Go to the documentation of this file.
14 #ifndef PX_PHYSICS_METADATA_H
15 #define PX_PHYSICS_METADATA_H
46 #define PX_STORE_METADATA(stream, metaData) stream.write(&metaData, sizeof(PxMetaDataEntry))
51 #define PX_DEF_BIN_METADATA_ITEM(stream, Class, type, name, flags) \
53 PxMetaDataEntry tmp = { #type, #name, (PxU32)PX_OFFSET_OF(Class, name), PX_SIZE_OF(Class, name), \
55 PX_STORE_METADATA(stream, tmp); \
62 #define PX_DEF_BIN_METADATA_ITEMS(stream, Class, type, name, flags, count) \
64 PxMetaDataEntry tmp = { #type, #name, (PxU32)PX_OFFSET_OF(Class, name), PX_SIZE_OF(Class, name), \
65 count, 0, flags, 0}; \
66 PX_STORE_METADATA(stream, tmp); \
74 #define PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Class, type, name, flags) \
76 PxMetaDataEntry tmp = { #type, #name, (PxU32)PX_OFFSET_OF(Class, name), PX_SIZE_OF(Class, name), \
77 sizeof(((Class*)0)->name)/sizeof(type), 0, flags, 0}; \
78 PX_STORE_METADATA(stream, tmp); \
84 #define PX_DEF_BIN_METADATA_CLASS(stream, Class) \
86 PxMetaDataEntry tmp = { #Class, 0, 0, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS, 0 }; \
87 PX_STORE_METADATA(stream, tmp); \
93 #define PX_DEF_BIN_METADATA_VCLASS(stream, Class) \
95 PxMetaDataEntry tmp = { #Class, 0, 0, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS|PxMetaDataFlag::eVIRTUAL, 0}; \
96 PX_STORE_METADATA(stream, tmp); \
102 #define PX_DEF_BIN_METADATA_TYPEDEF(stream, newType, oldType) \
104 PxMetaDataEntry tmp = { #newType, #oldType, 0, 0, 0, 0, PxMetaDataFlag::eTYPEDEF, 0 }; \
105 PX_STORE_METADATA(stream, tmp); \
111 #define PX_DEF_BIN_METADATA_BASE_CLASS(stream, Class, BaseClass) \
113 Class* myClass = reinterpret_cast<Class*>(42); \
114 BaseClass* s = static_cast<BaseClass*>(myClass); \
115 const PxU32 offset = PxU32(size_t(s) - size_t(myClass)); \
116 PxMetaDataEntry tmp = { #Class, #BaseClass, offset, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS, 0 }; \
117 PX_STORE_METADATA(stream, tmp); \
123 #define PX_DEF_BIN_METADATA_UNION(stream, Class, name) \
125 PxMetaDataEntry tmp = { #Class, 0, (PxU32)PX_OFFSET_OF(Class, name), PX_SIZE_OF(Class, name), \
126 1, 0, PxMetaDataFlag::eUNION, 0 }; \
127 PX_STORE_METADATA(stream, tmp); \
133 #define PX_DEF_BIN_METADATA_UNION_TYPE(stream, Class, type, enumValue) \
135 PxMetaDataEntry tmp = { #Class, #type, enumValue, 0, 0, 0, PxMetaDataFlag::eUNION, 0 }; \
136 PX_STORE_METADATA(stream, tmp); \
142 #define PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, Class, type, control, align) \
144 PxMetaDataEntry tmp = { #type, 0, (PxU32)PX_OFFSET_OF(Class, control), sizeof(type), 0, (PxU32)PX_SIZE_OF(Class, control), \
145 PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEM, align }; \
146 PX_STORE_METADATA(stream, tmp); \
152 #define PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, Class, type, control, count, flags, align) \
154 PxMetaDataEntry tmp = { #type, 0, (PxU32)PX_OFFSET_OF(Class, control), (PxU32)PX_SIZE_OF(Class, control), \
155 (PxU32)PX_OFFSET_OF(Class, count), (PxU32)PX_SIZE_OF(Class, count), \
156 PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEMS|flags, align }; \
157 PX_STORE_METADATA(stream, tmp); \
165 #define PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, Class, type, control, controlMask ,count, flags, align) \
167 PxMetaDataEntry tmp = { #type, 0, (PxU32)PX_OFFSET_OF(Class, control), (PxU32)PX_SIZE_OF(Class, control), \
168 (PxU32)PX_OFFSET_OF(Class, count), (PxU32)PX_SIZE_OF(Class, count), \
169 PxMetaDataFlag::eCONTROL_MASK|PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEMS|flags|(controlMask & PxMetaDataFlag::eCONTROL_MASK_RANGE) << 16, \
171 PX_STORE_METADATA(stream, tmp); \
178 #define PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Class, type, dyn_count, align, flags) \
180 PxMetaDataEntry tmp = { #type, 0, (PxU32)PX_OFFSET_OF(Class, dyn_count), PX_SIZE_OF(Class, dyn_count), align, 0, \
181 PxMetaDataFlag::eEXTRA_DATA|flags, align }; \
182 PX_STORE_METADATA(stream, tmp); \
188 #define PX_DEF_BIN_METADATA_EXTRA_NAME(stream, Class, control, align) \
190 PxMetaDataEntry tmp = { "char", "string", 0, 0, 0, 0, PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_NAME, align }; \
191 PX_STORE_METADATA(stream, tmp); \
197 #define PX_DEF_BIN_METADATA_EXTRA_ALIGN(stream, Class, align) \
199 PxMetaDataEntry tmp = { "PxU8", "Alignment", 0, 0, 0, 0, PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eALIGNMENT, align}; \
200 PX_STORE_METADATA(stream, tmp); \
Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com