From Daniel Trastenjak, added checking of binding modes to ensure that changes are only applied
when the binding mode changes, thereby avoiding uncessary calls to dirtyDisplayList. Note, from Robert Osfield, moved bodies of set*Binding() into Geometry.cpp to avoid clutter in the header.
This commit is contained in:
parent
d7fdaecfa0
commit
1dcb923c15
@ -158,7 +158,7 @@ class OSG_EXPORT Geometry : public Drawable
|
|||||||
const ArrayData& getVertexData() const { return _vertexData; }
|
const ArrayData& getVertexData() const { return _vertexData; }
|
||||||
|
|
||||||
|
|
||||||
void setNormalBinding(AttributeBinding ab) { _normalData.binding = ab; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setNormalBinding(AttributeBinding ab);
|
||||||
AttributeBinding getNormalBinding() const { return _normalData.binding; }
|
AttributeBinding getNormalBinding() const { return _normalData.binding; }
|
||||||
|
|
||||||
void setNormalArray(Array* array) { _normalData.array = array; if (!_normalData.array.valid()) _normalData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setNormalArray(Array* array) { _normalData.array = array; if (!_normalData.array.valid()) _normalData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
||||||
@ -173,7 +173,7 @@ class OSG_EXPORT Geometry : public Drawable
|
|||||||
ArrayData& getNormalData() { return _normalData; }
|
ArrayData& getNormalData() { return _normalData; }
|
||||||
const ArrayData& getNormalData() const { return _normalData; }
|
const ArrayData& getNormalData() const { return _normalData; }
|
||||||
|
|
||||||
void setColorBinding(AttributeBinding ab) { _colorData.binding = ab; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setColorBinding(AttributeBinding ab);
|
||||||
AttributeBinding getColorBinding() const { return _colorData.binding; }
|
AttributeBinding getColorBinding() const { return _colorData.binding; }
|
||||||
|
|
||||||
void setColorArray(Array* array) { _colorData.array = array; if (!_colorData.array.valid()) _colorData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setColorArray(Array* array) { _colorData.array = array; if (!_colorData.array.valid()) _colorData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
||||||
@ -189,7 +189,7 @@ class OSG_EXPORT Geometry : public Drawable
|
|||||||
const ArrayData& getColorData() const { return _colorData; }
|
const ArrayData& getColorData() const { return _colorData; }
|
||||||
|
|
||||||
|
|
||||||
void setSecondaryColorBinding(AttributeBinding ab) { _secondaryColorData.binding = ab; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setSecondaryColorBinding(AttributeBinding ab);
|
||||||
AttributeBinding getSecondaryColorBinding() const { return _secondaryColorData.binding; }
|
AttributeBinding getSecondaryColorBinding() const { return _secondaryColorData.binding; }
|
||||||
|
|
||||||
void setSecondaryColorArray(Array* array) { _secondaryColorData.array = array; if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setSecondaryColorArray(Array* array) { _secondaryColorData.array = array; if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
||||||
@ -205,7 +205,7 @@ class OSG_EXPORT Geometry : public Drawable
|
|||||||
const ArrayData& getSecondaryColorData() const { return _secondaryColorData; }
|
const ArrayData& getSecondaryColorData() const { return _secondaryColorData; }
|
||||||
|
|
||||||
|
|
||||||
void setFogCoordBinding(AttributeBinding ab) { _fogCoordData.binding = ab; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setFogCoordBinding(AttributeBinding ab);
|
||||||
AttributeBinding getFogCoordBinding() const { return _fogCoordData.binding; }
|
AttributeBinding getFogCoordBinding() const { return _fogCoordData.binding; }
|
||||||
|
|
||||||
void setFogCoordArray(Array* array) { _fogCoordData.array = array; if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
void setFogCoordArray(Array* array) { _fogCoordData.array = array; if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); }
|
||||||
|
@ -479,6 +479,42 @@ bool Geometry::empty() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Geometry::setNormalBinding(AttributeBinding ab)
|
||||||
|
{
|
||||||
|
if (_normalData.binding == ab) return;
|
||||||
|
|
||||||
|
_normalData.binding = ab;
|
||||||
|
computeFastPathsUsed();
|
||||||
|
dirtyDisplayList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Geometry::setColorBinding(AttributeBinding ab)
|
||||||
|
{
|
||||||
|
if (_colorData.binding == ab) return;
|
||||||
|
|
||||||
|
_colorData.binding = ab;
|
||||||
|
computeFastPathsUsed();
|
||||||
|
dirtyDisplayList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Geometry::setSecondaryColorBinding(AttributeBinding ab)
|
||||||
|
{
|
||||||
|
if (_secondaryColorData.binding == ab) return;
|
||||||
|
|
||||||
|
_secondaryColorData.binding = ab;
|
||||||
|
computeFastPathsUsed();
|
||||||
|
dirtyDisplayList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Geometry::setFogCoordBinding(AttributeBinding ab)
|
||||||
|
{
|
||||||
|
if (_fogCoordData.binding == ab) return;
|
||||||
|
|
||||||
|
_fogCoordData.binding = ab;
|
||||||
|
computeFastPathsUsed();
|
||||||
|
dirtyDisplayList();
|
||||||
|
}
|
||||||
|
|
||||||
void Geometry::setTexCoordData(unsigned int unit,const ArrayData& arrayData)
|
void Geometry::setTexCoordData(unsigned int unit,const ArrayData& arrayData)
|
||||||
{
|
{
|
||||||
if (_texCoordList.size()<=unit)
|
if (_texCoordList.size()<=unit)
|
||||||
@ -614,8 +650,9 @@ const IndexArray* Geometry::getVertexAttribIndices(unsigned int index) const
|
|||||||
|
|
||||||
void Geometry::setVertexAttribBinding(unsigned int index,AttributeBinding ab)
|
void Geometry::setVertexAttribBinding(unsigned int index,AttributeBinding ab)
|
||||||
{
|
{
|
||||||
|
if (getVertexAttribData(index).binding == ab)
|
||||||
|
return;
|
||||||
getVertexAttribData(index).binding = ab;
|
getVertexAttribData(index).binding = ab;
|
||||||
|
|
||||||
computeFastPathsUsed();
|
computeFastPathsUsed();
|
||||||
dirtyDisplayList();
|
dirtyDisplayList();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user