I am creating a 3D level editor which should be used to generate the very basic layout (level geometry) and a few basic game-logic entities of maps used in my game. So far, I decided to use voxels (i have a fbx untextured model file and do NOT draw this myself via vertices etc. as I already found tutorials on that which are not suitable for me) as the way to create the level geometry and most of this works fine. The next step would be to implement code that allows me to texturize these cubes by specifically applying textures to faces.
Using something like the following Draw method I can apply a Texture2D to the whole voxel (so I am not able to chose the face to which I want to apply the texture) and this works fine for now (though I have sometime issues orienting it, which should not be part of this question)
public void Draw() {
foreach(ModelMesh mesh in this.Model.Meshes) {
foreach(ModelMeshPart part in mesh.MeshParts) {
BasicEffect effect = (BasicEffect)part.Effect;
effect.World = this.World;
effect.View = Engine.View;
effect.Projection = Engine.Projection;
if(this.Texture != null) {
// UNLIT textures
effect.Texture = this.Texture;
effect.TextureEnabled = true;
} else
// LIT placeholder voxel
effect.EnableDefaultLighting();
}
mesh.Draw();
}
}
I will have about 10 textures which I want to be able to apply programmatically on each face of the voxels - which approach would you suggest me to achieve the desired result?