I am trying to convert some OnMaterial Code over to Rhino6 RhinoCommon DisplayMaterial
the original function starts like this:
public CSDisplayMaterial(string fileNameEmap, double emapAmount, Color color, double glossAmount, double trans, string name)
{
OnMaterial onmat = new OnMaterial
{
m_ambient = new OnColor(0, 0, 0),
m_diffuse = color,
m_specular = OnColor.FromColor(Color.White),
m_shine = glossAmount * OnMaterial.MaxShine(),
m_transparency = trans
};
onmat.AddTexture(fileNameEmap, IOnTexture.TYPE.emap_texture);
onmat.m_textures[0].m_blend_constant_A = emapAmount;
onmat.m_textures[0].m_mode = IOnTexture.MODE.blend_texture;
_mat = new MDisplayPipelineMaterial(onmat) { m_bUseBackMaterial = false };
}
so start the conversion:
public CSDisplayMaterial(string fileNameEmap, double emapAmount, Color color, double glossAmount, double trans, string name)
{
DisplayMaterial onmat = new DisplayMaterial
{
Ambient = Color.Black,
Diffuse = color,
Specular = Color.White,
Shine = glossAmount * Rhino.DocObjects.Material.MaxShine,
Transparency = trans
};
/*
onmat.AddTexture(fileNameEmap, IOnTexture.TYPE.emap_texture);
onmat.m_textures[0].m_blend_constant_A = emapAmount;
onmat.m_textures[0].m_mode = IOnTexture.MODE.blend_texture;
*/
_mat = new DisplayMaterial(onmat);
}
So questions I have…
I sea Ambient is there but obsolete, I am setting it to black in this example, so probably does not matter, but in other code where I am using it, what should I be using instead.
then the emap texture.
I see there is:
onmat.SetEnvironmentTexture(filename,front);
how do I use this including the emapAmount, and IOnTexture.MODE.blend_texture.
Thanks