Changed the ReferenceFrame enums to be RELEATIVE and ABSOLUTE, and
deprecated the RELATIVE_TO_ABSOLUTE and RELATIVE_TO_PARENTS.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user