Changeset 13041 for OpenSceneGraph/trunk/src/osg/Shape.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osg/Shape.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osg/Shape.cpp
r10504 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 72 72 } 73 73 74 HeightField::HeightField(const HeightField& mesh,const CopyOp& copyop): 74 HeightField::HeightField(const HeightField& mesh,const CopyOp& copyop): 75 75 Shape(mesh,copyop), 76 76 _columns(mesh._columns), … … 100 100 } 101 101 102 Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const 102 Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const 103 103 { 104 104 // four point normal generation. … … 116 116 dz_dx = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r))/getXInterval(); 117 117 } 118 118 119 119 float dz_dy; 120 120 if (r==0) … … 130 130 dz_dy = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1))/getYInterval(); 131 131 } 132 132 133 133 Vec3 normal(-dz_dx,-dz_dy,1.0f); 134 134 normal.normalize(); 135 135 136 136 return normal; 137 137 } … … 153 153 heightDelta.x() = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r)); 154 154 } 155 155 156 156 if (r==0) 157 157 {
