Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

ShellImporter.h
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 "SegmentOrganizer.h"
00013 #include "SmartSuRef.h"
00014 
00015 #include <HUtility.h>
00016 
00017 #include <slapi/model/entities.h>
00018 #include <slapi/model/face.h>
00019 #include <slapi/model/mesh_helper.h>
00020 
00021 #include <vector>
00022 
00023 #include "InheritanceManager.h"
00024 
00025 class ShellImporter
00026 {
00027 public:
00028     ShellImporter(TextureWriter& textureWriter, SegmentOrganizer& SegmentOrganizer, InheritanceManager& inheritanceManager, VisibilityChecker& visibilityChecker);
00029 
00030     bool Import(SUEntitiesRef& entities);
00031 
00032 private:
00033     struct ShellInfo {
00034         std::vector<HPoint>     points;
00035         std::vector<int>        faces;
00036         std::vector<HVector>    normals;
00037         std::vector<float>      params;
00038 
00039         bool                    isVisible;
00040     };
00041     typedef std::map<HC_KEY, ShellInfo> SegmentShellMap;
00042 
00043 
00044     ShellImporter(const ShellImporter&);
00045     ShellImporter& operator=(const ShellImporter&);
00046 
00047     bool ImportShell(SUFaceRef& suFace, SegmentShellMap & segmentShellMap);
00048     bool GetFacesListAndPoints(SUMeshHelperRef& meshHelper, std::vector<int>& faces, std::vector<HPoint>& points, size_t baseIndex);
00049     bool GetNormalVectors(SUMeshHelperRef& meshHelper, std::size_t numVertices, std::vector<HVector>& normalVectors);
00050     bool GetVertexParameters(SUFaceRef& suFace, SUMeshHelperRef& meshHelper, std::size_t numVertices, std::vector<float>& vertexParameters);
00051     bool InsertShell(HC_KEY segmentKey, const std::vector<HPoint>& points, const std::vector<int>& faces, const std::vector<HVector>& normalVectors,
00052                     const std::vector<float>& vertexParameters, bool isVisible = true);
00053 
00054 private:
00055     static const std::size_t s_numParametersPerVertex = 3;
00056 
00057     TextureWriter&              m_textureWriter;
00058     InheritanceManager&         m_inheritanceManager;
00059     VisibilityChecker&          m_visibilityChecker;
00060     SegmentOrganizer& m_segmentOrganizer;
00061 };