Renamed the ConvexPlaner* classes to ConvexPlanar* and changed all the various
classes that reference it. Added MUST_READ_ME.txt to the VisualStudio directory.
This commit is contained in:
parent
4e45c82067
commit
79aaac4e0c
18
VisualStudio/MUST_READ_ME.txt
Normal file
18
VisualStudio/MUST_READ_ME.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
IMPORTANT NOTE: Whilst the OSG will compile cleanly with the basic VC++6.0
|
||||||
|
and its own STL implementation, the OSG will crash regularily due to bugs
|
||||||
|
in VC++6.0's STL. VC++6.0's STL is horribly broken and therefore is *NOT*
|
||||||
|
supported. Do not attempt to use the OSG in conjunction with native VC++6.0
|
||||||
|
STL implemention.
|
||||||
|
|
||||||
|
The supported combinations are:
|
||||||
|
|
||||||
|
1.Visual Studio7.0 .NET
|
||||||
|
2.Visual Studio6.0 + Dinkumware's STL bug fix patches
|
||||||
|
3.Visual Studio6.0 + STLport
|
||||||
|
|
||||||
|
For details on how to patch VisualStudio6.0 read the doc/install.html
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
Several of the plugins and demoes, and two of the core libraries - osgText
|
||||||
|
and osgGLUT require external dependancies. Full details on where to obtain
|
||||||
|
these can be found in doc/dependancies.html.
|
@ -141,11 +141,11 @@ SOURCE=..\..\src\osg\CollectOccludersVisitor.cpp
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\src\osg\ConvexPlanerOccluder.cpp
|
SOURCE=..\..\src\osg\ConvexPlanarOccluder.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\src\osg\ConvexPlanerPolygon.cpp
|
SOURCE=..\..\src\osg\ConvexPlanarPolygon.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
@ -469,11 +469,11 @@ SOURCE=..\..\Include\Osg\ClipPlane
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\Include\Osg\ConvexPlanerOccluder
|
SOURCE=..\..\Include\Osg\ConvexPlanarOccluder
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\Include\Osg\ConvexPlanerPolygon
|
SOURCE=..\..\Include\Osg\ConvexPlanarPolygon
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ SOURCE=..\..\..\src\osgPlugins\osg\ColorMatrix.cpp
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\src\osgPlugins\osg\ConvexPlanerOccluder.cpp
|
SOURCE=..\..\..\src\osgPlugins\osg\ConvexPlanarOccluder.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
||||||
//as published by the Free Software Foundation.
|
//as published by the Free Software Foundation.
|
||||||
|
|
||||||
#ifndef OSG_CONVEXPLANEROCCLUDER
|
#ifndef OSG_CONVEXPLANAROCCLUDER
|
||||||
#define OSG_CONVEXPLANEROCCLUDER 1
|
#define OSG_CONVEXPLANAROCCLUDER 1
|
||||||
|
|
||||||
#include <osg/ConvexPlanerPolygon>
|
#include <osg/ConvexPlanarPolygon>
|
||||||
#include <osg/Object>
|
#include <osg/Object>
|
||||||
|
|
||||||
namespace osg {
|
namespace osg {
|
||||||
@ -14,30 +14,30 @@ class OccluderVolume;
|
|||||||
|
|
||||||
/** A class for representing convex clipping volumes made up.
|
/** A class for representing convex clipping volumes made up.
|
||||||
* When adding planes, their normals should point inwards (into the volume) */
|
* When adding planes, their normals should point inwards (into the volume) */
|
||||||
class SG_EXPORT ConvexPlanerOccluder : public Object
|
class SG_EXPORT ConvexPlanarOccluder : public Object
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConvexPlanerOccluder():Object() {}
|
ConvexPlanarOccluder():Object() {}
|
||||||
ConvexPlanerOccluder(const ConvexPlanerOccluder& cpo,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
ConvexPlanarOccluder(const ConvexPlanarOccluder& cpo,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||||
Object(cpo,copyop),
|
Object(cpo,copyop),
|
||||||
_occluder(cpo._occluder),
|
_occluder(cpo._occluder),
|
||||||
_holeList(cpo._holeList) {}
|
_holeList(cpo._holeList) {}
|
||||||
|
|
||||||
META_Object(osg,ConvexPlanerOccluder)
|
META_Object(osg,ConvexPlanarOccluder)
|
||||||
|
|
||||||
void setOccluder(const ConvexPlanerPolygon& cpp) { _occluder = cpp; }
|
void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; }
|
||||||
|
|
||||||
ConvexPlanerPolygon& getOccluder() { return _occluder; }
|
ConvexPlanarPolygon& getOccluder() { return _occluder; }
|
||||||
|
|
||||||
const ConvexPlanerPolygon& getOccluder() const { return _occluder; }
|
const ConvexPlanarPolygon& getOccluder() const { return _occluder; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector<ConvexPlanerPolygon> HoleList;
|
typedef std::vector<ConvexPlanarPolygon> HoleList;
|
||||||
|
|
||||||
void addHole(const ConvexPlanerPolygon& cpp) { _holeList.push_back(cpp); }
|
void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); }
|
||||||
|
|
||||||
HoleList& getHoleList() { return _holeList; }
|
HoleList& getHoleList() { return _holeList; }
|
||||||
|
|
||||||
@ -51,9 +51,9 @@ class SG_EXPORT ConvexPlanerOccluder : public Object
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
~ConvexPlanerOccluder() {}
|
~ConvexPlanarOccluder() {}
|
||||||
|
|
||||||
ConvexPlanerPolygon _occluder;
|
ConvexPlanarPolygon _occluder;
|
||||||
HoleList _holeList;
|
HoleList _holeList;
|
||||||
|
|
||||||
};
|
};
|
@ -2,8 +2,8 @@
|
|||||||
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
||||||
//as published by the Free Software Foundation.
|
//as published by the Free Software Foundation.
|
||||||
|
|
||||||
#ifndef OSG_CONVEXPLANERPOLYGON
|
#ifndef OSG_CONVEXPLANARPOLYGON
|
||||||
#define OSG_CONVEXPLANERPOLYGON 1
|
#define OSG_CONVEXPLANARPOLYGON 1
|
||||||
|
|
||||||
#include <osg/Plane>
|
#include <osg/Plane>
|
||||||
|
|
||||||
@ -16,12 +16,12 @@ class BoundingSphere;
|
|||||||
|
|
||||||
/** A class for representing convex clipping volumes made up.
|
/** A class for representing convex clipping volumes made up.
|
||||||
* When adding planes, their normals should point inwards (into the volume) */
|
* When adding planes, their normals should point inwards (into the volume) */
|
||||||
class SG_EXPORT ConvexPlanerPolygon
|
class SG_EXPORT ConvexPlanarPolygon
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConvexPlanerPolygon();
|
ConvexPlanarPolygon();
|
||||||
|
|
||||||
typedef std::vector<osg::Vec3> VertexList;
|
typedef std::vector<osg::Vec3> VertexList;
|
||||||
|
|
@ -6,7 +6,7 @@
|
|||||||
#define OSG_OCCLUDERNODE 1
|
#define OSG_OCCLUDERNODE 1
|
||||||
|
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osg/ConvexPlanerOccluder>
|
#include <osg/ConvexPlanarOccluder>
|
||||||
|
|
||||||
namespace osg {
|
namespace osg {
|
||||||
|
|
||||||
@ -27,14 +27,14 @@ class SG_EXPORT OccluderNode : public Group
|
|||||||
META_Node(osg, OccluderNode);
|
META_Node(osg, OccluderNode);
|
||||||
|
|
||||||
|
|
||||||
/** Attach a ConvexPlanerOccluder to an OccluderNode.*/
|
/** Attach a ConvexPlanarOccluder to an OccluderNode.*/
|
||||||
void setOccluder(ConvexPlanerOccluder* occluder) { _occluder = occluder; }
|
void setOccluder(ConvexPlanarOccluder* occluder) { _occluder = occluder; }
|
||||||
|
|
||||||
/** Get the ConvexPlanerOccluder* attached to a OccluderNode. */
|
/** Get the ConvexPlanarOccluder* attached to a OccluderNode. */
|
||||||
ConvexPlanerOccluder* getOccluder() { return _occluder.get(); }
|
ConvexPlanarOccluder* getOccluder() { return _occluder.get(); }
|
||||||
|
|
||||||
/** Get the const ConvexPlanerOccluder* attached to a OccluderNode.*/
|
/** Get the const ConvexPlanarOccluder* attached to a OccluderNode.*/
|
||||||
const ConvexPlanerOccluder* getOccluder() const { return _occluder.get(); }
|
const ConvexPlanarOccluder* getOccluder() const { return _occluder.get(); }
|
||||||
|
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
@ -44,7 +44,7 @@ class SG_EXPORT OccluderNode : public Group
|
|||||||
/** Override's Group's computeBound.*/
|
/** Override's Group's computeBound.*/
|
||||||
virtual const bool computeBound() const;
|
virtual const bool computeBound() const;
|
||||||
|
|
||||||
ref_ptr<ConvexPlanerOccluder> _occluder;
|
ref_ptr<ConvexPlanarOccluder> _occluder;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define OSG_SHADOWVOLUMEOCCLUDER 1
|
#define OSG_SHADOWVOLUMEOCCLUDER 1
|
||||||
|
|
||||||
#include <osg/Polytope>
|
#include <osg/Polytope>
|
||||||
#include <osg/ConvexPlanerOccluder>
|
#include <osg/ConvexPlanarOccluder>
|
||||||
#include <osg/Node>
|
#include <osg/Node>
|
||||||
|
|
||||||
namespace osg {
|
namespace osg {
|
||||||
@ -36,7 +36,7 @@ class SG_EXPORT ShadowVolumeOccluder
|
|||||||
bool operator < (const ShadowVolumeOccluder& svo) const { return getVolume()>svo.getVolume(); } // not greater volume first.
|
bool operator < (const ShadowVolumeOccluder& svo) const { return getVolume()>svo.getVolume(); } // not greater volume first.
|
||||||
|
|
||||||
/** compute the shadow volume occluder. */
|
/** compute the shadow volume occluder. */
|
||||||
bool computeOccluder(const NodePath& nodePath,const ConvexPlanerOccluder& occluder,CullStack& cullStack,bool createDrawables=false);
|
bool computeOccluder(const NodePath& nodePath,const ConvexPlanarOccluder& occluder,CullStack& cullStack,bool createDrawables=false);
|
||||||
|
|
||||||
|
|
||||||
inline void disableResultMasks();
|
inline void disableResultMasks();
|
||||||
|
@ -84,7 +84,7 @@ class OccluderEventHandler : public osgGA::GUIEventHandler
|
|||||||
osg::ref_ptr<osgUtil::SceneView> _sceneview;
|
osg::ref_ptr<osgUtil::SceneView> _sceneview;
|
||||||
osg::ref_ptr<osg::Group> _rootnode;
|
osg::ref_ptr<osg::Group> _rootnode;
|
||||||
osg::ref_ptr<osg::Group> _occluders;
|
osg::ref_ptr<osg::Group> _occluders;
|
||||||
osg::ref_ptr<osg::ConvexPlanerOccluder> _convexPlanerOccluder;
|
osg::ref_ptr<osg::ConvexPlanarOccluder> _convexPlanarOccluder;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool OccluderEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
bool OccluderEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
@ -158,21 +158,21 @@ void OccluderEventHandler::addPoint(const osg::Vec3& pos)
|
|||||||
{
|
{
|
||||||
std::cout<<"add point "<<pos<<std::endl;
|
std::cout<<"add point "<<pos<<std::endl;
|
||||||
|
|
||||||
if (!_convexPlanerOccluder.valid()) _convexPlanerOccluder = new osg::ConvexPlanerOccluder;
|
if (!_convexPlanarOccluder.valid()) _convexPlanarOccluder = new osg::ConvexPlanarOccluder;
|
||||||
|
|
||||||
osg::ConvexPlanerPolygon& occluder = _convexPlanerOccluder->getOccluder();
|
osg::ConvexPlanarPolygon& occluder = _convexPlanarOccluder->getOccluder();
|
||||||
occluder.add(pos);
|
occluder.add(pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OccluderEventHandler::endOccluder()
|
void OccluderEventHandler::endOccluder()
|
||||||
{
|
{
|
||||||
if (_convexPlanerOccluder.valid())
|
if (_convexPlanarOccluder.valid())
|
||||||
{
|
{
|
||||||
if (_convexPlanerOccluder->getOccluder().getVertexList().size()>=3)
|
if (_convexPlanarOccluder->getOccluder().getVertexList().size()>=3)
|
||||||
{
|
{
|
||||||
osg::OccluderNode* occluderNode = osgNew osg::OccluderNode;
|
osg::OccluderNode* occluderNode = osgNew osg::OccluderNode;
|
||||||
occluderNode->setOccluder(_convexPlanerOccluder.get());
|
occluderNode->setOccluder(_convexPlanarOccluder.get());
|
||||||
|
|
||||||
if (!_occluders.valid())
|
if (!_occluders.valid())
|
||||||
{
|
{
|
||||||
@ -194,7 +194,7 @@ void OccluderEventHandler::endOccluder()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset current occluder.
|
// reset current occluder.
|
||||||
_convexPlanerOccluder = NULL;
|
_convexPlanarOccluder = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -204,14 +204,14 @@ osg::Node* createOccluder(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
|
|||||||
osg::OccluderNode* occluderNode = osgNew osg::OccluderNode;
|
osg::OccluderNode* occluderNode = osgNew osg::OccluderNode;
|
||||||
|
|
||||||
// create the convex planer occluder
|
// create the convex planer occluder
|
||||||
osg::ConvexPlanerOccluder* cpo = osgNew osg::ConvexPlanerOccluder;
|
osg::ConvexPlanarOccluder* cpo = osgNew osg::ConvexPlanarOccluder;
|
||||||
|
|
||||||
// attach it to the occluder node.
|
// attach it to the occluder node.
|
||||||
occluderNode->setOccluder(cpo);
|
occluderNode->setOccluder(cpo);
|
||||||
occluderNode->setName("occluder");
|
occluderNode->setName("occluder");
|
||||||
|
|
||||||
// set the occluder up for the front face of the bounding box.
|
// set the occluder up for the front face of the bounding box.
|
||||||
osg::ConvexPlanerPolygon& occluder = cpo->getOccluder();
|
osg::ConvexPlanarPolygon& occluder = cpo->getOccluder();
|
||||||
occluder.add(v1);
|
occluder.add(v1);
|
||||||
occluder.add(v2);
|
occluder.add(v2);
|
||||||
occluder.add(v3);
|
occluder.add(v3);
|
||||||
@ -229,7 +229,7 @@ osg::Node* createOccluder(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
|
|||||||
osg::Vec3 v3dash = v3*ratio + center*one_minus_ratio;
|
osg::Vec3 v3dash = v3*ratio + center*one_minus_ratio;
|
||||||
osg::Vec3 v4dash = v4*ratio + center*one_minus_ratio;
|
osg::Vec3 v4dash = v4*ratio + center*one_minus_ratio;
|
||||||
|
|
||||||
osg::ConvexPlanerPolygon hole;
|
osg::ConvexPlanarPolygon hole;
|
||||||
hole.add(v1dash);
|
hole.add(v1dash);
|
||||||
hole.add(v2dash);
|
hole.add(v2dash);
|
||||||
hole.add(v3dash);
|
hole.add(v3dash);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// A simple demo demonstrating planer reflections using multiple renderings
|
// A simple demo demonstrating planar reflections using multiple renderings
|
||||||
// of a subgraph, overriding of state attribures and use of the stencil buffer.
|
// of a subgraph, overriding of state attribures and use of the stencil buffer.
|
||||||
//
|
//
|
||||||
// The multipass system implemented here is a variation if Mark Kilgard's
|
// The multipass system implemented here is a variation if Mark Kilgard's
|
||||||
|
3
src/osg/ConvexPlanarOccluder.cpp
Normal file
3
src/osg/ConvexPlanarOccluder.cpp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include <osg/ConvexPlanarOccluder>
|
||||||
|
|
||||||
|
using namespace osg;
|
7
src/osg/ConvexPlanarPolygon.cpp
Normal file
7
src/osg/ConvexPlanarPolygon.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <osg/ConvexPlanarPolygon>
|
||||||
|
|
||||||
|
using namespace osg;
|
||||||
|
|
||||||
|
ConvexPlanarPolygon::ConvexPlanarPolygon()
|
||||||
|
{
|
||||||
|
}
|
@ -1,3 +0,0 @@
|
|||||||
#include <osg/ConvexPlanerOccluder>
|
|
||||||
|
|
||||||
using namespace osg;
|
|
@ -1,7 +0,0 @@
|
|||||||
#include <osg/ConvexPlanerPolygon>
|
|
||||||
|
|
||||||
using namespace osg;
|
|
||||||
|
|
||||||
ConvexPlanerPolygon::ConvexPlanerPolygon()
|
|
||||||
{
|
|
||||||
}
|
|
@ -15,8 +15,8 @@ CXXFILES =\
|
|||||||
ColorMask.cpp\
|
ColorMask.cpp\
|
||||||
ColorMatrix.cpp\
|
ColorMatrix.cpp\
|
||||||
CollectOccludersVisitor.cpp\
|
CollectOccludersVisitor.cpp\
|
||||||
ConvexPlanerPolygon.cpp\
|
ConvexPlanarPolygon.cpp\
|
||||||
ConvexPlanerOccluder.cpp\
|
ConvexPlanarOccluder.cpp\
|
||||||
CopyOp.cpp\
|
CopyOp.cpp\
|
||||||
CullFace.cpp\
|
CullFace.cpp\
|
||||||
CullingSet.cpp\
|
CullingSet.cpp\
|
||||||
|
@ -8,7 +8,7 @@ OccluderNode::OccluderNode()
|
|||||||
|
|
||||||
OccluderNode::OccluderNode(const OccluderNode& node,const CopyOp& copyop):
|
OccluderNode::OccluderNode(const OccluderNode& node,const CopyOp& copyop):
|
||||||
Group(node,copyop),
|
Group(node,copyop),
|
||||||
_occluder(dynamic_cast<ConvexPlanerOccluder*>(copyop(node._occluder.get())))
|
_occluder(dynamic_cast<ConvexPlanarOccluder*>(copyop(node._occluder.get())))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,8 +19,8 @@ const bool OccluderNode::computeBound() const
|
|||||||
if (getOccluder())
|
if (getOccluder())
|
||||||
{
|
{
|
||||||
BoundingBox bb;
|
BoundingBox bb;
|
||||||
const ConvexPlanerPolygon::VertexList& vertexList = getOccluder()->getOccluder().getVertexList();
|
const ConvexPlanarPolygon::VertexList& vertexList = getOccluder()->getOccluder().getVertexList();
|
||||||
for(ConvexPlanerPolygon::VertexList::const_iterator itr=vertexList.begin();
|
for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin();
|
||||||
itr!=vertexList.end();
|
itr!=vertexList.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ float computePolytopeVolume(const PointList& front, const PointList& back)
|
|||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const ConvexPlanerOccluder& occluder,CullStack& cullStack,bool /*createDrawables*/)
|
bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const ConvexPlanarOccluder& occluder,CullStack& cullStack,bool /*createDrawables*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex
|
|||||||
_volume = computePolytopeVolume(points,farPoints)/volumeview;
|
_volume = computePolytopeVolume(points,farPoints)/volumeview;
|
||||||
|
|
||||||
|
|
||||||
for(ConvexPlanerOccluder::HoleList::const_iterator hitr=occluder.getHoleList().begin();
|
for(ConvexPlanarOccluder::HoleList::const_iterator hitr=occluder.getHoleList().begin();
|
||||||
hitr!=occluder.getHoleList().end();
|
hitr!=occluder.getHoleList().end();
|
||||||
++hitr)
|
++hitr)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#pragma warning( disable : 4786 )
|
#pragma warning( disable : 4786 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "osg/ConvexPlanerOccluder"
|
#include "osg/ConvexPlanarOccluder"
|
||||||
#include "osg/Types"
|
#include "osg/Types"
|
||||||
#include "osg/Notify"
|
#include "osg/Notify"
|
||||||
|
|
||||||
@ -14,33 +14,33 @@ using namespace osg;
|
|||||||
using namespace osgDB;
|
using namespace osgDB;
|
||||||
|
|
||||||
// forward declare functions to use later.
|
// forward declare functions to use later.
|
||||||
bool ConvexPlanerOccluder_readLocalData(Object& obj, Input& fr);
|
bool ConvexPlanarOccluder_readLocalData(Object& obj, Input& fr);
|
||||||
bool ConvexPlanerOccluder_writeLocalData(const Object& obj, Output& fw);
|
bool ConvexPlanarOccluder_writeLocalData(const Object& obj, Output& fw);
|
||||||
|
|
||||||
// register the read and write functions with the osgDB::Registry.
|
// register the read and write functions with the osgDB::Registry.
|
||||||
RegisterDotOsgWrapperProxy g_ConvexPlanerOccluderFuncProxy
|
RegisterDotOsgWrapperProxy g_ConvexPlanarOccluderFuncProxy
|
||||||
(
|
(
|
||||||
osgNew osg::ConvexPlanerOccluder,
|
osgNew osg::ConvexPlanarOccluder,
|
||||||
"ConvexPlanerOccluder",
|
"ConvexPlanarOccluder",
|
||||||
"Object ConvexPlanerOccluder",
|
"Object ConvexPlanarOccluder",
|
||||||
&ConvexPlanerOccluder_readLocalData,
|
&ConvexPlanarOccluder_readLocalData,
|
||||||
&ConvexPlanerOccluder_writeLocalData,
|
&ConvexPlanarOccluder_writeLocalData,
|
||||||
DotOsgWrapper::READ_AND_WRITE
|
DotOsgWrapper::READ_AND_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
bool ConvexPlanerOccluder_readLocalData(Object& obj, Input& fr)
|
bool ConvexPlanarOccluder_readLocalData(Object& obj, Input& fr)
|
||||||
{
|
{
|
||||||
bool iteratorAdvanced = false;
|
bool iteratorAdvanced = false;
|
||||||
|
|
||||||
ConvexPlanerOccluder& cpo = static_cast<ConvexPlanerOccluder&>(obj);
|
ConvexPlanarOccluder& cpo = static_cast<ConvexPlanarOccluder&>(obj);
|
||||||
|
|
||||||
|
|
||||||
bool matchFirst;
|
bool matchFirst;
|
||||||
if ((matchFirst=fr.matchSequence("Occluder {")) || fr.matchSequence("Occluder %i {"))
|
if ((matchFirst=fr.matchSequence("Occluder {")) || fr.matchSequence("Occluder %i {"))
|
||||||
{
|
{
|
||||||
|
|
||||||
ConvexPlanerPolygon& cpp = cpo.getOccluder();
|
ConvexPlanarPolygon& cpp = cpo.getOccluder();
|
||||||
ConvexPlanerPolygon::VertexList& vertexList = cpp.getVertexList();
|
ConvexPlanarPolygon::VertexList& vertexList = cpp.getVertexList();
|
||||||
|
|
||||||
// set up coordinates.
|
// set up coordinates.
|
||||||
int entry = fr[0].getNoNestedBrackets();
|
int entry = fr[0].getNoNestedBrackets();
|
||||||
@ -77,14 +77,14 @@ bool ConvexPlanerOccluder_readLocalData(Object& obj, Input& fr)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConvexPlanerOccluder::HoleList& holeList = cpo.getHoleList();
|
ConvexPlanarOccluder::HoleList& holeList = cpo.getHoleList();
|
||||||
|
|
||||||
while ((matchFirst=fr.matchSequence("Hole {")) || fr.matchSequence("Hole %i {"))
|
while ((matchFirst=fr.matchSequence("Hole {")) || fr.matchSequence("Hole %i {"))
|
||||||
{
|
{
|
||||||
holeList.push_back(ConvexPlanerPolygon());
|
holeList.push_back(ConvexPlanarPolygon());
|
||||||
|
|
||||||
ConvexPlanerPolygon& cpp = holeList.back();
|
ConvexPlanarPolygon& cpp = holeList.back();
|
||||||
ConvexPlanerPolygon::VertexList& vertexList = cpp.getVertexList();
|
ConvexPlanarPolygon::VertexList& vertexList = cpp.getVertexList();
|
||||||
|
|
||||||
// set up coordinates.
|
// set up coordinates.
|
||||||
int entry = fr[0].getNoNestedBrackets();
|
int entry = fr[0].getNoNestedBrackets();
|
||||||
@ -125,18 +125,18 @@ bool ConvexPlanerOccluder_readLocalData(Object& obj, Input& fr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ConvexPlanerOccluder_writeLocalData(const Object& obj, Output& fw)
|
bool ConvexPlanarOccluder_writeLocalData(const Object& obj, Output& fw)
|
||||||
{
|
{
|
||||||
const ConvexPlanerOccluder& cpo = static_cast<const ConvexPlanerOccluder&>(obj);
|
const ConvexPlanarOccluder& cpo = static_cast<const ConvexPlanarOccluder&>(obj);
|
||||||
|
|
||||||
// write out the occluder polygon.
|
// write out the occluder polygon.
|
||||||
{
|
{
|
||||||
const ConvexPlanerPolygon::VertexList& vertexList = cpo.getOccluder().getVertexList();
|
const ConvexPlanarPolygon::VertexList& vertexList = cpo.getOccluder().getVertexList();
|
||||||
|
|
||||||
fw.indent() << "Occluder " << vertexList.size()<< "{"<< std::endl;
|
fw.indent() << "Occluder " << vertexList.size()<< "{"<< std::endl;
|
||||||
fw.moveIn();
|
fw.moveIn();
|
||||||
|
|
||||||
for(ConvexPlanerPolygon::VertexList::const_iterator itr=vertexList.begin();
|
for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin();
|
||||||
itr!=vertexList.end();
|
itr!=vertexList.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
@ -148,17 +148,17 @@ bool ConvexPlanerOccluder_writeLocalData(const Object& obj, Output& fw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write out any holes.
|
// write out any holes.
|
||||||
const ConvexPlanerOccluder::HoleList& holeList = cpo.getHoleList();
|
const ConvexPlanarOccluder::HoleList& holeList = cpo.getHoleList();
|
||||||
for(ConvexPlanerOccluder::HoleList::const_iterator holeItr=holeList.begin();
|
for(ConvexPlanarOccluder::HoleList::const_iterator holeItr=holeList.begin();
|
||||||
holeItr!=holeList.end();
|
holeItr!=holeList.end();
|
||||||
++holeItr)
|
++holeItr)
|
||||||
{
|
{
|
||||||
const ConvexPlanerPolygon::VertexList& vertexList = holeItr->getVertexList();
|
const ConvexPlanarPolygon::VertexList& vertexList = holeItr->getVertexList();
|
||||||
|
|
||||||
fw.indent() << "Hole " << vertexList.size() << "{"<< std::endl;
|
fw.indent() << "Hole " << vertexList.size() << "{"<< std::endl;
|
||||||
fw.moveIn();
|
fw.moveIn();
|
||||||
|
|
||||||
for(ConvexPlanerPolygon::VertexList::const_iterator itr=vertexList.begin();
|
for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin();
|
||||||
itr!=vertexList.end();
|
itr!=vertexList.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
@ -7,7 +7,7 @@ CXXFILES =\
|
|||||||
BlendFunc.cpp\
|
BlendFunc.cpp\
|
||||||
ClipPlane.cpp\
|
ClipPlane.cpp\
|
||||||
ColorMask.cpp\
|
ColorMask.cpp\
|
||||||
ConvexPlanerOccluder.cpp\
|
ConvexPlanarOccluder.cpp\
|
||||||
CullFace.cpp\
|
CullFace.cpp\
|
||||||
Depth.cpp\
|
Depth.cpp\
|
||||||
DOFTransform.cpp\
|
DOFTransform.cpp\
|
||||||
|
@ -27,9 +27,9 @@ bool OccluderNode_readLocalData(Object& obj, Input& fr)
|
|||||||
|
|
||||||
OccluderNode& occludernode = static_cast<OccluderNode&>(obj);
|
OccluderNode& occludernode = static_cast<OccluderNode&>(obj);
|
||||||
|
|
||||||
static ref_ptr<ConvexPlanerOccluder> s_occluder = osgNew ConvexPlanerOccluder;
|
static ref_ptr<ConvexPlanarOccluder> s_occluder = osgNew ConvexPlanarOccluder;
|
||||||
|
|
||||||
ConvexPlanerOccluder* tmpOccluder = static_cast<ConvexPlanerOccluder*>(fr.readObjectOfType(*s_occluder));
|
ConvexPlanarOccluder* tmpOccluder = static_cast<ConvexPlanarOccluder*>(fr.readObjectOfType(*s_occluder));
|
||||||
|
|
||||||
if (tmpOccluder)
|
if (tmpOccluder)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user