32 #include <matrix/vlTaitBryan.h>
34 #include <osg/Drawable>
35 #include <osg/Uniform>
36 #include <osg/StateSet>
37 #include <osg/OperationThread>
38 #include <osgSim/MultiSwitch>
40 #include <tbb/concurrent_queue.h>
44 #include <unordered_map>
45 #include <unordered_set>
60 class DtIndirectGeometryRegistrar;
61 class DtCullShaderConfig;
64 class DtOsgCullVisitorParameters;
66 class DtIndirectGeometryInitMainThreadJob;
67 class DtIndirectGeometryUpdateBuffersMainThreadJob;
68 class DtVirtualProgramCache;
70 class DtIndirectDrawComponent;
71 class DtIndirectDefaultDrawComponent;
72 class DtIndirectLightPointDrawComponent;
73 class DtIndirectDebugCullComponent;
75 class DtIndirectSwitchManager;
76 class DtIndirectDofManager;
77 class DtIndirectLodManager;
78 class DtIndirectUvOffsetManager;
79 class DtIndirectPerInstanceDataManager;
80 class DtIndirectShaderConstants;
81 class DtOsgLightPointManager;
83 class DtIndirectVaoManager;
85 class DtCoordinateSystem;
141 virtual void setName(
const std::string& name)
override;
156 virtual const char* className()
const;
161 virtual void drawImplementation(osg::RenderInfo& renderInfo)
const;
164 virtual unsigned int rebuildRegistrar(osg::RenderInfo& renderInfo)
const;
178 virtual int addInstance(
int modelId,
const osg::Matrixd& xForm,
float modelScale,
float modelRadius,
int lightPointGroupId);
183 virtual void accept(osg::NodeVisitor& nv);
186 virtual void setParent(
const osg::Group* parent);
193 virtual void setRegistrarInvalid(
void);
196 virtual void releaseGLObjects(osg::State* state)
const;
199 virtual void accept(osg::PrimitiveFunctor& functor)
const;
204 virtual void setupIndirect();
208 virtual void setupIndirectShadersOnly();
212 virtual const osg::Geode* parentGeode(
void)
const;
213 virtual osg::Geode* parentGeode(
void);
219 virtual void setLocalOriginTransform(
const osg::Matrixd& localOriginTransform);
224 virtual const osg::Matrixd& localOriginTransform()
const;
227 virtual bool actuallyAddQueuedUpInstances(
void);
233 virtual boost::condition_variable& waitCondition();
236 virtual void updateGpuBuffers(osg::RenderInfo& renderInfo);
246 virtual void perCameraUpdateAndCull(osg::RenderInfo& renderInfo,
const osg::Camera* camera,
const osg::Matrix& modelViewMatrix,
const osg::FrameStamp* frameStamp);
249 virtual void fillViewParameters(
DtIndirectViewParameters& destViewParameters,
const osg::Matrix& modelViewMatrix,
const osg::Camera* camera, osg::RenderInfo& renderInfo)
const;
257 virtual void setUpdateBuffersJobsRequiredCurrentFrame(
bool requiredCurrentFrame);
264 virtual bool updateBuffersJobsRequiredCurrentFrame(
void)
const;
268 virtual bool readyToRender(
const int instanceIdInIndirect)
const;
274 virtual bool instanceEverAdded(
void)
const;
278 virtual int numValidInstances(
void)
const;
282 static void setTrackObjects(
bool val);
284 static bool trackObjects(
void);
288 static int numIndirectGeometries(
void);
298 virtual void setupShadersIfNecessary();
302 virtual void setupDebugUniforms();
306 virtual void installDefaultMaterial(osg::StateSet* ss);
309 virtual void slot_reloadShaders();
314 virtual void updateIndicesCount(
const DtIndirectModelInfo& modelInfo,
int instanceContainerIndex);
317 virtual void updateModelIdsToInstances(
int modelId,
int instanceId,
bool add);
320 virtual void drawFromCommandBuffer(osg::RenderInfo& renderInfo,
const DtIndirectViewParameters& viewParameters,
const osg::Camera* camera)
const;
345 virtual void updateInstanceVisibilityLightPointMaxDistanceActual(
const DtIndirectGeometryInstance& instance,
int outInstanceIndex);
355 virtual void reloadShadersIfNecessary(
void)
const;
360 virtual void update(
const osg::FrameStamp* frameStamp);
363 virtual void adjustDofConstraintsIfNecessary(osgSim::DOFTransform* clone);
370 virtual bool hasLightPoints(
void)
const;
373 virtual bool hasDepthOnly(
void)
const;
376 virtual bool isDepthOnly(
int stateId)
const;
379 virtual void debugDrawIfNecessary(osg::RenderInfo& renderInfo,
const int maxCommands,
const osg::Camera* camera);
382 virtual void deleteDrawComponents(
void);
385 virtual void initDrawComponents(
void);
393 virtual void setPureSignalBasedUpdates(
bool val);
396 virtual void initializeUbosIfNecessary(osg::RenderInfo& renderInfo)
const;
399 virtual void slot_coordinateSystemChanged();
511 mutable int myGpuShaderUboBinding = -1;
unsigned int myNumTextCoordArrays
Definition: DtIndirectGeometry.h:424
boost::condition_variable myWaitCondition
Definition: DtIndirectGeometry.h:470
Contains the DtCullShaderConfig class declaration.
MapIntToInt myInstancesToModelIds
Definition: DtIndirectGeometry.h:413
DtIndirectFadeParameters myFadeParameters
Definition: DtIndirectGeometry.h:482
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:87
non virtual container class for holding the information needed to create an indirect geometry instanc...
Definition: DtIndirectGeometryInstance.h:26
int myId
a unique id for the geometry
Definition: DtIndirectGeometry.h:443
osg::ref_ptr< osg::StateSet > myDepthOnlyDrawStateSet
Definition: DtIndirectGeometry.h:498
structure to count total number of DtIndirectGeometrys in the system
Definition: DtIndirectGeometry.h:527
static TotalCounter theTotalCounter
Definition: DtIndirectGeometry.h:537
std::unordered_map< int, int > MapIndirectIdToInstanceContainerId
Map of instances' id in indirect geometry to their id in the instance container.
Definition: DtIndirectGeometry.h:464
DtIndirectPerInstanceDataManager * myPerInstanceDataManager
Definition: DtIndirectGeometry.h:452
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
handles the switches for all the indirect geometry. Sets up the default state of osg::Switch, osgSim::MultiSwitch, and DtDynamicTerrainSwitchNode. Connects to a signal for the DtDynamicTerrainSwitchNode so it can update the indirect buffer when a switch changes. saves off the node path hash for every switch path that is added. Owned by a DtIndirectGeometry 1:1 This manager's switches get updated per frame via looking at the actual switches/multi-switches
Definition: DtIndirectSwitchManager.h:70
Definition: DtIndirectDebugCullComponent.h:45
DtIndirectLodManager * myLodManager
Definition: DtIndirectGeometry.h:450
This class is a component of the DtIndirectGeometry It inputs are: -> the instances registered with Dt...
Definition: DtGpuCulling.h:82
bool myLastMissingTextureColorOn
Definition: DtIndirectGeometry.h:437
unsigned int myMutableLastRegistrarRebuildNumber
Definition: DtIndirectGeometry.h:454
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:106
DtIndirectLightPointDrawComponent * myLightPointDrawComponent
Definition: DtIndirectGeometry.h:488
std::atomic< int > myRunningInstanceId
Definition: DtIndirectGeometry.h:485
osg::Matrixd myLocalOriginTransformMatrix
Definition: DtIndirectGeometry.h:428
DtOsgLightPointManager & myLightPointManager
Definition: DtIndirectGeometry.h:514
Contains makVrv::DtIndirectModelScalingAlgorithm enumeration.
Contains the DtIndirectGeometryUpdateBuffersMainThreadJob class declaration.
bool myUpdateBuffersJobsRequiredCurrentFrame
whether gpu buffers for instances are updated immediately
Definition: DtIndirectGeometry.h:501
std::atomic< int > myCount
Definition: DtIndirectGeometry.h:535
shader configuration storage class. Has 3 available options which are described in the constructor's ...
Definition: DtCullShaderConfig.h:21
DtOsgLightPointManager registers LightPoint nodes so their TBO can be created and updated in a single...
Definition: DtOsgLightPointManager.h:106
Contains the DtIndirectGeometryUpdateMainThreadJob class declaration.
std::map< int, int > MapIntToInt
Definition: DtCommonTypes.h:25
osg::ref_ptr< DtIndirectGeometryUpdateBuffersMainThreadJob > myMainThreadUpdateBuffersJob
Definition: DtIndirectGeometry.h:479
handles the lods for all the indirect geometry. sets up and runs a compute shader prepass for process...
Definition: DtIndirectLodManager.h:53
osg::ref_ptr< DtIndirectGeometryRegistrar > myRegistrar
pointer to the (external) registrar
Definition: DtIndirectGeometry.h:404
unsigned int myLastFrameUpdateTraversed
Definition: DtIndirectGeometry.h:503
DtSignalConnectionManager myConnections
Definition: DtIndirectGeometry.h:426
osg::ref_ptr< osg::StateSet > myLightPointDrawStateSet
Definition: DtIndirectGeometry.h:495
DtDe & myDe
Definition: DtIndirectGeometry.h:516
osg::ref_ptr< DtIndirectGeometryInitMainThreadJob > myMainThreadInitJob
Definition: DtIndirectGeometry.h:478
bool myMutableOutputInstancesBuffersChanged
Internal variable that tracks whether the output instance buffers via the culling got changed (resize...
Definition: DtIndirectGeometry.h:508
const char * creatorTypeName< DtIndirectGeometry >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectGeometry.h:95
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
DtIndirectGeometryInstance, which holds information for creating an indirect geometry instance...
DtGpuCulling * myGpuCulling
Definition: DtIndirectGeometry.h:409
static bool theTrackObjects
Definition: DtIndirectGeometry.h:524
friend DtIndirectGeometryCreator
Definition: DtIndirectGeometry.h:118
DtIndirectDebugCullComponent * myIndirectDebugCullComponent
Definition: DtIndirectGeometry.h:489
\ ::, which allows us to hook into our indirect engine to render using indirect rendering...
Definition: DtIndirectGeometry.h:115
MapIntToInt myModelIDsToInstances
Definition: DtIndirectGeometry.h:411
const osg::Camera * myLastCamera
Definition: DtIndirectGeometry.h:468
Contains the DtIndirectGeometryInitMainThreadJob class declaration.
unsigned int myLastFrameUpdated
Definition: DtIndirectGeometry.h:467
MapIndirectIdToInstanceContainerId myMapIndirectIdToInstanceContainerId
Definition: DtIndirectGeometry.h:465
handles the dof nodes for all the indirect geometry. Sets up the default state of osg::Dof...
Definition: DtIndirectDofManager.h:64
DtIndirectVaoManager & myVaoManager
This is de-referenced here for speed.
Definition: DtIndirectGeometry.h:440
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
The osg cull vistor parameters class provides additional culling and intersector parameters for choos...
Definition: DtOsgCullVisitorParameters.h:42
bool myLastDebugIndirectColorOn
Definition: DtIndirectGeometry.h:435
'super' class for managing the per gc vao for all indirect geometries There is only one vao per gl co...
Definition: DtIndirectVaoManager.h:35
boost::mutex myInternalsMutex
Definition: DtIndirectGeometry.h:476
const bool myManagesIndividualInstances
Definition: DtIndirectGeometry.h:417
struct for holding the fade parameters used by the indirect rendering cull compute shader ...
Definition: DtIndirectFadeParameters.h:17
std::map< int, int > myInstanceContainerIdToNumIndices
Definition: DtIndirectGeometry.h:433
int myNumIndicesAcrossAllModels
number of indices across all unique models across instances
Definition: DtIndirectGeometry.h:432
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
responsible for initializing the indirect buffers in the main thread
Definition: DtIndirectGeometryInitMainThreadJob.h:42
bool myLastColorizePerDrawableEnabled
Definition: DtIndirectGeometry.h:436
DtIndirectSwitchManager * mySwitchManager
Definition: DtIndirectGeometry.h:448
A generic OpenGL buffer. This can be: -> a vertex buffer -> an index buffer -> a shader storage buffe...
Definition: DtGlBuffer.h:29
tbb::concurrent_queue< DtIndirectGeometryInstance > myQueueInstancesToAdd
addInstance may be called from multiple threads. Hence, concurrent queue
Definition: DtIndirectGeometry.h:407
Contains makVrv::DtIndirectAnnotationAndUvOffset class.
DtIndirectUvOffsetManager * myUvOffsetManager
Definition: DtIndirectGeometry.h:451
bool myMutableShadersSetup
Definition: DtIndirectGeometry.h:457
The class that is used to communicate the camera viewing parameters to the DtICullingAndLOD interface...
Definition: DtIndirectViewParameters.h:26
osg::ref_ptr< DtIndirectGeometryUpdateMainThreadJob > myMainThreadUpdateJob
Definition: DtIndirectGeometry.h:480
Base class to provide boost signal/slot management.
DtVirtualBaseClassCreator< DtIndirectGeometry, const DtCullShaderConfig &, const bool &, const bool & > DtIndirectGeometryCreator
creator
Definition: DtIndirectGeometry.h:88
handles the uv offsets for all the indirect geometry. Sets up the default state of the uv offset...
Definition: DtIndirectUvOffsetManager.h:49
unsigned int myMutableLastFrameTexturesUpdated
Definition: DtIndirectGeometry.h:455
DtInstanceContainer myInstanceContainer
container for all the instances registered here
Definition: DtIndirectGeometry.h:446
handles data that is specified per instance. Currently only the blend color from the DtOsgArticulated...
Definition: DtIndirectPerInstanceDataManager.h:59
osg::ref_ptr< osg::StateSet > myDefaultDrawStateSet
Definition: DtIndirectGeometry.h:492
Contains DLL export macros.
bool myMutableShouldReloadShaders
FIXME should be a static but currently the cull shader is per indirect.
Definition: DtIndirectGeometry.h:460
DtIndirectEffectTexturesTemplate myEffectTexturesState
the accumulated effect textures' state which represents the superset of all effect textures cumulativ...
Definition: DtIndirectGeometry.h:423
Interface class to manage/configure drawing of a subset of rendering components within an indirect ge...
Definition: DtIndirectDrawComponent.h:32
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
class to draw a subset of items of an indirect geometry (everything except light points), the default way
Definition: DtIndirectDefaultDrawComponent.h:36
Helper class to manage instances This class allows you to add a DtInstance_64 Internally, however it stores this as a DtInstance (which the GPU can directly read)
Definition: DtInstanceContainer.h:31
boost::mutex myWaitMutex
Definition: DtIndirectGeometry.h:471
Definition: DtIndirectShaderConstants.h:42
const bool myIsTerrainPatch
Definition: DtIndirectGeometry.h:415
Contains the DtIndirectGeometryRegistrar class declaration.
Contains makVrv::DtIndirectViewParameters class.
Contains makVrv::DtInstanceContainer.
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:40
DtIndirectDefaultDrawComponent * myDefaultDrawComponent
Definition: DtIndirectGeometry.h:487
Contains the per Model info which the indirect module needs It is owned by the Indirect geometry regi...
Definition: DtIndirectModelInfo.h:44
DtIndirectDofManager * myDofManager
Definition: DtIndirectGeometry.h:449
Contains makVrv::DtIndirectFadeParameters class.
class to draw a subset of light points of an indirect geometry
Definition: DtIndirectLightPointDrawComponent.h:49