mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0024590: Crash when processing OpenGl_BndBoxPrs objects
Eliminate TelType enumeration Cosmetics, warnings
This commit is contained in:
parent
f1a5afa25c
commit
5322131bd1
@ -68,7 +68,6 @@ OpenGl_PriorityList.hxx
|
|||||||
OpenGl_PriorityList.cxx
|
OpenGl_PriorityList.cxx
|
||||||
OpenGl_AVIWriter.hxx
|
OpenGl_AVIWriter.hxx
|
||||||
OpenGl_AVIWriter.cxx
|
OpenGl_AVIWriter.cxx
|
||||||
OpenGl_tsm.hxx
|
|
||||||
OpenGl_FrameBuffer.hxx
|
OpenGl_FrameBuffer.hxx
|
||||||
OpenGl_FrameBuffer.cxx
|
OpenGl_FrameBuffer.cxx
|
||||||
OpenGl_Texture.cxx
|
OpenGl_Texture.cxx
|
||||||
|
@ -347,7 +347,7 @@ void OpenGl_GraphicDriver::SetStencilTestOptions (const Graphic3d_CGroup& theCGr
|
|||||||
{
|
{
|
||||||
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
|
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
|
||||||
aStencilTest->SetOptions (theIsEnabled);
|
aStencilTest->SetOptions (theIsEnabled);
|
||||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aStencilTest);
|
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aStencilTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -375,7 +375,7 @@ void OpenGl_GraphicDriver::Text (const Graphic3d_CGroup& theCGro
|
|||||||
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 (theText, aPoint, aParams);
|
OpenGl_Text* aText = new OpenGl_Text (theText, aPoint, aParams);
|
||||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelText, aText);
|
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -589,5 +589,5 @@ void OpenGl_GraphicDriver::SetFlippingOptions (const Graphic3d_CGroup& theCGroup
|
|||||||
{
|
{
|
||||||
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
|
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
|
||||||
aFlipper->SetOptions (theIsEnabled);
|
aFlipper->SetOptions (theIsEnabled);
|
||||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aFlipper);
|
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aFlipper);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ void OpenGl_GraphicDriver::PrimitiveArray( const Graphic3d_CGroup& ACGroup,
|
|||||||
if ( ACGroup.ptrGroup && parray )
|
if ( ACGroup.ptrGroup && parray )
|
||||||
{
|
{
|
||||||
OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray );
|
OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray );
|
||||||
((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelParray, aparray );
|
((OpenGl_Group *)ACGroup.ptrGroup)->AddElement (aparray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void OpenGl_GraphicDriver::UserDraw (const Graphic3d_CGroup& theCGroup,
|
|||||||
OpenGl_Element* aUserDraw = myUserDrawCallback(&theUserDraw);
|
OpenGl_Element* aUserDraw = myUserDrawCallback(&theUserDraw);
|
||||||
if (aUserDraw != NULL)
|
if (aUserDraw != NULL)
|
||||||
{
|
{
|
||||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelUserdraw, aUserDraw);
|
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aUserDraw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ void OpenGl_Group::SetAspectLine (const CALL_DEF_CONTEXTLINE& theAspect,
|
|||||||
{
|
{
|
||||||
OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine();
|
OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine();
|
||||||
anAspectLine->SetAspect (theAspect);
|
anAspectLine->SetAspect (theAspect);
|
||||||
AddElement (TelNil/*TelAspectLine*/, anAspectLine);
|
AddElement (anAspectLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ void OpenGl_Group::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theAspect,
|
|||||||
{
|
{
|
||||||
OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace();
|
OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace();
|
||||||
anAspectFace->SetAspect (theAspect);
|
anAspectFace->SetAspect (theAspect);
|
||||||
AddElement (TelNil/*TelAspectFace*/, anAspectFace);
|
AddElement (anAspectFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
@ -131,7 +131,7 @@ void OpenGl_Group::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect,
|
|||||||
{
|
{
|
||||||
OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker();
|
OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker();
|
||||||
anAspectMarker->SetAspect (theAspect);
|
anAspectMarker->SetAspect (theAspect);
|
||||||
AddElement (TelNil/*TelAspectMarker*/, anAspectMarker);
|
AddElement (anAspectMarker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ void OpenGl_Group::SetAspectText (const CALL_DEF_CONTEXTTEXT& theAspect,
|
|||||||
{
|
{
|
||||||
OpenGl_AspectText* anAspectText = new OpenGl_AspectText();
|
OpenGl_AspectText* anAspectText = new OpenGl_AspectText();
|
||||||
anAspectText->SetAspect (theAspect);
|
anAspectText->SetAspect (theAspect);
|
||||||
AddElement ( TelNil/*TelAspectText*/, anAspectText);
|
AddElement (anAspectText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,11 +162,10 @@ void OpenGl_Group::SetAspectText (const CALL_DEF_CONTEXTTEXT& theAspect,
|
|||||||
// function : AddElement
|
// function : AddElement
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Group::AddElement (const TelType theType, OpenGl_Element *theElem)
|
void OpenGl_Group::AddElement (OpenGl_Element* theElem)
|
||||||
{
|
{
|
||||||
OpenGl_ElementNode *aNode = new OpenGl_ElementNode();
|
OpenGl_ElementNode *aNode = new OpenGl_ElementNode();
|
||||||
|
|
||||||
aNode->type = theType;
|
|
||||||
aNode->elem = theElem;
|
aNode->elem = theElem;
|
||||||
aNode->next = NULL;
|
aNode->next = NULL;
|
||||||
(myLast? myLast->next : myFirst) = aNode;
|
(myLast? myLast->next : myFirst) = aNode;
|
||||||
@ -194,7 +193,6 @@ void OpenGl_Group::AddElement (const TelType theType, OpenGl_Element *theElem)
|
|||||||
void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||||
{
|
{
|
||||||
// Is rendering in ADD or IMMEDIATE mode?
|
// Is rendering in ADD or IMMEDIATE mode?
|
||||||
const Standard_Boolean isImmediate = (theWorkspace->NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) != 0;
|
|
||||||
const Handle(OpenGl_RenderFilter)& aFilter = theWorkspace->GetRenderFilter();
|
const Handle(OpenGl_RenderFilter)& aFilter = theWorkspace->GetRenderFilter();
|
||||||
|
|
||||||
// Setup aspects
|
// Setup aspects
|
||||||
@ -210,27 +208,7 @@ void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
|||||||
// Render group elements
|
// Render group elements
|
||||||
for (OpenGl_ElementNode* aNodeIter = myFirst; aNodeIter != NULL; aNodeIter = aNodeIter->next)
|
for (OpenGl_ElementNode* aNodeIter = myFirst; aNodeIter != NULL; aNodeIter = aNodeIter->next)
|
||||||
{
|
{
|
||||||
switch (aNodeIter->type)
|
|
||||||
{
|
|
||||||
case TelMarker:
|
|
||||||
case TelMarkerSet:
|
|
||||||
case TelText:
|
|
||||||
{
|
|
||||||
glDisable (GL_LIGHTING);
|
|
||||||
if (isImmediate)
|
|
||||||
{
|
|
||||||
glDepthMask (GL_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
aNodeIter->elem->RenderFiltered (theWorkspace, aFilter);
|
aNodeIter->elem->RenderFiltered (theWorkspace, aFilter);
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
aNodeIter->elem->RenderFiltered (theWorkspace, aFilter);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore aspects
|
// Restore aspects
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <OpenGl_AspectMarker.hxx>
|
#include <OpenGl_AspectMarker.hxx>
|
||||||
#include <OpenGl_AspectText.hxx>
|
#include <OpenGl_AspectText.hxx>
|
||||||
|
|
||||||
#include <OpenGl_tsm.hxx>
|
|
||||||
|
|
||||||
class OpenGl_Group;
|
class OpenGl_Group;
|
||||||
class OpenGl_Structure;
|
class OpenGl_Structure;
|
||||||
|
|
||||||
@ -35,9 +33,8 @@ typedef NCollection_List<const OpenGl_Group* > OpenGl_ListOfGroup;
|
|||||||
|
|
||||||
struct OpenGl_ElementNode
|
struct OpenGl_ElementNode
|
||||||
{
|
{
|
||||||
TelType type;
|
OpenGl_Element* elem;
|
||||||
OpenGl_Element *elem;
|
OpenGl_ElementNode* next;
|
||||||
OpenGl_ElementNode *next;
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,7 +53,7 @@ public:
|
|||||||
void SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
void SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
||||||
void SetAspectText (const CALL_DEF_CONTEXTTEXT& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
void SetAspectText (const CALL_DEF_CONTEXTTEXT& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
||||||
|
|
||||||
void AddElement (const TelType, OpenGl_Element * );
|
void AddElement (OpenGl_Element* theElem);
|
||||||
|
|
||||||
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||||
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
||||||
|
@ -335,13 +335,10 @@ namespace OpenGl_Raytrace
|
|||||||
// 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 OpenGl_ElementNode* theNode)
|
||||||
{
|
|
||||||
if (TelParray == theNode->type)
|
|
||||||
{
|
{
|
||||||
OpenGl_PrimitiveArray* anArray = dynamic_cast< OpenGl_PrimitiveArray* > (theNode->elem);
|
OpenGl_PrimitiveArray* anArray = dynamic_cast< OpenGl_PrimitiveArray* > (theNode->elem);
|
||||||
return anArray->PArray()->type >= TelPolygonsArrayType;
|
return anArray != NULL
|
||||||
}
|
&& anArray->PArray()->type >= TelPolygonsArrayType;
|
||||||
return Standard_False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -283,7 +283,7 @@ void OpenGl_Structure::SetHighlightBox (const Handle(OpenGl_Context)& theGlCtx,
|
|||||||
myHighlightBox->SetAspectLine (aContextLine);
|
myHighlightBox->SetAspectLine (aContextLine);
|
||||||
|
|
||||||
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (theBoundBox);
|
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (theBoundBox);
|
||||||
myHighlightBox->AddElement (TelParray, aBndBoxPrs);
|
myHighlightBox->AddElement (aBndBoxPrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@ -709,6 +709,7 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx,
|
|||||||
|
|
||||||
// push enabled flags to the stack
|
// push enabled flags to the stack
|
||||||
glPushAttrib (GL_ENABLE_BIT);
|
glPushAttrib (GL_ENABLE_BIT);
|
||||||
|
glDisable (GL_LIGHTING);
|
||||||
|
|
||||||
// setup depth test
|
// setup depth test
|
||||||
if (!myIs2d
|
if (!myIs2d
|
||||||
|
@ -136,20 +136,16 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! Creates new texture format.
|
//! Creates new texture format.
|
||||||
OpenGl_TextureFormat (const GLint theChannels, const GLint theInternal)
|
OpenGl_TextureFormat (const GLint theChannels,
|
||||||
: myChannels (theChannels),
|
const GLint theInternal)
|
||||||
myInternal (theInternal)
|
: myInternal (theInternal),
|
||||||
{
|
myChannels (theChannels) {}
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! OpenGL internal format of the pixel data.
|
GLint myInternal; //!< OpenGL internal format of the pixel data
|
||||||
GLint myInternal;
|
GLint myChannels; //!< Number of channels for each pixel (from 1 to 4)
|
||||||
|
|
||||||
//! Number of channels for each pixel (from 1 to 4).
|
|
||||||
GLint myChannels;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Texture resource.
|
//! Texture resource.
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
|
|
||||||
#include <NCollection_Sequence.hxx>
|
#include <NCollection_Sequence.hxx>
|
||||||
|
|
||||||
#include <OpenGl_tsm.hxx>
|
|
||||||
|
|
||||||
#include <OpenGl_AspectFace.hxx>
|
#include <OpenGl_AspectFace.hxx>
|
||||||
#include <OpenGl_Display.hxx>
|
#include <OpenGl_Display.hxx>
|
||||||
#include <OpenGl_Matrix.hxx>
|
#include <OpenGl_Matrix.hxx>
|
||||||
|
@ -405,11 +405,8 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
|
|||||||
|
|
||||||
// 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 = anItg.Value()->FirstNode(); aNode != NULL; aNode = aNode->next)
|
for (const OpenGl_ElementNode* aNode = anItg.Value()->FirstNode(); aNode != NULL; aNode = aNode->next)
|
||||||
{
|
|
||||||
if (TelNil == aNode->type)
|
|
||||||
{
|
{
|
||||||
OpenGl_AspectFace* anAspect = dynamic_cast<OpenGl_AspectFace*> (aNode->elem);
|
OpenGl_AspectFace* anAspect = dynamic_cast<OpenGl_AspectFace*> (aNode->elem);
|
||||||
|
|
||||||
if (anAspect != NULL)
|
if (anAspect != NULL)
|
||||||
{
|
{
|
||||||
aMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
|
aMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
|
||||||
@ -419,11 +416,9 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
|
|||||||
|
|
||||||
myRaytraceGeometry.Materials.push_back (aMaterial);
|
myRaytraceGeometry.Materials.push_back (aMaterial);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (TelParray == aNode->type)
|
|
||||||
{
|
{
|
||||||
OpenGl_PrimitiveArray* aPrimArray = dynamic_cast<OpenGl_PrimitiveArray*> (aNode->elem);
|
OpenGl_PrimitiveArray* aPrimArray = dynamic_cast<OpenGl_PrimitiveArray*> (aNode->elem);
|
||||||
|
|
||||||
if (aPrimArray != NULL)
|
if (aPrimArray != NULL)
|
||||||
{
|
{
|
||||||
NCollection_Handle<BVH_Object<Standard_ShortReal, 4> > aSet =
|
NCollection_Handle<BVH_Object<Standard_ShortReal, 4> > aSet =
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
// Copyright (c) 1995-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and / or modify it
|
|
||||||
// under the terms of the GNU Lesser General Public version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#ifndef OPENGL_TSM_H
|
|
||||||
#define OPENGL_TSM_H
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
TelNil = 0,
|
|
||||||
TelMarker,
|
|
||||||
TelMarkerSet,
|
|
||||||
TelText,
|
|
||||||
TelParray,
|
|
||||||
TelUserdraw,
|
|
||||||
TelLast
|
|
||||||
} TelType;
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user