17 #include <matrix/vlVector.h>
19 #include <osgUtil/LineSegmentIntersector>
21 #include <osg/ref_ptr>
22 #include <osg/LightSource>
24 #include <boost/unordered_map.hpp>
44 class DtGLTextureBufferObject;
45 class DtInstanceProcessor;
46 class DtOsgIntersectorResult;
47 class DtChannelManager;
49 class DtPerViewUniformCallback;
52 class DtOsgCullVisitorParameters;
53 class DtViewSpecificGroup;
62 typedef std::vector<osg::ref_ptr<osg::Geometry> >
GeometryVec;
65 typedef std::map<osg::ref_ptr< osgEarth::VirtualProgram >, osg::ref_ptr<osgEarth::VirtualProgram> >
VpMap;
66 typedef std::vector<osg::ref_ptr<osgEarth::VirtualProgram> >
VpRefList;
73 static const unsigned int NumVec4PerInstance = 8;
220 typedef std::vector<InstancedLod*>
LodVec;
278 bool intersect(
const osg::Vec3d& start,
const osg::Vec3d& end,
280 std::list<DtUniqueID>* ignoreList=0);
283 bool intersect(
const osg::Vec3d& start,
const osg::Vec3d& end,
284 std::vector<DtOsgIntersectorResult>& results,
285 std::list<DtUniqueID>* ignoreList=0);
292 void setSequenceSpeed(
DtInstanceState& instance,
unsigned int sequenceIndex,
float speed);
295 void setSequencePlayTime(
DtInstanceState& instance,
unsigned int sequenceIndex,
float loopTime);
308 void setDofAnimation(osg::Vec3f& hpr, osg::Vec3f hprVel,
DtInstanceState& state,
unsigned int partIndex);
311 void setDofTranslation(osg::Vec3f& trans, osg::Vec3f& transVel,
DtInstanceState& state,
unsigned int partIndex);
316 void setSwitchState(
DtInstanceState& instance,
unsigned int partIndex,
unsigned int childIndex,
bool state);
321 void setUVOffset(
DtUniqueID id,
unsigned int drawableIx, osg::Vec2f uvOffset);
326 void setUserDefined(
DtUniqueID id,
float userDefined);
344 virtual void reset();
347 virtual osg::Node* instanceRoot();
350 bool isRegistered(
const std::string& modelType);
353 void registerModel(
const std::string& modelType,
GeometryVec& drawables,
LodVec& lods,
356 unsigned int nodeMask, osg::ref_ptr<osg::StateSet> rootNodeSS,
bool daylightControlledLights =
false);
359 osg::Geode *setupModelGeode(
const std::string& modelType,
unsigned int nodeMask);
362 void allocateImage( osg::View* view );
371 bool newInstance(
const std::string& modelType,
DtUniqueID id,
DtElementID elementId, osg::Node* rootNode);
455 inline osg::View*
lastView() {
return myLastView; }
458 inline unsigned int drawableIndex(
unsigned int instanceIx);
461 void reloadShaders();
466 virtual bool isDaylight();
548 double l, r, b,
t, n, f;
557 osgUtil::LineSegmentIntersector::Intersection
result;
570 unsigned int nodeMask,
bool suppressLastUpdateTime =
false);
573 void registerGeometry(
unsigned int templateIx, osg::Geometry* geometry,
VpMap& vpMap);
576 float computeDistanceToEye(
const Eyepoint& eye,
const osg::Vec3d& pos)
const;
579 void allocateRenderList();
582 unsigned int updateBuffers( osg::View* view,
DtGLTextureBufferObject* tbo,
const ArrayRange& drawableRange,
unsigned int bufferOffset, osg::Vec4* bufferStorage );
587 unsigned int updateRenderList(
const Eyepoint& eye,
const Frustum& frustum,
const osg::Matrixd& viewMat,
unsigned int nodeMask);
592 void allocateInstanceData();
597 unsigned int fillRenderList(
unsigned visibleSetStride,
unsigned int instanceOffset,
unsigned int numInstances );
600 void cullRange(
const Eyepoint& eye,
unsigned int instanceOffset,
unsigned int instanceCount,
601 std::vector<osg::Vec4d>& planes,
bool useScale,
unsigned int nodeMask );
610 void createHitList(
const osg::Vec3d& end,
const osg::Vec3d& start, std::vector<InstancingHit>& hitList);
613 void loadInstanceShaders(osg::ref_ptr<osgEarth::VirtualProgram> vp);
616 const std::list<DtUniqueID>& ignoreList);
721 virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo)
const
749 typedef boost::unordered_map<osg::View*, osg::ref_ptr<DtViewSpecificGroup> >
ViewToGroup;
753 typedef boost::unordered_map<osg::Geometry*, osg::ref_ptr<DtPerViewUniformCallback> >
GeometryToCallback;