PilzAdam wrote:content_cao.cpp:554
GenericCAO is used for players and LuaEntities.
content_cao.cpp
1293: if(m_animated_meshnode)
1294: {
1295: if(m_prop.visual == "mesh")
1296: {
1297: for (u32 i = 0; i < m_prop.textures.size() && i < m_animated_meshnode->getMaterialCount(); ++i)
.
.
1311: m_animated_meshnode->setMaterialTexture(i, texture);
m_animated_meshnode->getMaterialCount()PilzAdam wrote:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
m_animated_meshnode->getMaterialCount()
is 1, so only one texture can be applied.
Seems like only 1 texture per material is supported.
stu wrote:PilzAdam wrote:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
m_animated_meshnode->getMaterialCount()
is 1, so only one texture can be applied.
Seems like only 1 texture per material is supported.
Well I guess that would make sense but looking at irrlicht ISceneNode::getMaterialCount(); it shoud infact return zero unless its overridden by the derived class. I can't find where this done in minetest besides farmesh.cpp
I guess this is not going to be as easy as I thought :(
Thank you again for your help.
node->getMaterial(0).TextureLayer[0].Texture = driver->getTexture("wieldview_character.png");
node->getMaterial(1).TextureLayer[0].Texture = driver->getTexture("armor.png");
video::SMaterial& material_player = node->getMaterial(0);
video::SMaterial& material_armor = node->getMaterial(1);
material_player.setFlag(video::EMF_LIGHTING, false);
material_armor.setFlag(video::EMF_LIGHTING, false);
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
printf("Material Count: %d \n", node->getMaterialCount());
node->setMaterialTexture( 0, driver->getTexture("wieldview_character.png") );
node->setMaterialTexture( 1, driver->getTexture("armor.png") );
stu wrote:Ok well I think I am beginning to make some progress. It turns out that node->getMaterialCount() should do just exactly what it says; return the number of materials a model supplies. My model has 2 materials, therefore getMaterialCount returns 2.
I have proven this by applying the following to the irrlicht 'HelloWorld' example.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
node->getMaterial(0).TextureLayer[0].Texture = driver->getTexture("wieldview_character.png");
node->getMaterial(1).TextureLayer[0].Texture = driver->getTexture("armor.png");
video::SMaterial& material_player = node->getMaterial(0);
video::SMaterial& material_armor = node->getMaterial(1);
material_player.setFlag(video::EMF_LIGHTING, false);
material_armor.setFlag(video::EMF_LIGHTING, false);
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
printf("Material Count: %d \n", node->getMaterialCount());
This works fine in the example but for some reason only the first material is loaded when I use the same model in minetest.
My guess is that it has to do with how content.cao applies the material texture.
Notably this does NOT work when used with the example above.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
node->setMaterialTexture( 0, driver->getTexture("wieldview_character.png") );
node->setMaterialTexture( 1, driver->getTexture("armor.png") );
m_animated_meshnode->setMaterialTexture(i, texture);
m_animated_meshnode->setMaterial(i).TextureLayer[0].Texture = texture;
stu wrote:Yay, I changed:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.To:
- Code: Select all
m_animated_meshnode->setMaterialTexture(i, texture);Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
m_animated_meshnode->setMaterial(i).TextureLayer[0].Texture = texture;
Recompiled and it works! :D
Do you think that would be accepted as a pull request?
RealBadAngel wrote:I used multitextured objects already without problems.
if model comes with materials defined in it (like .x model for example) engine will load textures defined here, without even need to mention them in code.
// Set material flags and texture
m_animated_meshnode->getMaterial(i).TextureLayer[0].Texture = texture;
Jordach wrote:I was thinking something like this could make custom skins even further refined:
You could have one texture for eyes, hair, hats, clothes etc and no one will have a pron skin ever.
linkstu wrote:Jordach wrote:I was thinking something like this could make custom skins even further refined:
You could have one texture for eyes, hair, hats, clothes etc and no one will have a pron skin ever.
Sure, there are lots of possibilities for this if it gets added.
Anyway I just made my very first pull request...and I mean like ever!
Hope I got it right.
We never even did ANYTHING.jojoa1997 wrote:linkstu wrote:Jordach wrote:I was thinking something like this could make custom skins even further refined:
You could have one texture for eyes, hair, hats, clothes etc and no one will have a pron skin ever.
Sure, there are lots of possibilities for this if it gets added.
Anyway I just made my very first pull request...and I mean like ever!
Hope I got it right.


PilzAdam wrote:Merged, will be in 0.4.7
// Set material flags and texture
video::SMaterial& material = m_animated_meshnode->getMaterial(i);
material.TextureLayer[0].Texture = texture;
material.setFlag(video::EMF_LIGHTING, false);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
visual = "mesh",
mesh = "heli.x",
textures = {"wool_red.png", "heli.png", "wool_blue.png"},

Inocudom wrote:Here is to hoping that this feature will be in Minetest one day.
MirceaKitsune wrote:I added model support to Minetest (or rather connected the Irrlicht functions to the Minetest code). The intention was for models to support multiple materials, and for Lua to assign any texture to each. I'm surprised the texture list I initially coded doesn't work, although I never got around to testing it. I hope this fixes the problem... it would suck not to be able to use multiple mesh materials properly.
stu wrote:Potential next-generation wieldview & armor mods if this patch is merged.
Fully compatible with HDX texture packs.
Otherwise not possible!
Mito551 wrote:stu wrote:Potential next-generation wieldview & armor mods if this patch is merged.
Fully compatible with HDX texture packs.
Otherwise not possible!
is this mt or mc?
1) MC doesn't have shields.Mito551 wrote:stu wrote:Potential next-generation wieldview & armor mods if this patch is merged.
Fully compatible with HDX texture packs.
Otherwise not possible!
is this mt or mc?
Users browsing this forum: No registered users and 18 guests