Ran script to remove trailing spaces and tabs

This commit is contained in:
Robert Osfield
2012-03-21 17:36:20 +00:00
parent 1e35f8975d
commit 14a563dc9f
1495 changed files with 21873 additions and 21873 deletions

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/AnimationPath>
@@ -27,7 +27,7 @@ void AnimationPath::insert(double time,const ControlPoint& controlPoint)
bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const
{
if (_timeControlPointMap.empty()) return false;
switch(_loopMode)
{
case(SWING):
@@ -35,7 +35,7 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro
double modulated_time = (time - getFirstTime())/(getPeriod()*2.0);
double fraction_part = modulated_time - floor(modulated_time);
if (fraction_part>0.5) fraction_part = 1.0-fraction_part;
time = getFirstTime()+(fraction_part*2.0) * getPeriod();
break;
}
@@ -50,8 +50,8 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro
// no need to modulate the time.
break;
}
TimeControlPointMap::const_iterator second = _timeControlPointMap.lower_bound(time);
if (second==_timeControlPointMap.begin())
@@ -61,8 +61,8 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro
else if (second!=_timeControlPointMap.end())
{
TimeControlPointMap::const_iterator first = second;
--first;
--first;
// we have both a lower bound and the next item.
// delta_time = second.time - first.time
@@ -75,7 +75,7 @@ bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& contro
controlPoint.interpolate((time - first->first)/delta_time,
first->second,
second->second);
}
}
}
else // (second==_timeControlPointMap.end())
{
@@ -138,13 +138,13 @@ AnimationPathCallback::AnimationPathCallback(const osg::Vec3d& pivot,const osg::
double time2 = osg::PI*1.0/angularVelocity;
double time3 = osg::PI*1.5/angularVelocity;
double time4 = osg::PI*2.0/angularVelocity;
osg::Quat rotation0(0.0, axis);
osg::Quat rotation1(osg::PI*0.5, axis);
osg::Quat rotation2(osg::PI*1.0, axis);
osg::Quat rotation3(osg::PI*1.5, axis);
_animationPath->insert(time0,osg::AnimationPath::ControlPoint(pivot,rotation0));
_animationPath->insert(time1,osg::AnimationPath::ControlPoint(pivot,rotation1));
_animationPath->insert(time2,osg::AnimationPath::ControlPoint(pivot,rotation2));
@@ -168,10 +168,10 @@ class AnimationPathCallbackVisitor : public NodeVisitor
_cp.getInverse(matrix);
else
_cp.getMatrix(matrix);
camera.setViewMatrix(osg::Matrix::translate(-_pivotPoint)*matrix);
}
virtual void apply(CameraView& cv)
{
@@ -182,7 +182,7 @@ class AnimationPathCallbackVisitor : public NodeVisitor
cv.setPosition(matrix.getTrans());
cv.setAttitude(_cp.getRotation().inverse());
cv.setFocalLength(1.0f/_cp.getScale().x());
}
else
{
@@ -199,10 +199,10 @@ class AnimationPathCallbackVisitor : public NodeVisitor
_cp.getInverse(matrix);
else
_cp.getMatrix(matrix);
mt.setMatrix(osg::Matrix::translate(-_pivotPoint)*matrix);
}
virtual void apply(PositionAttitudeTransform& pat)
{
if (_useInverseMatrix)
@@ -213,7 +213,7 @@ class AnimationPathCallbackVisitor : public NodeVisitor
pat.setAttitude(_cp.getRotation().inverse());
pat.setScale(osg::Vec3(1.0f/_cp.getScale().x(),1.0f/_cp.getScale().y(),1.0f/_cp.getScale().z()));
pat.setPivotPoint(_pivotPoint);
}
else
{
@@ -223,16 +223,16 @@ class AnimationPathCallbackVisitor : public NodeVisitor
pat.setPivotPoint(_pivotPoint);
}
}
AnimationPath::ControlPoint _cp;
osg::Vec3d _pivotPoint;
bool _useInverseMatrix;
bool _useInverseMatrix;
};
void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv)
{
if (_animationPath.valid() &&
nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
if (_animationPath.valid() &&
nv->getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getSimulationTime();
@@ -245,7 +245,7 @@ void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv)
update(*node);
}
}
// must call any nested node callbacks and continue subgraph traversal.
NodeCallback::traverse(node,nv);
}
@@ -283,7 +283,7 @@ void AnimationPathCallback::setPause(bool pause)
{
return;
}
_pause = pause;
if (_firstTime==DBL_MAX) return;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -100,7 +100,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u
unsigned int explanationWidth = fullWidth-explanationPos;
std::string line;
for(citr=um.begin();
citr!=um.end();
++citr)
@@ -135,7 +135,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u
currentEndPos = 0;
}
}
const std::string& explanation = citr->second;
std::string::size_type pos = 0;
std::string::size_type offset = 0;
@@ -175,7 +175,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u
++extraSkip;
firstInLine = true;
}
else if (slashn_pos==pos+width)
else if (slashn_pos==pos+width)
{
++extraSkip;
firstInLine = true;
@@ -186,8 +186,8 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u
{
// now reduce width until we get a space or a return
// so that we ensure that whole words are printed.
while (width>0 &&
explanation[pos+width]!=' ' &&
while (width>0 &&
explanation[pos+width]!=' ' &&
explanation[pos+width]!='\n') --width;
if (width==0)
@@ -238,7 +238,7 @@ void ApplicationUsage::write(std::ostream& output, unsigned int type, unsigned i
write(output,getCommandLineOptions(),widthOfOutput,showDefaults,getCommandLineOptionsDefaults());
needspace = true;
}
if ((type&ENVIRONMENTAL_VARIABLE) && !getEnvironmentalVariables().empty())
{
if (needspace) output << std::endl;
@@ -274,10 +274,10 @@ void ApplicationUsage::writeEnvironmentSettings(std::ostream& output)
if (len == std::string::npos) len = citr->first.size();
maxNumCharsInOptions = maximum( maxNumCharsInOptions,static_cast<unsigned int>(len));
}
unsigned int optionPos = 2;
std::string line;
for(citr=getEnvironmentalVariables().begin();
citr!=getEnvironmentalVariables().end();
++citr)

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -57,7 +57,7 @@ bool ArgumentParser::isNumber(const char* str)
int noZeroToNine = 0;
const char* ptr = str;
// check if could be a hex number.
if (strncmp(ptr,"0x",2)==0)
{
@@ -67,17 +67,17 @@ bool ArgumentParser::isNumber(const char* str)
while (
*ptr!=0 &&
((*ptr>='0' && *ptr<='9') ||
(*ptr>='a' && *ptr<='f') ||
(*ptr>='a' && *ptr<='f') ||
(*ptr>='A' && *ptr<='F'))
)
{
++ptr;
}
// got to end of string without failure, therefore must be a hex integer.
if (*ptr==0) return true;
}
ptr = str;
// check if a float or an int.
@@ -136,7 +136,7 @@ bool ArgumentParser::isNumber(const char* str)
if (couldBeFloat && noZeroToNine>0) return true;
return false;
}
bool ArgumentParser::Parameter::valid(const char* str) const
@@ -186,12 +186,12 @@ ArgumentParser::ArgumentParser(int* argc,char **argv):
_usage(ApplicationUsage::instance())
{
#ifdef __APPLE__
//On OSX, any -psn arguments need to be removed because they will
//On OSX, any -psn arguments need to be removed because they will
// confuse the application. -psn plus a concatenated argument are
// passed by the finder to application bundles
for(int pos=1;pos<this->argc();++pos)
{
if (std::string(_argv[pos]).compare(0, 4, std::string("-psn")) == 0)
if (std::string(_argv[pos]).compare(0, 4, std::string("-psn")) == 0)
{
remove(pos, 1);
}
@@ -215,7 +215,7 @@ std::string ArgumentParser::getApplicationName() const
return "";
}
bool ArgumentParser::isOption(int pos) const
{
return pos<*_argc && isOption(_argv[pos]);
@@ -263,7 +263,7 @@ bool ArgumentParser::containsOptions() const
void ArgumentParser::remove(int pos,int num)
{
if (num==0) return;
for(;pos+num<*_argc;++pos)
{
_argv[pos]=_argv[pos+num];
@@ -594,7 +594,7 @@ void ArgumentParser::reportError(const std::string& message,ErrorSeverity severi
void ArgumentParser::reportRemainingOptionsAsUnrecognized(ErrorSeverity severity)
{
std::set<std::string> options;
if (_usage.valid())
if (_usage.valid())
{
// parse the usage options to get all the option that the application can potential handle.
for(ApplicationUsage::UsageMap::const_iterator itr=_usage->getCommandLineOptions().begin();
@@ -605,25 +605,25 @@ void ArgumentParser::reportRemainingOptionsAsUnrecognized(ErrorSeverity severity
std::string::size_type prevpos = 0, pos = 0;
while ((pos=option.find(' ',prevpos))!=std::string::npos)
{
if (option[prevpos]=='-')
if (option[prevpos]=='-')
{
options.insert(std::string(option,prevpos,pos-prevpos));
}
prevpos=pos+1;
}
if (option[prevpos]=='-')
if (option[prevpos]=='-')
{
options.insert(std::string(option,prevpos,std::string::npos));
}
}
}
for(int pos=1;pos<argc();++pos)
{
// if an option and havn't been previous querried for report as unrecognized.
if (isOption(pos) && options.find(_argv[pos])==options.end())
if (isOption(pos) && options.find(_argv[pos])==options.end())
{
reportError(std::string("unrecognized option ")+std::string(_argv[pos]),severity);
}
@@ -642,7 +642,7 @@ void ArgumentParser::writeErrorMessages(std::ostream& output,ErrorSeverity sever
}
}
ApplicationUsage::Type ArgumentParser::readHelpType()
ApplicationUsage::Type ArgumentParser::readHelpType()
{
getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available");

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Array>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ArrayDispatchers>
@@ -518,7 +518,7 @@ void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit)
#if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)
Drawable::Extensions* extensions = Drawable::getExtensions(_state->getContextID(),true);
#endif
for(unsigned int i=_texCoordDispatchers.size(); i<=unit; ++i)
{
_texCoordDispatchers.push_back(new AttributeDispatchMap(_glBeginEndAdapter));

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/AutoTransform>
@@ -58,13 +58,13 @@ AutoTransform::AutoTransform(const AutoTransform& pat,const CopyOp& copyop):
_cachedMode(pat._cachedMode),
_side(pat._side)
{
// setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
// setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
}
void AutoTransform::setAutoRotateMode(AutoRotateMode mode)
{
_autoRotateMode = mode;
_firstTimeToInitEyePoint = true;
{
_autoRotateMode = mode;
_firstTimeToInitEyePoint = true;
_cachedMode = CACHE_DIRTY;
updateCache();
}
@@ -93,23 +93,23 @@ void AutoTransform::updateCache()
else _cachedMode = ROTATE_TO_AXIS;
}
else _cachedMode = _autoRotateMode;
_side = _axis^_normal;
_side.normalize();
_side.normalize();
}
void AutoTransform::setScale(const Vec3d& scale)
{
_scale = scale;
_scale = scale;
if (_scale.x()<_minimumScale) _scale.x() = _minimumScale;
if (_scale.y()<_minimumScale) _scale.y() = _minimumScale;
if (_scale.z()<_minimumScale) _scale.z() = _minimumScale;
if (_scale.x()>_maximumScale) _scale.x() = _maximumScale;
if (_scale.y()>_maximumScale) _scale.y() = _maximumScale;
if (_scale.z()>_maximumScale) _scale.z() = _maximumScale;
_matrixDirty=true;
_matrixDirty=true;
dirtyBound();
}
@@ -117,7 +117,7 @@ void AutoTransform::setScale(const Vec3d& scale)
bool AutoTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_matrixDirty) computeMatrix();
if (_referenceFrame==RELATIVE_RF)
{
matrix.preMult(_cachedMatrix);
@@ -155,18 +155,18 @@ bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
void AutoTransform::computeMatrix() const
{
if (!_matrixDirty) return;
_cachedMatrix.makeRotate(_rotation);
_cachedMatrix.postMultTranslate(_position);
_cachedMatrix.preMultScale(_scale);
_cachedMatrix.preMultTranslate(-_pivotPoint);
_matrixDirty = false;
}
void AutoTransform::accept(NodeVisitor& nv)
{
if (nv.validNodeMask(*this))
if (nv.validNodeMask(*this))
{
// if app traversal update the frame count.
if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR)
@@ -190,8 +190,8 @@ void AutoTransform::accept(NodeVisitor& nv)
height = viewport->height();
}
osg::Vec3d eyePoint = cs->getEyeLocal();
osg::Vec3d localUp = cs->getUpLocal();
osg::Vec3d eyePoint = cs->getEyeLocal();
osg::Vec3d localUp = cs->getUpLocal();
osg::Vec3d position = getPosition();
const osg::Matrix& projection = *(cs->getProjectionMatrix());
@@ -215,30 +215,30 @@ void AutoTransform::accept(NodeVisitor& nv)
{
doUpdate = true;
}
else if (projection != _previousProjection)
else if (projection != _previousProjection)
{
doUpdate = true;
}
else if (position != _previousPosition)
{
doUpdate = true;
}
}
else if (position != _previousPosition)
{
doUpdate = true;
}
}
_firstTimeToInitEyePoint = false;
if (doUpdate)
{
{
if (getAutoScaleToScreen())
{
double size = 1.0/cs->pixelSize(getPosition(),0.48f);
if (_autoScaleTransitionWidthRatio>0.0)
{
{
if (_minimumScale>0.0)
{
double j = _minimumScale;
double i = (_maximumScale<DBL_MAX) ?
double i = (_maximumScale<DBL_MAX) ?
_minimumScale+(_maximumScale-_minimumScale)*_autoScaleTransitionWidthRatio :
_minimumScale*(1.0+_autoScaleTransitionWidthRatio);
double c = 1.0/(4.0*(i-j));
@@ -263,9 +263,9 @@ void AutoTransform::accept(NodeVisitor& nv)
if (size>p) size = _maximumScale;
else if (size>m) size = a + b*size + c*(size*size);
}
}
}
setScale(size);
}
@@ -275,7 +275,7 @@ void AutoTransform::accept(NodeVisitor& nv)
osg::Quat rotation;
osg::Vec3d scale;
osg::Quat so;
cs->getModelViewMatrix()->decompose( translation, rotation, scale, so );
setRotation(rotation.inverse());
@@ -350,7 +350,7 @@ void AutoTransform::accept(NodeVisitor& nv)
}
break;
}
case(ROTATE_TO_AXIS): // need to implement
case(ROTATE_TO_AXIS): // need to implement
{
float ev_side = ev*_side;
float ev_normal = ev*_normal;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <stdio.h>
@@ -94,12 +94,12 @@ void Billboard::updateCache()
{
if(_axis==Vec3(0.0f, 0.0, 1.0f) && _normal==Vec3(0.0f, -1.0f, 0.0f)) _cachedMode = POINT_ROT_WORLD_Z_AXIS;
else _cachedMode = _mode;
}
else _cachedMode = _mode;
_side = _axis^_normal;
_side.normalize();
_side.normalize();
}
bool Billboard::addDrawable(Drawable *gset)
@@ -215,7 +215,7 @@ bool Billboard::computeMatrix(Matrix& modelview, const Vec3& eye_local, const Ve
}
break;
}
case(AXIAL_ROT): // need to implement
case(AXIAL_ROT): // need to implement
{
float ev_side = ev*_side;
float ev_normal = ev*_normal;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/BlendColor>
@@ -35,12 +35,12 @@ BlendColor::~BlendColor()
void BlendColor::apply(State& state) const
{
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
if (!extensions->isBlendColorSupported())
{
OSG_WARN<<"Warning: BlendColor::apply(..) failed, BlendColor is not support by OpenGL driver."<<std::endl;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/BlendEquation>
@@ -44,12 +44,12 @@ BlendEquation::~BlendEquation()
void BlendEquation::apply(State& state) const
{
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
if (!extensions->isBlendEquationSupported())
{
OSG_WARN<<"Warning: BlendEquation::apply(..) failed, BlendEquation is not support by OpenGL driver."<<std::endl;
@@ -125,12 +125,12 @@ void BlendEquation::Extensions::lowestCommonDenominator(const Extensions& rhs)
void BlendEquation::Extensions::setupGLExtensions(unsigned int contextID)
{
bool bultInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;
_isBlendEquationSupported = bultInSupport ||
isGLExtensionSupported(contextID, "GL_EXT_blend_equation") ||
_isBlendEquationSupported = bultInSupport ||
isGLExtensionSupported(contextID, "GL_EXT_blend_equation") ||
strncmp((const char*)glGetString(GL_VERSION), "1.2", 3) >= 0;
_isBlendEquationSeparateSupported = bultInSupport ||
isGLExtensionSupported(contextID, "GL_EXT_blend_equation_separate") ||
isGLExtensionSupported(contextID, "GL_EXT_blend_equation_separate") ||
strncmp((const char*)glGetString(GL_VERSION), "2.0", 3) >= 0;
_isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "GL_SGIX_blend_alpha_minmax");

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/BlendFunc>
@@ -50,7 +50,7 @@ void BlendFunc::apply(State& state) const
if (_source_factor != _source_factor_alpha ||
_destination_factor != _destination_factor_alpha)
{
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();

View File

@@ -1,14 +1,14 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2010 Tim Moore
* Copyright (C) 2010 Tim Moore
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/

View File

@@ -206,7 +206,7 @@ void GLBufferObject::compileBuffer()
const osg::Image* image = entry.dataSource->asImage();
if (image && !(image->isDataContiguous()))
{
{
unsigned int offset = entry.offset;
for(osg::Image::DataIterator img_itr(image); img_itr.valid(); ++img_itr)
{
@@ -216,7 +216,7 @@ void GLBufferObject::compileBuffer()
}
}
else
{
{
_extensions->glBufferSubData(_profile._target, (GLintptrARB)entry.offset, (GLsizeiptrARB)entry.dataSize, entry.dataSource->getDataPointer());
}
@@ -665,7 +665,7 @@ void GLBufferObjectSet::flushDeletedGLBufferObjects(double currentTime, double&
OSG_INFO<<"Plenty of space in GLBufferObject pool"<<std::endl;
return;
}
// if nothing to delete return
if (_orphanedGLBufferObjects.empty()) return;
@@ -1598,7 +1598,7 @@ PixelDataBufferObject::~PixelDataBufferObject()
//--------------------------------------------------------------------------------
void PixelDataBufferObject::compileBuffer(State& state) const
{
unsigned int contextID = state.getContextID();
unsigned int contextID = state.getContextID();
if ( _profile._size == 0) return;
GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
@@ -1612,7 +1612,7 @@ void PixelDataBufferObject::compileBuffer(State& state) const
//--------------------------------------------------------------------------------
void PixelDataBufferObject::bindBufferInReadMode(State& state)
{
unsigned int contextID = state.getContextID();
unsigned int contextID = state.getContextID();
GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
if (!bo) return;
@@ -1627,7 +1627,7 @@ void PixelDataBufferObject::bindBufferInReadMode(State& state)
//--------------------------------------------------------------------------------
void PixelDataBufferObject::bindBufferInWriteMode(State& state)
{
unsigned int contextID = state.getContextID();
unsigned int contextID = state.getContextID();
GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
if (!bo) return;
@@ -1641,7 +1641,7 @@ void PixelDataBufferObject::bindBufferInWriteMode(State& state)
//--------------------------------------------------------------------------------
void PixelDataBufferObject::unbindBuffer(unsigned int contextID) const
{
{
GLBufferObject::Extensions* extensions = GLBufferObject::getExtensions(contextID,true);
switch(_mode[contextID])

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/CameraView>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ClampColor>
@@ -40,12 +40,12 @@ ClampColor::~ClampColor()
void ClampColor::apply(State& state) const
{
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
if (!extensions->isClampColorSupported())
{
OSG_WARN<<"Warning: ClampColor::apply(..) failed, ClampColor is not support by OpenGL driver."<<std::endl;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ClearNode>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ClipNode>
@@ -73,7 +73,7 @@ void ClipNode::createClipBox(const BoundingBox& bb,unsigned int clipPlaneNumberB
_stateset->setAssociatedModes(_planes.back().get(), _value);
}
// Add a ClipPlane to a ClipNode. Return true if plane is added,
// Add a ClipPlane to a ClipNode. Return true if plane is added,
// return false if plane already exists in ClipNode, or clipplane is false.
bool ClipNode::addClipPlane(ClipPlane* clipplane)
{
@@ -93,7 +93,7 @@ bool ClipNode::addClipPlane(ClipPlane* clipplane)
}
}
// Remove ClipPlane from a ClipNode. Return true if plane is removed,
// Remove ClipPlane from a ClipNode. Return true if plane is removed,
// return false if plane does not exists in ClipNode.
bool ClipNode::removeClipPlane(ClipPlane* clipplane)
{
@@ -113,7 +113,7 @@ bool ClipNode::removeClipPlane(ClipPlane* clipplane)
}
}
// Remove ClipPlane, at specified index, from a ClipNode. Return true if plane is removed,
// Remove ClipPlane, at specified index, from a ClipNode. Return true if plane is removed,
// return false if plane does not exists in ClipNode.
bool ClipNode::removeClipPlane(unsigned int pos)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ClipPlane>
@@ -54,7 +54,7 @@ void ClipPlane::setClipPlaneNum(unsigned int num)
osg::StateSet* stateset = *itr;
stateset->removeAttribute(this);
}
// assign the clip plane number
_clipPlaneNum = num;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ClusterCullingCallback>
@@ -63,18 +63,18 @@ struct ComputeAveragesFunctor
if (normal.normalize()!=0.0f)
{
_normal += normal;
}
}
_center += v1;
_center += v2;
_center += v3;
++_num;
}
osg::Vec3 center() { return _center / (double)(3*_num); }
osg::Vec3 normal() { _normal.normalize(); return _normal; }
unsigned int _num;
Vec3d _center;
Vec3d _normal;
@@ -86,7 +86,7 @@ struct ComputeDeviationFunctor
ComputeDeviationFunctor():
_deviation(1.0),
_radius2(0.0) {}
void set(const osg::Vec3& center,const osg::Vec3& normal)
{
_center = center;
@@ -117,27 +117,27 @@ void ClusterCullingCallback::computeFrom(const osg::Drawable* drawable)
{
TriangleFunctor<ComputeAveragesFunctor> caf;
drawable->accept(caf);
_controlPoint = caf.center();
_normal = caf.normal();
TriangleFunctor<ComputeDeviationFunctor> cdf;
cdf.set(_controlPoint,_normal);
drawable->accept(cdf);
// OSG_NOTICE<<"ClusterCullingCallback::computeFrom() _controlPoint="<<_controlPoint<<std::endl;
// OSG_NOTICE<<" _normal="<<_normal<<std::endl;
// OSG_NOTICE<<" cdf._deviation="<<cdf._deviation<<std::endl;
if (_normal.length2()==0.0) _deviation = -1.0f;
else
else
{
float angle = acosf(cdf._deviation)+osg::PI*0.5f;
if (angle<osg::PI) _deviation = cosf(angle);
else _deviation = -1.0f;
}
_radius = sqrtf(cdf._radius2);
}
@@ -171,16 +171,16 @@ bool ClusterCullingCallback::cull(osg::NodeVisitor* nv, osg::Drawable* , osg::St
// cluster culling switch off by deviation.
return false;
}
osg::Vec3 eye_cp = nv->getViewPoint() - _controlPoint;
float radius = eye_cp.length();
if (radius<_radius)
{
return false;
}
float deviation = (eye_cp * _normal)/radius;
// OSG_NOTICE<<"ClusterCullingCallback::cull() _normal="<<_normal<<" _controlPointtest="<<_controlPoint<<" eye_cp="<<eye_cp<<std::endl;
@@ -195,7 +195,7 @@ void ClusterCullingCallback::operator()(Node* node, NodeVisitor* nv)
if (nv)
{
if (cull(nv,0,static_cast<State *>(0))) return;
traverse(node,nv);
traverse(node,nv);
}
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/CollectOccludersVisitor>
@@ -29,11 +29,11 @@ CollectOccludersVisitor::CollectOccludersVisitor():
NEAR_PLANE_CULLING|
FAR_PLANE_CULLING|
SMALL_FEATURE_CULLING);
_minimumShadowOccluderVolume = 0.005f;
_maximumNumberOfActiveOccluders = 10;
_createDrawables = false;
}
CollectOccludersVisitor::~CollectOccludersVisitor()
@@ -62,7 +62,7 @@ float CollectOccludersVisitor::getDistanceFromEyePoint(const Vec3& pos, bool wit
{
const Matrix& matrix = *_modelviewStack.back();
float dist = -(pos[0]*matrix(0,2)+pos[1]*matrix(1,2)+pos[2]*matrix(2,2)+matrix(3,2));
if (withLODScale) return dist*getLODScale();
else return dist*getLODScale();
}
@@ -73,9 +73,9 @@ void CollectOccludersVisitor::apply(osg::Node& node)
// push the culling mode.
pushCurrentMask();
handle_cull_callbacks_and_traverse(node);
// pop the culling mode.
popCurrentMask();
}
@@ -90,7 +90,7 @@ void CollectOccludersVisitor::apply(osg::Transform& node)
ref_ptr<osg::RefMatrix> matrix = createOrReuseMatrix(*getModelViewMatrix());
node.computeLocalToWorldMatrix(*matrix,this);
pushModelViewMatrix(matrix.get(), node.getReferenceFrame());
handle_cull_callbacks_and_traverse(node);
popModelViewMatrix();
@@ -108,7 +108,7 @@ void CollectOccludersVisitor::apply(osg::Projection& node)
ref_ptr<osg::RefMatrix> matrix = createOrReuseMatrix(node.getMatrix());
pushProjectionMatrix(matrix.get());
handle_cull_callbacks_and_traverse(node);
popProjectionMatrix();
@@ -140,7 +140,7 @@ void CollectOccludersVisitor::apply(osg::OccluderNode& node)
// need to check if occlusion node is in the occluder
// list, if so disable the appropriate ShadowOccluderVolume
disableAndPushOccludersCurrentMask(_nodePath);
if (isCulled(node))
{
@@ -164,7 +164,7 @@ void CollectOccludersVisitor::apply(osg::OccluderNode& node)
ShadowVolumeOccluder svo;
if (svo.computeOccluder(_nodePath, *node.getOccluder(), *this,_createDrawables))
{
if (svo.getVolume()>_minimumShadowOccluderVolume)
{
// need to test occluder against view frustum.
@@ -182,7 +182,7 @@ void CollectOccludersVisitor::apply(osg::OccluderNode& node)
// pop the culling mode.
popCurrentMask();
// pop the current mask for the disabled occluder
popOccludersCurrentMask(_nodePath);
}
@@ -190,9 +190,9 @@ void CollectOccludersVisitor::apply(osg::OccluderNode& node)
void CollectOccludersVisitor::removeOccludedOccluders()
{
if (_occluderSet.empty()) return;
ShadowVolumeOccluderSet::iterator occludeeItr=_occluderSet.begin();
// skip the first element as this can't be occluded by anything else.
occludeeItr++;
@@ -201,7 +201,7 @@ void CollectOccludersVisitor::removeOccludedOccluders()
occludeeItr!=_occluderSet.end();
++occludeeItr)
{
// search for any occluders that occlude the current occluder,
// we only need to test any occluder near the front of the set since
// you can't be occluder by something smaller than you.
@@ -224,8 +224,8 @@ void CollectOccludersVisitor::removeOccludedOccluders()
_occluderSet.erase(eraseItr);
break;
}
// now check all the holes in the occludee against the occluder,
// now check all the holes in the occludee against the occluder,
// do so in reverse order so that the iterators remain valid.
for(ShadowVolumeOccluder::HoleList::reverse_iterator holeItr=holeList.rbegin();
holeItr!=holeList.rend();
@@ -239,21 +239,21 @@ void CollectOccludersVisitor::removeOccludedOccluders()
{
++holeItr;
}
}
}
}
if (_occluderSet.size()<=_maximumNumberOfActiveOccluders) return;
// move the iterator to the _maximumNumberOfActiveOccluders th occluder.
occludeeItr = _occluderSet.begin();
for(unsigned int i=0;i<_maximumNumberOfActiveOccluders;++i)
++occludeeItr;
// discard last occluders.
_occluderSet.erase(occludeeItr,_occluderSet.end());
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ColorMask>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLExtensions>
@@ -31,7 +31,7 @@ void ColorMatrix::apply(State& state) const
{
#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)
unsigned int contextID = state.getContextID();
static bool s_ARB_imaging = isGLExtensionSupported(contextID,"GL_ARB_imaging");
if (s_ARB_imaging)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ConvexPlanarOccluder>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/ConvexPlanarPolygon>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -47,8 +47,8 @@ CoordinateFrame CoordinateSystemNode::computeLocalCoordinateFrame(const Vec3d& p
if (_ellipsoidModel.valid())
{
Matrixd localToWorld;
double latitude, longitude, height;
double latitude, longitude, height;
_ellipsoidModel->convertXYZToLatLongHeight(position.x(),position.y(),position.z(),latitude, longitude, height);
_ellipsoidModel->computeLocalToWorldTransformFromLatLongHeight(latitude, longitude, 0.0f, localToWorld);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/CopyOp>
@@ -29,7 +29,7 @@ TYPE* CopyOp::operator() (const TYPE* obj) const \
return osg::clone(obj, *this); \
else \
return const_cast<TYPE*>(obj); \
}
}
COPY_OP( Object, DEEP_COPY_OBJECTS )
COPY_OP( Node, DEEP_COPY_NODES )
@@ -57,7 +57,7 @@ StateAttribute* CopyOp::operator() (const StateAttribute* attr) const
{
return operator()(textbase);
}
else
else
{
return osg::clone(attr, *this);
}
@@ -76,7 +76,7 @@ NodeCallback* CopyOp::operator() (const NodeCallback* nc) const
first->setNestedCallback(0);
nc = nc->getNestedCallback();
while (nc)
while (nc)
{
osg::NodeCallback* ucb = osg::clone(nc, *this);
if (ucb)

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <stdlib.h>
@@ -64,7 +64,7 @@ void CullSettings::setCullSettings(const CullSettings& rhs)
_impostorActive = rhs._impostorActive;
_depthSortImpostorSprites = rhs._depthSortImpostorSprites;
_impostorPixelErrorThreshold = rhs._impostorPixelErrorThreshold;
_numFramesToKeepImpostorSprites = rhs._numFramesToKeepImpostorSprites;
_numFramesToKeepImpostorSprites = rhs._numFramesToKeepImpostorSprites;
_cullMask = rhs._cullMask;
_cullMaskLeft = rhs._cullMaskLeft;
@@ -98,7 +98,7 @@ void CullSettings::readEnvironmentalVariables()
OSG_INFO<<"CullSettings::readEnvironmentalVariables()"<<std::endl;
char *ptr;
if ((ptr = getenv("OSG_COMPUTE_NEAR_FAR_MODE")) != 0)
{
if (strcmp(ptr,"DO_NOT_COMPUTE_NEAR_FAR")==0) _computeNearFar = DO_NOT_COMPUTE_NEAR_FAR;
@@ -106,16 +106,16 @@ void CullSettings::readEnvironmentalVariables()
else if (strcmp(ptr,"COMPUTE_NEAR_FAR_USING_PRIMITIVES")==0) _computeNearFar = COMPUTE_NEAR_FAR_USING_PRIMITIVES;
OSG_INFO<<"Set compute near far mode to "<<_computeNearFar<<std::endl;
}
if ((ptr = getenv("OSG_NEAR_FAR_RATIO")) != 0)
{
_nearFarRatio = osg::asciiToDouble(ptr);
OSG_INFO<<"Set near/far ratio to "<<_nearFarRatio<<std::endl;
}
}
void CullSettings::readCommandLine(ArgumentParser& arguments)
@@ -150,7 +150,7 @@ void CullSettings::readCommandLine(ArgumentParser& arguments)
void CullSettings::write(std::ostream& out)
{
out<<"CullSettings: "<<this<<" {"<<std::endl;
out<<" _inheritanceMask = "<<_inheritanceMask<<std::endl;
out<<" _inheritanceMaskActionOnAttributeSetting = "<<_inheritanceMaskActionOnAttributeSetting<<std::endl;
out<<" _computeNearFar = "<<_computeNearFar<<std::endl;
@@ -166,7 +166,7 @@ void CullSettings::write(std::ostream& out)
out<<" _cullMask = "<<_cullMask<<std::endl;
out<<" _cullMaskLeft = "<<_cullMaskLeft<<std::endl;
out<<" _cullMaskRight = "<<_cullMaskRight<<std::endl;
out<<"{"<<std::endl;
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/CullStack>
@@ -28,7 +28,7 @@ CullStack::CullStack()
_index_modelviewCullingStack = 0;
_back_modelviewCullingStack = 0;
_referenceViewPoints.push_back(osg::Vec3(0.0f,0.0f,0.0f));
}
@@ -43,7 +43,7 @@ CullStack::CullStack(const CullStack& cs):
_index_modelviewCullingStack = 0;
_back_modelviewCullingStack = 0;
_referenceViewPoints.push_back(osg::Vec3(0.0f,0.0f,0.0f));
}
@@ -65,7 +65,7 @@ void CullStack::reset()
_referenceViewPoints.clear();
_referenceViewPoints.push_back(osg::Vec3(0.0f,0.0f,0.0f));
_eyePointStack.clear();
_viewPointStack.clear();
@@ -78,13 +78,13 @@ void CullStack::reset()
_back_modelviewCullingStack = 0;
osg::Vec3 lookVector(0.0,0.0,-1.0);
_bbCornerFar = (lookVector.x()>=0?1:0) |
(lookVector.y()>=0?2:0) |
(lookVector.z()>=0?4:0);
_bbCornerNear = (~_bbCornerFar)&7;
_currentReuseMatrixIndex=0;
}
@@ -93,31 +93,31 @@ void CullStack::pushCullingSet()
{
_MVPW_Stack.push_back(0L);
if (_index_modelviewCullingStack==0)
if (_index_modelviewCullingStack==0)
{
if (_modelviewCullingStack.empty())
_modelviewCullingStack.push_back(CullingSet());
_modelviewCullingStack[_index_modelviewCullingStack++].set(_projectionCullingStack.back());
}
else
else
{
const osg::Viewport& W = *_viewportStack.back();
const osg::Matrix& P = *_projectionStack.back();
const osg::Matrix& M = *_modelviewStack.back();
osg::Vec4 pixelSizeVector = CullingSet::computePixelSizeVector(W,P,M);
if (_index_modelviewCullingStack>=_modelviewCullingStack.size())
if (_index_modelviewCullingStack>=_modelviewCullingStack.size())
{
_modelviewCullingStack.push_back(CullingSet());
}
_modelviewCullingStack[_index_modelviewCullingStack++].set(_projectionCullingStack.back(),*_modelviewStack.back(),pixelSizeVector);
}
_back_modelviewCullingStack = &_modelviewCullingStack[_index_modelviewCullingStack-1];
// const osg::Polytope& polytope = _modelviewCullingStack.back()->getFrustum();
@@ -136,7 +136,7 @@ void CullStack::pushCullingSet()
void CullStack::popCullingSet()
{
_MVPW_Stack.pop_back();
--_index_modelviewCullingStack;
if (_index_modelviewCullingStack>0) _back_modelviewCullingStack = &_modelviewCullingStack[_index_modelviewCullingStack-1];
@@ -157,20 +157,20 @@ void CullStack::popViewport()
void CullStack::pushProjectionMatrix(RefMatrix* matrix)
{
_projectionStack.push_back(matrix);
_projectionCullingStack.push_back(osg::CullingSet());
osg::CullingSet& cullingSet = _projectionCullingStack.back();
// set up view frustum.
cullingSet.getFrustum().setToUnitFrustum(((_cullingMode&NEAR_PLANE_CULLING)!=0),((_cullingMode&FAR_PLANE_CULLING)!=0));
cullingSet.getFrustum().transformProvidingInverse(*matrix);
// set the culling mask ( There should be a more elegant way!) Nikolaus H.
cullingSet.setCullingMask(_cullingMode);
// set the small feature culling.
cullingSet.setSmallFeatureCullingPixelSize(_smallFeatureCullingPixelSize);
// set up the relevant occluders which a related to this projection.
for(ShadowVolumeOccluderList::iterator itr=_occluderList.begin();
itr!=_occluderList.end();
@@ -183,8 +183,8 @@ void CullStack::pushProjectionMatrix(RefMatrix* matrix)
cullingSet.addOccluder(*itr);
}
}
// need to recompute frustum volume.
_frustumVolume = -1.0f;
@@ -210,13 +210,13 @@ void CullStack::pushModelViewMatrix(RefMatrix* matrix, Transform::ReferenceFrame
osg::RefMatrix* originalModelView = _modelviewStack.empty() ? 0 : _modelviewStack.back().get();
_modelviewStack.push_back(matrix);
pushCullingSet();
osg::Matrix inv;
inv.invert(*matrix);
switch(referenceFrame)
{
case(Transform::RELATIVE_RF):
@@ -232,7 +232,7 @@ void CullStack::pushModelViewMatrix(RefMatrix* matrix, Transform::ReferenceFrame
case(Transform::ABSOLUTE_RF_INHERIT_VIEWPOINT):
{
_eyePointStack.push_back(inv.getTrans());
osg::Vec3 referenceViewPoint = getReferenceViewPoint();
if (originalModelView)
{
@@ -249,20 +249,20 @@ void CullStack::pushModelViewMatrix(RefMatrix* matrix, Transform::ReferenceFrame
}
osg::Vec3 lookVector = getLookVectorLocal();
osg::Vec3 lookVector = getLookVectorLocal();
_bbCornerFar = (lookVector.x()>=0?1:0) |
(lookVector.y()>=0?2:0) |
(lookVector.z()>=0?4:0);
_bbCornerNear = (~_bbCornerFar)&7;
}
void CullStack::popModelViewMatrix()
{
_modelviewStack.pop_back();
_eyePointStack.pop_back();
_referenceViewPoints.pop_back();
_viewPointStack.pop_back();
@@ -299,5 +299,5 @@ void CullStack::computeFrustumVolume()
_frustumVolume = computeVolume(f1,f2,f3,b1,b2,b3)+
computeVolume(f2,f3,f4,b1,b3,b4);
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/CullingSet>
@@ -36,7 +36,7 @@ void CullingSet::disableAndPushOccludersCurrentMask(NodePath& nodePath)
{
//std::cout<<" ++ disabling occluder "<<itr<<std::endl;
// we have trapped for the case an occlude potentially occluding itself,
// to prevent this we disable the results mask so that no subsequnt
// to prevent this we disable the results mask so that no subsequnt
// when the next pushCurrentMask calls happens this occluder is switched off.
itr->disableResultMasks();
itr->pushCurrentMask();
@@ -57,7 +57,7 @@ void CullingSet::popOccludersCurrentMask(NodePath& nodePath)
{
//std::cout<<" popping occluder "<<itr<<std::endl;
// we have trapped for the case an occlude potentially occluding itself,
// to prevent this we disable the results mask so that no subsequent
// to prevent this we disable the results mask so that no subsequent
// when the next pushCurrentMask calls happens this occluder is switched off.
itr->popCurrentMask();
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/DeleteHandler>
@@ -48,7 +48,7 @@ void DeleteHandler::flush()
deletionList.push_back(itr->second);
itr->second = 0;
itr->second = 0;
}
_objectsToDelete.erase( _objectsToDelete.begin(), itr);
@@ -82,7 +82,7 @@ void DeleteHandler::flushAll()
++itr)
{
deletionList.push_back(itr->second);
itr->second = 0;
itr->second = 0;
}
_objectsToDelete.erase( _objectsToDelete.begin(), _objectsToDelete.end());

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Depth>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/DisplaySettings>
@@ -38,7 +38,7 @@ DisplaySettings::~DisplaySettings()
{
}
DisplaySettings& DisplaySettings::operator = (const DisplaySettings& vs)
{
if (this==&vs) return *this;
@@ -61,7 +61,7 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
_splitStereoVerticalEyeMapping = vs._splitStereoVerticalEyeMapping;
_splitStereoVerticalSeparation = vs._splitStereoVerticalSeparation;
_splitStereoAutoAdjustAspectRatio = vs._splitStereoAutoAdjustAspectRatio;
_doubleBuffer = vs._doubleBuffer;
@@ -76,13 +76,13 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
_maxNumOfGraphicsContexts = vs._maxNumOfGraphicsContexts;
_numMultiSamples = vs._numMultiSamples;
_compileContextsHint = vs._compileContextsHint;
_serializeDrawDispatch = vs._serializeDrawDispatch;
_numDatabaseThreadsHint = vs._numDatabaseThreadsHint;
_numHttpDatabaseThreadsHint = vs._numHttpDatabaseThreadsHint;
_application = vs._application;
_maxTexturePoolSize = vs._maxTexturePoolSize;
@@ -100,13 +100,13 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
void DisplaySettings::merge(const DisplaySettings& vs)
{
if (_stereo || vs._stereo) _stereo = true;
// need to think what to do about merging the stereo mode.
if (_doubleBuffer || vs._doubleBuffer) _doubleBuffer = true;
if (_RGB || vs._RGB) _RGB = true;
if (_depthBuffer || vs._depthBuffer) _depthBuffer = true;
if (vs._minimumNumberAlphaBits>_minimumNumberAlphaBits) _minimumNumberAlphaBits = vs._minimumNumberAlphaBits;
if (vs._minimumNumberStencilBits>_minimumNumberStencilBits) _minimumNumberStencilBits = vs._minimumNumberStencilBits;
if (vs._numMultiSamples>_numMultiSamples) _numMultiSamples = vs._numMultiSamples;
@@ -122,7 +122,7 @@ void DisplaySettings::merge(const DisplaySettings& vs)
if (vs._maxTexturePoolSize>_maxTexturePoolSize) _maxTexturePoolSize = vs._maxTexturePoolSize;
if (vs._maxBufferObjectPoolSize>_maxBufferObjectPoolSize) _maxBufferObjectPoolSize = vs._maxBufferObjectPoolSize;
// these are bit masks so merging them is like logical or
// these are bit masks so merging them is like logical or
_implicitBufferAttachmentRenderMask |= vs._implicitBufferAttachmentRenderMask;
_implicitBufferAttachmentResolveMask |= vs._implicitBufferAttachmentResolveMask;
@@ -159,7 +159,7 @@ void DisplaySettings::setDefaults()
_minimumNumberAccumGreenBits = 0;
_minimumNumberAccumBlueBits = 0;
_minimumNumberAccumAlphaBits = 0;
_maxNumOfGraphicsContexts = 32;
_numMultiSamples = 0;
@@ -167,7 +167,7 @@ void DisplaySettings::setDefaults()
// switch on anti-aliasing by default, just in case we have an Onyx :-)
_numMultiSamples = 4;
#endif
_compileContextsHint = false;
_serializeDrawDispatch = true;
@@ -291,7 +291,7 @@ static ApplicationUsageProxy DisplaySetting_e26(ApplicationUsage::ENVIRONMENTAL_
void DisplaySettings::readEnvironmentalVariables()
{
const char* ptr = 0;
if ((ptr = getenv("OSG_DISPLAY_TYPE")) != 0)
{
if (strcmp(ptr,"MONITOR")==0)
@@ -314,7 +314,7 @@ void DisplaySettings::readEnvironmentalVariables()
_displayType = HEAD_MOUNTED_DISPLAY;
}
}
if( (ptr = getenv("OSG_STEREO_MODE")) != 0)
{
if (strcmp(ptr,"QUAD_BUFFER")==0)
@@ -419,7 +419,7 @@ void DisplaySettings::readEnvironmentalVariables()
_splitStereoVerticalEyeMapping = LEFT_EYE_BOTTOM_VIEWPORT;
}
}
if( (ptr = getenv("OSG_SPLIT_STEREO_AUTO_ADJUST_ASPECT_RATIO")) != 0)
{
if (strcmp(ptr,"OFF")==0)
@@ -455,7 +455,7 @@ void DisplaySettings::readEnvironmentalVariables()
_compileContextsHint = true;
}
}
if( (ptr = getenv("OSG_SERIALIZE_DRAW_DISPATCH")) != 0)
{
if (strcmp(ptr,"OFF")==0)
@@ -623,7 +623,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
{
_RGB = true;
_minimumNumberAlphaBits = 1;
}
}
while (arguments.read("--stencil"))
{
@@ -668,7 +668,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
"--implicit-buffer-attachment-resolve-mask",
};
int * mask[] = {
int * mask[] = {
&_implicitBufferAttachmentRenderMask,
&_implicitBufferAttachmentResolveMask,
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/DrawPixels>
@@ -18,12 +18,12 @@ DrawPixels::DrawPixels()
{
// turn off display lists right now, just incase we want to modify the projection matrix along the way.
setSupportsDisplayList(false);
_position.set(0.0f,0.0f,0.0f);
_useSubImage = false;
_offsetX = 0;
_offsetY = 0;
_offsetY = 0;
_width = 0;
_height = 0;
}
@@ -33,7 +33,7 @@ DrawPixels::DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop):
_position(drawimage._position),
_image(drawimage._image),
_useSubImage(drawimage._useSubImage),
_offsetX(drawimage._offsetX),
_offsetX(drawimage._offsetX),
_offsetY(drawimage._offsetY),
_width(drawimage._width),
_height(drawimage._height)
@@ -55,7 +55,7 @@ void DrawPixels::setSubImageDimensions(unsigned int offsetX,unsigned int offsetY
{
_useSubImage = true;
_offsetX = offsetX;
_offsetY = offsetY;
_offsetY = offsetY;
_width = width;
_height = height;
}
@@ -63,7 +63,7 @@ void DrawPixels::setSubImageDimensions(unsigned int offsetX,unsigned int offsetY
void DrawPixels::getSubImageDimensions(unsigned int& offsetX,unsigned int& offsetY,unsigned int& width,unsigned int& height) const
{
offsetX = _offsetX;
offsetY = _offsetY;
offsetY = _offsetY;
width = _width;
height = _height;
}
@@ -82,7 +82,7 @@ BoundingBox DrawPixels::computeBound() const
{
diagonal = sqrtf(_image->s()*_image->s()+_image->t()*_image->t());
}
bbox.expandBy(_position-osg::Vec3(diagonal,diagonal,diagonal));
bbox.expandBy(_position+osg::Vec3(diagonal,diagonal,diagonal));
return bbox;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <stdio.h>
@@ -36,7 +36,7 @@ unsigned int Drawable::s_numberDrawablesReusedLastInLastFrame = 0;
unsigned int Drawable::s_numberNewDrawablesInLastFrame = 0;
unsigned int Drawable::s_numberDeletedDrawablesInLastFrame = 0;
// static cache of deleted display lists which can only
// static cache of deleted display lists which can only
// by completely deleted once the appropriate OpenGL context
// is set. Used osg::Drawable::deleteDisplayList(..) and flushDeletedDisplayLists(..) below.
typedef std::multimap<unsigned int,GLuint> DisplayListMap;
@@ -56,7 +56,7 @@ GLuint Drawable::generateDisplayList(unsigned int contextID, unsigned int sizeHi
++s_numberNewDrawablesInLastFrame;
return glGenLists( 1 );
}
else
else
{
DisplayListMap::iterator itr = dll.lower_bound(sizeHint);
if (itr!=dll.end())
@@ -64,12 +64,12 @@ GLuint Drawable::generateDisplayList(unsigned int contextID, unsigned int sizeHi
// OSG_NOTICE<<"Reusing a display list of size = "<<itr->first<<" for requested size = "<<sizeHint<<std::endl;
++s_numberDrawablesReusedLastInLastFrame;
GLuint globj = itr->second;
dll.erase(itr);
return globj;
}
}
else
{
// OSG_NOTICE<<"Creating a new display list of size = "<<sizeHint<<" although "<<dll.size()<<" are available"<<std::endl;
@@ -123,7 +123,7 @@ void Drawable::flushAllDeletedDisplayLists(unsigned int contextID)
glDeleteLists(ditr->second,1);
}
dll.clear();
dll.clear();
#else
OSG_NOTICE<<"Warning: Drawable::deleteDisplayList(..) - not supported."<<std::endl;
#endif
@@ -134,7 +134,7 @@ void Drawable::discardAllDeletedDisplayLists(unsigned int contextID)
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedDisplayListCache);
DisplayListMap& dll = s_deletedDisplayListCache[contextID];
dll.clear();
dll.clear();
}
void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availableTime)
@@ -178,7 +178,7 @@ void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availabl
if (noDeleted+dll.size() != prev_size)
{
OSG_WARN<<"Error in delete"<<std::endl;
}
}
}
else
{
@@ -203,11 +203,11 @@ void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availabl
if (noDeleted+dll.size() != prev_size)
{
OSG_WARN<<"Error in delete"<<std::endl;
}
}
}
}
elapsedTime = timer.delta_s(start_tick,timer.tick());
if (noDeleted!=0) OSG_INFO<<"Number display lists deleted = "<<noDeleted<<" elapsed time"<<elapsedTime<<std::endl;
availableTime -= elapsedTime;
@@ -290,14 +290,14 @@ void Drawable::computeDataVariance()
if (getDataVariance() != UNSPECIFIED) return;
bool dynamic = false;
if (getUpdateCallback() ||
getEventCallback() ||
getCullCallback())
getCullCallback())
{
dynamic = true;
}
setDataVariance(dynamic ? DYNAMIC : STATIC);
}
@@ -321,22 +321,22 @@ void Drawable::setStateSet(osg::StateSet* stateset)
{
// do nothing if nothing changed.
if (_stateset==stateset) return;
// track whether we need to account for the need to do a update or event traversal.
int delta_update = 0;
int delta_event = 0;
// remove this node from the current statesets parent list
// remove this node from the current statesets parent list
if (_stateset.valid())
{
_stateset->removeParent(this);
if (_stateset->requiresUpdateTraversal()) --delta_update;
if (_stateset->requiresEventTraversal()) --delta_event;
}
// set the stateset.
_stateset = stateset;
// add this node to the new stateset to the parent list.
if (_stateset.valid())
{
@@ -344,7 +344,7 @@ void Drawable::setStateSet(osg::StateSet* stateset)
if (_stateset->requiresUpdateTraversal()) ++delta_update;
if (_stateset->requiresEventTraversal()) ++delta_event;
}
// only inform parents if change occurs and drawable doesn't already have an update callback
if (delta_update!=0 && !_updateCallback)
@@ -381,7 +381,7 @@ void Drawable::setNumChildrenRequiringUpdateTraversal(unsigned int num)
// _numChildrenRequiringUpdateTraversal so no need to inform them.
if (!_updateCallback && !_parents.empty())
{
// need to pass on changes to parents.
// need to pass on changes to parents.
int delta = 0;
if (_numChildrenRequiringUpdateTraversal>0) --delta;
if (num>0) ++delta;
@@ -393,16 +393,16 @@ void Drawable::setNumChildrenRequiringUpdateTraversal(unsigned int num)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenRequiringUpdateTraversal( (*itr)->getNumChildrenRequiringUpdateTraversal()+delta );
}
}
}
// finally update this objects value.
_numChildrenRequiringUpdateTraversal=num;
}
@@ -416,7 +416,7 @@ void Drawable::setNumChildrenRequiringEventTraversal(unsigned int num)
// _numChildrenRequiringEventTraversal so no need to inform them.
if (!_eventCallback && !_parents.empty())
{
// need to pass on changes to parents.
// need to pass on changes to parents.
int delta = 0;
if (_numChildrenRequiringEventTraversal>0) --delta;
if (num>0) ++delta;
@@ -428,16 +428,16 @@ void Drawable::setNumChildrenRequiringEventTraversal(unsigned int num)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenRequiringEventTraversal( (*itr)->getNumChildrenRequiringEventTraversal()+delta );
}
}
}
// finally Event this objects value.
_numChildrenRequiringEventTraversal=num;
}
osg::StateSet* Drawable::getOrCreateStateSet()
@@ -468,7 +468,7 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
if (!_useDisplayList) return;
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
unsigned int contextID = renderInfo.getContextID();
@@ -477,7 +477,7 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
// call the globj if already set otherwise compile and execute.
if( globj != 0 )
{
{
glDeleteLists( globj, 1 );
}
@@ -486,7 +486,7 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
if (_drawCallback.valid())
_drawCallback->drawImplementation(renderInfo,this);
else
else
drawImplementation(renderInfo);
glEndList();
@@ -521,10 +521,10 @@ void Drawable::releaseGLObjects(State* state) const
if (_drawCallback.valid()) _drawCallback->releaseGLObjects(state);
if (!_useDisplayList) return;
if (state)
{
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
unsigned int contextID = state->getContextID();
@@ -536,7 +536,7 @@ void Drawable::releaseGLObjects(State* state) const
{
Drawable::deleteDisplayList(contextID,globj, getGLObjectSizeHint());
globj = 0;
}
}
}
else
{
@@ -561,7 +561,7 @@ void Drawable::setSupportsDisplayList(bool flag)
_useDisplayList = false;
}
}
// set with new value.
_supportsDisplayList=flag;
#else
@@ -580,13 +580,13 @@ void Drawable::setUseDisplayList(bool flag)
{
dirtyDisplayList();
}
if (_supportsDisplayList)
{
// set with new value.
_useDisplayList = flag;
}
else // does not support display lists.
{
@@ -594,7 +594,7 @@ void Drawable::setUseDisplayList(bool flag)
{
OSG_WARN<<"Warning: attempt to setUseDisplayList(true) on a drawable with does not support display lists."<<std::endl;
}
else
else
{
// set with new value.
_useDisplayList = false;
@@ -643,13 +643,13 @@ void Drawable::dirtyDisplayList()
void Drawable::setUpdateCallback(UpdateCallback* ac)
{
if (_updateCallback==ac) return;
int delta = 0;
if (_updateCallback.valid()) --delta;
if (ac) ++delta;
_updateCallback = ac;
if (delta!=0 && !(_stateset.valid() && _stateset->requiresUpdateTraversal()))
{
for(ParentList::iterator itr=_parents.begin();
@@ -664,13 +664,13 @@ void Drawable::setUpdateCallback(UpdateCallback* ac)
void Drawable::setEventCallback(EventCallback* ac)
{
if (_eventCallback==ac) return;
int delta = 0;
if (_eventCallback.valid()) --delta;
if (ac) ++delta;
_eventCallback = ac;
if (delta!=0 && !(_stateset.valid() && _stateset->requiresEventTraversal()))
{
for(ParentList::iterator itr=_parents.begin();
@@ -687,10 +687,10 @@ struct ComputeBound : public PrimitiveFunctor
ComputeBound()
{
_vertices2f = 0;
_vertices3f = 0;
_vertices3f = 0;
_vertices4f = 0;
_vertices2d = 0;
_vertices3d = 0;
_vertices2d = 0;
_vertices3d = 0;
_vertices4d = 0;
}
@@ -775,14 +775,14 @@ struct ComputeBound : public PrimitiveFunctor
virtual void vertex(double x,double y,double z) { _bb.expandBy(x,y,z); }
virtual void vertex(double x,double y,double z,double w) { if (w!=0.0f) _bb.expandBy(x/w,y/w,z/w); }
virtual void end() {}
const Vec2* _vertices2f;
const Vec3* _vertices3f;
const Vec4* _vertices4f;
const Vec2d* _vertices2d;
const Vec3d* _vertices3d;
const Vec4d* _vertices4d;
BoundingBox _bb;
BoundingBox _bb;
};
BoundingBox Drawable::computeBound() const
@@ -792,12 +792,12 @@ BoundingBox Drawable::computeBound() const
Drawable* non_const_this = const_cast<Drawable*>(this);
non_const_this->accept(cb);
#if 0
#if 0
OSG_NOTICE<<"computeBound() "<<cb._bb.xMin()<<", "<<cb._bb.xMax()<<", "<<std::endl;
OSG_NOTICE<<" "<<cb._bb.yMin()<<", "<<cb._bb.yMax()<<", "<<std::endl;
OSG_NOTICE<<" "<<cb._bb.zMin()<<", "<<cb._bb.zMax()<<", "<<std::endl;
#endif
return cb._bb;
}
@@ -843,7 +843,7 @@ Drawable::Extensions::Extensions(const Extensions& rhs):
_isARBOcclusionQuerySupported = rhs._isARBOcclusionQuerySupported;
_isTimerQuerySupported = rhs._isTimerQuerySupported;
_isARBTimerQuerySupported = rhs._isARBTimerQuerySupported;
_glFogCoordfv = rhs._glFogCoordfv;
_glSecondaryColor3ubv = rhs._glSecondaryColor3ubv;
_glSecondaryColor3fv = rhs._glSecondaryColor3fv;
@@ -1024,7 +1024,7 @@ void Drawable::Extensions::glFogCoordfv(const GLfloat* coord) const
else
{
OSG_WARN<<"Error: glFogCoordfv not supported by OpenGL driver"<<std::endl;
}
}
}
void Drawable::Extensions::glSecondaryColor3ubv(const GLubyte* coord) const
@@ -1055,7 +1055,7 @@ void Drawable::Extensions::glMultiTexCoord1f(GLenum target,GLfloat coord) const
{
if (_glMultiTexCoord1f)
{
_glMultiTexCoord1f(target,coord);
_glMultiTexCoord1f(target,coord);
}
else
{
@@ -1067,7 +1067,7 @@ void Drawable::Extensions::glMultiTexCoord2fv(GLenum target,const GLfloat* coord
{
if (_glMultiTexCoord2fv)
{
_glMultiTexCoord2fv(target,coord);
_glMultiTexCoord2fv(target,coord);
}
else
{
@@ -1079,7 +1079,7 @@ void Drawable::Extensions::glMultiTexCoord3fv(GLenum target,const GLfloat* coord
{
if (_glMultiTexCoord3fv)
{
_glMultiTexCoord3fv(target,coord);
_glMultiTexCoord3fv(target,coord);
}
else
{
@@ -1091,7 +1091,7 @@ void Drawable::Extensions::glMultiTexCoord4fv(GLenum target,const GLfloat* coord
{
if (_glMultiTexCoord4fv)
{
_glMultiTexCoord4fv(target,coord);
_glMultiTexCoord4fv(target,coord);
}
else
{
@@ -1103,7 +1103,7 @@ void Drawable::Extensions::glMultiTexCoord1d(GLenum target,GLdouble coord) const
{
if (_glMultiTexCoord1d)
{
_glMultiTexCoord1d(target,coord);
_glMultiTexCoord1d(target,coord);
}
else
{
@@ -1115,7 +1115,7 @@ void Drawable::Extensions::glMultiTexCoord2dv(GLenum target,const GLdouble* coor
{
if (_glMultiTexCoord2dv)
{
_glMultiTexCoord2dv(target,coord);
_glMultiTexCoord2dv(target,coord);
}
else
{
@@ -1127,7 +1127,7 @@ void Drawable::Extensions::glMultiTexCoord3dv(GLenum target,const GLdouble* coor
{
if (_glMultiTexCoord3dv)
{
_glMultiTexCoord3dv(target,coord);
_glMultiTexCoord3dv(target,coord);
}
else
{
@@ -1139,7 +1139,7 @@ void Drawable::Extensions::glMultiTexCoord4dv(GLenum target,const GLdouble* coor
{
if (_glMultiTexCoord4dv)
{
_glMultiTexCoord4dv(target,coord);
_glMultiTexCoord4dv(target,coord);
}
else
{
@@ -1151,7 +1151,7 @@ void Drawable::Extensions::glVertexAttrib1s(unsigned int index, GLshort s) const
{
if (_glVertexAttrib1s)
{
_glVertexAttrib1s(index,s);
_glVertexAttrib1s(index,s);
}
else
{
@@ -1163,7 +1163,7 @@ void Drawable::Extensions::glVertexAttrib1f(unsigned int index, GLfloat f) const
{
if (_glVertexAttrib1f)
{
_glVertexAttrib1f(index,f);
_glVertexAttrib1f(index,f);
}
else
{
@@ -1175,7 +1175,7 @@ void Drawable::Extensions::glVertexAttrib1d(unsigned int index, GLdouble f) cons
{
if (_glVertexAttrib1d)
{
_glVertexAttrib1d(index,f);
_glVertexAttrib1d(index,f);
}
else
{
@@ -1187,7 +1187,7 @@ void Drawable::Extensions::glVertexAttrib2fv(unsigned int index, const GLfloat *
{
if (_glVertexAttrib2fv)
{
_glVertexAttrib2fv(index,v);
_glVertexAttrib2fv(index,v);
}
else
{
@@ -1199,7 +1199,7 @@ void Drawable::Extensions::glVertexAttrib3fv(unsigned int index, const GLfloat *
{
if (_glVertexAttrib3fv)
{
_glVertexAttrib3fv(index,v);
_glVertexAttrib3fv(index,v);
}
else
{
@@ -1211,7 +1211,7 @@ void Drawable::Extensions::glVertexAttrib4fv(unsigned int index, const GLfloat *
{
if (_glVertexAttrib4fv)
{
_glVertexAttrib4fv(index,v);
_glVertexAttrib4fv(index,v);
}
else
{
@@ -1223,7 +1223,7 @@ void Drawable::Extensions::glVertexAttrib2dv(unsigned int index, const GLdouble
{
if (_glVertexAttrib2dv)
{
_glVertexAttrib2dv(index,v);
_glVertexAttrib2dv(index,v);
}
else
{
@@ -1235,7 +1235,7 @@ void Drawable::Extensions::glVertexAttrib3dv(unsigned int index, const GLdouble
{
if (_glVertexAttrib3dv)
{
_glVertexAttrib3dv(index,v);
_glVertexAttrib3dv(index,v);
}
else
{
@@ -1247,7 +1247,7 @@ void Drawable::Extensions::glVertexAttrib4dv(unsigned int index, const GLdouble
{
if (_glVertexAttrib4dv)
{
_glVertexAttrib4dv(index,v);
_glVertexAttrib4dv(index,v);
}
else
{
@@ -1259,7 +1259,7 @@ void Drawable::Extensions::glVertexAttrib4ubv(unsigned int index, const GLubyte
{
if (_glVertexAttrib4ubv)
{
_glVertexAttrib4ubv(index,v);
_glVertexAttrib4ubv(index,v);
}
else
{
@@ -1271,7 +1271,7 @@ void Drawable::Extensions::glVertexAttrib4Nubv(unsigned int index, const GLubyte
{
if (_glVertexAttrib4Nubv)
{
_glVertexAttrib4Nubv(index,v);
_glVertexAttrib4Nubv(index,v);
}
else
{
@@ -1281,38 +1281,38 @@ void Drawable::Extensions::glVertexAttrib4Nubv(unsigned int index, const GLubyte
void Drawable::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const
{
if (_glGenBuffers) _glGenBuffers(n, buffers);
if (_glGenBuffers) _glGenBuffers(n, buffers);
else OSG_WARN<<"Error: glGenBuffers not supported by OpenGL driver"<<std::endl;
}
void Drawable::Extensions::glBindBuffer(GLenum target, GLuint buffer) const
{
if (_glBindBuffer) _glBindBuffer(target, buffer);
if (_glBindBuffer) _glBindBuffer(target, buffer);
else OSG_WARN<<"Error: glBindBuffer not supported by OpenGL driver"<<std::endl;
}
void Drawable::Extensions::glBufferData(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const
{
if (_glBufferData) _glBufferData(target, size, data, usage);
if (_glBufferData) _glBufferData(target, size, data, usage);
else OSG_WARN<<"Error: glBufferData not supported by OpenGL driver"<<std::endl;
}
void Drawable::Extensions::glBufferSubData(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const
{
if (_glBufferSubData) _glBufferSubData(target, offset, size, data);
if (_glBufferSubData) _glBufferSubData(target, offset, size, data);
else OSG_WARN<<"Error: glBufferData not supported by OpenGL driver"<<std::endl;
}
void Drawable::Extensions::glDeleteBuffers(GLsizei n, const GLuint *buffers) const
{
if (_glDeleteBuffers) _glDeleteBuffers(n, buffers);
if (_glDeleteBuffers) _glDeleteBuffers(n, buffers);
else OSG_WARN<<"Error: glBufferData not supported by OpenGL driver"<<std::endl;
}
GLboolean Drawable::Extensions::glIsBuffer (GLuint buffer) const
{
if (_glIsBuffer) return _glIsBuffer(buffer);
else
else
{
OSG_WARN<<"Error: glIsBuffer not supported by OpenGL driver"<<std::endl;
return GL_FALSE;
@@ -1328,7 +1328,7 @@ void Drawable::Extensions::glGetBufferSubData (GLenum target, GLintptrARB offset
GLvoid* Drawable::Extensions::glMapBuffer (GLenum target, GLenum access) const
{
if (_glMapBuffer) return _glMapBuffer(target,access);
else
else
{
OSG_WARN<<"Error: glMapBuffer not supported by OpenGL driver"<<std::endl;
return 0;
@@ -1338,7 +1338,7 @@ GLvoid* Drawable::Extensions::glMapBuffer (GLenum target, GLenum access) const
GLboolean Drawable::Extensions::glUnmapBuffer (GLenum target) const
{
if (_glUnmapBuffer) return _glUnmapBuffer(target);
else
else
{
OSG_WARN<<"Error: glUnmapBuffer not supported by OpenGL driver"<<std::endl;
return GL_FALSE;
@@ -1367,7 +1367,7 @@ void Drawable::Extensions::glGenOcclusionQueries( GLsizei n, GLuint *ids ) const
else
{
OSG_WARN<<"Error: glGenOcclusionQueries not supported by OpenGL driver"<<std::endl;
}
}
}
void Drawable::Extensions::glDeleteOcclusionQueries( GLsizei n, const GLuint *ids ) const
@@ -1379,7 +1379,7 @@ void Drawable::Extensions::glDeleteOcclusionQueries( GLsizei n, const GLuint *id
else
{
OSG_WARN<<"Error: glDeleteOcclusionQueries not supported by OpenGL driver"<<std::endl;
}
}
}
GLboolean Drawable::Extensions::glIsOcclusionQuery( GLuint id ) const
@@ -1391,7 +1391,7 @@ GLboolean Drawable::Extensions::glIsOcclusionQuery( GLuint id ) const
else
{
OSG_WARN<<"Error: glIsOcclusionQuery not supported by OpenGL driver"<<std::endl;
}
}
return GLboolean( 0 );
}
@@ -1405,7 +1405,7 @@ void Drawable::Extensions::glBeginOcclusionQuery( GLuint id ) const
else
{
OSG_WARN<<"Error: glBeginOcclusionQuery not supported by OpenGL driver"<<std::endl;
}
}
}
void Drawable::Extensions::glEndOcclusionQuery() const
@@ -1417,7 +1417,7 @@ void Drawable::Extensions::glEndOcclusionQuery() const
else
{
OSG_WARN<<"Error: glEndOcclusionQuery not supported by OpenGL driver"<<std::endl;
}
}
}
void Drawable::Extensions::glGetOcclusionQueryiv( GLuint id, GLenum pname, GLint *params ) const
@@ -1429,7 +1429,7 @@ void Drawable::Extensions::glGetOcclusionQueryiv( GLuint id, GLenum pname, GLint
else
{
OSG_WARN<<"Error: glGetOcclusionQueryiv not supported by OpenGL driver"<<std::endl;
}
}
}
void Drawable::Extensions::glGetOcclusionQueryuiv( GLuint id, GLenum pname, GLuint *params ) const
@@ -1441,7 +1441,7 @@ void Drawable::Extensions::glGetOcclusionQueryuiv( GLuint id, GLenum pname, GLui
else
{
OSG_WARN<<"Error: glGetOcclusionQueryuiv not supported by OpenGL driver"<<std::endl;
}
}
}
void Drawable::Extensions::glGetQueryiv(GLenum target, GLenum pname, GLint *params) const
@@ -1494,7 +1494,7 @@ GLboolean Drawable::Extensions::glIsQuery(GLuint id) const
void Drawable::Extensions::glDeleteQueries(GLsizei n, const GLuint *ids) const
{
if (_gl_delete_queries_arb)
if (_gl_delete_queries_arb)
_gl_delete_queries_arb(n, ids);
else
OSG_WARN << "Error: glIsQuery not supported by OpenGL driver" << std::endl;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLExtensions>
@@ -51,7 +51,7 @@ void Fog::apply(State& state) const
glFogf( GL_FOG_START, _start );
glFogf( GL_FOG_END, _end );
glFogfv( GL_FOG_COLOR, (GLfloat*)_color.ptr() );
static bool fogCoordExtensionSupported = osg::isGLExtensionSupported(state.getContextID(),"GL_EXT_fog_coord");
if (fogCoordExtensionSupported)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Notify>
@@ -23,7 +23,7 @@
using namespace osg;
// static cache of deleted fragment programs which can only
// static cache of deleted fragment programs which can only
// by completely deleted once the appropriate OpenGL context
// is set.
typedef std::list<GLuint> FragmentProgramObjectList;
@@ -69,7 +69,7 @@ void FragmentProgram::flushDeletedFragmentProgramObjects(unsigned int contextID,
elapsedTime = timer.delta_s(start_tick,timer.tick());
}
}
availableTime -= elapsedTime;
}
@@ -91,13 +91,13 @@ FragmentProgram::FragmentProgram(const FragmentProgram& vp,const CopyOp& copyop)
{
_fragmentProgram = vp._fragmentProgram;
for( LocalParamList::const_iterator itr = vp._programLocalParameters.begin();
for( LocalParamList::const_iterator itr = vp._programLocalParameters.begin();
itr != vp._programLocalParameters.end(); ++itr )
{
_programLocalParameters[itr->first] = itr->second;
}
for( MatrixList::const_iterator mitr = vp._matrixList.begin();
for( MatrixList::const_iterator mitr = vp._matrixList.begin();
mitr != vp._matrixList.end(); ++mitr )
{
_matrixList[mitr->first] = mitr->second;
@@ -278,7 +278,7 @@ void FragmentProgram::Extensions::glBindProgram(GLenum target, GLuint id) const
else
{
OSG_WARN<<"Error: glBindProgram not supported by OpenGL driver"<<std::endl;
}
}
}
void FragmentProgram::Extensions::glGenPrograms(GLsizei n, GLuint *programs) const
@@ -309,7 +309,7 @@ void FragmentProgram::Extensions::glProgramString(GLenum target, GLenum format,
{
if (_glProgramString)
{
_glProgramString(target,format, len, string);
_glProgramString(target,format, len, string);
}
else
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -88,7 +88,7 @@ FBOExtensions::FBOExtensions(unsigned int contextID)
LOAD_FBO_EXT(glGenerateMipmap);
LOAD_FBO_EXT(glGetRenderbufferParameteriv);
_supported =
_supported =
glBindRenderbuffer != 0 &&
glDeleteRenderbuffers != 0 &&
glGenRenderbuffers != 0 &&
@@ -240,7 +240,7 @@ GLuint RenderBuffer::getObjectID(unsigned int contextID, const FBOExtensions *ex
if (objectID == 0)
{
ext->glGenRenderbuffers(1, &objectID);
if (objectID == 0)
if (objectID == 0)
return 0;
dirty = 1;
}
@@ -335,7 +335,7 @@ struct FrameBufferAttachment::Pimpl
TEXTURE2DARRAY,
TEXTURE2DMULTISAMPLE
};
TargetType targetType;
ref_ptr<RenderBuffer> renderbufferTarget;
ref_ptr<Texture> textureTarget;
@@ -426,7 +426,7 @@ FrameBufferAttachment::FrameBufferAttachment(TextureRectangle* target)
FrameBufferAttachment::FrameBufferAttachment(Camera::Attachment& attachment)
{
osg::Texture* texture = attachment._texture.get();
if (texture)
{
osg::Texture1D* texture1D = dynamic_cast<osg::Texture1D*>(texture);
@@ -461,7 +461,7 @@ FrameBufferAttachment::FrameBufferAttachment(Camera::Attachment& attachment)
_ximpl->zoffset = attachment._face;
return;
}
osg::Texture2DArray* texture2DArray = dynamic_cast<osg::Texture2DArray*>(texture);
if (texture2DArray)
{
@@ -556,9 +556,9 @@ void FrameBufferAttachment::createRequiredTexturesAndApplyGenerateMipMap(State &
return;
Texture::FilterMode minFilter = _ximpl->textureTarget->getFilter(Texture::MIN_FILTER);
if (minFilter==Texture::LINEAR_MIPMAP_LINEAR ||
minFilter==Texture::LINEAR_MIPMAP_NEAREST ||
minFilter==Texture::NEAREST_MIPMAP_LINEAR ||
if (minFilter==Texture::LINEAR_MIPMAP_LINEAR ||
minFilter==Texture::LINEAR_MIPMAP_NEAREST ||
minFilter==Texture::NEAREST_MIPMAP_LINEAR ||
minFilter==Texture::NEAREST_MIPMAP_NEAREST)
{
state.setActiveTextureUnit(0);
@@ -586,7 +586,7 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen
if (!tobj || tobj->id() == 0)
return;
}
switch (_ximpl->targetType)
{
default:
@@ -858,8 +858,8 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
if (_unsupported[contextID])
return;
FBOExtensions* ext = FBOExtensions::instance(contextID,true);
if (!ext->isSupported())
{
@@ -892,7 +892,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
if (dirtyAttachmentList)
{
// the set of of attachments appears to be thread sensitive, it shouldn't be because
// the set of of attachments appears to be thread sensitive, it shouldn't be because
// OpenGL FBO handles osg::FrameBufferObject has are multi-buffered...
// so as a temporary fix will stick in a mutex to ensure that only one thread passes through here
// at one time.
@@ -907,8 +907,8 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
}
}
ext->glBindFramebuffer(target, fboID);
// enable drawing buffers to render the result to fbo
@@ -936,7 +936,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
}
else
{
OSG_WARN <<
OSG_WARN <<
"Warning: FrameBufferObject: could not attach PACKED_DEPTH_STENCIL_BUFFER, "
"EXT_packed_depth_stencil is not supported !" << std::endl;
}
@@ -946,7 +946,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
fa.attach(state, target, convertBufferComponentToGLenum(i->first), ext);
break;
}
}
}
dirtyAttachmentList = 0;
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/FrameStamp>
@@ -36,7 +36,7 @@ FrameStamp::FrameStamp(const FrameStamp& fs):Referenced(true)
_frameNumber = fs._frameNumber;
_referenceTime = fs._referenceTime;
_simulationTime = fs._simulationTime;
tm_sec = fs.tm_sec; /* Seconds. [0-60] (1 leap second) */
tm_min = fs.tm_min; /* Minutes. [0-59] */
tm_hour = fs.tm_hour; /* Hours. [0-23] */
@@ -59,7 +59,7 @@ FrameStamp& FrameStamp::operator = (const FrameStamp& fs)
_frameNumber = fs._frameNumber;
_referenceTime = fs._referenceTime;
_simulationTime = fs._simulationTime;
tm_sec = fs.tm_sec; /* Seconds. [0-60] (1 leap second) */
tm_min = fs.tm_min; /* Minutes. [0-59] */
tm_hour = fs.tm_hour; /* Hours. [0-23] */

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2008 Zebra Imaging
*
* This application is open source and may be redistributed and/or modified
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commercial and non commercial
* applications, as long as this copyright notice is maintained.
*
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -516,12 +516,12 @@ void GL2Extensions::setupGL2Extensions(unsigned int contextID)
return;
}
_glVersion = findAsciiToFloat( version );
_glslLanguageVersion = 0.0f;
bool shadersBuiltIn = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;
_isShaderObjectsSupported = shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_shader_objects");
_isVertexShaderSupported = shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_vertex_shader");
_isFragmentShaderSupported = shadersBuiltIn || osg::isGLExtensionSupported(contextID,"GL_ARB_fragment_shader");
@@ -531,7 +531,7 @@ void GL2Extensions::setupGL2Extensions(unsigned int contextID)
_areTessellationShadersSupported = osg::isGLExtensionSupported(contextID, "GL_ARB_tessellation_shader");
_isUniformBufferObjectSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_uniform_buffer_object");
_isGetProgramBinarySupported = osg::isGLExtensionSupported(contextID,"GL_ARB_get_program_binary");
if( isGlslSupported() )
{
// If glGetString raises an error, assume initial release "1.00"

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLBeginEndAdapter>
@@ -284,7 +284,7 @@ void GLBeginEndAdapter::End()
_state->applyDisablingOfVertexAttributes();
if (_primitiveMode==GL_QUADS)
if (_primitiveMode==GL_QUADS)
{
_state->drawQuads(0, _vertices->size());
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLExtensions>
@@ -81,7 +81,7 @@ bool osg::isExtensionInExtensionString(const char *extension, const char *extens
}
if (*startOfWord && strcmp(extension, startOfWord) == 0)
return true;
return false;
}
@@ -97,9 +97,9 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
// first check to see if GL version number of recent enough.
bool result = requiredGLVersion <= osg::getGLVersionNumber();
if (!result)
{
{
// if not already set up, initialize all the per graphic context values.
if (!s_glInitializedList[contextID])
{
@@ -187,7 +187,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
}
if (wglextensions)
{
{
const char* startOfWord = wglextensions;
const char* endOfWord;
while ((endOfWord = strchr(startOfWord, ' ')))
@@ -213,7 +213,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
// true if extension found in extensionSet.
result = extensionSet.find(extension)!=extensionSet.end();
}
// now see if extension is in the extension disabled list
bool extensionDisabled = false;
if (result)
@@ -222,13 +222,13 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
const std::string& disableString = getGLExtensionDisableString();
if (!disableString.empty())
{
std::string::size_type pos=0;
while ( pos!=std::string::npos && (pos=disableString.find(extension,pos))!=std::string::npos )
{
std::string::size_type previousColon = disableString.find_last_of(':',pos);
std::string::size_type previousSemiColon = disableString.find_last_of(';',pos);
std::string renderer = "";
if (previousColon!=std::string::npos)
{
@@ -238,7 +238,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
if (!renderer.empty())
{
// remove leading spaces if they exist.
std::string::size_type leadingSpaces = renderer.find_first_not_of(' ');
if (leadingSpaces==std::string::npos) renderer = ""; // nothing but spaces
@@ -249,20 +249,20 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
if (trailingSpaces!=std::string::npos) renderer.erase(trailingSpaces+1,std::string::npos);
}
if (renderer.empty())
{
extensionDisabled = true;
break;
}
if (rendererString.find(renderer)!=std::string::npos)
{
extensionDisabled = true;
break;
}
// move the position in the disable string along so that the same extension is found multiple times
++pos;
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLObjects>

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2008 Zebra Imaging
*
* This application is open source and may be redistributed and/or modified
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commercial and non commercial
* applications, as long as this copyright notice is maintained.
*
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Geode>
@@ -53,22 +53,22 @@ bool Geode::addDrawable( Drawable *drawable )
{
// note ref_ptr<> automatically handles incrementing drawable's reference count.
_drawables.push_back(drawable);
// register as parent of drawable.
drawable->addParent(this);
if (drawable->requiresUpdateTraversal())
{
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
}
if (drawable->requiresEventTraversal())
{
setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()+1);
}
dirtyBound();
dirtyBound();
return true;
}
else return false;
@@ -109,14 +109,14 @@ bool Geode::removeDrawables(unsigned int pos,unsigned int numDrawablesToRemove)
{
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-updateCallbackRemoved);
}
if (eventCallbackRemoved)
{
setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-eventCallbackRemoved);
}
dirtyBound();
return true;
}
else return false;
@@ -138,7 +138,7 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable )
{
if (i<_drawables.size() && newDrawable)
{
Drawable* origDrawable = _drawables[i].get();
int deltaUpdate = 0;
@@ -160,7 +160,7 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable )
// remove from origDrawable's parent list.
origDrawable->removeParent(this);
// note ref_ptr<> automatically handles decrementing origGset's reference count,
// and incrementing newGset's reference count.
_drawables[i] = newDrawable;
@@ -170,7 +170,7 @@ bool Geode::setDrawable( unsigned int i, Drawable* newDrawable )
dirtyBound();
return true;
}
else return false;
@@ -212,7 +212,7 @@ void Geode::compileDrawables(RenderInfo& renderInfo)
void Geode::setThreadSafeRefUnref(bool threadSafe)
{
Node::setThreadSafeRefUnref(threadSafe);
for(DrawableList::const_iterator itr=_drawables.begin();
itr!=_drawables.end();
++itr)

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <stdlib.h>
@@ -92,14 +92,14 @@ Geometry::Geometry(const Geometry& geometry,const CopyOp& copyop):
setUseVertexBufferObjects(true);
}
}
}
Geometry::~Geometry()
{
// do dirty here to keep the getGLObjectSizeHint() estimate on the ball
dirtyDisplayList();
// no need to delete, all automatically handled by ref_ptr :-)
}
@@ -118,9 +118,9 @@ bool Geometry::empty() const
void Geometry::setVertexArray(Array* array)
{
_vertexData.array = array;
computeFastPathsUsed();
dirtyDisplayList();
_vertexData.array = array;
computeFastPathsUsed();
dirtyDisplayList();
dirtyBound();
if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array);
@@ -128,17 +128,17 @@ void Geometry::setVertexArray(Array* array)
void Geometry::setVertexIndices(IndexArray* array)
{
_vertexData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
_vertexData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
dirtyBound();
}
void Geometry::setVertexData(const ArrayData& arrayData)
{
_vertexData = arrayData;
computeFastPathsUsed();
dirtyDisplayList();
_vertexData = arrayData;
computeFastPathsUsed();
dirtyDisplayList();
dirtyBound();
if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get());
@@ -146,9 +146,9 @@ void Geometry::setVertexData(const ArrayData& arrayData)
void Geometry::setNormalArray(Array* array)
{
_normalData.array = array;
if (!_normalData.array.valid()) _normalData.binding=BIND_OFF;
computeFastPathsUsed();
_normalData.array = array;
if (!_normalData.array.valid()) _normalData.binding=BIND_OFF;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array);
@@ -156,15 +156,15 @@ void Geometry::setNormalArray(Array* array)
void Geometry::setNormalIndices(IndexArray* array)
{
_normalData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
_normalData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
}
void Geometry::setNormalData(const ArrayData& arrayData)
{
_normalData = arrayData;
computeFastPathsUsed();
_normalData = arrayData;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get());
@@ -173,8 +173,8 @@ void Geometry::setNormalData(const ArrayData& arrayData)
void Geometry::setColorArray(Array* array)
{
_colorData.array = array;
if (!_colorData.array.valid()) _colorData.binding=BIND_OFF;
computeFastPathsUsed();
if (!_colorData.array.valid()) _colorData.binding=BIND_OFF;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array);
@@ -182,15 +182,15 @@ void Geometry::setColorArray(Array* array)
void Geometry::setColorIndices(IndexArray* array)
{
_colorData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
_colorData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
}
void Geometry::setColorData(const ArrayData& arrayData)
{
_colorData = arrayData;
computeFastPathsUsed();
_colorData = arrayData;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get());
@@ -199,9 +199,9 @@ void Geometry::setColorData(const ArrayData& arrayData)
void Geometry::setSecondaryColorArray(Array* array)
{
_secondaryColorData.array = array;
if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF;
computeFastPathsUsed();
_secondaryColorData.array = array;
if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array);
@@ -209,15 +209,15 @@ void Geometry::setSecondaryColorArray(Array* array)
void Geometry::setSecondaryColorIndices(IndexArray* array)
{
_secondaryColorData.indices = array;
computeFastPathsUsed();
_secondaryColorData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
}
void Geometry::setSecondaryColorData(const ArrayData& arrayData)
{
_secondaryColorData = arrayData;
computeFastPathsUsed();
_secondaryColorData = arrayData;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get());
@@ -225,37 +225,37 @@ void Geometry::setSecondaryColorData(const ArrayData& arrayData)
void Geometry::setFogCoordArray(Array* array)
{
_fogCoordData.array = array;
if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF;
computeFastPathsUsed();
dirtyDisplayList();
_fogCoordData.array = array;
if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array);
}
void Geometry::setFogCoordIndices(IndexArray* array)
{
_fogCoordData.indices = array;
computeFastPathsUsed();
_fogCoordData.indices = array;
computeFastPathsUsed();
dirtyDisplayList();
}
void Geometry::setFogCoordData(const ArrayData& arrayData)
{
_fogCoordData = arrayData;
computeFastPathsUsed();
_fogCoordData = arrayData;
computeFastPathsUsed();
dirtyDisplayList();
if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get());
}
void Geometry::setNormalBinding(AttributeBinding ab)
void Geometry::setNormalBinding(AttributeBinding ab)
{
if (_normalData.binding == ab) return;
_normalData.binding = ab;
computeFastPathsUsed();
dirtyDisplayList();
dirtyDisplayList();
}
void Geometry::setColorBinding(AttributeBinding ab)
@@ -264,7 +264,7 @@ void Geometry::setColorBinding(AttributeBinding ab)
_colorData.binding = ab;
computeFastPathsUsed();
dirtyDisplayList();
dirtyDisplayList();
}
void Geometry::setSecondaryColorBinding(AttributeBinding ab)
@@ -273,7 +273,7 @@ void Geometry::setSecondaryColorBinding(AttributeBinding ab)
_secondaryColorData.binding = ab;
computeFastPathsUsed();
dirtyDisplayList();
dirtyDisplayList();
}
void Geometry::setFogCoordBinding(AttributeBinding ab)
@@ -282,14 +282,14 @@ void Geometry::setFogCoordBinding(AttributeBinding ab)
_fogCoordData.binding = ab;
computeFastPathsUsed();
dirtyDisplayList();
dirtyDisplayList();
}
void Geometry::setTexCoordData(unsigned int unit,const ArrayData& arrayData)
{
if (_texCoordList.size()<=unit)
_texCoordList.resize(unit+1);
_texCoordList[unit] = arrayData;
if (_useVertexBufferObjects && arrayData.array.valid()) addVertexBufferObjectIfRequired(arrayData.array.get());
@@ -299,7 +299,7 @@ Geometry::ArrayData& Geometry::getTexCoordData(unsigned int unit)
{
if (_texCoordList.size()<=unit)
_texCoordList.resize(unit+1);
return _texCoordList[unit];
}
@@ -307,7 +307,7 @@ const Geometry::ArrayData& Geometry::getTexCoordData(unsigned int unit) const
{
if (_texCoordList.size()<=unit)
return s_InvalidArrayData;
return _texCoordList[unit];
}
@@ -362,9 +362,9 @@ void Geometry::setVertexAttribData(unsigned int index, const Geometry::ArrayData
{
if (_vertexAttribList.size()<=index)
_vertexAttribList.resize(index+1);
_vertexAttribList[index] = attrData;
computeFastPathsUsed();
dirtyDisplayList();
@@ -375,7 +375,7 @@ Geometry::ArrayData& Geometry::getVertexAttribData(unsigned int index)
{
if (_vertexAttribList.size()<=index)
_vertexAttribList.resize(index+1);
return _vertexAttribList[index];
}
@@ -383,7 +383,7 @@ const Geometry::ArrayData& Geometry::getVertexAttribData(unsigned int index) con
{
if (_vertexAttribList.size()<=_vertexAttribList.size())
return s_InvalidArrayData;
return _vertexAttribList[index];
}
@@ -505,7 +505,7 @@ bool Geometry::insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset)
{
return addPrimitiveSet(primitiveset);
}
}
OSG_WARN<<"Warning: invalid index i or primitiveset passed to osg::Geometry::insertPrimitiveSet(i,primitiveset), ignoring call."<<std::endl;
return false;
@@ -543,7 +543,7 @@ bool Geometry::removePrimitiveSet(unsigned int i, unsigned int numElementsToRemo
OSG_WARN<<" removing on from i to the end of the list of primitive sets."<<std::endl;
_primitives.erase(_primitives.begin()+i,_primitives.end());
}
dirtyDisplayList();
dirtyBound();
return true;
@@ -573,7 +573,7 @@ bool Geometry::computeFastPathsUsed()
else if (_colorData.binding==BIND_PER_PRIMITIVE || (_colorData.binding==BIND_PER_VERTEX && _colorData.indices.valid())) _fastPath = false;
else if (_secondaryColorData.binding==BIND_PER_PRIMITIVE || (_secondaryColorData.binding==BIND_PER_VERTEX && _secondaryColorData.indices.valid())) _fastPath = false;
else if (_fogCoordData.binding==BIND_PER_PRIMITIVE || (_fogCoordData.binding==BIND_PER_VERTEX && _fogCoordData.indices.valid())) _fastPath = false;
else
else
{
for( unsigned int va = 0; va < _vertexAttribList.size(); ++va )
{
@@ -587,9 +587,9 @@ bool Geometry::computeFastPathsUsed()
const Array * array = _vertexAttribList[va].array.get();
const IndexArray * idxArray = _vertexAttribList[va].indices.get();
if( _vertexAttribList[va].binding==BIND_PER_VERTEX &&
if( _vertexAttribList[va].binding==BIND_PER_VERTEX &&
array && array->getNumElements()>0 &&
idxArray && idxArray->getNumElements()>0 )
idxArray && idxArray->getNumElements()>0 )
{
_fastPath = false;
break;
@@ -611,15 +611,15 @@ bool Geometry::computeFastPathsUsed()
{
if (texcoordData.indices->getNumElements()>0)
{
_fastPath = false;
_fastPath = false;
break;
}
}
}
}
_supportsVertexBufferObjects = _fastPath;
//_supportsVertexBufferObjects = false;
//_useVertexBufferObjects = false;
@@ -655,7 +655,7 @@ unsigned int Geometry::getGLObjectSizeHint() const
for( index = 0; index < _vertexAttribList.size(); ++index )
{
const Array* array = _vertexAttribList[index].array.get();
if (array) totalSize += array->getTotalDataSize();
if (array) totalSize += array->getTotalDataSize();
}
}
@@ -676,13 +676,13 @@ unsigned int Geometry::getGLObjectSizeHint() const
bool Geometry::getArrayList(ArrayList& arrayList) const
{
unsigned int startSize = arrayList.size();
if (_vertexData.array.valid()) arrayList.push_back(_vertexData.array.get());
if (_normalData.array.valid()) arrayList.push_back(_normalData.array.get());
if (_colorData.array.valid()) arrayList.push_back(_colorData.array.get());
if (_secondaryColorData.array.valid()) arrayList.push_back(_secondaryColorData.array.get());
if (_fogCoordData.array.valid()) arrayList.push_back(_fogCoordData.array.get());
for(unsigned int unit=0;unit<_texCoordList.size();++unit)
{
Array* array = _texCoordList[unit].array.get();
@@ -701,7 +701,7 @@ bool Geometry::getArrayList(ArrayList& arrayList) const
bool Geometry::getDrawElementsList(DrawElementsList& drawElementsList) const
{
unsigned int startSize = drawElementsList.size();
for(PrimitiveSetList::const_iterator itr = _primitives.begin();
itr != _primitives.end();
++itr)
@@ -709,7 +709,7 @@ bool Geometry::getDrawElementsList(DrawElementsList& drawElementsList) const
osg::DrawElements* de = (*itr)->getDrawElements();
if (de) drawElementsList.push_back(de);
}
return drawElementsList.size()!=startSize;
}
@@ -773,13 +773,13 @@ osg::ElementBufferObject* Geometry::getOrCreateElementBufferObject()
void Geometry::setUseVertexBufferObjects(bool flag)
{
// flag = true;
// OSG_NOTICE<<"Geometry::setUseVertexBufferObjects("<<flag<<")"<<std::endl;
if (_useVertexBufferObjects==flag) return;
Drawable::setUseVertexBufferObjects(flag);
ArrayList arrayList;
getArrayList(arrayList);
@@ -791,11 +791,11 @@ void Geometry::setUseVertexBufferObjects(bool flag)
if (_useVertexBufferObjects)
{
if (!arrayList.empty())
if (!arrayList.empty())
{
VertexBufferObjectList vboList;
osg::ref_ptr<osg::VertexBufferObject> vbo;
ArrayList::iterator vitr;
@@ -818,10 +818,10 @@ void Geometry::setUseVertexBufferObjects(bool flag)
}
}
if (!drawElementsList.empty())
if (!drawElementsList.empty())
{
ElementBufferObjectList eboList;
osg::ref_ptr<osg::ElementBufferObject> ebo;
DrawElementsList::iterator deitr;
@@ -1006,7 +1006,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
return;
}
#endif
if (_internalOptimizedGeometry.valid())
{
_internalOptimizedGeometry->drawImplementation(renderInfo);
@@ -1017,7 +1017,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
bool checkForGLErrors = state.getCheckForGLErrors()==osg::State::ONCE_PER_ATTRIBUTE;
if (checkForGLErrors) state.checkGLErrors("start of Geometry::drawImplementation()");
bool useFastPath = areFastPathsUsed();
// useFastPath = false;
@@ -1284,11 +1284,11 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
class AttributeFunctorArrayVisitor : public ArrayVisitor
{
public:
AttributeFunctorArrayVisitor(Drawable::AttributeFunctor& af):
_af(af),
_type(0) {}
virtual ~AttributeFunctorArrayVisitor() {}
virtual void apply(ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
@@ -1306,8 +1306,8 @@ class AttributeFunctorArrayVisitor : public ArrayVisitor
virtual void apply(Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
virtual void apply(Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
virtual void apply(Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
inline void applyArray(Drawable::AttributeType type,Array* array)
{
if (array)
@@ -1317,8 +1317,8 @@ class AttributeFunctorArrayVisitor : public ArrayVisitor
}
}
protected:
protected:
AttributeFunctorArrayVisitor& operator = (const AttributeFunctorArrayVisitor&) { return *this; }
Drawable::AttributeFunctor& _af;
Drawable::AttributeType _type;
@@ -1342,7 +1342,7 @@ void Geometry::accept(AttributeFunctor& af)
afav.applyArray(COLORS,_colorData.array.get());
afav.applyArray(SECONDARY_COLORS,_secondaryColorData.array.get());
afav.applyArray(FOG_COORDS,_fogCoordData.array.get());
for(unsigned unit=0;unit<_texCoordList.size();++unit)
{
afav.applyArray((AttributeType)(TEXTURE_COORDS_0+unit),_texCoordList[unit].array.get());
@@ -1357,11 +1357,11 @@ void Geometry::accept(AttributeFunctor& af)
class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor
{
public:
ConstAttributeFunctorArrayVisitor(Drawable::ConstAttributeFunctor& af):
_af(af),
_type(0) {}
virtual ~ConstAttributeFunctorArrayVisitor() {}
virtual void apply(const ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
@@ -1379,8 +1379,8 @@ class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor
virtual void apply(const Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
virtual void apply(const Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
virtual void apply(const Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
inline void applyArray(Drawable::AttributeType type,const Array* array)
{
if (array)
@@ -1389,7 +1389,7 @@ class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor
array->accept(*this);
}
}
protected:
ConstAttributeFunctorArrayVisitor& operator = (const ConstAttributeFunctorArrayVisitor&) { return *this; }
@@ -1401,7 +1401,7 @@ protected:
void Geometry::accept(ConstAttributeFunctor& af) const
{
ConstAttributeFunctorArrayVisitor afav(af);
if (_vertexData.array.valid())
{
afav.applyArray(VERTICES,_vertexData.array.get());
@@ -1446,29 +1446,29 @@ void Geometry::accept(PrimitiveFunctor& functor) const
{
switch(vertices->getType())
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec2*>(vertices->getDataPointer()));
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec3*>(vertices->getDataPointer()));
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec4*>(vertices->getDataPointer()));
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec2d*>(vertices->getDataPointer()));
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec3d*>(vertices->getDataPointer()));
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec4d*>(vertices->getDataPointer()));
break;
default:
OSG_WARN<<"Warning: Geometry::accept(PrimitiveFunctor&) cannot handle Vertex Array type"<<vertices->getType()<<std::endl;
return;
}
for(PrimitiveSetList::const_iterator itr=_primitives.begin();
itr!=_primitives.end();
++itr)
@@ -1487,22 +1487,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const
Array::Type type = vertices->getType();
switch(type)
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
vec2Array = static_cast<const Vec2*>(vertices->getDataPointer());
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
vec3Array = static_cast<const Vec3*>(vertices->getDataPointer());
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
vec4Array = static_cast<const Vec4*>(vertices->getDataPointer());
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
vec2dArray = static_cast<const Vec2d*>(vertices->getDataPointer());
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
vec3dArray = static_cast<const Vec3d*>(vertices->getDataPointer());
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
vec4dArray = static_cast<const Vec4d*>(vertices->getDataPointer());
break;
default:
@@ -1530,22 +1530,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const
{
switch(type)
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.vertex(vec2Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.vertex(vec3Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.vertex(vec4Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]);
break;
default:
@@ -1573,22 +1573,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const
{
switch(type)
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.vertex(vec2Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.vertex(vec3Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.vertex(vec4Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]);
break;
default:
@@ -1615,22 +1615,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const
unsigned int vindex=*primItr;
switch(type)
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.vertex(vec2Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.vertex(vec3Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.vertex(vec4Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]);
break;
default:
@@ -1653,22 +1653,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const
unsigned int vindex=*primItr;
switch(type)
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.vertex(vec2Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.vertex(vec3Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.vertex(vec4Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]);
break;
default:
@@ -1691,22 +1691,22 @@ void Geometry::accept(PrimitiveFunctor& functor) const
unsigned int vindex=*primItr;
switch(type)
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.vertex(vec2Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.vertex(vec3Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.vertex(vec4Array[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.vertex(vec2dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.vertex(vec3dArray[_vertexData.indices->index(vindex)]);
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.vertex(vec4dArray[_vertexData.indices->index(vindex)]);
break;
default:
@@ -1743,22 +1743,22 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const
switch(vertices->getType())
{
case(Array::Vec2ArrayType):
case(Array::Vec2ArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec2*>(vertices->getDataPointer()));
break;
case(Array::Vec3ArrayType):
case(Array::Vec3ArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec3*>(vertices->getDataPointer()));
break;
case(Array::Vec4ArrayType):
case(Array::Vec4ArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec4*>(vertices->getDataPointer()));
break;
case(Array::Vec2dArrayType):
case(Array::Vec2dArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec2d*>(vertices->getDataPointer()));
break;
case(Array::Vec3dArrayType):
case(Array::Vec3dArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec3d*>(vertices->getDataPointer()));
break;
case(Array::Vec4dArrayType):
case(Array::Vec4dArrayType):
functor.setVertexArray(vertices->getNumElements(),static_cast<const Vec4d*>(vertices->getDataPointer()));
break;
default:
@@ -1797,7 +1797,7 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const
{
functor.vertex(indices->index(vindex));
}
functor.end();
break;
}
@@ -1818,7 +1818,7 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const
functor.vertex(indices->index(vindex));
++vindex;
}
functor.end();
}
@@ -1887,7 +1887,7 @@ unsigned int _computeNumberOfPrimitives(const osg::Geometry& geom)
{
unsigned int totalNumberOfPrimitives = 0;
for(Geometry::PrimitiveSetList::const_iterator itr=geom.getPrimitiveSetList().begin();
itr!=geom.getPrimitiveSetList().end();
++itr)
@@ -1958,10 +1958,10 @@ bool _verifyBindings(const osg::Geometry& geom, const A& arrayData)
{
unsigned int numVertices = geom.getVertexIndices()?geom.getVertexIndices()->getNumElements():
geom.getVertexArray()?geom.getVertexArray()->getNumElements():0;
if (numElements!=numVertices) return false;
if (numElements!=numVertices) return false;
break;
}
}
}
return true;
}
@@ -1976,7 +1976,7 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
{
// correct binding if not correct.
if (arrayData.binding!=osg::Geometry::BIND_OFF)
{
{
out<<"Warning: in osg::Geometry::computeCorrectBindingsAndArraySizes() "<<std::endl
<<" "<<arrayName<<" binding has been reset to BIND_OFF"<<std::endl;
arrayData.binding=osg::Geometry::BIND_OFF;
@@ -1989,7 +1989,7 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
{
// correct binding if not correct.
if (arrayData.binding!=osg::Geometry::BIND_OVERALL)
{
{
out<<"Warning: in osg::Geometry::computeCorrectBindingsAndArraySizes() "<<std::endl
<<" "<<arrayName<<" binding has been reset to BIND_OVERALL"<<std::endl;
arrayData.binding=osg::Geometry::BIND_OVERALL;
@@ -2000,7 +2000,7 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
unsigned int numVertices = geom.getVertexIndices()?geom.getVertexIndices()->getNumElements():
geom.getVertexArray()?geom.getVertexArray()->getNumElements():0;
if ( numVertices==0 )
{
if (arrayData.binding!=osg::Geometry::BIND_OFF)
@@ -2013,7 +2013,7 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
<<" reseting "<<arrayName<< " binding to BIND_OFF and array & indices to 0."<<std::endl;
}
}
if (numElements==numVertices)
{
// correct the binding to per vertex.
@@ -2028,9 +2028,9 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
// check to see if binding might be per primitive set
// check to see if binding might be per primitive set
unsigned int numPrimitiveSets = geom.getPrimitiveSetList().size();
if (numElements==numPrimitiveSets)
{
if (arrayData.binding != osg::Geometry::BIND_PER_PRIMITIVE_SET)
@@ -2041,8 +2041,8 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
}
return;
}
// check to see if binding might be per primitive
// check to see if binding might be per primitive
unsigned int numPrimitives = _computeNumberOfPrimitives(geom);
if (numElements==numPrimitives)
{
@@ -2076,8 +2076,8 @@ void _computeCorrectBindingsAndArraySizes(std::ostream& out, const osg::Geometry
return;
}
arrayData.binding = osg::Geometry::BIND_OFF;
}
}
bool Geometry::verifyBindings(const ArrayData& arrayData) const
{
@@ -2126,7 +2126,7 @@ bool Geometry::verifyBindings() const
void Geometry::computeCorrectBindingsAndArraySizes()
{
// if (verifyBindings()) return;
computeCorrectBindingsAndArraySizes(_normalData,"_normalData");
computeCorrectBindingsAndArraySizes(_colorData,"_colorData");
computeCorrectBindingsAndArraySizes(_secondaryColorData,"_secondaryColorData");
@@ -2153,10 +2153,10 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor
ExpandIndexedArray(const osg::IndexArray& indices,Array* targetArray):
_indices(indices),
_targetArray(targetArray) {}
virtual ~ExpandIndexedArray() {}
// Create when both of the arrays are predefined templated classes. We
// Create when both of the arrays are predefined templated classes. We
// can do some optimizations in this case that aren't possible in the general
// case.
template <class T,class I>
@@ -2167,7 +2167,7 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor
// if source array type and target array type are equal but arrays arn't equal
if (_targetArray && _targetArray->getType()==array.getType() && _targetArray!=(osg::Array*)(&array))
{
// reuse exisiting target array
// reuse exisiting target array
newArray = static_cast<T*>(_targetArray);
if (newArray->size()!=indices.size())
{
@@ -2190,9 +2190,9 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor
}
// Create when one of the arrays isn't one of the predefined templated classes. The
// template parameter is the type of the array that will get created. This is always
// one of the predefined classes. We could call clone to get one of the same type as
// the input array, but the interface of the osg::Array class doesn't include a way
// template parameter is the type of the array that will get created. This is always
// one of the predefined classes. We could call clone to get one of the same type as
// the input array, but the interface of the osg::Array class doesn't include a way
// to set an element.
template <class T>
osg::Array* create_noinline(const osg::Array& array, const osg::IndexArray& indices)
@@ -2215,7 +2215,7 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor
osg::Array* create_noinline(const osg::Array& array, const osg::IndexArray& indices)
{
switch (array.getType())
switch (array.getType())
{
case(osg::Array::ByteArrayType): return create_noinline<osg::ByteArray>(array,indices);
case(osg::Array::ShortArrayType): return create_noinline<osg::ShortArray>(array,indices);
@@ -2239,9 +2239,9 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor
template <class TA, class TI>
osg::Array* create(const TA& array, const osg::IndexArray& indices)
{
// We know that indices.getType returned the same thing as TI, but
// we need to determine whether it is really an instance of TI, or
// perhaps another subclass of osg::Array that contains the same
// We know that indices.getType returned the same thing as TI, but
// we need to determine whether it is really an instance of TI, or
// perhaps another subclass of osg::Array that contains the same
// type of data.
const TI* ba(dynamic_cast<const TI*>(&indices));
if (ba != NULL) {
@@ -2265,7 +2265,7 @@ class ExpandIndexedArray : public osg::ConstArrayVisitor
case(osg::Array::UIntArrayType): return create<T, osg::UIntArray>(array, _indices);
default: return create_noinline(array, _indices);
}
}
// applys for the predefined classes go through 1-arg create to do indexing
@@ -2311,7 +2311,7 @@ bool Geometry::suitableForOptimization() const
{
if (getTexCoordIndices(ti)) hasIndices = true;
}
for(unsigned int vi=0;vi<getNumVertexAttribArrays();++vi)
{
if (getVertexAttribIndices(vi)) hasIndices = true;
@@ -2402,18 +2402,18 @@ void Geometry::copyToAndOptimize(Geometry& target)
if (getTexCoordIndices(ti) && getTexCoordArray(ti))
{
ExpandIndexedArray eia(*(getTexCoordIndices(ti)),target.getTexCoordArray(ti));
getTexCoordArray(ti)->accept(eia);
target.setTexCoordArray(ti,eia._targetArray);
target.setTexCoordIndices(ti,0);
}
else if (getTexCoordArray(ti))
else if (getTexCoordArray(ti))
{
if (!copyToSelf) target.setTexCoordArray(ti,getTexCoordArray(ti));
}
}
for(unsigned int vi=0;vi<_vertexAttribList.size();++vi)
{
ArrayData& arrayData = _vertexAttribList[vi];
@@ -2433,7 +2433,7 @@ void Geometry::copyToAndOptimize(Geometry& target)
bool Geometry::containsSharedArrays() const
{
unsigned int numSharedArrays = 0;
if (getVertexArray() && getVertexArray()->referenceCount()>1) ++numSharedArrays;
if (getNormalArray() && getNormalArray()->referenceCount()>1) ++numSharedArrays;
if (getColorArray() && getColorArray()->referenceCount()>1) ++numSharedArrays;
@@ -2444,7 +2444,7 @@ bool Geometry::containsSharedArrays() const
{
if (getTexCoordArray(ti) && getTexCoordArray(ti)->referenceCount()>1) ++numSharedArrays;
}
for(unsigned int vi=0;vi<_vertexAttribList.size();++vi)
{
const ArrayData& arrayData = _vertexAttribList[vi];
@@ -2474,7 +2474,7 @@ void Geometry::duplicateSharedArrays()
setTexCoordArray(ti, osg::clone(getTexCoordArray(ti),osg::CopyOp::DEEP_COPY_ARRAYS));
}
}
for(unsigned int vi=0;vi<_vertexAttribList.size();++vi)
{
ArrayData& arrayData = _vertexAttribList[vi];

View File

@@ -40,7 +40,7 @@ using namespace osg;
// Use a static reference pointer to hold the window system interface.
// Wrap this within a function, in order to control the order in which
// the static pointer's constructor is executed.
// the static pointer's constructor is executed.
static ref_ptr<GraphicsContext::WindowingSystemInterface> &windowingSystemInterfaceRef()
{
@@ -72,11 +72,11 @@ GraphicsContext* GraphicsContext::createGraphicsContext(Traits* traits)
{
// catch any undefined values.
if (traits) traits->setUndefinedScreenDetailsToDefaultScreen();
return wsref->createGraphicsContext(traits);
}
else
return 0;
return 0;
}
GraphicsContext::ScreenIdentifier::ScreenIdentifier():
@@ -112,9 +112,9 @@ void GraphicsContext::ScreenIdentifier::setScreenIdentifier(const std::string& d
{
std::string::size_type colon = displayName.find_last_of(':');
std::string::size_type point = displayName.find_last_of('.');
if (point!=std::string::npos &&
colon==std::string::npos &&
if (point!=std::string::npos &&
colon==std::string::npos &&
point < colon) point = std::string::npos;
if (colon==std::string::npos)
@@ -125,7 +125,7 @@ void GraphicsContext::ScreenIdentifier::setScreenIdentifier(const std::string& d
{
hostName = displayName.substr(0,colon);
}
std::string::size_type startOfDisplayNum = (colon==std::string::npos) ? 0 : colon+1;
std::string::size_type endOfDisplayNum = (point==std::string::npos) ? displayName.size() : point;
@@ -147,7 +147,7 @@ void GraphicsContext::ScreenIdentifier::setScreenIdentifier(const std::string& d
screenNum = -1;
}
#if 0
#if 0
OSG_NOTICE<<" hostName ["<<hostName<<"]"<<std::endl;
OSG_NOTICE<<" displayNum "<<displayNum<<std::endl;
OSG_NOTICE<<" screenNum "<<screenNum<<std::endl;
@@ -208,7 +208,7 @@ GraphicsContext::Traits::Traits(DisplaySettings* ds):
default: break;
}
}
glContextVersion = ds->getGLContextVersion();
glContextFlags = ds->getGLContextFlags();
glContextProfileMask = ds->getGLContextProfileMask();
@@ -237,7 +237,7 @@ public:
_numContexts(0) {}
unsigned int _numContexts;
void incrementUsageCount() { ++_numContexts; }
void decrementUsageCount()
@@ -249,11 +249,11 @@ public:
if (_numContexts <= 1 && _compileContext.valid())
{
OSG_INFO<<"resetting compileContext "<<_compileContext.get()<<" refCount "<<_compileContext->referenceCount()<<std::endl;
_compileContext = 0;
}
}
osg::ref_ptr<osg::GraphicsContext> _compileContext;
};
@@ -267,7 +267,7 @@ static GraphicsContext::GraphicsContexts s_registeredContexts;
unsigned int GraphicsContext::createNewContextID()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_contextIDMapMutex);
// first check to see if we can reuse contextID;
for(ContextIDMap::iterator itr = s_contextIDMap.begin();
itr != s_contextIDMap.end();
@@ -287,15 +287,15 @@ unsigned int GraphicsContext::createNewContextID()
unsigned int contextID = s_contextIDMap.size();
s_contextIDMap[contextID]._numContexts = 1;
OSG_INFO<<"GraphicsContext::createNewContextID() creating contextID="<<contextID<<std::endl;
OSG_INFO<<"Updating the MaxNumberOfGraphicsContexts to "<<contextID+1<<std::endl;
// update the the maximum number of graphics contexts,
// update the the maximum number of graphics contexts,
// to ensure that texture objects and display buffers are configured to the correct size.
osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts( contextID + 1 );
return contextID;
return contextID;
}
unsigned int GraphicsContext::getMaxContextID()
@@ -315,7 +315,7 @@ unsigned int GraphicsContext::getMaxContextID()
void GraphicsContext::incrementContextIDUsageCount(unsigned int contextID)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_contextIDMapMutex);
s_contextIDMap[contextID].incrementUsageCount();
OSG_INFO<<"GraphicsContext::incrementContextIDUsageCount("<<contextID<<") to "<<s_contextIDMap[contextID]._numContexts<<std::endl;
@@ -333,7 +333,7 @@ void GraphicsContext::decrementContextIDUsageCount(unsigned int contextID)
else
{
OSG_NOTICE<<"Warning: decrementContextIDUsageCount("<<contextID<<") called on expired contextID."<<std::endl;
}
}
OSG_INFO<<"GraphicsContext::decrementContextIDUsageCount("<<contextID<<") to "<<s_contextIDMap[contextID]._numContexts<<std::endl;
@@ -387,7 +387,7 @@ GraphicsContext::GraphicsContexts GraphicsContext::getRegisteredGraphicsContexts
}
OSG_INFO<<"GraphicsContext::getRegisteredGraphicsContexts "<<contextID<<" contexts.size()="<<contexts.size()<<std::endl;
return contexts;
}
@@ -395,14 +395,14 @@ GraphicsContext* GraphicsContext::getOrCreateCompileContext(unsigned int context
{
OSG_NOTICE<<"GraphicsContext::createCompileContext."<<std::endl;
{
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_contextIDMapMutex);
if (s_contextIDMap[contextID]._compileContext.valid()) return s_contextIDMap[contextID]._compileContext.get();
}
GraphicsContext::GraphicsContexts contexts = GraphicsContext::getRegisteredGraphicsContexts(contextID);
if (contexts.empty()) return 0;
GraphicsContext* src_gc = contexts.front();
const osg::GraphicsContext::Traits* src_traits = src_gc->getTraits();
@@ -422,7 +422,7 @@ GraphicsContext* GraphicsContext::getOrCreateCompileContext(unsigned int context
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits);
if (gc.valid() && gc->realize())
{
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_contextIDMapMutex);
s_contextIDMap[contextID]._compileContext = gc;
OSG_NOTICE<<" succeeded GraphicsContext::createCompileContext."<<std::endl;
@@ -432,7 +432,7 @@ GraphicsContext* GraphicsContext::getOrCreateCompileContext(unsigned int context
{
return 0;
}
}
void GraphicsContext::setCompileContext(unsigned int contextID, GraphicsContext* gc)
@@ -509,7 +509,7 @@ bool GraphicsContext::realize()
return true;
}
else
{
{
return false;
}
}
@@ -520,17 +520,17 @@ void GraphicsContext::close(bool callCloseImplementation)
// switch off the graphics thread...
setGraphicsThread(0);
bool sharedContextExists = false;
if (_state.valid())
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_contextIDMapMutex);
if (s_contextIDMap[_state->getContextID()]._numContexts>1) sharedContextExists = true;
}
// release all the OpenGL objects in the scene graphs associated with this
// release all the OpenGL objects in the scene graphs associated with this
for(Cameras::iterator itr = _cameras.begin();
itr != _cameras.end();
++itr)
@@ -575,11 +575,11 @@ void GraphicsContext::close(bool callCloseImplementation)
OSG_INFO<<"makeCurrent did not succeed, could not do flush/deletion of OpenGL objects."<<std::endl;
}
}
if (callCloseImplementation) closeImplementation();
// now discard any deleted deleted OpenGL objects that the are still hanging around - such as due to
// now discard any deleted deleted OpenGL objects that the are still hanging around - such as due to
// the the flushDelete*() methods not being invoked, such as when using GraphicContextEmbedded where makeCurrent
// does not work.
if ( !sharedContextExists && _state.valid())
@@ -592,7 +592,7 @@ void GraphicsContext::close(bool callCloseImplementation)
if (_state.valid())
{
decrementContextIDUsageCount(_state->getContextID());
_state = 0;
}
}
@@ -603,14 +603,14 @@ bool GraphicsContext::makeCurrent()
_threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread();
bool result = makeCurrentImplementation();
if (result)
{
// initialize extension process, not only initializes on first
// call, will be a non-op on subsequent calls.
// call, will be a non-op on subsequent calls.
getState()->initializeExtensionProcs();
}
return result;
}
@@ -623,19 +623,19 @@ bool GraphicsContext::makeContextCurrent(GraphicsContext* readContext)
_threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread();
// initialize extension process, not only initializes on first
// call, will be a non-op on subsequent calls.
// call, will be a non-op on subsequent calls.
getState()->initializeExtensionProcs();
}
return result;
}
bool GraphicsContext::releaseContext()
{
bool result = releaseContextImplementation();
_threadOfLastMakeCurrent = (OpenThreads::Thread*)(-1);
return result;
}
@@ -646,7 +646,7 @@ void GraphicsContext::swapBuffers()
swapBuffersCallbackOrImplemenation();
clear();
}
else if (_graphicsThread.valid() &&
else if (_graphicsThread.valid() &&
_threadOfLastMakeCurrent == _graphicsThread.get())
{
_graphicsThread->add(new SwapBuffersOperation);
@@ -669,9 +669,9 @@ void GraphicsContext::createGraphicsThread()
void GraphicsContext::setGraphicsThread(GraphicsThread* gt)
{
if (_graphicsThread==gt) return;
if (_graphicsThread==gt) return;
if (_graphicsThread.valid())
if (_graphicsThread.valid())
{
// need to kill the thread in some way...
_graphicsThread->cancel();
@@ -679,8 +679,8 @@ void GraphicsContext::setGraphicsThread(GraphicsThread* gt)
}
_graphicsThread = gt;
if (_graphicsThread.valid())
if (_graphicsThread.valid())
{
_graphicsThread->setParent(this);
}
@@ -722,7 +722,7 @@ void GraphicsContext::remove(Operation* operation)
void GraphicsContext::remove(const std::string& name)
{
OSG_INFO<<"Doing remove named operation"<<std::endl;
// acquire the lock on the operations queue to prevent anyone else for modifying it at the same time
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
@@ -768,7 +768,7 @@ void GraphicsContext::runOperations()
CameraVector camerasCopy;
std::copy(_cameras.begin(), _cameras.end(), std::back_inserter(camerasCopy));
std::sort(camerasCopy.begin(), camerasCopy.end(), CameraRenderOrderSortOp());
for(CameraVector::iterator itr = camerasCopy.begin();
itr != camerasCopy.end();
++itr)
@@ -799,7 +799,7 @@ void GraphicsContext::runOperations()
++itr;
}
}
if (_currentOperation.valid())
{
// OSG_INFO<<"Doing op "<<_currentOperation->getName()<<" "<<this<<std::endl;
@@ -807,7 +807,7 @@ void GraphicsContext::runOperations()
// call the graphics operation.
(*_currentOperation)(this);
{
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
_currentOperation = 0;
}
@@ -831,9 +831,9 @@ void GraphicsContext::removeCamera(osg::Camera* camera)
NodeSet nodes;
for(unsigned int i=0; i<camera->getNumChildren(); ++i)
{
nodes.insert(camera->getChild(i));
nodes.insert(camera->getChild(i));
}
for(Cameras::iterator citr = _cameras.begin();
citr != _cameras.end();
++citr)
@@ -846,9 +846,9 @@ void GraphicsContext::removeCamera(osg::Camera* camera)
NodeSet::iterator nitr = nodes.find(otherCamera->getChild(i));
if (nitr != nodes.end()) nodes.erase(nitr);
}
}
}
}
// now release the GLobjects associated with these non shared nodes
for(NodeSet::iterator nitr = nodes.begin();
nitr != nodes.end();
@@ -873,21 +873,21 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height)
std::set<osg::Viewport*> processedViewports;
if (!_traits) return;
double widthChangeRatio = double(width) / double(_traits->width);
double heigtChangeRatio = double(height) / double(_traits->height);
double aspectRatioChange = widthChangeRatio / heigtChangeRatio;
double aspectRatioChange = widthChangeRatio / heigtChangeRatio;
for(Cameras::iterator itr = _cameras.begin();
itr != _cameras.end();
++itr)
{
Camera* camera = (*itr);
// resize doesn't affect Cameras set up with FBO's.
if (camera->getRenderTargetImplementation()==osg::Camera::FRAME_BUFFER_OBJECT) continue;
Viewport* viewport = camera->getViewport();
if (viewport)
{

View File

@@ -22,26 +22,26 @@ using namespace OpenThreads;
GraphicsThread::GraphicsThread()
{
}
}
void GraphicsThread::run()
{
// make the graphics context current.
GraphicsContext* graphicsContext = dynamic_cast<GraphicsContext*>(_parent.get());
if (graphicsContext)
{
{
graphicsContext->makeCurrent();
graphicsContext->getState()->initializeExtensionProcs();
}
OperationThread::run();
// release operations before the thread stops working.
_operationQueue->releaseAllOperations();
_operationQueue->releaseAllOperations();
if (graphicsContext)
{
{
graphicsContext->releaseContext();
}
@@ -52,7 +52,7 @@ void GraphicsOperation::operator () (Object* object)
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
if (context) operator() (context);
}
void SwapBuffersOperation::operator () (GraphicsContext* context)
{
context->swapBuffersCallbackOrImplemenation();
@@ -71,7 +71,7 @@ void BarrierOperation::operator () (Object* /*object*/)
if (_preBlockOp==GL_FLUSH) glFlush();
else if (_preBlockOp==GL_FINISH) glFinish();
}
block();
}
@@ -85,13 +85,13 @@ void ReleaseContext_Block_MakeCurrentOperation::operator () (GraphicsContext* co
{
// release the graphics context.
context->releaseContext();
// reset the block so that it the next call to block()
// reset the block so that it the next call to block()
reset();
// block this thread, until the block is released externally.
block();
// re acquire the graphics context.
context->makeCurrent();
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -72,15 +72,15 @@ bool Group::addChild( Node *child )
bool Group::insertChild( unsigned int index, Node *child )
{
if (!child) return false;
#if ENSURE_CHILD_IS_UNIQUE
#if ENSURE_CHILD_IS_UNIQUE
if (containsNode(child))
{
OSG_WARN<<"Adding non unique child to osg::Group, ignoring call"<<std::endl;
return false;
}
#endif
if (child)
{
// note ref_ptr<> automatically handles incrementing child's reference count.
@@ -95,7 +95,7 @@ bool Group::insertChild( unsigned int index, Node *child )
// register as parent of child.
child->addParent(this);
// tell any subclasses that a child has been inserted so that they can update themselves.
childInserted(index);
@@ -185,7 +185,7 @@ bool Group::removeChildren(unsigned int pos,unsigned int numChildrenToRemove)
{
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-updateCallbackRemoved);
}
if (eventCallbackRemoved)
{
setNumChildrenRequiringEventTraversal(getNumChildrenRequiringEventTraversal()-eventCallbackRemoved);
@@ -195,14 +195,14 @@ bool Group::removeChildren(unsigned int pos,unsigned int numChildrenToRemove)
{
setNumChildrenWithCullingDisabled(getNumChildrenWithCullingDisabled()-numChildrenWithCullingDisabledRemoved);
}
if (numChildrenWithOccludersRemoved)
{
setNumChildrenWithOccluderNodes(getNumChildrenWithOccluderNodes()-numChildrenWithOccludersRemoved);
}
dirtyBound();
return true;
}
else return false;
@@ -226,9 +226,9 @@ bool Group::setChild( unsigned int i, Node* newNode )
{
if (i<_children.size() && newNode)
{
ref_ptr<Node> origNode = _children[i];
// first remove for origNode's parent list.
origNode->removeParent(this);
@@ -297,7 +297,7 @@ bool Group::setChild( unsigned int i, Node* newNode )
{
++delta_numChildrenWithCullingDisabled;
}
if (delta_numChildrenWithCullingDisabled!=0)
{
setNumChildrenWithCullingDisabled(
@@ -318,7 +318,7 @@ bool Group::setChild( unsigned int i, Node* newNode )
{
++delta_numChildrenWithOccluderNodes;
}
if (delta_numChildrenWithOccluderNodes!=0)
{
setNumChildrenWithOccluderNodes(
@@ -335,7 +335,7 @@ bool Group::setChild( unsigned int i, Node* newNode )
BoundingSphere Group::computeBound() const
{
BoundingSphere bsphere;
if (_children.empty())
if (_children.empty())
{
return bsphere;
}
@@ -358,7 +358,7 @@ BoundingSphere Group::computeBound() const
}
}
if (!bb.valid())
if (!bb.valid())
{
return bsphere;
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -50,7 +50,7 @@ void Hint::setTarget(GLenum target)
osg::StateSet* stateset = *itr;
stateset->removeAttribute(this);
}
// assign the hint target
_target = target;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>
@@ -111,7 +111,7 @@ void Image::DataIterator::operator ++ ()
{
// advance to next row
++_rowNum;
if (_rowNum>=_image->t())
{
// moved over end of current image so move to next
@@ -127,7 +127,7 @@ void Image::DataIterator::operator ++ ()
}
}
}
assign();
}
@@ -140,7 +140,7 @@ void Image::DataIterator::assign()
_currentSize = 0;
return;
}
//OSG_NOTICE<<"DataIterator::assign B"<<std::endl;
if (_image->isDataContiguous())
@@ -153,7 +153,7 @@ void Image::DataIterator::assign()
return;
}
//OSG_NOTICE<<"DataIterator::assign C"<<std::endl;
if (_image->isMipmap())
@@ -167,16 +167,16 @@ void Image::DataIterator::assign()
return;
}
const unsigned char* ptr = _image->getMipmapData(_mipmapNum);
int rowLength = _image->getRowLength()>>_mipmapNum;
if (rowLength==0) rowLength = 1;
int imageHeight = _image->t()>>_mipmapNum;
if (imageHeight==0) imageHeight = 1;
unsigned int rowWidthInBytes = Image::computeRowWidthInBytes(rowLength,_image->getPixelFormat(),_image->getDataType(),_image->getPacking());
unsigned int imageSizeInBytes = rowWidthInBytes*imageHeight;
_currentPtr = ptr + rowWidthInBytes*_rowNum + imageSizeInBytes*_imageNum;
_currentSize = rowWidthInBytes;
}
@@ -215,7 +215,7 @@ Image::Image()
_allocationMode(USE_NEW_DELETE),
_data(0L)
{
setDataVariance(STATIC);
setDataVariance(STATIC);
}
Image::Image(const Image& image,const CopyOp& copyop):
@@ -287,7 +287,7 @@ int Image::compare(const Image& rhs) const
if ((_data || rhs._data) && (_data == rhs._data)) return 0;
// slowest comparison at the bottom!
COMPARE_StateAttribute_Parameter(getFileName())
COMPARE_StateAttribute_Parameter(getFileName())
return 0;
}
@@ -322,7 +322,7 @@ bool Image::isPackedType(GLenum type)
case(GL_UNSIGNED_INT_10_10_10_2):
case(GL_UNSIGNED_INT_2_10_10_10_REV): return true;
default: return false;
}
}
}
@@ -369,7 +369,7 @@ GLenum Image::computePixelFormat(GLenum format)
case(GL_INTENSITY8UI_EXT):
case(GL_INTENSITY16UI_EXT):
case(GL_INTENSITY32UI_EXT):
OSG_WARN<<"Image::computePixelFormat("<<std::hex<<format<<std::dec<<") intensity pixel format is not correctly specified, so assume GL_LUMINANCE_INTEGER."<<std::endl;
OSG_WARN<<"Image::computePixelFormat("<<std::hex<<format<<std::dec<<") intensity pixel format is not correctly specified, so assume GL_LUMINANCE_INTEGER."<<std::endl;
return GL_LUMINANCE_INTEGER_EXT;
case(GL_LUMINANCE_ALPHA8I_EXT):
case(GL_LUMINANCE_ALPHA16I_EXT):
@@ -403,11 +403,11 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
switch (pixelFormat)
{
case GL_LUMINANCE32F_ARB:
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE_ALPHA32F_ARB:
case GL_LUMINANCE_ALPHA16F_ARB:
case GL_LUMINANCE_ALPHA16F_ARB:
case GL_RGB32F_ARB:
case GL_RGB16F_ARB:
case GL_RGB16F_ARB:
case GL_RGBA32F_ARB:
case GL_RGBA16F_ARB: return GL_FLOAT;
@@ -418,7 +418,7 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
case GL_RGB16UI_EXT:
case GL_RGBA16UI_EXT:
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE_ALPHA16UI_EXT: return GL_UNSIGNED_SHORT;
case GL_RGBA8UI_EXT:
@@ -426,7 +426,7 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT: return GL_UNSIGNED_BYTE;
case GL_RGBA32I_EXT:
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE_ALPHA32I_EXT: return GL_INT;
@@ -436,9 +436,9 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
case GL_LUMINANCE16I_EXT:
case GL_LUMINANCE_ALPHA16I_EXT: return GL_SHORT;
case GL_RGB8I_EXT:
case GL_RGBA8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_RGB8I_EXT:
case GL_RGBA8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT: return GL_BYTE;
case GL_RGBA:
@@ -447,7 +447,7 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
case GL_LUMINANCE_ALPHA:
case GL_ALPHA: return GL_UNSIGNED_BYTE;
default:
default:
{
OSG_WARN<<"error computeFormatType = "<<std::hex<<pixelFormat<<std::dec<<std::endl;
return 0;
@@ -466,7 +466,7 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 1;
case(GL_COMPRESSED_RED_RGTC1_EXT): return 1;
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): return 2;
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT): return 2;
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT): return 2;
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG): return 3;
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): return 3;
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG): return 4;
@@ -563,7 +563,7 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
OSG_WARN<<"error pixelFormat = "<<std::hex<<pixelFormat<<std::dec<<std::endl;
return 0;
}
}
}
}
@@ -632,41 +632,41 @@ unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type)
switch(type)
{
case(GL_BITMAP): return computeNumComponents(format);
case(GL_BYTE):
case(GL_UNSIGNED_BYTE): return 8*computeNumComponents(format);
case(GL_HALF_FLOAT_NV):
case(GL_SHORT):
case(GL_UNSIGNED_SHORT): return 16*computeNumComponents(format);
case(GL_INT):
case(GL_UNSIGNED_INT):
case(GL_FLOAT): return 32*computeNumComponents(format);
case(GL_UNSIGNED_BYTE_3_3_2):
case(GL_UNSIGNED_BYTE_3_3_2):
case(GL_UNSIGNED_BYTE_2_3_3_REV): return 8;
case(GL_UNSIGNED_SHORT_5_6_5):
case(GL_UNSIGNED_SHORT_5_6_5_REV):
case(GL_UNSIGNED_SHORT_4_4_4_4):
case(GL_UNSIGNED_SHORT_4_4_4_4_REV):
case(GL_UNSIGNED_SHORT_5_5_5_1):
case(GL_UNSIGNED_SHORT_1_5_5_5_REV): return 16;
case(GL_UNSIGNED_INT_8_8_8_8):
case(GL_UNSIGNED_INT_8_8_8_8_REV):
case(GL_UNSIGNED_INT_10_10_10_2):
case(GL_UNSIGNED_INT_2_10_10_10_REV): return 32;
default:
default:
{
OSG_WARN<<"error type = "<<type<<std::endl;
return 0;
}
}
}
}
@@ -710,7 +710,7 @@ unsigned int Image::computeRowWidthInBytes(int width,GLenum pixelFormat,GLenum t
unsigned int Image::computeImageSizeInBytes(int width,int height, int depth, GLenum pixelFormat,GLenum type,int packing)
{
if (width==0 || height==0 || depth==0) return 0;
return osg::maximum(
Image::computeRowWidthInBytes(width,pixelFormat,type,packing)*height*depth,
computeBlockSize(pixelFormat, packing)
@@ -757,7 +757,7 @@ bool Image::isCompressed() const
case(GL_COMPRESSED_RED_RGTC1_EXT):
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT):
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT):
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
@@ -770,12 +770,12 @@ bool Image::isCompressed() const
unsigned int Image::getTotalSizeInBytesIncludingMipmaps() const
{
if (_mipmapData.empty())
if (_mipmapData.empty())
{
// no mips so just return size of main image
return getTotalSizeInBytes();
}
int s = _s;
int t = _t;
int r = _r;
@@ -783,7 +783,7 @@ unsigned int Image::getTotalSizeInBytesIncludingMipmaps() const
for(unsigned int i=0;i<_mipmapData.size()+1;++i)
{
totalSize += computeImageSizeInBytes(s, t, r, _pixelFormat, _dataType, _packing);
s >>= 1;
t >>= 1;
r >>= 1;
@@ -796,11 +796,11 @@ unsigned int Image::getTotalSizeInBytesIncludingMipmaps() const
return totalSize;
}
void Image::setRowLength(int length)
{
void Image::setRowLength(int length)
{
_rowLength = length;
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (length > 0)
if (length > 0)
{
OSG_WARN << "Image::setRowLength is not supported on this platform, ignoring" << std::endl;
}
@@ -810,7 +810,7 @@ void Image::setRowLength(int length)
void Image::setInternalTextureFormat(GLint internalFormat)
{
// won't do any sanity checking right now, leave it to
// won't do any sanity checking right now, leave it to
// OpenGL to make the call.
_internalTextureFormat = internalFormat;
}
@@ -843,9 +843,9 @@ void Image::allocateImage(int s,int t,int r,
_mipmapData.clear();
unsigned int previousTotalSize = 0;
if (_data) previousTotalSize = computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing)*_t*_r;
unsigned int newTotalSize = computeRowWidthInBytes(s,format,type,packing)*t*r;
if (newTotalSize!=previousTotalSize)
@@ -865,14 +865,14 @@ void Image::allocateImage(int s,int t,int r,
_dataType = type;
_packing = packing;
_rowLength = 0;
// preserve internalTextureFormat if already set, otherwise
// use the pixelFormat as the source for the format.
if (_internalTextureFormat==0) _internalTextureFormat = format;
}
else
{
// failed to allocate memory, for now, will simply set values to 0.
_s = 0;
_t = 0;
@@ -881,12 +881,12 @@ void Image::allocateImage(int s,int t,int r,
_dataType = 0;
_packing = 0;
_rowLength = 0;
// commenting out reset of _internalTextureFormat as we are changing
// policy so that allocateImage honours previous settings of _internalTextureFormat.
//_internalTextureFormat = 0;
}
dirty();
}
@@ -912,7 +912,7 @@ void Image::setImage(int s,int t,int r,
_packing = packing;
_rowLength = rowLength;
dirty();
}
@@ -938,7 +938,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
const osg::Texture3D::Extensions* extensions3D = osg::Texture3D::getExtensions(contextID,true);
const osg::Texture2DArray::Extensions* extensions2DArray = osg::Texture2DArray::getExtensions(contextID,true);
GLboolean binding1D = GL_FALSE, binding2D = GL_FALSE, binding3D = GL_FALSE, binding2DArray = GL_FALSE, bindingCubeMap = GL_FALSE;
glGetBooleanv(GL_TEXTURE_BINDING_1D, &binding1D);
@@ -976,7 +976,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
break;
}
}
if (textureMode==0) return;
GLint internalformat;
@@ -1002,10 +1002,10 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
{
numMipMaps = 1;
}
// OSG_NOTICE<<"Image::readImageFromCurrentTexture() : numMipMaps = "<<numMipMaps<<std::endl;
GLint compressed = 0;
if (textureMode==GL_TEXTURE_2D)
@@ -1029,33 +1029,33 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
glGetTexLevelParameteriv(textureMode, 0, GL_TEXTURE_COMPRESSED_ARB,&compressed);
}
}
/* if the compression has been successful */
if (compressed == GL_TRUE)
{
MipmapDataType mipMapData;
unsigned int total_size = 0;
GLint i;
for(i=0;i<numMipMaps;++i)
{
if (i>0) mipMapData.push_back(total_size);
GLint compressed_size;
glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &compressed_size);
total_size += compressed_size;
}
unsigned char* data = new unsigned char[total_size];
if (!data)
{
OSG_WARN<<"Warning: Image::readImageFromCurrentTexture(..) out of memory, now image read."<<std::endl;
return;
return;
}
deallocateData(); // and sets it to NULL.
@@ -1073,7 +1073,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
_s = width;
_t = height;
_r = depth;
_pixelFormat = internalformat;
_dataType = type;
_internalTextureFormat = internalformat;
@@ -1088,7 +1088,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
}
dirty();
}
else
{
@@ -1107,22 +1107,22 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
for(i=0;i<numMipMaps;++i)
{
if (i>0) mipMapData.push_back(total_size);
glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_WIDTH, &width);
glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_HEIGHT, &height);
glGetTexLevelParameteriv(textureMode, i, GL_TEXTURE_DEPTH, &depth);
unsigned int level_size = computeRowWidthInBytes(width,internalformat,type,packing)*height*depth;
total_size += level_size;
}
unsigned char* data = new unsigned char[total_size];
if (!data)
{
OSG_WARN<<"Warning: Image::readImageFromCurrentTexture(..) out of memory, now image read."<<std::endl;
return;
return;
}
deallocateData(); // and sets it to NULL.
@@ -1135,7 +1135,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
_s = width;
_t = height;
_r = depth;
_pixelFormat = computePixelFormat(internalformat);
_dataType = type;
_internalTextureFormat = internalformat;
@@ -1143,14 +1143,14 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
_allocationMode=USE_NEW_DELETE;
_packing = packing;
_rowLength = rowLength;
for(i=0;i<numMipMaps;++i)
{
glGetTexImage(textureMode,i,_pixelFormat,_dataType,getMipmapData(i));
}
dirty();
}
}
#else
OSG_NOTICE<<"Warning: Image::readImageFromCurrentTexture() not supported."<<std::endl;
#endif
@@ -1286,7 +1286,7 @@ void Image::flipHorizontal()
{
unsigned int rowStepInBytes = getRowStepInBytes();
unsigned int imageStepInBytes = getImageStepInBytes();
for(int r=0;r<_r;++r)
{
for (int t=0; t<_t; ++t)
@@ -1312,7 +1312,7 @@ void Image::flipHorizontal()
OSG_WARN << "Error Image::flipHorizontal() did not succeed : cannot flip mipmapped image."<<std::endl;
return;
}
dirty();
}
@@ -1362,7 +1362,7 @@ void Image::flipVertical()
// its not a compressed image, so implement flip oursleves.
unsigned char* top = data(0,0,r);
unsigned char* bottom = top + (_t-1)*rowStep;
flipImageVertical(top, bottom, rowSize, rowStep);
}
}
@@ -1397,7 +1397,7 @@ void Image::flipVertical()
flipImageVertical(top, bottom, rowSize, rowStep);
}
}
}
}
dirty();
}
@@ -1428,7 +1428,7 @@ void Image::flipDepth()
for(; r_front<r_back; ++r_front,--r_back)
{
for(int row=0; row<_t; ++row)
{
{
unsigned char* front = data(0, row, r_front);
unsigned char* back = data(0, row, r_back);
for(unsigned int i=0; i<sizeOfRow; ++i, ++front, ++back)
@@ -1444,10 +1444,10 @@ void Image::ensureValidSizeForTexturing(GLint maxTextureSize)
{
int new_s = computeNearestPowerOfTwo(_s);
int new_t = computeNearestPowerOfTwo(_t);
if (new_s>maxTextureSize) new_s = maxTextureSize;
if (new_t>maxTextureSize) new_t = maxTextureSize;
if (new_s!=_s || new_t!=_t)
{
if (!_fileName.empty()) { OSG_NOTICE << "Scaling image '"<<_fileName<<"' from ("<<_s<<","<<_t<<") to ("<<new_s<<","<<new_t<<")"<<std::endl; }
@@ -1469,7 +1469,7 @@ bool Image::supportsTextureSubloading() const
}
template <typename T>
template <typename T>
bool _findLowerAlphaValueInRow(unsigned int num, T* data,T value, unsigned int delta)
{
for(unsigned int i=0;i<num;++i)
@@ -1480,7 +1480,7 @@ bool _findLowerAlphaValueInRow(unsigned int num, T* data,T value, unsigned int d
return false;
}
template <typename T>
template <typename T>
bool _maskedFindLowerAlphaValueInRow(unsigned int num, T* data,T value, T mask, unsigned int delta)
{
for(unsigned int i=0;i<num;++i)
@@ -1591,7 +1591,7 @@ bool Image::isImageTranslucent() const
0x00000003u,
0x00000003u, 1))
return true;
break;
break;
case(GL_UNSIGNED_INT_2_10_10_10_REV):
if (_maskedFindLowerAlphaValueInRow(s(), (unsigned int*)d,
0xc0000000u,
@@ -1619,7 +1619,7 @@ Geode* osg::createGeodeForImage(osg::Image* image)
}
#include <osg/TextureRectangle>
#include <osg/TextureRectangle>
Geode* osg::createGeodeForImage(osg::Image* image,float s,float t)
@@ -1704,7 +1704,7 @@ Geode* osg::createGeodeForImage(osg::Image* image,float s,float t)
}
}
template <typename T>
template <typename T>
Vec4 _readColor(GLenum pixelFormat, T* data,float scale)
{
switch(pixelFormat)

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -30,10 +30,10 @@ ImageSequence::ImageSequence()
_mode = PRE_LOAD_ALL_IMAGES;
_length = 1.0;
_timePerImage = 1.0;
_seekTime = 0.0;
_seekTimeSet = false;
_previousAppliedImageIndex = -1;
}
@@ -89,7 +89,7 @@ void ImageSequence::setLength(double length)
OSG_NOTICE<<"ImageSequence::setLength("<<length<<") invalid length value, must be greater than 0."<<std::endl;
return;
}
_length = length;
computeTimePerImage();
}
@@ -114,7 +114,7 @@ std::string ImageSequence::getImageFile(unsigned int pos) const
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
return pos<_fileNames.size() ? _fileNames[pos] : std::string();
}
void ImageSequence::addImageFile(const std::string& fileName)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
@@ -129,7 +129,7 @@ void ImageSequence::setImage(unsigned int pos, osg::Image* image)
OSG_INFO<<"ImageSequence::setImage("<<pos<<","<<image->getFileName()<<")"<<std::endl;
if (pos>=_images.size()) _images.resize(pos+1);
_images[pos] = image;
// prune from file requested list.
@@ -159,7 +159,7 @@ void ImageSequence::addImage(osg::Image* image)
_images.push_back(image);
computeTimePerImage();
if (data()==0)
{
setImageToChild(_images.front().get());
@@ -189,7 +189,7 @@ void ImageSequence::applyLoopingMode()
int ImageSequence::imageIndex(double time)
{
if (getLoopingMode()==LOOPING)
if (getLoopingMode()==LOOPING)
{
double positionRatio = time/_length;
time = (positionRatio - floor(positionRatio))*_length;
@@ -204,7 +204,7 @@ int ImageSequence::imageIndex(double time)
void ImageSequence::update(osg::NodeVisitor* nv)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
osg::NodeVisitor::ImageRequestHandler* irh = nv->getImageRequestHandler();
const osg::FrameStamp* fs = nv->getFrameStamp();
@@ -214,13 +214,13 @@ void ImageSequence::update(osg::NodeVisitor* nv)
{
_referenceTime = fs->getSimulationTime();
}
bool looping = getLoopingMode()==LOOPING;
double time = (fs->getSimulationTime() - _referenceTime)*_timeMultiplier;
if (_seekTimeSet || _status==PAUSED || _status==INVALID)
{
time = _seekTime;
time = _seekTime;
_referenceTime = fs->getSimulationTime() - time/_timeMultiplier;
}
else
@@ -242,13 +242,13 @@ void ImageSequence::update(osg::NodeVisitor* nv)
}
}
}
_seekTime = time;
_seekTimeSet = false;
bool pruneOldImages = false;
switch(_mode)
{
case(PRE_LOAD_ALL_IMAGES):
@@ -264,7 +264,7 @@ void ImageSequence::update(osg::NodeVisitor* nv)
_images.push_back(image);
}
}
irh = 0;
break;
}
@@ -294,22 +294,22 @@ void ImageSequence::update(osg::NodeVisitor* nv)
--index;
}
}
if (index>=0)
{
// OSG_NOTICE<<"at time "<<time<<" setting child = "<<index<<std::endl;
if (_previousAppliedImageIndex!=index)
{
if (_previousAppliedImageIndex >= 0 &&
_previousAppliedImageIndex<int(_images.size()) &&
if (_previousAppliedImageIndex >= 0 &&
_previousAppliedImageIndex<int(_images.size()) &&
pruneOldImages)
{
_images[_previousAppliedImageIndex] = 0;
}
setImageToChild(_images[index].get());
_previousAppliedImageIndex = index;
}
}
@@ -320,13 +320,13 @@ void ImageSequence::update(osg::NodeVisitor* nv)
if (irh)
{
double preLoadTime = time + osg::minimum(irh->getPreLoadTime()*_timeMultiplier, _length);
int startLoadIndex = int(time/_timePerImage);
if (startLoadIndex>=int(_images.size())) startLoadIndex = int(_images.size())-1;
if (startLoadIndex<0) startLoadIndex = 0;
int endLoadIndex = int(preLoadTime/_timePerImage);
if (endLoadIndex>=int(_fileNames.size()))
if (endLoadIndex>=int(_fileNames.size()))
{
if (looping)
{
@@ -338,9 +338,9 @@ void ImageSequence::update(osg::NodeVisitor* nv)
}
}
if (endLoadIndex<0) endLoadIndex = 0;
double requestTime = time;
if (endLoadIndex<startLoadIndex)
{
for(int i=startLoadIndex; i<int(_fileNames.size()); ++i)

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -19,8 +19,8 @@ ImageStream::ImageStream():
_status(INVALID),
_loopingMode(LOOPING)
{
setDataVariance(DYNAMIC);
setDataVariance(DYNAMIC);
#ifndef __APPLE__
// disabled under OSX for time being while we resolve why PBO
// doesn't function properly under OSX.

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -33,22 +33,22 @@ struct FindRangeOperator
_bmax(-FLT_MAX),
_amin(FLT_MAX),
_amax(-FLT_MAX) {}
float _rmin, _rmax, _gmin, _gmax, _bmin, _bmax, _amin, _amax;
inline void luminance(float l) { rgba(l,l,l,l); }
inline void alpha(float a) { rgba(1.0f,1.0f,1.0f,a); }
inline void luminance_alpha(float l,float a) { rgba(l,l,l,a); }
inline void luminance(float l) { rgba(l,l,l,l); }
inline void alpha(float a) { rgba(1.0f,1.0f,1.0f,a); }
inline void luminance_alpha(float l,float a) { rgba(l,l,l,a); }
inline void rgb(float r,float g,float b) { rgba(r,g,b,1.0f); }
inline void rgba(float r,float g,float b,float a)
{
_rmin = osg::minimum(r,_rmin);
_rmax = osg::maximum(r,_rmax);
_gmin = osg::minimum(g,_gmin);
_gmax = osg::maximum(g,_gmax);
_bmin = osg::minimum(b,_bmin);
_bmax = osg::maximum(b,_bmax);
_amin = osg::minimum(a,_amin);
_rmin = osg::minimum(r,_rmin);
_rmax = osg::maximum(r,_rmax);
_gmin = osg::minimum(g,_gmin);
_gmax = osg::maximum(g,_gmax);
_bmin = osg::minimum(b,_bmin);
_bmax = osg::maximum(b,_bmax);
_amin = osg::minimum(a,_amin);
_amax = osg::maximum(a,_amax);
}
@@ -59,29 +59,29 @@ struct FindRangeOperator
struct OffsetAndScaleOperator
{
OffsetAndScaleOperator(const osg::Vec4& offset, const osg::Vec4& scale):
_offset(offset),
_offset(offset),
_scale(scale) {}
osg::Vec4 _offset;
osg::Vec4 _scale;
inline void luminance(float& l) const { l= _offset.r() + l*_scale.r(); }
inline void alpha(float& a) const { a = _offset.a() + a*_scale.a(); }
inline void luminance(float& l) const { l= _offset.r() + l*_scale.r(); }
inline void alpha(float& a) const { a = _offset.a() + a*_scale.a(); }
inline void luminance_alpha(float& l,float& a) const
{
l= _offset.r() + l*_scale.r();
l= _offset.r() + l*_scale.r();
a = _offset.a() + a*_scale.a();
}
}
inline void rgb(float& r,float& g,float& b) const
{
r = _offset.r() + r*_scale.r();
g = _offset.g() + g*_scale.g();
r = _offset.r() + r*_scale.r();
g = _offset.g() + g*_scale.g();
b = _offset.b() + b*_scale.b();
}
inline void rgba(float& r,float& g,float& b,float& a) const
{
r = _offset.r() + r*_scale.r();
g = _offset.g() + g*_scale.g();
r = _offset.r() + r*_scale.r();
g = _offset.g() + g*_scale.g();
b = _offset.b() + b*_scale.b();
a = _offset.a() + a*_scale.a();
}
@@ -91,7 +91,7 @@ bool computeMinMax(const osg::Image* image, osg::Vec4& minValue, osg::Vec4& maxV
{
if (!image) return false;
osg::FindRangeOperator rangeOp;
osg::FindRangeOperator rangeOp;
readImage(image, rangeOp);
minValue.r() = rangeOp._rmin;
minValue.g() = rangeOp._gmin;
@@ -102,8 +102,8 @@ bool computeMinMax(const osg::Image* image, osg::Vec4& minValue, osg::Vec4& maxV
maxValue.g() = rangeOp._gmax;
maxValue.b() = rangeOp._bmax;
maxValue.a() = rangeOp._amax;
return minValue.r()<=maxValue.r() &&
return minValue.r()<=maxValue.r() &&
minValue.g()<=maxValue.g() &&
minValue.b()<=maxValue.b() &&
minValue.a()<=maxValue.a();
@@ -114,7 +114,7 @@ bool offsetAndScaleImage(osg::Image* image, const osg::Vec4& offset, const osg::
if (!image) return false;
modifyImage(image,OffsetAndScaleOperator(offset, scale));
return true;
}
@@ -174,10 +174,10 @@ struct RecordRowOperator
mutable std::vector<osg::Vec4> _colours;
mutable unsigned int _pos;
inline void luminance(float l) const { rgba(l,l,l,1.0f); }
inline void alpha(float a) const { rgba(1.0f,1.0f,1.0f,a); }
inline void luminance_alpha(float l,float a) const { rgba(l,l,l,a); }
inline void luminance(float l) const { rgba(l,l,l,1.0f); }
inline void alpha(float a) const { rgba(1.0f,1.0f,1.0f,a); }
inline void luminance_alpha(float l,float a) const { rgba(l,l,l,a); }
inline void rgb(float r,float g,float b) const { rgba(r,g,b,1.0f); }
inline void rgba(float r,float g,float b,float a) const { _colours[_pos++].set(r,g,b,a); }
};
@@ -189,10 +189,10 @@ struct WriteRowOperator
std::vector<osg::Vec4> _colours;
mutable unsigned int _pos;
inline void luminance(float& l) const { l = _colours[_pos++].r(); }
inline void alpha(float& a) const { a = _colours[_pos++].a(); }
inline void luminance_alpha(float& l,float& a) const { l = _colours[_pos].r(); a = _colours[_pos++].a(); }
inline void luminance(float& l) const { l = _colours[_pos++].r(); }
inline void alpha(float& a) const { a = _colours[_pos++].a(); }
inline void luminance_alpha(float& l,float& a) const { l = _colours[_pos].r(); a = _colours[_pos++].a(); }
inline void rgb(float& r,float& g,float& b) const { r = _colours[_pos].r(); g = _colours[_pos].g(); b = _colours[_pos].b(); }
inline void rgba(float& r,float& g,float& b,float& a) const { r = _colours[_pos].r(); g = _colours[_pos].g(); b = _colours[_pos].b(); a = _colours[_pos++].a(); }
};
@@ -278,11 +278,11 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
const unsigned char* srcData = srcImage->data(src_s, src_t+row, src_r+slice);
unsigned char* destData = destImage->data(dest_s, dest_t+row, dest_r+slice);
unsigned int numComponents = osg::Image::computeNumComponents(destImage->getPixelFormat());
_copyRowAndScale(srcData, srcImage->getDataType(), destData, destImage->getDataType(), (width*numComponents), scale);
}
}
return true;
}
}
@@ -290,7 +290,7 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
{
//OSG_NOTICE<<"copyImage("<<srcImage<<", "<<src_s<<", "<< src_t<<", "<<src_r<<", "<<width<<", "<<height<<", "<<depth<<std::endl;
//OSG_NOTICE<<" "<<destImage<<", "<<dest_s<<", "<< dest_t<<", "<<dest_r<<", "<<doRescale<<")"<<std::endl;
RecordRowOperator readOp(width);
WriteRowOperator writeOp;
@@ -302,20 +302,20 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
// reset the indices to beginning
readOp._pos = 0;
writeOp._pos = 0;
// read the pixels into readOp's _colour array
readRow(width, srcImage->getPixelFormat(), srcImage->getDataType(), srcImage->data(src_s,src_t+row,src_r+slice), readOp);
// pass readOp's _colour array contents over to writeOp (note this is just a pointer swap).
writeOp._colours.swap(readOp._colours);
modifyRow(width, destImage->getPixelFormat(), destImage->getDataType(), destImage->data(dest_s, dest_t+row,dest_r+slice), writeOp);
// return readOp's _colour array contents back to its rightful owner.
writeOp._colours.swap(readOp._colours);
}
}
return false;
}
@@ -327,8 +327,8 @@ struct SetToColourOperator
SetToColourOperator(const osg::Vec4& colour):
_colour(colour) {}
inline void luminance(float& l) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; }
inline void alpha(float& a) const { a = _colour.a(); }
inline void luminance(float& l) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; }
inline void alpha(float& a) const { a = _colour.a(); }
inline void luminance_alpha(float& l,float& a) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; a = _colour.a(); }
inline void rgb(float& r,float& g,float& b) const { r = _colour.r(); g = _colour.g(); b = _colour.b(); }
inline void rgba(float& r,float& g,float& b,float& a) const { r = _colour.r(); g = _colour.g(); b = _colour.b(); a = _colour.a(); }
@@ -341,7 +341,7 @@ bool clearImageToColor(osg::Image* image, const osg::Vec4& colour)
if (!image) return false;
modifyImage(image, SetToColourOperator(colour));
return true;
}
@@ -478,7 +478,7 @@ osg::Image* createImage3D(const ImageList& imageList,
pixelFormat==GL_BGR ||
pixelFormat==GL_BGRA)
{
int num_s = minimum(image->s(), image_3d->s());
int num_t = minimum(image->t(), image_3d->t());
int num_r = minimum(image->r(), (image_3d->r() - curr_dest_r));
@@ -492,7 +492,7 @@ osg::Image* createImage3D(const ImageList& imageList,
curr_dest_r += num_r;
}
}
return image_3d.release();
}
@@ -506,7 +506,7 @@ struct ModulateAlphaByLuminanceOperator
inline void rgb(float&,float&,float&) const {}
inline void rgba(float& r,float& g,float& b,float& a) const { float l = (r+g+b)*0.3333333; a *= l;}
};
osg::Image* createImage3DWithAlpha(const ImageList& imageList,
int s_maximumImageSize,
int t_maximumImageSize,
@@ -522,7 +522,7 @@ osg::Image* createImage3DWithAlpha(const ImageList& imageList,
desiredPixelFormat = GL_RGBA;
modulateAlphaByLuminance = true;
}
osg::ref_ptr<osg::Image> image = createImage3D(imageList,
desiredPixelFormat,
s_maximumImageSize,

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -69,7 +69,7 @@ struct TriangleIndicesCollector
const osg::Vec3& v0 = (*(_buildKdTree->_kdTree.getVertices()))[p0];
const osg::Vec3& v1 = (*(_buildKdTree->_kdTree.getVertices()))[p1];
const osg::Vec3& v2 = (*(_buildKdTree->_kdTree.getVertices()))[p2];
// discard degenerate points
if (v0==v1 || v1==v2 || v1==v2)
{
@@ -78,7 +78,7 @@ struct TriangleIndicesCollector
}
unsigned int i = _buildKdTree->_kdTree.addTriangle(KdTree::Triangle(p0,p1,p2));
osg::BoundingBox bb;
bb.expandBy(v0);
bb.expandBy(v1);
@@ -86,9 +86,9 @@ struct TriangleIndicesCollector
_buildKdTree->_centers.push_back(bb.center());
_buildKdTree->_primitiveIndices.push_back(i);
}
BuildKdTree* _buildKdTree;
};
@@ -100,27 +100,27 @@ struct TriangleIndicesCollector
bool BuildKdTree::build(KdTree::BuildOptions& options, osg::Geometry* geometry)
{
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<"osg::KDTreeBuilder::createKDTree()"<<std::endl;146
#endif
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
if (!vertices) return false;
if (vertices->size() <= options._targetNumTrianglesPerLeaf) return false;
_bb = geometry->getBound();
_kdTree.setVertices(vertices);
unsigned int estimatedSize = (unsigned int)(2.0*float(vertices->size())/float(options._targetNumTrianglesPerLeaf));
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<"kdTree->_kdNodes.reserve()="<<estimatedSize<<std::endl<<std::endl;
#endif
_kdTree.getNodes().reserve(estimatedSize*5);
computeDivisions(options);
options._numVerticesProcessed += vertices->size();
@@ -144,22 +144,22 @@ bool BuildKdTree::build(KdTree::BuildOptions& options, osg::Geometry* geometry)
osg::BoundingBox bb = _bb;
nodeNum = divide(options, bb, nodeNum, 0);
// now reorder the triangle list so that it's in order as per the primitiveIndex list.
KdTree::TriangleList triangleList(_kdTree.getTriangles().size());
for(unsigned int i=0; i<_primitiveIndices.size(); ++i)
{
triangleList[i] = _kdTree.getTriangle(_primitiveIndices[i]);
}
_kdTree.getTriangles().swap(triangleList);
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<"Root nodeNum="<<nodeNum<<std::endl;
#endif
// OSG_NOTICE<<"_kdNodes.size()="<<k_kdNodes.size()<<" estimated size = "<<estimatedSize<<std::endl;
// OSG_NOTICE<<"_kdLeaves.size()="<<_kdLeaves.size()<<" estimated size = "<<estimatedSize<<std::endl<<std::endl;
@@ -173,12 +173,12 @@ void BuildKdTree::computeDivisions(KdTree::BuildOptions& options)
_bb.yMax()-_bb.yMin(),
_bb.zMax()-_bb.zMin());
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<"computeDivisions("<<options._maxNumLevels<<") "<<dimensions<< " { "<<std::endl;
#endif
_axisStack.reserve(options._maxNumLevels);
for(unsigned int level=0; level<options._maxNumLevels; ++level)
{
int axis = 0;
@@ -193,12 +193,12 @@ void BuildKdTree::computeDivisions(KdTree::BuildOptions& options)
_axisStack.push_back(axis);
dimensions[axis] /= 2.0f;
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<" "<<level<<", "<<dimensions<<", "<<axis<<std::endl;
#endif
}
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<"}"<<std::endl;
#endif
}
@@ -209,14 +209,14 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
bool needToDivide = level < _axisStack.size() &&
(node.first<0 && static_cast<unsigned int>(node.second)>options._targetNumTrianglesPerLeaf);
if (!needToDivide)
{
if (node.first<0)
{
int istart = -node.first-1;
int iend = istart+node.second-1;
// leaf is done, now compute bound on it.
node.bb.init();
for(int i=istart; i<=iend; ++i)
@@ -228,7 +228,7 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
node.bb.expandBy(v0);
node.bb.expandBy(v1);
node.bb.expandBy(v2);
}
if (node.bb.valid())
@@ -241,8 +241,8 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
node.bb._max.y() += epsilon;
node.bb._max.z() += epsilon;
}
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
if (!node.bb.valid())
{
OSG_NOTICE<<"After reset "<<node.first<<","<<node.second<<std::endl;
@@ -262,19 +262,19 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
int axis = _axisStack[level];
#ifdef VERBOSE_OUTPUT
#ifdef VERBOSE_OUTPUT
OSG_NOTICE<<"divide("<<nodeIndex<<", "<<level<< "), axis="<<axis<<std::endl;
#endif
if (node.first<0)
{
{
// leaf node as first <= 0, so look at dividing it.
int istart = -node.first-1;
int iend = istart+node.second-1;
//OSG_NOTICE<<" divide leaf"<<std::endl;
float original_min = bb._min[axis];
float original_max = bb._max[axis];
@@ -288,13 +288,13 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
//osg::Vec3Array* vertices = kdTree._vertices.get();
int left = istart;
int right = iend;
while(left<right)
{
while(left<right && (_centers[_primitiveIndices[left]][axis]<=mid)) { ++left; }
while(left<right && (_centers[_primitiveIndices[right]][axis]>mid)) { --right; }
while(left<right && (_centers[_primitiveIndices[right]][axis]>mid)) { --right; }
if (left<right)
@@ -304,13 +304,13 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
--right;
}
}
if (left==right)
{
if (_centers[_primitiveIndices[left]][axis]<=mid) ++left;
else --right;
}
KdTree::KdNode leftLeaf(-istart-1, (right-istart)+1);
KdTree::KdNode rightLeaf(-left-1, (iend-left)+1);
@@ -357,7 +357,7 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
}
}
float restore = bb._max[axis];
bb._max[axis] = mid;
@@ -365,24 +365,24 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
int leftChildIndex = originalLeftChildIndex!=0 ? divide(options, bb, originalLeftChildIndex, level+1) : 0;
bb._max[axis] = restore;
restore = bb._min[axis];
bb._min[axis] = mid;
//OSG_NOTICE<<" divide rightLeaf "<<kdTree.getNode(nodeNum).second<<std::endl;
int rightChildIndex = originalRightChildIndex!=0 ? divide(options, bb, originalRightChildIndex, level+1) : 0;
bb._min[axis] = restore;
if (!insitueDivision)
{
// take a second reference to node we are working on as the std::vector<> resize could
// have invalidate the previous node ref.
KdTree::KdNode& newNodeRef = _kdTree.getNode(nodeIndex);
newNodeRef.first = leftChildIndex;
newNodeRef.second = rightChildIndex;
newNodeRef.second = rightChildIndex;
insitueDivision = true;
@@ -416,9 +416,9 @@ int BuildKdTree::divide(KdTree::BuildOptions& options, osg::BoundingBox& bb, int
{
OSG_NOTICE<<"NOT expecting to get here"<<std::endl;
}
return nodeIndex;
}
////////////////////////////////////////////////////////////////////////////////
@@ -443,7 +443,7 @@ struct IntersectKdTree
_length = _d.length();
_inverse_length = _length!=0.0f ? 1.0f/_length : 0.0;
_d *= _inverse_length;
_d_invX = _d.x()!=0.0f ? _d/_d.x() : osg::Vec3(0.0f,0.0f,0.0f);
_d_invY = _d.y()!=0.0f ? _d/_d.y() : osg::Vec3(0.0f,0.0f,0.0f);
_d_invZ = _d.z()!=0.0f ? _d/_d.z() : osg::Vec3(0.0f,0.0f,0.0f);
@@ -463,7 +463,7 @@ struct IntersectKdTree
osg::Vec3 _d;
float _length;
float _inverse_length;
osg::Vec3 _d_invX;
osg::Vec3 _d_invY;
osg::Vec3 _d_invZ;
@@ -480,11 +480,11 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls,
if (node.first<0)
{
// treat as a leaf
//OSG_NOTICE<<"KdTree::intersect("<<&leaf<<")"<<std::endl;
int istart = -node.first-1;
int iend = istart + node.second;
for(int i=istart; i<iend; ++i)
{
//const Triangle& tri = _triangles[_primitiveIndices[i]];
@@ -498,27 +498,27 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls,
osg::Vec3 T = _s - v0;
osg::Vec3 E2 = v2 - v0;
osg::Vec3 E1 = v1 - v0;
osg::Vec3 P = _d ^ E2;
float det = P * E1;
float r,r0,r1,r2;
const float esplison = 1e-10f;
if (det>esplison)
{
float u = (P*T);
if (u<0.0 || u>det) continue;
osg::Vec3 Q = T ^ E1;
float v = (Q*_d);
if (v<0.0 || v>det) continue;
if ((u+v)> det) continue;
float inv_det = 1.0f/det;
float t = (Q*E2)*inv_det;
float inv_det = 1.0f/det;
float t = (Q*E2)*inv_det;
if (t<0.0 || t>_length) continue;
u *= inv_det;
@@ -526,7 +526,7 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls,
r0 = 1.0f-u-v;
r1 = u;
r2 = v;
r2 = v;
r = t * _inverse_length;
}
else if (det<-esplison)
@@ -534,15 +534,15 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls,
float u = (P*T);
if (u>0.0 || u<det) continue;
osg::Vec3 Q = T ^ E1;
float v = (Q*_d);
if (v>0.0 || v<det) continue;
if ((u+v) < det) continue;
float inv_det = 1.0f/det;
float t = (Q*E2)*inv_det;
float inv_det = 1.0f/det;
float t = (Q*E2)*inv_det;
if (t<0.0 || t>_length) continue;
u *= inv_det;
@@ -561,7 +561,7 @@ void IntersectKdTree::intersect(const KdTree::KdNode& node, const osg::Vec3& ls,
osg::Vec3 in = v0*r0 + v1*r1 + v2*r2;
osg::Vec3 normal = E1^E2;
normal.normalize();
#if 1
_intersections.push_back(KdTree::LineSegmentIntersection());
KdTree::LineSegmentIntersection& intersection = _intersections.back();
@@ -704,7 +704,7 @@ bool IntersectKdTree::intersectAndClip(osg::Vec3& s, osg::Vec3& e, const osg::Bo
// clip e to zMax.
e = s+_d_invZ*(bb.zMax()-s.z());
}
}
}
else
{
if (s.z()<bb.zMin()) return false;
@@ -722,12 +722,12 @@ bool IntersectKdTree::intersectAndClip(osg::Vec3& s, osg::Vec3& e, const osg::Bo
s = s+_d_invZ*(bb.zMax()-s.z());
}
}
// OSG_NOTICE<<"clampped segment "<<s<<" "<<e<<std::endl;
// if (s==e) return false;
return true;
return true;
}
@@ -766,7 +766,7 @@ bool KdTree::build(BuildOptions& options, osg::Geometry* geometry)
bool KdTree::intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegmentIntersections& intersections) const
{
if (_kdNodes.empty())
if (_kdNodes.empty())
{
OSG_NOTICE<<"Warning: _kdTree is empty"<<std::endl;
return false;
@@ -779,9 +779,9 @@ bool KdTree::intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegme
_triangles,
intersections,
start, end);
intersector.intersect(getNode(0), start, end);
return numIntersectionsBefore != intersections.size();
}
@@ -790,7 +790,7 @@ bool KdTree::intersect(const osg::Vec3d& start, const osg::Vec3d& end, LineSegme
// KdTreeBuilder
KdTreeBuilder::KdTreeBuilder():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
{
_kdTreePrototype = new osg::KdTree;
}
@@ -804,7 +804,7 @@ KdTreeBuilder::KdTreeBuilder(const KdTreeBuilder& rhs):
void KdTreeBuilder::apply(osg::Geode& geode)
{
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
{
osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
if (geom)
@@ -819,6 +819,6 @@ void KdTreeBuilder::apply(osg::Geode& geode)
{
geom->setShape(kdTree.get());
}
}
}
}
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/LOD>
@@ -66,12 +66,12 @@ void LOD::traverse(NodeVisitor& nv)
}
}
}
unsigned int numChildren = _children.size();
if (_rangeList.size()<numChildren) numChildren=_rangeList.size();
for(unsigned int i=0;i<numChildren;++i)
{
{
if (_rangeList[i].first<=required_range && required_range<_rangeList[i].second)
{
_children[i]->accept(nv);
@@ -109,7 +109,7 @@ bool LOD::addChild( Node *child )
if (Group::addChild(child))
{
if (_children.size()>_rangeList.size())
if (_children.size()>_rangeList.size())
{
float maxRange = !_rangeList.empty() ? _rangeList.back().second : 0.0f;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Light>
@@ -58,7 +58,7 @@ void Light::init( void )
// OSG_DEBUG << "_quadratic_attenuation "<<_quadratic_attenuation<<std::endl;
}
void Light::setLightNum(int num)
void Light::setLightNum(int num)
{
if (_lightnum==num) return;
@@ -85,7 +85,7 @@ void Light::setLightNum(int num)
osg::StateSet* stateset = *itr;
stateset->removeAttribute(this);
}
// assign the hint target
_lightnum = num;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <string.h>
@@ -70,7 +70,7 @@ void LightModel::apply(State&) const
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR);
}
}
#ifndef OSG_GLES1_AVAILABLE
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,_localViewer);
#endif

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/LightSource>
@@ -61,7 +61,7 @@ void LightSource::setLocalStateSetModes(StateAttribute::GLModeValue value)
BoundingSphere LightSource::computeBound() const
{
BoundingSphere bsphere(Group::computeBound());
if (_light.valid() && _referenceFrame==RELATIVE_RF)
{
const Vec4& pos = _light->getPosition();

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/LineSegment>
@@ -208,9 +208,9 @@ bool LineSegment::intersect(const BoundingSphere& bs,float& r1,float& r2) const
// check for zero length segment.
if (a==0.0)
{
// check if start point outside sphere radius
// check if start point outside sphere radius
if (c>0.0) return false;
// length segment within radius of bounding sphere but zero length
// so return true, and set the ratio so the start point is the one
// to be used.
@@ -254,9 +254,9 @@ bool LineSegment::intersect(const BoundingSphere& bs,double& r1,double& r2) cons
// check for zero length segment.
if (a==0.0)
{
// check if start point outside sphere radius
// check if start point outside sphere radius
if (c>0.0) return false;
// length segment within radius of bounding sphere but zero length
// so return true, and set the ratio so the start point is the one
// to be used.

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>
@@ -32,7 +32,7 @@ void LineStipple::setFactor(GLint factor)
{
_factor = factor;
}
void LineStipple::setPattern(GLushort pattern)
{
_pattern = pattern;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/LogicOp>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Material>
@@ -49,7 +49,7 @@ Material::~Material()
Material& Material:: operator = (const Material& rhs)
{
if (&rhs==this) return *this;
_colorMode= rhs._colorMode;
_ambientFrontAndBack= rhs._ambientFrontAndBack;
_ambientFront= rhs._ambientFront;
@@ -66,7 +66,7 @@ Material& Material:: operator = (const Material& rhs)
_shininessFrontAndBack= rhs._shininessFrontAndBack;
_shininessFront= rhs._shininessFront;
_shininessBack= rhs._shininessBack;
return *this;
}
@@ -265,7 +265,7 @@ const Vec4& Material::getEmission(Face face) const
void Material::setShininess(Face face, float shininess )
{
clampBetweenRange(shininess,0.0f,128.0f,"Material::setShininess()");
switch(face)
{
case(FRONT):
@@ -327,7 +327,7 @@ void Material::setTransparency(Face face,float transparency)
_specularBack[3] = 1.0f-transparency;
_emissionBack[3] = 1.0f-transparency;
}
}
}
void Material::setAlpha(Face face,float alpha)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -32,7 +32,7 @@ double osg::asciiToDouble(const char* str)
while (
*ptr!=0 &&
((*ptr>='0' && *ptr<='9') ||
(*ptr>='a' && *ptr<='f') ||
(*ptr>='a' && *ptr<='f') ||
(*ptr>='A' && *ptr<='F'))
)
{
@@ -41,24 +41,24 @@ double osg::asciiToDouble(const char* str)
else if (*ptr>='A' && *ptr<='F') value = value*16.0 + double(*ptr-'A'+10);
++ptr;
}
// OSG_NOTICE<<"Read "<<str<<" result = "<<value<<std::endl;
return value;
}
ptr = str;
bool hadDecimal[2];
double value[2];
double sign[2];
double decimalMultiplier[2];
hadDecimal[0] = hadDecimal[1] = false;
sign[0] = sign[1] = 1.0;
value[0] = value[1] = 0.0;
decimalMultiplier[0] = decimalMultiplier[1] = 0.1;
int pos = 0;
// compute mantissa and exponent parts
while (*ptr!=0 && pos<2)
{
@@ -89,7 +89,7 @@ double osg::asciiToDouble(const char* str)
else if (*ptr=='e' || *ptr=='E')
{
if (pos==1) break;
pos = 1;
}
else

View File

@@ -45,14 +45,14 @@ namespace MatrixDecomposition
typedef struct {double x, y, z, w;} Quat; // Quaternion
enum QuatPart {X, Y, Z, W};
typedef double _HMatrix[4][4];
typedef Quat HVect; // Homogeneous 3D vector
typedef Quat HVect; // Homogeneous 3D vector
typedef struct
{
osg::Vec4d t; // Translation Component;
Quat q; // Essential Rotation
Quat u; //Stretch rotation
HVect k; //Sign of determinant
double f; // Sign of determinant
Quat u; //Stretch rotation
HVect k; //Sign of determinant
double f; // Sign of determinant
} _affineParts;
HVect spectDecomp(_HMatrix S, _HMatrix U);
@@ -343,7 +343,7 @@ namespace MatrixDecomposition
double det, M_one, M_inf, MadjT_one, MadjT_inf, E_one, gamma, g1, g2;
int i, j;
mat_tpose(Mk,=,M,3);
mat_tpose(Mk,=,M,3);
M_one = norm_one(Mk); M_inf = norm_inf(Mk);
do
@@ -352,21 +352,21 @@ namespace MatrixDecomposition
det = vdot(Mk[0], MadjTk[0]);
if (det==0.0)
{
do_rank2(Mk, MadjTk, Mk);
do_rank2(Mk, MadjTk, Mk);
break;
}
MadjT_one = norm_one(MadjTk);
MadjT_one = norm_one(MadjTk);
MadjT_inf = norm_inf(MadjTk);
gamma = sqrt(sqrt((MadjT_one*MadjT_inf)/(M_one*M_inf))/fabs(det));
g1 = gamma*0.5;
g2 = 0.5/(gamma*det);
matrixCopy(Ek,=,Mk,3);
matBinop(Mk,=,g1*Mk,+,g2*MadjTk,3);
matrixCopy(Ek,=,Mk,3);
matBinop(Mk,=,g1*Mk,+,g2*MadjTk,3);
mat_copy(Ek,-=,Mk,3);
E_one = norm_one(Ek);
M_one = norm_one(Mk);
M_one = norm_one(Mk);
M_inf = norm_inf(Mk);
} while(E_one>(M_one*TOL));
@@ -374,7 +374,7 @@ namespace MatrixDecomposition
mat_tpose(Q,=,Mk,3); mat_pad(Q);
mat_mult(Mk, M, S); mat_pad(S);
for (i=0; i<3; i++)
for (i=0; i<3; i++)
for (j=i; j<3; j++)
S[i][j] = S[j][i] = 0.5*(S[i][j]+S[j][i]);
return (det);
@@ -456,14 +456,14 @@ namespace MatrixDecomposition
ka[X] = k->x; ka[Y] = k->y; ka[Z] = k->z;
if (ka[X]==ka[Y]) {
if (ka[X]==ka[Z])
turn = W;
if (ka[X]==ka[Z])
turn = W;
else turn = Z;
}
else {
if (ka[X]==ka[Z])
turn = Y;
else if (ka[Y]==ka[Z])
if (ka[X]==ka[Z])
turn = Y;
else if (ka[Y]==ka[Z])
turn = X;
}
if (turn>=0) {
@@ -489,12 +489,12 @@ namespace MatrixDecomposition
}
if (mag[0]>mag[1]) {
if (mag[0]>mag[2])
win = 0;
if (mag[0]>mag[2])
win = 0;
else win = 2;
}
else {
if (mag[1]>mag[2]) win = 1;
if (mag[1]>mag[2]) win = 1;
else win = 2;
}
@@ -508,7 +508,7 @@ namespace MatrixDecomposition
t = sqrt(mag[win]+0.5);
p = Qt_Mul(p, Qt_(0.0,0.0,-qp.z/t,qp.w/t));
p = Qt_Mul(qtoz, Qt_Conj(p));
}
}
else {
double qa[4], pa[4];
unsigned int lo, hi;
@@ -524,10 +524,10 @@ namespace MatrixDecomposition
}
/* Find two largest components, indices in hi and lo */
if (qa[0]>qa[1]) lo = 0;
if (qa[0]>qa[1]) lo = 0;
else lo = 1;
if (qa[2]>qa[3]) hi = 2;
if (qa[2]>qa[3]) hi = 2;
else hi = 3;
if (qa[lo]>qa[hi]) {
@@ -537,7 +537,7 @@ namespace MatrixDecomposition
else {
hi ^= lo; lo ^= hi; hi ^= lo;
}
}
}
else {
if (qa[hi^1]>qa[lo]) lo = hi^1;
}
@@ -549,22 +549,22 @@ namespace MatrixDecomposition
if (all>big) {/*all*/
{int i; for (i=0; i<4; i++) pa[i] = sgn(neg[i], 0.5);}
cycle(ka,par);
}
}
else {/*big*/ pa[hi] = sgn(neg[hi],1.0);}
} else {
if (two>big) { /*two*/
pa[hi] = sgn(neg[hi],SQRTHALF);
pa[hi] = sgn(neg[hi],SQRTHALF);
pa[lo] = sgn(neg[lo], SQRTHALF);
if (lo>hi) {
hi ^= lo; lo ^= hi; hi ^= lo;
}
if (hi==W) {
hi = "\001\002\000"[lo];
hi = "\001\002\000"[lo];
lo = 3-hi-lo;
}
swap(ka,hi,lo);
}
else {/*big*/
}
else {/*big*/
pa[hi] = sgn(neg[hi],1.0);
}
}
@@ -609,7 +609,7 @@ void osg::Matrixf::decompose(osg::Vec3d& t,
MatrixDecomposition::decompAffine(hmatrix, &parts);
double mul = 1.0;
if (parts.t[MatrixDecomposition::W] != 0.0)
if (parts.t[MatrixDecomposition::W] != 0.0)
mul = 1.0 / parts.t[MatrixDecomposition::W];
t[0] = parts.t[MatrixDecomposition::X] * mul;
@@ -619,7 +619,7 @@ void osg::Matrixf::decompose(osg::Vec3d& t,
r.set(parts.q.x, parts.q.y, parts.q.z, parts.q.w);
mul = 1.0;
if (parts.k.w != 0.0)
if (parts.k.w != 0.0)
mul = 1.0 / parts.k.w;
// mul be sign of determinant to support negative scales.
@@ -663,7 +663,7 @@ void osg::Matrixd::decompose(osg::Vec3d& t,
MatrixDecomposition::decompAffine(hmatrix, &parts);
double mul = 1.0;
if (parts.t[MatrixDecomposition::W] != 0.0)
if (parts.t[MatrixDecomposition::W] != 0.0)
mul = 1.0 / parts.t[MatrixDecomposition::W];
t[0] = parts.t[MatrixDecomposition::X] * mul;
@@ -673,7 +673,7 @@ void osg::Matrixd::decompose(osg::Vec3d& t,
r.set(parts.q.x, parts.q.y, parts.q.z, parts.q.w);
mul = 1.0;
if (parts.k.w != 0.0)
if (parts.k.w != 0.0)
mul = 1.0 / parts.k.w;
// mul be sign of determinant to support negative scales.

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/MatrixTransform>
@@ -24,7 +24,7 @@ MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp&
_matrix(transform._matrix),
_inverse(transform._inverse),
_inverseDirty(transform._inverseDirty)
{
{
}
MatrixTransform::MatrixTransform(const Matrix& mat )

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -87,44 +87,44 @@ void Matrix_implementation::setRotate(const Quat& q)
{
rlength2 = 2.0;
}
// Source: Gamasutra, Rotating Objects Using Quaternions
//
//http://www.gamasutra.com/features/19980703/quaternions_01.htm
double wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2;
// calculate coefficients
x2 = rlength2*QX;
y2 = rlength2*QY;
z2 = rlength2*QZ;
xx = QX * x2;
xy = QX * y2;
xz = QX * z2;
yy = QY * y2;
yz = QY * z2;
zz = QZ * z2;
wx = QW * x2;
wy = QW * y2;
wz = QW * z2;
// Note. Gamasutra gets the matrix assignments inverted, resulting
// in left-handed rotations, which is contrary to OpenGL and OSG's
// in left-handed rotations, which is contrary to OpenGL and OSG's
// methodology. The matrix assignment has been altered in the next
// few lines of code to do the right thing.
// Don Burns - Oct 13, 2001
_mat[0][0] = 1.0 - (yy + zz);
_mat[1][0] = xy - wz;
_mat[2][0] = xz + wy;
_mat[0][1] = xy + wz;
_mat[1][1] = 1.0 - (xx + zz);
_mat[2][1] = yz - wx;
_mat[0][2] = xz - wy;
_mat[1][2] = yz + wx;
_mat[2][2] = 1.0 - (xx + yy);
@@ -171,29 +171,29 @@ Quat Matrix_implementation::getRotate() const
{
/* perform instant calculation */
QW = tq[0];
QX = _mat[1][2]-_mat[2][1];
QY = _mat[2][0]-_mat[0][2];
QZ = _mat[0][1]-_mat[1][0];
QX = _mat[1][2]-_mat[2][1];
QY = _mat[2][0]-_mat[0][2];
QZ = _mat[0][1]-_mat[1][0];
}
else if (j==1)
{
QW = _mat[1][2]-_mat[2][1];
QW = _mat[1][2]-_mat[2][1];
QX = tq[1];
QY = _mat[0][1]+_mat[1][0];
QZ = _mat[2][0]+_mat[0][2];
QY = _mat[0][1]+_mat[1][0];
QZ = _mat[2][0]+_mat[0][2];
}
else if (j==2)
{
QW = _mat[2][0]-_mat[0][2];
QX = _mat[0][1]+_mat[1][0];
QW = _mat[2][0]-_mat[0][2];
QX = _mat[0][1]+_mat[1][0];
QY = tq[2];
QZ = _mat[1][2]+_mat[2][1];
QZ = _mat[1][2]+_mat[2][1];
}
else /* if (j==3) */
{
QW = _mat[0][1]-_mat[1][0];
QX = _mat[2][0]+_mat[0][2];
QY = _mat[1][2]+_mat[2][1];
QW = _mat[0][1]-_mat[1][0];
QX = _mat[2][0]+_mat[0][2];
QY = _mat[1][2]+_mat[2][1];
QZ = tq[3];
}
@@ -408,7 +408,7 @@ void Matrix_implementation::makeRotate( value_type angle, const Vec3d& axis )
setRotate(quat);
}
void Matrix_implementation::makeRotate( value_type angle, value_type x, value_type y, value_type z )
void Matrix_implementation::makeRotate( value_type angle, value_type x, value_type y, value_type z )
{
makeIdentity();
@@ -424,34 +424,34 @@ void Matrix_implementation::makeRotate( const Quat& quat )
setRotate(quat);
}
void Matrix_implementation::makeRotate( value_type angle1, const Vec3f& axis1,
void Matrix_implementation::makeRotate( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3)
{
makeIdentity();
Quat quat;
quat.makeRotate(angle1, axis1,
quat.makeRotate(angle1, axis1,
angle2, axis2,
angle3, axis3);
setRotate(quat);
}
void Matrix_implementation::makeRotate( value_type angle1, const Vec3d& axis1,
void Matrix_implementation::makeRotate( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3)
{
makeIdentity();
Quat quat;
quat.makeRotate(angle1, axis1,
quat.makeRotate(angle1, axis1,
angle2, axis2,
angle3, axis3);
setRotate(quat);
}
void Matrix_implementation::mult( const Matrix_implementation& lhs, const Matrix_implementation& rhs )
{
{
if (&lhs==this)
{
postMult(rhs);
@@ -530,7 +530,7 @@ void Matrix_implementation::orthoNormalize(const Matrix_implementation& rhs)
value_type x_colMag = (rhs._mat[0][0] * rhs._mat[0][0]) + (rhs._mat[1][0] * rhs._mat[1][0]) + (rhs._mat[2][0] * rhs._mat[2][0]);
value_type y_colMag = (rhs._mat[0][1] * rhs._mat[0][1]) + (rhs._mat[1][1] * rhs._mat[1][1]) + (rhs._mat[2][1] * rhs._mat[2][1]);
value_type z_colMag = (rhs._mat[0][2] * rhs._mat[0][2]) + (rhs._mat[1][2] * rhs._mat[1][2]) + (rhs._mat[2][2] * rhs._mat[2][2]);
if(!equivalent((double)x_colMag, 1.0) && !equivalent((double)x_colMag, 0.0))
{
x_colMag = sqrt(x_colMag);
@@ -657,7 +657,7 @@ bool Matrix_implementation::invert_4x3( const Matrix_implementation& mat )
if( osg::square(d-1.0) > 1.0e-6 ) // Involves perspective, so we must
{ // compute the full inverse
Matrix_implementation TPinv;
_mat[3][0] = _mat[3][1] = _mat[3][2] = 0.0;
@@ -831,15 +831,15 @@ bool Matrix_implementation::getOrtho(Matrix_implementation::value_type& left, Ma
zNear = (_mat[3][2]+1.0) / _mat[2][2];
zFar = (_mat[3][2]-1.0) / _mat[2][2];
left = -(1.0+_mat[3][0]) / _mat[0][0];
right = (1.0-_mat[3][0]) / _mat[0][0];
bottom = -(1.0+_mat[3][1]) / _mat[1][1];
top = (1.0-_mat[3][1]) / _mat[1][1];
return true;
}
}
bool Matrix_implementation::getOrtho(Matrix_implementation::other_value_type& left, Matrix_implementation::other_value_type& right,
Matrix_implementation::other_value_type& bottom, Matrix_implementation::other_value_type& top,
@@ -894,12 +894,12 @@ bool Matrix_implementation::getFrustum(Matrix_implementation::value_type& left,
top = temp_near * (1.0+_mat[2][1]) / _mat[1][1];
bottom = temp_near * (_mat[2][1]-1.0) / _mat[1][1];
zNear = temp_near;
zFar = temp_far;
return true;
}
}
bool Matrix_implementation::getFrustum(Matrix_implementation::other_value_type& left, Matrix_implementation::other_value_type& right,
Matrix_implementation::other_value_type& bottom, Matrix_implementation::other_value_type& top,

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLExtensions>
@@ -17,7 +17,7 @@
#include <osg/buffered_value>
using namespace osg;
Multisample::Multisample() : _mode(DONT_CARE)
{
@@ -31,12 +31,12 @@ Multisample::~Multisample()
void Multisample::apply(State& state) const
{
// get the contextID (user defined ID of 0 upwards) for the
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const unsigned int contextID = state.getContextID();
const Extensions* extensions = getExtensions(contextID,true);
if (!extensions->isMultisampleSupported())
{
OSG_WARN<<"Warning: Multisample::apply(..) failed, Multisample is not support by OpenGL driver."<<std::endl;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -29,7 +29,7 @@ namespace osg
class CollectParentPaths : public NodeVisitor
{
public:
CollectParentPaths(const osg::Node* haltTraversalAtNode=0) :
CollectParentPaths(const osg::Node* haltTraversalAtNode=0) :
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS),
_haltTraversalAtNode(haltTraversalAtNode)
{
@@ -58,7 +58,7 @@ Node::Node()
{
_boundingSphereComputed = false;
_nodeMask = 0xffffffff;
_numChildrenRequiringUpdateTraversal = 0;
_numChildrenRequiringEventTraversal = 0;
@@ -90,7 +90,7 @@ Node::Node(const Node& node,const CopyOp& copyop):
Node::~Node()
{
// cleanly detatch any associated stateset (include remove parent links)
setStateSet(0);
setStateSet(0);
}
void Node::addParent(osg::Group* node)
@@ -110,7 +110,7 @@ void Node::removeParent(osg::Group* node)
void Node::accept(NodeVisitor& nv)
{
if (nv.validNodeMask(*this))
if (nv.validNodeMask(*this))
{
nv.pushOntoNodePath(this);
nv.apply(*this);
@@ -128,22 +128,22 @@ void Node::setStateSet(osg::StateSet* stateset)
{
// do nothing if nothing changed.
if (_stateset==stateset) return;
// track whether we need to account for the need to do a update or event traversal.
int delta_update = 0;
int delta_event = 0;
// remove this node from the current statesets parent list
// remove this node from the current statesets parent list
if (_stateset.valid())
{
_stateset->removeParent(this);
if (_stateset->requiresUpdateTraversal()) --delta_update;
if (_stateset->requiresEventTraversal()) --delta_event;
}
// set the stateset.
_stateset = stateset;
// add this node to the new stateset to the parent list.
if (_stateset.valid())
{
@@ -151,7 +151,7 @@ void Node::setStateSet(osg::StateSet* stateset)
if (_stateset->requiresUpdateTraversal()) ++delta_update;
if (_stateset->requiresEventTraversal()) ++delta_event;
}
if (delta_update!=0)
{
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+delta_update);
@@ -180,9 +180,9 @@ MatrixList Node::getWorldMatrices(const osg::Node* haltTraversalAtNode) const
{
CollectParentPaths cpp(haltTraversalAtNode);
const_cast<Node*>(this)->accept(cpp);
MatrixList matrices;
for(NodePathList::iterator itr = cpp._nodePaths.begin();
itr != cpp._nodePaths.end();
++itr)
@@ -197,7 +197,7 @@ MatrixList Node::getWorldMatrices(const osg::Node* haltTraversalAtNode) const
matrices.push_back(osg::computeLocalToWorld(nodePath));
}
}
return matrices;
}
@@ -205,7 +205,7 @@ void Node::setUpdateCallback(NodeCallback* nc)
{
// if no changes just return.
if (_updateCallback==nc) return;
// updated callback has been changed, will need to update
// both _updateCallback and possibly the numChildrenRequiringAppTraversal
// if the number of callbacks changes.
@@ -228,7 +228,7 @@ void Node::setUpdateCallback(NodeCallback* nc)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenRequiringUpdateTraversal(
(*itr)->getNumChildrenRequiringUpdateTraversal()+delta );
}
@@ -251,8 +251,8 @@ void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num)
// _numChildrenRequiringUpdateTraversal so no need to inform them.
if (!_updateCallback && !_parents.empty())
{
// need to pass on changes to parents.
// need to pass on changes to parents.
int delta = 0;
if (_numChildrenRequiringUpdateTraversal>0) --delta;
if (num>0) ++delta;
@@ -264,7 +264,7 @@ void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenRequiringUpdateTraversal(
(*itr)->getNumChildrenRequiringUpdateTraversal()+delta
);
@@ -272,10 +272,10 @@ void Node::setNumChildrenRequiringUpdateTraversal(unsigned int num)
}
}
// finally update this objects value.
_numChildrenRequiringUpdateTraversal=num;
}
@@ -283,7 +283,7 @@ void Node::setEventCallback(NodeCallback* nc)
{
// if no changes just return.
if (_eventCallback==nc) return;
// event callback has been changed, will need to Event
// both _EventCallback and possibly the numChildrenRequiringAppTraversal
// if the number of callbacks changes.
@@ -306,7 +306,7 @@ void Node::setEventCallback(NodeCallback* nc)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenRequiringEventTraversal(
(*itr)->getNumChildrenRequiringEventTraversal()+delta );
}
@@ -329,8 +329,8 @@ void Node::setNumChildrenRequiringEventTraversal(unsigned int num)
// _numChildrenRequiringEventTraversal so no need to inform them.
if (!_eventCallback && !_parents.empty())
{
// need to pass on changes to parents.
// need to pass on changes to parents.
int delta = 0;
if (_numChildrenRequiringEventTraversal>0) --delta;
if (num>0) ++delta;
@@ -342,7 +342,7 @@ void Node::setNumChildrenRequiringEventTraversal(unsigned int num)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenRequiringEventTraversal(
(*itr)->getNumChildrenRequiringEventTraversal()+delta
);
@@ -350,17 +350,17 @@ void Node::setNumChildrenRequiringEventTraversal(unsigned int num)
}
}
// finally Event this objects value.
_numChildrenRequiringEventTraversal=num;
}
void Node::setCullingActive(bool active)
{
// if no changes just return.
if (_cullingActive == active) return;
// culling active has been changed, will need to update
// both _cullActive and possibly the parents numChildrenWithCullingDisabled
// if culling disabled changes.
@@ -382,7 +382,7 @@ void Node::setCullingActive(bool active)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenWithCullingDisabled(
(*itr)->getNumChildrenWithCullingDisabled()+delta );
}
@@ -404,8 +404,8 @@ void Node::setNumChildrenWithCullingDisabled(unsigned int num)
// _numChildrenWithCullingDisabled so no need to inform them.
if (_cullingActive && !_parents.empty())
{
// need to pass on changes to parents.
// need to pass on changes to parents.
int delta = 0;
if (_numChildrenWithCullingDisabled>0) --delta;
if (num>0) ++delta;
@@ -417,7 +417,7 @@ void Node::setNumChildrenWithCullingDisabled(unsigned int num)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenWithCullingDisabled(
(*itr)->getNumChildrenWithCullingDisabled()+delta
);
@@ -425,7 +425,7 @@ void Node::setNumChildrenWithCullingDisabled(unsigned int num)
}
}
// finally update this objects value.
_numChildrenWithCullingDisabled=num;
}
@@ -441,8 +441,8 @@ void Node::setNumChildrenWithOccluderNodes(unsigned int num)
// _numChildrenWithOccluderNodes so no need to inform them.
if (!dynamic_cast<OccluderNode*>(this) && !_parents.empty())
{
// need to pass on changes to parents.
// need to pass on changes to parents.
int delta = 0;
if (_numChildrenWithOccluderNodes>0) --delta;
if (num>0) ++delta;
@@ -454,7 +454,7 @@ void Node::setNumChildrenWithOccluderNodes(unsigned int num)
for(ParentList::iterator itr =_parents.begin();
itr != _parents.end();
++itr)
{
{
(*itr)->setNumChildrenWithOccluderNodes(
(*itr)->getNumChildrenWithOccluderNodes()+delta
);
@@ -462,10 +462,10 @@ void Node::setNumChildrenWithOccluderNodes(unsigned int num)
}
}
// finally update this objects value.
_numChildrenWithOccluderNodes=num;
}
bool Node::containsOccluderNodes() const
@@ -544,7 +544,7 @@ void Node::dirtyBound()
void Node::setThreadSafeRefUnref(bool threadSafe)
{
Object::setThreadSafeRefUnref(threadSafe);
if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe);
if (_updateCallback.valid()) _updateCallback->setThreadSafeRefUnref(threadSafe);
if (_eventCallback.valid()) _eventCallback->setThreadSafeRefUnref(threadSafe);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Node>
@@ -20,4 +20,4 @@ void NodeCallback::traverse(Node* node,NodeVisitor* nv)
{
if (_nestedCallback.valid()) (*_nestedCallback)(node,nv);
else nv->traverse(*node);
}
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -43,13 +43,13 @@ class ApplyMatrixVisitor : public NodeVisitor
{
mt.setMatrix(_matrix);
}
virtual void apply(PositionAttitudeTransform& pat)
{
pat.setPosition(_matrix.getTrans());
pat.setAttitude(_matrix.getRotate());
}
osg::Matrix _matrix;
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/NodeVisitor>
@@ -152,7 +152,7 @@ void NodeVisitor::apply(Sequence& node)
}
void NodeVisitor::apply(LOD& node)
{
{
apply(static_cast<Group&>(node));
}
@@ -172,6 +172,6 @@ void NodeVisitor::apply(OccluderNode& node)
}
void NodeVisitor::apply(OcclusionQueryNode& node)
{
{
apply(static_cast<Group&>(node));
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Notify>
@@ -39,7 +39,7 @@ public:
NullStream():
std::ostream(new NullStreamBuffer)
{ _buffer = dynamic_cast<NullStreamBuffer *>(rdbuf()); }
~NullStream()
{
rdbuf(0);
@@ -97,7 +97,7 @@ public:
{
return _buffer->getCurrentSeverity();
}
~NotifyStream()
{
rdbuf(0);
@@ -153,7 +153,7 @@ bool osg::initNotifyLevel()
g_NullStream = &s_NullStream;
g_NotifyStream = &s_NotifyStream;
// g_NotifyLevel
// =============
@@ -183,7 +183,7 @@ bool osg::initNotifyLevel()
else if(stringOSGNOTIFYLEVEL.find("DEBUG")!=std::string::npos) g_NotifyLevel=osg::DEBUG_INFO;
else if(stringOSGNOTIFYLEVEL.find("INFO")!=std::string::npos) g_NotifyLevel=osg::INFO;
else std::cout << "Warning: invalid OSG_NOTIFY_LEVEL set ("<<stringOSGNOTIFYLEVEL<<")"<<std::endl;
}
// Setup standard notify handler
@@ -220,7 +220,7 @@ std::ostream& osg::notify(const osg::NotifySeverity severity)
void osg::StandardNotifyHandler::notify(osg::NotifySeverity severity, const char *message)
{
#if 1
if (severity <= osg::WARN)
if (severity <= osg::WARN)
fputs(message, stderr);
else
fputs(message, stdout);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Object>
@@ -20,7 +20,7 @@ namespace osg
//
// Object
//
Object::Object(const Object& obj,const CopyOp& copyop):
Object::Object(const Object& obj,const CopyOp& copyop):
Referenced(),
_name(obj._name),
_dataVariance(obj._dataVariance),
@@ -54,11 +54,11 @@ void Object::setThreadSafeRefUnref(bool threadSafe)
void Object::setUserDataContainer(osg::UserDataContainer* udc)
{
if (_userDataContainer == udc) return;
if (_userDataContainer) _userDataContainer->unref();
_userDataContainer = udc;
if (_userDataContainer) _userDataContainer->ref();
}
@@ -71,7 +71,7 @@ osg::UserDataContainer* Object::getOrCreateUserDataContainer()
void Object::setUserData(Referenced* obj)
{
if (getUserData()==obj) return;
getOrCreateUserDataContainer()->setUserData(obj);
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/OccluderNode>
@@ -27,7 +27,7 @@ OccluderNode::OccluderNode(const OccluderNode& node,const CopyOp& copyop):
BoundingSphere OccluderNode::computeBound() const
{
BoundingSphere bsphere(Group::computeBound());
if (getOccluder())
{
BoundingBox bb;

View File

@@ -1,14 +1,14 @@
//
// Copyright (C) 2007 Skew Matrix Software LLC (http://www.skew-matrix.com)
//
// This library is open source and may be redistributed and/or modified under
// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
// This library is open source and may be redistributed and/or modified under
// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
// (at your option) any later version. The full license is in LICENSE file
// included with this distribution, and on the openscenegraph.org website.
//
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// OpenSceneGraph Public License for more details.
//
@@ -244,7 +244,7 @@ struct ClearQueriesCallback : public osg::Camera::DrawCallback
};
// static cache of deleted query objects which can only
// static cache of deleted query objects which can only
// be completely deleted once the appropriate OpenGL context
// is set.
typedef std::list< GLuint > QueryObjectList;
@@ -439,7 +439,7 @@ QueryGeometry::flushDeletedQueryObjects( unsigned int contextID, double /*curren
elapsedTime = timer.delta_s(start_tick,timer.tick());
}
}
availableTime -= elapsedTime;
}

View File

@@ -55,17 +55,17 @@ OperationQueue::~OperationQueue()
{
}
bool OperationQueue::empty()
{
bool OperationQueue::empty()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
return _operations.empty();
return _operations.empty();
}
unsigned int OperationQueue::getNumOperationsInQueue()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
return static_cast<unsigned int>(_operations.size());
return static_cast<unsigned int>(_operations.size());
}
ref_ptr<Operation> OperationQueue::getNextOperation(bool blockIfEmpty)
@@ -76,15 +76,15 @@ ref_ptr<Operation> OperationQueue::getNextOperation(bool blockIfEmpty)
}
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
if (_operations.empty()) return osg::ref_ptr<Operation>();
if (_currentOperationIterator == _operations.end())
{
// iterator at end of operations so reset to beginning.
_currentOperationIterator = _operations.begin();
}
ref_ptr<Operation> currentOperation = *_currentOperationIterator;
if (!currentOperation->getKeep())
@@ -139,11 +139,11 @@ void OperationQueue::remove(Operation* operation)
if ((*itr)==operation)
{
bool needToResetCurrentIterator = (_currentOperationIterator == itr);
itr = _operations.erase(itr);
if (needToResetCurrentIterator) _currentOperationIterator = itr;
}
else ++itr;
}
@@ -152,7 +152,7 @@ void OperationQueue::remove(Operation* operation)
void OperationQueue::remove(const std::string& name)
{
OSG_INFO<<"Doing remove named operation"<<std::endl;
// acquire the lock on the operations queue to prevent anyone else for modifying it at the same time
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
@@ -160,12 +160,12 @@ void OperationQueue::remove(const std::string& name)
for(Operations::iterator itr = _operations.begin();
itr!=_operations.end();)
{
if ((*itr)->getName()==name)
if ((*itr)->getName()==name)
{
bool needToResetCurrentIterator = (_currentOperationIterator == itr);
itr = _operations.erase(itr);
if (needToResetCurrentIterator) _currentOperationIterator = itr;
}
else ++itr;
@@ -182,9 +182,9 @@ void OperationQueue::removeAllOperations()
OSG_INFO<<"Doing remove all operations"<<std::endl;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
_operations.clear();
// reset current operator.
_currentOperationIterator = _operations.begin();
@@ -200,7 +200,7 @@ void OperationQueue::runOperations(Object* callingObject)
// reset current operation iterator to beginning if at end.
if (_currentOperationIterator==_operations.end()) _currentOperationIterator = _operations.begin();
for(;
_currentOperationIterator != _operations.end();
)
@@ -215,7 +215,7 @@ void OperationQueue::runOperations(Object* callingObject)
{
++_currentOperationIterator;
}
// OSG_INFO<<"Doing op "<<_currentOperation->getName()<<" "<<this<<std::endl;
// call the graphics operation.
@@ -232,11 +232,11 @@ void OperationQueue::releaseOperationsBlock()
{
_operationsBlock->release();
}
void OperationQueue::releaseAllOperations()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
for(Operations::iterator itr = _operations.begin();
itr!=_operations.end();
++itr)
@@ -300,7 +300,7 @@ void OperationThread::setDone(bool done)
if (done)
{
OSG_INFO<<"set done "<<this<<std::endl;
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_threadMutex);
if (_currentOperation.valid())
@@ -321,7 +321,7 @@ int OperationThread::cancel()
int result = 0;
if( isRunning() )
{
_done = true;
OSG_INFO<<" Doing cancel "<<this<<std::endl;
@@ -329,7 +329,7 @@ int OperationThread::cancel()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_threadMutex);
if (_operationQueue.valid())
if (_operationQueue.valid())
{
_operationQueue->releaseOperationsBlock();
//_operationQueue->releaseAllOperations();
@@ -337,7 +337,7 @@ int OperationThread::cancel()
if (_currentOperation.valid()) _currentOperation->release();
}
// then wait for the the thread to stop running.
while(isRunning())
{
@@ -346,7 +346,7 @@ int OperationThread::cancel()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_threadMutex);
if (_operationQueue.valid())
if (_operationQueue.valid())
{
_operationQueue->releaseOperationsBlock();
// _operationQueue->releaseAllOperations();
@@ -403,7 +403,7 @@ void OperationThread::run()
// OSG_NOTICE<<"In thread loop "<<this<<std::endl;
ref_ptr<Operation> operation;
ref_ptr<OperationQueue> operationQueue;
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_threadMutex);
operationQueue = _operationQueue;
@@ -425,7 +425,7 @@ void OperationThread::run()
// call the graphics operation.
(*operation)(_parent.get());
{
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_threadMutex);
_currentOperation = 0;
}
@@ -433,12 +433,12 @@ void OperationThread::run()
if (firstTime)
{
// do a yield to get round a peculiar thread hang when testCancel() is called
// do a yield to get round a peculiar thread hang when testCancel() is called
// in certain circumstances - of which there is no particular pattern.
YieldCurrentThread();
firstTime = false;
}
// OSG_NOTICE<<"operations.size()="<<_operations.size()<<" done="<<_done<<" testCancel()"<<testCancel()<<std::endl;
} while (!testCancel() && !_done);

View File

@@ -126,8 +126,8 @@ void PagedLOD::traverse(NodeVisitor& nv)
{
// set the frame number of the traversal so that external nodes can find out how active this
// node is.
if (nv.getFrameStamp() &&
nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR)
if (nv.getFrameStamp() &&
nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR)
{
setFrameNumberOfLastTraversal(nv.getFrameStamp()->getFrameNumber());
}
@@ -298,7 +298,7 @@ bool PagedLOD::removeExpiredChildren(double expiryTime, unsigned int expiryFrame
if (!_perRangeDataList[cindex]._filename.empty() &&
_perRangeDataList[cindex]._timeStamp + _perRangeDataList[cindex]._minExpiryTime < expiryTime &&
_perRangeDataList[cindex]._frameNumber + _perRangeDataList[cindex]._minExpiryFrames < expiryFrame)
{
{
osg::Node* nodeToRemove = _children[cindex].get();
removedChildren.push_back(nodeToRemove);
return Group::removeChildren(cindex,1);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -145,7 +145,7 @@ void Point::Extensions::setupGLExtensions(unsigned int contextID)
isGLExtensionSupported(contextID,"GL_ARB_point_parameters") ||
isGLExtensionSupported(contextID,"GL_EXT_point_parameters") ||
isGLExtensionSupported(contextID,"GL_SGIS_point_parameters");
_isPointSpriteCoordOriginSupported = OSG_GL3_FEATURES || strncmp((const char*)glGetString(GL_VERSION),"2.0",3)>=0;
setGLExtensionFuncPtr(_glPointParameteri, "glPointParameteri", "glPointParameteriARB");

View File

@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GLExtensions>
#include <osg/GL>
#include <osg/PointSprite>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>
@@ -48,7 +48,7 @@ void PolygonMode::setMode(Face face,Mode mode)
_modeFront = mode;
_modeBack = mode;
break;
}
}
}
PolygonMode::Mode PolygonMode::getMode(Face face) const
@@ -61,7 +61,7 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
return _modeBack;
case(FRONT_AND_BACK):
return _modeFront;
}
}
OSG_WARN<<"Warning : invalid Face passed to PolygonMode::getMode(Face face)"<<std::endl;
return _modeFront;
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <string.h>
@@ -92,6 +92,6 @@ void PolygonOffset::apply(State&) const
{
if (!s_MultiplerSet) setFactorAndUnitsMultipliersUsingBestGuessForDriver();
glPolygonOffset(_factor * s_FactorMultipler,
glPolygonOffset(_factor * s_FactorMultipler,
_units * s_UnitsMultipler);
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>
@@ -73,7 +73,7 @@ int PolygonStipple::compare(const StateAttribute& sa) const
return 0; // passed all the above comparison macros, must be equal.
}
void PolygonStipple::setMask(const GLubyte* givenMask)
{
std::copy(givenMask,givenMask+128,_mask);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/PositionAttitudeTransform>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/PrimitiveSet>
@@ -30,17 +30,17 @@ unsigned int PrimitiveSet::getNumPrimitives() const
case(TRIANGLE_STRIP):
case(TRIANGLE_FAN):
case(QUAD_STRIP):
case(PATCHES):
case(PATCHES):
case(POLYGON): return 1;
}
return 0;
}
void DrawArrays::draw(State& state, bool) const
void DrawArrays::draw(State& state, bool) const
{
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
GLenum mode = _mode;
if (_mode==GL_QUADS)
if (_mode==GL_QUADS)
{
state.drawQuads(_first, _count, _numInstances);
return;
@@ -94,8 +94,8 @@ unsigned int DrawArrayLengths::getNumPrimitives() const
void DrawArrayLengths::draw(State& state, bool) const
{
GLenum mode = _mode;
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (_mode==GL_QUADS)
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (_mode==GL_QUADS)
{
GLint first = _first;
for(vector_type::const_iterator itr=begin();
@@ -105,7 +105,7 @@ void DrawArrayLengths::draw(State& state, bool) const
state.drawQuads(first, *itr, _numInstances);
first += *itr;
}
return;
}
if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN;
@@ -164,10 +164,10 @@ DrawElementsUByte::~DrawElementsUByte()
releaseGLObjects();
}
void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const
void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const
{
GLenum mode = _mode;
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN;
if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP;
#endif
@@ -187,7 +187,7 @@ void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const
else glDrawElements(mode, size(), GL_UNSIGNED_BYTE, &front());
}
}
else
else
{
if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_BYTE, &front(), _numInstances);
else glDrawElements(mode, size(), GL_UNSIGNED_BYTE, &front());
@@ -220,10 +220,10 @@ DrawElementsUShort::~DrawElementsUShort()
releaseGLObjects();
}
void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const
void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const
{
GLenum mode = _mode;
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN;
if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP;
#endif
@@ -243,7 +243,7 @@ void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const
else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, &front());
}
}
else
else
{
if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, &front(), _numInstances);
else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, &front());
@@ -276,10 +276,10 @@ DrawElementsUInt::~DrawElementsUInt()
releaseGLObjects();
}
void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const
void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const
{
GLenum mode = _mode;
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN;
if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP;
#endif
@@ -299,7 +299,7 @@ void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const
else glDrawElements(mode, size(), GL_UNSIGNED_INT, &front());
}
}
else
else
{
if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_INT, &front(), _numInstances);
else glDrawElements(mode, size(), GL_UNSIGNED_INT, &front());

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2008 Zebra Imaging
* Copyright (C) 2010 VIRES Simulationstechnologie GmbH
*
* This application is open source and may be redistributed and/or modified
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commercial and non commercial
* applications, as long as this copyright notice is maintained.
*
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -183,7 +183,7 @@ int Program::compare(const osg::StateAttribute& sa) const
// check the types are equal and then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(Program,sa)
if( _shaderList.size() < rhs._shaderList.size() ) return -1;
if( rhs._shaderList.size() < _shaderList.size() ) return 1;
@@ -272,7 +272,7 @@ void Program::releaseGLObjects(osg::State* state) const
{
unsigned int contextID = state->getContextID();
_pcpList[contextID] = 0;
}
}
}
bool Program::addShader( Shader* shader )
@@ -389,7 +389,7 @@ GLint Program::getParameter( GLenum pname ) const
case GL_GEOMETRY_VERTICES_OUT_EXT: return _geometryVerticesOut;
case GL_GEOMETRY_INPUT_TYPE_EXT: return _geometryInputType;
case GL_GEOMETRY_OUTPUT_TYPE_EXT: return _geometryOutputType;
case GL_PATCH_VERTICES: return _patchVertices;
case GL_PATCH_VERTICES: return _patchVertices;
}
OSG_WARN << "getParameter invalid param " << pname << std::endl;
return 0;
@@ -651,10 +651,10 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
std::string infoLog;
if( getInfoLog(infoLog) )
{
OSG_WARN << "Program \""<< _program->getName() << "\" "
OSG_WARN << "Program \""<< _program->getName() << "\" "
"infolog:\n" << infoLog << std::endl;
}
return;
}
else
@@ -745,7 +745,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
}
GLint loc = _extensions->glGetUniformLocation( _glProgramHandle, name );
if( loc != -1 )
{
_uniformInfoMap[Uniform::getNameID(reinterpret_cast<const char*>(name))] = ActiveVarInfo(loc,type,size);
@@ -776,7 +776,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
i, maxLen, 0, &size, &type, name );
GLint loc = _extensions->glGetAttribLocation( _glProgramHandle, name );
if( loc != -1 )
{
_attribInfoMap[reinterpret_cast<char*>(name)] = ActiveVarInfo(loc,type,size);
@@ -810,7 +810,7 @@ bool Program::PerContextProgram::validateProgram()
OSG_WARN << "infolog:\n" << infoLog << std::endl;
OSG_WARN << std::endl;
return false;
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Projection>
@@ -21,7 +21,7 @@ Projection::Projection()
Projection::Projection(const Projection& projection,const CopyOp& copyop):
Group(projection,copyop),
_matrix(projection._matrix)
{
{
}
Projection::Projection(const Matrix& mat )

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -17,12 +17,12 @@
using namespace osg;
ProxyNode::ProxyNode() :
ProxyNode::ProxyNode() :
_loadingExtReference(LOAD_IMMEDIATELY),
_centerMode(USER_DEFINED_CENTER),
_radius(-1)
{
}
}
ProxyNode::ProxyNode(const ProxyNode& proxynode,const CopyOp& copyop):
Group(proxynode,copyop),

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <stdio.h>
@@ -81,16 +81,16 @@ void Quat::makeRotate( value_type angle, const Vec3d& vec )
}
void Quat::makeRotate ( value_type angle1, const Vec3f& axis1,
void Quat::makeRotate ( value_type angle1, const Vec3f& axis1,
value_type angle2, const Vec3f& axis2,
value_type angle3, const Vec3f& axis3)
{
makeRotate(angle1,Vec3d(axis1),
angle2,Vec3d(axis2),
angle3,Vec3d(axis3));
}
}
void Quat::makeRotate ( value_type angle1, const Vec3d& axis1,
void Quat::makeRotate ( value_type angle1, const Vec3d& axis1,
value_type angle2, const Vec3d& axis2,
value_type angle3, const Vec3d& axis3)
{
@@ -99,7 +99,7 @@ void Quat::makeRotate ( value_type angle1, const Vec3d& axis1,
Quat q3; q3.makeRotate(angle3,axis3);
*this = q1*q2*q3;
}
}
void Quat::makeRotate( const Vec3f& from, const Vec3f& to )
@@ -109,14 +109,14 @@ void Quat::makeRotate( const Vec3f& from, const Vec3f& to )
/** Make a rotation Quat which will rotate vec1 to vec2
This routine uses only fast geometric transforms, without costly acos/sin computations.
This routine uses only fast geometric transforms, without costly acos/sin computations.
It's exact, fast, and with less degenerate cases than the acos/sin method.
For an explanation of the math used, you may see for example:
For an explanation of the math used, you may see for example:
http://logiciels.cnes.fr/MARMOTTES/marmottes-mathematique.pdf
@note This is the rotation with shortest angle, which is the one equivalent to the
acos/sin transform method. Other rotations exists, for example to additionally keep
@note This is the rotation with shortest angle, which is the one equivalent to the
acos/sin transform method. Other rotations exists, for example to additionally keep
a local horizontal attitude.
@author Nicolas Brodu
@@ -124,7 +124,7 @@ a local horizontal attitude.
void Quat::makeRotate( const Vec3d& from, const Vec3d& to )
{
// This routine takes any vector as argument but normalized
// This routine takes any vector as argument but normalized
// vectors are necessary, if only for computing the dot product.
// Too bad the API is that generic, it leads to performance loss.
// Even in the case the 2 vectors are not normalized but same length,
@@ -133,7 +133,7 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to )
// So, we have to test... in the hope of saving at least a sqrt
Vec3d sourceVector = from;
Vec3d targetVector = to;
value_type fromLen2 = from.length2();
value_type fromLen;
// normalize only when necessary, epsilon test
@@ -141,7 +141,7 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to )
fromLen = sqrt(fromLen2);
sourceVector /= fromLen;
} else fromLen = 1.0;
value_type toLen2 = to.length2();
// normalize only when necessary, epsilon test
if ((toLen2 < 1.0-1e-7) || (toLen2 > 1.0+1e-7)) {
@@ -149,26 +149,26 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to )
// re-use fromLen for case of mapping 2 vectors of the same length
if ((toLen2 > fromLen2-1e-7) && (toLen2 < fromLen2+1e-7)) {
toLen = fromLen;
}
}
else toLen = sqrt(toLen2);
targetVector /= toLen;
}
// Now let's get into the real stuff
// Use "dot product plus one" as test as it can be re-used later on
double dotProdPlus1 = 1.0 + sourceVector * targetVector;
// Check for degenerate case of full u-turn. Use epsilon for detection
if (dotProdPlus1 < 1e-7) {
// Get an orthogonal vector of the given vector
// in a plane with maximum vector coordinates.
// Then use it as quaternion axis with pi angle
// Trick is to realize one value at least is >0.6 for a normalized vector.
if (fabs(sourceVector.x()) < 0.6) {
const double norm = sqrt(1.0 - sourceVector.x() * sourceVector.x());
_v[0] = 0.0;
_v[0] = 0.0;
_v[1] = sourceVector.z() / norm;
_v[2] = -sourceVector.y() / norm;
_v[3] = 0.0;
@@ -186,7 +186,7 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to )
_v[3] = 0.0;
}
}
else {
// Find the shortest angle quaternion that transforms normalized vectors
// into one other. Formula is still valid when vectors are colinear
@@ -211,14 +211,14 @@ void Quat::makeRotate_original( const Vec3d& from, const Vec3d& to )
value_type length1 = from.length();
value_type length2 = to.length();
// dot product vec1*vec2
value_type cosangle = from*to/(length1*length2);
if ( fabs(cosangle - 1) < epsilon )
{
OSG_INFO<<"*** Quat::makeRotate(from,to) with near co-linear vectors, epsilon= "<<fabs(cosangle-1)<<std::endl;
// cosangle is close to 1, so the vectors are close to being coincident
// Need to generate an angle of zero with any vector we like
// We'll choose (1,0,0)
@@ -235,13 +235,13 @@ void Quat::makeRotate_original( const Vec3d& from, const Vec3d& to )
else tmp.set(0.0,0.0,1.0);
else if (fabs(from.y())<fabs(from.z())) tmp.set(0.0,1.0,0.0);
else tmp.set(0.0,0.0,1.0);
Vec3d fromd(from.x(),from.y(),from.z());
// find orthogonal axis.
Vec3d axis(fromd^tmp);
axis.normalize();
_v[0] = axis[0]; // sin of half angle of PI is 1.0.
_v[1] = axis[1]; // sin of half angle of PI is 1.0.
_v[2] = axis[2]; // sin of half angle of PI is 1.0.
@@ -309,15 +309,15 @@ void Quat::slerp( value_type t, const Quat& from, const Quat& to )
{
const double epsilon = 0.00001;
double omega, cosomega, sinomega, scale_from, scale_to ;
osg::Quat quatTo(to);
// this is a dot product
cosomega = from.asVec4() * to.asVec4();
if ( cosomega <0.0 )
{
cosomega = -cosomega;
{
cosomega = -cosomega;
quatTo = -to;
}
@@ -341,7 +341,7 @@ void Quat::slerp( value_type t, const Quat& from, const Quat& to )
}
*this = (from*scale_from) + (quatTo*scale_to);
// so that we get a Vec4
}
@@ -357,32 +357,32 @@ void test_Quat_Eueler(value_type heading,value_type pitch,value_type roll)
{
osg::Quat q;
q.makeRotate(heading,pitch,roll);
osg::Matrix q_m;
q.get(q_m);
osg::Vec3 xAxis(1,0,0);
osg::Vec3 yAxis(0,1,0);
osg::Vec3 zAxis(0,0,1);
cout << "heading = "<<heading<<" pitch = "<<pitch<<" roll = "<<roll<<endl;
cout <<"q_m = "<<q_m;
cout <<"xAxis*q_m = "<<xAxis*q_m << endl;
cout <<"yAxis*q_m = "<<yAxis*q_m << endl;
cout <<"zAxis*q_m = "<<zAxis*q_m << endl;
osg::Matrix r_m = osg::Matrix::rotate(roll,0.0,1.0,0.0)*
osg::Matrix::rotate(pitch,1.0,0.0,0.0)*
osg::Matrix::rotate(-heading,0.0,0.0,1.0);
cout << "r_m = "<<r_m;
cout <<"xAxis*r_m = "<<xAxis*r_m << endl;
cout <<"yAxis*r_m = "<<yAxis*r_m << endl;
cout <<"zAxis*r_m = "<<zAxis*r_m << endl;
cout << endl<<"*****************************************" << endl<< endl;
}
void test_Quat()

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <stdlib.h>
@@ -87,7 +87,7 @@ OpenThreads::Mutex* Referenced::getGlobalReferencedMutex()
return s_ReferencedGlobalMutext.get();
}
// helper class for forcing the global mutex to be constructed when the library is loaded.
// helper class for forcing the global mutex to be constructed when the library is loaded.
struct InitGlobalMutexes
{
InitGlobalMutexes()
@@ -158,7 +158,7 @@ Referenced::Referenced():
#endif
_refMutex = new OpenThreads::Mutex;
#endif
#ifdef DEBUG_OBJECT_ALLOCATION_DESTRUCTION
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(getNumObjectMutex());

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/Scissor>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -39,7 +39,7 @@ Sequence::Sequence() :
_mode(STOP),
_sync(false),
_clearOnStop(false)
{
setNumChildrenRequiringUpdateTraversal(1);
}
@@ -66,7 +66,7 @@ Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) :
_sync(seq._sync),
_clearOnStop(seq._clearOnStop)
{
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
}
bool Sequence::addChild( Node *child)
@@ -115,8 +115,8 @@ bool Sequence::removeChild( Node *child )
bool Sequence::removeChildren(unsigned int pos,unsigned int numChildrenToRemove)
{
if (pos<_frameTime.size())
_frameTime.erase(_frameTime.begin()+pos,
osg::minimum(_frameTime.begin()+(pos+numChildrenToRemove),
_frameTime.erase(_frameTime.begin()+pos,
osg::minimum(_frameTime.begin()+(pos+numChildrenToRemove),
_frameTime.end()) );
_resetTotalTime = true;
return Group::removeChildren(pos,numChildrenToRemove);
@@ -140,7 +140,7 @@ void Sequence::setTime(unsigned int frame, double t)
_frameTime.push_back(t);
}
}
}
// returns a frame time of -1 if frame is out of range
@@ -178,7 +178,7 @@ void Sequence::setMode(SequenceMode mode)
{
int ubegin, uend;
switch (mode)
switch (mode)
{
case START:
// restarts sequence from beginning
@@ -222,11 +222,11 @@ void Sequence::traverse(NodeVisitor& nv)
}
if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
if (nv.getVisitorType()==NodeVisitor::UPDATE_VISITOR &&
_mode == START &&
!_frameTime.empty() && getNumChildren()!=0)
{
// if begin or end < 0, make it last frame
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
@@ -278,8 +278,8 @@ void Sequence::traverse(NodeVisitor& nv)
}
else
{
if ( (_loopMode == LOOP) &&
( (_step>0 && _value!=_send) ||
if ( (_loopMode == LOOP) &&
( (_step>0 && _value!=_send) ||
(_step<0 && _value!=_sbegin)))
{
_mode = STOP;
@@ -293,7 +293,7 @@ void Sequence::traverse(NodeVisitor& nv)
}
}
// update local variables
_update();
@@ -306,12 +306,12 @@ void Sequence::traverse(NodeVisitor& nv)
{ // case 2 or case 3
// most of the time it's just the next frame in the sequence
int nextValue = _getNextValue();
if (!_sync ||
if (!_sync ||
((_now - _start) <= (_frameTime[_value]+_frameTime[nextValue])*osg::absolute(_speed)) )
{
_start += _frameTime[_value]*osg::absolute(_speed);
// repeat or change directions?
if ( (_step>0 && nextValue==_send) ||
if ( (_step>0 && nextValue==_send) ||
(_step<0 && nextValue==_sbegin))
{
if (_nreps>0)
@@ -330,23 +330,23 @@ void Sequence::traverse(NodeVisitor& nv)
// elapsed time from start of the frame
double deltaT = _now - _start;
// factors _speed into account
double adjTotalTime = _totalTime*osg::absolute(_speed);
// how many laps?
int loops = (int)(deltaT/adjTotalTime);
// adjust reps & quick check to see if done becuase reps used up
if (_nreps>0)
{
if (_loopMode == LOOP)
_nrepsRemain -= loops;
else
_nrepsRemain -= 2*loops;
if (_nrepsRemain<=0)
{
_nrepsRemain = 0;
@@ -354,17 +354,17 @@ void Sequence::traverse(NodeVisitor& nv)
OSG_WARN << "stopping because elapsed time greater or equal to time remaining to repeat the sequence\n";
}
}
// deduct off time for laps- _value shouldn't change as it's modulo the total time
double jumpStart = ((double)loops * adjTotalTime);
// step through frames one at a time until caught up
while (deltaT-jumpStart > _frameTime[_value]*osg::absolute(_speed))
{
jumpStart += _frameTime[_value]*osg::absolute(_speed );
_value = _getNextValue();
}
// set start time
_start += jumpStart;
}
@@ -398,7 +398,7 @@ int Sequence::_getNextValue()
// if begin or end < 0, make it last frame
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
int _sbegin = osg::minimum(_ubegin,_uend);
int _send = osg::maximum(_ubegin,_uend);
@@ -422,7 +422,7 @@ int Sequence::_getNextValue()
{
v+=vs;
}
return v;
}
else // SWING
@@ -444,7 +444,7 @@ void Sequence::_update()
// if begin or end < 0, make it last frame
int _ubegin = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
int _uend = (_end < 0 ? (int)_frameTime.size()-1: _end);
int _sbegin = osg::minimum(_ubegin,_uend);
int _send = osg::maximum(_ubegin,_uend);
@@ -454,14 +454,14 @@ void Sequence::_update()
_value = (_begin < 0 ? (int)_frameTime.size()-1: _begin);
_resetTotalTime = true;
}
// if _start<0, new or restarted
if (_start<0)
{
_start = _now;
_resetTotalTime = true;
}
// need to calculate time of a complete sequence?
// time is different depending on loop mode
if (_resetTotalTime)
@@ -490,5 +490,5 @@ void Sequence::_update()
_resetTotalTime = false;
}
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osg/GL>

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2008 Zebra Imaging
* Copyright (C) 2010 VIRES Simulationstechnologie GmbH
*
* This application is open source and may be redistributed and/or modified
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commercial and non commercial
* applications, as long as this copyright notice is maintained.
*
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -473,7 +473,7 @@ void Shader::PerContextShader::requestCompile()
_isCompiled = false;
}
namespace
namespace
{
std::string insertLineNumbers(const std::string& source)
{
@@ -531,7 +531,7 @@ void Shader::PerContextShader::compileShader(osg::State& state)
return;
}
}
if (_shader->getShaderSource().empty())
{
OSG_WARN<<"Warning: No suitable shader of supported format by GLES driver found in shader binary, unable to compile shader."<<std::endl;

Some files were not shown because too many files have changed in this diff Show More