Exemple #1
0
        public void UpdateVoxelMultiTextures(byte mat0, byte?mat1, byte?mat2)
        {
            m_multimaterial = false;
            //  Get with lazy-load
            // Material 0
            MyRenderVoxelMaterial   voxelMaterial = MyRenderVoxelMaterials.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;
                MyRenderVoxelMaterial   voxelMaterial2 = MyRenderVoxelMaterials.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;

                MyRenderVoxelMaterial   voxelMaterial3 = MyRenderVoxelMaterials.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);
            }
        }
        public void UpdateVoxelTextures(byte material)
        {
            m_multimaterial = false;

            //  Get with lazy-load
            MyRenderVoxelMaterial   voxelMaterial = MyRenderVoxelMaterials.Get(material);
            MyVoxelMaterialTextures voxelTexture  = voxelMaterial.GetTextures();

            m_D3DEffect.SetTexture(m_textureDiffuseForAxisXZ, (Texture)voxelTexture.TextureDiffuseForAxisXZ);
            m_D3DEffect.SetTexture(m_textureDiffuseForAxisY, (Texture)voxelTexture.TextureDiffuseForAxisY);

            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);
        }