RavEngine
Loading...
Searching...
No Matches
SnConvX_Output.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26
27#ifndef SN_CONVX_OUTPUT_H
28#define SN_CONVX_OUTPUT_H
29
30#include "foundation/PxSimpleTypes.h"
31
32namespace physx { namespace Sn {
33
34 struct PxMetaDataEntry;
35 class ConvX;
36
37 typedef void (Sn::ConvX::*ConvertCallback) (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry);
38
39 inline_ void flip(PxI16& v)
40 {
41 PxI8* b = reinterpret_cast<PxI8*>(&v);
42 PxI8 temp = b[0];
43 b[0] = b[1];
44 b[1] = temp;
45 }
46
47 inline_ void flip(PxU16& v)
48 {
49 flip(reinterpret_cast<PxI16&>(v));
50 }
51
52 inline_ void flip32(PxI8* b)
53 {
54 PxI8 temp = b[0];
55 b[0] = b[3];
56 b[3] = temp;
57 temp = b[1];
58 b[1] = b[2];
59 b[2] = temp;
60 }
61
62 inline_ void flip(PxI32& v)
63 {
64 PxI8* b = reinterpret_cast<PxI8*>(&v);
65 flip32(b);
66 }
67
68 inline_ void flip(PxU32& v)
69 {
70 PxI8* b = reinterpret_cast<PxI8*>(&v);
71 flip32(b);
72 }
73
74 inline_ void flip(PxI64& v)
75 {
76 PxI8* b = reinterpret_cast<PxI8*>(&v);
77
78 PxI8 temp = b[0];
79 b[0] = b[7];
80 b[7] = temp;
81 temp = b[1];
82 b[1] = b[6];
83 b[6] = temp;
84 temp = b[2];
85 b[2] = b[5];
86 b[5] = temp;
87 temp = b[3];
88 b[3] = b[4];
89 b[4] = temp;
90 }
91
92 inline_ void flip(PxF32& v)
93 {
94 PxI8* b = reinterpret_cast<PxI8*>(&v);
95 flip32(b);
96 }
97
98 inline_ void flip(void*& v)
99 {
100 PxI8* b = reinterpret_cast<PxI8*>(&v);
101 flip32(b);
102 }
103
104 inline_ void flip(const PxI8*& v)
105 {
106 PxI8* b = const_cast<PxI8*>(v);
107 flip32(b);
108 }
109} }
110
111#endif
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39