Fixes for Win32.
This commit is contained in:
parent
0ebf005ac1
commit
73094265c3
@ -149,6 +149,9 @@ Package=<4>
|
|||||||
Begin Project Dependency
|
Begin Project Dependency
|
||||||
Project_Dep_Name Core osgDB
|
Project_Dep_Name Core osgDB
|
||||||
End Project Dependency
|
End Project Dependency
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name Core osgText
|
||||||
|
End Project Dependency
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -83,7 +83,7 @@ osg::Node* createSphereSegment()
|
|||||||
osg::DegreesToRadians(45.0f),
|
osg::DegreesToRadians(45.0f),
|
||||||
60);
|
60);
|
||||||
ss->setAllColors(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
ss->setAllColors(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
ss->setPlaneColor(osg::Vec4(0.0f,0.0f,1.0f,0.1f));
|
ss->setSideColor(osg::Vec4(0.0f,0.0f,1.0f,0.1f));
|
||||||
//ss->setDrawMask(SphereSegment::DrawMask(SphereSegment::SPOKES | SphereSegment::EDGELINE));
|
//ss->setDrawMask(SphereSegment::DrawMask(SphereSegment::SPOKES | SphereSegment::EDGELINE));
|
||||||
|
|
||||||
//ss->setUpdateCallback(new MyNodeCallback);
|
//ss->setUpdateCallback(new MyNodeCallback);
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
SURFACE = 0x00000001, ///< Draw the specified area on the sphere's surface
|
SURFACE = 0x00000001, ///< Draw the specified area on the sphere's surface
|
||||||
SPOKES = 0x00000002, ///< Draw the spokes from the sphere's centre to the surface's corners
|
SPOKES = 0x00000002, ///< Draw the spokes from the sphere's centre to the surface's corners
|
||||||
EDGELINE = 0x00000008, ///< Draw the line round the edge of the area on the sphere's surface
|
EDGELINE = 0x00000008, ///< Draw the line round the edge of the area on the sphere's surface
|
||||||
PLANES = 0x00000010, ///< Draw the planes from the sphere's centre to the edge of the sphere's surface
|
SIDES = 0x00000010, ///< Draw the planes from the sphere's centre to the edge of the sphere's surface
|
||||||
ALL = 0xffffffff ///< Draw every part of the sphere segment
|
ALL = 0xffffffff ///< Draw every part of the sphere segment
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ public:
|
|||||||
void setEdgeLineColor(const osg::Vec4& c);
|
void setEdgeLineColor(const osg::Vec4& c);
|
||||||
|
|
||||||
/** Set the color of the planes. */
|
/** Set the color of the planes. */
|
||||||
void setPlaneColor(const osg::Vec4& c);
|
void setSideColor(const osg::Vec4& c);
|
||||||
|
|
||||||
/** Set color of all components. */
|
/** Set color of all components. */
|
||||||
void setAllColors(const osg::Vec4& c);
|
void setAllColors(const osg::Vec4& c);
|
||||||
@ -228,12 +228,12 @@ private:
|
|||||||
bool EdgeLine_computeBound(osg::BoundingBox&) const;
|
bool EdgeLine_computeBound(osg::BoundingBox&) const;
|
||||||
void EdgeLine_drawImplementation(osg::State&) const;
|
void EdgeLine_drawImplementation(osg::State&) const;
|
||||||
|
|
||||||
enum BoundaryAngle{MIN,MAX}; // Why here and not in Plane class? Because we can't forward
|
enum BoundaryAngle{MIN,MAX}; // Why here and not in Side class? Because we can't forward
|
||||||
enum PlaneOrientation{AZIM,ELEV}; // declare enums, Plane is in the .cpp, and this is tidier...
|
enum SideOrientation{AZIM,ELEV}; // declare enums, Side is in the .cpp, and this is tidier...
|
||||||
class Plane;
|
class Side;
|
||||||
friend class Plane;
|
friend class Side;
|
||||||
bool Plane_computeBound(osg::BoundingBox&, PlaneOrientation, BoundaryAngle) const;
|
bool Side_computeBound(osg::BoundingBox&, SideOrientation, BoundaryAngle) const;
|
||||||
void Plane_drawImplementation(osg::State&, PlaneOrientation, BoundaryAngle) const;
|
void Side_drawImplementation(osg::State&, SideOrientation, BoundaryAngle) const;
|
||||||
|
|
||||||
class Spoke;
|
class Spoke;
|
||||||
friend class Spoke;
|
friend class Spoke;
|
||||||
|
@ -246,8 +246,8 @@ void ScalarBar::createDrawables()
|
|||||||
// vertical alignment depending on the letters used in the labels. E.g. a 'y' has a dangling tail.
|
// vertical alignment depending on the letters used in the labels. E.g. a 'y' has a dangling tail.
|
||||||
if(_orientation == HORIZONTAL)
|
if(_orientation == HORIZONTAL)
|
||||||
{
|
{
|
||||||
std::vector<osgText::Text*>::iterator maxYIt = max_element(texts.begin(), texts.end(), MaxCoordLess(MaxCoordLess::Y_AXIS));
|
std::vector<osgText::Text*>::iterator maxYIt = std::max_element(texts.begin(), texts.end(), MaxCoordLess(MaxCoordLess::Y_AXIS));
|
||||||
for_each(texts.begin(), texts.end(), AlignCentreOnYValue((*maxYIt)->getBound().center().y()));
|
std::for_each(texts.begin(), texts.end(), AlignCentreOnYValue((*maxYIt)->getBound().center().y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. And finally the title
|
// 3. And finally the title
|
||||||
@ -268,7 +268,7 @@ void ScalarBar::createDrawables()
|
|||||||
// Need to move the title above any labels, using maximum y value of the
|
// Need to move the title above any labels, using maximum y value of the
|
||||||
// existing text objects
|
// existing text objects
|
||||||
|
|
||||||
std::vector<osgText::Text*>::iterator maxYIt = max_element(texts.begin(), texts.end(), MaxCoordLess(MaxCoordLess::Y_AXIS));
|
std::vector<osgText::Text*>::iterator maxYIt = std::max_element(texts.begin(), texts.end(), MaxCoordLess(MaxCoordLess::Y_AXIS));
|
||||||
|
|
||||||
float titleY;
|
float titleY;
|
||||||
if(maxYIt != texts.end()) titleY = (*maxYIt)->getBound().yMax() * 1.1f;
|
if(maxYIt != texts.end()) titleY = (*maxYIt)->getBound().yMax() * 1.1f;
|
||||||
@ -284,7 +284,7 @@ void ScalarBar::createDrawables()
|
|||||||
// Need to move the title out beyond any labels, using the maximum x value of the
|
// Need to move the title out beyond any labels, using the maximum x value of the
|
||||||
// existing text objects
|
// existing text objects
|
||||||
|
|
||||||
std::vector<osgText::Text*>::iterator maxXIt = max_element(texts.begin(), texts.end(), MaxCoordLess(MaxCoordLess::X_AXIS));
|
std::vector<osgText::Text*>::iterator maxXIt = std::max_element(texts.begin(), texts.end(), MaxCoordLess(MaxCoordLess::X_AXIS));
|
||||||
|
|
||||||
float titleX;
|
float titleX;
|
||||||
if(maxXIt != texts.end()) titleX = (*maxXIt)->getBound().xMax() * 1.1f;
|
if(maxXIt != texts.end()) titleX = (*maxXIt)->getBound().xMax() * 1.1f;
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
"Warning: unexpected call to osgSim::SphereSegment::Surface() default constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::Surface() default constructor"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface(const Surface& rhs, const osg::CopyOp& co=osg::CopyOp::SHALLOW_COPY):Drawable(*this,co), _ss(0)
|
Surface(const Surface& rhs, const osg::CopyOp& co=osg::CopyOp::SHALLOW_COPY):Drawable(rhs,co), _ss(0)
|
||||||
{
|
{
|
||||||
osg::notify(osg::WARN)<<
|
osg::notify(osg::WARN)<<
|
||||||
"Warning: unexpected call to osgSim::SphereSegment::Surface() copy constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::Surface() copy constructor"<<std::endl;
|
||||||
@ -67,7 +67,7 @@ public:
|
|||||||
"Warning: unexpected call to osgSim::SphereSegment::EdgeLine() default constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::EdgeLine() default constructor"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeLine(const EdgeLine& rhs, const osg::CopyOp& co=osg::CopyOp::SHALLOW_COPY):Drawable(*this,co), _ss(0)
|
EdgeLine(const EdgeLine& rhs, const osg::CopyOp& co=osg::CopyOp::SHALLOW_COPY):Drawable(rhs,co), _ss(0)
|
||||||
{
|
{
|
||||||
osg::notify(osg::WARN)<<
|
osg::notify(osg::WARN)<<
|
||||||
"Warning: unexpected call to osgSim::SphereSegment::EdgeLine() copy constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::EdgeLine() copy constructor"<<std::endl;
|
||||||
@ -100,28 +100,28 @@ bool SphereSegment::EdgeLine::computeBound() const
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SphereSegment::Plane is a Drawable which represents one of the
|
SphereSegment::Side is a Drawable which represents one of the
|
||||||
planar areas, at either the minimum or maxium azimuth.
|
planar areas, at either the minimum or maxium azimuth.
|
||||||
*/
|
*/
|
||||||
class SphereSegment::Plane: public osg::Drawable
|
class SphereSegment::Side: public osg::Drawable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Plane(SphereSegment* ss, SphereSegment::PlaneOrientation po, SphereSegment::BoundaryAngle pa):
|
Side(SphereSegment* ss, SphereSegment::SideOrientation po, SphereSegment::BoundaryAngle pa):
|
||||||
Drawable(), _ss(ss), _planeOrientation(po), _BoundaryAngle(pa) {}
|
Drawable(), _ss(ss), _planeOrientation(po), _BoundaryAngle(pa) {}
|
||||||
|
|
||||||
Plane():_ss(0)
|
Side():_ss(0)
|
||||||
{
|
{
|
||||||
osg::notify(osg::WARN)<<
|
osg::notify(osg::WARN)<<
|
||||||
"Warning: unexpected call to osgSim::SphereSegment::Plane() default constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::Side() default constructor"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plane(const Plane& rhs, const osg::CopyOp& co=osg:: CopyOp::SHALLOW_COPY): Drawable(*this,co), _ss(0)
|
Side(const Side& rhs, const osg::CopyOp& co=osg:: CopyOp::SHALLOW_COPY): Drawable(rhs,co), _ss(0)
|
||||||
{
|
{
|
||||||
osg::notify(osg::WARN)<<
|
osg::notify(osg::WARN)<<
|
||||||
"Warning: unexpected call to osgSim::SphereSegment::Plane() copy constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::Side() copy constructor"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
META_Object(osgSim,Plane)
|
META_Object(osgSim,Side)
|
||||||
|
|
||||||
void drawImplementation(osg::State& state) const;
|
void drawImplementation(osg::State& state) const;
|
||||||
|
|
||||||
@ -131,19 +131,19 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SphereSegment* _ss;
|
SphereSegment* _ss;
|
||||||
SphereSegment::PlaneOrientation _planeOrientation;
|
SphereSegment::SideOrientation _planeOrientation;
|
||||||
SphereSegment::BoundaryAngle _BoundaryAngle;
|
SphereSegment::BoundaryAngle _BoundaryAngle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void SphereSegment::Plane::drawImplementation(osg::State& state) const
|
void SphereSegment::Side::drawImplementation(osg::State& state) const
|
||||||
{
|
{
|
||||||
_ss->Plane_drawImplementation(state, _planeOrientation, _BoundaryAngle);
|
_ss->Side_drawImplementation(state, _planeOrientation, _BoundaryAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SphereSegment::Plane::computeBound() const
|
bool SphereSegment::Side::computeBound() const
|
||||||
{
|
{
|
||||||
_bbox_computed = _ss->Plane_computeBound(_bbox, _planeOrientation, _BoundaryAngle);
|
_bbox_computed = _ss->Side_computeBound(_bbox, _planeOrientation, _BoundaryAngle);
|
||||||
return _bbox_computed;
|
return _bbox_computed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ public:
|
|||||||
"Warning: unexpected call to osgSim::SphereSegment::Spoke() default constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::Spoke() default constructor"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spoke(const Spoke& rhs, const osg::CopyOp& co=osg:: CopyOp::SHALLOW_COPY): Drawable(*this,co), _ss(0)
|
Spoke(const Spoke& rhs, const osg::CopyOp& co=osg:: CopyOp::SHALLOW_COPY): Drawable(rhs,co), _ss(0)
|
||||||
{
|
{
|
||||||
osg::notify(osg::WARN)<<
|
osg::notify(osg::WARN)<<
|
||||||
"Warning: unexpected call to osgSim::SphereSegment::Spoke() copy constructor"<<std::endl;
|
"Warning: unexpected call to osgSim::SphereSegment::Spoke() copy constructor"<<std::endl;
|
||||||
@ -289,10 +289,10 @@ void SphereSegment::init()
|
|||||||
|
|
||||||
addDrawable(new EdgeLine(this));
|
addDrawable(new EdgeLine(this));
|
||||||
|
|
||||||
addDrawable(new Plane(this,AZIM,MIN));
|
addDrawable(new Side(this,AZIM,MIN));
|
||||||
addDrawable(new Plane(this,AZIM,MAX));
|
addDrawable(new Side(this,AZIM,MAX));
|
||||||
addDrawable(new Plane(this,ELEV,MIN));
|
addDrawable(new Side(this,ELEV,MIN));
|
||||||
addDrawable(new Plane(this,ELEV,MAX));
|
addDrawable(new Side(this,ELEV,MAX));
|
||||||
|
|
||||||
addDrawable(new Spoke(this,MIN,MIN));
|
addDrawable(new Spoke(this,MIN,MIN));
|
||||||
addDrawable(new Spoke(this,MIN,MAX));
|
addDrawable(new Spoke(this,MIN,MAX));
|
||||||
@ -315,7 +315,7 @@ struct DirtyDisplayList
|
|||||||
|
|
||||||
void SphereSegment::dirtyAllDrawableDisplayLists()
|
void SphereSegment::dirtyAllDrawableDisplayLists()
|
||||||
{
|
{
|
||||||
for_each(_drawables.begin(), _drawables.end(), DirtyDisplayList());
|
std::for_each(_drawables.begin(), _drawables.end(), DirtyDisplayList());
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -333,7 +333,7 @@ struct DirtyBound
|
|||||||
|
|
||||||
void SphereSegment::dirtyAllDrawableBounds()
|
void SphereSegment::dirtyAllDrawableBounds()
|
||||||
{
|
{
|
||||||
for_each(_drawables.begin(), _drawables.end(), DirtyBound());
|
std::for_each(_drawables.begin(), _drawables.end(), DirtyBound());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphereSegment::Surface_drawImplementation(osg::State& /* state */) const
|
void SphereSegment::Surface_drawImplementation(osg::State& /* state */) const
|
||||||
@ -529,13 +529,13 @@ bool SphereSegment::EdgeLine_computeBound(osg::BoundingBox& bbox) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphereSegment::Plane_drawImplementation(osg::State& /* state */,
|
void SphereSegment::Side_drawImplementation(osg::State& /* state */,
|
||||||
SphereSegment::PlaneOrientation orientation,
|
SphereSegment::SideOrientation orientation,
|
||||||
SphereSegment::BoundaryAngle boundaryAngle) const
|
SphereSegment::BoundaryAngle boundaryAngle) const
|
||||||
{
|
{
|
||||||
// Draw the planes if necessary
|
// Draw the planes if necessary
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
if(_drawMask & PLANES)
|
if(_drawMask & SIDES)
|
||||||
{
|
{
|
||||||
if(orientation == AZIM) // This is a plane at a given azimuth
|
if(orientation == AZIM) // This is a plane at a given azimuth
|
||||||
{
|
{
|
||||||
@ -586,8 +586,8 @@ void SphereSegment::Plane_drawImplementation(osg::State& /* state */,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SphereSegment::Plane_computeBound(osg::BoundingBox& bbox,
|
bool SphereSegment::Side_computeBound(osg::BoundingBox& bbox,
|
||||||
SphereSegment::PlaneOrientation orientation,
|
SphereSegment::SideOrientation orientation,
|
||||||
SphereSegment::BoundaryAngle boundaryAngle) const
|
SphereSegment::BoundaryAngle boundaryAngle) const
|
||||||
{
|
{
|
||||||
bbox.init();
|
bbox.init();
|
||||||
@ -720,32 +720,32 @@ void SphereSegment::setSurfaceColor(const osg::Vec4& c)
|
|||||||
{
|
{
|
||||||
_surfaceColor=c;
|
_surfaceColor=c;
|
||||||
|
|
||||||
if(c.w() != 1.0) for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(Surface)));
|
if(c.w() != 1.0) std::for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(Surface)));
|
||||||
else for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(Surface)));
|
else std::for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(Surface)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphereSegment::setSpokeColor(const osg::Vec4& c)
|
void SphereSegment::setSpokeColor(const osg::Vec4& c)
|
||||||
{
|
{
|
||||||
_spokeColor=c;
|
_spokeColor=c;
|
||||||
|
|
||||||
if(c.w() != 1.0) for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(Spoke)));
|
if(c.w() != 1.0) std::for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(Spoke)));
|
||||||
else for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(Spoke)));
|
else std::for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(Spoke)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphereSegment::setEdgeLineColor(const osg::Vec4& c)
|
void SphereSegment::setEdgeLineColor(const osg::Vec4& c)
|
||||||
{
|
{
|
||||||
_edgeLineColor=c;
|
_edgeLineColor=c;
|
||||||
|
|
||||||
if(c.w() != 1.0) for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(EdgeLine)));
|
if(c.w() != 1.0) std::for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(EdgeLine)));
|
||||||
else for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(EdgeLine)));
|
else std::for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(EdgeLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphereSegment::setPlaneColor(const osg::Vec4& c)
|
void SphereSegment::setSideColor(const osg::Vec4& c)
|
||||||
{
|
{
|
||||||
_planeColor=c;
|
_planeColor=c;
|
||||||
|
|
||||||
if(c.w() != 1.0) for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(Plane)));
|
if(c.w() != 1.0) std::for_each(_drawables.begin(), _drawables.end(), ActivateTransparencyOnType(typeid(Side)));
|
||||||
else for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(Plane)));
|
else std::for_each(_drawables.begin(), _drawables.end(), DeactivateTransparencyOnType(typeid(Side)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SphereSegment::setAllColors(const osg::Vec4& c)
|
void SphereSegment::setAllColors(const osg::Vec4& c)
|
||||||
@ -753,5 +753,5 @@ void SphereSegment::setAllColors(const osg::Vec4& c)
|
|||||||
setSurfaceColor(c);
|
setSurfaceColor(c);
|
||||||
setSpokeColor(c);
|
setSpokeColor(c);
|
||||||
setEdgeLineColor(c);
|
setEdgeLineColor(c);
|
||||||
setPlaneColor(c);
|
setSideColor(c);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user