Fixes for Visual .NET and Mingw builds, and fix MacOSX notify() crash.
This commit is contained in:
@@ -57,9 +57,12 @@ void write_usage(std::ostream& out,const std::string& name)
|
||||
osg::Node* createOccludersAroundModel(osg::Node* model)
|
||||
{
|
||||
osg::Group* scene = osgNew osg::Group;
|
||||
scene->setName("rootgroup");
|
||||
|
||||
|
||||
// add the loaded model into a the scene group.
|
||||
scene->addChild(model);
|
||||
model->setName("model");
|
||||
|
||||
|
||||
// create and occluder which will site along side the loadmodel model.
|
||||
@@ -77,6 +80,7 @@ osg::Node* createOccludersAroundModel(osg::Node* model)
|
||||
|
||||
// attach it to the occluder node.
|
||||
occluderNode->setOccluder(cpo);
|
||||
occluderNode->setName("occluder");
|
||||
|
||||
// set the occluder up for the front face of the bounding box.
|
||||
osg::ConvexPlanerPolygon& occluder = cpo->getOccluder();
|
||||
|
||||
@@ -12,12 +12,12 @@ CollectOccludersVisitor::CollectOccludersVisitor()
|
||||
// overide the default node visitor mode.
|
||||
setTraversalMode(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
|
||||
|
||||
/*setCullingMode(VIEW_FRUSTUM_CULLING|
|
||||
setCullingMode(VIEW_FRUSTUM_CULLING|
|
||||
NEAR_PLANE_CULLING|
|
||||
FAR_PLANE_CULLING|
|
||||
SMALL_FEATURE_CULLING);*/
|
||||
SMALL_FEATURE_CULLING);
|
||||
|
||||
_minimumShadowOccluderVolume = 0.01;
|
||||
_minimumShadowOccluderVolume = 0.01f;
|
||||
_createDrawables = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void CullStack::pushProjectionMatrix(Matrix* matrix)
|
||||
osg::CullingSet* cullingSet = osgNew osg::CullingSet();
|
||||
|
||||
// set up view frustum.
|
||||
cullingSet->getFrustum().setToUnitFrustum(_cullingMode&NEAR_PLANE_CULLING,_cullingMode&FAR_PLANE_CULLING);
|
||||
cullingSet->getFrustum().setToUnitFrustum(((_cullingMode&NEAR_PLANE_CULLING)!=0),((_cullingMode&FAR_PLANE_CULLING)!=0));
|
||||
cullingSet->getFrustum().transformProvidingInverse(*matrix);
|
||||
|
||||
// set the small feature culling.
|
||||
|
||||
@@ -62,17 +62,24 @@ bool osg::initNotifyLevel()
|
||||
|
||||
}
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
const char* NullStreamName = "nul";
|
||||
#else
|
||||
const char* NullStreamName = "/dev/null";
|
||||
#endif
|
||||
|
||||
std::ostream& osg::notify(const osg::NotifySeverity severity)
|
||||
{
|
||||
// set up global notify null stream for inline notify
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
static std::ofstream s_NotifyNulStream("nul");
|
||||
#else
|
||||
static std::ofstream s_NotifyNulStream("/dev/null");
|
||||
#endif
|
||||
static std::ofstream s_NotifyNulStream(NullStreamName);
|
||||
|
||||
static bool initialized = osg::initNotifyLevel();
|
||||
initialized=initialized; // statement with no effect to stop GCC warning.
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
std::cerr<<""; // dummy op to force construction of cerr, before a reference is passed back to calling code.
|
||||
std::cout<<""; // dummy op to force construction of cout, before a reference is passed back to calling code.
|
||||
initialized = osg::initNotifyLevel();
|
||||
}
|
||||
|
||||
if (severity<=g_NotifyLevel)
|
||||
{
|
||||
|
||||
@@ -155,7 +155,7 @@ Plane computeFrontPlane(const PointList& front)
|
||||
// }
|
||||
|
||||
// compute the volume between the front and back polygons of the occluder/hole.
|
||||
float computeVolume(const PointList& front, const PointList& back)
|
||||
float computePolytopeVolume(const PointList& front, const PointList& back)
|
||||
{
|
||||
float volume = 0.0f;
|
||||
Vec3 frontStart = front[0].second;
|
||||
@@ -168,26 +168,6 @@ float computeVolume(const PointList& front, const PointList& back)
|
||||
return volume;
|
||||
}
|
||||
|
||||
float computeVolumeOfView(osg::Matrix& invP)
|
||||
{
|
||||
PointList front;
|
||||
front.push_back(Point(0,osg::Vec3(-1,-1,-1)));
|
||||
front.push_back(Point(0,osg::Vec3(-1, 1,-1)));
|
||||
front.push_back(Point(0,osg::Vec3( 1, 1,-1)));
|
||||
front.push_back(Point(0,osg::Vec3( 1,-1,-1)));
|
||||
transform(front,invP);
|
||||
|
||||
PointList back;
|
||||
back.push_back(Point(0,osg::Vec3(-1,-1,1)));
|
||||
back.push_back(Point(0,osg::Vec3(-1, 1,1)));
|
||||
back.push_back(Point(0,osg::Vec3( 1, 1,1)));
|
||||
back.push_back(Point(0,osg::Vec3( 1,-1,1)));
|
||||
transform(back,invP);
|
||||
|
||||
return computeVolume(front,back);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Drawable* createOccluderDrawable(const PointList& front, const PointList& back)
|
||||
{
|
||||
@@ -310,7 +290,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex
|
||||
_occluderVolume.flip();
|
||||
}
|
||||
|
||||
_volume = computeVolume(points,farPoints)/volumeview;
|
||||
_volume = computePolytopeVolume(points,farPoints)/volumeview;
|
||||
|
||||
if (createDrawables && !nodePath.empty())
|
||||
{
|
||||
@@ -338,7 +318,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex
|
||||
PointList points;
|
||||
if (clip(cullingset.getFrustum().getPlaneList(),hitr->getVertexList(),points)>=3)
|
||||
{
|
||||
_holeList.push_back();
|
||||
_holeList.push_back(Polytope());
|
||||
Polytope& polytope = _holeList.back();
|
||||
|
||||
// compute the points on the far plane.
|
||||
@@ -366,7 +346,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex
|
||||
}
|
||||
|
||||
// remove the hole's volume from the occluder volume.
|
||||
_volume -= computeVolume(points,farPoints)/volumeview;
|
||||
_volume -= computePolytopeVolume(points,farPoints)/volumeview;
|
||||
|
||||
if (createDrawables && !nodePath.empty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user