I worked a bit with mesh buffers and I realised that there are set methodes for the mesh buffer materials (setMaterialTexture, setMaterialFlag, setMaterialType) but there are no get methodes...
then I sound out that this could be maybe because with the set methodes you set the flag, type and texture for all mesh buffers the same...
I don't know why there are no get methodes and why you can't set type, flag and texture for a single buffer ???
so I implemented this for me...
you don't need to recompile the engine, you just need to edit the ISceneNode.h file !!!
so open ISceneNode.h, find the public part and add this lines:
Code: Select all
class ISceneNode : public io::IAttributeExchangingObject
{
public:
// new functions start
void setMaterialFlag(u32 idMBuffer, video::E_MATERIAL_FLAG flag, bool newvalue){
if(idMBuffer < getMaterialCount()) getMaterial(idMBuffer).setFlag(flag, newvalue);
}
bool getMaterialFlag(u32 idMBuffer, video::E_MATERIAL_FLAG flag){
if(idMBuffer < getMaterialCount()) return getMaterial(idMBuffer).getFlag(flag);
return false;
}
void setMaterialTexture(u32 idMBuffer, u32 textureLayer, video::ITexture* texture){
if(textureLayer >= video::MATERIAL_MAX_TEXTURES) return;
if(idMBuffer < getMaterialCount()) getMaterial(idMBuffer).setTexture(textureLayer, texture);
}
video::ITexture* getMaterialTexture(u32 idMBuffer, u32 textureLayer){
if(textureLayer >= video::MATERIAL_MAX_TEXTURES) return 0;
if(idMBuffer < getMaterialCount()) return getMaterial(idMBuffer).getTexture(textureLayer);
return 0;
}
void setMaterialType(u32 idMBuffer, video::E_MATERIAL_TYPE newType){
if(idMBuffer < getMaterialCount()) getMaterial(idMBuffer).MaterialType = newType;
}
video::E_MATERIAL_TYPE getMaterialType(u32 idMBuffer){
if(idMBuffer < getMaterialCount()) return getMaterial(idMBuffer).MaterialType;
return video::EMT_SOLID;
}
// new functions endthis will also be a new extension, but because this is realy simple I thought to post this here in the code snippets forum, too
