|
Blender
V2.59
|
00001 /* 00002 * $Id: LOD_FaceNormalEditor.h 35147 2011-02-25 10:47:28Z jesterking $ 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00020 * All rights reserved. 00021 * 00022 * The Original Code is: all of this file. 00023 * 00024 * Contributor(s): none yet. 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #ifndef NAN_INCLUDED_FaceNormalEditor_h 00035 #define NAN_INCLUDED_FaceNormalEditor_h 00036 00037 #include "MEM_NonCopyable.h" 00038 #include "LOD_ManMesh2.h" 00039 #include "MT_Vector3.h" 00040 00041 00042 class LOD_FaceNormalEditor : public MEM_NonCopyable 00043 { 00044 00045 public : 00046 00047 // Creation 00049 00050 static 00051 LOD_FaceNormalEditor * 00052 New( 00053 LOD_ManMesh2 &mesh 00054 ); 00055 00056 // Property editor interface 00058 00059 00060 // Faces 00062 void 00063 Remove( 00064 std::vector<LOD_FaceInd> &sorted_faces 00065 ); 00066 00067 void 00068 Add( 00069 ); 00070 00071 void 00072 Update( 00073 std::vector<LOD_FaceInd> &sorted_faces 00074 ); 00075 00076 00077 // vertex normals 00079 00080 void 00081 RemoveVertexNormals( 00082 std::vector<LOD_VertexInd> &sorted_verts 00083 ); 00084 00085 00086 void 00087 UpdateVertexNormals( 00088 std::vector<LOD_VertexInd> &sorted_verts 00089 ); 00090 00091 00092 00093 const 00094 std::vector<MT_Vector3> & 00095 Normals( 00096 ) const { 00097 return m_normals.Ref(); 00098 }; 00099 00100 00101 const 00102 std::vector<MT_Vector3> & 00103 VertexNormals( 00104 ) const { 00105 return m_vertex_normals.Ref(); 00106 }; 00107 00108 // Editor specific methods 00110 00111 void 00112 BuildNormals( 00113 ); 00114 00115 00116 private : 00117 00118 MEM_SmartPtr<std::vector<MT_Vector3> > m_normals; 00119 MEM_SmartPtr<std::vector<MT_Vector3> > m_vertex_normals; 00120 00121 LOD_ManMesh2 &m_mesh; 00122 00123 private : 00124 00125 00126 LOD_FaceNormalEditor(LOD_ManMesh2 &mesh); 00127 00128 const 00129 MT_Vector3 00130 ComputeNormal( 00131 const LOD_TriFace &face 00132 ) const ; 00133 00134 const 00135 MT_Vector3 00136 ComputeVertexNormal ( 00137 const LOD_VertexInd vi 00138 ) const; 00139 00140 00141 00142 }; 00143 00144 #endif 00145