public void UpdateVoxelTextures(MyMwcVoxelMaterialsEnum material) { m_multimaterial = false; // Get with lazy-load MyVoxelMaterial voxelMaterial = MyVoxelMaterials.Get(material); MyVoxelMaterialTextures voxelTexture = voxelMaterial.GetTextures(); if (MyRender.DebugDiffuseTexture) { m_D3DEffect.SetTexture(m_textureDiffuseForAxisXZ, (Texture)MyRender.GetDebugTexture()); m_D3DEffect.SetTexture(m_textureDiffuseForAxisY, (Texture)MyRender.GetDebugTexture()); } else { m_D3DEffect.SetTexture(m_textureDiffuseForAxisXZ, (Texture)voxelTexture.TextureDiffuseForAxisXZ); m_D3DEffect.SetTexture(m_textureDiffuseForAxisY, (Texture)voxelTexture.TextureDiffuseForAxisY); } if (MyRender.DebugNormalTexture) { m_D3DEffect.SetTexture(m_textureNormalMapForAxisXZ, (Texture)MyRender.GetDebugNormalTexture()); m_D3DEffect.SetTexture(m_textureNormalMapForAxisY, (Texture)MyRender.GetDebugNormalTexture()); } else { m_D3DEffect.SetTexture(m_textureNormalMapForAxisXZ, (Texture)voxelTexture.TextureNormalMapForAxisXZ); m_D3DEffect.SetTexture(m_textureNormalMapForAxisY, (Texture)voxelTexture.TextureNormalMapForAxisY); } m_D3DEffect.SetValue(m_specularIntensity, voxelMaterial.SpecularIntensity); m_D3DEffect.SetValue(m_specularPower, voxelMaterial.SpecularPower); }
public static void LoadContent() { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyDebrisField.LoadContent"); MyVoxelMaterial voxelMaterial = MyVoxelMaterials.Get(MyMwcVoxelMaterialsEnum.Indestructible_01); MyVoxelMaterialTextures voxelTexture = voxelMaterial.GetTextures(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }
public void UpdateVoxelMultiTextures(MyMwcVoxelMaterialsEnum mat0, MyMwcVoxelMaterialsEnum?mat1, MyMwcVoxelMaterialsEnum?mat2) { m_multimaterial = false; // Get with lazy-load // Material 0 MyVoxelMaterial voxelMaterial = MyVoxelMaterials.Get(mat0); MyVoxelMaterialTextures voxelTexture = voxelMaterial.GetTextures(); m_D3DEffect.SetTexture(m_textureDiffuseForAxisXZ, (Texture)voxelTexture.TextureDiffuseForAxisXZ); m_D3DEffect.SetTexture(m_textureNormalMapForAxisXZ, (Texture)voxelTexture.TextureNormalMapForAxisXZ); m_D3DEffect.SetTexture(m_textureDiffuseForAxisY, (Texture)voxelTexture.TextureDiffuseForAxisY); m_D3DEffect.SetTexture(m_textureNormalMapForAxisY, (Texture)voxelTexture.TextureNormalMapForAxisY); m_D3DEffect.SetValue(m_specularIntensity, voxelMaterial.SpecularIntensity); m_D3DEffect.SetValue(m_specularPower, voxelMaterial.SpecularPower); // Material 1 if (mat1.HasValue) { m_multimaterial = true; MyVoxelMaterial voxelMaterial2 = MyVoxelMaterials.Get(mat1.Value); MyVoxelMaterialTextures voxelTexture2 = voxelMaterial2.GetTextures(); m_D3DEffect.SetTexture(m_textureDiffuseForAxisXZ2, (Texture)voxelTexture2.TextureDiffuseForAxisXZ); m_D3DEffect.SetTexture(m_textureNormalMapForAxisXZ2, (Texture)voxelTexture2.TextureNormalMapForAxisXZ); m_D3DEffect.SetTexture(m_textureDiffuseForAxisY2, (Texture)voxelTexture2.TextureDiffuseForAxisY); m_D3DEffect.SetTexture(m_textureNormalMapForAxisY2, (Texture)voxelTexture2.TextureNormalMapForAxisY); m_D3DEffect.SetValue(m_specularIntensity2, voxelMaterial2.SpecularIntensity); m_D3DEffect.SetValue(m_specularPower2, voxelMaterial2.SpecularPower); } // Material 2 if (mat2.HasValue) { m_multimaterial = true; MyVoxelMaterial voxelMaterial3 = MyVoxelMaterials.Get(mat2.Value); MyVoxelMaterialTextures voxelTexture3 = voxelMaterial3.GetTextures(); m_D3DEffect.SetTexture(m_textureDiffuseForAxisXZ3, (Texture)voxelTexture3.TextureDiffuseForAxisXZ); m_D3DEffect.SetTexture(m_textureNormalMapForAxisXZ3, (Texture)voxelTexture3.TextureNormalMapForAxisXZ); m_D3DEffect.SetTexture(m_textureDiffuseForAxisY3, (Texture)voxelTexture3.TextureDiffuseForAxisY); m_D3DEffect.SetTexture(m_textureNormalMapForAxisY3, (Texture)voxelTexture3.TextureNormalMapForAxisY); m_D3DEffect.SetValue(m_specularIntensity3, voxelMaterial3.SpecularIntensity); m_D3DEffect.SetValue(m_specularPower3, voxelMaterial3.SpecularPower); } }