CFx SDK Documentation  2020SP3
GsMaterialCache.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef __OD_GS_MATERIAL_CACHE__
25 #define __OD_GS_MATERIAL_CACHE__
26 
27 // Cache for material nodes
28 
29 #include "TD_PackPush.h"
30 
31 #include "RxObject.h"
32 
33 class OdGsBaseVectorizer;
34 class OdGsBaseModel;
35 class OdGsMaterialNode;
36 class OdGsFiler;
37 
41 {
42  protected:
47  public:
50 
52 
53  void setBaseModel(OdGsBaseModel* pModel);
54 
55  OdGsBaseModel* baseModel() { return m_pModel; }
56  const OdGsBaseModel* baseModel() const { return m_pModel; }
57 
59 
60  // Search for already initialized node
61  OdGsMaterialNode *searchNode(OdDbStub *mtl) const;
62  // Get current node
64  // Initialize new node, if not already initialized or changed and set's as current node
65  void setMaterial(OdGsBaseVectorizer& view, OdDbStub *mtl, bool bDontReinit = false);
66  // Reset current node
68 
69  // Remove material node on Erase
70  bool removeNode(OdDbStub *mtl);
71  bool removeNode(OdGsCache *pCsh);
72 
73  // Cache accessors
76 
77  // Aliases
78  inline void addNode(OdGsBaseVectorizer& view, OdDbStub *mtl)
79  {
80  setMaterial(view, mtl, true);
81  }
82 
83  // Clear cache
84  void clearCache();
85 
86  // Invalidate cache
88 
89  // Save cache to filer
90  bool saveMaterialCache(OdGsFiler *pFiler) const;
91  // Load cache from filer
93 };
94 
96 
97 #include "TD_PackPop.h"
98 
99 #endif // __OD_GS_MATERIAL_CACHE__
NULL
#define NULL
Definition: GsProperties.h:177
OdGsMaterialCache::setCurrentNode
void setCurrentNode(OdGsMaterialNode *curNode=NULL)
OdGsMaterialCache::m_nMaterials
OdUInt32 m_nMaterials
Definition: GsMaterialCache.h:43
OdGsBaseVectorizer
Definition: GsBaseVectorizer.h:112
OdGsMaterialCache::baseModel
const OdGsBaseModel * baseModel() const
Definition: GsMaterialCache.h:56
OdRxObject
Definition: RxObject.h:564
OdGsMaterialCache::setBaseModel
void setBaseModel(OdGsBaseModel *pModel)
OdGsMaterialCachePtr
OdSmartPtr< OdGsMaterialCache > OdGsMaterialCachePtr
Definition: GsMaterialCache.h:95
OdGsCache
Definition: GsModel.h:40
OdGsMaterialCache
Definition: GsMaterialCache.h:41
OdGsMaterialCache::getCacheNode
OdGsMaterialNode * getCacheNode(OdUInt32 n) const
OdGsMaterialCache::m_pModel
OdGsBaseModel * m_pModel
Definition: GsMaterialCache.h:46
TD_PackPop.h
RxObject.h
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGsMaterialCache::loadMaterialCache
bool loadMaterialCache(OdGsFiler *pFiler)
OdGsMaterialNode
Definition: GsMaterialNode.h:50
OdGsMaterialCache::setMaterial
void setMaterial(OdGsBaseVectorizer &view, OdDbStub *mtl, bool bDontReinit=false)
OdGsMaterialCache::baseModel
OdGsBaseModel * baseModel()
Definition: GsMaterialCache.h:55
OdSmartPtr< OdGsMaterialCache >
OdGsMaterialCache::OdGsMaterialCache
OdGsMaterialCache()
OdGsMaterialCache::invalidateCache
void invalidateCache()
OdGsMaterialCache::createObject
static OdSmartPtr< OdGsMaterialCache > createObject(OdGsBaseModel *pModel)
OdGsMaterialCache::clearCache
void clearCache()
OdGsMaterialCache::saveMaterialCache
bool saveMaterialCache(OdGsFiler *pFiler) const
TD_PackPush.h
OdGsMaterialCache::addNode
void addNode(OdGsBaseVectorizer &view, OdDbStub *mtl)
Definition: GsMaterialCache.h:78
OdGsMaterialCache::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdGsMaterialCache)
OdGsMaterialCache::searchNode
OdGsMaterialNode * searchNode(OdDbStub *mtl) const
OdGsBaseModel
Definition: GsBaseModel.h:118
GS_TOOLKIT_EXPORT
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdGsMaterialCache::m_pMaterials
OdGsMaterialNode * m_pMaterials
Definition: GsMaterialCache.h:44
OdGsMaterialCache::removeNode
bool removeNode(OdDbStub *mtl)
OdGsMaterialCache::currentNode
OdGsMaterialNode * currentNode() const
OdGsMaterialCache::removeNode
bool removeNode(OdGsCache *pCsh)
OdGsFiler
Definition: GsFiler.h:63
OdGsMaterialCache::getCacheSize
OdUInt32 getCacheSize() const
OdGsMaterialCache::~OdGsMaterialCache
~OdGsMaterialCache()
OdGsMaterialCache::m_pCurrentNode
OdGsMaterialNode * m_pCurrentNode
Definition: GsMaterialCache.h:45