Changed ABSOLUTE and RELATIVE to ABSOLUTE_RF and RELATIVE_RF to avoid stooppid Win32 #define
This commit is contained in:
parent
1dd682f6b4
commit
b70ff91eaf
@ -144,7 +144,7 @@ void DistortionNode::createHUDSubgraph()
|
|||||||
|
|
||||||
// create the hud.
|
// create the hud.
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
modelview_abs->addChild(geode);
|
modelview_abs->addChild(geode);
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str)
|
|||||||
|
|
||||||
// create the hud.
|
// create the hud.
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
modelview_abs->addChild(geode);
|
modelview_abs->addChild(geode);
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ osg::Group *build_hud_base(osg::Group *root)
|
|||||||
root->addChild(proj.get());
|
root->addChild(proj.get());
|
||||||
|
|
||||||
osg::ref_ptr<osg::MatrixTransform> xform = new osg::MatrixTransform(osg::Matrix::identity());
|
osg::ref_ptr<osg::MatrixTransform> xform = new osg::MatrixTransform(osg::Matrix::identity());
|
||||||
xform->setReferenceFrame(osg::Transform::ABSOLUTE);
|
xform->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
proj->addChild(xform.get());
|
proj->addChild(xform.get());
|
||||||
|
|
||||||
osg::StateSet *ss = xform->getOrCreateStateSet();
|
osg::StateSet *ss = xform->getOrCreateStateSet();
|
||||||
|
@ -102,7 +102,7 @@ osg::Node* createHUD()
|
|||||||
|
|
||||||
text->setFont(timesFont);
|
text->setFont(timesFont);
|
||||||
text->setPosition(position);
|
text->setPosition(position);
|
||||||
text->setText("And add an osg::ModelViewMatrix set to ABSOLUTE to ensure\nit remains independent from any external model view matrices.");
|
text->setText("And add an osg::ModelViewMatrix set to ABSOLUTE_RF to ensure\nit remains independent from any external model view matrices.");
|
||||||
|
|
||||||
position += delta;
|
position += delta;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ osg::Node* createHUD()
|
|||||||
|
|
||||||
// create the hud.
|
// create the hud.
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
modelview_abs->addChild(geode);
|
modelview_abs->addChild(geode);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ osg::Node* createHUD(osgText::Text* updateText)
|
|||||||
// eg to be used as a menuing/help system!
|
// eg to be used as a menuing/help system!
|
||||||
// Can pick texts too!
|
// Can pick texts too!
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
|
|
||||||
osg::Projection* projection = new osg::Projection;
|
osg::Projection* projection = new osg::Projection;
|
||||||
|
@ -47,10 +47,10 @@ public:
|
|||||||
// operators on the particle set via the operate() method.
|
// operators on the particle set via the operate() method.
|
||||||
void beginOperate(osgParticle::Program *prg)
|
void beginOperate(osgParticle::Program *prg)
|
||||||
{
|
{
|
||||||
// we have to check whether the reference frame is relative to parents
|
// we have to check whether the reference frame is RELATIVE_RF to parents
|
||||||
// or it's absolute; in the first case, we must transform the vectors
|
// or it's absolute; in the first case, we must transform the vectors
|
||||||
// from local to world space.
|
// from local to world space.
|
||||||
if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE) {
|
if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE_RF) {
|
||||||
// transform the center point (full transformation)
|
// transform the center point (full transformation)
|
||||||
xf_center_ = prg->transformLocalToWorld(center_);
|
xf_center_ = prg->transformLocalToWorld(center_);
|
||||||
// transform the axis vector (only rotation and scale)
|
// transform the axis vector (only rotation and scale)
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const
|
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.preMult(getMatrix());
|
matrix.preMult(getMatrix());
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
{
|
{
|
||||||
const osg::Matrix& inverse = getInverseMatrix();
|
const osg::Matrix& inverse = getInverseMatrix();
|
||||||
|
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.postMult(inverse);
|
matrix.postMult(inverse);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ osg::Node* createHUD(osgText::Text* updateText)
|
|||||||
// eg to be used as a menuing/help system!
|
// eg to be used as a menuing/help system!
|
||||||
// Can pick texts too!
|
// Can pick texts too!
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
|
|
||||||
osg::Projection* projection = new osg::Projection;
|
osg::Projection* projection = new osg::Projection;
|
||||||
|
@ -84,7 +84,7 @@ osg::Node * createScalarBar_HUD()
|
|||||||
stateset->setRenderBinDetails(11, "RenderBin");
|
stateset->setRenderBinDetails(11, "RenderBin");
|
||||||
|
|
||||||
osg::MatrixTransform * modelview = new osg::MatrixTransform;
|
osg::MatrixTransform * modelview = new osg::MatrixTransform;
|
||||||
modelview->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
osg::Matrixd matrix(osg::Matrixd::scale(1000,1000,1000) * osg::Matrixd::translate(120,10,0)); // I've played with these values a lot and it seems to work, but I have no idea why
|
osg::Matrixd matrix(osg::Matrixd::scale(1000,1000,1000) * osg::Matrixd::translate(120,10,0)); // I've played with these values a lot and it seems to work, but I have no idea why
|
||||||
modelview->setMatrix(matrix);
|
modelview->setMatrix(matrix);
|
||||||
modelview->addChild(geode);
|
modelview->addChild(geode);
|
||||||
|
@ -525,7 +525,7 @@ osg::Node* createHUD()
|
|||||||
|
|
||||||
// create the hud.
|
// create the hud.
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
modelview_abs->addChild(geode);
|
modelview_abs->addChild(geode);
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ int main( int argc, char **argv )
|
|||||||
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
|
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
|
||||||
|
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
|
|
||||||
modelview_abs->addChild(createHUDText());
|
modelview_abs->addChild(createHUDText());
|
||||||
|
@ -209,7 +209,7 @@ osg::Node* createHUD()
|
|||||||
|
|
||||||
// create HUD
|
// create HUD
|
||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
modelview_abs->addChild(group);
|
modelview_abs->addChild(group);
|
||||||
|
|
||||||
|
@ -38,19 +38,19 @@ class SG_EXPORT LightSource : public Group
|
|||||||
|
|
||||||
enum ReferenceFrame
|
enum ReferenceFrame
|
||||||
{
|
{
|
||||||
RELATIVE,
|
RELATIVE_RF,
|
||||||
ABSOLUTE
|
ABSOLUTE_RF
|
||||||
#ifdef USE_DEPRECATED_API
|
#ifdef USE_DEPRECATED_API
|
||||||
,
|
,
|
||||||
RELATIVE_TO_PARENTS=RELATIVE,
|
RELATIVE_TO_PARENTS=RELATIVE_RF,
|
||||||
RELATIVE_TO_ABSOLUTE=ABSOLUTE,
|
RELATIVE_TO_ABSOLUTE=ABSOLUTE_RF,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Set the light sources's ReferenceFrame, either to be relative to its
|
/** Set the light sources's ReferenceFrame, either to be relative to its
|
||||||
* parent reference frame, or relative to an absolute coordinate
|
* parent reference frame, or relative to an absolute coordinate
|
||||||
* frame. RELATIVE is the default.
|
* frame. RELATIVE_RF is the default.
|
||||||
* Note: setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
* Note: setting the ReferenceFrame to be ABSOLUTE_RF will
|
||||||
* also set the CullingActive flag on the light source, and hence all
|
* also set the CullingActive flag on the light source, and hence all
|
||||||
* of its parents, to false, thereby disabling culling of it and
|
* of its parents, to false, thereby disabling culling of it and
|
||||||
* all its parents. This is necessary to prevent inappropriate
|
* all its parents. This is necessary to prevent inappropriate
|
||||||
|
@ -89,19 +89,19 @@ class SG_EXPORT Transform : public Group
|
|||||||
|
|
||||||
enum ReferenceFrame
|
enum ReferenceFrame
|
||||||
{
|
{
|
||||||
RELATIVE,
|
RELATIVE_RF,
|
||||||
ABSOLUTE
|
ABSOLUTE_RF
|
||||||
#ifdef USE_DEPRECATED_API
|
#ifdef USE_DEPRECATED_API
|
||||||
,
|
,
|
||||||
RELATIVE_TO_PARENTS=RELATIVE,
|
RELATIVE_TO_PARENTS=RELATIVE_RF,
|
||||||
RELATIVE_TO_ABSOLUTE=ABSOLUTE,
|
RELATIVE_TO_ABSOLUTE=ABSOLUTE_RF,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Set the transform's ReferenceFrame, either to be relative to its
|
/** Set the transform's ReferenceFrame, either to be relative to its
|
||||||
* parent reference frame, or relative to an absolute coordinate
|
* parent reference frame, or relative to an absolute coordinate
|
||||||
* frame. RELATIVE is the default.
|
* frame. RELATIVE_RF is the default.
|
||||||
* Note: Setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
* Note: Setting the ReferenceFrame to be ABSOLUTE_RF will
|
||||||
* also set the CullingActive flag on the transform, and hence all
|
* also set the CullingActive flag on the transform, and hence all
|
||||||
* of its parents, to false, thereby disabling culling of it and
|
* of its parents, to false, thereby disabling culling of it and
|
||||||
* all its parents. This is neccessary to prevent inappropriate
|
* all its parents. This is neccessary to prevent inappropriate
|
||||||
@ -116,7 +116,7 @@ class SG_EXPORT Transform : public Group
|
|||||||
|
|
||||||
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ class SG_EXPORT Transform : public Group
|
|||||||
|
|
||||||
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ namespace osgParticle
|
|||||||
|
|
||||||
inline void AccelOperator::beginOperate(Program *prg)
|
inline void AccelOperator::beginOperate(Program *prg)
|
||||||
{
|
{
|
||||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE) {
|
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) {
|
||||||
xf_accel_ = prg->rotateLocalToWorld(accel_);
|
xf_accel_ = prg->rotateLocalToWorld(accel_);
|
||||||
} else {
|
} else {
|
||||||
xf_accel_ = accel_;
|
xf_accel_ = accel_;
|
||||||
|
@ -86,7 +86,7 @@ namespace osgParticle
|
|||||||
|
|
||||||
inline void AngularAccelOperator::beginOperate(Program *prg)
|
inline void AngularAccelOperator::beginOperate(Program *prg)
|
||||||
{
|
{
|
||||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE) {
|
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) {
|
||||||
xf_angular_accel_ = prg->rotateLocalToWorld(angular_accel_);
|
xf_angular_accel_ = prg->rotateLocalToWorld(angular_accel_);
|
||||||
} else {
|
} else {
|
||||||
xf_angular_accel_ = angular_accel_;
|
xf_angular_accel_ = angular_accel_;
|
||||||
|
@ -87,7 +87,7 @@ namespace osgParticle
|
|||||||
|
|
||||||
inline void ForceOperator::beginOperate(Program *prg)
|
inline void ForceOperator::beginOperate(Program *prg)
|
||||||
{
|
{
|
||||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE) {
|
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) {
|
||||||
xf_force_ = prg->rotateLocalToWorld(force_);
|
xf_force_ = prg->rotateLocalToWorld(force_);
|
||||||
} else {
|
} else {
|
||||||
xf_force_ = force_;
|
xf_force_ = force_;
|
||||||
|
@ -57,7 +57,7 @@ namespace osgParticle
|
|||||||
|
|
||||||
/** Do something before processing particles via the <CODE>operate()</CODE> method.
|
/** Do something before processing particles via the <CODE>operate()</CODE> method.
|
||||||
Overriding this method could be necessary to query the calling <CODE>Program</CODE> object
|
Overriding this method could be necessary to query the calling <CODE>Program</CODE> object
|
||||||
for the current reference frame. If the reference frame is RELATIVE, then your
|
for the current reference frame. If the reference frame is RELATIVE_RF, then your
|
||||||
class should prepare itself to do all operations in local coordinates.
|
class should prepare itself to do all operations in local coordinates.
|
||||||
*/
|
*/
|
||||||
virtual void beginOperate(Program *) {}
|
virtual void beginOperate(Program *) {}
|
||||||
|
@ -39,12 +39,12 @@ namespace osgParticle
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
enum ReferenceFrame {
|
enum ReferenceFrame {
|
||||||
RELATIVE,
|
RELATIVE_RF,
|
||||||
ABSOLUTE
|
ABSOLUTE_RF
|
||||||
#ifdef USE_DEPRECATED_API
|
#ifdef USE_DEPRECATED_API
|
||||||
,
|
,
|
||||||
RELATIVE_TO_PARENTS=RELATIVE,
|
RELATIVE_RF_TO_PARENTS=RELATIVE_RF,
|
||||||
RELATIVE_TO_ABSOLUTE=ABSOLUTE,
|
RELATIVE_RF_TO_ABSOLUTE=ABSOLUTE_RF,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
|||||||
{
|
{
|
||||||
if (_matrixDirty) computeMatrix();
|
if (_matrixDirty) computeMatrix();
|
||||||
|
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.preMult(_cachedMatrix);
|
matrix.preMult(_cachedMatrix);
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
|||||||
|
|
||||||
bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.postMult(osg::Matrix::translate(-_position)*
|
matrix.postMult(osg::Matrix::translate(-_position)*
|
||||||
osg::Matrix::rotate(_rotation.inverse())*
|
osg::Matrix::rotate(_rotation.inverse())*
|
||||||
|
@ -360,7 +360,7 @@ bool Group::computeBound() const
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
const osg::Transform* transform = (*itr)->asTransform();
|
const osg::Transform* transform = (*itr)->asTransform();
|
||||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE)
|
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
|
||||||
{
|
{
|
||||||
bb.expandBy((*itr)->getBound());
|
bb.expandBy((*itr)->getBound());
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ bool Group::computeBound() const
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
const osg::Transform* transform = (*itr)->asTransform();
|
const osg::Transform* transform = (*itr)->asTransform();
|
||||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE)
|
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
|
||||||
{
|
{
|
||||||
_bsphere.expandRadiusBy((*itr)->getBound());
|
_bsphere.expandRadiusBy((*itr)->getBound());
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ using namespace osg;
|
|||||||
|
|
||||||
LightSource::LightSource():
|
LightSource::LightSource():
|
||||||
_value(StateAttribute::ON),
|
_value(StateAttribute::ON),
|
||||||
_referenceFrame(RELATIVE)
|
_referenceFrame(RELATIVE_RF)
|
||||||
{
|
{
|
||||||
// switch off culling of light source nodes by default.
|
// switch off culling of light source nodes by default.
|
||||||
setCullingActive(false);
|
setCullingActive(false);
|
||||||
@ -33,7 +33,7 @@ LightSource::~LightSource()
|
|||||||
void LightSource::setReferenceFrame(ReferenceFrame rf)
|
void LightSource::setReferenceFrame(ReferenceFrame rf)
|
||||||
{
|
{
|
||||||
_referenceFrame = rf;
|
_referenceFrame = rf;
|
||||||
setCullingActive(_referenceFrame==RELATIVE);
|
setCullingActive(_referenceFrame==RELATIVE_RF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightSource::setLight(Light* light)
|
void LightSource::setLight(Light* light)
|
||||||
@ -62,7 +62,7 @@ bool LightSource::computeBound() const
|
|||||||
{
|
{
|
||||||
Group::computeBound();
|
Group::computeBound();
|
||||||
|
|
||||||
if (_light.valid() && _referenceFrame==RELATIVE)
|
if (_light.valid() && _referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
const Vec4& pos = _light->getPosition();
|
const Vec4& pos = _light->getPosition();
|
||||||
if (pos[3]!=0.0f)
|
if (pos[3]!=0.0f)
|
||||||
|
@ -29,7 +29,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp&
|
|||||||
|
|
||||||
MatrixTransform::MatrixTransform(const Matrix& mat )
|
MatrixTransform::MatrixTransform(const Matrix& mat )
|
||||||
{
|
{
|
||||||
_referenceFrame = RELATIVE;
|
_referenceFrame = RELATIVE_RF;
|
||||||
|
|
||||||
_matrix = mat;
|
_matrix = mat;
|
||||||
_inverseDirty = false;
|
_inverseDirty = false;
|
||||||
@ -42,7 +42,7 @@ MatrixTransform::~MatrixTransform()
|
|||||||
|
|
||||||
bool MatrixTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
bool MatrixTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.preMult(_matrix);
|
matrix.preMult(_matrix);
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ bool MatrixTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) con
|
|||||||
{
|
{
|
||||||
const Matrix& inverse = getInverseMatrix();
|
const Matrix& inverse = getInverseMatrix();
|
||||||
|
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.postMult(inverse);
|
matrix.postMult(inverse);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ PositionAttitudeTransform::PositionAttitudeTransform():
|
|||||||
|
|
||||||
bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.preMult(osg::Matrix::translate(-_pivotPoint)*
|
matrix.preMult(osg::Matrix::translate(-_pivotPoint)*
|
||||||
osg::Matrix::scale(_scale)*
|
osg::Matrix::scale(_scale)*
|
||||||
@ -41,7 +41,7 @@ bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVis
|
|||||||
|
|
||||||
bool PositionAttitudeTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
bool PositionAttitudeTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
||||||
{
|
{
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.postMult(osg::Matrix::translate(-_position)*
|
matrix.postMult(osg::Matrix::translate(-_position)*
|
||||||
osg::Matrix::rotate(_attitude.inverse())*
|
osg::Matrix::rotate(_attitude.inverse())*
|
||||||
|
@ -98,7 +98,7 @@ Matrix osg::computeEyeToLocal(const Matrix& modelview,const NodePath& nodePath)
|
|||||||
|
|
||||||
Transform::Transform()
|
Transform::Transform()
|
||||||
{
|
{
|
||||||
_referenceFrame = RELATIVE;
|
_referenceFrame = RELATIVE_RF;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform::Transform(const Transform& transform,const CopyOp& copyop):
|
Transform::Transform(const Transform& transform,const CopyOp& copyop):
|
||||||
@ -118,7 +118,7 @@ void Transform::setReferenceFrame(ReferenceFrame rf)
|
|||||||
_referenceFrame = rf;
|
_referenceFrame = rf;
|
||||||
|
|
||||||
// switch off culling if transform is absolute.
|
// switch off culling if transform is absolute.
|
||||||
if (_referenceFrame==RELATIVE) setCullingActive(false);
|
if (_referenceFrame==RELATIVE_RF) setCullingActive(false);
|
||||||
else setCullingActive(true);
|
else setCullingActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void osgParticle::FluidFrictionOperator::operate(Particle *P, double dt)
|
|||||||
|
|
||||||
osg::Vec3 Fr(-R * v.x(), -R * v.y(), -R * v.z());
|
osg::Vec3 Fr(-R * v.x(), -R * v.y(), -R * v.z());
|
||||||
|
|
||||||
if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE) {
|
if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE_RF) {
|
||||||
Fr = current_program_->rotateLocalToWorld(Fr);
|
Fr = current_program_->rotateLocalToWorld(Fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ void osgParticle::ModularEmitter::emit(double dt)
|
|||||||
if (P) {
|
if (P) {
|
||||||
placer_->place(P);
|
placer_->place(P);
|
||||||
shooter_->shoot(P);
|
shooter_->shoot(P);
|
||||||
if (getReferenceFrame() == RELATIVE) {
|
if (getReferenceFrame() == RELATIVE_RF) {
|
||||||
P->transformPositionVelocity(getLocalToWorldMatrix());
|
P->transformPositionVelocity(getLocalToWorldMatrix());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ using namespace osg;
|
|||||||
|
|
||||||
osgParticle::ParticleProcessor::ParticleProcessor()
|
osgParticle::ParticleProcessor::ParticleProcessor()
|
||||||
: osg::Node(),
|
: osg::Node(),
|
||||||
rf_(RELATIVE),
|
rf_(RELATIVE_RF),
|
||||||
enabled_(true),
|
enabled_(true),
|
||||||
t0_(-1),
|
t0_(-1),
|
||||||
ps_(0),
|
ps_(0),
|
||||||
|
@ -29,12 +29,12 @@ bool LightSource_readLocalData(Object& obj, Input& fr)
|
|||||||
|
|
||||||
if (fr[0].matchWord("referenceFrame")) {
|
if (fr[0].matchWord("referenceFrame")) {
|
||||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
||||||
lightsource.setReferenceFrame(LightSource::ABSOLUTE);
|
lightsource.setReferenceFrame(LightSource::ABSOLUTE_RF);
|
||||||
fr += 2;
|
fr += 2;
|
||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||||
lightsource.setReferenceFrame(LightSource::RELATIVE);
|
lightsource.setReferenceFrame(LightSource::RELATIVE_RF);
|
||||||
fr += 2;
|
fr += 2;
|
||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
@ -58,10 +58,10 @@ bool LightSource_writeLocalData(const Object& obj, Output& fw)
|
|||||||
|
|
||||||
fw.indent() << "referenceFrame ";
|
fw.indent() << "referenceFrame ";
|
||||||
switch (lightsource.getReferenceFrame()) {
|
switch (lightsource.getReferenceFrame()) {
|
||||||
case LightSource::ABSOLUTE:
|
case LightSource::ABSOLUTE_RF:
|
||||||
fw << "RELATIVE_TO_ABSOLUTE\n";
|
fw << "RELATIVE_TO_ABSOLUTE\n";
|
||||||
break;
|
break;
|
||||||
case LightSource::RELATIVE:
|
case LightSource::RELATIVE_RF:
|
||||||
default:
|
default:
|
||||||
fw << "RELATIVE\n";
|
fw << "RELATIVE\n";
|
||||||
};
|
};
|
||||||
|
@ -51,12 +51,12 @@ bool Transform_readLocalData(Object& obj, Input& fr)
|
|||||||
|
|
||||||
if (fr[0].matchWord("referenceFrame")) {
|
if (fr[0].matchWord("referenceFrame")) {
|
||||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE") ) {
|
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE") ) {
|
||||||
transform.setReferenceFrame(Transform::ABSOLUTE);
|
transform.setReferenceFrame(Transform::ABSOLUTE_RF);
|
||||||
fr += 2;
|
fr += 2;
|
||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||||
transform.setReferenceFrame(Transform::RELATIVE);
|
transform.setReferenceFrame(Transform::RELATIVE_RF);
|
||||||
fr += 2;
|
fr += 2;
|
||||||
iteratorAdvanced = true;
|
iteratorAdvanced = true;
|
||||||
}
|
}
|
||||||
@ -72,10 +72,10 @@ bool Transform_writeLocalData(const Object& obj, Output& fw)
|
|||||||
|
|
||||||
fw.indent() << "referenceFrame ";
|
fw.indent() << "referenceFrame ";
|
||||||
switch (transform.getReferenceFrame()) {
|
switch (transform.getReferenceFrame()) {
|
||||||
case Transform::ABSOLUTE:
|
case Transform::ABSOLUTE_RF:
|
||||||
fw << "ABSOLUTE\n";
|
fw << "ABSOLUTE\n";
|
||||||
break;
|
break;
|
||||||
case Transform::RELATIVE:
|
case Transform::RELATIVE_RF:
|
||||||
default:
|
default:
|
||||||
fw << "RELATIVE\n";
|
fw << "RELATIVE\n";
|
||||||
};
|
};
|
||||||
|
@ -52,12 +52,12 @@ bool ParticleProcessor_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
|||||||
|
|
||||||
if (fr[0].matchWord("referenceFrame")) {
|
if (fr[0].matchWord("referenceFrame")) {
|
||||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
||||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::ABSOLUTE);
|
myobj.setReferenceFrame(osgParticle::ParticleProcessor::ABSOLUTE_RF);
|
||||||
fr += 2;
|
fr += 2;
|
||||||
itAdvanced = true;
|
itAdvanced = true;
|
||||||
}
|
}
|
||||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE);
|
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_RF);
|
||||||
fr += 2;
|
fr += 2;
|
||||||
itAdvanced = true;
|
itAdvanced = true;
|
||||||
}
|
}
|
||||||
@ -129,10 +129,10 @@ bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
|||||||
fw.indent() << "referenceFrame ";
|
fw.indent() << "referenceFrame ";
|
||||||
switch (myobj.getReferenceFrame())
|
switch (myobj.getReferenceFrame())
|
||||||
{
|
{
|
||||||
case osgParticle::ParticleProcessor::ABSOLUTE:
|
case osgParticle::ParticleProcessor::ABSOLUTE_RF:
|
||||||
fw << "ABSOLUTE" << std::endl;
|
fw << "ABSOLUTE" << std::endl;
|
||||||
break;
|
break;
|
||||||
case osgParticle::ParticleProcessor::RELATIVE:
|
case osgParticle::ParticleProcessor::RELATIVE_RF:
|
||||||
default:
|
default:
|
||||||
fw << "RELATIVE" << std::endl;
|
fw << "RELATIVE" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -468,11 +468,11 @@ void Viewer::setUpViewer(unsigned int options)
|
|||||||
lightsource->setLight(light);
|
lightsource->setLight(light);
|
||||||
if (options & HEAD_LIGHT_SOURCE)
|
if (options & HEAD_LIGHT_SOURCE)
|
||||||
{
|
{
|
||||||
lightsource->setReferenceFrame(osg::LightSource::ABSOLUTE); // headlight.
|
lightsource->setReferenceFrame(osg::LightSource::ABSOLUTE_RF); // headlight.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lightsource->setReferenceFrame(osg::LightSource::RELATIVE); // skylight
|
lightsource->setReferenceFrame(osg::LightSource::RELATIVE_RF); // skylight
|
||||||
}
|
}
|
||||||
lightsource->setLocalStateSetModes(osg::StateAttribute::ON);
|
lightsource->setLocalStateSetModes(osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ bool DOFTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisito
|
|||||||
l2w.postMult(getInversePutMatrix());
|
l2w.postMult(getInversePutMatrix());
|
||||||
|
|
||||||
// finally.
|
// finally.
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
matrix.preMult(l2w);
|
matrix.preMult(l2w);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ bool DOFTransform::computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisito
|
|||||||
//and impose inverse put:
|
//and impose inverse put:
|
||||||
w2l.postMult(getPutMatrix());
|
w2l.postMult(getPutMatrix());
|
||||||
|
|
||||||
if (_referenceFrame==RELATIVE)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
{
|
{
|
||||||
//finally:
|
//finally:
|
||||||
matrix.postMult(w2l);
|
matrix.postMult(w2l);
|
||||||
|
@ -830,7 +830,7 @@ void CullVisitor::apply(LightSource& node)
|
|||||||
StateAttribute* light = node.getLight();
|
StateAttribute* light = node.getLight();
|
||||||
if (light)
|
if (light)
|
||||||
{
|
{
|
||||||
if (node.getReferenceFrame()==osg::LightSource::RELATIVE)
|
if (node.getReferenceFrame()==osg::LightSource::RELATIVE_RF)
|
||||||
{
|
{
|
||||||
RefMatrix& matrix = getModelViewMatrix();
|
RefMatrix& matrix = getModelViewMatrix();
|
||||||
addPositionedAttribute(&matrix,light);
|
addPositionedAttribute(&matrix,light);
|
||||||
|
@ -625,7 +625,7 @@ class CollectLowestTransformsVisitor : public osg::NodeVisitor
|
|||||||
if (transform)
|
if (transform)
|
||||||
{
|
{
|
||||||
if (transform->getDataVariance()==osg::Transform::DYNAMIC) _moreThanOneMatrixRequired=true;
|
if (transform->getDataVariance()==osg::Transform::DYNAMIC) _moreThanOneMatrixRequired=true;
|
||||||
else if (transform->getReferenceFrame()==osg::Transform::RELATIVE) _moreThanOneMatrixRequired=true;
|
else if (transform->getReferenceFrame()==osg::Transform::RELATIVE_RF) _moreThanOneMatrixRequired=true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_transformSet.empty()) transform->computeLocalToWorldMatrix(_firstMatrix,0);
|
if (_transformSet.empty()) transform->computeLocalToWorldMatrix(_firstMatrix,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user