Changeset 13041 for OpenSceneGraph/trunk/src/osgPlugins/normals/Normals.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/normals/Normals.cpp
r11519 r13041 32 32 33 33 34 Normals::MakeNormalsVisitor::MakeNormalsVisitor( float normalScale, Mode mode): 34 Normals::MakeNormalsVisitor::MakeNormalsVisitor( float normalScale, Mode mode): 35 35 NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN), 36 36 _normal_scale(normalScale), … … 80 80 while( coord_index != coords->end() ) 81 81 v += *(coord_index++) * _mat; 82 v /= (float)(coords->size()); 82 v /= (float)(coords->size()); 83 83 84 84 n *= _normal_scale; … … 102 102 { 103 103 Vec3 v(0,0,0); 104 Vec3 n = *(normals_index++); 104 Vec3 n = *(normals_index++); 105 105 int ni = (*itr)->getNumIndices(); 106 106 for( int i = 0; i < ni; i++ ) … … 112 112 _local_coords->push_back( (v + n)); 113 113 } 114 else 114 else 115 115 { 116 116 switch((*itr)->getMode()) … … 124 124 if( binding == Geometry::BIND_PER_PRIMITIVE ) 125 125 normals_index++; 126 else 126 else 127 127 normals_index+=3; 128 128 } … … 153 153 if( binding == Geometry::BIND_PER_PRIMITIVE ) 154 154 normals_index++; 155 else 155 else 156 156 normals_index+=4; 157 157 } … … 193 193 194 194 void Normals::MakeNormalsVisitor::_processPrimitive( unsigned int nv, 195 Vec3Array::iterator coords, 195 Vec3Array::iterator coords, 196 196 Vec3Array::iterator normals, 197 197 Geometry::AttributeBinding binding ) … … 209 209 for( unsigned int i = 0; i < nv; i++ ) 210 210 n += *(normals++); 211 n /= (float)(nv); 211 n /= (float)(nv); 212 212 } 213 213
