mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030491
: Visualization - OpenGl_Element inherits Standard_Transient
This commit is contained in:
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <Image_PixMap.hxx>
|
#include <Image_PixMap.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_AspectFace, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//! Initialize default material in this way for backward compatibility.
|
//! Initialize default material in this way for backward compatibility.
|
||||||
@@ -66,6 +68,7 @@ OpenGl_AspectFace::OpenGl_AspectFace()
|
|||||||
THE_DEFAULT_MATERIAL, THE_DEFAULT_MATERIAL)),
|
THE_DEFAULT_MATERIAL, THE_DEFAULT_MATERIAL)),
|
||||||
myShadingModel (Graphic3d_TOSM_UNLIT)
|
myShadingModel (Graphic3d_TOSM_UNLIT)
|
||||||
{
|
{
|
||||||
|
myAspectEdge = new OpenGl_AspectLine();
|
||||||
myAspect->SetShadingModel (myShadingModel);
|
myAspect->SetShadingModel (myShadingModel);
|
||||||
myAspect->SetHatchStyle (Handle(Graphic3d_HatchStyle)());
|
myAspect->SetHatchStyle (Handle(Graphic3d_HatchStyle)());
|
||||||
}
|
}
|
||||||
@@ -77,6 +80,8 @@ OpenGl_AspectFace::OpenGl_AspectFace()
|
|||||||
OpenGl_AspectFace::OpenGl_AspectFace (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
|
OpenGl_AspectFace::OpenGl_AspectFace (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
|
||||||
: myShadingModel (Graphic3d_TOSM_DEFAULT)
|
: myShadingModel (Graphic3d_TOSM_DEFAULT)
|
||||||
{
|
{
|
||||||
|
myAspectEdge = new OpenGl_AspectLine();
|
||||||
|
|
||||||
SetAspect (theAspect);
|
SetAspect (theAspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +102,9 @@ void OpenGl_AspectFace::SetAspect (const Handle(Graphic3d_AspectFillArea3d)& the
|
|||||||
? theAspect->ShadingModel()
|
? theAspect->ShadingModel()
|
||||||
: Graphic3d_TOSM_UNLIT;
|
: Graphic3d_TOSM_UNLIT;
|
||||||
|
|
||||||
myAspectEdge.Aspect()->SetColor (theAspect->EdgeColor());
|
myAspectEdge->Aspect()->SetColor (theAspect->EdgeColor());
|
||||||
myAspectEdge.Aspect()->SetType (theAspect->EdgeLineType());
|
myAspectEdge->Aspect()->SetType (theAspect->EdgeLineType());
|
||||||
myAspectEdge.Aspect()->SetWidth (theAspect->EdgeWidth());
|
myAspectEdge->Aspect()->SetWidth (theAspect->EdgeWidth());
|
||||||
|
|
||||||
// update texture binding
|
// update texture binding
|
||||||
myResources.UpdateTexturesRediness (myAspect->TextureSet());
|
myResources.UpdateTexturesRediness (myAspect->TextureSet());
|
||||||
|
@@ -28,7 +28,7 @@ class OpenGl_Texture;
|
|||||||
//! The element holding Graphic3d_AspectFillArea3d.
|
//! The element holding Graphic3d_AspectFillArea3d.
|
||||||
class OpenGl_AspectFace : public OpenGl_Element
|
class OpenGl_AspectFace : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_AspectFace, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Empty constructor.
|
//! Empty constructor.
|
||||||
@@ -44,10 +44,10 @@ public:
|
|||||||
Standard_EXPORT void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
|
Standard_EXPORT void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
|
||||||
|
|
||||||
//! Set edge aspect.
|
//! Set edge aspect.
|
||||||
void SetAspectEdge (const OpenGl_AspectLine* theAspectEdge) { myAspectEdge = *theAspectEdge; }
|
void SetAspectEdge (const Handle(OpenGl_AspectLine)& theAspectEdge) { myAspectEdge = theAspectEdge; }
|
||||||
|
|
||||||
//! @return edge aspect.
|
//! @return edge aspect.
|
||||||
const OpenGl_AspectLine* AspectEdge() const { return &myAspectEdge; }
|
const Handle(OpenGl_AspectLine)& AspectEdge() const { return myAspectEdge; }
|
||||||
|
|
||||||
//! Returns Shading Model.
|
//! Returns Shading Model.
|
||||||
Graphic3d_TypeOfShadingModel ShadingModel() const { return myShadingModel; }
|
Graphic3d_TypeOfShadingModel ShadingModel() const { return myShadingModel; }
|
||||||
@@ -140,7 +140,7 @@ protected:
|
|||||||
} myResources;
|
} myResources;
|
||||||
|
|
||||||
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
||||||
OpenGl_AspectLine myAspectEdge;
|
Handle(OpenGl_AspectLine) myAspectEdge;
|
||||||
Graphic3d_TypeOfShadingModel myShadingModel;
|
Graphic3d_TypeOfShadingModel myShadingModel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#include <OpenGl_ShaderProgram.hxx>
|
#include <OpenGl_ShaderProgram.hxx>
|
||||||
#include <OpenGl_Workspace.hxx>
|
#include <OpenGl_Workspace.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_AspectLine, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static const TCollection_AsciiString THE_EMPTY_KEY;
|
static const TCollection_AsciiString THE_EMPTY_KEY;
|
||||||
|
@@ -26,6 +26,7 @@ class OpenGl_ShaderProgram;
|
|||||||
//! The element holding Graphic3d_AspectLine3d.
|
//! The element holding Graphic3d_AspectLine3d.
|
||||||
class OpenGl_AspectLine : public OpenGl_Element
|
class OpenGl_AspectLine : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_AspectLine, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Empty constructor.
|
//! Empty constructor.
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
#include <NCollection_Vec4.hxx>
|
#include <NCollection_Vec4.hxx>
|
||||||
#include <TColStd_HArray1OfByte.hxx>
|
#include <TColStd_HArray1OfByte.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_AspectMarker, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static const TCollection_AsciiString THE_EMPTY_KEY;
|
static const TCollection_AsciiString THE_EMPTY_KEY;
|
||||||
|
@@ -29,6 +29,7 @@ class OpenGl_ShaderProgram;
|
|||||||
//! The element holding Graphic3d_AspectMarker3d.
|
//! The element holding Graphic3d_AspectMarker3d.
|
||||||
class OpenGl_AspectMarker : public OpenGl_Element
|
class OpenGl_AspectMarker : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_AspectMarker, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Empty constructor.
|
//! Empty constructor.
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#include <OpenGl_ShaderManager.hxx>
|
#include <OpenGl_ShaderManager.hxx>
|
||||||
#include <OpenGl_ShaderProgram.hxx>
|
#include <OpenGl_ShaderProgram.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_AspectText, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static const TCollection_AsciiString THE_EMPTY_KEY;
|
static const TCollection_AsciiString THE_EMPTY_KEY;
|
||||||
|
@@ -28,7 +28,7 @@ class OpenGl_ShaderProgram;
|
|||||||
//! Text representation parameters
|
//! Text representation parameters
|
||||||
class OpenGl_AspectText : public OpenGl_Element
|
class OpenGl_AspectText : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_AspectText, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Empty constructor.
|
//! Empty constructor.
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#include <OpenGl_View.hxx>
|
#include <OpenGl_View.hxx>
|
||||||
#include <Graphic3d_TextureParams.hxx>
|
#include <Graphic3d_TextureParams.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_BackgroundArray, OpenGl_PrimitiveArray)
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// method : Constructor
|
// method : Constructor
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -337,7 +339,7 @@ Standard_Boolean OpenGl_BackgroundArray::createTextureArray (const Handle(OpenGl
|
|||||||
|
|
||||||
// Get texture parameters
|
// Get texture parameters
|
||||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||||
const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace();
|
const Handle(OpenGl_AspectFace)& anAspectFace = theWorkspace->AspectFace();
|
||||||
GLfloat aTextureWidth = (GLfloat )anAspectFace->TextureSet (aCtx)->First()->SizeX();
|
GLfloat aTextureWidth = (GLfloat )anAspectFace->TextureSet (aCtx)->First()->SizeX();
|
||||||
GLfloat aTextureHeight = (GLfloat )anAspectFace->TextureSet (aCtx)->First()->SizeY();
|
GLfloat aTextureHeight = (GLfloat )anAspectFace->TextureSet (aCtx)->First()->SizeY();
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
//! gradient or texture background rendering.
|
//! gradient or texture background rendering.
|
||||||
class OpenGl_BackgroundArray : public OpenGl_PrimitiveArray
|
class OpenGl_BackgroundArray : public OpenGl_PrimitiveArray
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_BackgroundArray, OpenGl_PrimitiveArray)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Main constructor.
|
//! Main constructor.
|
||||||
|
@@ -72,7 +72,7 @@ namespace
|
|||||||
aContext->ModelWorldState.SetCurrent (OpenGl_Mat4::Map (*thePlane->Orientation()->mat));
|
aContext->ModelWorldState.SetCurrent (OpenGl_Mat4::Map (*thePlane->Orientation()->mat));
|
||||||
aContext->ApplyModelViewMatrix();
|
aContext->ApplyModelViewMatrix();
|
||||||
|
|
||||||
thePlane->Primitives().Render (theWorkspace);
|
thePlane->Primitives()->Render (theWorkspace);
|
||||||
|
|
||||||
aContext->ModelWorldState.Pop();
|
aContext->ModelWorldState.Pop();
|
||||||
aContext->ApplyModelViewMatrix();
|
aContext->ApplyModelViewMatrix();
|
||||||
@@ -104,11 +104,11 @@ namespace
|
|||||||
theStencilSentry.Init();
|
theStencilSentry.Init();
|
||||||
|
|
||||||
// check if capping plane should be rendered within current pass (only opaque / only transparent)
|
// check if capping plane should be rendered within current pass (only opaque / only transparent)
|
||||||
const OpenGl_AspectFace* anObjAspectFace = aRenderPlane->ToUseObjectProperties() ? aGroupIter.Value()->AspectFace() : NULL;
|
const Handle(OpenGl_AspectFace) anObjAspectFace = aRenderPlane->ToUseObjectProperties() ? aGroupIter.Value()->AspectFace() : NULL;
|
||||||
thePlane->Update (aContext, anObjAspectFace != NULL ? anObjAspectFace->Aspect() : Handle(Graphic3d_AspectFillArea3d)());
|
thePlane->Update (aContext, !anObjAspectFace.IsNull() ? anObjAspectFace->Aspect() : Handle(Graphic3d_AspectFillArea3d)());
|
||||||
theWorkspace->SetAspectFace (thePlane->AspectFace());
|
theWorkspace->SetAspectFace (thePlane->AspectFace());
|
||||||
theWorkspace->SetRenderFilter (aPrevFilter);
|
theWorkspace->SetRenderFilter (aPrevFilter);
|
||||||
if (!theWorkspace->ShouldRender (&thePlane->Primitives()))
|
if (!theWorkspace->ShouldRender (thePlane->Primitives()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace
|
|||||||
const bool aColorMaskBack = aContext->SetColorMask (false);
|
const bool aColorMaskBack = aContext->SetColorMask (false);
|
||||||
|
|
||||||
// override aspects, disable culling
|
// override aspects, disable culling
|
||||||
theWorkspace->SetAspectFace (&theWorkspace->NoneCulling());
|
theWorkspace->SetAspectFace (theWorkspace->NoneCulling());
|
||||||
theWorkspace->ApplyAspectFace();
|
theWorkspace->ApplyAspectFace();
|
||||||
|
|
||||||
// evaluate number of pair faces
|
// evaluate number of pair faces
|
||||||
@@ -156,7 +156,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
// override material, cull back faces
|
// override material, cull back faces
|
||||||
theWorkspace->SetAspectFace (&theWorkspace->FrontCulling());
|
theWorkspace->SetAspectFace (theWorkspace->FrontCulling());
|
||||||
theWorkspace->ApplyAspectFace();
|
theWorkspace->ApplyAspectFace();
|
||||||
|
|
||||||
// enable all clip plane except the rendered one
|
// enable all clip plane except the rendered one
|
||||||
@@ -207,7 +207,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remember current aspect face defined in workspace
|
// remember current aspect face defined in workspace
|
||||||
const OpenGl_AspectFace* aFaceAsp = theWorkspace->AspectFace();
|
const Handle(OpenGl_AspectFace)& aFaceAsp = theWorkspace->AspectFace();
|
||||||
|
|
||||||
// only filled primitives should be rendered
|
// only filled primitives should be rendered
|
||||||
const Standard_Integer aPrevFilter = theWorkspace->RenderFilter();
|
const Standard_Integer aPrevFilter = theWorkspace->RenderFilter();
|
||||||
|
@@ -63,7 +63,7 @@ namespace
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane)
|
OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane)
|
||||||
: myPrimitives (NULL),
|
: myPrimitives (new OpenGl_PrimitiveArray(NULL)),
|
||||||
myOrientation (OpenGl_IdentityMatrix),
|
myOrientation (OpenGl_IdentityMatrix),
|
||||||
myAspect (NULL),
|
myAspect (NULL),
|
||||||
myPlaneRoot (thePlane),
|
myPlaneRoot (thePlane),
|
||||||
@@ -82,7 +82,7 @@ OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource (const Handle(Graphic3d
|
|||||||
if (anAttribs->Init (12, anAttribInfo, 3))
|
if (anAttribs->Init (12, anAttribInfo, 3))
|
||||||
{
|
{
|
||||||
memcpy (anAttribs->ChangeData(), THE_CAPPING_PLN_VERTS, sizeof(THE_CAPPING_PLN_VERTS));
|
memcpy (anAttribs->ChangeData(), THE_CAPPING_PLN_VERTS, sizeof(THE_CAPPING_PLN_VERTS));
|
||||||
myPrimitives.InitBuffers (NULL, Graphic3d_TOPA_TRIANGLES, NULL, anAttribs, NULL);
|
myPrimitives->InitBuffers (NULL, Graphic3d_TOPA_TRIANGLES, NULL, anAttribs, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ void OpenGl_CappingPlaneResource::Update (const Handle(OpenGl_Context)& ,
|
|||||||
void OpenGl_CappingPlaneResource::Release (OpenGl_Context* theContext)
|
void OpenGl_CappingPlaneResource::Release (OpenGl_Context* theContext)
|
||||||
{
|
{
|
||||||
OpenGl_Element::Destroy (theContext, myAspect);
|
OpenGl_Element::Destroy (theContext, myAspect);
|
||||||
myPrimitives.Release (theContext);
|
myPrimitives->Release (theContext);
|
||||||
myEquationMod = (unsigned int )-1;
|
myEquationMod = (unsigned int )-1;
|
||||||
myAspectMod = (unsigned int )-1;
|
myAspectMod = (unsigned int )-1;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ void OpenGl_CappingPlaneResource::Release (OpenGl_Context* theContext)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_CappingPlaneResource::updateAspect (const Handle(Graphic3d_AspectFillArea3d)& theObjAspect)
|
void OpenGl_CappingPlaneResource::updateAspect (const Handle(Graphic3d_AspectFillArea3d)& theObjAspect)
|
||||||
{
|
{
|
||||||
if (myAspect == NULL)
|
if (myAspect.IsNull())
|
||||||
{
|
{
|
||||||
myAspect = new OpenGl_AspectFace();
|
myAspect = new OpenGl_AspectFace();
|
||||||
myAspectMod = myPlaneRoot->MCountAspect() - 1; // mark out of sync
|
myAspectMod = myPlaneRoot->MCountAspect() - 1; // mark out of sync
|
||||||
|
@@ -61,13 +61,13 @@ public:
|
|||||||
const Handle(Graphic3d_ClipPlane)& Plane() const { return myPlaneRoot; }
|
const Handle(Graphic3d_ClipPlane)& Plane() const { return myPlaneRoot; }
|
||||||
|
|
||||||
//! @return aspect face for rendering capping surface.
|
//! @return aspect face for rendering capping surface.
|
||||||
inline const OpenGl_AspectFace* AspectFace() const { return myAspect; }
|
inline const Handle(OpenGl_AspectFace)& AspectFace() const { return myAspect; }
|
||||||
|
|
||||||
//! @return evaluated orientation matrix to transform infinite plane.
|
//! @return evaluated orientation matrix to transform infinite plane.
|
||||||
inline const OpenGl_Matrix* Orientation() const { return &myOrientation; }
|
inline const OpenGl_Matrix* Orientation() const { return &myOrientation; }
|
||||||
|
|
||||||
//! @return primitive array of vertices to render infinite plane.
|
//! @return primitive array of vertices to render infinite plane.
|
||||||
inline const OpenGl_PrimitiveArray& Primitives() const { return myPrimitives; }
|
inline const Handle(OpenGl_PrimitiveArray)& Primitives() const { return myPrimitives; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -79,9 +79,9 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
OpenGl_PrimitiveArray myPrimitives; //!< vertices and texture coordinates for rendering
|
Handle(OpenGl_PrimitiveArray) myPrimitives; //!< vertices and texture coordinates for rendering
|
||||||
OpenGl_Matrix myOrientation; //!< plane transformation matrix.
|
OpenGl_Matrix myOrientation; //!< plane transformation matrix.
|
||||||
OpenGl_AspectFace* myAspect; //!< capping face aspect.
|
Handle(OpenGl_AspectFace) myAspect; //!< capping face aspect.
|
||||||
Handle(Graphic3d_ClipPlane) myPlaneRoot; //!< parent clipping plane structure.
|
Handle(Graphic3d_ClipPlane) myPlaneRoot; //!< parent clipping plane structure.
|
||||||
Handle(Graphic3d_AspectFillArea3d) myFillAreaAspect; //!< own capping aspect
|
Handle(Graphic3d_AspectFillArea3d) myFillAreaAspect; //!< own capping aspect
|
||||||
unsigned int myEquationMod; //!< modification counter for plane equation.
|
unsigned int myEquationMod; //!< modification counter for plane equation.
|
||||||
|
@@ -3167,7 +3167,7 @@ Handle(OpenGl_FrameBuffer) OpenGl_Context::SetDefaultFrameBuffer (const Handle(O
|
|||||||
// function : SetShadingMaterial
|
// function : SetShadingMaterial
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
void OpenGl_Context::SetShadingMaterial (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight)
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight)
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
|
const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
|
||||||
@@ -3239,7 +3239,7 @@ void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
|||||||
// function : CheckIsTransparent
|
// function : CheckIsTransparent
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean OpenGl_Context::CheckIsTransparent (const OpenGl_AspectFace* theAspect,
|
Standard_Boolean OpenGl_Context::CheckIsTransparent (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
||||||
Standard_ShortReal& theAlphaFront,
|
Standard_ShortReal& theAlphaFront,
|
||||||
Standard_ShortReal& theAlphaBack)
|
Standard_ShortReal& theAlphaBack)
|
||||||
|
@@ -699,17 +699,17 @@ public: //! @name methods to alter or retrieve current state
|
|||||||
Standard_EXPORT Standard_Boolean BindProgram (const Handle(OpenGl_ShaderProgram)& theProgram);
|
Standard_EXPORT Standard_Boolean BindProgram (const Handle(OpenGl_ShaderProgram)& theProgram);
|
||||||
|
|
||||||
//! Setup current shading material.
|
//! Setup current shading material.
|
||||||
Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
Standard_EXPORT void SetShadingMaterial (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight);
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight);
|
||||||
|
|
||||||
//! Checks if transparency is required for the given aspect and highlight style.
|
//! Checks if transparency is required for the given aspect and highlight style.
|
||||||
Standard_EXPORT static Standard_Boolean CheckIsTransparent (const OpenGl_AspectFace* theAspect,
|
Standard_EXPORT static Standard_Boolean CheckIsTransparent (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
||||||
Standard_ShortReal& theAlphaFront,
|
Standard_ShortReal& theAlphaFront,
|
||||||
Standard_ShortReal& theAlphaBack);
|
Standard_ShortReal& theAlphaBack);
|
||||||
|
|
||||||
//! Checks if transparency is required for the given aspect and highlight style.
|
//! Checks if transparency is required for the given aspect and highlight style.
|
||||||
static Standard_Boolean CheckIsTransparent (const OpenGl_AspectFace* theAspect,
|
static Standard_Boolean CheckIsTransparent (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight)
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight)
|
||||||
{
|
{
|
||||||
Standard_ShortReal anAlphaFront = 1.0f, anAlphaBack = 1.0f;
|
Standard_ShortReal anAlphaFront = 1.0f, anAlphaBack = 1.0f;
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include <OpenGl_Element.hxx>
|
#include <OpenGl_Element.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Element, Standard_Transient)
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : OpenGl_Element
|
// function : OpenGl_Element
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@@ -23,8 +23,9 @@ class OpenGl_Workspace;
|
|||||||
class OpenGl_Context;
|
class OpenGl_Context;
|
||||||
|
|
||||||
//! Base interface for drawable elements.
|
//! Base interface for drawable elements.
|
||||||
class OpenGl_Element
|
class OpenGl_Element : public Standard_Transient
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_Element, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Standard_EXPORT OpenGl_Element();
|
Standard_EXPORT OpenGl_Element();
|
||||||
@@ -40,18 +41,14 @@ public:
|
|||||||
//! Pointer to the context is used because this method might be called
|
//! Pointer to the context is used because this method might be called
|
||||||
//! when the context is already being destroyed and usage of a handle
|
//! when the context is already being destroyed and usage of a handle
|
||||||
//! would be unsafe
|
//! would be unsafe
|
||||||
template <typename theResource_t>
|
|
||||||
static void Destroy (OpenGl_Context* theContext,
|
static void Destroy (OpenGl_Context* theContext,
|
||||||
theResource_t*& theElement)
|
Handle(OpenGl_Element)& theElement)
|
||||||
{
|
{
|
||||||
if (theElement == NULL)
|
if (theElement.IsNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
theElement->Release (theContext);
|
theElement->Release (theContext);
|
||||||
OpenGl_Element* anElement = theElement;
|
|
||||||
delete anElement;
|
|
||||||
theElement = NULL;
|
theElement = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include <gp_Ax2.hxx>
|
#include <gp_Ax2.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Flipper, OpenGl_Element)
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Constructor
|
// function : Constructor
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@@ -27,6 +27,7 @@ class gp_Ax2;
|
|||||||
//! Originally, this element serves for need of flipping the 3D text of dimension presentations.
|
//! Originally, this element serves for need of flipping the 3D text of dimension presentations.
|
||||||
class OpenGl_Flipper : public OpenGl_Element
|
class OpenGl_Flipper : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_Flipper, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Construct rendering element to flip model-view matrix
|
//! Construct rendering element to flip model-view matrix
|
||||||
|
@@ -205,9 +205,10 @@ void OpenGl_FrameStats::updateStructures (Standard_Integer theViewId,
|
|||||||
for (OpenGl_Structure::GroupIterator aGroupIter (aStruct->Groups()); aGroupIter.More(); aGroupIter.Next())
|
for (OpenGl_Structure::GroupIterator aGroupIter (aStruct->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||||
{
|
{
|
||||||
const OpenGl_Group* aGroup = aGroupIter.Value();
|
const OpenGl_Group* aGroup = aGroupIter.Value();
|
||||||
for (const OpenGl_ElementNode* aNodeIter = aGroup->FirstNode(); aNodeIter != NULL; aNodeIter = aNodeIter->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator (aGroup->GetElements()); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
if (const OpenGl_PrimitiveArray* aPrim = dynamic_cast<const OpenGl_PrimitiveArray*> (aNodeIter->elem))
|
Handle(OpenGl_PrimitiveArray) aPrim = Handle(OpenGl_PrimitiveArray)::DownCast (anElemIterator.Value());
|
||||||
|
if (!aPrim.IsNull())
|
||||||
{
|
{
|
||||||
myCountersTmp[Graphic3d_FrameStatsCounter_EstimatedBytesGeom] += estimatedDataSize (aPrim->AttributesVbo());
|
myCountersTmp[Graphic3d_FrameStatsCounter_EstimatedBytesGeom] += estimatedDataSize (aPrim->AttributesVbo());
|
||||||
myCountersTmp[Graphic3d_FrameStatsCounter_EstimatedBytesGeom] += estimatedDataSize (aPrim->IndexVbo());
|
myCountersTmp[Graphic3d_FrameStatsCounter_EstimatedBytesGeom] += estimatedDataSize (aPrim->IndexVbo());
|
||||||
@@ -227,9 +228,10 @@ void OpenGl_FrameStats::updateStructures (Standard_Integer theViewId,
|
|||||||
for (OpenGl_Structure::GroupIterator aGroupIter (aStruct->Groups()); aGroupIter.More(); aGroupIter.Next())
|
for (OpenGl_Structure::GroupIterator aGroupIter (aStruct->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||||
{
|
{
|
||||||
const OpenGl_Group* aGroup = aGroupIter.Value();
|
const OpenGl_Group* aGroup = aGroupIter.Value();
|
||||||
for (const OpenGl_ElementNode* aNodeIter = aGroup->FirstNode(); aNodeIter != NULL; aNodeIter = aNodeIter->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator (aGroup->GetElements()); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
if (const OpenGl_PrimitiveArray* aPrim = dynamic_cast<const OpenGl_PrimitiveArray*> (aNodeIter->elem))
|
Handle(OpenGl_PrimitiveArray) aPrim = Handle(OpenGl_PrimitiveArray)::DownCast (anElemIterator.Value());
|
||||||
|
if (!aPrim.IsNull())
|
||||||
{
|
{
|
||||||
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsNotCulled];
|
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsNotCulled];
|
||||||
if (theToCountMem)
|
if (theToCountMem)
|
||||||
@@ -313,9 +315,8 @@ void OpenGl_FrameStats::updateStructures (Standard_Integer theViewId,
|
|||||||
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsLineNotCulled];
|
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsLineNotCulled];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (const OpenGl_Text* aText = dynamic_cast<const OpenGl_Text*> (aNodeIter->elem))
|
else if (!Handle(OpenGl_Text)::DownCast(anElemIterator.Value()).IsNull())
|
||||||
{
|
{
|
||||||
(void )aText;
|
|
||||||
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsNotCulled];
|
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsNotCulled];
|
||||||
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsTextNotCulled];
|
++myCountersTmp[Graphic3d_FrameStatsCounter_NbElemsTextNotCulled];
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_FrameStatsPrs, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//! Auxiliary structure defining vertex with two attributes.
|
//! Auxiliary structure defining vertex with two attributes.
|
||||||
@@ -50,7 +52,11 @@ OpenGl_FrameStatsPrs::OpenGl_FrameStatsPrs()
|
|||||||
myChartIndices (new OpenGl_IndexBuffer()),
|
myChartIndices (new OpenGl_IndexBuffer()),
|
||||||
myChartLines (new OpenGl_VertexBuffer())
|
myChartLines (new OpenGl_VertexBuffer())
|
||||||
{
|
{
|
||||||
//
|
myCountersText = new OpenGl_Text();
|
||||||
|
myTextAspect = new OpenGl_AspectText();
|
||||||
|
myChartLabels[0] = new OpenGl_Text();
|
||||||
|
myChartLabels[1] = new OpenGl_Text();
|
||||||
|
myChartLabels[2] = new OpenGl_Text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -68,10 +74,10 @@ OpenGl_FrameStatsPrs::~OpenGl_FrameStatsPrs()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_FrameStatsPrs::Release (OpenGl_Context* theCtx)
|
void OpenGl_FrameStatsPrs::Release (OpenGl_Context* theCtx)
|
||||||
{
|
{
|
||||||
myCountersText.Release (theCtx);
|
myCountersText->Release (theCtx);
|
||||||
myChartLabels[0].Release (theCtx);
|
myChartLabels[0]->Release (theCtx);
|
||||||
myChartLabels[1].Release (theCtx);
|
myChartLabels[1]->Release (theCtx);
|
||||||
myChartLabels[2].Release (theCtx);
|
myChartLabels[2]->Release (theCtx);
|
||||||
myChartVertices->Release (theCtx);
|
myChartVertices->Release (theCtx);
|
||||||
myChartIndices->Release (theCtx);
|
myChartIndices->Release (theCtx);
|
||||||
myChartLines->Release (theCtx);
|
myChartLines->Release (theCtx);
|
||||||
@@ -88,7 +94,7 @@ void OpenGl_FrameStatsPrs::Update (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
const Graphic3d_RenderingParams& aRendParams = theWorkspace->View()->RenderingParams();
|
const Graphic3d_RenderingParams& aRendParams = theWorkspace->View()->RenderingParams();
|
||||||
myCountersTrsfPers = theWorkspace->View()->RenderingParams().StatsPosition;
|
myCountersTrsfPers = theWorkspace->View()->RenderingParams().StatsPosition;
|
||||||
myChartTrsfPers = theWorkspace->View()->RenderingParams().ChartPosition;
|
myChartTrsfPers = theWorkspace->View()->RenderingParams().ChartPosition;
|
||||||
myTextAspect.SetAspect (aRendParams.StatsTextAspect);
|
myTextAspect->SetAspect (aRendParams.StatsTextAspect);
|
||||||
|
|
||||||
// adjust text alignment depending on corner
|
// adjust text alignment depending on corner
|
||||||
OpenGl_TextParam aParams;
|
OpenGl_TextParam aParams;
|
||||||
@@ -111,21 +117,21 @@ void OpenGl_FrameStatsPrs::Update (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
{
|
{
|
||||||
aParams.VAlign = Graphic3d_VTA_BOTTOM;
|
aParams.VAlign = Graphic3d_VTA_BOTTOM;
|
||||||
}
|
}
|
||||||
if (aParams.Height != myCountersText.FormatParams().Height
|
if (aParams.Height != myCountersText->FormatParams().Height
|
||||||
|| aParams.HAlign != myCountersText.FormatParams().HAlign
|
|| aParams.HAlign != myCountersText->FormatParams().HAlign
|
||||||
|| aParams.VAlign != myCountersText.FormatParams().VAlign)
|
|| aParams.VAlign != myCountersText->FormatParams().VAlign)
|
||||||
{
|
{
|
||||||
myCountersText.Release (aCtx.operator->());
|
myCountersText->Release (aCtx.operator->());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aStats->IsFrameUpdated (myStatsPrev)
|
if (!aStats->IsFrameUpdated (myStatsPrev)
|
||||||
&& !myCountersText.Text().IsEmpty())
|
&& !myCountersText->Text().IsEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TCollection_AsciiString aText = aStats->FormatStats (aRendParams.CollectedStats);
|
TCollection_AsciiString aText = aStats->FormatStats (aRendParams.CollectedStats);
|
||||||
myCountersText.Init (aCtx, aText.ToCString(), OpenGl_Vec3 (0.0f, 0.0f, 0.0f), aParams);
|
myCountersText->Init (aCtx, aText.ToCString(), OpenGl_Vec3 (0.0f, 0.0f, 0.0f), aParams);
|
||||||
|
|
||||||
updateChart (theWorkspace);
|
updateChart (theWorkspace);
|
||||||
}
|
}
|
||||||
@@ -341,9 +347,9 @@ void OpenGl_FrameStatsPrs::updateChart (const Handle(OpenGl_Workspace)& theWorks
|
|||||||
const float aLabX = aParams.HAlign == Graphic3d_HTA_RIGHT
|
const float aLabX = aParams.HAlign == Graphic3d_HTA_RIGHT
|
||||||
? float(anOffset.x())
|
? float(anOffset.x())
|
||||||
: float(anOffset.x() + aCharSize.x());
|
: float(anOffset.x() + aCharSize.x());
|
||||||
myChartLabels[0].Init (aCtx, aLabels[isTopDown ? 0 : 2].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y()), 0.0f), aParams);
|
myChartLabels[0]->Init (aCtx, aLabels[isTopDown ? 0 : 2].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y()), 0.0f), aParams);
|
||||||
myChartLabels[1].Init (aCtx, aLabels[isTopDown ? 1 : 1].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y() / 2), 0.0f), aParams);
|
myChartLabels[1]->Init (aCtx, aLabels[isTopDown ? 1 : 1].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y() / 2), 0.0f), aParams);
|
||||||
myChartLabels[2].Init (aCtx, aLabels[isTopDown ? 2 : 0].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y()), 0.0f), aParams);
|
myChartLabels[2]->Init (aCtx, aLabels[isTopDown ? 2 : 0].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y()), 0.0f), aParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +367,8 @@ void OpenGl_FrameStatsPrs::Render (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
glDepthMask (GL_FALSE);
|
glDepthMask (GL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const OpenGl_AspectText* aTextAspectBack = theWorkspace->SetAspectText (&myTextAspect);
|
const Handle(OpenGl_AspectText)& aTextAspectBack = theWorkspace->AspectText();
|
||||||
|
theWorkspace->SetAspectText (myTextAspect);
|
||||||
|
|
||||||
aCtx->ModelWorldState.Push();
|
aCtx->ModelWorldState.Push();
|
||||||
aCtx->ModelWorldState.ChangeCurrent().InitIdentity();
|
aCtx->ModelWorldState.ChangeCurrent().InitIdentity();
|
||||||
@@ -376,7 +383,7 @@ void OpenGl_FrameStatsPrs::Render (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
aCtx->VirtualViewport()[2], aCtx->VirtualViewport()[3]);
|
aCtx->VirtualViewport()[2], aCtx->VirtualViewport()[3]);
|
||||||
}
|
}
|
||||||
aCtx->ApplyModelViewMatrix();
|
aCtx->ApplyModelViewMatrix();
|
||||||
myCountersText.Render (theWorkspace);
|
myCountersText->Render (theWorkspace);
|
||||||
aCtx->WorldViewState.Pop();
|
aCtx->WorldViewState.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,9 +426,9 @@ void OpenGl_FrameStatsPrs::Render (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
myChartLines->unbindAttribute (aCtx, Graphic3d_TOA_COLOR);
|
myChartLines->unbindAttribute (aCtx, Graphic3d_TOA_COLOR);
|
||||||
myChartLines->unbindAttribute (aCtx, Graphic3d_TOA_POS);
|
myChartLines->unbindAttribute (aCtx, Graphic3d_TOA_POS);
|
||||||
|
|
||||||
myChartLabels[0].Render (theWorkspace);
|
myChartLabels[0]->Render (theWorkspace);
|
||||||
myChartLabels[1].Render (theWorkspace);
|
myChartLabels[1]->Render (theWorkspace);
|
||||||
myChartLabels[2].Render (theWorkspace);
|
myChartLabels[2]->Render (theWorkspace);
|
||||||
|
|
||||||
aCtx->WorldViewState.Pop();
|
aCtx->WorldViewState.Pop();
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ class OpenGl_VertexBuffer;
|
|||||||
//! Element rendering frame statistics.
|
//! Element rendering frame statistics.
|
||||||
class OpenGl_FrameStatsPrs : public OpenGl_Element
|
class OpenGl_FrameStatsPrs : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_FrameStatsPrs, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
@@ -43,7 +44,7 @@ public:
|
|||||||
Standard_EXPORT void Update (const Handle(OpenGl_Workspace)& theWorkspace);
|
Standard_EXPORT void Update (const Handle(OpenGl_Workspace)& theWorkspace);
|
||||||
|
|
||||||
//! Assign text aspect.
|
//! Assign text aspect.
|
||||||
void SetTextAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect.SetAspect (theAspect); }
|
void SetTextAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect->SetAspect (theAspect); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -54,14 +55,14 @@ protected:
|
|||||||
|
|
||||||
Handle(OpenGl_FrameStats) myStatsPrev; //!< currently displayed stats
|
Handle(OpenGl_FrameStats) myStatsPrev; //!< currently displayed stats
|
||||||
Handle(Graphic3d_TransformPers) myCountersTrsfPers; //!< transformation persistence for counters presentation
|
Handle(Graphic3d_TransformPers) myCountersTrsfPers; //!< transformation persistence for counters presentation
|
||||||
OpenGl_Text myCountersText; //!< counters presentation
|
Handle(OpenGl_Text) myCountersText; //!< counters presentation
|
||||||
OpenGl_AspectText myTextAspect; //!< text aspect
|
Handle(OpenGl_AspectText) myTextAspect; //!< text aspect
|
||||||
Handle(Graphic3d_TransformPers) myChartTrsfPers; //!< transformation persistence for chart presentation
|
Handle(Graphic3d_TransformPers) myChartTrsfPers; //!< transformation persistence for chart presentation
|
||||||
Handle(Graphic3d_ArrayOfTriangles) myChartArray; //!< array of chart triangles
|
Handle(Graphic3d_ArrayOfTriangles) myChartArray; //!< array of chart triangles
|
||||||
Handle(OpenGl_VertexBuffer) myChartVertices; //!< VBO with chart triangles
|
Handle(OpenGl_VertexBuffer) myChartVertices; //!< VBO with chart triangles
|
||||||
Handle(OpenGl_IndexBuffer) myChartIndices; //!< VBO with chart triangle indexes
|
Handle(OpenGl_IndexBuffer) myChartIndices; //!< VBO with chart triangle indexes
|
||||||
Handle(OpenGl_VertexBuffer) myChartLines; //!< array of chart lines
|
Handle(OpenGl_VertexBuffer) myChartLines; //!< array of chart lines
|
||||||
OpenGl_Text myChartLabels[3]; //!< chart labels
|
Handle(OpenGl_Text) myChartLabels[3]; //!< chart labels
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraduatedTrihedron, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static const OpenGl_TextParam THE_LABEL_PARAMS =
|
static const OpenGl_TextParam THE_LABEL_PARAMS =
|
||||||
@@ -49,7 +51,11 @@ OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron()
|
|||||||
myMax (100.0f, 100.0f, 100.0f),
|
myMax (100.0f, 100.0f, 100.0f),
|
||||||
myIsInitialized (Standard_False)
|
myIsInitialized (Standard_False)
|
||||||
{
|
{
|
||||||
//
|
myGridLineAspect = new OpenGl_AspectLine();
|
||||||
|
|
||||||
|
myLabelValues = new OpenGl_Text();
|
||||||
|
myAspectLabels = new OpenGl_AspectText();
|
||||||
|
myAspectValues = new OpenGl_AspectText();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -80,7 +86,7 @@ void OpenGl_GraduatedTrihedron::Release (OpenGl_Context* theCtx)
|
|||||||
myAxes[0].Release (theCtx);
|
myAxes[0].Release (theCtx);
|
||||||
myAxes[1].Release (theCtx);
|
myAxes[1].Release (theCtx);
|
||||||
myAxes[2].Release (theCtx);
|
myAxes[2].Release (theCtx);
|
||||||
myLabelValues.Release (theCtx);
|
myLabelValues->Release (theCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -92,7 +98,7 @@ void OpenGl_GraduatedTrihedron::initGlResources (const Handle(OpenGl_Context)& t
|
|||||||
myAxes[0].Release (theCtx.operator->());
|
myAxes[0].Release (theCtx.operator->());
|
||||||
myAxes[1].Release (theCtx.operator->());
|
myAxes[1].Release (theCtx.operator->());
|
||||||
myAxes[2].Release (theCtx.operator->());
|
myAxes[2].Release (theCtx.operator->());
|
||||||
myLabelValues.Release (theCtx.operator->());
|
myLabelValues->Release (theCtx.operator->());
|
||||||
|
|
||||||
// Initialize text label parameters for x, y, and z axes
|
// Initialize text label parameters for x, y, and z axes
|
||||||
myAxes[0] = Axis (myData.XAxisAspect(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
|
myAxes[0] = Axis (myData.XAxisAspect(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
|
||||||
@@ -105,19 +111,19 @@ void OpenGl_GraduatedTrihedron::initGlResources (const Handle(OpenGl_Context)& t
|
|||||||
myAxes[2].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
|
myAxes[2].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
|
||||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||||
{
|
{
|
||||||
myAxes[anIt].Label.SetFontSize (theCtx, myData.NamesSize());
|
myAxes[anIt].Label->SetFontSize (theCtx, myData.NamesSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
myLabelValues.SetFontSize (theCtx, myData.ValuesSize());
|
myLabelValues->SetFontSize (theCtx, myData.ValuesSize());
|
||||||
|
|
||||||
myAspectLabels.Aspect()->SetTextFontAspect (myData.NamesFontAspect());
|
myAspectLabels->Aspect()->SetTextFontAspect (myData.NamesFontAspect());
|
||||||
myAspectLabels.Aspect()->SetFont (myData.NamesFont());
|
myAspectLabels->Aspect()->SetFont (myData.NamesFont());
|
||||||
|
|
||||||
myAspectValues.Aspect()->SetTextFontAspect (myData.ValuesFontAspect());
|
myAspectValues->Aspect()->SetTextFontAspect (myData.ValuesFontAspect());
|
||||||
myAspectValues.Aspect()->SetFont (myData.ValuesFont());
|
myAspectValues->Aspect()->SetFont (myData.ValuesFont());
|
||||||
|
|
||||||
// Grid aspect
|
// Grid aspect
|
||||||
myGridLineAspect.Aspect()->SetColor (myData.GridColor());
|
myGridLineAspect->Aspect()->SetColor (myData.GridColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -326,7 +332,7 @@ Standard_ExtCharacter OpenGl_GraduatedTrihedron::getGridAxes (const Standard_Sho
|
|||||||
// function : renderLine
|
// function : renderLine
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray& theLine,
|
void OpenGl_GraduatedTrihedron::renderLine (const Handle(OpenGl_PrimitiveArray)& theLine,
|
||||||
const Handle(OpenGl_Workspace)& theWorkspace,
|
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
const OpenGl_Mat4& theMat,
|
const OpenGl_Mat4& theMat,
|
||||||
const Standard_ShortReal theXt,
|
const Standard_ShortReal theXt,
|
||||||
@@ -338,7 +344,7 @@ void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray& theL
|
|||||||
Graphic3d_TransformUtils::Translate (aMat, theXt, theYt, theZt);
|
Graphic3d_TransformUtils::Translate (aMat, theXt, theYt, theZt);
|
||||||
aContext->WorldViewState.SetCurrent (aMat);
|
aContext->WorldViewState.SetCurrent (aMat);
|
||||||
aContext->ApplyWorldViewMatrix();
|
aContext->ApplyWorldViewMatrix();
|
||||||
theLine.Render (theWorkspace);
|
theLine->Render (theWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -385,7 +391,7 @@ void OpenGl_GraduatedTrihedron::renderGridPlane (const Handle(OpenGl_Workspace)&
|
|||||||
Graphic3d_TransformUtils::Translate (aMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
|
Graphic3d_TransformUtils::Translate (aMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
|
||||||
aContext->WorldViewState.SetCurrent (aMat);
|
aContext->WorldViewState.SetCurrent (aMat);
|
||||||
aContext->ApplyWorldViewMatrix();
|
aContext->ApplyWorldViewMatrix();
|
||||||
anAxis.Line.Render (theWorkspace);
|
anAxis.Line->Render (theWorkspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,7 +406,7 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
|
|||||||
{
|
{
|
||||||
const Axis& anAxis = myAxes[theIndex];
|
const Axis& anAxis = myAxes[theIndex];
|
||||||
|
|
||||||
theWorkspace->SetAspectLine (&anAxis.LineAspect);
|
theWorkspace->SetAspectLine (anAxis.LineAspect);
|
||||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||||
|
|
||||||
// Reset transformations
|
// Reset transformations
|
||||||
@@ -422,7 +428,7 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
|
|||||||
aContext->ModelWorldState.SetCurrent (aTransMode.Compute (theWorkspace->View()->Camera(), aProjection, aWorldView, aWidth, aHeight));
|
aContext->ModelWorldState.SetCurrent (aTransMode.Compute (theWorkspace->View()->Camera(), aProjection, aWorldView, aWidth, aHeight));
|
||||||
aContext->ApplyModelViewMatrix();
|
aContext->ApplyModelViewMatrix();
|
||||||
|
|
||||||
anAxis.Arrow.Render (theWorkspace);
|
anAxis.Arrow->Render (theWorkspace);
|
||||||
|
|
||||||
// Get current Model-View and Projection states
|
// Get current Model-View and Projection states
|
||||||
OpenGl_Mat4 aModelMat;
|
OpenGl_Mat4 aModelMat;
|
||||||
@@ -457,7 +463,7 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
|
|||||||
|
|
||||||
aContext->WorldViewState.SetCurrent (aModelMat);
|
aContext->WorldViewState.SetCurrent (aModelMat);
|
||||||
aContext->ApplyWorldViewMatrix();
|
aContext->ApplyWorldViewMatrix();
|
||||||
anAxis.Line.Render (theWorkspace);
|
anAxis.Line->Render (theWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -487,7 +493,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
|
|||||||
|
|
||||||
if (aCurAspect.ToDrawTickmarks() && aCurAspect.TickmarksNumber() > 0)
|
if (aCurAspect.ToDrawTickmarks() && aCurAspect.TickmarksNumber() > 0)
|
||||||
{
|
{
|
||||||
theWorkspace->SetAspectLine (&myGridLineAspect);
|
theWorkspace->SetAspectLine (myGridLineAspect);
|
||||||
|
|
||||||
OpenGl_Mat4 aModelMat (theMat);
|
OpenGl_Mat4 aModelMat (theMat);
|
||||||
|
|
||||||
@@ -500,7 +506,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
|
|||||||
OpenGl_Vec3 aStepVec = anAxis.Direction * aStep;
|
OpenGl_Vec3 aStepVec = anAxis.Direction * aStep;
|
||||||
for (Standard_Integer anIter = 0; anIter <= aCurAspect.TickmarksNumber(); ++anIter)
|
for (Standard_Integer anIter = 0; anIter <= aCurAspect.TickmarksNumber(); ++anIter)
|
||||||
{
|
{
|
||||||
anAxis.Tickmark.Render (theWorkspace);
|
anAxis.Tickmark->Render (theWorkspace);
|
||||||
Graphic3d_TransformUtils::Translate (aModelMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
|
Graphic3d_TransformUtils::Translate (aModelMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
|
||||||
aContext->WorldViewState.SetCurrent (aModelMat);
|
aContext->WorldViewState.SetCurrent (aModelMat);
|
||||||
aContext->ApplyWorldViewMatrix();
|
aContext->ApplyWorldViewMatrix();
|
||||||
@@ -517,24 +523,24 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
|
|||||||
|
|
||||||
OpenGl_Vec3 aMiddle (theGridAxes.Ticks[theIndex] + aSizeVec * theGridAxes.Axes[theIndex] * 0.5f + aDir * (Standard_ShortReal)(theDpix * anOffset));
|
OpenGl_Vec3 aMiddle (theGridAxes.Ticks[theIndex] + aSizeVec * theGridAxes.Axes[theIndex] * 0.5f + aDir * (Standard_ShortReal)(theDpix * anOffset));
|
||||||
|
|
||||||
myAspectLabels.Aspect()->SetColor (anAxis.NameColor);
|
myAspectLabels->Aspect()->SetColor (anAxis.NameColor);
|
||||||
theWorkspace->SetAspectText (&myAspectLabels);
|
theWorkspace->SetAspectText (myAspectLabels);
|
||||||
anAxis.Label.SetPosition (aMiddle);
|
anAxis.Label->SetPosition (aMiddle);
|
||||||
anAxis.Label.Render (theWorkspace);
|
anAxis.Label->Render (theWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aCurAspect.ToDrawValues() && aCurAspect.TickmarksNumber() > 0)
|
if (aCurAspect.ToDrawValues() && aCurAspect.TickmarksNumber() > 0)
|
||||||
{
|
{
|
||||||
myAspectValues.Aspect()->SetColor (anAxis.LineAspect.Aspect()->Color());
|
myAspectValues->Aspect()->SetColor (anAxis.LineAspect->Aspect()->Color());
|
||||||
theWorkspace->SetAspectText (&myAspectValues);
|
theWorkspace->SetAspectText (myAspectValues);
|
||||||
Standard_Real anOffset = aCurAspect.ValuesOffset() + aCurAspect.TickmarksLength();
|
Standard_Real anOffset = aCurAspect.ValuesOffset() + aCurAspect.TickmarksLength();
|
||||||
|
|
||||||
for (Standard_Integer anIt = 0; anIt <= aCurAspect.TickmarksNumber(); ++anIt)
|
for (Standard_Integer anIt = 0; anIt <= aCurAspect.TickmarksNumber(); ++anIt)
|
||||||
{
|
{
|
||||||
sprintf (aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep);
|
sprintf (aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep);
|
||||||
OpenGl_Vec3 aPos (theGridAxes.Ticks[theIndex] + anAxis.Direction* (Standard_ShortReal) (anIt * aStep) + aDir * (Standard_ShortReal) (theDpix * anOffset));
|
OpenGl_Vec3 aPos (theGridAxes.Ticks[theIndex] + anAxis.Direction* (Standard_ShortReal) (anIt * aStep) + aDir * (Standard_ShortReal) (theDpix * anOffset));
|
||||||
myLabelValues.Init (theWorkspace->GetGlContext(), aTextValue, aPos);
|
myLabelValues->Init (theWorkspace->GetGlContext(), aTextValue, aPos);
|
||||||
myLabelValues.Render (theWorkspace);
|
myLabelValues->Render (theWorkspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -559,9 +565,9 @@ void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorks
|
|||||||
if (myData.CubicAxesCallback)
|
if (myData.CubicAxesCallback)
|
||||||
{
|
{
|
||||||
myData.CubicAxesCallback (myData.PtrView);
|
myData.CubicAxesCallback (myData.PtrView);
|
||||||
if (!myAxes[0].Line.IsInitialized()
|
if (!myAxes[0].Line->IsInitialized()
|
||||||
|| !myAxes[1].Line.IsInitialized()
|
|| !myAxes[1].Line->IsInitialized()
|
||||||
|| !myAxes[2].Line.IsInitialized()
|
|| !myAxes[2].Line->IsInitialized()
|
||||||
|| OpenGl_Vec3 (anOldMin - myMin).Modulus() > Precision::Confusion()
|
|| OpenGl_Vec3 (anOldMin - myMin).Modulus() > Precision::Confusion()
|
||||||
|| OpenGl_Vec3 (anOldMax - myMax).Modulus() > Precision::Confusion())
|
|| OpenGl_Vec3 (anOldMax - myMax).Modulus() > Precision::Confusion())
|
||||||
{
|
{
|
||||||
@@ -605,8 +611,8 @@ void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorks
|
|||||||
Standard_ExtCharacter anAxesState = getGridAxes (aCorners, aGridAxes);
|
Standard_ExtCharacter anAxesState = getGridAxes (aCorners, aGridAxes);
|
||||||
|
|
||||||
// Remember current aspects
|
// Remember current aspects
|
||||||
const OpenGl_AspectLine* anOldAspectLine = theWorkspace->AspectLine();
|
const Handle(OpenGl_AspectLine)& anOldAspectLine = theWorkspace->AspectLine();
|
||||||
const OpenGl_AspectText* anOldAspectText = theWorkspace->AspectText();
|
const Handle(OpenGl_AspectText)& anOldAspectText = theWorkspace->AspectText();
|
||||||
|
|
||||||
OpenGl_Mat4 aModelMatrix;
|
OpenGl_Mat4 aModelMatrix;
|
||||||
aModelMatrix.Convert (aContext->WorldViewState.Current());
|
aModelMatrix.Convert (aContext->WorldViewState.Current());
|
||||||
@@ -618,7 +624,7 @@ void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorks
|
|||||||
|
|
||||||
if (myData.ToDrawGrid())
|
if (myData.ToDrawGrid())
|
||||||
{
|
{
|
||||||
theWorkspace->SetAspectLine (&myGridLineAspect);
|
theWorkspace->SetAspectLine (myGridLineAspect);
|
||||||
|
|
||||||
// render grid edges
|
// render grid edges
|
||||||
if (anAxesState & XOO_XYO)
|
if (anAxesState & XOO_XYO)
|
||||||
@@ -714,13 +720,14 @@ void OpenGl_GraduatedTrihedron::SetMinMax (const OpenGl_Vec3& theMin, const Open
|
|||||||
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
|
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
|
||||||
const OpenGl_Vec3& theDirection)
|
const OpenGl_Vec3& theDirection)
|
||||||
: Direction (theDirection),
|
: Direction (theDirection),
|
||||||
Label (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(), theDirection, THE_LABEL_PARAMS),
|
Label (new OpenGl_Text(NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(), theDirection, THE_LABEL_PARAMS)),
|
||||||
Tickmark (NULL),
|
Tickmark (new OpenGl_PrimitiveArray (NULL)),
|
||||||
Line (NULL),
|
Line (new OpenGl_PrimitiveArray (NULL)),
|
||||||
Arrow (NULL)
|
Arrow (new OpenGl_PrimitiveArray (NULL))
|
||||||
{
|
{
|
||||||
NameColor = theAspect.NameColor();
|
NameColor = theAspect.NameColor();
|
||||||
LineAspect.Aspect()->SetColor (theAspect.Color());
|
LineAspect = new OpenGl_AspectLine();
|
||||||
|
LineAspect->Aspect()->SetColor (theAspect.Color());
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -743,9 +750,9 @@ OpenGl_GraduatedTrihedron::Axis& OpenGl_GraduatedTrihedron::Axis::operator= (con
|
|||||||
LineAspect = theOther.LineAspect;
|
LineAspect = theOther.LineAspect;
|
||||||
Label = theOther.Label;
|
Label = theOther.Label;
|
||||||
|
|
||||||
Line .InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Line.Indices(), theOther.Line.Attributes(), theOther.Line.Bounds());
|
Line ->InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Line->Indices(), theOther.Line->Attributes(), theOther.Line->Bounds());
|
||||||
Tickmark.InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Tickmark.Indices(), theOther.Tickmark.Attributes(), theOther.Tickmark.Bounds());
|
Tickmark->InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Tickmark->Indices(), theOther.Tickmark->Attributes(), theOther.Tickmark->Bounds());
|
||||||
Arrow .InitBuffers (NULL, Graphic3d_TOPA_POLYLINES, theOther.Arrow.Indices(), theOther.Arrow.Attributes(), theOther.Arrow.Bounds());
|
Arrow ->InitBuffers (NULL, Graphic3d_TOPA_POLYLINES, theOther.Arrow->Indices(), theOther.Arrow->Attributes(), theOther.Arrow->Bounds());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -780,8 +787,8 @@ void OpenGl_GraduatedTrihedron::Axis::InitArrow (const Handle(OpenGl_Context)& t
|
|||||||
anArray->AddVertex (aPoint3);
|
anArray->AddVertex (aPoint3);
|
||||||
anArray->AddVertex (aPoint1);
|
anArray->AddVertex (aPoint1);
|
||||||
|
|
||||||
Arrow.InitBuffers (theContext, Graphic3d_TOPA_POLYLINES,
|
Arrow->InitBuffers (theContext, Graphic3d_TOPA_POLYLINES,
|
||||||
anArray->Indices(), anArray->Attributes(), anArray->Bounds());
|
anArray->Indices(), anArray->Attributes(), anArray->Bounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -795,8 +802,8 @@ void OpenGl_GraduatedTrihedron::Axis::InitTickmark (const Handle(OpenGl_Context)
|
|||||||
Handle(Graphic3d_ArrayOfSegments) anArray = new Graphic3d_ArrayOfSegments (2);
|
Handle(Graphic3d_ArrayOfSegments) anArray = new Graphic3d_ArrayOfSegments (2);
|
||||||
anArray->AddVertex (0.0f, 0.0f, 0.0f);
|
anArray->AddVertex (0.0f, 0.0f, 0.0f);
|
||||||
anArray->AddVertex (theDir);
|
anArray->AddVertex (theDir);
|
||||||
Tickmark.InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
|
Tickmark->InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
|
||||||
anArray->Indices(), anArray->Attributes(), anArray->Bounds());
|
anArray->Indices(), anArray->Attributes(), anArray->Bounds());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -812,8 +819,8 @@ void OpenGl_GraduatedTrihedron::Axis::InitLine (const Handle(OpenGl_Context)& th
|
|||||||
anArray->AddVertex (0.0f, 0.0f, 0.0f);
|
anArray->AddVertex (0.0f, 0.0f, 0.0f);
|
||||||
anArray->AddVertex (theDir);
|
anArray->AddVertex (theDir);
|
||||||
|
|
||||||
Line.InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
|
Line->InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
|
||||||
anArray->Indices(), anArray->Attributes(), anArray->Bounds());
|
anArray->Indices(), anArray->Attributes(), anArray->Bounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -822,8 +829,8 @@ void OpenGl_GraduatedTrihedron::Axis::InitLine (const Handle(OpenGl_Context)& th
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_GraduatedTrihedron::Axis::Release (OpenGl_Context* theCtx)
|
void OpenGl_GraduatedTrihedron::Axis::Release (OpenGl_Context* theCtx)
|
||||||
{
|
{
|
||||||
Label .Release (theCtx);
|
Label ->Release (theCtx);
|
||||||
Tickmark.Release (theCtx);
|
Tickmark->Release (theCtx);
|
||||||
Line .Release (theCtx);
|
Line ->Release (theCtx);
|
||||||
Arrow .Release (theCtx);
|
Arrow ->Release (theCtx);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ class OpenGl_View;
|
|||||||
//! @sa Graphic3d_GraduatedTrihedron
|
//! @sa Graphic3d_GraduatedTrihedron
|
||||||
class OpenGl_GraduatedTrihedron : public OpenGl_Element
|
class OpenGl_GraduatedTrihedron : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_GraduatedTrihedron, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
@@ -70,11 +71,11 @@ private:
|
|||||||
|
|
||||||
OpenGl_Vec3 Direction;
|
OpenGl_Vec3 Direction;
|
||||||
Quantity_Color NameColor;
|
Quantity_Color NameColor;
|
||||||
OpenGl_AspectLine LineAspect;
|
Handle(OpenGl_AspectLine) LineAspect;
|
||||||
mutable OpenGl_Text Label;
|
mutable Handle(OpenGl_Text) Label;
|
||||||
mutable OpenGl_PrimitiveArray Tickmark;
|
mutable Handle(OpenGl_PrimitiveArray) Tickmark;
|
||||||
mutable OpenGl_PrimitiveArray Line;
|
mutable Handle(OpenGl_PrimitiveArray) Line;
|
||||||
mutable OpenGl_PrimitiveArray Arrow;
|
mutable Handle(OpenGl_PrimitiveArray) Arrow;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -165,7 +166,7 @@ private:
|
|||||||
//! @param thaTx the X for vector of translation
|
//! @param thaTx the X for vector of translation
|
||||||
//! @param thaTy the Y for vector of translation
|
//! @param thaTy the Y for vector of translation
|
||||||
//! @param thaTz the Z for vector of translation
|
//! @param thaTz the Z for vector of translation
|
||||||
void renderLine (const OpenGl_PrimitiveArray& theLine,
|
void renderLine (const Handle(OpenGl_PrimitiveArray)& theLine,
|
||||||
const Handle(OpenGl_Workspace)& theWorkspace,
|
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
const OpenGl_Mat4& theMat,
|
const OpenGl_Mat4& theMat,
|
||||||
const Standard_ShortReal theXt,
|
const Standard_ShortReal theXt,
|
||||||
@@ -215,13 +216,13 @@ protected:
|
|||||||
|
|
||||||
mutable Axis myAxes[3]; //!< Axes for trihedron
|
mutable Axis myAxes[3]; //!< Axes for trihedron
|
||||||
mutable Graphic3d_GraduatedTrihedron myData;
|
mutable Graphic3d_GraduatedTrihedron myData;
|
||||||
mutable OpenGl_AspectLine myGridLineAspect; //!< Color grid properties
|
mutable Handle(OpenGl_AspectLine) myGridLineAspect; //!< Color grid properties
|
||||||
|
|
||||||
protected: //! @name Labels properties
|
protected: //! @name Labels properties
|
||||||
|
|
||||||
mutable OpenGl_Text myLabelValues;
|
mutable Handle(OpenGl_Text) myLabelValues;
|
||||||
mutable OpenGl_AspectText myAspectLabels;
|
mutable Handle(OpenGl_AspectText) myAspectLabels;
|
||||||
mutable OpenGl_AspectText myAspectValues;
|
mutable Handle(OpenGl_AspectText) myAspectValues;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -562,8 +562,8 @@ void OpenGl_GraphicDriver::TextSize (const Handle(Graphic3d_CView)& theView,
|
|||||||
const Standard_ShortReal aHeight = (theHeight < 2.0f) ? DefaultTextHeight() : theHeight;
|
const Standard_ShortReal aHeight = (theHeight < 2.0f) ? DefaultTextHeight() : theHeight;
|
||||||
OpenGl_TextParam aTextParam;
|
OpenGl_TextParam aTextParam;
|
||||||
aTextParam.Height = (int )aHeight;
|
aTextParam.Height = (int )aHeight;
|
||||||
OpenGl_AspectText aTextAspect;
|
Handle(OpenGl_AspectText) aTextAspect = new OpenGl_AspectText();
|
||||||
aTextAspect.Aspect()->SetSpace (0.3);
|
aTextAspect->Aspect()->SetSpace (0.3);
|
||||||
TCollection_ExtendedString anExtText = theText;
|
TCollection_ExtendedString anExtText = theText;
|
||||||
NCollection_String aText (anExtText.ToExtString());
|
NCollection_String aText (anExtText.ToExtString());
|
||||||
OpenGl_Text::StringSize(aCtx, aText, aTextAspect, aTextParam, theView->RenderingParams().Resolution, theWidth, theAscent, theDescent);
|
OpenGl_Text::StringSize(aCtx, aText, aTextAspect, aTextParam, theView->RenderingParams().Resolution, theWidth, theAscent, theDescent);
|
||||||
|
@@ -40,7 +40,7 @@ namespace
|
|||||||
//! should be rendered or not.
|
//! should be rendered or not.
|
||||||
//! @return True if element passes the check and renders,
|
//! @return True if element passes the check and renders,
|
||||||
static bool renderFiltered (const Handle(OpenGl_Workspace)& theWorkspace,
|
static bool renderFiltered (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||||
OpenGl_Element* theElement)
|
const Handle(OpenGl_Element)& theElement)
|
||||||
{
|
{
|
||||||
if (!theWorkspace->ShouldRender (theElement))
|
if (!theWorkspace->ShouldRender (theElement))
|
||||||
{
|
{
|
||||||
@@ -58,12 +58,6 @@ namespace
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
OpenGl_Group::OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct)
|
OpenGl_Group::OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct)
|
||||||
: Graphic3d_Group (theStruct),
|
: Graphic3d_Group (theStruct),
|
||||||
myAspectLine(NULL),
|
|
||||||
myAspectFace(NULL),
|
|
||||||
myAspectMarker(NULL),
|
|
||||||
myAspectText(NULL),
|
|
||||||
myFirst(NULL),
|
|
||||||
myLast(NULL),
|
|
||||||
myIsRaytracable (Standard_False)
|
myIsRaytracable (Standard_False)
|
||||||
{
|
{
|
||||||
Handle(OpenGl_Structure) aStruct = Handle(OpenGl_Structure)::DownCast (myStructure->CStructure());
|
Handle(OpenGl_Structure) aStruct = Handle(OpenGl_Structure)::DownCast (myStructure->CStructure());
|
||||||
@@ -93,7 +87,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myAspectLine == NULL)
|
if (myAspectLine.IsNull())
|
||||||
{
|
{
|
||||||
myAspectLine = new OpenGl_AspectLine (theAspect);
|
myAspectLine = new OpenGl_AspectLine (theAspect);
|
||||||
}
|
}
|
||||||
@@ -110,7 +104,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspect)
|
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspect)
|
||||||
{
|
{
|
||||||
if (myAspectLine == NULL)
|
if (myAspectLine.IsNull())
|
||||||
{
|
{
|
||||||
SetGroupPrimitivesAspect (theAspect);
|
SetGroupPrimitivesAspect (theAspect);
|
||||||
return;
|
return;
|
||||||
@@ -120,7 +114,7 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& th
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine (theAspect);
|
Handle(OpenGl_AspectLine) anAspectLine = new OpenGl_AspectLine (theAspect);
|
||||||
AddElement (anAspectLine);
|
AddElement (anAspectLine);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@@ -136,7 +130,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillAr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myAspectFace == NULL)
|
if (myAspectFace.IsNull())
|
||||||
{
|
{
|
||||||
myAspectFace = new OpenGl_AspectFace (theAspect);
|
myAspectFace = new OpenGl_AspectFace (theAspect);
|
||||||
}
|
}
|
||||||
@@ -163,7 +157,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillAr
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
|
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
|
||||||
{
|
{
|
||||||
if (myAspectFace == NULL)
|
if (myAspectFace.IsNull())
|
||||||
{
|
{
|
||||||
SetGroupPrimitivesAspect (theAspect);
|
SetGroupPrimitivesAspect (theAspect);
|
||||||
return;
|
return;
|
||||||
@@ -173,7 +167,7 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace (theAspect);
|
Handle(OpenGl_AspectFace) anAspectFace = new OpenGl_AspectFace (theAspect);
|
||||||
AddElement (anAspectFace);
|
AddElement (anAspectFace);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@@ -189,7 +183,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myAspectMarker == NULL)
|
if (myAspectMarker.IsNull())
|
||||||
{
|
{
|
||||||
myAspectMarker = new OpenGl_AspectMarker (theAspMarker);
|
myAspectMarker = new OpenGl_AspectMarker (theAspMarker);
|
||||||
}
|
}
|
||||||
@@ -206,7 +200,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
|
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
|
||||||
{
|
{
|
||||||
if (myAspectMarker == NULL)
|
if (myAspectMarker.IsNull())
|
||||||
{
|
{
|
||||||
SetGroupPrimitivesAspect (theAspMarker);
|
SetGroupPrimitivesAspect (theAspMarker);
|
||||||
return;
|
return;
|
||||||
@@ -216,7 +210,7 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker (theAspMarker);
|
Handle(OpenGl_AspectMarker) anAspectMarker = new OpenGl_AspectMarker (theAspMarker);
|
||||||
AddElement (anAspectMarker);
|
AddElement (anAspectMarker);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@@ -232,7 +226,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myAspectText == NULL)
|
if (myAspectText.IsNull())
|
||||||
{
|
{
|
||||||
myAspectText = new OpenGl_AspectText (theAspText);
|
myAspectText = new OpenGl_AspectText (theAspText);
|
||||||
}
|
}
|
||||||
@@ -249,7 +243,7 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
|
void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
|
||||||
{
|
{
|
||||||
if (myAspectText == NULL)
|
if (myAspectText.IsNull())
|
||||||
{
|
{
|
||||||
SetGroupPrimitivesAspect (theAspText);
|
SetGroupPrimitivesAspect (theAspText);
|
||||||
return;
|
return;
|
||||||
@@ -259,7 +253,7 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& th
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGl_AspectText* anAspectText = new OpenGl_AspectText (theAspText);
|
Handle(OpenGl_AspectText) anAspectText = new OpenGl_AspectText (theAspText);
|
||||||
AddElement (anAspectText);
|
AddElement (anAspectText);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
@@ -270,25 +264,25 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& th
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::SynchronizeAspects()
|
void OpenGl_Group::SynchronizeAspects()
|
||||||
{
|
{
|
||||||
if (myAspectFace != NULL)
|
if (!myAspectFace.IsNull())
|
||||||
{
|
{
|
||||||
myAspectFace->SynchronizeAspects();
|
myAspectFace->SynchronizeAspects();
|
||||||
}
|
}
|
||||||
if (myAspectLine != NULL)
|
if (!myAspectLine.IsNull())
|
||||||
{
|
{
|
||||||
myAspectLine->SynchronizeAspects();
|
myAspectLine->SynchronizeAspects();
|
||||||
}
|
}
|
||||||
if (myAspectMarker != NULL)
|
if (!myAspectMarker.IsNull())
|
||||||
{
|
{
|
||||||
myAspectMarker->SynchronizeAspects();
|
myAspectMarker->SynchronizeAspects();
|
||||||
}
|
}
|
||||||
if (myAspectText != NULL)
|
if (!myAspectText.IsNull())
|
||||||
{
|
{
|
||||||
myAspectText->SynchronizeAspects();
|
myAspectText->SynchronizeAspects();
|
||||||
}
|
}
|
||||||
for (OpenGl_ElementNode* aNode = myFirst; aNode != NULL; aNode = aNode->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator(myElements); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
aNode->elem->SynchronizeAspects();
|
anElemIterator.ChangeValue()->SynchronizeAspects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +305,7 @@ void OpenGl_Group::AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theTy
|
|||||||
OpenGl_Structure* aStruct = GlStruct();
|
OpenGl_Structure* aStruct = GlStruct();
|
||||||
const OpenGl_GraphicDriver* aDriver = aStruct->GlDriver();
|
const OpenGl_GraphicDriver* aDriver = aStruct->GlDriver();
|
||||||
|
|
||||||
OpenGl_PrimitiveArray* anArray = new OpenGl_PrimitiveArray (aDriver, theType, theIndices, theAttribs, theBounds);
|
Handle(OpenGl_PrimitiveArray) anArray = new OpenGl_PrimitiveArray (aDriver, theType, theIndices, theAttribs, theBounds);
|
||||||
AddElement (anArray);
|
AddElement (anArray);
|
||||||
|
|
||||||
Graphic3d_Group::AddPrimitiveArray (theType, theIndices, theAttribs, theBounds, theToEvalMinMax);
|
Graphic3d_Group::AddPrimitiveArray (theType, theIndices, theAttribs, theBounds, theToEvalMinMax);
|
||||||
@@ -341,7 +335,7 @@ void OpenGl_Group::Text (const Standard_CString theTextUtf,
|
|||||||
aParams.HAlign = theHta;
|
aParams.HAlign = theHta;
|
||||||
aParams.VAlign = theVta;
|
aParams.VAlign = theVta;
|
||||||
const OpenGl_Vec3 aPoint (thePoint.X(), thePoint.Y(), thePoint.Z());
|
const OpenGl_Vec3 aPoint (thePoint.X(), thePoint.Y(), thePoint.Z());
|
||||||
OpenGl_Text* aText = new OpenGl_Text (theTextUtf, aPoint, aParams);
|
Handle(OpenGl_Text) aText = new OpenGl_Text (theTextUtf, aPoint, aParams);
|
||||||
AddElement (aText);
|
AddElement (aText);
|
||||||
Graphic3d_Group::Text (theTextUtf, thePoint, theHeight, theAngle,
|
Graphic3d_Group::Text (theTextUtf, thePoint, theHeight, theAngle,
|
||||||
theTp, theHta, theVta, theToEvalMinMax);
|
theTp, theHta, theVta, theToEvalMinMax);
|
||||||
@@ -373,7 +367,7 @@ void OpenGl_Group::Text (const Standard_CString theTextUtf,
|
|||||||
aParams.HAlign = theHTA;
|
aParams.HAlign = theHTA;
|
||||||
aParams.VAlign = theVTA;
|
aParams.VAlign = theVTA;
|
||||||
|
|
||||||
OpenGl_Text* aText = new OpenGl_Text (theTextUtf, theOrientation, aParams, theHasOwnAnchor != Standard_False);
|
Handle(OpenGl_Text) aText = new OpenGl_Text (theTextUtf, theOrientation, aParams, theHasOwnAnchor != Standard_False);
|
||||||
|
|
||||||
AddElement (aText);
|
AddElement (aText);
|
||||||
|
|
||||||
@@ -396,7 +390,7 @@ void OpenGl_Group::Text (const Standard_CString theTextUtf,
|
|||||||
void OpenGl_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
void OpenGl_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
||||||
const gp_Ax2& theRefPlane)
|
const gp_Ax2& theRefPlane)
|
||||||
{
|
{
|
||||||
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
|
Handle(OpenGl_Flipper) aFlipper = new OpenGl_Flipper (theRefPlane);
|
||||||
aFlipper->SetOptions (theIsEnabled);
|
aFlipper->SetOptions (theIsEnabled);
|
||||||
AddElement (aFlipper);
|
AddElement (aFlipper);
|
||||||
}
|
}
|
||||||
@@ -407,7 +401,7 @@ void OpenGl_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
|
void OpenGl_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
|
||||||
{
|
{
|
||||||
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
|
Handle(OpenGl_StencilTest) aStencilTest = new OpenGl_StencilTest();
|
||||||
aStencilTest->SetOptions (theIsEnabled);
|
aStencilTest->SetOptions (theIsEnabled);
|
||||||
AddElement (aStencilTest);
|
AddElement (aStencilTest);
|
||||||
}
|
}
|
||||||
@@ -416,16 +410,11 @@ void OpenGl_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
|
|||||||
// function : AddElement
|
// function : AddElement
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::AddElement (OpenGl_Element* theElem)
|
void OpenGl_Group::AddElement (Handle(OpenGl_Element) theElem)
|
||||||
{
|
{
|
||||||
OpenGl_ElementNode *aNode = new OpenGl_ElementNode();
|
myElements.Append (theElem);
|
||||||
|
|
||||||
aNode->elem = theElem;
|
if (OpenGl_Raytrace::IsRaytracedElement (theElem))
|
||||||
aNode->next = NULL;
|
|
||||||
(myLast? myLast->next : myFirst) = aNode;
|
|
||||||
myLast = aNode;
|
|
||||||
|
|
||||||
if (OpenGl_Raytrace::IsRaytracedElement (aNode))
|
|
||||||
{
|
{
|
||||||
myIsRaytracable = Standard_True;
|
myIsRaytracable = Standard_True;
|
||||||
|
|
||||||
@@ -446,19 +435,19 @@ void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
// Setup aspects
|
// Setup aspects
|
||||||
theWorkspace->SetAllowFaceCulling (myIsClosed
|
theWorkspace->SetAllowFaceCulling (myIsClosed
|
||||||
&& !theWorkspace->GetGlContext()->Clipping().IsClippingOrCappingOn());
|
&& !theWorkspace->GetGlContext()->Clipping().IsClippingOrCappingOn());
|
||||||
const OpenGl_AspectLine* aBackAspectLine = theWorkspace->AspectLine();
|
const Handle(OpenGl_AspectLine)& aBackAspectLine = theWorkspace->AspectLine();
|
||||||
const OpenGl_AspectFace* aBackAspectFace = theWorkspace->AspectFace();
|
const Handle(OpenGl_AspectFace)& aBackAspectFace = theWorkspace->AspectFace();
|
||||||
const OpenGl_AspectMarker* aBackAspectMarker = theWorkspace->AspectMarker();
|
const Handle(OpenGl_AspectMarker)& aBackAspectMarker = theWorkspace->AspectMarker();
|
||||||
const OpenGl_AspectText* aBackAspectText = theWorkspace->AspectText();
|
const Handle(OpenGl_AspectText)& aBackAspectText = theWorkspace->AspectText();
|
||||||
const bool isLineSet = myAspectLine && renderFiltered (theWorkspace, myAspectLine);
|
const bool isLineSet = !myAspectLine.IsNull() && renderFiltered (theWorkspace, myAspectLine);
|
||||||
const bool isFaceSet = myAspectFace && renderFiltered (theWorkspace, myAspectFace);
|
const bool isFaceSet = !myAspectFace.IsNull() && renderFiltered (theWorkspace, myAspectFace);
|
||||||
const bool isMarkerSet = myAspectMarker && renderFiltered (theWorkspace, myAspectMarker);
|
const bool isMarkerSet = !myAspectMarker.IsNull() && renderFiltered (theWorkspace, myAspectMarker);
|
||||||
const bool isTextSet = myAspectText && renderFiltered (theWorkspace, myAspectText);
|
const bool isTextSet = !myAspectText.IsNull() && renderFiltered (theWorkspace, myAspectText);
|
||||||
|
|
||||||
// Render group elements
|
// Render group elements
|
||||||
for (OpenGl_ElementNode* aNodeIter = myFirst; aNodeIter != NULL; aNodeIter = aNodeIter->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator(myElements); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
renderFiltered (theWorkspace, aNodeIter->elem);
|
renderFiltered (theWorkspace, anElemIterator.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore aspects
|
// Restore aspects
|
||||||
@@ -499,14 +488,11 @@ void OpenGl_Group::Clear (const Standard_Boolean theToUpdateStructureMgr)
|
|||||||
void OpenGl_Group::Release (const Handle(OpenGl_Context)& theGlCtx)
|
void OpenGl_Group::Release (const Handle(OpenGl_Context)& theGlCtx)
|
||||||
{
|
{
|
||||||
// Delete elements
|
// Delete elements
|
||||||
while (myFirst != NULL)
|
for (OpenGl_ElementNodes::Iterator anElemIterator(myElements); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
OpenGl_ElementNode* aNext = myFirst->next;
|
OpenGl_Element::Destroy (theGlCtx.operator->(), anElemIterator.ChangeValue());
|
||||||
OpenGl_Element::Destroy (theGlCtx.operator->(), myFirst->elem);
|
|
||||||
delete myFirst;
|
|
||||||
myFirst = aNext;
|
|
||||||
}
|
}
|
||||||
myLast = NULL;
|
myElements.Clear();
|
||||||
|
|
||||||
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectLine);
|
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectLine);
|
||||||
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectFace);
|
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectFace);
|
||||||
|
@@ -29,12 +29,7 @@
|
|||||||
class OpenGl_Group;
|
class OpenGl_Group;
|
||||||
class OpenGl_Structure;
|
class OpenGl_Structure;
|
||||||
|
|
||||||
struct OpenGl_ElementNode
|
typedef NCollection_List<Handle(OpenGl_Element)> OpenGl_ElementNodes;
|
||||||
{
|
|
||||||
OpenGl_Element* elem;
|
|
||||||
OpenGl_ElementNode* next;
|
|
||||||
DEFINE_STANDARD_ALLOC
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Implementation of low-level graphic group.
|
//! Implementation of low-level graphic group.
|
||||||
class OpenGl_Group : public Graphic3d_Group
|
class OpenGl_Group : public Graphic3d_Group
|
||||||
@@ -50,9 +45,9 @@ public:
|
|||||||
//! Return line aspect.
|
//! Return line aspect.
|
||||||
virtual Handle(Graphic3d_AspectLine3d) LineAspect() const Standard_OVERRIDE
|
virtual Handle(Graphic3d_AspectLine3d) LineAspect() const Standard_OVERRIDE
|
||||||
{
|
{
|
||||||
return myAspectLine != NULL
|
return !myAspectLine.IsNull()
|
||||||
? myAspectLine->Aspect()
|
? myAspectLine->Aspect()
|
||||||
: Handle(Graphic3d_AspectLine3d)();
|
: Handle(Graphic3d_AspectLine3d)();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Update line aspect.
|
//! Update line aspect.
|
||||||
@@ -64,9 +59,9 @@ public:
|
|||||||
//! Return marker aspect.
|
//! Return marker aspect.
|
||||||
virtual Handle(Graphic3d_AspectMarker3d) MarkerAspect() const Standard_OVERRIDE
|
virtual Handle(Graphic3d_AspectMarker3d) MarkerAspect() const Standard_OVERRIDE
|
||||||
{
|
{
|
||||||
return myAspectMarker != NULL
|
return !myAspectMarker.IsNull()
|
||||||
? myAspectMarker->Aspect()
|
? myAspectMarker->Aspect()
|
||||||
: Handle(Graphic3d_AspectMarker3d)();
|
: Handle(Graphic3d_AspectMarker3d)();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Update marker aspect.
|
//! Update marker aspect.
|
||||||
@@ -78,7 +73,7 @@ public:
|
|||||||
//! Return fill area aspect.
|
//! Return fill area aspect.
|
||||||
virtual Handle(Graphic3d_AspectFillArea3d) FillAreaAspect() const Standard_OVERRIDE
|
virtual Handle(Graphic3d_AspectFillArea3d) FillAreaAspect() const Standard_OVERRIDE
|
||||||
{
|
{
|
||||||
return myAspectFace != NULL
|
return !myAspectFace.IsNull()
|
||||||
? myAspectFace->Aspect()
|
? myAspectFace->Aspect()
|
||||||
: Handle(Graphic3d_AspectFillArea3d)();
|
: Handle(Graphic3d_AspectFillArea3d)();
|
||||||
}
|
}
|
||||||
@@ -92,7 +87,7 @@ public:
|
|||||||
//! Return marker aspect.
|
//! Return marker aspect.
|
||||||
virtual Handle(Graphic3d_AspectText3d) TextAspect() const Standard_OVERRIDE
|
virtual Handle(Graphic3d_AspectText3d) TextAspect() const Standard_OVERRIDE
|
||||||
{
|
{
|
||||||
return myAspectText != NULL
|
return !myAspectText.IsNull()
|
||||||
? myAspectText->Aspect()
|
? myAspectText->Aspect()
|
||||||
: Handle(Graphic3d_AspectText3d)();
|
: Handle(Graphic3d_AspectText3d)();
|
||||||
}
|
}
|
||||||
@@ -145,16 +140,16 @@ public:
|
|||||||
|
|
||||||
OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); }
|
OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); }
|
||||||
|
|
||||||
Standard_EXPORT void AddElement (OpenGl_Element* theElem);
|
Standard_EXPORT void AddElement (Handle(OpenGl_Element) theElem);
|
||||||
|
|
||||||
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||||
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
||||||
|
|
||||||
//! Returns first OpenGL element node of the group.
|
//! Returns OpenGl elements of the group
|
||||||
const OpenGl_ElementNode* FirstNode() const { return myFirst; }
|
const OpenGl_ElementNodes& GetElements() const { return myElements; }
|
||||||
|
|
||||||
//! Returns OpenGL face aspect.
|
//! Returns OpenGL face aspect.
|
||||||
const OpenGl_AspectFace* AspectFace() const { return myAspectFace; }
|
const Handle(OpenGl_AspectFace)& AspectFace() const { return myAspectFace; }
|
||||||
|
|
||||||
//! Is the group ray-tracable (contains ray-tracable elements)?
|
//! Is the group ray-tracable (contains ray-tracable elements)?
|
||||||
Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
|
Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
|
||||||
@@ -165,13 +160,12 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
OpenGl_AspectLine* myAspectLine;
|
Handle(OpenGl_AspectLine) myAspectLine;
|
||||||
OpenGl_AspectFace* myAspectFace;
|
Handle(OpenGl_AspectFace) myAspectFace;
|
||||||
OpenGl_AspectMarker* myAspectMarker;
|
Handle(OpenGl_AspectMarker) myAspectMarker;
|
||||||
OpenGl_AspectText* myAspectText;
|
Handle(OpenGl_AspectText) myAspectText;
|
||||||
|
|
||||||
OpenGl_ElementNode* myFirst;
|
OpenGl_ElementNodes myElements;
|
||||||
OpenGl_ElementNode* myLast;
|
|
||||||
|
|
||||||
Standard_Boolean myIsRaytracable;
|
Standard_Boolean myIsRaytracable;
|
||||||
|
|
||||||
|
@@ -13,12 +13,13 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <OpenGl_PrimitiveArray.hxx>
|
||||||
|
|
||||||
#include <OpenGl_AspectFace.hxx>
|
#include <OpenGl_AspectFace.hxx>
|
||||||
#include <OpenGl_Context.hxx>
|
#include <OpenGl_Context.hxx>
|
||||||
#include <OpenGl_GraphicDriver.hxx>
|
#include <OpenGl_GraphicDriver.hxx>
|
||||||
#include <OpenGl_IndexBuffer.hxx>
|
#include <OpenGl_IndexBuffer.hxx>
|
||||||
#include <OpenGl_PointSprite.hxx>
|
#include <OpenGl_PointSprite.hxx>
|
||||||
#include <OpenGl_PrimitiveArray.hxx>
|
|
||||||
#include <OpenGl_Sampler.hxx>
|
#include <OpenGl_Sampler.hxx>
|
||||||
#include <OpenGl_ShaderManager.hxx>
|
#include <OpenGl_ShaderManager.hxx>
|
||||||
#include <OpenGl_ShaderProgram.hxx>
|
#include <OpenGl_ShaderProgram.hxx>
|
||||||
@@ -28,6 +29,8 @@
|
|||||||
#include <Graphic3d_TextureParams.hxx>
|
#include <Graphic3d_TextureParams.hxx>
|
||||||
#include <NCollection_AlignedAllocator.hxx>
|
#include <NCollection_AlignedAllocator.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_PrimitiveArray, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//! Convert data type to GL info
|
//! Convert data type to GL info
|
||||||
@@ -502,8 +505,10 @@ void OpenGl_PrimitiveArray::drawEdges (const OpenGl_Vec4& theEdgeCo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OpenGl_AspectLine* anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace()->AspectEdge());
|
const Handle(OpenGl_AspectLine) anAspectLineOld = theWorkspace->AspectLine();
|
||||||
const OpenGl_AspectLine* anAspect = theWorkspace->ApplyAspectLine();
|
theWorkspace->SetAspectLine (theWorkspace->AspectFace()->AspectEdge());
|
||||||
|
|
||||||
|
const Handle(OpenGl_AspectLine)& anAspect = theWorkspace->ApplyAspectLine();
|
||||||
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||||
@@ -588,8 +593,8 @@ void OpenGl_PrimitiveArray::drawEdges (const OpenGl_Vec4& theEdgeCo
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_PrimitiveArray::drawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const
|
void OpenGl_PrimitiveArray::drawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||||
{
|
{
|
||||||
const OpenGl_AspectMarker* anAspectMarker = theWorkspace->ApplyAspectMarker();
|
const Handle(OpenGl_AspectMarker)& anAspectMarker = theWorkspace->ApplyAspectMarker();
|
||||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||||
const GLenum aDrawMode = !aCtx->ActiveProgram().IsNull()
|
const GLenum aDrawMode = !aCtx->ActiveProgram().IsNull()
|
||||||
&& aCtx->ActiveProgram()->HasTessellationStage()
|
&& aCtx->ActiveProgram()->HasTessellationStage()
|
||||||
? GL_PATCHES
|
? GL_PATCHES
|
||||||
@@ -765,9 +770,9 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OpenGl_AspectFace* anAspectFace = theWorkspace->ApplyAspectFace();
|
const Handle(OpenGl_AspectFace)& anAspectFace = theWorkspace->ApplyAspectFace();
|
||||||
const OpenGl_AspectLine* anAspectLine = theWorkspace->ApplyAspectLine();
|
const Handle(OpenGl_AspectLine)& anAspectLine = theWorkspace->ApplyAspectLine();
|
||||||
const OpenGl_AspectMarker* anAspectMarker = myDrawMode == GL_POINTS
|
const Handle(OpenGl_AspectMarker)& anAspectMarker = myDrawMode == GL_POINTS
|
||||||
? theWorkspace->ApplyAspectMarker()
|
? theWorkspace->ApplyAspectMarker()
|
||||||
: theWorkspace->AspectMarker();
|
: theWorkspace->AspectMarker();
|
||||||
|
|
||||||
@@ -1041,7 +1046,7 @@ Standard_Boolean OpenGl_PrimitiveArray::processIndices (const Handle(OpenGl_Cont
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myAttribs->NbElements > std::numeric_limits<GLushort>::max())
|
if (myAttribs->NbElements > IntegerLast()/*std::numeric_limits<GLushort>::max()*/)
|
||||||
{
|
{
|
||||||
Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (new NCollection_AlignedAllocator (16));
|
Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (new NCollection_AlignedAllocator (16));
|
||||||
if (!anAttribs->Init (myIndices->NbElements, myAttribs->AttributesArray(), myAttribs->NbAttributes))
|
if (!anAttribs->Init (myIndices->NbElements, myAttribs->AttributesArray(), myAttribs->NbAttributes))
|
||||||
|
@@ -31,6 +31,7 @@ class OpenGl_GraphicDriver;
|
|||||||
//! Class for rendering of arbitrary primitive array.
|
//! Class for rendering of arbitrary primitive array.
|
||||||
class OpenGl_PrimitiveArray : public OpenGl_Element
|
class OpenGl_PrimitiveArray : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_PrimitiveArray, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
//! OpenGL does not provide a constant for "none" draw mode.
|
//! OpenGL does not provide a constant for "none" draw mode.
|
||||||
//! So we define our own one that does not conflict with GL constants and utilizes common GL invalid value.
|
//! So we define our own one that does not conflict with GL constants and utilizes common GL invalid value.
|
||||||
|
@@ -593,21 +593,10 @@ namespace OpenGl_Raytrace
|
|||||||
// function : IsRaytracedElement
|
// function : IsRaytracedElement
|
||||||
// purpose : Checks to see if the element contains ray-trace geometry
|
// purpose : Checks to see if the element contains ray-trace geometry
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean IsRaytracedElement (const OpenGl_ElementNode* theNode)
|
Standard_Boolean IsRaytracedElement (const Handle(OpenGl_Element) theElement)
|
||||||
{
|
{
|
||||||
OpenGl_PrimitiveArray* anArray = dynamic_cast<OpenGl_PrimitiveArray*> (theNode->elem);
|
Handle(OpenGl_PrimitiveArray) anArray = Handle(OpenGl_PrimitiveArray)::DownCast (theElement);
|
||||||
return anArray != NULL
|
return !anArray.IsNull()
|
||||||
&& anArray->DrawMode() >= GL_TRIANGLES;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : IsRaytracedElement
|
|
||||||
// purpose : Checks to see if the element contains ray-trace geometry
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Boolean IsRaytracedElement (const OpenGl_Element* theElement)
|
|
||||||
{
|
|
||||||
const OpenGl_PrimitiveArray* anArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theElement);
|
|
||||||
return anArray != NULL
|
|
||||||
&& anArray->DrawMode() >= GL_TRIANGLES;
|
&& anArray->DrawMode() >= GL_TRIANGLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,9 +606,9 @@ namespace OpenGl_Raytrace
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean IsRaytracedGroup (const OpenGl_Group* theGroup)
|
Standard_Boolean IsRaytracedGroup (const OpenGl_Group* theGroup)
|
||||||
{
|
{
|
||||||
for (const OpenGl_ElementNode* aNode = theGroup->FirstNode(); aNode != NULL; aNode = aNode->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator (theGroup->GetElements()); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
if (IsRaytracedElement (aNode))
|
if (IsRaytracedElement (anElemIterator.Value()))
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
@@ -36,10 +36,7 @@ namespace OpenGl_Raytrace
|
|||||||
Standard_Boolean IsRaytracedGroup (const OpenGl_Group* theGroup);
|
Standard_Boolean IsRaytracedGroup (const OpenGl_Group* theGroup);
|
||||||
|
|
||||||
//! Checks to see if the element contains ray-trace geometry.
|
//! Checks to see if the element contains ray-trace geometry.
|
||||||
Standard_Boolean IsRaytracedElement (const OpenGl_ElementNode* theNode);
|
Standard_Boolean IsRaytracedElement (const Handle(OpenGl_Element) theElement);
|
||||||
|
|
||||||
//! Checks to see if the element contains ray-trace geometry.
|
|
||||||
Standard_Boolean IsRaytracedElement (const OpenGl_Element* theElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Stores properties of surface material.
|
//! Stores properties of surface material.
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
#include <OpenGl_GlCore11.hxx>
|
#include <OpenGl_GlCore11.hxx>
|
||||||
#include <OpenGl_StencilTest.hxx>
|
#include <OpenGl_StencilTest.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_StencilTest, OpenGl_Element)
|
||||||
|
|
||||||
OpenGl_StencilTest::OpenGl_StencilTest()
|
OpenGl_StencilTest::OpenGl_StencilTest()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
class OpenGl_StencilTest : public OpenGl_Element
|
class OpenGl_StencilTest : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_StencilTest, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
|
@@ -460,10 +460,10 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
aCtx->ApplyModelViewMatrix();
|
aCtx->ApplyModelViewMatrix();
|
||||||
|
|
||||||
// remember aspects
|
// remember aspects
|
||||||
const OpenGl_AspectLine* aPrevAspectLine = theWorkspace->AspectLine();
|
const Handle(OpenGl_AspectLine)& aPrevAspectLine = theWorkspace->AspectLine();
|
||||||
const OpenGl_AspectFace* aPrevAspectFace = theWorkspace->AspectFace();
|
const Handle(OpenGl_AspectFace)& aPrevAspectFace = theWorkspace->AspectFace();
|
||||||
const OpenGl_AspectMarker* aPrevAspectMarker = theWorkspace->AspectMarker();
|
const Handle(OpenGl_AspectMarker)& aPrevAspectMarker = theWorkspace->AspectMarker();
|
||||||
const OpenGl_AspectText* aPrevAspectText = theWorkspace->AspectText();
|
const Handle(OpenGl_AspectText)& aPrevAspectText = theWorkspace->AspectText();
|
||||||
|
|
||||||
// Apply correction for mirror transform
|
// Apply correction for mirror transform
|
||||||
if (myIsMirrored)
|
if (myIsMirrored)
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
#include <Graphic3d_TransformUtils.hxx>
|
#include <Graphic3d_TransformUtils.hxx>
|
||||||
#include <TCollection_HAsciiString.hxx>
|
#include <TCollection_HAsciiString.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Text, OpenGl_Element)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static const GLdouble THE_IDENTITY_MATRIX[16] =
|
static const GLdouble THE_IDENTITY_MATRIX[16] =
|
||||||
@@ -287,7 +289,7 @@ void OpenGl_Text::Release (OpenGl_Context* theCtx)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||||
const NCollection_String& theText,
|
const NCollection_String& theText,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_TextParam& theParams,
|
const OpenGl_TextParam& theParams,
|
||||||
const unsigned int theResolution,
|
const unsigned int theResolution,
|
||||||
Standard_ShortReal& theWidth,
|
Standard_ShortReal& theWidth,
|
||||||
@@ -353,10 +355,10 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||||
{
|
{
|
||||||
theWorkspace->SetAspectFace (&theWorkspace->FontFaceAspect());
|
theWorkspace->SetAspectFace (theWorkspace->FontFaceAspect());
|
||||||
theWorkspace->ApplyAspectFace();
|
theWorkspace->ApplyAspectFace();
|
||||||
const OpenGl_AspectText* aTextAspect = theWorkspace->ApplyAspectText();
|
const Handle(OpenGl_AspectText)& aTextAspect = theWorkspace->ApplyAspectText();
|
||||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||||
const Handle(OpenGl_TextureSet) aPrevTexture = aCtx->BindTextures (Handle(OpenGl_TextureSet)());
|
const Handle(OpenGl_TextureSet) aPrevTexture = aCtx->BindTextures (Handle(OpenGl_TextureSet)());
|
||||||
|
|
||||||
// Bind custom shader program or generate default version
|
// Bind custom shader program or generate default version
|
||||||
@@ -367,7 +369,7 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
|
|
||||||
// use highlight color or colors from aspect
|
// use highlight color or colors from aspect
|
||||||
render (aCtx,
|
render (aCtx,
|
||||||
*aTextAspect,
|
aTextAspect,
|
||||||
theWorkspace->TextColor(),
|
theWorkspace->TextColor(),
|
||||||
theWorkspace->TextSubtitleColor(),
|
theWorkspace->TextSubtitleColor(),
|
||||||
aCtx->Resolution());
|
aCtx->Resolution());
|
||||||
@@ -390,12 +392,12 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const unsigned int theResolution) const
|
const unsigned int theResolution) const
|
||||||
{
|
{
|
||||||
render (theCtx, theTextAspect,
|
render (theCtx, theTextAspect,
|
||||||
theTextAspect.Aspect()->ColorRGBA(),
|
theTextAspect->Aspect()->ColorRGBA(),
|
||||||
theTextAspect.Aspect()->ColorSubTitleRGBA(),
|
theTextAspect->Aspect()->ColorSubTitleRGBA(),
|
||||||
theResolution);
|
theResolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +406,7 @@ void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_Vec3 theDVec) const
|
const OpenGl_Vec3 theDVec) const
|
||||||
{
|
{
|
||||||
OpenGl_Mat4d aModViewMat;
|
OpenGl_Mat4d aModViewMat;
|
||||||
@@ -422,7 +424,7 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
Graphic3d_TransformUtils::Translate<GLdouble> (aModViewMat, myPoint.x() + theDVec.x(), myPoint.y() + theDVec.y(), 0.f);
|
Graphic3d_TransformUtils::Translate<GLdouble> (aModViewMat, myPoint.x() + theDVec.x(), myPoint.y() + theDVec.y(), 0.f);
|
||||||
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, 1.f, -1.f, 1.f);
|
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, 1.f, -1.f, 1.f);
|
||||||
Graphic3d_TransformUtils::Rotate<GLdouble> (aModViewMat, theTextAspect.Aspect()->GetTextAngle(), 0.f, 0.f, 1.f);
|
Graphic3d_TransformUtils::Rotate<GLdouble> (aModViewMat, theTextAspect->Aspect()->GetTextAngle(), 0.f, 0.f, 1.f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -464,10 +466,10 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Graphic3d_TransformUtils::Translate<GLdouble> (aModViewMat, anObjX, anObjY, anObjZ);
|
Graphic3d_TransformUtils::Translate<GLdouble> (aModViewMat, anObjX, anObjY, anObjZ);
|
||||||
Graphic3d_TransformUtils::Rotate<GLdouble> (aModViewMat, theTextAspect.Aspect()->GetTextAngle(), 0.0, 0.0, 1.0);
|
Graphic3d_TransformUtils::Rotate<GLdouble> (aModViewMat, theTextAspect->Aspect()->GetTextAngle(), 0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theTextAspect.Aspect()->GetTextZoomable())
|
if (!theTextAspect->Aspect()->GetTextZoomable())
|
||||||
{
|
{
|
||||||
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, myScaleHeight, myScaleHeight, myScaleHeight);
|
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, myScaleHeight, myScaleHeight, myScaleHeight);
|
||||||
}
|
}
|
||||||
@@ -504,7 +506,7 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::drawText (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::drawText (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect) const
|
const Handle(OpenGl_AspectText)& theTextAspect) const
|
||||||
{
|
{
|
||||||
(void )theTextAspect;
|
(void )theTextAspect;
|
||||||
if (myVertsVbo.Length() != myTextures.Length()
|
if (myVertsVbo.Length() != myTextures.Length()
|
||||||
@@ -535,14 +537,14 @@ void OpenGl_Text::drawText (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// function : FontKey
|
// function : FontKey
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
TCollection_AsciiString OpenGl_Text::FontKey (const OpenGl_AspectText& theAspect,
|
TCollection_AsciiString OpenGl_Text::FontKey (const Handle(OpenGl_AspectText)& theAspect,
|
||||||
const Standard_Integer theHeight,
|
const Standard_Integer theHeight,
|
||||||
const unsigned int theResolution)
|
const unsigned int theResolution)
|
||||||
{
|
{
|
||||||
const Font_FontAspect anAspect = theAspect.Aspect()->GetTextFontAspect() != Font_FA_Undefined
|
const Font_FontAspect anAspect = theAspect->Aspect()->GetTextFontAspect() != Font_FA_Undefined
|
||||||
? theAspect.Aspect()->GetTextFontAspect()
|
? theAspect->Aspect()->GetTextFontAspect()
|
||||||
: Font_FA_Regular;
|
: Font_FA_Regular;
|
||||||
return theAspect.Aspect()->Font()
|
return theAspect->Aspect()->Font()
|
||||||
+ TCollection_AsciiString(":") + Standard_Integer(anAspect)
|
+ TCollection_AsciiString(":") + Standard_Integer(anAspect)
|
||||||
+ TCollection_AsciiString(":") + Standard_Integer(theResolution)
|
+ TCollection_AsciiString(":") + Standard_Integer(theResolution)
|
||||||
+ TCollection_AsciiString(":") + theHeight;
|
+ TCollection_AsciiString(":") + theHeight;
|
||||||
@@ -553,7 +555,7 @@ TCollection_AsciiString OpenGl_Text::FontKey (const OpenGl_AspectText& theAspect
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theAspect,
|
const Handle(OpenGl_AspectText)& theAspect,
|
||||||
const Standard_Integer theHeight,
|
const Standard_Integer theHeight,
|
||||||
const unsigned int theResolution,
|
const unsigned int theResolution,
|
||||||
const TCollection_AsciiString theKey)
|
const TCollection_AsciiString theKey)
|
||||||
@@ -567,9 +569,9 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
if (!theCtx->GetResource (theKey, aFont))
|
if (!theCtx->GetResource (theKey, aFont))
|
||||||
{
|
{
|
||||||
Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance();
|
Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance();
|
||||||
const TCollection_AsciiString& aFontName = theAspect.Aspect()->Font();
|
const TCollection_AsciiString& aFontName = theAspect->Aspect()->Font();
|
||||||
Font_FontAspect anAspect = theAspect.Aspect()->GetTextFontAspect() != Font_FA_Undefined
|
Font_FontAspect anAspect = theAspect->Aspect()->GetTextFontAspect() != Font_FA_Undefined
|
||||||
? theAspect.Aspect()->GetTextFontAspect()
|
? theAspect->Aspect()->GetTextFontAspect()
|
||||||
: Font_FA_Regular;
|
: Font_FA_Regular;
|
||||||
Handle(Font_FTFont) aFontFt;
|
Handle(Font_FTFont) aFontFt;
|
||||||
if (Handle(Font_SystemFont) aRequestedFont = aFontMgr->FindFont (aFontName, anAspect))
|
if (Handle(Font_SystemFont) aRequestedFont = aFontMgr->FindFont (aFontName, anAspect))
|
||||||
@@ -583,7 +585,7 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
TCollection_ExtendedString aMsg;
|
TCollection_ExtendedString aMsg;
|
||||||
aMsg += "Font '";
|
aMsg += "Font '";
|
||||||
aMsg += theAspect.Aspect()->Font();
|
aMsg += theAspect->Aspect()->Font();
|
||||||
aMsg += "' - initialization of GL resources has failed!";
|
aMsg += "' - initialization of GL resources has failed!";
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
|
||||||
aFontFt.Nullify();
|
aFontFt.Nullify();
|
||||||
@@ -595,7 +597,7 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
TCollection_ExtendedString aMsg;
|
TCollection_ExtendedString aMsg;
|
||||||
aMsg += "Font '";
|
aMsg += "Font '";
|
||||||
aMsg += theAspect.Aspect()->Font();
|
aMsg += theAspect->Aspect()->Font();
|
||||||
aMsg += "' is broken or has incompatible format! File path: ";
|
aMsg += "' is broken or has incompatible format! File path: ";
|
||||||
aMsg += aRequestedFont->FontPathAny (anAspect);
|
aMsg += aRequestedFont->FontPathAny (anAspect);
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
|
||||||
@@ -607,7 +609,7 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
TCollection_ExtendedString aMsg;
|
TCollection_ExtendedString aMsg;
|
||||||
aMsg += "Font '";
|
aMsg += "Font '";
|
||||||
aMsg += theAspect.Aspect()->Font();
|
aMsg += theAspect->Aspect()->Font();
|
||||||
aMsg += "' is not found in the system!";
|
aMsg += "' is not found in the system!";
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
|
||||||
aFont = new OpenGl_Font (aFontFt, theKey);
|
aFont = new OpenGl_Font (aFontFt, theKey);
|
||||||
@@ -623,7 +625,7 @@ Handle(OpenGl_Font) OpenGl_Text::FindFont (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::drawRect (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::drawRect (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_Vec4& theColorSubs) const
|
const OpenGl_Vec4& theColorSubs) const
|
||||||
{
|
{
|
||||||
Handle(OpenGl_ShaderProgram) aPrevProgram = theCtx->ActiveProgram();
|
Handle(OpenGl_ShaderProgram) aPrevProgram = theCtx->ActiveProgram();
|
||||||
@@ -674,7 +676,7 @@ void OpenGl_Text::drawRect (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_Vec4& theColorText,
|
const OpenGl_Vec4& theColorText,
|
||||||
const OpenGl_Vec4& theColorSubs,
|
const OpenGl_Vec4& theColorSubs,
|
||||||
const unsigned int theResolution) const
|
const unsigned int theResolution) const
|
||||||
@@ -747,7 +749,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
myWinX, myWinY, myWinZ);
|
myWinX, myWinY, myWinZ);
|
||||||
|
|
||||||
// compute scale factor for constant text height
|
// compute scale factor for constant text height
|
||||||
if (theTextAspect.Aspect()->GetTextZoomable())
|
if (theTextAspect->Aspect()->GetTextZoomable())
|
||||||
{
|
{
|
||||||
myExportHeight = aPointSize;
|
myExportHeight = aPointSize;
|
||||||
}
|
}
|
||||||
@@ -778,7 +780,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
|
|
||||||
// setup depth test
|
// setup depth test
|
||||||
const bool hasDepthTest = !myIs2d
|
const bool hasDepthTest = !myIs2d
|
||||||
&& theTextAspect.Aspect()->Style() != Aspect_TOST_ANNOTATION;
|
&& theTextAspect->Aspect()->Style() != Aspect_TOST_ANNOTATION;
|
||||||
if (!hasDepthTest)
|
if (!hasDepthTest)
|
||||||
{
|
{
|
||||||
glDisable (GL_DEPTH_TEST);
|
glDisable (GL_DEPTH_TEST);
|
||||||
@@ -809,7 +811,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
const bool anAlphaToCoverageOld = theCtx->SetSampleAlphaToCoverage (false);
|
const bool anAlphaToCoverageOld = theCtx->SetSampleAlphaToCoverage (false);
|
||||||
|
|
||||||
// extra drawings
|
// extra drawings
|
||||||
switch (theTextAspect.Aspect()->DisplayType())
|
switch (theTextAspect->Aspect()->DisplayType())
|
||||||
{
|
{
|
||||||
case Aspect_TODT_BLEND:
|
case Aspect_TODT_BLEND:
|
||||||
{
|
{
|
||||||
@@ -872,7 +874,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (theTextAspect.Aspect()->DisplayType() == Aspect_TODT_DIMENSION)
|
if (theTextAspect->Aspect()->DisplayType() == Aspect_TODT_DIMENSION)
|
||||||
{
|
{
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
if (!myIs2d)
|
if (!myIs2d)
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
//! Text rendering
|
//! Text rendering
|
||||||
class OpenGl_Text : public OpenGl_Element
|
class OpenGl_Text : public OpenGl_Element
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(OpenGl_Text, OpenGl_Element)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Main constructor
|
//! Main constructor
|
||||||
@@ -83,13 +83,13 @@ public: //! @name methods for compatibility with layers
|
|||||||
Standard_EXPORT OpenGl_Text();
|
Standard_EXPORT OpenGl_Text();
|
||||||
|
|
||||||
//! Create key for shared resource
|
//! Create key for shared resource
|
||||||
Standard_EXPORT static TCollection_AsciiString FontKey (const OpenGl_AspectText& theAspect,
|
Standard_EXPORT static TCollection_AsciiString FontKey (const Handle(OpenGl_AspectText)& theAspect,
|
||||||
const Standard_Integer theHeight,
|
const Standard_Integer theHeight,
|
||||||
const unsigned int theResolution);
|
const unsigned int theResolution);
|
||||||
|
|
||||||
//! Find shared resource for specified font or initialize new one
|
//! Find shared resource for specified font or initialize new one
|
||||||
Standard_EXPORT static Handle(OpenGl_Font) FindFont (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT static Handle(OpenGl_Font) FindFont (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theAspect,
|
const Handle(OpenGl_AspectText)& theAspect,
|
||||||
const Standard_Integer theHeight,
|
const Standard_Integer theHeight,
|
||||||
const unsigned int theResolution,
|
const unsigned int theResolution,
|
||||||
const TCollection_AsciiString theKey);
|
const TCollection_AsciiString theKey);
|
||||||
@@ -97,7 +97,7 @@ public: //! @name methods for compatibility with layers
|
|||||||
//! Compute text width
|
//! Compute text width
|
||||||
Standard_EXPORT static void StringSize (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT static void StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||||
const NCollection_String& theText,
|
const NCollection_String& theText,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_TextParam& theParams,
|
const OpenGl_TextParam& theParams,
|
||||||
const unsigned int theResolution,
|
const unsigned int theResolution,
|
||||||
Standard_ShortReal& theWidth,
|
Standard_ShortReal& theWidth,
|
||||||
@@ -112,8 +112,8 @@ public: //! @name methods for compatibility with layers
|
|||||||
|
|
||||||
//! Perform rendering
|
//! Perform rendering
|
||||||
Standard_EXPORT void Render (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT void Render (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION) const;
|
const unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -127,21 +127,21 @@ private:
|
|||||||
|
|
||||||
//! Setup matrix.
|
//! Setup matrix.
|
||||||
void setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
void setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_Vec3 theDVec) const;
|
const OpenGl_Vec3 theDVec) const;
|
||||||
|
|
||||||
//! Draw arrays of vertices.
|
//! Draw arrays of vertices.
|
||||||
void drawText (const Handle(OpenGl_Context)& theCtx,
|
void drawText (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect) const;
|
const Handle(OpenGl_AspectText)& theTextAspect) const;
|
||||||
|
|
||||||
//! Draw rectangle from bounding text box.
|
//! Draw rectangle from bounding text box.
|
||||||
void drawRect (const Handle(OpenGl_Context)& theCtx,
|
void drawRect (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_Vec4& theColorSubs) const;
|
const OpenGl_Vec4& theColorSubs) const;
|
||||||
|
|
||||||
//! Main rendering code
|
//! Main rendering code
|
||||||
void render (const Handle(OpenGl_Context)& theCtx,
|
void render (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_AspectText& theTextAspect,
|
const Handle(OpenGl_AspectText)& theTextAspect,
|
||||||
const OpenGl_Vec4& theColorText,
|
const OpenGl_Vec4& theColorText,
|
||||||
const OpenGl_Vec4& theColorSubs,
|
const OpenGl_Vec4& theColorSubs,
|
||||||
const unsigned int theResolution) const;
|
const unsigned int theResolution) const;
|
||||||
|
@@ -110,6 +110,9 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
|||||||
myRaytraceFBO1[1] = new OpenGl_FrameBuffer();
|
myRaytraceFBO1[1] = new OpenGl_FrameBuffer();
|
||||||
myRaytraceFBO2[0] = new OpenGl_FrameBuffer();
|
myRaytraceFBO2[0] = new OpenGl_FrameBuffer();
|
||||||
myRaytraceFBO2[1] = new OpenGl_FrameBuffer();
|
myRaytraceFBO2[1] = new OpenGl_FrameBuffer();
|
||||||
|
|
||||||
|
myGraduatedTrihedron = new OpenGl_GraduatedTrihedron();
|
||||||
|
myFrameStatsPrs = new OpenGl_FrameStatsPrs();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -130,8 +133,8 @@ OpenGl_View::~OpenGl_View()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
|
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
|
||||||
{
|
{
|
||||||
myGraduatedTrihedron.Release (theCtx.operator->());
|
myGraduatedTrihedron->Release (theCtx.operator->());
|
||||||
myFrameStatsPrs.Release (theCtx.operator->());
|
myFrameStatsPrs->Release (theCtx.operator->());
|
||||||
|
|
||||||
if (!myTextureEnv.IsNull())
|
if (!myTextureEnv.IsNull())
|
||||||
{
|
{
|
||||||
@@ -143,15 +146,15 @@ void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
|
|||||||
myTextureEnv.Nullify();
|
myTextureEnv.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myTextureParams != NULL)
|
if (!myTextureParams.IsNull())
|
||||||
{
|
{
|
||||||
myTextureParams->Release (theCtx.operator->());
|
myTextureParams->Release (theCtx.operator->());
|
||||||
}
|
}
|
||||||
if (myBgGradientArray != NULL)
|
if (!myBgGradientArray.IsNull())
|
||||||
{
|
{
|
||||||
myBgGradientArray->Release (theCtx.operator->());
|
myBgGradientArray->Release (theCtx.operator->());
|
||||||
}
|
}
|
||||||
if (myBgTextureArray != NULL)
|
if (!myBgTextureArray.IsNull())
|
||||||
{
|
{
|
||||||
myBgTextureArray->Release (theCtx.operator->());
|
myBgTextureArray->Release (theCtx.operator->());
|
||||||
}
|
}
|
||||||
@@ -333,7 +336,7 @@ void OpenGl_View::GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron&
|
|||||||
myGTrihedronData = theTrihedronData;
|
myGTrihedronData = theTrihedronData;
|
||||||
myGTrihedronData.PtrView = this;
|
myGTrihedronData.PtrView = this;
|
||||||
myGTrihedronData.CubicAxesCallback = SetMinMaxValuesCallback;
|
myGTrihedronData.CubicAxesCallback = SetMinMaxValuesCallback;
|
||||||
myGraduatedTrihedron.SetValues (myGTrihedronData);
|
myGraduatedTrihedron->SetValues (myGTrihedronData);
|
||||||
myToShowGradTrihedron = true;
|
myToShowGradTrihedron = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +347,7 @@ void OpenGl_View::GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron&
|
|||||||
void OpenGl_View::GraduatedTrihedronErase()
|
void OpenGl_View::GraduatedTrihedronErase()
|
||||||
{
|
{
|
||||||
myGTrihedronData.PtrView = NULL;
|
myGTrihedronData.PtrView = NULL;
|
||||||
myGraduatedTrihedron.Release (myWorkspace->GetGlContext().operator->());
|
myGraduatedTrihedron->Release (myWorkspace->GetGlContext().operator->());
|
||||||
myToShowGradTrihedron = false;
|
myToShowGradTrihedron = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +357,7 @@ void OpenGl_View::GraduatedTrihedronErase()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_View::GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax)
|
void OpenGl_View::GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax)
|
||||||
{
|
{
|
||||||
myGraduatedTrihedron.SetMinMax (theMin, theMax);
|
myGraduatedTrihedron->SetMinMax (theMin, theMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@@ -297,7 +297,7 @@ public:
|
|||||||
const Quantity_ColorRGBA& BackgroundColor() const { return myBgColor; }
|
const Quantity_ColorRGBA& BackgroundColor() const { return myBgColor; }
|
||||||
|
|
||||||
//! Change graduated trihedron.
|
//! Change graduated trihedron.
|
||||||
OpenGl_GraduatedTrihedron& ChangeGraduatedTrihedron() { return myGraduatedTrihedron; }
|
const Handle(OpenGl_GraduatedTrihedron)& ChangeGraduatedTrihedron() { return myGraduatedTrihedron; }
|
||||||
|
|
||||||
void SetTextureEnv (const Handle(OpenGl_Context)& theCtx,
|
void SetTextureEnv (const Handle(OpenGl_Context)& theCtx,
|
||||||
const Handle(Graphic3d_TextureEnv)& theTexture);
|
const Handle(Graphic3d_TextureEnv)& theTexture);
|
||||||
@@ -486,8 +486,8 @@ protected:
|
|||||||
//! Is needed for selection of overlapping objects and storage of the current view volume
|
//! Is needed for selection of overlapping objects and storage of the current view volume
|
||||||
OpenGl_BVHTreeSelector myBVHSelector;
|
OpenGl_BVHTreeSelector myBVHSelector;
|
||||||
|
|
||||||
OpenGl_GraduatedTrihedron myGraduatedTrihedron;
|
Handle(OpenGl_GraduatedTrihedron) myGraduatedTrihedron;
|
||||||
OpenGl_FrameStatsPrs myFrameStatsPrs;
|
Handle(OpenGl_FrameStatsPrs) myFrameStatsPrs;
|
||||||
|
|
||||||
Handle(OpenGl_TextureSet) myTextureEnv;
|
Handle(OpenGl_TextureSet) myTextureEnv;
|
||||||
|
|
||||||
@@ -520,9 +520,9 @@ protected: //! @name Rendering properties
|
|||||||
|
|
||||||
protected: //! @name Background parameters
|
protected: //! @name Background parameters
|
||||||
|
|
||||||
OpenGl_AspectFace* myTextureParams; //!< Stores texture and its parameters for textured background
|
Handle(OpenGl_AspectFace) myTextureParams; //!< Stores texture and its parameters for textured background
|
||||||
OpenGl_BackgroundArray* myBgGradientArray; //!< Primitive array for gradient background
|
Handle(OpenGl_BackgroundArray) myBgGradientArray; //!< Primitive array for gradient background
|
||||||
OpenGl_BackgroundArray* myBgTextureArray; //!< Primitive array for texture background
|
Handle(OpenGl_BackgroundArray) myBgTextureArray; //!< Primitive array for texture background
|
||||||
|
|
||||||
protected: //! @name data types related to ray-tracing
|
protected: //! @name data types related to ray-tracing
|
||||||
|
|
||||||
@@ -773,11 +773,11 @@ protected: //! @name methods related to ray-tracing
|
|||||||
const Handle(OpenGl_Context)& theGlContext);
|
const Handle(OpenGl_Context)& theGlContext);
|
||||||
|
|
||||||
//! Creates ray-tracing material properties.
|
//! Creates ray-tracing material properties.
|
||||||
OpenGl_RaytraceMaterial convertMaterial (const OpenGl_AspectFace* theAspect,
|
OpenGl_RaytraceMaterial convertMaterial (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(OpenGl_Context)& theGlContext);
|
const Handle(OpenGl_Context)& theGlContext);
|
||||||
|
|
||||||
//! Adds OpenGL primitive array to ray-traced scene geometry.
|
//! Adds OpenGL primitive array to ray-traced scene geometry.
|
||||||
Handle(OpenGl_TriangleSet) addRaytracePrimitiveArray (const OpenGl_PrimitiveArray* theArray,
|
Handle(OpenGl_TriangleSet) addRaytracePrimitiveArray (const Handle(OpenGl_PrimitiveArray)& theArray,
|
||||||
const Standard_Integer theMatID,
|
const Standard_Integer theMatID,
|
||||||
const OpenGl_Mat4* theTrans);
|
const OpenGl_Mat4* theTrans);
|
||||||
|
|
||||||
@@ -786,7 +786,7 @@ protected: //! @name methods related to ray-tracing
|
|||||||
const Standard_Integer theMatID,
|
const Standard_Integer theMatID,
|
||||||
const Standard_Integer theCount,
|
const Standard_Integer theCount,
|
||||||
const Standard_Integer theOffset,
|
const Standard_Integer theOffset,
|
||||||
const OpenGl_PrimitiveArray& theArray);
|
const Handle(OpenGl_PrimitiveArray)& theArray);
|
||||||
|
|
||||||
//! Adds OpenGL triangle array to ray-traced scene geometry.
|
//! Adds OpenGL triangle array to ray-traced scene geometry.
|
||||||
Standard_Boolean addRaytraceTriangleArray (OpenGl_TriangleSet& theSet,
|
Standard_Boolean addRaytraceTriangleArray (OpenGl_TriangleSet& theSet,
|
||||||
|
@@ -144,11 +144,10 @@ Standard_Boolean OpenGl_View::updateRaytraceGeometry (const RaytraceUpdateMode
|
|||||||
for (OpenGl_Structure::GroupIterator aGroupIter (aStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
|
for (OpenGl_Structure::GroupIterator aGroupIter (aStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||||
{
|
{
|
||||||
// Extract OpenGL elements from the group (primitives arrays)
|
// Extract OpenGL elements from the group (primitives arrays)
|
||||||
for (const OpenGl_ElementNode* aNode = aGroupIter.Value()->FirstNode(); aNode != NULL; aNode = aNode->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator (aGroupIter.Value()->GetElements()); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
OpenGl_PrimitiveArray* aPrimArray = dynamic_cast<OpenGl_PrimitiveArray*> (aNode->elem);
|
Handle(OpenGl_PrimitiveArray) aPrimArray = Handle(OpenGl_PrimitiveArray)::DownCast (anElemIterator.Value());
|
||||||
|
if (!aPrimArray.IsNull())
|
||||||
if (aPrimArray != NULL)
|
|
||||||
{
|
{
|
||||||
anArrayIDs.insert (aPrimArray->GetUID());
|
anArrayIDs.insert (aPrimArray->GetUID());
|
||||||
}
|
}
|
||||||
@@ -344,7 +343,7 @@ void buildTextureTransform (const Handle(Graphic3d_TextureParams)& theParams, BV
|
|||||||
// function : convertMaterial
|
// function : convertMaterial
|
||||||
// purpose : Creates ray-tracing material properties
|
// purpose : Creates ray-tracing material properties
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
OpenGl_RaytraceMaterial OpenGl_View::convertMaterial (const OpenGl_AspectFace* theAspect,
|
OpenGl_RaytraceMaterial OpenGl_View::convertMaterial (const Handle(OpenGl_AspectFace)& theAspect,
|
||||||
const Handle(OpenGl_Context)& theGlContext)
|
const Handle(OpenGl_Context)& theGlContext)
|
||||||
{
|
{
|
||||||
OpenGl_RaytraceMaterial theMaterial;
|
OpenGl_RaytraceMaterial theMaterial;
|
||||||
@@ -509,7 +508,7 @@ Standard_Boolean OpenGl_View::addRaytraceGroups (const OpenGl_Structure*
|
|||||||
{
|
{
|
||||||
// Get group material
|
// Get group material
|
||||||
OpenGl_RaytraceMaterial aGroupMaterial;
|
OpenGl_RaytraceMaterial aGroupMaterial;
|
||||||
if (aGroupIter.Value()->AspectFace() != NULL)
|
if (!aGroupIter.Value()->AspectFace().IsNull())
|
||||||
{
|
{
|
||||||
aGroupMaterial = convertMaterial (
|
aGroupMaterial = convertMaterial (
|
||||||
aGroupIter.Value()->AspectFace(), theGlContext);
|
aGroupIter.Value()->AspectFace(), theGlContext);
|
||||||
@@ -519,14 +518,14 @@ Standard_Boolean OpenGl_View::addRaytraceGroups (const OpenGl_Structure*
|
|||||||
|
|
||||||
// Use group material if available, otherwise use structure material
|
// Use group material if available, otherwise use structure material
|
||||||
myRaytraceGeometry.Materials.push_back (
|
myRaytraceGeometry.Materials.push_back (
|
||||||
aGroupIter.Value()->AspectFace() != NULL ? aGroupMaterial : theStructMat);
|
!aGroupIter.Value()->AspectFace().IsNull() ? aGroupMaterial : theStructMat);
|
||||||
|
|
||||||
// Add OpenGL elements from group (extract primitives arrays and aspects)
|
// Add OpenGL elements from group (extract primitives arrays and aspects)
|
||||||
for (const OpenGl_ElementNode* aNode = aGroupIter.Value()->FirstNode(); aNode != NULL; aNode = aNode->next)
|
for (OpenGl_ElementNodes::Iterator anElemIterator (aGroupIter.Value()->GetElements()); anElemIterator.More(); anElemIterator.Next())
|
||||||
{
|
{
|
||||||
OpenGl_AspectFace* anAspect = dynamic_cast<OpenGl_AspectFace*> (aNode->elem);
|
Handle(OpenGl_AspectFace) anAspect = Handle(OpenGl_AspectFace)::DownCast (anElemIterator.Value());
|
||||||
|
|
||||||
if (anAspect != NULL)
|
if (!anAspect.IsNull())
|
||||||
{
|
{
|
||||||
aMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
|
aMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
|
||||||
|
|
||||||
@@ -536,9 +535,9 @@ Standard_Boolean OpenGl_View::addRaytraceGroups (const OpenGl_Structure*
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OpenGl_PrimitiveArray* aPrimArray = dynamic_cast<OpenGl_PrimitiveArray*> (aNode->elem);
|
Handle(OpenGl_PrimitiveArray) aPrimArray = Handle(OpenGl_PrimitiveArray)::DownCast (anElemIterator.Value());
|
||||||
|
|
||||||
if (aPrimArray != NULL)
|
if (!aPrimArray.IsNull())
|
||||||
{
|
{
|
||||||
std::map<Standard_Size, OpenGl_TriangleSet*>::iterator aSetIter = myArrayToTrianglesMap.find (aPrimArray->GetUID());
|
std::map<Standard_Size, OpenGl_TriangleSet*>::iterator aSetIter = myArrayToTrianglesMap.find (aPrimArray->GetUID());
|
||||||
|
|
||||||
@@ -585,7 +584,7 @@ Standard_Boolean OpenGl_View::addRaytraceGroups (const OpenGl_Structure*
|
|||||||
// function : addRaytracePrimitiveArray
|
// function : addRaytracePrimitiveArray
|
||||||
// purpose : Adds OpenGL primitive array to ray-traced scene geometry
|
// purpose : Adds OpenGL primitive array to ray-traced scene geometry
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Handle(OpenGl_TriangleSet) OpenGl_View::addRaytracePrimitiveArray (const OpenGl_PrimitiveArray* theArray,
|
Handle(OpenGl_TriangleSet) OpenGl_View::addRaytracePrimitiveArray (const Handle(OpenGl_PrimitiveArray)& theArray,
|
||||||
const Standard_Integer theMaterial,
|
const Standard_Integer theMaterial,
|
||||||
const OpenGl_Mat4* theTransform)
|
const OpenGl_Mat4* theTransform)
|
||||||
{
|
{
|
||||||
@@ -705,7 +704,7 @@ Handle(OpenGl_TriangleSet) OpenGl_View::addRaytracePrimitiveArray (const OpenGl_
|
|||||||
{
|
{
|
||||||
const Standard_Integer aVertNum = aBounds->Bounds[aBound];
|
const Standard_Integer aVertNum = aBounds->Bounds[aBound];
|
||||||
|
|
||||||
if (!addRaytraceVertexIndices (*aSet, theMaterial, aVertNum, aBoundStart, *theArray))
|
if (!addRaytraceVertexIndices (*aSet, theMaterial, aVertNum, aBoundStart, theArray))
|
||||||
{
|
{
|
||||||
aSet.Nullify();
|
aSet.Nullify();
|
||||||
return Handle(OpenGl_TriangleSet)();
|
return Handle(OpenGl_TriangleSet)();
|
||||||
@@ -718,7 +717,7 @@ Handle(OpenGl_TriangleSet) OpenGl_View::addRaytracePrimitiveArray (const OpenGl_
|
|||||||
{
|
{
|
||||||
const Standard_Integer aVertNum = !anIndices.IsNull() ? anIndices->NbElements : anAttribs->NbElements;
|
const Standard_Integer aVertNum = !anIndices.IsNull() ? anIndices->NbElements : anAttribs->NbElements;
|
||||||
|
|
||||||
if (!addRaytraceVertexIndices (*aSet, theMaterial, aVertNum, 0, *theArray))
|
if (!addRaytraceVertexIndices (*aSet, theMaterial, aVertNum, 0, theArray))
|
||||||
{
|
{
|
||||||
aSet.Nullify();
|
aSet.Nullify();
|
||||||
return Handle(OpenGl_TriangleSet)();
|
return Handle(OpenGl_TriangleSet)();
|
||||||
@@ -742,17 +741,17 @@ Standard_Boolean OpenGl_View::addRaytraceVertexIndices (OpenGl_TriangleSet&
|
|||||||
const Standard_Integer theMatID,
|
const Standard_Integer theMatID,
|
||||||
const Standard_Integer theCount,
|
const Standard_Integer theCount,
|
||||||
const Standard_Integer theOffset,
|
const Standard_Integer theOffset,
|
||||||
const OpenGl_PrimitiveArray& theArray)
|
const Handle(OpenGl_PrimitiveArray)& theArray)
|
||||||
{
|
{
|
||||||
switch (theArray.DrawMode())
|
switch (theArray->DrawMode())
|
||||||
{
|
{
|
||||||
case GL_TRIANGLES: return addRaytraceTriangleArray (theSet, theMatID, theCount, theOffset, theArray.Indices());
|
case GL_TRIANGLES: return addRaytraceTriangleArray (theSet, theMatID, theCount, theOffset, theArray->Indices());
|
||||||
case GL_TRIANGLE_FAN: return addRaytraceTriangleFanArray (theSet, theMatID, theCount, theOffset, theArray.Indices());
|
case GL_TRIANGLE_FAN: return addRaytraceTriangleFanArray (theSet, theMatID, theCount, theOffset, theArray->Indices());
|
||||||
case GL_TRIANGLE_STRIP: return addRaytraceTriangleStripArray (theSet, theMatID, theCount, theOffset, theArray.Indices());
|
case GL_TRIANGLE_STRIP: return addRaytraceTriangleStripArray (theSet, theMatID, theCount, theOffset, theArray->Indices());
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
case GL_QUAD_STRIP: return addRaytraceQuadrangleStripArray (theSet, theMatID, theCount, theOffset, theArray.Indices());
|
case GL_QUAD_STRIP: return addRaytraceQuadrangleStripArray (theSet, theMatID, theCount, theOffset, theArray->Indices());
|
||||||
case GL_QUADS: return addRaytraceQuadrangleArray (theSet, theMatID, theCount, theOffset, theArray.Indices());
|
case GL_QUADS: return addRaytraceQuadrangleArray (theSet, theMatID, theCount, theOffset, theArray->Indices());
|
||||||
case GL_POLYGON: return addRaytracePolygonArray (theSet, theMatID, theCount, theOffset, theArray.Indices());
|
case GL_POLYGON: return addRaytracePolygonArray (theSet, theMatID, theCount, theOffset, theArray->Indices());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2640,7 +2639,7 @@ Standard_Boolean OpenGl_View::setUniformState (const Standard_Integer the
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set background colors (only gradient background supported)
|
// Set background colors (only gradient background supported)
|
||||||
if (myBgGradientArray != NULL && myBgGradientArray->IsDefined())
|
if (!myBgGradientArray.IsNull() && myBgGradientArray->IsDefined())
|
||||||
{
|
{
|
||||||
theProgram->SetUniform (theGlContext,
|
theProgram->SetUniform (theGlContext,
|
||||||
myUniformLocations[theProgramId][OpenGl_RT_uBackColorTop], myBgGradientArray->GradientColor (0));
|
myUniformLocations[theProgramId][OpenGl_RT_uBackColorTop], myBgGradientArray->GradientColor (0));
|
||||||
|
@@ -125,7 +125,9 @@ void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
|
|||||||
{
|
{
|
||||||
aCtx->core11fwd->glDisable (GL_BLEND);
|
aCtx->core11fwd->glDisable (GL_BLEND);
|
||||||
|
|
||||||
const OpenGl_AspectFace* anOldAspectFace = theWorkspace->SetAspectFace (myTextureParams);
|
const Handle(OpenGl_AspectFace) anOldAspectFace = theWorkspace->AspectFace();
|
||||||
|
theWorkspace->SetAspectFace (myTextureParams);
|
||||||
|
|
||||||
myBgTextureArray->Render (theWorkspace);
|
myBgTextureArray->Render (theWorkspace);
|
||||||
theWorkspace->SetAspectFace (anOldAspectFace);
|
theWorkspace->SetAspectFace (anOldAspectFace);
|
||||||
}
|
}
|
||||||
@@ -1171,7 +1173,7 @@ void OpenGl_View::renderTrihedron (const Handle(OpenGl_Workspace) &theWorkspace)
|
|||||||
{
|
{
|
||||||
if (myToShowGradTrihedron)
|
if (myToShowGradTrihedron)
|
||||||
{
|
{
|
||||||
myGraduatedTrihedron.Render (theWorkspace);
|
myGraduatedTrihedron->Render (theWorkspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1184,8 +1186,8 @@ void OpenGl_View::renderFrameStats()
|
|||||||
if (myRenderParams.ToShowStats
|
if (myRenderParams.ToShowStats
|
||||||
&& myRenderParams.CollectedStats != Graphic3d_RenderingParams::PerfCounters_NONE)
|
&& myRenderParams.CollectedStats != Graphic3d_RenderingParams::PerfCounters_NONE)
|
||||||
{
|
{
|
||||||
myFrameStatsPrs.Update (myWorkspace);
|
myFrameStatsPrs->Update (myWorkspace);
|
||||||
myFrameStatsPrs.Render (myWorkspace);
|
myFrameStatsPrs->Render (myWorkspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -123,16 +123,25 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi
|
|||||||
myNbSkippedTranspElems (0),
|
myNbSkippedTranspElems (0),
|
||||||
myRenderFilter (OpenGl_RenderFilter_Empty),
|
myRenderFilter (OpenGl_RenderFilter_Empty),
|
||||||
//
|
//
|
||||||
myAspectLineSet (&myDefaultAspectLine),
|
|
||||||
myAspectFaceSet (&myDefaultAspectFace),
|
|
||||||
myAspectMarkerSet (&myDefaultAspectMarker),
|
|
||||||
myAspectTextSet (&myDefaultAspectText),
|
|
||||||
//
|
|
||||||
ViewMatrix_applied (&myDefaultMatrix),
|
ViewMatrix_applied (&myDefaultMatrix),
|
||||||
StructureMatrix_applied (&myDefaultMatrix),
|
StructureMatrix_applied (&myDefaultMatrix),
|
||||||
myToAllowFaceCulling (false),
|
myToAllowFaceCulling (false),
|
||||||
myModelViewMatrix (myDefaultMatrix)
|
myModelViewMatrix (myDefaultMatrix)
|
||||||
{
|
{
|
||||||
|
myDefaultAspectLine = new OpenGl_AspectLine();
|
||||||
|
myDefaultAspectFace = new OpenGl_AspectFace();
|
||||||
|
myDefaultAspectMarker = new OpenGl_AspectMarker();
|
||||||
|
myDefaultAspectText = new OpenGl_AspectText();
|
||||||
|
|
||||||
|
myNoneCulling = new OpenGl_AspectFace();
|
||||||
|
myFrontCulling = new OpenGl_AspectFace();
|
||||||
|
myFontFaceAspect = new OpenGl_AspectFace();
|
||||||
|
|
||||||
|
myAspectLineSet = myDefaultAspectLine;
|
||||||
|
myAspectFaceSet = myDefaultAspectFace;
|
||||||
|
myAspectMarkerSet = myDefaultAspectMarker;
|
||||||
|
myAspectTextSet = myDefaultAspectText;
|
||||||
|
|
||||||
if (!myGlContext.IsNull() && myGlContext->MakeCurrent())
|
if (!myGlContext.IsNull() && myGlContext->MakeCurrent())
|
||||||
{
|
{
|
||||||
myGlContext->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
myGlContext->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||||
@@ -155,16 +164,16 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
myFontFaceAspect.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
|
myFontFaceAspect->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
|
||||||
myFontFaceAspect.Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
myFontFaceAspect->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||||
|
|
||||||
myNoneCulling .Aspect()->SetSuppressBackFaces (false);
|
myNoneCulling->Aspect()->SetSuppressBackFaces (false);
|
||||||
myNoneCulling .Aspect()->SetDrawEdges (false);
|
myNoneCulling->Aspect()->SetDrawEdges (false);
|
||||||
myNoneCulling .Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
|
myNoneCulling->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
|
||||||
|
|
||||||
myFrontCulling.Aspect()->SetSuppressBackFaces (true);
|
myFrontCulling->Aspect()->SetSuppressBackFaces (true);
|
||||||
myFrontCulling.Aspect()->SetDrawEdges (false);
|
myFrontCulling->Aspect()->SetDrawEdges (false);
|
||||||
myFrontCulling.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
|
myFrontCulling->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -206,12 +215,12 @@ void OpenGl_Workspace::ResetAppliedAspect()
|
|||||||
|
|
||||||
myHighlightStyle.Nullify();
|
myHighlightStyle.Nullify();
|
||||||
myToAllowFaceCulling = false;
|
myToAllowFaceCulling = false;
|
||||||
myAspectLineSet = &myDefaultAspectLine;
|
myAspectLineSet = myDefaultAspectLine;
|
||||||
myAspectFaceSet = &myDefaultAspectFace;
|
myAspectFaceSet = myDefaultAspectFace;
|
||||||
myAspectFaceApplied.Nullify();
|
myAspectFaceApplied.Nullify();
|
||||||
myAspectMarkerSet = &myDefaultAspectMarker;
|
myAspectMarkerSet = myDefaultAspectMarker;
|
||||||
myAspectMarkerApplied.Nullify();
|
myAspectMarkerApplied.Nullify();
|
||||||
myAspectTextSet = &myDefaultAspectText;
|
myAspectTextSet = myDefaultAspectText;
|
||||||
myGlContext->SetPolygonOffset (Graphic3d_PolygonOffset());
|
myGlContext->SetPolygonOffset (Graphic3d_PolygonOffset());
|
||||||
|
|
||||||
ApplyAspectLine();
|
ApplyAspectLine();
|
||||||
@@ -219,8 +228,8 @@ void OpenGl_Workspace::ResetAppliedAspect()
|
|||||||
ApplyAspectMarker();
|
ApplyAspectMarker();
|
||||||
ApplyAspectText();
|
ApplyAspectText();
|
||||||
|
|
||||||
myGlContext->SetTypeOfLine (myDefaultAspectLine.Aspect()->Type());
|
myGlContext->SetTypeOfLine (myDefaultAspectLine->Aspect()->Type());
|
||||||
myGlContext->SetLineWidth (myDefaultAspectLine.Aspect()->Width());
|
myGlContext->SetLineWidth (myDefaultAspectLine->Aspect()->Width());
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -229,9 +238,9 @@ void OpenGl_Workspace::ResetAppliedAspect()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_PolygonOffset OpenGl_Workspace::SetDefaultPolygonOffset (const Graphic3d_PolygonOffset& theOffset)
|
Graphic3d_PolygonOffset OpenGl_Workspace::SetDefaultPolygonOffset (const Graphic3d_PolygonOffset& theOffset)
|
||||||
{
|
{
|
||||||
Graphic3d_PolygonOffset aPrev = myDefaultAspectFace.Aspect()->PolygonOffset();
|
Graphic3d_PolygonOffset aPrev = myDefaultAspectFace->Aspect()->PolygonOffset();
|
||||||
myDefaultAspectFace.Aspect()->SetPolygonOffset (theOffset);
|
myDefaultAspectFace->Aspect()->SetPolygonOffset (theOffset);
|
||||||
if (myAspectFaceApplied == myDefaultAspectFace.Aspect()
|
if (myAspectFaceApplied == myDefaultAspectFace->Aspect()
|
||||||
|| myAspectFaceApplied.IsNull()
|
|| myAspectFaceApplied.IsNull()
|
||||||
|| (myAspectFaceApplied->PolygonOffset().Mode & Aspect_POM_None) == Aspect_POM_None)
|
|| (myAspectFaceApplied->PolygonOffset().Mode & Aspect_POM_None) == Aspect_POM_None)
|
||||||
{
|
{
|
||||||
@@ -244,51 +253,43 @@ Graphic3d_PolygonOffset OpenGl_Workspace::SetDefaultPolygonOffset (const Graphic
|
|||||||
// function : SetAspectLine
|
// function : SetAspectLine
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_AspectLine* OpenGl_Workspace::SetAspectLine (const OpenGl_AspectLine* theAspect)
|
void OpenGl_Workspace::SetAspectLine (const Handle(OpenGl_AspectLine)& theAspect)
|
||||||
{
|
{
|
||||||
const OpenGl_AspectLine* aPrevAspectLine = myAspectLineSet;
|
|
||||||
myAspectLineSet = theAspect;
|
myAspectLineSet = theAspect;
|
||||||
return aPrevAspectLine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SetAspectFace
|
// function : SetAspectFace
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace (const OpenGl_AspectFace* theAspect)
|
void OpenGl_Workspace::SetAspectFace (const Handle(OpenGl_AspectFace)& theAspect)
|
||||||
{
|
{
|
||||||
const OpenGl_AspectFace* aPrevAspectFace = myAspectFaceSet;
|
|
||||||
myAspectFaceSet = theAspect;
|
myAspectFaceSet = theAspect;
|
||||||
return aPrevAspectFace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SetAspectMarker
|
// function : SetAspectMarker
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_AspectMarker* OpenGl_Workspace::SetAspectMarker (const OpenGl_AspectMarker* theAspect)
|
void OpenGl_Workspace::SetAspectMarker (const Handle(OpenGl_AspectMarker)& theAspect)
|
||||||
{
|
{
|
||||||
const OpenGl_AspectMarker* aPrevAspectMarker = myAspectMarkerSet;
|
|
||||||
myAspectMarkerSet = theAspect;
|
myAspectMarkerSet = theAspect;
|
||||||
return aPrevAspectMarker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SetAspectText
|
// function : SetAspectText
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_AspectText * OpenGl_Workspace::SetAspectText (const OpenGl_AspectText* theAspect)
|
void OpenGl_Workspace::SetAspectText (const Handle(OpenGl_AspectText)& theAspect)
|
||||||
{
|
{
|
||||||
const OpenGl_AspectText* aPrevAspectText = myAspectTextSet;
|
|
||||||
myAspectTextSet = theAspect;
|
myAspectTextSet = theAspect;
|
||||||
return aPrevAspectText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : ApplyAspectFace
|
// function : ApplyAspectFace
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
|
const Handle(OpenGl_AspectFace)& OpenGl_Workspace::ApplyAspectFace()
|
||||||
{
|
{
|
||||||
if (myView->BackfacingModel() == Graphic3d_TOBM_AUTOMATIC)
|
if (myView->BackfacingModel() == Graphic3d_TOBM_AUTOMATIC)
|
||||||
{
|
{
|
||||||
@@ -395,7 +396,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
|
|||||||
// function : ApplyAspectMarker
|
// function : ApplyAspectMarker
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
const OpenGl_AspectMarker* OpenGl_Workspace::ApplyAspectMarker()
|
const Handle(OpenGl_AspectMarker)& OpenGl_Workspace::ApplyAspectMarker()
|
||||||
{
|
{
|
||||||
if (myAspectMarkerSet->Aspect() != myAspectMarkerApplied)
|
if (myAspectMarkerSet->Aspect() != myAspectMarkerApplied)
|
||||||
{
|
{
|
||||||
@@ -486,7 +487,7 @@ Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)&
|
|||||||
// function : ShouldRender
|
// function : ShouldRender
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
bool OpenGl_Workspace::ShouldRender (const OpenGl_Element* theElement)
|
bool OpenGl_Workspace::ShouldRender (const Handle(OpenGl_Element)& theElement)
|
||||||
{
|
{
|
||||||
// render only non-raytracable elements when RayTracing is enabled
|
// render only non-raytracable elements when RayTracing is enabled
|
||||||
if ((myRenderFilter & OpenGl_RenderFilter_NonRaytraceableOnly) != 0)
|
if ((myRenderFilter & OpenGl_RenderFilter_NonRaytraceableOnly) != 0)
|
||||||
@@ -522,7 +523,7 @@ bool OpenGl_Workspace::ShouldRender (const OpenGl_Element* theElement)
|
|||||||
{
|
{
|
||||||
if (!theElement->IsFillDrawMode())
|
if (!theElement->IsFillDrawMode())
|
||||||
{
|
{
|
||||||
if (dynamic_cast<const OpenGl_AspectFace*> (theElement) == NULL)
|
if (Handle(OpenGl_AspectFace)::DownCast(theElement).IsNull())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -160,44 +160,44 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Currently set line aspect (can differ from applied).
|
//! Currently set line aspect (can differ from applied).
|
||||||
const OpenGl_AspectLine* AspectLine() const { return myAspectLineSet; }
|
const Handle(OpenGl_AspectLine)& AspectLine() const { return myAspectLineSet; }
|
||||||
|
|
||||||
//! Currently set face aspect (can differ from applied).
|
//! Currently set face aspect (can differ from applied).
|
||||||
const OpenGl_AspectFace* AspectFace() const { return myAspectFaceSet; }
|
const Handle(OpenGl_AspectFace)& AspectFace() const { return myAspectFaceSet; }
|
||||||
|
|
||||||
//! Currently set marker aspect (can differ from applied).
|
//! Currently set marker aspect (can differ from applied).
|
||||||
const OpenGl_AspectMarker* AspectMarker() const { return myAspectMarkerSet; }
|
const Handle(OpenGl_AspectMarker)& AspectMarker() const { return myAspectMarkerSet; }
|
||||||
|
|
||||||
//! Currently set text aspect (can differ from applied).
|
//! Currently set text aspect (can differ from applied).
|
||||||
const OpenGl_AspectText* AspectText() const { return myAspectTextSet; }
|
const Handle(OpenGl_AspectText)& AspectText() const { return myAspectTextSet; }
|
||||||
|
|
||||||
//! Assign new line aspect (will be applied within ApplyAspectLine()).
|
//! Assign new line aspect (will be applied within ApplyAspectLine()).
|
||||||
Standard_EXPORT const OpenGl_AspectLine* SetAspectLine (const OpenGl_AspectLine* theAspect);
|
Standard_EXPORT void SetAspectLine (const Handle(OpenGl_AspectLine)& theAspect);
|
||||||
|
|
||||||
//! Assign new face aspect (will be applied within ApplyAspectFace()).
|
//! Assign new face aspect (will be applied within ApplyAspectFace()).
|
||||||
Standard_EXPORT const OpenGl_AspectFace* SetAspectFace (const OpenGl_AspectFace* theAspect);
|
Standard_EXPORT void SetAspectFace (const Handle(OpenGl_AspectFace)& theAspect);
|
||||||
|
|
||||||
//! Assign new marker aspect (will be applied within ApplyAspectMarker()).
|
//! Assign new marker aspect (will be applied within ApplyAspectMarker()).
|
||||||
Standard_EXPORT const OpenGl_AspectMarker* SetAspectMarker (const OpenGl_AspectMarker* theAspect);
|
Standard_EXPORT void SetAspectMarker (const Handle(OpenGl_AspectMarker)& theAspect);
|
||||||
|
|
||||||
//! Assign new text aspect (will be applied within ApplyAspectText()).
|
//! Assign new text aspect (will be applied within ApplyAspectText()).
|
||||||
Standard_EXPORT const OpenGl_AspectText* SetAspectText (const OpenGl_AspectText* theAspect);
|
Standard_EXPORT void SetAspectText (const Handle(OpenGl_AspectText)& theAspect);
|
||||||
|
|
||||||
//! Apply line aspect.
|
//! Apply line aspect.
|
||||||
//! @return aspect set by SetAspectLine()
|
//! @return aspect set by SetAspectLine()
|
||||||
const OpenGl_AspectLine* ApplyAspectLine() { return myAspectLineSet; }
|
const Handle(OpenGl_AspectLine)& ApplyAspectLine() { return myAspectLineSet; }
|
||||||
|
|
||||||
//! Apply face aspect.
|
//! Apply face aspect.
|
||||||
//! @return aspect set by SetAspectFace()
|
//! @return aspect set by SetAspectFace()
|
||||||
Standard_EXPORT const OpenGl_AspectFace* ApplyAspectFace();
|
Standard_EXPORT const Handle(OpenGl_AspectFace)& ApplyAspectFace();
|
||||||
|
|
||||||
//! Apply marker aspect.
|
//! Apply marker aspect.
|
||||||
//! @return aspect set by SetAspectMarker()
|
//! @return aspect set by SetAspectMarker()
|
||||||
Standard_EXPORT const OpenGl_AspectMarker* ApplyAspectMarker();
|
Standard_EXPORT const Handle(OpenGl_AspectMarker)& ApplyAspectMarker();
|
||||||
|
|
||||||
//! Apply text aspect.
|
//! Apply text aspect.
|
||||||
//! @return aspect set by SetAspectText()
|
//! @return aspect set by SetAspectText()
|
||||||
const OpenGl_AspectText* ApplyAspectText() { return myAspectTextSet; }
|
const Handle(OpenGl_AspectText)& ApplyAspectText() { return myAspectTextSet; }
|
||||||
|
|
||||||
//! Clear the applied aspect state to default values.
|
//! Clear the applied aspect state to default values.
|
||||||
void ResetAppliedAspect();
|
void ResetAppliedAspect();
|
||||||
@@ -213,7 +213,7 @@ public:
|
|||||||
//! Checks whether the element can be rendered or not.
|
//! Checks whether the element can be rendered or not.
|
||||||
//! @param theElement [in] the element to check
|
//! @param theElement [in] the element to check
|
||||||
//! @return True if element can be rendered
|
//! @return True if element can be rendered
|
||||||
bool ShouldRender (const OpenGl_Element* theElement);
|
bool ShouldRender (const Handle(OpenGl_Element)& theElement);
|
||||||
|
|
||||||
//! Return the number of skipped transparent elements within active OpenGl_RenderFilter_OpaqueOnly filter.
|
//! Return the number of skipped transparent elements within active OpenGl_RenderFilter_OpaqueOnly filter.
|
||||||
//! @sa OpenGl_LayerList::Render()
|
//! @sa OpenGl_LayerList::Render()
|
||||||
@@ -230,13 +230,13 @@ public:
|
|||||||
inline const OpenGl_Matrix* ModelMatrix() const { return StructureMatrix_applied; }
|
inline const OpenGl_Matrix* ModelMatrix() const { return StructureMatrix_applied; }
|
||||||
|
|
||||||
//! Returns face aspect for textured font rendering.
|
//! Returns face aspect for textured font rendering.
|
||||||
const OpenGl_AspectFace& FontFaceAspect() const { return myFontFaceAspect; }
|
const Handle(OpenGl_AspectFace)& FontFaceAspect() const { return myFontFaceAspect; }
|
||||||
|
|
||||||
//! Returns face aspect for none culling mode.
|
//! Returns face aspect for none culling mode.
|
||||||
const OpenGl_AspectFace& NoneCulling() const { return myNoneCulling; }
|
const Handle(OpenGl_AspectFace)& NoneCulling() const { return myNoneCulling; }
|
||||||
|
|
||||||
//! Returns face aspect for front face culling mode.
|
//! Returns face aspect for front face culling mode.
|
||||||
const OpenGl_AspectFace& FrontCulling() const { return myFrontCulling; }
|
const Handle(OpenGl_AspectFace)& FrontCulling() const { return myFrontCulling; }
|
||||||
|
|
||||||
//! Sets a new environment texture.
|
//! Sets a new environment texture.
|
||||||
void SetEnvironmentTexture (const Handle(OpenGl_TextureSet)& theTexture) { myEnvironmentTexture = theTexture; }
|
void SetEnvironmentTexture (const Handle(OpenGl_TextureSet)& theTexture) { myEnvironmentTexture = theTexture; }
|
||||||
@@ -251,26 +251,26 @@ protected: //! @name protected fields
|
|||||||
Handle(OpenGl_Context) myGlContext;
|
Handle(OpenGl_Context) myGlContext;
|
||||||
Standard_Boolean myUseZBuffer;
|
Standard_Boolean myUseZBuffer;
|
||||||
Standard_Boolean myUseDepthWrite;
|
Standard_Boolean myUseDepthWrite;
|
||||||
OpenGl_AspectFace myNoneCulling;
|
Handle(OpenGl_AspectFace) myNoneCulling;
|
||||||
OpenGl_AspectFace myFrontCulling;
|
Handle(OpenGl_AspectFace) myFrontCulling;
|
||||||
OpenGl_AspectFace myFontFaceAspect;
|
Handle(OpenGl_AspectFace) myFontFaceAspect;
|
||||||
|
|
||||||
protected: //! @name fields related to status
|
protected: //! @name fields related to status
|
||||||
|
|
||||||
Standard_Integer myNbSkippedTranspElems; //!< counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
|
Standard_Integer myNbSkippedTranspElems; //!< counter of skipped transparent elements for OpenGl_LayerList two rendering passes method
|
||||||
Standard_Integer myRenderFilter; //!< active filter for skipping rendering of elements by some criteria (multiple render passes)
|
Standard_Integer myRenderFilter; //!< active filter for skipping rendering of elements by some criteria (multiple render passes)
|
||||||
|
|
||||||
OpenGl_AspectLine myDefaultAspectLine;
|
Handle(OpenGl_AspectLine) myDefaultAspectLine;
|
||||||
OpenGl_AspectFace myDefaultAspectFace;
|
Handle(OpenGl_AspectFace) myDefaultAspectFace;
|
||||||
OpenGl_AspectMarker myDefaultAspectMarker;
|
Handle(OpenGl_AspectMarker) myDefaultAspectMarker;
|
||||||
OpenGl_AspectText myDefaultAspectText;
|
Handle(OpenGl_AspectText) myDefaultAspectText;
|
||||||
|
|
||||||
const OpenGl_AspectLine* myAspectLineSet;
|
Handle(OpenGl_AspectLine) myAspectLineSet;
|
||||||
const OpenGl_AspectFace* myAspectFaceSet;
|
Handle(OpenGl_AspectFace) myAspectFaceSet;
|
||||||
Handle(Graphic3d_AspectFillArea3d) myAspectFaceApplied;
|
Handle(Graphic3d_AspectFillArea3d) myAspectFaceApplied;
|
||||||
const OpenGl_AspectMarker* myAspectMarkerSet;
|
Handle(OpenGl_AspectMarker) myAspectMarkerSet;
|
||||||
Handle(Graphic3d_AspectMarker3d) myAspectMarkerApplied;
|
Handle(Graphic3d_AspectMarker3d) myAspectMarkerApplied;
|
||||||
const OpenGl_AspectText* myAspectTextSet;
|
Handle(OpenGl_AspectText) myAspectTextSet;
|
||||||
Handle(Graphic3d_PresentationAttributes) myAspectFaceAppliedWithHL;
|
Handle(Graphic3d_PresentationAttributes) myAspectFaceAppliedWithHL;
|
||||||
|
|
||||||
const OpenGl_Matrix* ViewMatrix_applied;
|
const OpenGl_Matrix* ViewMatrix_applied;
|
||||||
|
@@ -158,9 +158,9 @@ void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||||
|
|
||||||
// To test linking against OpenGl_Workspace and all aspect classes
|
// To test linking against OpenGl_Workspace and all aspect classes
|
||||||
const OpenGl_AspectMarker* aMA = theWorkspace->AspectMarker();
|
const Handle(OpenGl_AspectMarker)& aMA = theWorkspace->AspectMarker();
|
||||||
aMA->Aspect()->Type();
|
aMA->Aspect()->Type();
|
||||||
const OpenGl_AspectText* aTA = theWorkspace->AspectText();
|
const Handle(OpenGl_AspectText)& aTA = theWorkspace->AspectText();
|
||||||
aTA->Aspect()->Font();
|
aTA->Aspect()->Font();
|
||||||
OpenGl_Vec4 aColor = theWorkspace->LineColor();
|
OpenGl_Vec4 aColor = theWorkspace->LineColor();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user