Changed the ReferenceFrame enums to be RELEATIVE and ABSOLUTE, and
deprecated the RELATIVE_TO_ABSOLUTE and RELATIVE_TO_PARENTS.
This commit is contained in:
parent
8ab8fc762f
commit
6821a80e14
@ -144,7 +144,7 @@ void DistortionNode::createHUDSubgraph()
|
||||
|
||||
// create the hud.
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
modelview_abs->addChild(geode);
|
||||
|
||||
|
@ -744,7 +744,7 @@ osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str)
|
||||
|
||||
// create the hud.
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
modelview_abs->addChild(geode);
|
||||
|
||||
|
@ -232,7 +232,7 @@ osg::Group *build_hud_base(osg::Group *root)
|
||||
root->addChild(proj.get());
|
||||
|
||||
osg::ref_ptr<osg::MatrixTransform> xform = new osg::MatrixTransform(osg::Matrix::identity());
|
||||
xform->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
xform->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
proj->addChild(xform.get());
|
||||
|
||||
osg::StateSet *ss = xform->getOrCreateStateSet();
|
||||
|
@ -148,7 +148,7 @@ osg::Node* createHUD()
|
||||
|
||||
// create the hud.
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
modelview_abs->addChild(geode);
|
||||
|
||||
|
@ -111,7 +111,7 @@ osg::Node* createHUD(osgText::Text* updateText)
|
||||
// eg to be used as a menuing/help system!
|
||||
// Can pick texts too!
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
|
||||
osg::Projection* projection = new osg::Projection;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// we have to check whether the reference frame is relative to parents
|
||||
// or it's absolute; in the first case, we must transform the vectors
|
||||
// from local to world space.
|
||||
if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE_TO_PARENTS) {
|
||||
if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE) {
|
||||
// transform the center point (full transformation)
|
||||
xf_center_ = prg->transformLocalToWorld(center_);
|
||||
// transform the axis vector (only rotation and scale)
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.preMult(getMatrix());
|
||||
}
|
||||
@ -96,7 +96,7 @@ public:
|
||||
{
|
||||
const osg::Matrix& inverse = getInverseMatrix();
|
||||
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.postMult(inverse);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ osg::Node* createHUD(osgText::Text* updateText)
|
||||
// eg to be used as a menuing/help system!
|
||||
// Can pick texts too!
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
|
||||
osg::Projection* projection = new osg::Projection;
|
||||
|
@ -84,7 +84,7 @@ osg::Node * createScalarBar_HUD()
|
||||
stateset->setRenderBinDetails(11, "RenderBin");
|
||||
|
||||
osg::MatrixTransform * modelview = new osg::MatrixTransform;
|
||||
modelview->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
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->addChild(geode);
|
||||
|
@ -525,7 +525,7 @@ osg::Node* createHUD()
|
||||
|
||||
// create the hud.
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
modelview_abs->addChild(geode);
|
||||
|
||||
|
@ -501,7 +501,7 @@ int main( int argc, char **argv )
|
||||
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
|
||||
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
|
||||
modelview_abs->addChild(createHUDText());
|
||||
|
@ -209,7 +209,7 @@ osg::Node* createHUD()
|
||||
|
||||
// create HUD
|
||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
|
||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE);
|
||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||
modelview_abs->addChild(group);
|
||||
|
||||
|
@ -38,13 +38,18 @@ class SG_EXPORT LightSource : public Group
|
||||
|
||||
enum ReferenceFrame
|
||||
{
|
||||
RELATIVE_TO_PARENTS,
|
||||
RELATIVE_TO_ABSOLUTE
|
||||
RELATIVE,
|
||||
ABSOLUTE
|
||||
#ifdef USE_DEPRECATED_API
|
||||
,
|
||||
RELATIVE_TO_PARENTS=RELATIVE,
|
||||
RELATIVE_TO_ABSOLUTE=ABSOLUTE,
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Set the light sources's ReferenceFrame, either to be relative to its
|
||||
* parent reference frame, or relative to an absolute coordinate
|
||||
* frame. RELATIVE_TO_PARENTS is the default.
|
||||
* frame. RELATIVE is the default.
|
||||
* Note: setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
||||
* also set the CullingActive flag on the light source, and hence all
|
||||
* of its parents, to false, thereby disabling culling of it and
|
||||
|
@ -89,13 +89,18 @@ class SG_EXPORT Transform : public Group
|
||||
|
||||
enum ReferenceFrame
|
||||
{
|
||||
RELATIVE_TO_PARENTS,
|
||||
RELATIVE_TO_ABSOLUTE
|
||||
RELATIVE,
|
||||
ABSOLUTE
|
||||
#ifdef USE_DEPRECATED_API
|
||||
,
|
||||
RELATIVE_TO_PARENTS=RELATIVE,
|
||||
RELATIVE_TO_ABSOLUTE=ABSOLUTE,
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Set the transform's ReferenceFrame, either to be relative to its
|
||||
* parent reference frame, or relative to an absolute coordinate
|
||||
* frame. RELATIVE_TO_PARENTS is the default.
|
||||
* frame. RELATIVE is the default.
|
||||
* Note: Setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
||||
* also set the CullingActive flag on the transform, and hence all
|
||||
* of its parents, to false, thereby disabling culling of it and
|
||||
@ -111,7 +116,7 @@ class SG_EXPORT Transform : public Group
|
||||
|
||||
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -124,7 +129,7 @@ class SG_EXPORT Transform : public Group
|
||||
|
||||
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ namespace osgParticle
|
||||
|
||||
inline void AccelOperator::beginOperate(Program *prg)
|
||||
{
|
||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
|
||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE) {
|
||||
xf_accel_ = prg->rotateLocalToWorld(accel_);
|
||||
} else {
|
||||
xf_accel_ = accel_;
|
||||
|
@ -86,7 +86,7 @@ namespace osgParticle
|
||||
|
||||
inline void AngularAccelOperator::beginOperate(Program *prg)
|
||||
{
|
||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
|
||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE) {
|
||||
xf_angular_accel_ = prg->rotateLocalToWorld(angular_accel_);
|
||||
} else {
|
||||
xf_angular_accel_ = angular_accel_;
|
||||
|
@ -87,7 +87,7 @@ namespace osgParticle
|
||||
|
||||
inline void ForceOperator::beginOperate(Program *prg)
|
||||
{
|
||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
|
||||
if (prg->getReferenceFrame() == ModularProgram::RELATIVE) {
|
||||
xf_force_ = prg->rotateLocalToWorld(force_);
|
||||
} else {
|
||||
xf_force_ = force_;
|
||||
|
@ -57,7 +57,7 @@ namespace osgParticle
|
||||
|
||||
/** 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
|
||||
for the current reference frame. If the reference frame is RELATIVE_TO_PARENTS, then your
|
||||
for the current reference frame. If the reference frame is RELATIVE, then your
|
||||
class should prepare itself to do all operations in local coordinates.
|
||||
*/
|
||||
virtual void beginOperate(Program *) {}
|
||||
|
@ -39,8 +39,13 @@ namespace osgParticle
|
||||
public:
|
||||
|
||||
enum ReferenceFrame {
|
||||
RELATIVE_TO_PARENTS,
|
||||
RELATIVE_TO_ABSOLUTE
|
||||
RELATIVE,
|
||||
ABSOLUTE
|
||||
#ifdef USE_DEPRECATED_API
|
||||
,
|
||||
RELATIVE_TO_PARENTS=RELATIVE,
|
||||
RELATIVE_TO_ABSOLUTE=ABSOLUTE,
|
||||
#endif
|
||||
};
|
||||
|
||||
ParticleProcessor();
|
||||
|
@ -45,7 +45,7 @@ bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_matrixDirty) computeMatrix();
|
||||
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.preMult(_cachedMatrix);
|
||||
}
|
||||
@ -59,7 +59,7 @@ bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
|
||||
bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.postMult(osg::Matrix::translate(-_position)*
|
||||
osg::Matrix::rotate(_rotation.inverse())*
|
||||
|
@ -321,7 +321,7 @@ bool Group::computeBound() const
|
||||
++itr)
|
||||
{
|
||||
const osg::Transform* transform = (*itr)->asTransform();
|
||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_PARENTS)
|
||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE)
|
||||
{
|
||||
bb.expandBy((*itr)->getBound());
|
||||
}
|
||||
@ -340,7 +340,7 @@ bool Group::computeBound() const
|
||||
++itr)
|
||||
{
|
||||
const osg::Transform* transform = (*itr)->asTransform();
|
||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_PARENTS)
|
||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE)
|
||||
{
|
||||
_bsphere.expandRadiusBy((*itr)->getBound());
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ using namespace osg;
|
||||
|
||||
LightSource::LightSource():
|
||||
_value(StateAttribute::ON),
|
||||
_referenceFrame(RELATIVE_TO_PARENTS)
|
||||
_referenceFrame(RELATIVE)
|
||||
{
|
||||
// switch off culling of light source nodes by default.
|
||||
setCullingActive(false);
|
||||
@ -33,7 +33,7 @@ LightSource::~LightSource()
|
||||
void LightSource::setReferenceFrame(ReferenceFrame rf)
|
||||
{
|
||||
_referenceFrame = rf;
|
||||
setCullingActive(_referenceFrame==RELATIVE_TO_PARENTS);
|
||||
setCullingActive(_referenceFrame==RELATIVE);
|
||||
}
|
||||
|
||||
void LightSource::setLight(Light* light)
|
||||
@ -62,7 +62,7 @@ bool LightSource::computeBound() const
|
||||
{
|
||||
Group::computeBound();
|
||||
|
||||
if (_light.valid() && _referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_light.valid() && _referenceFrame==RELATIVE)
|
||||
{
|
||||
const Vec4& pos = _light->getPosition();
|
||||
if (pos[3]!=0.0f)
|
||||
|
@ -29,7 +29,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp&
|
||||
|
||||
MatrixTransform::MatrixTransform(const Matrix& mat )
|
||||
{
|
||||
_referenceFrame = RELATIVE_TO_PARENTS;
|
||||
_referenceFrame = RELATIVE;
|
||||
|
||||
_matrix = mat;
|
||||
_inverseDirty = false;
|
||||
@ -42,7 +42,7 @@ MatrixTransform::~MatrixTransform()
|
||||
|
||||
bool MatrixTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.preMult(_matrix);
|
||||
}
|
||||
@ -57,7 +57,7 @@ bool MatrixTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) con
|
||||
{
|
||||
const Matrix& inverse = getInverseMatrix();
|
||||
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.postMult(inverse);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ PositionAttitudeTransform::PositionAttitudeTransform():
|
||||
|
||||
bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.preMult(osg::Matrix::translate(-_pivotPoint)*
|
||||
osg::Matrix::scale(_scale)*
|
||||
@ -41,7 +41,7 @@ bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVis
|
||||
|
||||
bool PositionAttitudeTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.postMult(osg::Matrix::translate(-_position)*
|
||||
osg::Matrix::rotate(_attitude.inverse())*
|
||||
|
@ -98,7 +98,7 @@ Matrix osg::computeEyeToLocal(const Matrix& modelview,const NodePath& nodePath)
|
||||
|
||||
Transform::Transform()
|
||||
{
|
||||
_referenceFrame = RELATIVE_TO_PARENTS;
|
||||
_referenceFrame = RELATIVE;
|
||||
}
|
||||
|
||||
Transform::Transform(const Transform& transform,const CopyOp& copyop):
|
||||
@ -118,7 +118,7 @@ void Transform::setReferenceFrame(ReferenceFrame rf)
|
||||
_referenceFrame = rf;
|
||||
|
||||
// switch off culling if transform is absolute.
|
||||
if (_referenceFrame==RELATIVE_TO_ABSOLUTE) setCullingActive(false);
|
||||
if (_referenceFrame==RELATIVE) setCullingActive(false);
|
||||
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());
|
||||
|
||||
if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
|
||||
if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE) {
|
||||
Fr = current_program_->rotateLocalToWorld(Fr);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ void osgParticle::ModularEmitter::emit(double dt)
|
||||
if (P) {
|
||||
placer_->place(P);
|
||||
shooter_->shoot(P);
|
||||
if (getReferenceFrame() == RELATIVE_TO_PARENTS) {
|
||||
if (getReferenceFrame() == RELATIVE) {
|
||||
P->transformPositionVelocity(getLocalToWorldMatrix());
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using namespace osg;
|
||||
|
||||
osgParticle::ParticleProcessor::ParticleProcessor()
|
||||
: osg::Node(),
|
||||
rf_(RELATIVE_TO_PARENTS),
|
||||
rf_(RELATIVE),
|
||||
enabled_(true),
|
||||
t0_(-1),
|
||||
ps_(0),
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Group>
|
||||
#include <osg/Timer>
|
||||
#include "sockinet.h"
|
||||
|
||||
/*
|
||||
@ -122,6 +123,10 @@ class NetReader : public osgDB::ReaderWriter
|
||||
|
||||
virtual ReadResult readFile(ObjectType objectType, const std::string& inFileName, const Options *options)
|
||||
{
|
||||
osg::Timer_t start = osg::Timer::instance()->tick();
|
||||
|
||||
osg::notify(osg::DEBUG_INFO) << "osgPlugin .net: start load" << inFileName << std::endl;
|
||||
|
||||
std::string hostname;
|
||||
std::string serverPrefix;
|
||||
std::string localCacheDir;
|
||||
@ -320,12 +325,15 @@ class NetReader : public osgDB::ReaderWriter
|
||||
|
||||
|
||||
|
||||
osg::notify(osg::DEBUG_INFO) << "osgPlugin .net: " << fileName <<
|
||||
" fetched from server." << std::endl;
|
||||
|
||||
if( reader != 0L )
|
||||
readResult = readFile(objectType, reader, sio, local_opt.get() );
|
||||
|
||||
double ms = osg::Timer::instance()->delta_m(start,osg::Timer::instance()->tick());
|
||||
|
||||
osg::notify(osg::DEBUG_INFO) << "osgPlugin .net: " << fileName <<
|
||||
" fetched from server. in" << ms <<" ms"<< std::endl;
|
||||
|
||||
if( !localCacheDir.empty() && cacheMode & Write )
|
||||
{
|
||||
std::string cacheFile = localCacheDir + '/' + fileName;
|
||||
|
@ -28,13 +28,13 @@ bool LightSource_readLocalData(Object& obj, Input& fr)
|
||||
LightSource& lightsource = static_cast<LightSource&>(obj);
|
||||
|
||||
if (fr[0].matchWord("referenceFrame")) {
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) {
|
||||
lightsource.setReferenceFrame(LightSource::RELATIVE_TO_ABSOLUTE);
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
||||
lightsource.setReferenceFrame(LightSource::ABSOLUTE);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS")) {
|
||||
lightsource.setReferenceFrame(LightSource::RELATIVE_TO_PARENTS);
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||
lightsource.setReferenceFrame(LightSource::RELATIVE);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
@ -58,12 +58,12 @@ bool LightSource_writeLocalData(const Object& obj, Output& fw)
|
||||
|
||||
fw.indent() << "referenceFrame ";
|
||||
switch (lightsource.getReferenceFrame()) {
|
||||
case LightSource::RELATIVE_TO_ABSOLUTE:
|
||||
case LightSource::ABSOLUTE:
|
||||
fw << "RELATIVE_TO_ABSOLUTE\n";
|
||||
break;
|
||||
case LightSource::RELATIVE_TO_PARENTS:
|
||||
case LightSource::RELATIVE:
|
||||
default:
|
||||
fw << "RELATIVE_TO_PARENTS\n";
|
||||
fw << "RELATIVE\n";
|
||||
};
|
||||
|
||||
if (lightsource.getLight()) fw.writeObject(*lightsource.getLight());
|
||||
|
@ -50,13 +50,13 @@ bool Transform_readLocalData(Object& obj, Input& fr)
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("referenceFrame")) {
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) {
|
||||
transform.setReferenceFrame(Transform::RELATIVE_TO_ABSOLUTE);
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE") ) {
|
||||
transform.setReferenceFrame(Transform::ABSOLUTE);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS")) {
|
||||
transform.setReferenceFrame(Transform::RELATIVE_TO_PARENTS);
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||
transform.setReferenceFrame(Transform::RELATIVE);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
@ -72,12 +72,12 @@ bool Transform_writeLocalData(const Object& obj, Output& fw)
|
||||
|
||||
fw.indent() << "referenceFrame ";
|
||||
switch (transform.getReferenceFrame()) {
|
||||
case Transform::RELATIVE_TO_ABSOLUTE:
|
||||
fw << "RELATIVE_TO_ABSOLUTE\n";
|
||||
case Transform::ABSOLUTE:
|
||||
fw << "ABSOLUTE\n";
|
||||
break;
|
||||
case Transform::RELATIVE_TO_PARENTS:
|
||||
case Transform::RELATIVE:
|
||||
default:
|
||||
fw << "RELATIVE_TO_PARENTS\n";
|
||||
fw << "RELATIVE\n";
|
||||
};
|
||||
|
||||
return true;
|
||||
|
@ -51,13 +51,13 @@ bool ParticleProcessor_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("referenceFrame")) {
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) {
|
||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_TO_ABSOLUTE);
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::ABSOLUTE);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS")) {
|
||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_TO_PARENTS);
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
@ -129,12 +129,12 @@ bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
fw.indent() << "referenceFrame ";
|
||||
switch (myobj.getReferenceFrame())
|
||||
{
|
||||
case osgParticle::ParticleProcessor::RELATIVE_TO_ABSOLUTE:
|
||||
fw << "RELATIVE_TO_ABSOLUTE" << std::endl;
|
||||
case osgParticle::ParticleProcessor::ABSOLUTE:
|
||||
fw << "ABSOLUTE" << std::endl;
|
||||
break;
|
||||
case osgParticle::ParticleProcessor::RELATIVE_TO_PARENTS:
|
||||
case osgParticle::ParticleProcessor::RELATIVE:
|
||||
default:
|
||||
fw << "RELATIVE_TO_PARENTS" << std::endl;
|
||||
fw << "RELATIVE" << std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "endless ";
|
||||
|
@ -468,11 +468,11 @@ void Viewer::setUpViewer(unsigned int options)
|
||||
lightsource->setLight(light);
|
||||
if (options & HEAD_LIGHT_SOURCE)
|
||||
{
|
||||
lightsource->setReferenceFrame(osg::LightSource::RELATIVE_TO_ABSOLUTE); // headlight.
|
||||
lightsource->setReferenceFrame(osg::LightSource::ABSOLUTE); // headlight.
|
||||
}
|
||||
else
|
||||
{
|
||||
lightsource->setReferenceFrame(osg::LightSource::RELATIVE_TO_PARENTS); // skylight
|
||||
lightsource->setReferenceFrame(osg::LightSource::RELATIVE); // skylight
|
||||
}
|
||||
lightsource->setLocalStateSetModes(osg::StateAttribute::ON);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ bool DOFTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisito
|
||||
l2w.postMult(getInversePutMatrix());
|
||||
|
||||
// finally.
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
matrix.preMult(l2w);
|
||||
}
|
||||
@ -209,7 +209,7 @@ bool DOFTransform::computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisito
|
||||
//and impose inverse put:
|
||||
w2l.postMult(getPutMatrix());
|
||||
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
if (_referenceFrame==RELATIVE)
|
||||
{
|
||||
//finally:
|
||||
matrix.postMult(w2l);
|
||||
|
@ -830,7 +830,7 @@ void CullVisitor::apply(LightSource& node)
|
||||
StateAttribute* light = node.getLight();
|
||||
if (light)
|
||||
{
|
||||
if (node.getReferenceFrame()==osg::LightSource::RELATIVE_TO_PARENTS)
|
||||
if (node.getReferenceFrame()==osg::LightSource::RELATIVE)
|
||||
{
|
||||
RefMatrix& matrix = getModelViewMatrix();
|
||||
addPositionedAttribute(&matrix,light);
|
||||
|
@ -625,7 +625,7 @@ class CollectLowestTransformsVisitor : public osg::NodeVisitor
|
||||
if (transform)
|
||||
{
|
||||
if (transform->getDataVariance()==osg::Transform::DYNAMIC) _moreThanOneMatrixRequired=true;
|
||||
else if (transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_ABSOLUTE) _moreThanOneMatrixRequired=true;
|
||||
else if (transform->getReferenceFrame()==osg::Transform::RELATIVE) _moreThanOneMatrixRequired=true;
|
||||
else
|
||||
{
|
||||
if (_transformSet.empty()) transform->computeLocalToWorldMatrix(_firstMatrix,0);
|
||||
|
Loading…
Reference in New Issue
Block a user