NormalMapMaterialDesc looks like this
[source=cpp]class NormalMapMaterialDesc{public: NormalMapMaterialDesc(); virtual ~NormalMapMaterialDesc(); BitmapData* DiffuseMap; BitmapData* NormalMap; BitmapData* SpecularMap; float Shininess;};
NormalMapMaterialDesc is registered as a value type. The object properties are registered like:
[source=cpp]int r;r = engine->RegisterObjectProperty("NormalMapMaterialDesc", "BitmapData@ DiffuseMap", offsetof(NormalMapMaterialDesc, DiffuseMap));assert( r >= 0 );r = engine->RegisterObjectProperty("NormalMapMaterialDesc", "BitmapData@ NormalMap", offsetof(NormalMapMaterialDesc, NormalMap));assert( r >= 0 );r = engine->RegisterObjectProperty("NormalMapMaterialDesc", "BitmapData@ SpecularMap", offsetof(NormalMapMaterialDesc, SpecularMap));assert( r >= 0 );r = engine->RegisterObjectProperty("NormalMapMaterialDesc", "float Shininess", offsetof(NormalMapMaterialDesc, Shininess));assert( r >= 0 );
level.bitmapManager().Load() returns a BitmapData* (BitmapData@)
// I need to get the handle of materialDesc.DiffuseMap. I want to set it with the return value of level.bitmapManager().Load(). Now I get an exception saying "Null pointer access" I have tried putting the @ at various places but all my effords have failed.
[source=cpp]NormalMapMaterialDesc materialDesc;materialDesc.DiffuseMap = level.bitmapManager().Load("Images/Stone_D.png");materialDesc.NormalMap = level.bitmapManager().Load("Images/Stone_N.png");materialDesc.SpecularMap = level.bitmapManager().Load("Images/Stone_S.png");materialDesc.Shininess = 66.0f;