XMesh with multiple alpha materials

All about the core api and animation, input, sound, effect, collision and physics engines.
You can also post here your feature requests.

Moderator: Brume Dev Team

XMesh with multiple alpha materials

Postby GeneralFailure on Sat Nov 08, 2008 9:29 pm

Hi,
first let me tell you, I just discovered this project and it is amazing. Great job!
I started playing with it and discovered a potential problem with XMeshes with alpha enabled materials. I loaded an XMesh I made earlier which has 6 materials, with the second and third having an alpha value (e.g. the propeller).
Image
When setting the RenderState to
myObject.RenderStates.AlphaBlending = BrumeRenderParams.ALPHABLENDING_INVERTSOURCE;
I got an IndexOutOfRangeException in BruceMainRenderer.StoreHierarchyAlphas on the line newPos = geo.positions[isub].
The cause is that the positions array is always initialized to length 1, while the renderer checks at the position of the subset. So I changed the lines
Code: Select all
geometry.positions = new BrumeVector[1];
geometry.positions[0] = new BrumeVector(0, 0, 0);

in BruceXMesh.CreateMeshContainer to
Code: Select all
geometry.positions = new BrumeVector[materials.Length];
for (int i = 0; i < materials.Length; i++)
      geometry.positions[i] = new BrumeVector(0, 0, 0);

and now it works fine!

PS. if you want to test, the mesh and texture can be downloaded from
http://playinginthedark.net/downloads/extra300s.x and
http://playinginthedark.net/downloads/extra.jpg.
GeneralFailure
Brume Rookie
 
Posts: 1
Joined: Sat Nov 08, 2008 9:08 pm

Re: XMesh with multiple alpha materials

Postby Silmaryls on Tue Nov 25, 2008 10:09 pm

Hi,

Thank you very much. I will change that for next release.

Silmaryls
User avatar
Silmaryls
Brume Team Member
 
Posts: 340
Joined: Tue Feb 21, 2006 10:09 pm
Location: Paris - France


Return to Technical discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron