Blender V2.61 - r43446

LOD_FaceNormalEditor.h

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