23 #include <osgViewer/CompositeViewer>
25 #include <osgEarth/VirtualProgram>
27 #include <boost/unordered_map.hpp>
28 #include <boost/signals.hpp>
41 class DtGLTextureBufferObject;
42 class DtInstanceProcessor;
43 class DtOsgIntersectorResult;
44 class DtChannelManager;
46 class DtPerViewUniformCallback;
57 typedef std::vector<osg::ref_ptr<osg::Geometry> >
GeometryVec;
60 typedef std::map<osg::ref_ptr< osgEarth::VirtualProgram >, osg::ref_ptr<osgEarth::VirtualProgram> >
VpMap;
61 typedef std::vector<osg::ref_ptr<osgEarth::VirtualProgram> >
VpRefList;
67 static const unsigned int NumVec4PerInstance = 8;
211 typedef std::vector<InstancedLod*>
LodVec;
260 bool intersect(
const osg::Vec3d& start,
const osg::Vec3d& end, std::vector<DtOsgIntersectorResult>& results);
267 void setSequenceSpeed(
DtInstanceState& instance,
unsigned int sequenceIndex,
float speed);
270 void setSequencePlayTime(
DtInstanceState& instance,
unsigned int sequenceIndex,
float loopTime);
283 void setDofAnimation(osg::Vec3f& hpr, osg::Vec3f hprVel,
DtInstanceState& state,
unsigned int partIndex);
286 void setDofTranslation(osg::Vec3f& trans,
DtInstanceState& state,
unsigned int partIndex);
291 void setSwitchState(
DtInstanceState& instance,
unsigned int partIndex,
unsigned int childIndex,
bool state);
296 void setUVOffset(
DtUniqueID id,
unsigned int drawableIx, osg::Vec2f uvOffset);
301 void setUserDefined(
DtUniqueID id,
float userDefined);
316 virtual void reset();
319 virtual osg::Node* instanceRoot();
322 bool isRegistered(
const std::string& modelType);
325 void registerModel(
const std::string& modelType,
GeometryVec& drawables,
LodVec& lods,
328 unsigned int nodeMask, osg::ref_ptr<osg::StateSet> rootNodeSS);
331 void setupModelGeode(
const std::string& modelType,
unsigned int nodeMask);
334 void allocateImage( osg::View* view );
427 inline osg::View*
lastView() {
return myLastView; }
430 inline unsigned int drawableIndex(
unsigned int instanceIx);
433 void reloadShaders();
439 BoolVec myVisibleSet;
514 double l, r, b,
t, n, f;
523 osgUtil::LineSegmentIntersector::Intersection
result;
535 void registerGeometry(
const std::string& modelType, osg::Geometry* geometry,
VpMap& vpMap);
538 float computeDistanceToEye(
const Eyepoint& eye,
const osg::Vec3d& pos)
const;
541 void allocateRenderList();
544 unsigned int updateBuffers( osg::View* view,
DtGLTextureBufferObject* tbo,
const ArrayRange& drawableRange,
unsigned int bufferOffset, osg::Vec4* bufferStorage );
549 unsigned int updateRenderList(
const Eyepoint& eye,
const Frustum& frustum,
const osg::Matrixd& viewMat,
unsigned int nodeMask);
554 void allocateInstanceData();
559 unsigned int fillRenderList(
unsigned visibleSetStride,
unsigned int instanceOffset,
unsigned int numInstances );
562 void cullRange(
const Eyepoint& eye,
unsigned int instanceOffset,
unsigned int instanceCount,
563 std::vector<osg::Vec4d>& planes,
bool useScale,
unsigned int nodeMask );
572 void createHitList(
const osg::Vec3d& end,
const osg::Vec3d& start, std::vector<InstancingHit>& hitList);
575 void loadInstanceShaders(osg::ref_ptr<osgEarth::VirtualProgram> vp);
685 virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo)
const
713 typedef boost::unordered_map<osg::View*, osg::ref_ptr<DtViewSpecificGroup> >
ViewToGroup;
717 typedef boost::unordered_map<osg::Geometry*, osg::ref_ptr<DtPerViewUniformCallback> >
GeometryToCallback;