Object specific Shading mode

Hi everybody,

I'm currently facing a small problem concerning the shading of AIS_Shape. I have a CAD model (represented by a single AIS_Shape) which should be shaded with normal Gouraud Shading. Across this shape multiple measurement points are spread (each represented by a AIS_Shape built from a face). To distinguish certain groups of these measurement points I need to color their faces with different colors (not shaded, for better viewing). And this is exactly the problem. Currently all measurement point faces are shaded, but I want to fill them with a normal, unshaded color like red, green, yellow etc.

The shading mode V3d_MULTICOLOR I think would do it, but then I need to display the CAD model in mode V3d_GOURAUD and the measurement points in the multicolor mode at the same time. Is this possible or is there another possibility to do the same work.

Thanks, Sven.

Patrik Mueller's picture

Hi Sven,

one solution could be deriving your own AIS_Shape. An example how to do that is the AIS_TexturedShape.

HTH,

Patrik

Sven Jungnickel's picture

Hi Patrik,

thanks for your answer. I have already found a quicker and simpler solution: I modfied the material aspect so that it behaves like a simple filled triangle with a single non-shaded color. Therefore I set the diffuse color and emissive color reflection to the maximum and changed the corresponding colors to my specific color for the measurement point. The shininess does the rest. Here is the code snippet which does this

mat.SetDiffuse(1.0);
mat.SetDiffuseColor(m_color);
mat.SetEmissive(1.0);
mat.SetEmissiveColor(m_color);
mat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
mat.SetShininess(0.5);

Best regards,

Sven