Implemented duplicate removal code into TriStripVisitor and added an

extra pass to doing tri stripping in the osgUtil::Optimzer.

Added validity checks into osg::TexEnvCombine to catch eronous enumarant values.

Improved the efficient of CullingSet's handling of new transforms.

Added a copy shared subgraphs and subdivision code into osgUtil::Optimizer.
This commit is contained in:
Robert Osfield
2003-12-03 21:45:32 +00:00
parent cdb6f9a1df
commit db66abd6d6
14 changed files with 985 additions and 112 deletions

View File

@@ -358,6 +358,23 @@ class DrawFogCoord : public osg::ConstValueVisitor
const Drawable::Extensions * _extensions;
};
Geometry::ArrayData::ArrayData(const ArrayData& data,const CopyOp& copyop):
array(data.array.valid()?dynamic_cast<osg::Array*>(data.array->clone(copyop)):0),
indices(data.indices.valid()?dynamic_cast<osg::IndexArray*>(data.indices->clone(copyop)):0),
binding(data.binding),
normalize(data.normalize),
offset(data.offset)
{
}
Geometry::Vec3ArrayData::Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& copyop):
array(data.array.valid()?dynamic_cast<osg::Vec3Array*>(data.array->clone(copyop)):0),
indices(data.indices.valid()?dynamic_cast<osg::IndexArray*>(data.indices->clone(copyop)):0),
binding(data.binding),
normalize(data.normalize),
offset(data.offset)
{
}
Geometry::Geometry()
{
@@ -367,11 +384,11 @@ Geometry::Geometry()
Geometry::Geometry(const Geometry& geometry,const CopyOp& copyop):
Drawable(geometry,copyop),
_vertexData(geometry._vertexData),
_normalData(geometry._normalData),
_colorData(geometry._colorData),
_secondaryColorData(geometry._secondaryColorData),
_fogCoordData(geometry._fogCoordData),
_vertexData(geometry._vertexData,copyop),
_normalData(geometry._normalData,copyop),
_colorData(geometry._colorData,copyop),
_secondaryColorData(geometry._secondaryColorData,copyop),
_fogCoordData(geometry._fogCoordData,copyop),
_fastPath(geometry._fastPath),
_fastPathHint(geometry._fastPathHint)
{

View File

@@ -12,6 +12,7 @@
*/
#include <osg/GLExtensions>
#include <osg/TexEnvCombine>
#include <osg/Notify>
using namespace osg;
@@ -100,3 +101,42 @@ void TexEnvCombine::apply(State&) const
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
}
void TexEnvCombine::setCombine_RGB(GLint cm) { _combine_RGB = cm; }
void TexEnvCombine::setCombine_Alpha(GLint cm) { _combine_Alpha = cm; }
void TexEnvCombine::setSource0_RGB(GLint sp) { _source0_RGB = sp; computeNeedoForTexEnvCombiners(); }
void TexEnvCombine::setSource1_RGB(GLint sp) { _source1_RGB = sp; computeNeedoForTexEnvCombiners(); }
void TexEnvCombine::setSource2_RGB(GLint sp) { _source2_RGB = sp; computeNeedoForTexEnvCombiners(); }
void TexEnvCombine::setSource0_Alpha(GLint sp) { _source0_Alpha = sp; computeNeedoForTexEnvCombiners(); }
void TexEnvCombine::setSource1_Alpha(GLint sp) { _source1_Alpha = sp; computeNeedoForTexEnvCombiners(); }
void TexEnvCombine::setSource2_Alpha(GLint sp) { _source2_Alpha = sp; computeNeedoForTexEnvCombiners(); }
void TexEnvCombine::setOperand0_RGB(GLint op) { _operand0_RGB = op; }
void TexEnvCombine::setOperand1_RGB(GLint op) { _operand1_RGB = op; }
void TexEnvCombine::setOperand2_RGB(GLint op) { _operand2_RGB = op; }
static GLint Valid_Operand_Alpha(GLint op, const char* functionName)
{
if (op==TexEnvCombine::SRC_ALPHA || op==TexEnvCombine::ONE_MINUS_SRC_ALPHA) return op;
notify(WARN)<<"Warning:: TexEnvCombine::"<<functionName<<"("<<op<<") invalid parameter value,"<<std::endl<<
" must be SRC_ALPHA or ONE_MINUS_SRC_ALPHA, resetting to SRC_ALPHA."<<std::endl;
return TexEnvCombine::SRC_ALPHA;
}
void TexEnvCombine::setOperand0_Alpha(GLint op)
{
_operand0_Alpha = Valid_Operand_Alpha(op,"setOperand0_Alpha");
}
void TexEnvCombine::setOperand1_Alpha(GLint op)
{
_operand1_Alpha = Valid_Operand_Alpha(op,"setOperand1_Alpha");
}
void TexEnvCombine::setOperand2_Alpha(GLint op)
{
_operand2_Alpha = Valid_Operand_Alpha(op,"setOperand2_Alpha");
}
void TexEnvCombine::setScale_RGB(float scale) { _scale_RGB = scale; }
void TexEnvCombine::setScale_Alpha(float scale) { _scale_Alpha = scale; }