OpenGl_PriorityList.cxx
OpenGl_AVIWriter.hxx
OpenGl_AVIWriter.cxx
-OpenGl_tsm.hxx
OpenGl_FrameBuffer.hxx
OpenGl_FrameBuffer.cxx
OpenGl_Texture.cxx
{
return Standard_False;
}
-
+
return reinterpret_cast<const OpenGl_CView*> (theCView.ptrView)->WS->GetOpenClDeviceInfo (theInfo);
}
{
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
aStencilTest->SetOptions (theIsEnabled);
- ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aStencilTest);
+ ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aStencilTest);
}
// =======================================================================
aParams.VAlign = theVta;
const OpenGl_Vec3 aPoint (thePoint.X(), thePoint.Y(), thePoint.Z());
OpenGl_Text* aText = new OpenGl_Text (theText, aPoint, aParams);
- ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelText, aText);
+ ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aText);
}
// =======================================================================
{
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
aFlipper->SetOptions (theIsEnabled);
- ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aFlipper);
+ ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aFlipper);
}
if ( ACGroup.ptrGroup && parray )
{
OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray );
- ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelParray, aparray );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement (aparray);
}
}
OpenGl_Element* aUserDraw = myUserDrawCallback(&theUserDraw);
if (aUserDraw != NULL)
{
- ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelUserdraw, aUserDraw);
+ ((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aUserDraw);
}
}
}
{
OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine();
anAspectLine->SetAspect (theAspect);
- AddElement (TelNil/*TelAspectLine*/, anAspectLine);
+ AddElement (anAspectLine);
}
}
{
OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace();
anAspectFace->SetAspect (theAspect);
- AddElement (TelNil/*TelAspectFace*/, anAspectFace);
+ AddElement (anAspectFace);
}
#ifdef HAVE_OPENCL
{
OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker();
anAspectMarker->SetAspect (theAspect);
- AddElement (TelNil/*TelAspectMarker*/, anAspectMarker);
+ AddElement (anAspectMarker);
}
}
{
OpenGl_AspectText* anAspectText = new OpenGl_AspectText();
anAspectText->SetAspect (theAspect);
- AddElement ( TelNil/*TelAspectText*/, anAspectText);
+ AddElement (anAspectText);
}
}
// function : AddElement
// purpose :
// =======================================================================
-void OpenGl_Group::AddElement (const TelType theType, OpenGl_Element *theElem)
+void OpenGl_Group::AddElement (OpenGl_Element* theElem)
{
OpenGl_ElementNode *aNode = new OpenGl_ElementNode();
- aNode->type = theType;
aNode->elem = theElem;
aNode->next = NULL;
(myLast? myLast->next : myFirst) = aNode;
void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
{
// 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();
// Setup aspects
// Render group elements
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);
- break;
- }
- default:
- {
- aNodeIter->elem->RenderFiltered (theWorkspace, aFilter);
- break;
- }
- }
+ aNodeIter->elem->RenderFiltered (theWorkspace, aFilter);
}
// Restore aspects
#include <OpenGl_AspectMarker.hxx>
#include <OpenGl_AspectText.hxx>
-#include <OpenGl_tsm.hxx>
-
class OpenGl_Group;
class OpenGl_Structure;
-typedef NCollection_List<const OpenGl_Group* > OpenGl_ListOfGroup;
+typedef NCollection_List<const OpenGl_Group* > OpenGl_ListOfGroup;
struct OpenGl_ElementNode
{
- TelType type;
- OpenGl_Element *elem;
- OpenGl_ElementNode *next;
+ OpenGl_Element* elem;
+ OpenGl_ElementNode* next;
DEFINE_STANDARD_ALLOC
};
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 AddElement (const TelType, OpenGl_Element * );
+ void AddElement (OpenGl_Element* theElem);
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
OpenGl_ElementNode* myFirst;
OpenGl_ElementNode* myLast;
-
+
#ifdef HAVE_OPENCL
const OpenGl_Structure* myAncestorStructure;
Standard_Boolean myIsRaytracable;
{
OpenGl_TriangleSet* aTriangleSet = dynamic_cast<OpenGl_TriangleSet*> (
Set->Objects().ChangeValue (static_cast<Standard_Integer> (anObjectIdx)).operator->());
-
+
if (aTriangleSet != NULL)
{
aTriangleSet->BVH();
#ifdef BVH_PRINT_INFO
OSD_Timer aTimer;
#endif
-
+
MarkDirty(); // force BVH rebuilding
#ifdef BVH_PRINT_INFO
tbb::parallel_for (tbb::blocked_range<size_t> (0, Size()),
OpenGL_BVHParallelBuilder (this));
#endif
-
+
for (Standard_Integer anObjectIdx = 0; anObjectIdx < Size(); ++anObjectIdx)
{
OpenGl_TriangleSet* aTriangleSet = dynamic_cast<OpenGl_TriangleSet*> (
Standard_ASSERT_RETURN (aTriangleSet != NULL,
"Error! Failed to get triangulation of OpenGL element", Standard_False);
-
+
Standard_ASSERT_RETURN (!aTriangleSet->BVH().IsNull(),
"Error! Failed to update bottom-level BVH of OpenGL element", Standard_False);
}
if (aBVH->NodeInfoBuffer().at (theNodeIdx).x() > myObjects.Size())
return NULL;
-
+
return dynamic_cast<OpenGl_TriangleSet*> (myObjects.ChangeValue (
aBVH->NodeInfoBuffer().at (theNodeIdx).x() - 1).operator->());
}
// =======================================================================
Standard_Boolean IsRaytracedElement (const OpenGl_ElementNode* theNode)
{
- if (TelParray == theNode->type)
- {
- OpenGl_PrimitiveArray* anArray = dynamic_cast< OpenGl_PrimitiveArray* > (theNode->elem);
- return anArray->PArray()->type >= TelPolygonsArrayType;
- }
- return Standard_False;
+ OpenGl_PrimitiveArray* anArray = dynamic_cast< OpenGl_PrimitiveArray* > (theNode->elem);
+ return anArray != NULL
+ && anArray->PArray()->type >= TelPolygonsArrayType;
}
// =======================================================================
myHighlightBox->SetAspectLine (aContextLine);
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (theBoundBox);
- myHighlightBox->AddElement (TelParray, aBndBoxPrs);
+ myHighlightBox->AddElement (aBndBoxPrs);
}
// =======================================================================
if (anIt.Value() == theStructure)
{
return;
- }
+ }
}
myAncestorStructures.Append (theStructure);
{
myAncestorStructures.Remove (anIt);
return;
- }
+ }
}
}
{
anAncestor->myConnected.Remove (anIts);
return;
- }
+ }
}
}
}
#ifdef HAVE_OPENCL
aRaytracableGroupDeleted |= anIter.Value()->IsRaytracable();
#endif
-
+
// Delete objects
OpenGl_Element::Destroy (theGlCtx, const_cast<OpenGl_Group*& > (anIter.ChangeValue()));
}
aProgram->BindWithVariables (aCtx);
const OpenGl_MaterialState* aMaterialState = aCtx->ShaderManager()->MaterialState (aProgram);
-
+
if (aMaterialState == NULL || aMaterialState->Aspect() != aTextAspect)
aCtx->ShaderManager()->UpdateMaterialStateTo (aProgram, aTextAspect);
-
+
aCtx->ShaderManager()->PushState (aProgram);
}
else
// push enabled flags to the stack
glPushAttrib (GL_ENABLE_BIT);
+ glDisable (GL_LIGHTING);
// setup depth test
if (!myIs2d
private:
//! Creates new texture format.
- OpenGl_TextureFormat (const GLint theChannels, const GLint theInternal)
- : myChannels (theChannels),
- myInternal (theInternal)
- {
- //
- }
+ OpenGl_TextureFormat (const GLint theChannels,
+ const GLint theInternal)
+ : myInternal (theInternal),
+ myChannels (theChannels) {}
private:
- //! OpenGL internal format of the pixel data.
- GLint myInternal;
+ GLint myInternal; //!< OpenGL internal format of the pixel data
+ 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.
#include <NCollection_Sequence.hxx>
-#include <OpenGl_tsm.hxx>
-
#include <OpenGl_AspectFace.hxx>
#include <OpenGl_Display.hxx>
#include <OpenGl_Matrix.hxx>
//! @param theFilter [in] the filter instance.
inline void SetRenderFilter (const Handle(OpenGl_RenderFilter)& theFilter)
{
- myRenderFilter = theFilter;
+ myRenderFilter = theFilter;
}
//! Get rendering filter.
//! @return filter instance.
- inline const Handle(OpenGl_RenderFilter)& GetRenderFilter() const
- {
- return myRenderFilter;
+ inline const Handle(OpenGl_RenderFilter)& GetRenderFilter() const
+ {
+ return myRenderFilter;
}
//! @return applied view matrix.
//! Updates environment map for ray-tracing.
Standard_Boolean UpdateRaytraceEnvironmentMap();
-
+
//! Adds OpenGL structure to ray-traced scene geometry.
Standard_Boolean AddRaytraceStructure (const OpenGl_Structure* theStructure,
const Standard_ShortReal* theTransform, std::set<const OpenGl_Structure*>& theElements);
//! Initializes OpenCL resources.
Standard_Boolean InitOpenCL();
-
+
//! Releases OpenCL resources.
void ReleaseOpenCL();
Standard_Boolean myIsRaytraceDataValid;
//! Is geometry data musty be updated?
Standard_Boolean myToUpdateRaytraceData;
-
+
//! 3D scene geometry data for ray-tracing.
OpenGl_RaytraceGeometry myRaytraceGeometry;
// Add OpenGL elements from group (extract primitives arrays and aspects)
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);
+ if (anAspect != NULL)
{
- OpenGl_AspectFace* anAspect = dynamic_cast<OpenGl_AspectFace*> (aNode->elem);
+ aMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
- if (anAspect != NULL)
- {
- aMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
-
- OpenGl_RaytraceMaterial aMaterial;
- CreateMaterial (anAspect->IntFront(), aMaterial);
+ OpenGl_RaytraceMaterial aMaterial;
+ CreateMaterial (anAspect->IntFront(), aMaterial);
- myRaytraceGeometry.Materials.push_back (aMaterial);
- }
+ myRaytraceGeometry.Materials.push_back (aMaterial);
}
- else if (TelParray == aNode->type)
+ else
{
OpenGl_PrimitiveArray* aPrimArray = dynamic_cast<OpenGl_PrimitiveArray*> (aNode->elem);
-
if (aPrimArray != NULL)
{
NCollection_Handle<BVH_Object<Standard_ShortReal, 4> > aSet =
case TelTriangleFansArrayType:
return AddRaytraceTriangleFanArray (theSet, theArray, theOffset, theCount, theMatID);
- case TelTriangleStripsArrayType:
+ case TelTriangleStripsArrayType:
return AddRaytraceTriangleStripArray (theSet, theArray, theOffset, theCount, theMatID);
case TelQuadrangleStripsArrayType:
clReleaseProgram (myRaytraceProgram);
clReleaseCommandQueue (myComputeQueue);
-
+
clReleaseMemObject (myRaytraceOutputImage);
clReleaseMemObject (myRaytraceEnvironment);
clReleaseMemObject (myRaytraceOutputImageAA);
myGlContext->DelayedRelease (myRaytraceOutputTextureAA);
}
}
-
+
myRaytraceOutputTexture = new OpenGl_Texture();
-
+
myRaytraceOutputTexture->Create (myGlContext);
myRaytraceOutputTexture->InitRectangle (myGlContext,
theSizeX, theSizeY, OpenGl_TextureFormat::Create<GLfloat, 4>());
-
+
myRaytraceOutputTextureAA = new OpenGl_Texture();
-
+
myRaytraceOutputTextureAA->Create (myGlContext);
myRaytraceOutputTextureAA->InitRectangle (myGlContext,
theSizeX, theSizeY, OpenGl_TextureFormat::Create<GLfloat, 4>());
cl_int anErrorTmp = CL_SUCCESS;
const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >& aBVH = myRaytraceGeometry.BVH();
-
+
const size_t aSceneMinPointBufferSize =
aBVH->MinPointBuffer().size() != 0 ? aBVH->MinPointBuffer().size() : 1;
aTotalBVHNodesNb += aTriangleSet->BVH()->NodeInfoBuffer().size();
}
-
+
aTotalBVHNodesNb = aTotalBVHNodesNb > 0 ? aTotalBVHNodesNb : 1;
myObjectNodeInfoBuffer = clCreateBuffer (myComputeContext,
#endif
#ifdef RAY_TRACE_PRINT_INFO
-
+
Standard_ShortReal aMemUsed = 0.f;
-
+
for (Standard_Integer anElemIdx = 0; anElemIdx < myRaytraceGeometry.Size(); ++anElemIdx)
{
OpenGl_TriangleSet* aTriangleSet = dynamic_cast<OpenGl_TriangleSet*> (
aMemUsed += static_cast<Standard_ShortReal> (
aTriangleSet->BVH()->MaxPointBuffer().size() * sizeof (BVH_Vec4f));
}
-
+
aMemUsed += static_cast<Standard_ShortReal> (
myRaytraceGeometry.BVH()->NodeInfoBuffer().size() * sizeof (BVH_Vec4i));
aMemUsed += static_cast<Standard_ShortReal> (
if (anError != CL_SUCCESS)
{
const TCollection_ExtendedString aMessage = "Error! Failed to set arguments of ray-tracing kernel!";
-
+
myGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
GL_DEBUG_TYPE_ERROR_ARB, 0, GL_DEBUG_SEVERITY_HIGH_ARB, aMessage);
+++ /dev/null
-// 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