32#include "foundation/PxSimpleTypes.h"
33#include "foundation/PxIO.h"
34#include "common/PxPhysXCommonConfig.h"
35#include "foundation/PxUtilities.h"
41 PxU8* b =
reinterpret_cast<PxU8*
>(&v);
49 PxI8* b =
reinterpret_cast<PxI8*
>(&v);
57 PxU8* b =
reinterpret_cast<PxU8*
>(&v);
75 PxU8* b =
reinterpret_cast<PxU8*
>(&v);
85 PX_INLINE void writeChunk(PxI8 a, PxI8 b, PxI8 c, PxI8 d, PxOutputStream& stream)
87 stream.write(&a,
sizeof(PxI8));
88 stream.write(&b,
sizeof(PxI8));
89 stream.write(&c,
sizeof(PxI8));
90 stream.write(&d,
sizeof(PxI8));
93 void readChunk(PxI8& a, PxI8& b, PxI8& c, PxI8& d, PxInputStream& stream);
95 PxU16 readWord(
bool mismatch, PxInputStream& stream);
96 PxU32 readDword(
bool mismatch, PxInputStream& stream);
97 PxF32 readFloat(
bool mismatch, PxInputStream& stream);
99 void writeWord(PxU16 value,
bool mismatch, PxOutputStream& stream);
100 void writeDword(PxU32 value,
bool mismatch, PxOutputStream& stream);
101 void writeFloat(PxF32 value,
bool mismatch, PxOutputStream& stream);
103 bool readFloatBuffer(PxF32* dest, PxU32 nbFloats,
bool mismatch, PxInputStream& stream);
104 void writeFloatBuffer(
const PxF32* src, PxU32 nb,
bool mismatch, PxOutputStream& stream);
105 void writeWordBuffer(
const PxU16* src, PxU32 nb,
bool mismatch, PxOutputStream& stream);
106 void readWordBuffer(PxU16* dest, PxU32 nb,
bool mismatch, PxInputStream& stream);
107 void writeWordBuffer(
const PxI16* src, PxU32 nb,
bool mismatch, PxOutputStream& stream);
108 void readWordBuffer(PxI16* dest, PxU32 nb,
bool mismatch, PxInputStream& stream);
109 void writeByteBuffer(
const PxU8* src, PxU32 nb, PxOutputStream& stream);
110 void readByteBuffer(PxU8* dest, PxU32 nb, PxInputStream& stream);
112 bool writeHeader(PxI8 a, PxI8 b, PxI8 c, PxI8 d, PxU32 version,
bool mismatch, PxOutputStream& stream);
113 bool readHeader(PxI8 a, PxI8 b, PxI8 c, PxI8 d, PxU32& version,
bool& mismatch, PxInputStream& stream);
115 PX_INLINE bool readIntBuffer(PxU32* dest, PxU32 nbInts,
bool mismatch, PxInputStream& stream)
117 return readFloatBuffer(
reinterpret_cast<PxF32*
>(dest), nbInts, mismatch, stream);
120 PX_INLINE void writeIntBuffer(
const PxU32* src, PxU32 nb,
bool mismatch, PxOutputStream& stream)
122 writeFloatBuffer(
reinterpret_cast<const PxF32*
>(src), nb, mismatch, stream);
125 PX_INLINE bool ReadDwordBuffer(PxU32* dest, PxU32 nb,
bool mismatch, PxInputStream& stream)
127 return readFloatBuffer(
reinterpret_cast<float*
>(dest), nb, mismatch, stream);
130 PX_INLINE void WriteDwordBuffer(
const PxU32* src, PxU32 nb,
bool mismatch, PxOutputStream& stream)
132 writeFloatBuffer(
reinterpret_cast<const float*
>(src), nb, mismatch, stream);
135 PxU32 computeMaxIndex(
const PxU32* indices, PxU32 nbIndices);
136 PxU16 computeMaxIndex(
const PxU16* indices, PxU32 nbIndices);
137 void storeIndices(PxU32 maxIndex, PxU32 nbIndices,
const PxU32* indices, PxOutputStream& stream,
bool platformMismatch);
138 void readIndices(PxU32 maxIndex, PxU32 nbIndices, PxU32* indices, PxInputStream& stream,
bool platformMismatch);
141 PX_FORCE_INLINE bool readBigEndianVersionNumber(PxInputStream& stream,
bool mismatch_, PxU32& fileVersion,
bool& mismatch)
149 mismatch = (PxLittleEndian() == 1);
151 const PxU32 rawFileVersion = readDword(
false, stream);
152 if(rawFileVersion==1)
156 PX_ASSERT(!mismatch);
160 PxU32 fileVersionFlipped = rawFileVersion;
161 flip(fileVersionFlipped);
162 if(fileVersionFlipped==1)
171 mismatch = mismatch_;
172 fileVersion = mismatch_ ? fileVersionFlipped : rawFileVersion;
176 PX_ASSERT(fileVersion<=3);
185 bool WriteHeader(PxU8 a, PxU8 b, PxU8 c, PxU8 d, PxU32 version,
bool mismatch, PxOutputStream& stream);
186 bool ReadHeader(PxU8 a_, PxU8 b_, PxU8 c_, PxU8 d_, PxU32& version,
bool& mismatch, PxInputStream& stream);
188 void StoreIndices(PxU32 maxIndex, PxU32 nbIndices,
const PxU32* indices, PxOutputStream& stream,
bool platformMismatch);
189 void ReadIndices(PxU32 maxIndex, PxU32 nbIndices, PxU32* indices, PxInputStream& stream,
bool platformMismatch);
191 void StoreIndices(PxU16 maxIndex, PxU32 nbIndices,
const PxU16* indices, PxOutputStream& stream,
bool platformMismatch);
192 void ReadIndices(PxU16 maxIndex, PxU32 nbIndices, PxU16* indices, PxInputStream& stream,
bool platformMismatch);
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39