00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00010 #pragma once 00011 00012 #include "SmartSuRef.h" 00013 00014 #include <slapi/model/model.h> 00015 #include <slapi/model/face.h> 00016 #include <slapi/model/image.h> 00017 #include <slapi/model/entities.h> 00018 00019 #include <string> 00020 #include <vector> 00021 00022 class TextureWriter 00023 { 00024 public: 00025 TextureWriter(); 00026 00027 bool LoadModel(SUModelRef& model); 00028 bool CreateMeshHelper(SUFaceRef& face, SmartMeshHelperRef& meshHelper); 00029 bool DumpTextureImages(const std::string& directory, std::size_t& numTextures); 00030 bool GetTextureIdsForFace(SUFaceRef& face, int32_t& frontTextureId, int32_t& backTextureId); 00031 bool GetTextureIdForImage(SUImageRef& image, int32_t& textureId); 00032 bool GetTextureIdForGroup(SUGroupRef& group, int32_t& textureId); 00033 std::string GetTextureFilePath(int32_t textureId); 00034 SUTextureWriterRef& GetSKPTextureWriter() { return m_textureWriter.GetReference(); } 00035 00036 private: 00037 bool ProcessEntities(SUEntitiesRef& entities); 00038 bool ProcessDefinitions(SUModelRef& model); 00039 bool ProcessGroups(SUEntitiesRef& entities); 00040 bool LoadFacesInEntities(SUEntitiesRef& entities); 00041 bool LoadImagesInEntities(SUEntitiesRef& entities); 00042 00043 private: 00044 SmartTextureWriterRef m_textureWriter; 00045 std::vector<void *> m_groupsProcessed; 00046 };