public int GetUtilShaderIndex(UtilityShader us) { int shader_index = 0; switch (us) { case UtilityShader.NX: shader_index = 1; break; case UtilityShader.NY: shader_index = 2; break; case UtilityShader.NZ: shader_index = 3; break; case UtilityShader.PX: shader_index = 4; break; case UtilityShader.PY: shader_index = 5; break; case UtilityShader.PZ: shader_index = 6; break; } return(shader_index); }
public void RegisterUtilityShader(UtilityShader us) { m_ShaderIndex = MdxRender.SM.GetUtilShaderIndex(us); }
public void LoadDefaultModel(UtilityShader skin) { float scale = 0.1f; //create a cube model m_MeshList = new EnhancedMesh[1][]; m_MeshList[0] = new EnhancedMesh[1]; m_MeshList[0][0] = new EnhancedMesh(12); m_MeshList[0][0].AllocateVertexBuffer(MeshFormat.Model, 36); //back face (0,1,2) (3,4,5) m_MeshList[0][0].RegisterUtilityShader(skin); m_MeshList[0][0].LoadVertex(0, -scale, -scale, scale, -1, 0, 0, 0, 1); m_MeshList[0][0].LoadVertex(1, -scale, scale, scale, -1, 0, 0, 1, 1); m_MeshList[0][0].LoadVertex(2, -scale, -scale, -scale, -1, 0, 0, 0, 0); m_MeshList[0][0].LoadVertex(3, -scale, scale, scale, -1, 0, 0, 1, 1); m_MeshList[0][0].LoadVertex(4, -scale, scale, -scale, -1, 0, 0, 1, 0); m_MeshList[0][0].LoadVertex(5, -scale, -scale, -scale, -1, 0, 0, 0, 0); //right face (6,7,8) (9,10,11) m_MeshList[0][0].LoadVertex(6, -scale, scale, scale, 0, 1, 0, 0, 1); m_MeshList[0][0].LoadVertex(7, scale, scale, scale, 0, 1, 0, 1, 1); m_MeshList[0][0].LoadVertex(8, -scale, scale, -scale, 0, 1, 0, 0, 0); m_MeshList[0][0].LoadVertex(9, scale, scale, scale, 0, 1, 0, 1, 1); m_MeshList[0][0].LoadVertex(10, scale, scale, -scale, 0, 1, 0, 1, 0); m_MeshList[0][0].LoadVertex(11, -scale, scale, -scale, 0, 1, 0, 0, 0); //left face (12,13,14) (15,16,17) m_MeshList[0][0].LoadVertex(12, scale, -scale, scale, 0, -1, 0, 0, 1); m_MeshList[0][0].LoadVertex(13, -scale, -scale, scale, 0, -1, 0, 1, 1); m_MeshList[0][0].LoadVertex(14, scale, -scale, -scale, 0, -1, 0, 0, 0); m_MeshList[0][0].LoadVertex(15, -scale, -scale, scale, 0, -1, 0, 1, 1); m_MeshList[0][0].LoadVertex(16, -scale, -scale, -scale, 0, -1, 0, 1, 0); m_MeshList[0][0].LoadVertex(17, scale, -scale, -scale, 0, -1, 0, 0, 0); //front face (18,19,20) (21,22,23) m_MeshList[0][0].LoadVertex(18, scale, scale, scale, 1, 0, 0, 0, 1); m_MeshList[0][0].LoadVertex(19, scale, -scale, scale, 1, 0, 0, 1, 1); m_MeshList[0][0].LoadVertex(20, scale, scale, -scale, 1, 0, 0, 0, 0); m_MeshList[0][0].LoadVertex(21, scale, -scale, scale, 1, 0, 0, 1, 1); m_MeshList[0][0].LoadVertex(22, scale, -scale, -scale, 1, 0, 0, 1, 0); m_MeshList[0][0].LoadVertex(23, scale, scale, -scale, 1, 0, 0, 0, 0); //top face (24,25,26) (27,28,29) m_MeshList[0][0].LoadVertex(24, scale, scale, scale, 0, 0, 1, 0, 1); m_MeshList[0][0].LoadVertex(25, -scale, scale, scale, 0, 0, 1, 1, 1); m_MeshList[0][0].LoadVertex(26, scale, -scale, scale, 0, 0, 1, 0, 0); m_MeshList[0][0].LoadVertex(27, -scale, scale, scale, 0, 0, 1, 1, 1); m_MeshList[0][0].LoadVertex(28, -scale, -scale, scale, 0, 0, 1, 1, 0); m_MeshList[0][0].LoadVertex(29, scale, -scale, scale, 0, 0, 1, 0, 0); //bottom face (30,31,32) (33,34,35) m_MeshList[0][0].LoadVertex(30, -scale, scale, -scale, 0, 0, -1, 0, 1); m_MeshList[0][0].LoadVertex(31, scale, scale, -scale, 0, 0, -1, 1, 1); m_MeshList[0][0].LoadVertex(32, -scale, -scale, -scale, 0, 0, -1, 0, 0); m_MeshList[0][0].LoadVertex(33, scale, scale, -scale, 0, 0, -1, 1, 1); m_MeshList[0][0].LoadVertex(34, scale, -scale, -scale, 0, 0, -1, 1, 0); m_MeshList[0][0].LoadVertex(35, -scale, -scale, -scale, 0, 0, -1, 0, 0); m_MeshList[0][0].UpdateDxBuffer(); m_MeshList[0][0].AllocateAndSetIndexBuffer(PrimitiveType.TriangleList, Model3D.m_BoxIndices, 0, Model3D.m_BoxIndices.Length); m_Regions = new Region[1]; m_Regions[0] = new Region(); m_Regions[0].Name = "default cube"; m_Regions[0].Permutations = new Permutation[1]; m_Regions[0].Permutations[0] = new Permutation(); m_Regions[0].Permutations[0].LodMeshIndex[0] = 0; m_Regions[0].Permutations[0].LodMeshIndex[1] = 0; m_Regions[0].Permutations[0].LodMeshIndex[2] = 0; m_Regions[0].Permutations[0].LodMeshIndex[3] = 0; m_Regions[0].Permutations[0].LodMeshIndex[4] = 0; m_Regions[0].Permutations[0].LodMeshIndex[5] = 0; m_Regions[0].Permutations[0].Name = "default"; }