Graphic3d_Layer.hxx
Graphic3d_ZLayerId.hxx
Graphic3d_ZLayerSettings.hxx
-Graphic3d_OcclusionQuery.hxx
-Graphic3d_OcclusionQuery.cxx
Graphic3d_ViewOcclusionMask.hxx
-Graphic3d_ViewOcclusionMask.cxx
//! Returns True if the structure occulded in specified view, otherwise
//! returns False.
- Standard_Boolean IsOccluded(const Standard_Integer theViewId) const {
+ Standard_Boolean IsOccluded(const Standard_Integer theViewId) const
+ {
return (!OcclusionMask->IsVisible(theViewId));
}
//! Marks structure as Occluded by other strcuture in specified view,!
- void SetOccluded(const Standard_Integer theViewId) const {
- OcclusionMask->SetVisible(Standard_False, theViewId);
+ void SetOccluionSate(const Standard_Integer theViewId, const bool theIsVisible) const
+ {
+ OcclusionMask->SetVisible(theViewId, !theIsVisible);
}
//! Returns whether check of object's bounding box clipping is enabled before drawing of object; TRUE by default.
public:
- Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
- Handle(Graphic3d_ViewOcclusionMask) OcclusionMask; //!< view occlusion mask
+ Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
+ Handle(Graphic3d_ViewOcclusionMask) OcclusionMask; //!< view occlusion mask
protected:
//! Returns number of occluded strcutures in the view
Standard_EXPORT void OccludedStructures(Graphic3d_MapOfStructure& theStructures) const;
+
+ //! update occlusion test for dispalyed strcutures in the view
+ Standard_EXPORT virtual void UpdateOcclusion() = 0 ;
//! Returns number of displayed structures in the view.
virtual Standard_Integer NumberOfDisplayedStructures() const { return myStructsDisplayed.Extent(); }
+++ /dev/null
-// Created on: 2024-02-20
-// Created by: Hossam Ali
-// Copyright (c) 2024 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in
-// OCCT distribution for complete text of the license and disclaimer of any
-// warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Graphic3d_OcclusionQuery.hxx>
-
-#include <Standard_Dump.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_OcclusionQuery, Standard_Transient)
-
-// =======================================================================
-// function : GetNumSamplesPassed
-// purpose :
-// =======================================================================
-unsigned int Graphic3d_OcclusionQuery::GetNumSamplesPassed() const {
- return samplesPassed;
-}
-
-// =======================================================================
-// function : AnySamplesPassed
-// purpose :
-// =======================================================================
-bool Graphic3d_OcclusionQuery::AnySamplesPassed() const {
- return samplesPassed > 0;
-}
-
-// =======================================================================
-// function : DumpJson
-// purpose :
-// =======================================================================
-void Graphic3d_OcclusionQuery::DumpJson(Standard_OStream &theOStream,
- Standard_Integer) const {
- OCCT_DUMP_TRANSIENT_CLASS_BEGIN(theOStream)
-
- OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, queryID)
- OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, samplesPassed)
-}
\ No newline at end of file
+++ /dev/null
-// Created on: 2024-02-20
-// Created by: Hossam Ali
-// Copyright (c) 2024 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in
-// OCCT distribution for complete text of the license and disclaimer of any
-// warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Graphic3d_OcclusionQuery_HeaderFile
-#define _Graphic3d_OcclusionQuery_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-//! Base class provides access to occlusion query functionality.
-class Graphic3d_OcclusionQuery : public Standard_Transient {
-public:
- //! Empty constructor.
- Graphic3d_OcclusionQuery() : queryID(0), samplesPassed(0) {}
-
- //! Begins occlusion query. Until the query is ended, samples that pass the
- //! rendering pipeline are counted.
- Standard_EXPORT virtual void BeginQuery() const = 0;
-
- //! Ends occlusion query and caches the result - number of samples that passed
- //! the rendering pipeline.
- Standard_EXPORT virtual void EndQuery() = 0;
-
- //! Gets number of samples that have passed the rendering pipeline.
- unsigned int GetNumSamplesPassed() const;
-
- //! Helper method that returns if any samples have passed the rendering
- //! pipeline.
- bool AnySamplesPassed() const;
-
- //! Dumps the content of me into the stream
- Standard_EXPORT void DumpJson(Standard_OStream &theOStream,
- Standard_Integer theDepth = -1) const;
-
-protected:
- unsigned int queryID; // Query object ID
- int samplesPassed; // Number of samples passed in last query
-
-public:
- DEFINE_STANDARD_RTTIEXT(Graphic3d_OcclusionQuery, Standard_Transient)
-};
-
-DEFINE_STANDARD_HANDLE(Graphic3d_OcclusionQuery, Standard_Transient)
-
-#endif // _Graphic3d_OcclusionQuery_HeaderFile
+++ /dev/null
-// Created on: 2024-02-20
-// Created by: Hossam Ali
-// Copyright (c) 2024 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in
-// OCCT distribution for complete text of the license and disclaimer of any
-// warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Graphic3d_ViewOcclusionMask.hxx>
-
-#include <Standard_Dump.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ViewOcclusionMask, Standard_Transient)
-
-// =======================================================================
-// function : DumpJson
-// purpose :
-// =======================================================================
-void Graphic3d_ViewOcclusionMask::DumpJson(Standard_OStream &theOStream,
- Standard_Integer) const {
- OCCT_DUMP_TRANSIENT_CLASS_BEGIN(theOStream)
-
- OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myMask)
-}
\ No newline at end of file
#ifndef _Graphic3d_ViewOcclusionMask_HeaderFile
#define _Graphic3d_ViewOcclusionMask_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
+#include <Graphic3d_ViewAffinity.hxx>
-//! Structure display state.
-class Graphic3d_ViewOcclusionMask : public Standard_Transient
-{
-public:
+//! define occlusion mask as alias for view affinity mask .
+typedef Graphic3d_ViewAffinity Graphic3d_ViewOcclusionMask;
- //! Empty constructor.
- Graphic3d_ViewOcclusionMask()
- {
- SetVisible (Standard_True);
- }
-
- //! Return visibility flag.
- bool IsVisible (const Standard_Integer theViewId) const
- {
- const unsigned int aBit = 1 << theViewId;
- return (myMask & aBit) != 0;
- }
-
- //! Setup visibility flag for all views.
- void SetVisible (const Standard_Boolean theIsVisible)
- {
- ::memset (&myMask, theIsVisible ? 0xFF : 0x00, sizeof(myMask));
- }
-
- //! Setup visibility flag.
- void SetVisible (const Standard_Integer theViewId,
- const bool theIsVisible)
- {
- const unsigned int aBit = 1 << theViewId;
- if (theIsVisible)
- {
- myMask |= aBit;
- }
- else
- {
- myMask &= ~aBit;
- }
- }
-
- //! Dumps the content of me into the stream
- Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
-
-private:
-
- unsigned int myMask; //!< affinity mask
-
-public:
-
- DEFINE_STANDARD_RTTIEXT(Graphic3d_ViewOcclusionMask,Standard_Transient)
-
-};
-
-DEFINE_STANDARD_HANDLE(Graphic3d_ViewOcclusionMask, Standard_Transient)
-
-#endif // _Graphic3d_ViewOcclusionMask_HeaderFile
+#endif //_Graphic3d_ViewOcclusionMask_HeaderFile
\ No newline at end of file
#include <OpenGl_VertexBuffer.hxx>
#include <OpenGl_View.hxx>
#include <OpenGl_Workspace.hxx>
+#include <OpenGl_OcclusionQuery.hxx>
namespace
{
//function : updateOcclusion
//purpose : update Occlsuion state for each struct in each layer
//=======================================================================
-void OpenGl_LayerList::UpdateOcclusion( const Handle(OpenGl_Workspace) & theWorkspace,
- const Standard_Boolean theToDrawImmediate,
- const OpenGl_FrameBuffer *theReadDrawFbo,
- const OpenGl_FrameBuffer *theOitAccumFbo)
-{
+void OpenGl_LayerList::UpdateOcclusion( const Handle(OpenGl_Workspace) & theWorkspace)
+{
const Handle(OpenGl_Context) &aCtx = theWorkspace->GetGlContext();
aCtx->core11fwd->glEnable(GL_DEPTH_TEST);
aCtx->core11fwd->glDepthFunc (GL_LESS);
// Turn off writing to depth and color buffers
aCtx->core11fwd->glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- aCtx->core11fwd->glDepthMask(GL_FALSE);
// Start record occlusion test computational cost
const Handle(OpenGl_FrameStats) &aStats = theWorkspace->GetGlContext()->FrameStats();
if (aLayer->IsCulled())
continue;
- /// TODO Change below to Graphic3d_Query
- GLuint query_ID;
- GLint samplesPassed;
-
- aCtx->core20->glGenQueries(1, &query_ID);
+ aCtx->core11fwd->glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
// Render priority list
const Standard_Integer aViewId = theWorkspace->View()->Identification();
if (aStruct->IsCulled() || !aStruct->IsVisible(aViewId))
continue;
- // Begin occlusion query
- aCtx->core20->glBeginQuery(GL_SAMPLES_PASSED, query_ID);
-
- // Dry rendering for conservative approximation of the complex object
- aStruct->RenderOccluder(theWorkspace);
-
- // End query and count no of samples
- aCtx->core20->glEndQuery(GL_SAMPLES_PASSED);
- aCtx->core20->glGetQueryObjectiv(query_ID, GL_QUERY_RESULT, &samplesPassed);
-
- if (samplesPassed <= 0)
- aStruct->SetOccluded(aViewId);
-
- std::cout << "layerID: " << aLayer->LayerId()
- << " structureID: " << aStruct->Identification()
- << " clocation: " << aStruct->BoundingBox().Center().z()
- << " queryID: " << query_ID
- << " sample passsed : " << samplesPassed << std::endl;
- samplesPassed=0;
+ aStruct->UpdateOcclusion(theWorkspace);
}
}
- // Release query resources
- aCtx->core20->glDeleteQueries(1, &query_ID);
}
// Back to prev settings
OpenGl_FrameBuffer* theOitAccumFbo) const;
//! Update occlusion test
- Standard_EXPORT void UpdateOcclusion(const Handle(OpenGl_Workspace) & theWorkspace,
- const Standard_Boolean theToDrawImmediate,
- const OpenGl_FrameBuffer *theReadDrawFbo,
- const OpenGl_FrameBuffer *theOitAccumFbo);
+ Standard_EXPORT void UpdateOcclusion(const Handle(OpenGl_Workspace) & theWorkspace);
//! Returns the set of OpenGL Z-layers.
const NCollection_List<Handle(Graphic3d_Layer)>& Layers() const { return myLayers; }
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include "OpenGl_OcclusionQuery.hxx"
+#include <OpenGl_OcclusionQuery.hxx>
#include <OpenGl_Context.hxx>
#include <OpenGl_GlCore15.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(OpenGl_OcclusionQuery, Graphic3d_OcclusionQuery)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_OcclusionQuery, OpenGl_Resource)
// =======================================================================
// function :
// purpose :
// =======================================================================
-Standard_EXPORT
-OpenGl_OcclusionQuery::OpenGl_OcclusionQuery(const Handle(OpenGl_Context) &
- theCtx)
- : aCtx(theCtx) {
- aCtx->core15->glGenQueries(1, &queryID);
+OpenGl_OcclusionQuery::OpenGl_OcclusionQuery(): myID(0), inUse(false), started(false)
+{
}
// =======================================================================
// function :
// purpose :
// =======================================================================
-Standard_EXPORT OpenGl_OcclusionQuery::~OpenGl_OcclusionQuery() {
- aCtx->core15->glDeleteQueries(1, &queryID);
- queryID = 0;
+OpenGl_OcclusionQuery::~OpenGl_OcclusionQuery()
+{
+ Release(NULL);
}
-
// =======================================================================
-// function : BeginQuery()
+// function : Create()
+// purpose :
+// =======================================================================
+void OpenGl_OcclusionQuery::Create(const Handle(OpenGl_Context) & theCtx,
+ GLenum theQueryType) {
+ theCtx->core15->glGenQueries(1, &myID);
+ myType = theQueryType;
+ inUse = false;
+ started = false;
+}
+// =======================================================================
+// function : Begin()
+// purpose :
+// =======================================================================
+void OpenGl_OcclusionQuery::Begin(const Handle(OpenGl_Context) & theCtx)
+{
+ inUse = true;
+ started = true;
+ theCtx->core15->glBeginQuery(myType, myID);
+}
+
+// =======================================================================
+// function : End()
// purpose :
// =======================================================================
-Standard_EXPORT void OpenGl_OcclusionQuery::BeginQuery() const {
- aCtx->core15->glBeginQuery(GL_SAMPLES_PASSED, queryID);
+void OpenGl_OcclusionQuery::End(const Handle(OpenGl_Context) & theCtx) const
+{
+ theCtx->core15->glEndQuery(myType);
}
// =======================================================================
-// function : EndQuery()
+// function : isResultsReady()
// purpose :
// =======================================================================
-Standard_EXPORT void OpenGl_OcclusionQuery::EndQuery() {
- aCtx->core15->glEndQuery(GL_SAMPLES_PASSED);
- aCtx->core15->glGetQueryObjectiv(queryID, GL_QUERY_RESULT, &samplesPassed);
+int OpenGl_OcclusionQuery::IsResultsReady(const Handle(OpenGl_Context) & theCtx) const
+{
+ // check if the query started before check for results
+ if(!started)
+ return false;
+
+ GLint aReady = 0;
+ theCtx->core15->glGetQueryObjectiv(myID, GL_QUERY_RESULT_AVAILABLE, &aReady);
+ return aReady;
+ }
+
+// =======================================================================
+// function : GetResults()
+// purpose :
+// =======================================================================
+int OpenGl_OcclusionQuery::GetResults(const Handle(OpenGl_Context) & theCtx)
+{
+ inUse = false;
+ GLint aResult;
+ theCtx->core15->glGetQueryObjectiv(myID, GL_QUERY_RESULT, &aResult);
+ return aResult;
}
+
+// =======================================================================
+// function : Release()
+// purpose : Destroy the query opengl resources
+// =======================================================================
+void OpenGl_OcclusionQuery::Release(OpenGl_Context *theCtx) {
+ if (myID == 0)
+ return;
+ if (theCtx != NULL) {
+ theCtx->core15->glDeleteQueries(1, &myID);
+ myID = 0;
+ started = false;
+ }
+}
\ No newline at end of file
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#ifndef OpenGl_View_HeaderFile
-#define OpenGl_View_HeaderFile
+#ifndef OpenGl_OcclusionQuery_HeaderFile
+#define OpenGl_OcclusionQuery_HeaderFile
-#include <Graphic3d_OcclusionQuery.hxx>
+#include <OpenGl_Resource.hxx>
+#include <OpenGl_GlCore15.hxx>
class OpenGl_Context;
-DEFINE_STANDARD_HANDLE(OpenGl_OcclusionQuery, Graphic3d_OcclusionQuery)
+DEFINE_STANDARD_HANDLE(OpenGl_OcclusionQuery, OpenGl_Resource)
//! Implementation of OpenGl view.
-class OpenGl_OcclusionQuery : public Graphic3d_OcclusionQuery {
-
+class OpenGl_OcclusionQuery : public OpenGl_Resource {
public:
+ DEFINE_STANDARD_RTTIEXT(OpenGl_OcclusionQuery, OpenGl_Resource)
+
//! Constructor.
- Standard_EXPORT OpenGl_OcclusionQuery(const Handle(OpenGl_Context) & theCtx);
+ Standard_EXPORT OpenGl_OcclusionQuery();
//! Default destructor.
Standard_EXPORT virtual ~OpenGl_OcclusionQuery();
+
+ //! Create the occlusion test Gl resources.
+ Standard_EXPORT virtual void Create(const Handle(OpenGl_Context)& theCtx, GLenum theType);
//! Begins occlusion query.
- Standard_EXPORT virtual void BeginQuery() const Standard_OVERRIDE;
+ Standard_EXPORT virtual void Begin(const Handle(OpenGl_Context) & theCtx);
- //! Ends occlusion query and caches the result
- Standard_EXPORT virtual void EndQuery() Standard_OVERRIDE;
+ //! Ends occlusion query
+ Standard_EXPORT virtual void End(const Handle(OpenGl_Context) & theCtx) const;
-public:
- DEFINE_STANDARD_ALLOC
- DEFINE_STANDARD_RTTIEXT(OpenGl_OcclusionQuery,
- Graphic3d_OcclusionQuery) // Type definition
+ //! Check if the query results ready for retrive or not.
+ Standard_EXPORT virtual int IsResultsReady(const Handle(OpenGl_Context) & theCtx) const;
+
+ //! Return the query results based on query type.
+ Standard_EXPORT virtual int GetResults(const Handle(OpenGl_Context) & theCtx);
+
+ //! Return is the query in use or not
+ Standard_EXPORT bool IsInUse() { return inUse; }
+
+ //! Return Query ID
+ Standard_EXPORT unsigned int GetID() const {return myID;};
+
+ //! Destroys query object.
+ Standard_EXPORT virtual void Release (OpenGl_Context * theCtx) Standard_OVERRIDE;
+
+ //! Returns estimated GPU memory usage - not implemented.
+ virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
private:
- const Handle(OpenGl_Context) & aCtx;
+ GLuint myID; //!< OpenGL query ID.
+ GLenum myType; //!< OpenGL query Type.
+ bool inUse; //!< store bool answer is the query still inprogress or finished.
+ bool started; //!< bool answer is the query stated before or this the first time.
};
-#endif // _OpenGl_View_Header
+#endif // _OpenGl_OcclusionQuery_Header
myInstancedStructure (NULL),
myIsRaytracable (Standard_False),
myModificationState (0),
- myIsMirrored (Standard_False)
+ myIsMirrored (Standard_False),
+ myQuery(new OpenGl_OcclusionQuery())
{
updateLayerTransformation();
}
aCtx->ApplyModelViewMatrix();
renderBoundingBox(theWorkspace);
}
+// =======================================================================
+// function : OcclusionTest
+// purpose :
+// =======================================================================
+void OpenGl_Structure::UpdateOcclusion(const Handle(OpenGl_Workspace)& theWorkspace) const
+{
+ const Handle(OpenGl_Context) &aCtx = theWorkspace->GetGlContext();
+ if (myQuery->GetID()==0)
+ myQuery->Create(aCtx, GL_ANY_SAMPLES_PASSED);
+
+ if(myQuery->IsResultsReady(aCtx))
+ {
+ int aResult = myQuery->GetResults(aCtx);
+ const Standard_Integer aViewId = theWorkspace->View()->Identification();
+ if (aResult<=0)
+ SetOccluionSate(aViewId, Standard_False);
+ else
+ SetOccluionSate(aViewId, Standard_True);
+ }
+
+ if(!myQuery->IsInUse())
+ {
+ myQuery->Begin(aCtx);
+ RenderOccluder(theWorkspace);
+ myQuery->End(aCtx);
+ }
+}
// =======================================================================
// function : Release
{
aGroupIter.ChangeValue()->Release (theGlCtx);
}
+
+ myQuery->Release(theGlCtx.get());
}
//=======================================================================
#include <OpenGl_GraphicDriver.hxx>
#include <OpenGl_Group.hxx>
#include <OpenGl_Workspace.hxx>
+#include <OpenGl_OcclusionQuery.hxx>
#include <NCollection_List.hxx>
//! Renders the structure.
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
- //! Render Occluder presenation of this structure
+ //! Renders occluder presenation of the structure
Standard_EXPORT void RenderOccluder(const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+ //! Peforms occlusion test for the strcuture
+ Standard_EXPORT void UpdateOcclusion(const Handle(OpenGl_Workspace)& theWorkspace) const;
//! Releases structure resources.
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
protected:
OpenGl_Structure* myInstancedStructure;
- Graphic3d_Mat4 myRenderTrsf; //!< transformation, actually used for rendering (includes Local Origin shift)
+ Graphic3d_Mat4 myRenderTrsf; //!< transformation, actually used for rendering (includes Local Origin shift)
mutable Standard_Boolean myIsRaytracable;
mutable Standard_Size myModificationState;
- Standard_Boolean myIsMirrored; //!< Used to tell OpenGl to interpret polygons in clockwise order.
+ Standard_Boolean myIsMirrored; //!< Used to tell OpenGl to interpret polygons in clockwise order.
+
+ Handle(OpenGl_OcclusionQuery) myQuery; //! test the occlusion status of the structure;
};
//function : updateOcclusionState
//purpose :
//=======================================================================
-void OpenGl_View::updateOcclusion(OpenGl_FrameBuffer* theReadDrawFbo,
- OpenGl_FrameBuffer* theOitAccumFbo,
- const Standard_Boolean theToDrawImmediate)
+void OpenGl_View::UpdateOcclusion()
{
- myZLayers.UpdateOcclusion(myWorkspace, theToDrawImmediate,theReadDrawFbo, theOitAccumFbo);
+ myZLayers.UpdateOcclusion(myWorkspace);
// re-validate occlusion results
myRenderParams.OcculsionQueryState = Graphic3d_RenderingParams::OcculsionQuery_On;
// update occlusion here after update culling to ensure the frusrum culling updated
if (myRenderParams.OcculsionQueryState == Graphic3d_RenderingParams::OcculsionQuery_NoUpdate)
- updateOcclusion(theReadDrawFbo, theOitAccumFbo, theToDrawImmediate);
+ UpdateOcclusion();
Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
Standard_Boolean toRenderGL = theToDrawImmediate ||
//! Returns additional buffers for depth peeling OIT.
const Handle(OpenGl_DepthPeeling)& DepthPeelingFbos() const { return myDepthPeelingFbos; }
+ //! Perform occlusion test for the set of structures presented in the view
+ Standard_EXPORT virtual void UpdateOcclusion() Standard_OVERRIDE;
+
public:
//! Returns gradient background fill colors.
Standard_EXPORT virtual void drawBackground (const Handle(OpenGl_Workspace)& theWorkspace,
Graphic3d_Camera::Projection theProjection);
- //! Update occlusion state for the set of structures presented in the view
- //! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
- //! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
- //! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
- Standard_EXPORT virtual void updateOcclusion(OpenGl_FrameBuffer* theReadDrawFbo,
- OpenGl_FrameBuffer* theOitAccumFbo,
- const Standard_Boolean theToDrawImmediate);
-
//! Render set of structures presented in the view.
//! @param theProjection [in] the projection that is used for rendering.
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
Handle(V3d_View) aView = ViewerTest_myViews.Find1(anIter.Value());
aView->ChangeRenderingParams().OcculsionQueryState = Graphic3d_RenderingParams::OcculsionQuery_NoUpdate;
aView->Redraw();
-
+ aView->View()->UpdateOcclusion();
Graphic3d_MapOfStructure aOcculdedStructs;
aView->View()->OccludedStructures(aOcculdedStructs);
- printf("No Occluded Objects in view id: %d --> %d\n",
+ printf("Occluded objects in view: %d = %d\n",
aView->View()->Identification(), aOcculdedStructs.Extent());
}
# check left side
vinit name=View1
vsetdispmode 1
-vdisplay b c
+vdisplay c b
vright
vfit
vzoom 0.5
# check front side
vinit name=View2
vsetdispmode 1
-vdisplay b c
+vdisplay c b
vfront
vfit