1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0023712: Remove dependency on Aspect_GraphicDevice from Aspect_Window

This commit is contained in:
dbv
2013-02-18 11:59:36 +04:00
parent 8db070a59d
commit dc3fe572ec
114 changed files with 809 additions and 10216 deletions

View File

@@ -4,7 +4,7 @@
#pragma warning( disable : 4800 )
OCCViewer::OCCViewer(void)
{
myGraphicDevice=NULL;
myGraphicDriver=NULL;
myViewer=NULL;
myView=NULL;
myAISContext=NULL;
@@ -17,22 +17,27 @@ OCCViewer::~OCCViewer(void)
bool OCCViewer::InitViewer(void* wnd)
{
try {
myGraphicDevice = new Graphic3d_WNTGraphicDevice();
} catch (Standard_Failure) {
return false;
}
TCollection_ExtendedString a3DName("Visu3D");
myViewer = new V3d_Viewer( myGraphicDevice, a3DName.ToExtString(),"", 1000.0,
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
Standard_True, Standard_False);
try
{
Handle(Aspect_DisplayConnection) aDisplayConnection;
myGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
}
catch (Standard_Failure)
{
return false;
}
TCollection_ExtendedString a3DName("Visu3D");
myViewer = new V3d_Viewer (myGraphicDriver, a3DName.ToExtString(),"", 1000.0,
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
Standard_True, Standard_False);
myViewer->Init();
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myView = myViewer->CreateView();
Handle(WNT_Window) aWNTWindow = new WNT_Window(myGraphicDevice, reinterpret_cast<HWND> (wnd));
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (wnd));
myView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped())
aWNTWindow->Map();
@@ -543,9 +548,12 @@ void OCCViewer::CreateNewView(void* wnd)
if (myAISContext.IsNull())
return;
myView = myAISContext->CurrentViewer()->CreateView();
if (myGraphicDevice.IsNull())
myGraphicDevice = new Graphic3d_WNTGraphicDevice();
Handle(WNT_Window) aWNTWindow = new WNT_Window(myGraphicDevice, reinterpret_cast<HWND> (wnd));
if (myGraphicDriver.IsNull())
{
Handle(Aspect_DisplayConnection) aDisplayConnection;
myGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
}
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (wnd));
myView->SetWindow(aWNTWindow);
Standard_Integer w=100, h=100;
aWNTWindow->Size(w,h);

View File

@@ -11,7 +11,7 @@ private:
Handle_V3d_Viewer myViewer;
Handle_V3d_View myView;
Handle_AIS_InteractiveContext myAISContext;
Handle_Graphic3d_WNTGraphicDevice myGraphicDevice;
Handle_Graphic3d_GraphicDriver myGraphicDriver;
public:
__declspec(dllexport) bool InitViewer(void* wnd);
__declspec(dllexport) bool ImportBRep(char* filename);

View File

@@ -23,9 +23,11 @@
#include <PTColStd_PersistentTransientMap.hxx>
#include <TCollection_AsciiString.hxx>
//for OCC graphic
#include <Aspect_DisplayConnection.hxx>
#include <WNT_Window.hxx>
#include <Graphic3d_WNTGraphicDevice.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Graphic3d.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_NameOfMaterial.hxx>
//for object display
#include <V3d_Viewer.hxx>