OgreSubMesh.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 
00024 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 #ifndef __SubMesh_H_
00030 #define __SubMesh_H_
00031 
00032 #include "OgrePrerequisites.h"
00033 
00034 #include "OgreVertexIndexData.h"
00035 #include "OgreMaterial.h"
00036 #include "OgreRenderOperation.h"
00037 #include "OgreVertexBoneAssignment.h"
00038 #include "OgreProgressiveMesh.h"
00039 #include "OgreAnimationTrack.h"
00040 
00041 namespace Ogre {
00042 
00056     class _OgreExport SubMesh : public SubMeshAlloc
00057     {
00058         friend class Mesh;
00059         friend class MeshSerializerImpl;
00060         friend class MeshSerializerImpl_v1_2;
00061         friend class MeshSerializerImpl_v1_1;
00062     public:
00063         SubMesh();
00064         ~SubMesh();
00065 
00066 
00068         bool useSharedVertices;
00069 
00071         RenderOperation::OperationType operationType;
00072 
00080         VertexData *vertexData;
00081 
00083         IndexData *indexData;
00084 
00104         typedef std::vector<unsigned short> IndexMap;
00105         IndexMap blendIndexToBoneIndexMap;
00106 
00107         ProgressiveMesh::LODFaceList mLodFaceList;
00108 
00128         std::vector<Vector3> extremityPoints;
00129 
00131         Mesh* parent;
00132 
00134         void setMaterialName(const String& matName);
00135         const String& getMaterialName(void) const;
00136 
00139         bool isMatInitialised(void) const;
00140 
00147         void _getRenderOperation(RenderOperation& rend, ushort lodIndex = 0);
00148 
00161         void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
00162 
00168         void clearBoneAssignments(void);
00169 
00171         typedef std::multimap<size_t, VertexBoneAssignment> VertexBoneAssignmentList;
00172         typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
00173 
00178         BoneAssignmentIterator getBoneAssignmentIterator(void);
00179 
00182         const VertexBoneAssignmentList& getBoneAssignments() { return mBoneAssignments; }
00183 
00184 
00186         void _compileBoneAssignments(void);
00187 
00188         typedef ConstMapIterator<AliasTextureNamePairList> AliasTextureIterator;
00192         AliasTextureIterator getAliasTextureIterator(void) const;
00203         void addTextureAlias(const String& aliasName, const String& textureName);
00209         void removeTextureAlias(const String& aliasName);
00212         void removeAllTextureAliases(void);
00215         bool hasTextureAliases(void) const { return !mTextureAliases.empty(); }
00218         size_t getTextureAliasCount(void) const { return mTextureAliases.size(); }
00219 
00230         bool updateMaterialUsingTextureAliases(void);
00231 
00234         VertexAnimationType getVertexAnimationType(void) const;
00235 
00240         void generateExtremes(size_t count);
00241 
00244         bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
00245         void setBuildEdgesEnabled(bool b);
00246 
00247     protected:
00248 
00250         String mMaterialName;
00251 
00253         bool mMatInitialised;
00254 
00256         AliasTextureNamePairList mTextureAliases;
00257 
00258         VertexBoneAssignmentList mBoneAssignments;
00259 
00261         bool mBoneAssignmentsOutOfDate;
00262 
00264         mutable VertexAnimationType mVertexAnimationType;
00265 
00267         bool mBuildEdgesEnabled;
00268 
00270         void removeLodLevels(void);
00271 
00272 
00273     };
00274 
00275 } // namespace
00276 
00277 #endif
00278 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:26 2009