- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgAnimation/RigTransformSoftware.cpp
r12292 r13041 1 /* -*-c++-*- 1 /* -*-c++-*- 2 2 * Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net> 3 3 * 4 * This library is open source and may be redistributed and/or modified under 5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 4 * This library is open source and may be redistributed and/or modified under 5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 6 6 * (at your option) any later version. The full license is in LICENSE file 7 7 * included with this distribution, and on the openscenegraph.org website. 8 * 8 * 9 9 * This library is distributed in the hope that it will be useful, 10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 12 * OpenSceneGraph Public License for more details. 13 13 */ … … 70 70 *positionDst = *positionSrc; 71 71 } 72 72 73 73 osg::Vec3Array* normalSrc = dynamic_cast<osg::Vec3Array*>(source.getNormalArray()); 74 74 osg::Vec3Array* normalDst = dynamic_cast<osg::Vec3Array*>(destination.getNormalArray()); … … 87 87 if (positionDst && !positionDst->empty()) 88 88 { 89 compute<osg::Vec3>(geom.getMatrixFromSkeletonToGeometry(), 90 geom.getInvMatrixFromSkeletonToGeometry(), 89 compute<osg::Vec3>(geom.getMatrixFromSkeletonToGeometry(), 90 geom.getInvMatrixFromSkeletonToGeometry(), 91 91 &positionSrc->front(), 92 92 &positionDst->front()); … … 96 96 if (normalDst && !normalDst->empty()) 97 97 { 98 computeNormal<osg::Vec3>(geom.getMatrixFromSkeletonToGeometry(), 99 geom.getInvMatrixFromSkeletonToGeometry(), 98 computeNormal<osg::Vec3>(geom.getMatrixFromSkeletonToGeometry(), 99 geom.getInvMatrixFromSkeletonToGeometry(), 100 100 &normalSrc->front(), 101 101 &normalDst->front()); … … 110 110 int size = influence.size(); 111 111 _boneSetVertexSet.resize(size); 112 for (int i = 0; i < size; i++) 112 for (int i = 0; i < size; i++) 113 113 { 114 114 const VertexInfluenceSet::UniqVertexSetToBoneSet& inf = influence[i]; … … 117 117 118 118 double sumOfWeight = 0; 119 for (int b = 0; b < nbBones; b++) 119 for (int b = 0; b < nbBones; b++) 120 120 { 121 121 const std::string& bname = inf.getBones()[b].getBoneName(); 122 122 float weight = inf.getBones()[b].getWeight(); 123 123 BoneMap::const_iterator it = map.find(bname); 124 if (it == map.end()) 124 if (it == map.end()) 125 125 { 126 126 OSG_WARN << "RigTransformSoftware Bone " << bname << " not found, skip the influence group " <<bname << std::endl; … … 134 134 // so we check it and renormalize the all weight bone 135 135 const double threshold = 1e-4; 136 if (!_boneSetVertexSet[i].getBones().empty() && 136 if (!_boneSetVertexSet[i].getBones().empty() && 137 137 (sumOfWeight < 1.0 - threshold || sumOfWeight > 1.0 + threshold)) 138 138 {
