Hello Michael,
On 11/14/2011 08:59 AM, Michael Raab wrote:
2.) osg::calcVertexTangents() creates not enough tangents and binormals, e.g.
for a simple plane only 3 tangents are created...
this one seems to be a off-by-one in accounting for the property size.
Can you try the attached patch, please?
Cheers,
Carsten
PS: the equivalent bug is also in the 2.0 code, will commit there as
well once it's confirmed this fixes the problem.
Index: Source/System/NodeCores/Drawables/Geometry/OSGGeoFunctions.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/NodeCores/Drawables/Geometry/OSGGeoFunctions.cpp,v
retrieving revision 1.75
diff -u -p -r1.75 OSGGeoFunctions.cpp
--- Source/System/NodeCores/Drawables/Geometry/OSGGeoFunctions.cpp 12 Oct 2011 08:57:24 -0000 1.75
+++ Source/System/NodeCores/Drawables/Geometry/OSGGeoFunctions.cpp 14 Nov 2011 21:14:25 -0000
@@ -2216,6 +2251,7 @@ OSG_SYSTEMLIB_DLLMAPPING void OSG::calcV
case Geometry::SecondaryColorsFieldId:
FWARNING(("Case currently not treated, using NONE\n"));
dstAttribTan = -1;
+ // fallthrough
case -1:
tangentP = GeoTexCoords4f::create(); // to be deleted
@@ -2303,6 +2339,7 @@ OSG_SYSTEMLIB_DLLMAPPING void OSG::calcV
case Geometry::SecondaryColorsFieldId:
FWARNING(("Case currently not treated, using NONE\n"));
dstAttribBin = -1;
+ // fallthrough
case -1:
binormalP = GeoTexCoords4f::create();
@@ -2509,8 +2546,8 @@ OSG_SYSTEMLIB_DLLMAPPING void OSG::calcV
}
// keep track of needed size for properties
- if(v[k] > propSize)
- propSize = v[k];
+ if(v[k] >= propSize)
+ propSize = v[k] + 1;
// resize properties if inital guess was too small
if(v[k] >= tangent.size())
@@ -2620,7 +2657,7 @@ OSG_SYSTEMLIB_DLLMAPPING void OSG::calcV
binormalP->clear ();
binormalP->editField().reserve(binormal.size());
- for (i=0;i < tangent.size();++i)
+ for (i=0; i < tangent.size(); ++i)
{
T = tangent [i];
B = binormal[i];
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users