Page 1 of 1

Piecemeal Textures

Posted: Thu Nov 30, 2006 7:13 pm
by gavicus
I expect that someone must have asked about this, but I haven't found it in search or in the API. So, sorry in advance if you're a "n00b" hater. :(

I'd like to place a texture on just part of a model or primitive.

For example, in many RPGs, if your character drops the leather armor and dons chainmail, you want to keep the face, hair, pants etc. but have to change the shirt texture. You wouldn't want to keep a ton of images that represent every conceivable combination of skin, shirt, pants, shoes, etc. so I'm assuming the ability to apply textures piecemeal exists, but I haven't found it.

Thanks in advance.

Posted: Thu Nov 30, 2006 10:44 pm
by vitek
In Irrlicht, textures are associated with materials, and materials are associated with mesh buffers. Once you have a mesh, you just need to find the index for the material you want to change, and then change the texture.

Code: Select all

  // this assumes that the first material is the shirt of the model that is
  // represented by node
  node->setMaterialTexture(1, driver->getTexture("media/yellowshirt.jpg"));
Travis