Page 1 of 1

feature Proposal: skin files, defining sets of materials

Posted: Tue May 04, 2010 7:59 am
by jonim8or
In a project I'm working on, there are several vehicles, which have multiple materials. One for the vehicle, one for the driver, one for the glass. still, the whole shape is a single mesh.
For these vehicles, I want to have multiple "skins" ( like in Quake 3 the players had multiple skins ).
Using setMaterial on an entity will set it to every submesh of the entity, which is not what I want. But to call setMaterial on the submeshes, my code will require more knowledge on the structure of the meshes, which would lead to some hardcoded setup.

My solution would be the following:
The "material" in the mesh file is just an understandable name, like "truck_chassis", "truck_glass", "truck_driver".
a skin file links these to the actual materials, e.g.

Code: Select all

default_skin="Red"
[Red]
truck_chassis="Truck/Red_chassis"
truck_glass="Truck/Glass"
truck_driver="Truck/Driver"
[Blue]
truck_chassis="Truck/Blue_chassis"
truck_glass="Truck/Glass"
truck_driver="Truck/Driver"
Then I'd like to extend the entity with a setSkin(String skinName) method, which would apply the materials to the submeshes in the way defined in the skin file. This would allow a more user-friendly way of using multiple materials in a mesh.

I'd like to hear your ideas on this before I start out implementing it. Do you have alternative solutions? or suggestions to make this solution better?

Re: feature Proposal: skin files, defining sets of materials

Posted: Tue May 04, 2010 4:24 pm
by Praetor
All of this sounds great and very easily doable outside of the core. You can use whatever format you want for your skin files, you can just query the entity for its named subentities and set their materials accordingly.