Piecemeal Textures

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
gavicus
Posts: 16
Joined: Fri Aug 25, 2006 2:19 pm

Piecemeal Textures

Post 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.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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
Post Reply