Sirikata
|
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_UTIL_HPP_ 00006 #define _SIRIKATA_OGRE_UTIL_HPP_ 00007 00008 #include <sirikata/ogre/Platform.hpp> 00009 #include <sirikata/core/util/Logging.hpp> 00010 #include <sirikata/mesh/Visual.hpp> 00011 #include <sirikata/mesh/Meshdata.hpp> 00012 00013 #define OGRE_LOG(lvl, msg) SILOG(ogre, lvl, msg) 00014 00015 namespace Sirikata { 00016 namespace Graphics { 00017 00018 // Maps texture URIs -> hashes 00019 typedef std::map<String, String> TextureBindingsMap; 00020 typedef std::tr1::shared_ptr<TextureBindingsMap> TextureBindingsMapPtr; 00021 00022 // Get names for different components of meshes, where possible using hashes in 00023 // order to enable reuse if the same component is encountered multiple times, 00024 // even across different meshes. For example, mesh names combine the hash of 00025 // their dae contents and hashes of textures they depend on to ensure uniqueness 00026 // while enabling reuse. 00027 String ogreVisualName(Mesh::VisualPtr vis, TextureBindingsMapPtr bindings); 00028 String ogreMaterialName(const Mesh::MaterialEffectInfo& mat, const Transfer::URI& parent_uri, TextureBindingsMapPtr bindings); 00029 // This version of ogreMaterialName doesn't take a MaterialEffectInfo because 00030 // billboards have a fixed material setup. 00031 String ogreBillboardMaterialName(TextureBindingsMapPtr bindings); 00032 String ogreSkeletonName(Mesh::MeshdataPtr md, TextureBindingsMapPtr bindings); 00033 String ogreLightName(const String& entityname, const String& meshname, int32 light_idx); 00034 00035 } // namespace Graphics 00036 } // namespace Sirikata 00037 00038 00039 #endif //_SIRIKATA_OGRE_UTIL_HPP_