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-2013 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 "OgreAnimationTrack.h"
00038 #include "OgreResourceGroupManager.h"
00039 #include "OgreHeaderPrefix.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         typedef vector<IndexData*>::type LODFaceList;
00114         LODFaceList mLodFaceList;
00115 
00135         vector<Vector3>::type extremityPoints;
00136 
00138         Mesh* parent;
00139 
00141         void setMaterialName(const String& matName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
00142         const String& getMaterialName(void) const;
00143 
00146         bool isMatInitialised(void) const;
00147 
00154         void _getRenderOperation(RenderOperation& rend, ushort lodIndex = 0);
00155 
00168         void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
00169 
00175         void clearBoneAssignments(void);
00176 
00178         typedef multimap<size_t, VertexBoneAssignment>::type VertexBoneAssignmentList;
00179         typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
00180 
00185         BoneAssignmentIterator getBoneAssignmentIterator(void);
00186 
00189         const VertexBoneAssignmentList& getBoneAssignments() { return mBoneAssignments; }
00190 
00191 
00193         void _compileBoneAssignments(void);
00194 
00195         typedef ConstMapIterator<AliasTextureNamePairList> AliasTextureIterator;
00199         AliasTextureIterator getAliasTextureIterator(void) const;
00210         void addTextureAlias(const String& aliasName, const String& textureName);
00216         void removeTextureAlias(const String& aliasName);
00219         void removeAllTextureAliases(void);
00222         bool hasTextureAliases(void) const { return !mTextureAliases.empty(); }
00225         size_t getTextureAliasCount(void) const { return mTextureAliases.size(); }
00226 
00237         bool updateMaterialUsingTextureAliases(void);
00238 
00241         VertexAnimationType getVertexAnimationType(void) const;
00242         
00244         bool getVertexAnimationIncludesNormals() const { return mVertexAnimationIncludesNormals; }
00245 
00246 
00251         void generateExtremes(size_t count);
00252 
00255         bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
00256         void setBuildEdgesEnabled(bool b);
00264         SubMesh * clone(const String& newName, Mesh *parentMesh = 0);
00265 
00266     protected:
00267 
00269         String mMaterialName;
00270 
00272         bool mMatInitialised;
00273 
00275         AliasTextureNamePairList mTextureAliases;
00276 
00277         VertexBoneAssignmentList mBoneAssignments;
00278 
00280         bool mBoneAssignmentsOutOfDate;
00281 
00283         mutable VertexAnimationType mVertexAnimationType;
00284 
00286         mutable bool mVertexAnimationIncludesNormals;
00287 
00289         bool mBuildEdgesEnabled;
00290 
00292         void removeLodLevels(void);
00293 
00294 
00295     };
00299 } // namespace
00300 
00301 #include "OgreHeaderSuffix.h"
00302 
00303 #endif
00304 
00305 

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:48