CFx SDK Documentation  2023 SP0
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__
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdSmartPtr< OdGsMaterialCache > OdGsMaterialCachePtr
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
OdGsBaseModel * baseModel()
ODRX_DECLARE_MEMBERS(OdGsMaterialCache)
OdGsMaterialNode * currentNode() const
void addNode(OdGsBaseVectorizer &view, OdDbStub *mtl)
OdGsMaterialNode * m_pMaterials
void setCurrentNode(OdGsMaterialNode *curNode=NULL)
void setMaterial(OdGsBaseVectorizer &view, OdDbStub *mtl, bool bDontReinit=false)
OdUInt32 getCacheSize() const
bool removeNode(OdDbStub *mtl)
static OdSmartPtr< OdGsMaterialCache > createObject(OdGsBaseModel *pModel)
void setBaseModel(OdGsBaseModel *pModel)
OdGsMaterialNode * getCacheNode(OdUInt32 n) const
bool saveMaterialCache(OdGsFiler *pFiler) const
const OdGsBaseModel * baseModel() const
OdGsMaterialNode * searchNode(OdDbStub *mtl) const
OdGsBaseModel * m_pModel
OdGsMaterialNode * m_pCurrentNode
bool loadMaterialCache(OdGsFiler *pFiler)
bool removeNode(OdGsCache *pCsh)