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

0024704: Visualization - inherit OpenGl_Structure from Graphic3d_CStructure

Graphic3d_Structure - store Graphic3d_CStructure as handle.
Graphic3d_Structure class implementation clean up.
Graphic3d_Structure::SetManager() - remove unused method.
Graphic3d_GraphicDriver - move structure-related methods to Graphic3d_CStructure interface.

Remove unsupported Aspect_TOHM_BLINK value.

Remove field-duplicate OpenGl_Structure::myClipPlanes

Fixing warnings
This commit is contained in:
kgv 2014-03-13 14:35:13 +04:00 committed by bugmaster
parent 3dfe95cdb9
commit 63bcc44896
25 changed files with 2109 additions and 2339 deletions

View File

@ -453,14 +453,12 @@ is
---Category: Enumerations ---Category: Enumerations
enumeration TypeOfHighlightMethod is TOHM_COLOR, enumeration TypeOfHighlightMethod is TOHM_COLOR,
TOHM_BLINK,
TOHM_BOUNDBOX TOHM_BOUNDBOX
end TypeOfHighlightMethod; end TypeOfHighlightMethod;
---Purpose: Definition of a highlight method ---Purpose: Definition of a highlight method
-- --
-- TOHM_COLOR drawn in the highlight color -- TOHM_COLOR drawn in the highlight color
-- (default white) -- (default white)
-- TOHM_BLINK blinking
-- TOHM_BOUNDBOX enclosed by the boundary box -- TOHM_BOUNDBOX enclosed by the boundary box
-- (default white) -- (default white)
-- --

View File

@ -2,6 +2,7 @@ Graphic3d_CGroup.cxx
Graphic3d_CGroup.hxx Graphic3d_CGroup.hxx
Graphic3d_CStructure.cxx Graphic3d_CStructure.cxx
Graphic3d_CStructure.hxx Graphic3d_CStructure.hxx
Graphic3d_CStructure_Handle.hxx
Graphic3d_CBitFields16.cxx Graphic3d_CBitFields16.cxx
Graphic3d_CBitFields16.hxx Graphic3d_CBitFields16.hxx
Graphic3d_CBitFields20.cxx Graphic3d_CBitFields20.cxx

View File

@ -21,7 +21,6 @@
-- 1/08/97 ; PCT : Ajout texture mapping -- 1/08/97 ; PCT : Ajout texture mapping
-- 11/97 ; CAL : retrait de la dependance avec math -- 11/97 ; CAL : retrait de la dependance avec math
-- 11/97 ; CAL : retrait des DataStructure -- 11/97 ; CAL : retrait des DataStructure
-- 11/97 ; CAL : ajout pointer StructPtr
-- 04/98 ; FGU : ajout champs 'TOR_EMISSION' -- 04/98 ; FGU : ajout champs 'TOR_EMISSION'
-- 16-09-98; BGN: (S3819) Ajout TypeOfTriedronEcho, -- 16-09-98; BGN: (S3819) Ajout TypeOfTriedronEcho,
-- TypeOfTriedronPosition. -- TypeOfTriedronPosition.
@ -367,6 +366,8 @@ is
---Purpose: Defines the C structure <astructure> ---Purpose: Defines the C structure <astructure>
---Category: Imported types ---Category: Imported types
imported CStructure_Handle;
imported CLight; imported CLight;
---Purpose: Defines the C structure <alight> ---Purpose: Defines the C structure <alight>
---Category: Imported types ---Category: Imported types
@ -492,6 +493,8 @@ is
---Purpose: Visualiser with which the graphic objects are associated. ---Purpose: Visualiser with which the graphic objects are associated.
---Category: Classes ---Category: Classes
pointer StructureManagerPtr to StructureManager from Graphic3d;
deferred class DataStructureManager; deferred class DataStructureManager;
---Purpose: Visualiser with which the graphic objects are associated. ---Purpose: Visualiser with which the graphic objects are associated.
---Category: Classes ---Category: Classes
@ -508,13 +511,6 @@ is
---Purpose: 3d vertex ---Purpose: 3d vertex
---Category: Classes ---Category: Classes
---------------------
-- Category: Pointers
---------------------
pointer StructPtr to Structure from Graphic3d;
---Category: Pointers
--------------------------------- ---------------------------------
-- Category: Instantiated classes -- Category: Instantiated classes
--------------------------------- ---------------------------------

View File

@ -223,6 +223,7 @@ is
BackMaterial ( me ) BackMaterial ( me )
returns MaterialAspect from Graphic3d returns MaterialAspect from Graphic3d
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the surface material of internal faces ---Purpose: Returns the surface material of internal faces
---Category: Inquire methods ---Category: Inquire methods
@ -230,6 +231,7 @@ is
FrontMaterial ( me ) FrontMaterial ( me )
returns MaterialAspect from Graphic3d returns MaterialAspect from Graphic3d
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the surface material of external faces ---Purpose: Returns the surface material of external faces
---Category: Inquire methods ---Category: Inquire methods

View File

@ -64,16 +64,14 @@ void Graphic3d_AspectFillArea3d::SetFrontMaterial (const Graphic3d_MaterialAspec
} }
Graphic3d_MaterialAspect Graphic3d_AspectFillArea3d::BackMaterial () const { const Graphic3d_MaterialAspect& Graphic3d_AspectFillArea3d::BackMaterial() const
{
return (MyBackMaterial); return MyBackMaterial;
} }
Graphic3d_MaterialAspect Graphic3d_AspectFillArea3d::FrontMaterial () const { const Graphic3d_MaterialAspect& Graphic3d_AspectFillArea3d::FrontMaterial() const
{
return (MyFrontMaterial); return MyFrontMaterial;
} }
void Graphic3d_AspectFillArea3d::AllowBackFace () { void Graphic3d_AspectFillArea3d::AllowBackFace () {

View File

@ -14,9 +14,52 @@
#include <Graphic3d_CStructure.hxx> #include <Graphic3d_CStructure.hxx>
const Handle(Standard_Type)& TYPE(Graphic3d_CStructure) #include <Graphic3d_Structure.pxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_TransModeFlags.hxx>
IMPLEMENT_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure, Standard_Transient)
//=============================================================================
//function : Graphic3d_CStructure
//purpose :
//=============================================================================
Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager)
: Id (theManager->NewIdentification()),
Priority (Structure_MAX_PRIORITY / 2),
PreviousPriority (Structure_MAX_PRIORITY / 2),
Composition (Graphic3d_TOC_REPLACE),
ContainsFacet (0),
IsInfinite (0),
stick (0),
highlight (0),
visible (1),
pick (1),
HLRValidation (0),
myGraphicDriver (theManager->GraphicDriver())
{ {
static Handle(Standard_Type) _atype = for (Standard_Integer i = 0; i <= 3; ++i)
new Standard_Type ("Graphic3d_CStructure", sizeof (Graphic3d_CStructure)); {
return _atype; for (Standard_Integer j = 0; j <= 3; ++j)
{
Transformation[i][j] = (i == j) ? 1.0f : 0.0f;
}
}
ContextLine.IsDef = 1,
ContextFillArea.IsDef = 1,
ContextMarker.IsDef = 1,
ContextText.IsDef = 1;
ContextLine.IsSet = 0,
ContextFillArea.IsSet = 0,
ContextMarker.IsSet = 0,
ContextText.IsSet = 0;
TransformPersistence.IsSet = 0;
TransformPersistence.Flag = Graphic3d_TMF_None;
TransformPersistence.Point.x = 0.0;
TransformPersistence.Point.y = 0.0;
TransformPersistence.Point.z = 0.0;
} }

View File

@ -15,17 +15,67 @@
#ifndef _Graphic3d_CStructure_HeaderFile #ifndef _Graphic3d_CStructure_HeaderFile
#define _Graphic3d_CStructure_HeaderFile #define _Graphic3d_CStructure_HeaderFile
#include <Graphic3d_CStructure_Handle.hxx>
#include <Graphic3d_CGroup.hxx> #include <Graphic3d_CGroup.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx> #include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_TypeOfComposition.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Standard_Transient.hxx>
#include <Handle_Graphic3d_GraphicDriver.hxx>
class Graphic3d_CStructure class Handle(Graphic3d_StructureManager);
//! Low-level graphic structure interface
class Graphic3d_CStructure : public Standard_Transient
{ {
public: public:
int Id; //! @return graphic driver created this structure
void* ptrStructure; const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
{
return myGraphicDriver;
}
//! @return associated clip planes
const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
{
return myClipPlanes;
}
//! Pass clip planes to the associated graphic driver structure
void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
public:
//! Update structure visibility state
virtual void UpdateNamedStatus() = 0;
//! Clear graphic data
virtual void Clear() = 0;
//! Connect other structure to this one
virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
//! Disconnect other structure to this one
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
//! Synchronize structure aspects
virtual void UpdateAspects() = 0;
//! Synchronize structure transformation
virtual void UpdateTransformation() = 0;
//! Highlight entire structure with color
virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
const Standard_Boolean theToCreate) = 0;
//! Highlight structure using boundary box
virtual void HighlightWithBndBox (const Standard_Boolean theToCreate) = 0;
public:
int Id;
int Priority; int Priority;
int PreviousPriority; int PreviousPriority;
@ -37,12 +87,10 @@ public:
CALL_DEF_BOUNDBOX BoundBox; CALL_DEF_BOUNDBOX BoundBox;
float Transformation[4][4]; float Transformation[4][4];
int Composition; Graphic3d_TypeOfComposition Composition;
int ContainsFacet; int ContainsFacet;
unsigned IsDeleted : 1;
unsigned IsOpen : 1;
unsigned IsInfinite : 1; unsigned IsInfinite : 1;
unsigned stick : 1; unsigned stick : 1;
unsigned highlight : 1; unsigned highlight : 1;
@ -52,11 +100,20 @@ public:
CALL_DEF_TRANSFORM_PERSISTENCE TransformPersistence; CALL_DEF_TRANSFORM_PERSISTENCE TransformPersistence;
Graphic3d_SequenceOfHClipPlane ClipPlanes; protected:
//! Create empty structure.
Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
protected:
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
public:
DEFINE_STANDARD_RTTI(Graphic3d_CStructure) // Type definition
}; };
///typedef Graphic3d_CStructure CALL_DEF_STRUCTURE; #endif // _Graphic3d_CStructure_HeaderFile
const Handle(Standard_Type)& TYPE(Graphic3d_CStructure);
#endif // Graphic3d_CStructure_HeaderFile

View File

@ -0,0 +1,24 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_CStructure_Handle_H__
#define _Graphic3d_CStructure_Handle_H__
#include <Standard_DefineHandle.hxx>
#include <Handle_Standard_Transient.hxx>
class Graphic3d_CStructure;
DEFINE_STANDARD_HANDLE(Graphic3d_CStructure, Standard_Transient)
typedef Handle(Graphic3d_CStructure) Graphic3d_CStructure_Handle;
#endif // _Graphic3d_CStructure_Handle_H__

View File

@ -64,9 +64,11 @@ uses
CPick from Graphic3d, CPick from Graphic3d,
CPlane from Graphic3d, CPlane from Graphic3d,
CStructure from Graphic3d, CStructure from Graphic3d,
CStructure_Handle from Graphic3d,
CView from Graphic3d, CView from Graphic3d,
BufferType from Graphic3d, BufferType from Graphic3d,
Structure from Graphic3d, Structure from Graphic3d,
StructureManager from Graphic3d,
TextPath from Graphic3d, TextPath from Graphic3d,
TypeOfComposition from Graphic3d, TypeOfComposition from Graphic3d,
TypeOfPrimitive from Graphic3d, TypeOfPrimitive from Graphic3d,
@ -133,36 +135,6 @@ is
is deferred; is deferred;
---Purpose: call_togl_inquireview ---Purpose: call_togl_inquireview
------------------------------
-- Category: Highlight methods
------------------------------
Blink ( me : mutable;
ACStructure : CStructure from Graphic3d;
Create : Boolean from Standard )
is deferred;
---Purpose: call_togl_blink
BoundaryBox ( me : mutable;
ACStructure : CStructure from Graphic3d;
Create : Boolean from Standard )
is deferred;
---Purpose: call_togl_boundarybox
HighlightColor ( me : mutable;
ACStructure : CStructure from Graphic3d;
R : ShortReal from Standard;
G : ShortReal from Standard;
B : ShortReal from Standard;
Create : Boolean from Standard )
is deferred;
---Purpose: call_togl_highlightcolor
NameSetStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_namesetstructure
------------------------------------- -------------------------------------
-- Category: Group management methods -- Category: Group management methods
------------------------------------- -------------------------------------
@ -210,50 +182,29 @@ is
-- Category: Structure management methods -- Category: Structure management methods
----------------------------------------- -----------------------------------------
ClearStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_clearstructure
Connect ( me : mutable;
AFather : CStructure from Graphic3d;
ASon : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_connect
ContextStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_contextstructure
Disconnect ( me : mutable;
AFather : CStructure from Graphic3d;
ASon : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_disconnect
DisplayStructure ( me : mutable; DisplayStructure ( me : mutable;
ACView : CView from Graphic3d; theCView : CView from Graphic3d;
ACStructure : CStructure from Graphic3d; theCStructure : in out CStructure from Graphic3d;
APriority : Integer from Standard ) thePriority : Integer from Standard )
is deferred; is deferred;
---Purpose: call_togl_displaystructure ---Purpose: call_togl_displaystructure
EraseStructure ( me : mutable; EraseStructure ( me : mutable;
ACView : CView from Graphic3d; theCView : CView from Graphic3d;
ACStructure : CStructure from Graphic3d ) theCStructure : in out CStructure from Graphic3d )
is deferred; is deferred;
---Purpose: call_togl_erasestructure ---Purpose: call_togl_erasestructure
RemoveStructure ( me : mutable; RemoveStructure ( me : mutable;
ACStructure : CStructure from Graphic3d ) theCStructure : in out CStructure_Handle from Graphic3d )
is deferred; is deferred;
---Purpose: call_togl_removestructure ---Purpose: call_togl_removestructure
Structure ( me : mutable; Structure (me : mutable;
ACStructure : in out CStructure from Graphic3d ) theManager : StructureManager from Graphic3d)
returns CStructure_Handle from Graphic3d
is deferred; is deferred;
---Purpose: call_togl_structure ---Purpose: Creates new empty graphic structure
------------------------------------ ------------------------------------
-- Category: Structured mode methods -- Category: Structured mode methods
@ -348,9 +299,6 @@ is
SetClipPlanes (me : mutable; theCView : CView from Graphic3d) is deferred; SetClipPlanes (me : mutable; theCView : CView from Graphic3d) is deferred;
---Purpose: Pass clip planes to the associated graphic driver view. ---Purpose: Pass clip planes to the associated graphic driver view.
SetClipPlanes (me : mutable; theCStructure : CStructure from Graphic3d) is deferred;
---Purpose: Pass clip planes to the associated graphic driver structure.
SetCamera (me : mutable; theCView : CView from Graphic3d) SetCamera (me : mutable; theCView : CView from Graphic3d)
is deferred; is deferred;
---Purpose: Inform graphic driver if camera assigned to view changes. ---Purpose: Inform graphic driver if camera assigned to view changes.
@ -360,11 +308,6 @@ is
is deferred; is deferred;
---Purpose: call_togl_setvisualisation ---Purpose: call_togl_setvisualisation
TransformStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_transformstructure
Transparency ( me : mutable; Transparency ( me : mutable;
ACView : CView from Graphic3d; ACView : CView from Graphic3d;
AFlag : Boolean from Standard ) AFlag : Boolean from Standard )

View File

@ -77,7 +77,7 @@ MyListOfPArray()
MyContainsFacet = Standard_False, MyContainsFacet = Standard_False,
MyIsEmpty = Standard_True; MyIsEmpty = Standard_True;
MyCGroup.Struct = MyStructure->CStructure(); MyCGroup.Struct = MyStructure->CStructure().operator->();
MyCGroup.Struct->Id = int (MyStructure->Identification ()); MyCGroup.Struct->Id = int (MyStructure->Identification ());
MyCGroup.ptrGroup = NULL; MyCGroup.ptrGroup = NULL;

View File

@ -248,6 +248,7 @@ is
Color ( me ) Color ( me )
returns Color from Quantity returns Color from Quantity
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the ambient colour of the surface. ---Purpose: Returns the ambient colour of the surface.
---Category: Inquire methods ---Category: Inquire methods
@ -255,6 +256,7 @@ is
AmbientColor ( me ) AmbientColor ( me )
returns Color from Quantity returns Color from Quantity
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the ambient colour of the surface. ---Purpose: Returns the ambient colour of the surface.
---Category: Inquire methods ---Category: Inquire methods
@ -262,6 +264,7 @@ is
DiffuseColor ( me ) DiffuseColor ( me )
returns Color from Quantity returns Color from Quantity
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the diffuse colour of the surface. ---Purpose: Returns the diffuse colour of the surface.
---Category: Inquire methods ---Category: Inquire methods
@ -269,6 +272,7 @@ is
SpecularColor ( me ) SpecularColor ( me )
returns Color from Quantity returns Color from Quantity
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the specular colour of the surface. ---Purpose: Returns the specular colour of the surface.
---Category: Inquire methods ---Category: Inquire methods
@ -276,6 +280,7 @@ is
EmissiveColor ( me ) EmissiveColor ( me )
returns Color from Quantity returns Color from Quantity
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the emissive colour of the surface. ---Purpose: Returns the emissive colour of the surface.
---Category: Inquire methods ---Category: Inquire methods

View File

@ -690,32 +690,29 @@ void Graphic3d_MaterialAspect::SetTransparency (const Standard_Real AValue) {
MyTransparencyCoef = Standard_ShortReal (AValue); MyTransparencyCoef = Standard_ShortReal (AValue);
} }
Quantity_Color Graphic3d_MaterialAspect::Color () const { const Quantity_Color& Graphic3d_MaterialAspect::Color() const
return (MyAmbientColor); {
return MyAmbientColor;
} }
/* Access to the color of the ambient lighting */ const Quantity_Color& Graphic3d_MaterialAspect::AmbientColor() const
Quantity_Color Graphic3d_MaterialAspect::AmbientColor () const { {
return MyAmbientColor;
return (MyAmbientColor);
} }
/* Access to the color of the dispersed lighting */ const Quantity_Color& Graphic3d_MaterialAspect::DiffuseColor() const
Quantity_Color Graphic3d_MaterialAspect::DiffuseColor () const { {
return MyDiffuseColor;
return (MyDiffuseColor);
} }
/* Access to the color of the specular lighting */ const Quantity_Color& Graphic3d_MaterialAspect::SpecularColor() const
Quantity_Color Graphic3d_MaterialAspect::SpecularColor () const { {
return MySpecularColor;
return (MySpecularColor);
} }
/* Access to the color of emission */ const Quantity_Color& Graphic3d_MaterialAspect::EmissiveColor() const
Quantity_Color Graphic3d_MaterialAspect::EmissiveColor () const { {
return MyEmissiveColor;
return (MyEmissiveColor);
} }
/* Access to the type of material */ /* Access to the type of material */

View File

@ -54,6 +54,7 @@ uses
AspectMarker3d from Graphic3d, AspectMarker3d from Graphic3d,
AspectText3d from Graphic3d, AspectText3d from Graphic3d,
CStructure from Graphic3d, CStructure from Graphic3d,
CStructure_Handle from Graphic3d,
GraphicDriver from Graphic3d, GraphicDriver from Graphic3d,
Group from Graphic3d, Group from Graphic3d,
SequenceOfGroup from Graphic3d, SequenceOfGroup from Graphic3d,
@ -63,6 +64,7 @@ uses
MapOfStructure from Graphic3d, MapOfStructure from Graphic3d,
Plotter from Graphic3d, Plotter from Graphic3d,
StructureManager from Graphic3d, StructureManager from Graphic3d,
StructureManagerPtr from Graphic3d,
TypeOfComposition from Graphic3d, TypeOfComposition from Graphic3d,
TypeOfConnection from Graphic3d, TypeOfConnection from Graphic3d,
TypeOfPrimitive from Graphic3d, TypeOfPrimitive from Graphic3d,
@ -324,15 +326,6 @@ is
-- Standard_True. -- Standard_True.
---Category: Methods to modify the class definition ---Category: Methods to modify the class definition
SetManager ( me : mutable;
AManager : StructureManager from Graphic3d;
WithPropagation : Boolean from Standard = Standard_False)
is static;
---Level: Public
---Purpose: Moves the graphic object <me> in the manager <AManager>.
-- If <WithPropagation> is Standard_True then all the connected
-- graphic objects to <me> are moved.
SetVisual ( me : mutable; SetVisual ( me : mutable;
AVisual : TypeOfStructure from Graphic3d ) AVisual : TypeOfStructure from Graphic3d )
is virtual; is virtual;
@ -463,6 +456,7 @@ is
HighlightColor ( me ) HighlightColor ( me )
returns Color from Quantity returns Color from Quantity
is static; is static;
---C++: return const&
---Level: Public ---Level: Public
---Purpose: Returns the highlight color for the Highlight method ---Purpose: Returns the highlight color for the Highlight method
-- with the highlight method TOHM_COLOR or TOHM_BOUNDBOX. -- with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
@ -996,13 +990,11 @@ is
---Purpose: Updates the c structure associated to <me>. ---Purpose: Updates the c structure associated to <me>.
---Category: Private methods ---Category: Private methods
CStructure ( me : mutable ) CStructure (me)
returns CStructure from Graphic3d returns CStructure_Handle from Graphic3d
is static; is static;
---Level: Internal
---Purpose: Returns the c structure associated to <me>. ---Purpose: Returns the c structure associated to <me>.
---Category: Private methods ---C++: return const &
---C++: return *
fields fields
@ -1015,33 +1007,30 @@ fields
-- It is a sequence of groups of primitives. -- It is a sequence of groups of primitives.
-- --
-- the associated C structure -- the associated low-level structure
MyCStructure : CStructure from Graphic3d; myCStructure : CStructure_Handle from Graphic3d;
-- the structures to which the structure is attached -- the structures to which the structure is attached
MyAncestors : SequenceOfAddress from TColStd; myAncestors : SequenceOfAddress from TColStd;
-- the structures attached to the structure -- the structures attached to the structure
MyDescendants : SequenceOfAddress from TColStd; myDescendants : SequenceOfAddress from TColStd;
-- the sequence of groups -- the sequence of groups
MyGroups : SequenceOfGroup from Graphic3d; myGroups : SequenceOfGroup from Graphic3d;
-- the graphic driver used
MyGraphicDriver : GraphicDriver from Graphic3d;
-- the highlight method of the structure -- the highlight method of the structure
MyHighlightColor : Color from Quantity; myHighlightColor : Color from Quantity;
MyHighlightMethod : TypeOfHighlightMethod from Aspect; myHighlightMethod : TypeOfHighlightMethod from Aspect;
-- the manager accepting the structure -- the manager accepting the structure
MyPtrStructureManager : Address from Standard is protected; myStructureManager : StructureManagerPtr from Graphic3d is protected;
MyFirstPtrStructureManager : Address from Standard is protected; myFirstStructureManager : StructureManagerPtr from Graphic3d is protected;
MyOwner : Address from Standard; myOwner : Address from Standard;
-- the type of visualisation accepted by the structure -- the type of visualisation accepted by the structure
MyVisual : TypeOfStructure from Graphic3d; myVisual : TypeOfStructure from Graphic3d;
MyComputeVisual : TypeOfStructure from Graphic3d is protected; myComputeVisual : TypeOfStructure from Graphic3d is protected;
friends friends

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,4 @@
#include <Graphic3d_Group.pxx> #include <Graphic3d_Group.pxx>
#define MyStructureManager ((Graphic3d_StructureManager*) MyPtrStructureManager)
#define MyFirstStructureManager ((Graphic3d_StructureManager*) MyFirstPtrStructureManager)
#endif #endif

View File

@ -426,11 +426,9 @@ is
NewIdentification ( me : mutable ) NewIdentification ( me : mutable )
returns Integer from Standard returns Integer from Standard
is static private; is static;
---Level: Internal ---Level: Internal
---Purpose: Returns a new identification number for a new structure ---Purpose: Returns a new identification number for a new structure in the manager.
-- in the manager.
---Category: Private methods
Remove ( me : mutable; Remove ( me : mutable;
AnId : Integer from Standard ) AnId : Integer from Standard )

View File

@ -278,12 +278,7 @@ void OpenGl_GraphicDriver::ClearImmediatMode (const Graphic3d_CView& theCView,
// ======================================================================= // =======================================================================
void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& theCStructure) void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& theCStructure)
{ {
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aStructure == NULL)
{
return;
}
if (!myImmediateWS.IsNull()) if (!myImmediateWS.IsNull())
{ {
myImmediateWS->DrawStructure (aStructure); myImmediateWS->DrawStructure (aStructure);

View File

@ -107,10 +107,6 @@ public:
Standard_EXPORT Standard_Integer InquireLightLimit (); Standard_EXPORT Standard_Integer InquireLightLimit ();
Standard_EXPORT Standard_Integer InquireViewLimit (); Standard_EXPORT Standard_Integer InquireViewLimit ();
Standard_EXPORT void Blink (const Graphic3d_CStructure& ACStructure,const Standard_Boolean Create);
Standard_EXPORT void BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create);
Standard_EXPORT void HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create);
Standard_EXPORT void NameSetStructure (const Graphic3d_CStructure& ACStructure);
public: // Methods for graphical groups public: // Methods for graphical groups
@ -128,19 +124,13 @@ public: // Methods for graphical groups
public: // Methods for graphical structures public: // Methods for graphical structures
Standard_EXPORT void ClearStructure (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void ContextStructure (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void Connect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon);
Standard_EXPORT void Disconnect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon);
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView, Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure, Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority); const Standard_Integer thePriority);
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView, Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure); Graphic3d_CStructure& theCStructure);
Standard_EXPORT void RemoveStructure (const Graphic3d_CStructure& theCStructure); Standard_EXPORT void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure);
Standard_EXPORT void Structure (Graphic3d_CStructure& theCStructure); Standard_EXPORT Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager);
public: public:
@ -159,10 +149,8 @@ public:
Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView); Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
Standard_EXPORT void SetLight (const Graphic3d_CView& ACView); Standard_EXPORT void SetLight (const Graphic3d_CView& ACView);
Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView); Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
Standard_EXPORT void SetClipPlanes (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView); Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView);
Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView); Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure);
Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag); Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer); Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer);
Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView); Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
@ -336,8 +324,6 @@ public:
Standard_EXPORT Standard_Boolean GetOpenClDeviceInfo (const Graphic3d_CView& theCView, Standard_EXPORT Standard_Boolean GetOpenClDeviceInfo (const Graphic3d_CView& theCView,
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theInfo); NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theInfo);
private:
//! Method to retrieve valid GL context. //! Method to retrieve valid GL context.
//! Could return NULL-handle if no window created by this driver. //! Could return NULL-handle if no window created by this driver.
Standard_EXPORT const Handle(OpenGl_Context)& GetSharedContext() const; Standard_EXPORT const Handle(OpenGl_Context)& GetSharedContext() const;

View File

@ -39,8 +39,8 @@ void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup) void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
{ {
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure; OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
if (aStructure) if (aStructure != NULL)
{ {
theCGroup.ptrGroup = aStructure->AddGroup(); theCGroup.ptrGroup = aStructure->AddGroup();
} }
@ -64,7 +64,7 @@ void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup
void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup) void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
{ {
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure; OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
if (aStructure == NULL) if (aStructure == NULL)
return; return;

View File

@ -19,102 +19,47 @@
#include <OpenGl_Structure.hxx> #include <OpenGl_Structure.hxx>
#include <OpenGl_CView.hxx> #include <OpenGl_CView.hxx>
void OpenGl_GraphicDriver::ClearStructure (const Graphic3d_CStructure& theCStructure)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
aStructure->Clear (GetSharedContext());
}
void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& theCStructure)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
aStructure->SetTransformPersistence (theCStructure.TransformPersistence);
if (theCStructure.ContextLine.IsDef)
aStructure->SetAspectLine (theCStructure.ContextLine);
if (theCStructure.ContextFillArea.IsDef)
aStructure->SetAspectFace (theCStructure.ContextFillArea);
if (theCStructure.ContextMarker.IsDef)
aStructure->SetAspectMarker (theCStructure.ContextMarker);
if (theCStructure.ContextText.IsDef)
aStructure->SetAspectText (theCStructure.ContextText);
}
void OpenGl_GraphicDriver::Connect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon)
{
OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure;
OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure;
if (aFather && aSon)
aFather->Connect(aSon);
}
void OpenGl_GraphicDriver::Disconnect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon)
{
OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure;
OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure;
if (aFather && aSon)
aFather->Disconnect(aSon);
}
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView, void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure, Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority) const Standard_Integer thePriority)
{ {
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView; const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL || aStructure == NULL) if (aCView == NULL)
return; return;
aCView->View->DisplayStructure (aStructure, thePriority); aCView->View->DisplayStructure (aStructure, thePriority);
} }
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView, void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure) Graphic3d_CStructure& theCStructure)
{ {
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView; const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL || aStructure == NULL) if (aCView == NULL || aStructure == NULL)
return; return;
aCView->View->EraseStructure (aStructure); aCView->View->EraseStructure (aStructure);
} }
void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& theCStructure) void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
{ {
if (!myMapOfStructure.IsBound (theCStructure.Id)) OpenGl_Structure* aStructure = NULL;
if (!myMapOfStructure.Find (theCStructure->Id, aStructure))
{
return; return;
}
OpenGl_Structure* aStructure = myMapOfStructure.Find (theCStructure.Id); myMapOfStructure.UnBind (theCStructure->Id);
myMapOfStructure.UnBind (theCStructure.Id); aStructure->Release (GetSharedContext());
Graphic3d_CStructure& aCStruct = const_cast<Graphic3d_CStructure&>(theCStructure); theCStructure.Nullify();
aCStruct.ptrStructure = 0;
OpenGl_Element::Destroy (GetSharedContext(), aStructure);
} }
void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& theCStructure) Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::Structure (const Handle(Graphic3d_StructureManager)& theManager)
{ {
RemoveStructure (theCStructure); Handle(OpenGl_Structure) aStructure = new OpenGl_Structure (theManager);
myMapOfStructure.Bind (aStructure->Id, aStructure.operator->());
OpenGl_Structure* aStructure = new OpenGl_Structure(); return aStructure;
Standard_Integer aStatus = 0;
if (theCStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
if (!theCStructure.visible) aStatus |= OPENGL_NS_HIDE;
aStructure->SetNamedStatus (aStatus);
theCStructure.ptrStructure = aStructure;
myMapOfStructure.Bind (theCStructure.Id, aStructure);
} }
//======================================================================= //=======================================================================

View File

@ -59,52 +59,6 @@ void OpenGl_GraphicDriver::GradientBackground (const Graphic3d_CView& ACView,
} }
} }
void OpenGl_GraphicDriver::Blink (const Graphic3d_CStructure &, const Standard_Boolean)
{
// Do nothing
}
void OpenGl_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& theCStructure,
const Standard_Boolean toCreate)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
if (toCreate)
aStructure->SetHighlightBox (GetSharedContext(), theCStructure.BoundBox);
else
aStructure->ClearHighlightBox (GetSharedContext());
}
void OpenGl_GraphicDriver::HighlightColor (const Graphic3d_CStructure& theCStructure,
const Standard_ShortReal R,
const Standard_ShortReal G,
const Standard_ShortReal B,
const Standard_Boolean toCreate)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
if (toCreate)
aStructure->SetHighlightColor (GetSharedContext(), R, G, B);
else
aStructure->ClearHighlightColor (GetSharedContext());
}
void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStructure)
{
OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
if (astructure)
{
Standard_Integer aStatus = 0;
if (ACStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
if (!ACStructure.visible) aStatus |= OPENGL_NS_HIDE;
astructure->SetNamedStatus( aStatus );
}
}
void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait) void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait)
{ {
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
@ -457,15 +411,6 @@ void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CView& theCView)
} }
} }
void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CStructure& theCStructure)
{
OpenGl_Structure* aStructure = (OpenGl_Structure *)theCStructure.ptrStructure;
if (aStructure)
{
aStructure->SetClipPlanes (theCStructure.ClipPlanes);
}
}
//======================================================================= //=======================================================================
//function : SetCamera //function : SetCamera
//purpose : //purpose :
@ -489,13 +434,6 @@ void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView)
} }
} }
void OpenGl_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ACStructure)
{
OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
if (astructure)
astructure->SetTransformation(&(ACStructure.Transformation[0][0]));
}
void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
{ {
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;

View File

@ -17,10 +17,10 @@
#include <config.h> #include <config.h>
#endif #endif
#include <OpenGl_CappingAlgo.hxx> #include <OpenGl_CappingAlgo.hxx>
#include <OpenGl_Context.hxx> #include <OpenGl_Context.hxx>
#include <OpenGl_GlCore11.hxx> #include <OpenGl_GlCore11.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OpenGl_ShaderManager.hxx> #include <OpenGl_ShaderManager.hxx>
#include <OpenGl_ShaderProgram.hxx> #include <OpenGl_ShaderProgram.hxx>
#include <OpenGl_Structure.hxx> #include <OpenGl_Structure.hxx>
@ -31,6 +31,9 @@
#include <Graphic3d_SequenceOfHClipPlane_Handle.hxx> #include <Graphic3d_SequenceOfHClipPlane_Handle.hxx>
IMPLEMENT_STANDARD_HANDLE (OpenGl_Structure, Graphic3d_CStructure)
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Structure, Graphic3d_CStructure)
//! Auxiliary class for bounding box presentation //! Auxiliary class for bounding box presentation
class OpenGl_BndBoxPrs : public OpenGl_Element class OpenGl_BndBoxPrs : public OpenGl_Element
{ {
@ -132,8 +135,9 @@ static void call_util_transpose_mat (float tmat[16], float mat[4][4])
// function : OpenGl_Structure // function : OpenGl_Structure
// purpose : // purpose :
// ======================================================================= // =======================================================================
OpenGl_Structure::OpenGl_Structure () OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
: myTransformation(NULL), : Graphic3d_CStructure (theManager),
myTransformation(NULL),
myTransPers(NULL), myTransPers(NULL),
myAspectLine(NULL), myAspectLine(NULL),
myAspectFace(NULL), myAspectFace(NULL),
@ -144,6 +148,7 @@ OpenGl_Structure::OpenGl_Structure ()
myNamedStatus(0), myNamedStatus(0),
myZLayer(0) myZLayer(0)
{ {
UpdateNamedStatus();
#if HAVE_OPENCL #if HAVE_OPENCL
myIsRaytracable = Standard_False; myIsRaytracable = Standard_False;
myModificationState = 0; myModificationState = 0;
@ -162,17 +167,38 @@ OpenGl_Structure::~OpenGl_Structure()
} }
// ======================================================================= // =======================================================================
// function : SetTransformation // function : UpdateAspects
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_Structure::SetTransformation (const float *theMatrix) void OpenGl_Structure::UpdateAspects()
{ {
if (!myTransformation) SetTransformPersistence (TransformPersistence);
if (ContextLine.IsDef)
SetAspectLine (ContextLine);
if (ContextFillArea.IsDef)
SetAspectFace (ContextFillArea);
if (ContextMarker.IsDef)
SetAspectMarker (ContextMarker);
if (ContextText.IsDef)
SetAspectText (ContextText);
}
// =======================================================================
// function : UpdateTransformation
// purpose :
// =======================================================================
void OpenGl_Structure::UpdateTransformation()
{
if (myTransformation == NULL)
{ {
myTransformation = new OpenGl_Matrix(); myTransformation = new OpenGl_Matrix();
} }
matcpy (myTransformation->mat, theMatrix); matcpy (myTransformation->mat, &Graphic3d_CStructure::Transformation[0][0]);
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
if (myIsRaytracable) if (myIsRaytracable)
@ -298,14 +324,39 @@ void OpenGl_Structure::ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx
} }
} }
// =======================================================================
// function : HighlightWithColor
// purpose :
// =======================================================================
void OpenGl_Structure::HighlightWithColor (const Graphic3d_Vec3& theColor,
const Standard_Boolean theToCreate)
{
const Handle(OpenGl_Context)& aCtx = GlDriver()->GetSharedContext();
if (theToCreate)
SetHighlightColor (aCtx, theColor);
else
ClearHighlightColor (aCtx);
}
// =======================================================================
// function : HighlightWithBndBox
// purpose :
// =======================================================================
void OpenGl_Structure::HighlightWithBndBox (const Standard_Boolean theToCreate)
{
const Handle(OpenGl_Context)& aCtx = GlDriver()->GetSharedContext();
if (theToCreate)
SetHighlightBox (aCtx, BoundBox);
else
ClearHighlightBox (aCtx);
}
// ======================================================================= // =======================================================================
// function : SetHighlightColor // function : SetHighlightColor
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx, void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
const Standard_ShortReal R, const Graphic3d_Vec3& theColor)
const Standard_ShortReal G,
const Standard_ShortReal B)
{ {
ClearHighlightBox (theGlCtx); ClearHighlightBox (theGlCtx);
if (myHighlightColor == NULL) if (myHighlightColor == NULL)
@ -313,9 +364,9 @@ void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx
myHighlightColor = new TEL_COLOUR(); myHighlightColor = new TEL_COLOUR();
} }
myHighlightColor->rgb[0] = R; myHighlightColor->rgb[0] = theColor.r();
myHighlightColor->rgb[1] = G; myHighlightColor->rgb[1] = theColor.g();
myHighlightColor->rgb[2] = B; myHighlightColor->rgb[2] = theColor.b();
myHighlightColor->rgb[3] = 1.F; myHighlightColor->rgb[3] = 1.F;
} }
@ -331,12 +382,14 @@ void OpenGl_Structure::ClearHighlightColor (const Handle(OpenGl_Context)& theGlC
} }
// ======================================================================= // =======================================================================
// function : SetNamedStatus // function : UpdateNamedStatus
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_Structure::SetNamedStatus (const Standard_Integer aStatus) void OpenGl_Structure::UpdateNamedStatus()
{ {
myNamedStatus = aStatus; myNamedStatus = 0;
if (highlight) myNamedStatus |= OPENGL_NS_HIGHLIGHT;
if (!visible) myNamedStatus |= OPENGL_NS_HIDE;
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
if (myIsRaytracable) if (myIsRaytracable)
@ -456,19 +509,20 @@ void OpenGl_Structure::SetRaytracableWithAncestorStructures() const
// function : Connect // function : Connect
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_Structure::Connect (const OpenGl_Structure *theStructure) void OpenGl_Structure::Connect (Graphic3d_CStructure& theStructure)
{ {
OpenGl_Structure* aStruct = (OpenGl_Structure* )&theStructure;
Disconnect (theStructure); Disconnect (theStructure);
myConnected.Append (theStructure); myConnected.Append (aStruct);
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
if (theStructure->IsRaytracable()) if (aStruct->IsRaytracable())
{ {
UpdateStateWithAncestorStructures(); UpdateStateWithAncestorStructures();
SetRaytracableWithAncestorStructures(); SetRaytracableWithAncestorStructures();
} }
theStructure->RegisterAncestorStructure (this); aStruct->RegisterAncestorStructure (this);
#endif #endif
} }
@ -476,29 +530,27 @@ void OpenGl_Structure::Connect (const OpenGl_Structure *theStructure)
// function : Disconnect // function : Disconnect
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_Structure::Disconnect (const OpenGl_Structure *theStructure) void OpenGl_Structure::Disconnect (Graphic3d_CStructure& theStructure)
{ {
OpenGl_ListOfStructure::Iterator its (myConnected); OpenGl_Structure* aStruct = (OpenGl_Structure* )&theStructure;
while (its.More()) for (OpenGl_ListOfStructure::Iterator anIter (myConnected); anIter.More(); anIter.Next())
{ {
// Check for the given structure // Check for the given structure
if (its.Value() == theStructure) if (anIter.Value() == aStruct)
{ {
myConnected.Remove (its); myConnected.Remove (anIter);
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
if (theStructure->IsRaytracable()) if (aStruct->IsRaytracable())
{ {
UpdateStateWithAncestorStructures(); UpdateStateWithAncestorStructures();
UpdateRaytracableWithAncestorStructures(); UpdateRaytracableWithAncestorStructures();
} }
theStructure->UnregisterAncestorStructure (this); aStruct->UnregisterAncestorStructure (this);
#endif #endif
return; return;
} }
its.Next();
} }
} }
@ -548,6 +600,15 @@ void OpenGl_Structure::RemoveGroup (const Handle(OpenGl_Context)& theGlCtx,
} }
} }
// =======================================================================
// function : Clear
// purpose :
// =======================================================================
void OpenGl_Structure::Clear()
{
Clear (GlDriver()->GetSharedContext());
}
// ======================================================================= // =======================================================================
// function : Clear // function : Clear
// purpose : // purpose :

View File

@ -16,8 +16,8 @@
#ifndef OpenGl_Structure_Header #ifndef OpenGl_Structure_Header
#define OpenGl_Structure_Header #define OpenGl_Structure_Header
#include <NCollection_List.hxx> #include <Graphic3d_CStructure.hxx>
#include <InterfaceGraphic_Graphic3d.hxx> #include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <OpenGl_AspectLine.hxx> #include <OpenGl_AspectLine.hxx>
#include <OpenGl_AspectFace.hxx> #include <OpenGl_AspectFace.hxx>
@ -28,21 +28,55 @@
#include <OpenGl_Matrix.hxx> #include <OpenGl_Matrix.hxx>
#include <OpenGl_NamedStatus.hxx> #include <OpenGl_NamedStatus.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx> #include <NCollection_List.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class OpenGl_Structure; class OpenGl_Structure;
class OpenGl_GraphicDriver;
typedef NCollection_List<const OpenGl_Structure* > OpenGl_ListOfStructure; typedef NCollection_List<const OpenGl_Structure* > OpenGl_ListOfStructure;
class OpenGl_Structure : public OpenGl_Element class OpenGl_Structure : public Graphic3d_CStructure
{ {
friend class OpenGl_Group; friend class OpenGl_Group;
public: public:
OpenGl_Structure(); //! Create empty structure
OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
void SetTransformation (const float *AMatrix); //! Setup structure graphic state
virtual void UpdateNamedStatus();
//! Clear graphic data
virtual void Clear();
//! Connect other structure to this one
virtual void Connect (Graphic3d_CStructure& theStructure);
//! Disconnect other structure to this one
virtual void Disconnect (Graphic3d_CStructure& theStructure);
//! Synchronize structure aspects
virtual void UpdateAspects();
//! Synchronize structure transformation
virtual void UpdateTransformation();
//! Highlight entire structure with color
virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
const Standard_Boolean theToCreate);
//! Highlight structure using boundary box
virtual void HighlightWithBndBox (const Standard_Boolean theToCreate);
public:
//! Access graphic driver
OpenGl_GraphicDriver* GlDriver() const
{
return (OpenGl_GraphicDriver* )myGraphicDriver.operator->();
}
void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers); void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers);
@ -57,21 +91,12 @@ public:
void ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx); void ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
void SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx, void SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
const Standard_ShortReal R, const Graphic3d_Vec3& theColor);
const Standard_ShortReal G,
const Standard_ShortReal B);
void ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx); void ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
void SetNamedStatus (const Standard_Integer aStatus);
Standard_Boolean IsVisible() const { return !(myNamedStatus & OPENGL_NS_HIDE); } Standard_Boolean IsVisible() const { return !(myNamedStatus & OPENGL_NS_HIDE); }
void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
void Connect (const OpenGl_Structure *astructure);
void Disconnect (const OpenGl_Structure *astructure);
OpenGl_Group* AddGroup(); OpenGl_Group* AddGroup();
void RemoveGroup (const Handle(OpenGl_Context)& theGlCtx, void RemoveGroup (const Handle(OpenGl_Context)& theGlCtx,
const OpenGl_Group* theGroup); const OpenGl_Group* theGroup);
@ -150,24 +175,21 @@ protected:
protected: protected:
//Structure_LABBegin
OpenGl_Matrix* myTransformation; OpenGl_Matrix* myTransformation;
TEL_TRANSFORM_PERSISTENCE* myTransPers; TEL_TRANSFORM_PERSISTENCE* myTransPers;
OpenGl_AspectLine* myAspectLine; OpenGl_AspectLine* myAspectLine;
OpenGl_AspectFace* myAspectFace; OpenGl_AspectFace* myAspectFace;
OpenGl_AspectMarker* myAspectMarker; OpenGl_AspectMarker* myAspectMarker;
OpenGl_AspectText* myAspectText; OpenGl_AspectText* myAspectText;
//Structure_LABHighlight
OpenGl_Group* myHighlightBox; OpenGl_Group* myHighlightBox;
TEL_COLOUR* myHighlightColor; TEL_COLOUR* myHighlightColor;
//Structure_LABVisibility
//Structure_LABPick int myNamedStatus;
int myNamedStatus; //Structure_LABNameSet
int myZLayer; int myZLayer;
OpenGl_ListOfStructure myConnected; OpenGl_ListOfStructure myConnected;
OpenGl_ListOfGroup myGroups; OpenGl_ListOfGroup myGroups;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
mutable OpenGl_ListOfStructure myAncestorStructures; mutable OpenGl_ListOfStructure myAncestorStructures;
@ -177,8 +199,10 @@ protected:
public: public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_RTTI(OpenGl_Structure) // Type definition
}; };
#endif //OpenGl_Structure_Header DEFINE_STANDARD_HANDLE(OpenGl_Structure, Graphic3d_CStructure)
#endif // OpenGl_Structure_Header

View File

@ -1209,17 +1209,11 @@ Standard_Integer Index = IsComputed (AStructure);
<< ", " << OldPriority << ", " << NewPriority << ")\n"; << ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush; cout << flush;
#endif #endif
MyGraphicDriver->EraseStructure MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
(MyCView, MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), NewPriority);
*(Graphic3d_CStructure *)
MyCOMPUTEDSequence.Value (Index)->CStructure ());
MyGraphicDriver->DisplayStructure
(MyCView,
*(Graphic3d_CStructure *)
MyCOMPUTEDSequence.Value (Index)->CStructure (),
int (NewPriority));
} }
else { else
{
#ifdef TRACE #ifdef TRACE
Standard_Integer StructId = AStructure->Identification (); Standard_Integer StructId = AStructure->Identification ();
cout << "Visual3d_View" << MyCView.ViewId << "::ChangeDisplayPriority (" cout << "Visual3d_View" << MyCView.ViewId << "::ChangeDisplayPriority ("
@ -1227,13 +1221,8 @@ Standard_Integer Index = IsComputed (AStructure);
<< ", " << OldPriority << ", " << NewPriority << ")\n"; << ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush; cout << flush;
#endif #endif
MyGraphicDriver->EraseStructure MyGraphicDriver->EraseStructure (MyCView, *(AStructure->CStructure()));
(MyCView, MyGraphicDriver->DisplayStructure (MyCView, *(AStructure->CStructure()), NewPriority);
*(Graphic3d_CStructure *)AStructure->CStructure ());
MyGraphicDriver->DisplayStructure
(MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure (),
int (NewPriority));
} }
} }
@ -1361,11 +1350,7 @@ Standard_Integer Index = IsComputed (AStructure);
if (Answer == Visual3d_TOA_YES ) { if (Answer == Visual3d_TOA_YES ) {
if (IsDisplayed (AStructure)) return; if (IsDisplayed (AStructure)) return;
MyGraphicDriver->DisplayStructure ( MyGraphicDriver->DisplayStructure (MyCView, *(AStructure->CStructure()), AStructure->DisplayPriority());
MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure (),
int (AStructure->DisplayPriority ())
);
MyDisplayedStructure.Add (AStructure); MyDisplayedStructure.Add (AStructure);
if (AnUpdateMode == Aspect_TOU_ASAP) Update (); if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
} }
@ -1381,11 +1366,7 @@ Standard_Integer OldStructId =
// to be displayed // to be displayed
if (! IsDisplayed (AStructure)) { if (! IsDisplayed (AStructure)) {
MyDisplayedStructure.Add (AStructure); MyDisplayedStructure.Add (AStructure);
MyGraphicDriver->DisplayStructure ( MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), AStructure->DisplayPriority ());
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure (),
int (AStructure->DisplayPriority ())
);
if (AnUpdateMode == Aspect_TOU_ASAP) Update (); if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
} }
return; return;
@ -1409,11 +1390,7 @@ Standard_Integer OldStructId =
OldStructId = MyCOMPUTEDSequence.Value (NewIndex)-> OldStructId = MyCOMPUTEDSequence.Value (NewIndex)->
Identification (); Identification ();
MyDisplayedStructure.Add (AStructure); MyDisplayedStructure.Add (AStructure);
MyGraphicDriver->DisplayStructure ( MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (NewIndex)->CStructure()), AStructure->DisplayPriority ());
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (NewIndex)->CStructure (),
int (AStructure->DisplayPriority ())
);
if (AnUpdateMode == Aspect_TOU_ASAP) Update (); if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
} }
return; return;
@ -1423,10 +1400,7 @@ Standard_Integer OldStructId =
else { else {
// COMPUTED is removed if displayed // COMPUTED is removed if displayed
if (IsDisplayed (AStructure)) if (IsDisplayed (AStructure))
MyGraphicDriver->EraseStructure ( MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure ()
);
} }
} }
} // if (Index != 0) } // if (Index != 0)
@ -1504,11 +1478,7 @@ Standard_Boolean ComputeShading = ((ViewType == Visual3d_TOV_SHADING) &&
if (Answer != Visual3d_TOA_NO) { if (Answer != Visual3d_TOA_NO) {
if (! IsDisplayed (AStructure)) if (! IsDisplayed (AStructure))
MyDisplayedStructure.Add (AStructure); MyDisplayedStructure.Add (AStructure);
MyGraphicDriver->DisplayStructure ( MyGraphicDriver->DisplayStructure (MyCView, *(TheStructure->CStructure()), AStructure->DisplayPriority ());
MyCView,
*(Graphic3d_CStructure *)TheStructure->CStructure (),
int (AStructure->DisplayPriority ())
);
if (AnUpdateMode == Aspect_TOU_ASAP) Update (); if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
} }
} // Visual3d_TOA_COMPUTE } // Visual3d_TOA_COMPUTE
@ -1539,10 +1509,7 @@ Visual3d_TypeOfAnswer Answer = AcceptDisplay (AStructure);
} }
if (Answer != Visual3d_TOA_COMPUTE) { if (Answer != Visual3d_TOA_COMPUTE) {
MyGraphicDriver->EraseStructure ( MyGraphicDriver->EraseStructure (MyCView, *(AStructure->CStructure()));
MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure ()
);
} }
if (Answer == Visual3d_TOA_COMPUTE) { if (Answer == Visual3d_TOA_COMPUTE) {
@ -1565,8 +1532,7 @@ Standard_Integer Index = IsComputed (AStructure);
<< StructId << " is removed. \n"; << StructId << " is removed. \n";
cout << flush; cout << flush;
#endif #endif
MyGraphicDriver->EraseStructure MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
(MyCView, *(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure ());
} }
// else is impossible // else is impossible
} }
@ -2189,14 +2155,8 @@ Standard_Boolean ComputeShading = ((ViewType == Visual3d_TOV_SHADING) &&
NewStructId = TheStructure->Identification (); NewStructId = TheStructure->Identification ();
// The previous calculation is removed and the new one is dislayed // The previous calculation is removed and the new one is dislayed
MyGraphicDriver->EraseStructure ( MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyCView, MyGraphicDriver->DisplayStructure (MyCView, *(TheStructure->CStructure()), AStructure->DisplayPriority());
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure ());
MyGraphicDriver->DisplayStructure (
MyCView,
*(Graphic3d_CStructure *)TheStructure->CStructure (),
int (AStructure->DisplayPriority ())
);
#ifdef TRACE_LENGTH #ifdef TRACE_LENGTH
if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) { if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) {
@ -2645,17 +2605,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode )
StructId = MyCOMPUTEDSequence.Value ( Index ) -> Identification (); StructId = MyCOMPUTEDSequence.Value ( Index ) -> Identification ();
MyGraphicDriver -> EraseStructure ( MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyCView, MyGraphicDriver->DisplayStructure (MyCView, *(S1Iterator.Key()->CStructure()), S1Iterator.Key()->DisplayPriority());
*( Graphic3d_CStructure* )
MyCOMPUTEDSequence.Value ( Index ) -> CStructure ()
);
MyGraphicDriver -> DisplayStructure (
MyCView,
*( Graphic3d_CStructure* )
S1Iterator.Key () -> CStructure (),
int ( S1Iterator.Key () -> DisplayPriority () )
);
} // end if ( Index != 0 ) . . . } // end if ( Index != 0 ) . . .
} // end if ( Answer . . . ) } // end if ( Answer . . . )
@ -2678,17 +2629,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode )
StructId = MyCOMPUTEDSequence.Value ( Index ) -> Identification (); StructId = MyCOMPUTEDSequence.Value ( Index ) -> Identification ();
MyGraphicDriver -> EraseStructure ( MyGraphicDriver->EraseStructure (MyCView, *(S1Iterator.Key()->CStructure()));
MyCView, MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), S1Iterator.Key()->DisplayPriority());
*( Graphic3d_CStructure* )
S1Iterator.Key () -> CStructure ()
);
MyGraphicDriver -> DisplayStructure (
MyCView,
*( Graphic3d_CStructure* )
MyCOMPUTEDSequence.Value ( Index ) -> CStructure (),
int ( S1Iterator.Key () -> DisplayPriority () )
);
Display ( S1Iterator.Key (), Aspect_TOU_WAIT ); Display ( S1Iterator.Key (), Aspect_TOU_WAIT );
@ -2800,16 +2742,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode )
} // end else } // end else
MyGraphicDriver -> EraseStructure ( MyGraphicDriver->EraseStructure (MyCView, *(S1Iterator.Key()->CStructure()));
MyCView, MyGraphicDriver->DisplayStructure (MyCView, *(TheStructure->CStructure()), S1Iterator.Key()->DisplayPriority());
*( Graphic3d_CStructure* )
S1Iterator.Key () -> CStructure ()
);
MyGraphicDriver -> DisplayStructure (
MyCView,
*( Graphic3d_CStructure* )TheStructure -> CStructure (),
int ( S1Iterator.Key () -> DisplayPriority () )
);
} // end else } // end else
} // end if } // end if
@ -2988,6 +2922,5 @@ void Visual3d_View::RemoveZLayer (const Standard_Integer theLayerId)
void Visual3d_View::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, void Visual3d_View::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer theLayerId) const Standard_Integer theLayerId)
{ {
MyGraphicDriver->ChangeZLayer ( MyGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), MyCView, theLayerId);
(*(Graphic3d_CStructure*)theStructure->CStructure()), MyCView, theLayerId);
} }

View File

@ -747,8 +747,7 @@ void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theS
} }
// tell graphic driver to update the structure's display layer // tell graphic driver to update the structure's display layer
MyGraphicDriver->ChangeZLayer ( MyGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), theLayerId);
(*(Graphic3d_CStructure*)theStructure->CStructure ()), theLayerId);
} }
//======================================================================= //=======================================================================
@ -758,10 +757,7 @@ void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theS
Standard_Integer Visual3d_ViewManager::GetZLayer (const Handle(Graphic3d_Structure)& theStructure) const Standard_Integer Visual3d_ViewManager::GetZLayer (const Handle(Graphic3d_Structure)& theStructure) const
{ {
Graphic3d_CStructure& aStructure = return MyGraphicDriver->GetZLayer (*theStructure->CStructure ());
(*(Graphic3d_CStructure*)theStructure->CStructure ());
return MyGraphicDriver->GetZLayer (aStructure);
} }
//======================================================================= //=======================================================================