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-2011 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __SubMesh_H_
00029 #define __SubMesh_H_
00030 
00031 #include "OgrePrerequisites.h"
00032 
00033 #include "OgreVertexIndexData.h"
00034 #include "OgreMaterial.h"
00035 #include "OgreRenderOperation.h"
00036 #include "OgreVertexBoneAssignment.h"
00037 #include "OgreProgressiveMesh.h"
00038 #include "OgreAnimationTrack.h"
00039 #include "OgreResourceGroupManager.h"
00040 
00041 namespace Ogre {
00042 
00062     class _OgreExport SubMesh : public SubMeshAlloc
00063     {
00064         friend class Mesh;
00065         friend class MeshSerializerImpl;
00066         friend class MeshSerializerImpl_v1_2;
00067         friend class MeshSerializerImpl_v1_1;
00068     public:
00069         SubMesh();
00070         ~SubMesh();
00071 
00072 
00074         bool useSharedVertices;
00075 
00077         RenderOperation::OperationType operationType;
00078 
00086         VertexData *vertexData;
00087 
00089         IndexData *indexData;
00090 
00110         typedef vector<unsigned short>::type IndexMap;
00111         IndexMap blendIndexToBoneIndexMap;
00112 
00113         ProgressiveMesh::LODFaceList mLodFaceList;
00114 
00134         vector<Vector3>::type extremityPoints;
00135 
00137         Mesh* parent;
00138 
00140         void setMaterialName(const String& matName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
00141         const String& getMaterialName(void) const;
00142 
00145         bool isMatInitialised(void) const;
00146 
00153         void _getRenderOperation(RenderOperation& rend, ushort lodIndex = 0);
00154 
00167         void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
00168 
00174         void clearBoneAssignments(void);
00175 
00177         typedef multimap<size_t, VertexBoneAssignment>::type VertexBoneAssignmentList;
00178         typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
00179 
00184         BoneAssignmentIterator getBoneAssignmentIterator(void);
00185 
00188         const VertexBoneAssignmentList& getBoneAssignments() { return mBoneAssignments; }
00189 
00190 
00192         void _compileBoneAssignments(void);
00193 
00194         typedef ConstMapIterator<AliasTextureNamePairList> AliasTextureIterator;
00198         AliasTextureIterator getAliasTextureIterator(void) const;
00209         void addTextureAlias(const String& aliasName, const String& textureName);
00215         void removeTextureAlias(const String& aliasName);
00218         void removeAllTextureAliases(void);
00221         bool hasTextureAliases(void) const { return !mTextureAliases.empty(); }
00224         size_t getTextureAliasCount(void) const { return mTextureAliases.size(); }
00225 
00236         bool updateMaterialUsingTextureAliases(void);
00237 
00240         VertexAnimationType getVertexAnimationType(void) const;
00241 
00246         void generateExtremes(size_t count);
00247 
00250         bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
00251         void setBuildEdgesEnabled(bool b);
00252 
00253     protected:
00254 
00256         String mMaterialName;
00257 
00259         bool mMatInitialised;
00260 
00262         AliasTextureNamePairList mTextureAliases;
00263 
00264         VertexBoneAssignmentList mBoneAssignments;
00265 
00267         bool mBoneAssignmentsOutOfDate;
00268 
00270         mutable VertexAnimationType mVertexAnimationType;
00271 
00273         bool mBuildEdgesEnabled;
00274 
00276         void removeLodLevels(void);
00277 
00278 
00279     };
00283 } // namespace
00284 
00285 #endif
00286 
00287 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:44