I think you're right. It might be also possible to avoid cloning the resource again, if we don't set the _baseGeoRes Resource to 0x0.
Code:
Index: Horde3DEngine/egModel.cpp
===================================================================
--- Horde3DEngine/egModel.cpp (revision 122)
+++ Horde3DEngine/egModel.cpp (working copy)
@@ -345,14 +345,15 @@
else
{
_geometryRes = (GeometryResource *)res;
- _baseGeoRes = 0x0;
+ _baseGeoRes = _geometryRes;
}
markMeshBBoxesDirty();
return true;
case ModelNodeParams::SoftwareSkinning:
_softwareSkinning = (value != 0);
- if( _geometryRes != 0x0 ) setParami( ModelNodeParams::GeometryRes, _geometryRes->getHandle() );
+ if( !_softwareSkinning && _baseGeoRes != 0x0 && _morphers.empty() ) setParami( ModelNodeParams::GeometryRes, _baseGeoRes->getHandle() );
+ else if( _geometryRes != 0x0 && _baseGeoRes.getPtr() == _geometryRes.getPtr() ) setParami( ModelNodeParams::GeometryRes, _geometryRes->getHandle() );
return true;
default:
return SceneNode::setParami( param, value );
@@ -364,7 +365,7 @@
{
if( !skinningDirty && !_morpherDirty ) return false;
- if( _baseGeoRes == 0x0 || _baseGeoRes->getVertData() == 0x0 ) return false;
+ if( _baseGeoRes == 0x0 || _baseGeoRes.getPtr() == _geometryRes.getPtr() || _baseGeoRes->getVertData() == 0x0 ) return false;
if( _geometryRes == 0x0 || _geometryRes->getVertData() == 0x0 ) return false;
// Reset vertices to base data
Didn't test that code intensively so someone might think about it before we patch it in the repositories.