本文整理汇总了C#中Material.GetMaterialTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Material.GetMaterialTexture方法的具体用法?C# Material.GetMaterialTexture怎么用?C# Material.GetMaterialTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Material
的用法示例。
在下文中一共展示了Material.GetMaterialTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyMaterial
private void ApplyMaterial(Material mat, ref OpenGL gl)
{
if (mat.GetMaterialTextureCount(TextureType.Diffuse) > 0)
{
TextureSlot tex = new TextureSlot();
mat.GetMaterialTexture(TextureType.Diffuse, 0, out tex);
LoadModelAsset(tex.FilePath, ref gl);
}
Color4 color = new Color4(.8f, .8f, .8f, 1.0f);
if (mat.HasColorDiffuse)
{
// color = FromColor(mat.ColorDiffuse);
}
var colorf = new float[4];
color4_to_float4(color, colorf);
gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_DIFFUSE, colorf);
color = new Color4(0, 0, 0, 1.0f);
if (mat.HasColorSpecular)
{
color = FromColor(mat.ColorSpecular);
}
gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_SPECULAR, colorf);
color = new Color4(.2f, .2f, .2f, 1.0f);
if (mat.HasColorAmbient)
{
color = FromColor(mat.ColorAmbient);
}
gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_AMBIENT, colorf);
color = new Color4(0, 0, 0, 1.0f);
if (mat.HasColorEmissive)
{
color = FromColor(mat.ColorEmissive);
}
gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_EMISSION, colorf);
float shininess = 1;
float strength = 1;
if (mat.HasShininess)
{
shininess = mat.Shininess;
}
if (mat.HasShininessStrength)
{
strength = mat.ShininessStrength;
}
gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_SHININESS, shininess * strength);
}
示例2: ApplyMaterial
private void ApplyMaterial(Material mat)
{
if(mat.GetMaterialTextureCount(TextureType.Diffuse) > 0)
{
TextureSlot tex;
if(mat.GetMaterialTexture(TextureType.Diffuse, 0, out tex))
LoadTexture(tex.FilePath);
}
Color4 color = new Color4(.8f, .8f, .8f, 1.0f);
if(mat.HasColorDiffuse)
{
// color = FromColor(mat.ColorDiffuse);
}
GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Diffuse, color);
color = new Color4(0, 0, 0, 1.0f);
if(mat.HasColorSpecular)
{
color = FromColor(mat.ColorSpecular);
}
GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Specular, color);
color = new Color4(.2f, .2f, .2f, 1.0f);
if(mat.HasColorAmbient)
{
color = FromColor(mat.ColorAmbient);
}
GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Ambient, color);
color = new Color4(0, 0, 0, 1.0f);
if(mat.HasColorEmissive)
{
color = FromColor(mat.ColorEmissive);
}
GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, color);
float shininess = 1;
float strength = 1;
if(mat.HasShininess)
{
shininess = mat.Shininess;
}
if(mat.HasShininessStrength)
{
strength = mat.ShininessStrength;
}
GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Shininess, shininess * strength);
}