Page 1 of 1

Textures

Posted: Sat Feb 16, 2013 7:10 pm
by Belpois
Hello! I'm having problems loading textures. I have a 3D plane object loaded using Static Mesh

Code: Select all

Vector3[] staticTriangleVertices;
int[] staticTriangleIndices;
var model = game.Content.Load<Model>("Models/sample_terrain");
TriangleMesh.GetVerticesAndIndicesFromModel(model, out staticTriangleVertices, out staticTriangleIndices);
var staticMesh = new StaticMesh(staticTriangleVertices, staticTriangleIndices, new AffineTransform(new Vector3(100f, 100f, 100f), Quaternion.Identity, new Vector3(0, 0, 0)));
staticMesh.Sidedness = TriangleSidedness.Counterclockwise;

Space.Add(staticMesh);
((GameStart)game).ModelDrawer.Add(staticMesh);
How do I add the Texture2D to the static mesh?

Re: Textures

Posted: Sat Feb 16, 2013 8:56 pm
by Norbo
The StaticMesh is a physics object only. The physics engine is oblivious to graphics. The debug model drawer used by the BEPUphysicsDemos can visualize the physics, but it is not designed to support much in the way of graphical customization. To support custom graphical effects, you'll need a graphics implementation other than the default demos debug visualizer.

Re: Textures

Posted: Sun Feb 17, 2013 12:09 am
by Belpois
I see, thank you Norbo for pointing that out :) I managed to write a class that renders the texture after the static Mesh is added to the space.