31 #ifndef PX_PHYSICS_METADATA_H 32 #define PX_PHYSICS_METADATA_H 64 #define PX_STORE_METADATA(stream, metaData) stream.write(&metaData, sizeof(PxMetaDataEntry)) 66 #define PX_SIZE_OF(Class, Member) sizeof((reinterpret_cast<Class*>(0))->Member) 71 #define PX_DEF_BIN_METADATA_ITEM(stream, Class, type, name, flags) \ 73 PxMetaDataEntry tmp = { #type, #name, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ 75 PX_STORE_METADATA(stream, tmp); \ 82 #define PX_DEF_BIN_METADATA_ITEMS(stream, Class, type, name, flags, count) \ 84 PxMetaDataEntry tmp = { #type, #name, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ 85 count, 0, flags, 0}; \ 86 PX_STORE_METADATA(stream, tmp); \ 94 #define PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Class, type, name, flags) \ 96 PxMetaDataEntry tmp = { #type, #name, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ 97 sizeof((reinterpret_cast<Class*>(0))->name)/sizeof(type), 0, flags, 0}; \ 98 PX_STORE_METADATA(stream, tmp); \ 104 #define PX_DEF_BIN_METADATA_CLASS(stream, Class) \ 106 PxMetaDataEntry tmp = { #Class, 0, 0, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS, 0 }; \ 107 PX_STORE_METADATA(stream, tmp); \ 113 #define PX_DEF_BIN_METADATA_VCLASS(stream, Class) \ 115 PxMetaDataEntry tmp = { #Class, 0, 0, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS|PxMetaDataFlag::eVIRTUAL, 0}; \ 116 PX_STORE_METADATA(stream, tmp); \ 122 #define PX_DEF_BIN_METADATA_TYPEDEF(stream, newType, oldType) \ 124 PxMetaDataEntry tmp = { #newType, #oldType, 0, 0, 0, 0, PxMetaDataFlag::eTYPEDEF, 0 }; \ 125 PX_STORE_METADATA(stream, tmp); \ 131 #define PX_DEF_BIN_METADATA_BASE_CLASS(stream, Class, BaseClass) \ 133 Class* myClass = reinterpret_cast<Class*>(42); \ 134 BaseClass* s = static_cast<BaseClass*>(myClass); \ 135 const PxU32 offset = PxU32(size_t(s) - size_t(myClass)); \ 136 PxMetaDataEntry tmp = { #Class, #BaseClass, offset, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS, 0 }; \ 137 PX_STORE_METADATA(stream, tmp); \ 143 #define PX_DEF_BIN_METADATA_UNION(stream, Class, name) \ 145 PxMetaDataEntry tmp = { #Class, 0, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ 146 1, 0, PxMetaDataFlag::eUNION, 0 }; \ 147 PX_STORE_METADATA(stream, tmp); \ 153 #define PX_DEF_BIN_METADATA_UNION_TYPE(stream, Class, type, enumValue) \ 155 PxMetaDataEntry tmp = { #Class, #type, enumValue, 0, 0, 0, PxMetaDataFlag::eUNION, 0 }; \ 156 PX_STORE_METADATA(stream, tmp); \ 162 #define PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, Class, type, control, align) \ 164 PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, control)), sizeof(type), 0, PxU32(PX_SIZE_OF(Class, control)), \ 165 PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEM, align }; \ 166 PX_STORE_METADATA(stream, tmp); \ 172 #define PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, Class, type, control, count, flags, align) \ 174 PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, control)), PxU32(PX_SIZE_OF(Class, control)), \ 175 PxU32(PX_OFFSET_OF_RT(Class, count)), PxU32(PX_SIZE_OF(Class, count)), \ 176 PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEMS|flags, align }; \ 177 PX_STORE_METADATA(stream, tmp); \ 185 #define PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, Class, type, control, controlMask ,count, flags, align) \ 187 PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, control)), PxU32(PX_SIZE_OF(Class, control)), \ 188 PxU32(PX_OFFSET_OF_RT(Class, count)), PxU32(PX_SIZE_OF(Class, count)), \ 189 PxMetaDataFlag::eCONTROL_MASK|PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEMS|flags|(controlMask & PxMetaDataFlag::eCONTROL_MASK_RANGE) << 16, \ 191 PX_STORE_METADATA(stream, tmp); \ 198 #define PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Class, type, dyn_count, align, flags) \ 200 PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, dyn_count)), PX_SIZE_OF(Class, dyn_count), align, 0, \ 201 PxMetaDataFlag::eEXTRA_DATA|flags, align }; \ 202 PX_STORE_METADATA(stream, tmp); \ 208 #define PX_DEF_BIN_METADATA_EXTRA_NAME(stream, Class, control, align) \ 210 PxMetaDataEntry tmp = { "char", "string", 0, 0, 0, 0, PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_NAME, align }; \ 211 PX_STORE_METADATA(stream, tmp); \ 217 #define PX_DEF_BIN_METADATA_EXTRA_ALIGN(stream, Class, align) \ 219 PxMetaDataEntry tmp = { "PxU8", "Alignment", 0, 0, 0, 0, PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eALIGNMENT, align}; \ 220 PX_STORE_METADATA(stream, tmp); \ Definition: GuContactBuffer.h:37
PxU32 count
Number of items of type Type (0 for dynamic sizes)
Definition: PxMetaData.h:58
PxU32 alignment
Explicit alignment.
Definition: PxMetaData.h:61
PxU32 offset
Offset from the start of the class (ie from "this", field is located at "this"+Offset) ...
Definition: PxMetaData.h:56
const char * type
Field type (bool, byte, quaternion, etc)
Definition: PxMetaData.h:54
PxU32 flags
Field parameters.
Definition: PxMetaData.h:60
const char * name
Field name (appears exactly as in the source file)
Definition: PxMetaData.h:55
uint32_t PxU32
Definition: Px.h:48
Struct to store meta data definitions.
Definition: PxMetaData.h:52
PxU32 offsetSize
Offset of dynamic size param, for dynamic arrays.
Definition: PxMetaData.h:59
PxU32 size
sizeof(Type)
Definition: PxMetaData.h:57