CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsMaterialCache.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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#include "ThreadsCounter.h"
33
35class OdGsBaseModel;
37class OdGsBaseModule;
38class OdGsFiler;
39
43{
44 protected:
49 public:
50
55
60
62
69
73 OdGsBaseModel* baseModel() { return m_pModel; }
74
78 const OdGsBaseModel* baseModel() const { return m_pModel; }
79
86
87 // Search for already initialized node
93 OdGsMaterialNode *searchNode(OdDbStub *mtl) const;
94
102 OdGsMaterialNode *setMaterial(OdGsBaseVectorizer& view, OdDbStub *mtl, bool bDontReinit = false);
103
109 bool removeNode(OdDbStub *mtl);
110
117
118 // Cache accessors
119
125
126 // Aliases
127
134 inline void addNode(OdGsBaseVectorizer& view, OdDbStub *mtl)
135 {
136 setMaterial(view, mtl, true);
137 }
138
143
149 void invalidateCache(const OdGsBaseModule *pModule = NULL);
150
151
158 bool saveMaterialCache(OdGsFiler *pFiler) const;
159
167};
168
170
174{
175 protected:
177 public:
178
185 : m_pCurrentNode(pCurrentNode) {}
186
191
196 {
197 return m_pCurrentNode;
198 }
199
206 {
207 m_pCurrentNode = pNode;
208 }
209
218 OdGsMaterialNode *setMaterial(OdGsMaterialCache *pCache, OdGsBaseVectorizer& view, OdDbStub *mtl, bool bDontReinit = false);
219};
220
221#include "TD_PackPop.h"
222
223#endif // __OD_GS_MATERIAL_CACHE__
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdSmartPtr< OdGsMaterialCache > OdGsMaterialCachePtr
unsigned int OdUInt32
OdGsMaterialNode * m_pCurrentNode
OdGsMaterialNode * setMaterial(OdGsMaterialCache *pCache, OdGsBaseVectorizer &view, OdDbStub *mtl, bool bDontReinit=false)
void setCurrentNode(OdGsMaterialNode *pNode=NULL)
OdGsMaterialNode * currentNode() const
OdGsCurrentMaterialNode(OdGsMaterialNode *pCurrentNode=NULL)
OdGsBaseModel * baseModel()
void invalidateCache(const OdGsBaseModule *pModule=NULL)
ODRX_DECLARE_MEMBERS(OdGsMaterialCache)
OdMutexPtr m_pCacheMutex
void addNode(OdGsBaseVectorizer &view, OdDbStub *mtl)
OdGsMaterialNode * m_pMaterials
OdUInt32 getCacheSize() const
bool removeNode(OdDbStub *mtl)
OdGsMaterialNode * setMaterial(OdGsBaseVectorizer &view, OdDbStub *mtl, bool bDontReinit=false)
OdGsMaterialNode * getCacheNode(OdUInt32 n) const
static OdSmartPtr< OdGsMaterialCache > createObject(OdGsBaseModel *pModel)
void setBaseModel(OdGsBaseModel *pModel)
bool saveMaterialCache(OdGsFiler *pFiler) const
OdGsBaseModel * m_pModel
OdGsMaterialNode * searchNode(OdDbStub *mtl) const
const OdGsBaseModel * baseModel() const
bool loadMaterialCache(OdGsFiler *pFiler)
bool removeNode(OdGsCache *pCsh)