Sirikata
libogre/src/ManualMeshLoader.hpp
Go to the documentation of this file.
00001 // Copyright (c) 2011 Sirikata Authors. All rights reserved.
00002 // Use of this source code is governed by a BSD-style license that can
00003 // be found in the LICENSE file.
00004 
00005 #ifndef _SIRIKATA_OGRE_MANUAL_MESH_LOADER_HPP_
00006 #define _SIRIKATA_OGRE_MANUAL_MESH_LOADER_HPP_
00007 
00008 #include <sirikata/ogre/Platform.hpp>
00009 #include <sirikata/ogre/Util.hpp>
00010 #include <sirikata/mesh/Meshdata.hpp>
00011 #include <OgreResource.h>
00012 #include <OgreHardwareVertexBuffer.h>
00013 
00014 namespace Sirikata {
00015 namespace Graphics {
00016 
00017 class ManualMeshLoader : public Ogre::ManualResourceLoader {
00018 public:
00019     ManualMeshLoader(Mesh::MeshdataPtr meshdata, TextureBindingsMapPtr textureFingerprints);
00020 
00021     void prepareResource(Ogre::Resource*r) {}
00022     void loadResource(Ogre::Resource *r);
00023 
00024 private:
00025     Ogre::VertexData* createVertexData(const Mesh::SubMeshGeometry &submesh, int vertexCount, Ogre::HardwareVertexBufferSharedPtr&vbuf);
00026     void getMeshStats(bool* useSharedBufferOut, size_t* totalVertexCountOut);
00027     void traverseNodes(Ogre::Resource* r, const bool useSharedBuffer, const size_t totalVertexCount);
00028 
00029     Mesh::MeshdataPtr mdptr;
00030     TextureBindingsMapPtr mTextureFingerprints;
00031 };
00032 
00033 } // namespace Graphics
00034 } // namespace Sirikata
00035 
00036 #endif //_SIRIKATA_OGRE_MANUAL_MESH_LOADER_HPP_