Textures

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Belpois
Posts: 2
Joined: Sat Feb 16, 2013 7:01 pm

Textures

Post 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?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Textures

Post 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.
Belpois
Posts: 2
Joined: Sat Feb 16, 2013 7:01 pm

Re: Textures

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