Mon, 08/11/2003 - 13:19
Hi,
I have a question about using the Viusal3d package. I want to use the Visual3d package instead of the V3d package because it allows one to modify the view mapping in detail. The problem is that I don't know which function I have to use if I want to display an interactice object, like a shape. In an older version of my software I used the V3d package to create the interactive context. Here is the old code snippet
// Get Graphic device of application
Handle(Graphic3d_WNTGraphicDevice) GraphicDevice =
((CVcpaApp*)AfxGetApp())->GetGraphicDevice();
// Create new viewer
m_3dviewer = new V3d_Viewer(GraphicDevice,(short *) "Visu3D");
// Create interactive context
m_AISContext = new AIS_InteractiveContext(m_3dviewer);
Later I dispay a shape with the following code:
// Display shape
m_AISContext->Display(new AIS_Shape(m_Shape));
So how can I display the shape with an interactive context using the Visual3d package? It can't be so difficult, but I didn't find anything withing the OCC documentation.
Thanks for your help!!!
Sven
Mon, 08/11/2003 - 15:37
Hi,
I'm not so sure if I this works, but I see 2 possibilities for still working with V3d and use your own mapping (I don't think it would be so easy displaying a shape directly in Visual3D):
1) V3d_View::View() gives you a handle to the Visual3d_View. With that handle you can use "SetViewMapping()" for your Visual3d_ViewMapping.
2) derive a class from V3d_View and add a method for getting MyViewMapping directly.
Perhaps this helps you,
Patrik
Mon, 08/11/2003 - 16:02
Seems to be a good hint...and another undocumented Function. I think this will help, so I should get direct acces to the view mapping.
Thanks!
Sven
Mon, 08/11/2003 - 16:09
Never trust the documentation - most helps a look at the cdl files :-))))
Mon, 08/11/2003 - 16:20
cdl files?!? What kind of files are these and where can I find them?
Mon, 08/11/2003 - 17:49
You'll find them in the "src" dirs from OCC. They are from the OCC WOK environment if I remember right.
Regards,
Patrik
Tue, 08/12/2003 - 12:47
I tried it out and it worked. I'm now able to save and restore the ViewMapping and ViewOrientation. First get with V3d_View::View the Visual3d_View of the 3D Viewer and afterwards get/set ViewMapping/ViewOrientation with Visual3d_View::SetViewMapping, Visual3d_View::SetViewOrientation, Visual3d_View::ViewMapping, Visual3d_View::ViewOrientation.
Thanks a lot...
Sven
Tue, 08/12/2003 - 13:40
Good to hear...
Have a nice day,
Patrik
Tue, 04/04/2006 - 19:06
Hi Sven !
I'm interested by your topic. I can't set the back and front planes properly using this :
Handle_Visual3d_View myVisual;
myVisual = myView->View();
Visual3d_ViewMapping viewmap();
Graphic3d_Vertex prp(X,Y,Z);
viewmap.SetProjection (Visual3d_TOP_PERSPECTIVE);
viewmap.SetProjectionReferencePoint(prp);
viewmap.SetFrontPlaneDistance(asceneex->m_Camera->m_dNearPlane);
viewmap.SetBackPlaneDistance (asceneex->m_Camera->m_dFarPlane);
viewmap.SetViewPlaneDistance (asceneex->m_Camera->m_dCameraPOS[2]);
myVisual->SetViewMapping(viewmap);
I can't see my objects clipped by the planes. Do I have something to do with the V3d_View to make the clipping work.
Maybe if you have a code in which you modify your clipping it would help me.
Thank you for your help!
Philippe.
Wed, 04/05/2006 - 11:54
Hi Philippe,
to get the changes in you V3d_View you must use a trick.
append this to your code:
// Sets the default mapping
myVisual->SetViewMappingDefault();
// Transfers the mapping in your view
myView->Reset();
Should work.
Best regards,
Sven