Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

SegmentOrganizer.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 "StyleRepository.h"
00013 #include "TextureWriter.h"
00014 #include "VisibilityChecker.h"
00015 
00016 #include <hc.h>
00017 
00018 #include <slapi/model/face.h>
00019 #include <slapi/model/drawing_element.h>
00020 
00021 #include <map>
00022 #include <cstdint>
00023 
00024 class SegmentOrganizer
00025 {
00026 public:
00027     SegmentOrganizer(StyleRepository& styleRepository, TextureWriter& textureWriter,
00028                     VisibilityChecker& visibilityChecker);
00029 
00030     HC_KEY GetSegmentKey(SUFaceRef& face);
00031     HC_KEY GetSegmentKey(SUDrawingElementRef& drawingElement);
00032 
00033     VisibilityChecker & GetVisibilityChecker() { return m_visibilityChecker; }
00034 
00035 private:
00036     SegmentOrganizer(const SegmentOrganizer&);
00037     SegmentOrganizer& operator=(const SegmentOrganizer&);
00038 
00039     void CreateVisibleSegment(HC_KEY styleSegment, HC_KEY& newSegment);
00040     void CreateHiddenSegment(HC_KEY parentSegment, HC_KEY& newSegment);
00041 
00042 private:
00043     StyleRepository&   m_styleRepository;
00044     TextureWriter&     m_textureWriter;
00045     VisibilityChecker& m_visibilityChecker;
00046 
00047     typedef StyleRepository::FaceMaterialAndTextureId  FaceId;
00048 
00049     struct SegmentPair {
00050         SegmentPair(HC_KEY v = HC_ERROR_KEY, HC_KEY h = HC_ERROR_KEY) : visible(v), hidden(h) { }
00051 
00052         HC_KEY visible;
00053         HC_KEY hidden;
00054     };
00055 
00056     std::map<FaceId, SegmentPair>  m_faceSegmentsMap;
00057     std::map<int32_t, SegmentPair> m_lineSegmentsMap;
00058 };