For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Graphic3d_VertexNC : how to "display" th

Anonymous's picture
Forums: 

Hello,

I've programmed a Presentable Object inheriting from AIS_InteractiveObject. In the method Compute, I want to display each vertex of the shading presentation with a differtent color. It's working fine, but the Normal of my Graphic3d_VertexNC is not applied. It means, that I have a multicolor shding, but the object doesn't take in account the light source. I have the same result as with Graphic3d_VertexC.

How can I apply the normal parameter ? Do I need to set something special ?

Thanks,

Stephane

-------------Pseudo Code ------------

Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);

Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);

Graphic3d_MaterialAspect mat = myShadingAspect->Aspect()->FrontMaterial();

mat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);

mat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);

mat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);

mat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);

myShadingAspect->SetMaterial(mat);

theGroup->SetPrimitivesAspect(myShadingAspect->Aspect());

Aspect_Array1OfEdge aListEdge(1, 3 );

aListEdge.SetValue(1,Aspect_Edge(1,2,Aspect_TOE_VISIBLE));

aListEdge.SetValue(2,Aspect_Edge(2,3,Aspect_TOE_VISIBLE));

aListEdge.SetValue(3,Aspect_Edge(3,1,Aspect_TOE_VISIBLE));

theGroup->BeginPrimitives();

---begin loop on all my points ---

Graphic3d_Array1OfVertexNC theArray1(1,3);

Graphic3d_VertexNC aVertexNC(V1->X(),V1->Y(),V1->Z(),V1->NX(),V1->NY(),V1->NZ(),V1->GetColor());

theArray1.SetValue(1,aVertexNC);

aVertexNC = Graphic3d_VertexNC(V2->X(),V2->Y(),V2->Z(),V2->NX(),V2->NY(),V2->NZ(),V2->GetColor());

theArray1.SetValue(2,aVertexNC);

aVertexNC = Graphic3d_VertexNC(V3->X(),V3->Y(),V3->Z(),V3->NX(),V3->NY(),V3->NZ(),V3->GetColor());

theArray1.SetValue(3,aVertexNC);

theGroup->TriangleSet(theArray1,aListEdge);

-- end loop

Michael Gandyra's picture

I posted earlier some similar things. Please have a look in the thread: http://www.opencascade.org/cgi-bin/forum/config.cgi?read=718

best regards Michael

------------------------------------------------------------------

University of Kaiserslautern

Research Group for Computer Application in Engineering Design

------------------------------------------------------------------

Stephane Routelous's picture

Hello Michael ,

This is not my problem.

I can use Graphic3d_Vertex , Graphic3d_VertexN , Graphic3d_VertexC , but Graphic3d_VertexNC give me the same result as Graphic3d_VertexC.

If someone can say me how to have the normal attributes assign to the vertices...

Stephane