BRepPrimAPI_MakeCone MakeCone(gp_Ax2(p1, gp_Dir(gp_Vec(p1, p2))),
0, (p1.Distance(p2))/tan(1.04), coneHeigth);
spotConeShape->Set(MakeCone.Solid());
- GetDocument()->GetAISContext()->Display (spotConeShape, 0, -1, Standard_True);
+ GetDocument()->GetAISContext()->Display (spotConeShape, 0, -1, false);
((OCC_MainFrame*)AfxGetMainWnd())->SetStatusMessage("Pick the target point");
myCurrentMode = CurAction3d_TargetSpotLight;
GetDocument()->GetAISContext()->Redisplay(directionalEdgeShape,0,Standard_True);
myCurrent_DirectionalLight->SetDirection(p2.X()-p1.X(),p2.Y()-p1.Y(),p2.Z()-p1.Z());
myView->UpdateLights();
+ myView->Redraw();
}
}
else if (myCurrentMode == CurAction3d_BeginPositionalLight)
//Update the light dynamically
myCurrent_PositionalLight->SetPosition(p2.X(),p2.Y(),p2.Z());
myView->UpdateLights();
+ myView->Redraw();
}
else if (myCurrentMode == CurAction3d_TargetSpotLight)
{
GetDocument()->GetAISContext()->Redisplay(spotConeShape,0,Standard_True);
myCurrent_SpotLight->SetDirection(p2.X()-p1.X(),p2.Y()-p1.Y(),p2.Z()-p1.Z());
myView->UpdateLights();
+ myView->Redraw();
}
}
else if (myCurrentMode == CurAction3d_EndSpotLight)
GetDocument()->GetAISContext()->Redisplay(spotConeShape,0,Standard_True);
myCurrent_SpotLight->SetAngle((float )atan(p2.Distance(p3)/p1.Distance(p2))) ;
myView->UpdateLights();
+ myView->Redraw();
}
}
- if (nFlags & MK_SHIFT)
+ else if (nFlags & MK_SHIFT)
+ {
GetDocument()->ShiftMoveEvent(point.x,point.y,myView);
+ }
else
+ {
GetDocument()->MoveEvent(point.x,point.y,myView);
+ }
}
}
NbActiveLights++;
myView->UpdateLights();
+ myView->Redraw();
TCollection_AsciiString Message("\
myCurrent_AmbientLight=new V3d_AmbientLight(Quantity_NOC_GRAY);\n\
GetDocument()->UpdateResultMessageDlg("SetAntialiasingOn/SetAntialiasingOff",Message);
}
-void CViewer3dView::OnClearLights()
+void CViewer3dView::OnClearLights()
{
-// Setting Off all viewer active lights
- TColStd_ListOfTransient lights;
- for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())
+// Setting Off all viewer active lights
+ V3d_ListOfLight lights;
+ for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())
{
- lights.Append(myView->Viewer()->ActiveLight());
+ lights.Append (anIter.Value());
}
- TColStd_ListIteratorOfListOfTransient itrLights(lights);
+ V3d_ListOfLightIterator itrLights(lights);
for (; itrLights.More(); itrLights.Next())
{
- Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
- myView->Viewer()->SetLightOff(light);
+ myView->Viewer()->SetLightOff (itrLights.Value());
}
-// Setting Off all view active lights
+// Setting Off all view active lights
lights.Clear();
- for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())
+ for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())
{
- lights.Append(myView->ActiveLight());
+ lights.Append (anIter.Value());
}
- itrLights.Initialize(lights);
+ itrLights.Initialize (lights);
for (; itrLights.More(); itrLights.Next())
{
- Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
- myView->SetLightOff(light);
+ myView->SetLightOff (itrLights.Value());
}
- myView->Viewer()->SetDefaultLights();// Setting the default lights on
+ myView->Viewer()->SetDefaultLights(); // Setting the default lights on
- NbActiveLights = 2;// There are 2 default active lights
+ NbActiveLights = 2; // There are 2 default active lights
- myView->Update();
+ myView->Update();
TCollection_AsciiString Message("\
-// Setting Off all viewer active lights\n\
-TColStd_ListOfTransient lights;\n\
-for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())\n\
+// Setting Off all viewer active lights\n\
+V3d_ListOfLight lights;\n\
+for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())\n\
{\n\
- lights.Append(myView->Viewer()->ActiveLight());\n\
+ lights.Append (anIter.Value());\n\
}\n\
-TColStd_ListIteratorOfListOfTransient itrLights(lights);\n\
+V3d_ListOfLightIterator itrLights(lights);\n\
for (; itrLights.More(); itrLights.Next())\n\
{\n\
- Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
- myView->Viewer()->SetLightOff(light);\n\
+ myView->Viewer()->SetLightOff (itrLights.Value())\n\
}\n\
\n\
-// Setting Off all view active lights\n\
+// Setting Off all view active lights\n\
lights.Clear();\n\
-for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())\n\
+for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())\n\
{\n\
- lights.Append(myView->ActiveLight());\n\
+ lights.Append (anIter.Value());\n\
}\n\
itrLights.Initialize(lights);\n\
for (; itrLights.More(); itrLights.Next())\n\
{\n\
- Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
- myView->SetLightOff(light);\n\
+ myView->SetLightOff (itrLights.Value());\n\
}\n\
\n\
myView->Viewer()->SetDefaultLights();// Setting the default lights on\n\