|
Blender
V2.59
|
00001 /* 00002 * $Id: LOD_DecimationClass.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_LOD_DecimationClass_h 00035 #define NAN_INCLUDED_LOD_DecimationClass_h 00036 00037 #include "MEM_SmartPtr.h" 00038 #include "MEM_NonCopyable.h" 00039 00040 #include "LOD_ManMesh2.h" 00041 #include "LOD_QSDecimator.h" 00042 #include "LOD_ExternNormalEditor.h" 00043 #include "../extern/LOD_decimation.h" 00044 #include "LOD_ExternBufferEditor.h" 00045 00046 00047 class LOD_DecimationClass : public MEM_NonCopyable 00048 { 00049 public : 00050 00051 enum { 00052 e_not_loaded, 00053 e_loaded, 00054 e_preprocessed 00055 } m_e_decimation_state; 00056 00057 00058 static 00059 LOD_DecimationClass * 00060 New( 00061 LOD_Decimation_InfoPtr extern_info 00062 ) { 00063 // create everything 00064 00065 MEM_SmartPtr<LOD_DecimationClass> output(new LOD_DecimationClass()); 00066 MEM_SmartPtr<LOD_ManMesh2> mesh(LOD_ManMesh2::New()); 00067 MEM_SmartPtr<LOD_ExternBufferEditor> extern_editor(LOD_ExternBufferEditor::New(extern_info)); 00068 00069 if (mesh == NULL || extern_editor == NULL) return NULL; 00070 MEM_SmartPtr<LOD_ExternNormalEditor> normals(LOD_ExternNormalEditor::New(extern_info,mesh.Ref())); 00071 00072 if (normals == NULL) return NULL; 00073 MEM_SmartPtr<LOD_QSDecimator> decimator(LOD_QSDecimator::New( 00074 mesh.Ref(), 00075 normals.Ref(), 00076 extern_editor.Ref() 00077 )); 00078 if (decimator == NULL || output == NULL) return NULL; 00079 00080 output->m_mesh = mesh.Release(); 00081 output->m_decimator = decimator.Release(); 00082 output->m_normals = normals.Release(); 00083 output->m_extern_editor = extern_editor.Release(); 00084 00085 return output.Release(); 00086 } 00087 00088 LOD_ManMesh2 & 00089 Mesh( 00090 ){ 00091 return m_mesh.Ref(); 00092 } 00093 00094 LOD_QSDecimator & 00095 Decimator( 00096 ) { 00097 return m_decimator.Ref(); 00098 } 00099 00100 LOD_ExternNormalEditor & 00101 FaceEditor( 00102 ){ 00103 return m_normals.Ref(); 00104 } 00105 00106 private : 00107 00108 LOD_DecimationClass( 00109 ) : m_e_decimation_state(e_not_loaded) { 00110 }; 00111 00112 MEM_SmartPtr<LOD_ManMesh2> m_mesh; 00113 MEM_SmartPtr<LOD_QSDecimator> m_decimator; 00114 MEM_SmartPtr<LOD_ExternNormalEditor> m_normals; 00115 MEM_SmartPtr<LOD_ExternBufferEditor> m_extern_editor; 00116 }; 00117 00118 #endif 00119