CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsMaterialNode.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_NODE__
25#define __OD_GS_MATERIAL_NODE__
26
27#include "TD_PackPush.h"
28
29#include "Gs/GsNode.h"
30#include "Gi/GiMaterial.h"
32#include "ThreadsCounter.h"
33#define STL_USING_MAP
34#include "OdaSTL.h"
35
36// Materials cached in GsModel, but in separate cache, instead all geometry.
37
38// GsModel caches hierarchy:
39// OdGsBaseModel
40// OdGsContainerNode <-- OdGsNode - geometry cache
41// OdGsEntityNode <-- OdGsNode
42// OdGsLightNode - has separate array, but stored into geometry cache too
43// OdGsLayerNode <-- OdGsNode - layers cache
44// OdGsBaseMode::OdGsMaterialCache
45// OdGsMaterialNode <-- OdGsNode - materials cache
46
50{
51protected:
55 void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
56 OdSiSpatialIndex* pParentIndex);
57
61 void display(OdGsDisplayContext& ctx);
62
66 bool extents(OdGeExtents3d& ) const;
67
72
77
82
87
91 struct DataEntry
92 {
97
102
106 DataEntry() : m_cachedDataModified(true) { }
107 };
111 typedef std::map<const void *, DataEntry> CacheMap;
112
117
122
127
132public:
134
142 OdGsMaterialNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable, bool bSetGsNode = true);
143
148
149 void destroy() {}
150
155
160
167 virtual void onModified(OdGsBaseVectorizer& view);
168
173
179 void invalidateModule(const void *pModule);
180
186 virtual void update(OdGsBaseVectorizer& view);
187
192
197
206
215
222 bool isDataModified() const;
223
231
238
245
252 void setCachedData(OdGsBaseVectorizer& view, OdRxObject *newCachedData);
253
257 OdMutexPtr &cacheMutex() { return m_pCacheMutex; }
258
265 virtual ENodeType nodeType() const { return kMaterialNode; }
266
275 bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
276
285 bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
286};
287
288// Cache for material nodes
289#include "GsMaterialCache.h"
290
291#include "TD_PackPop.h"
292
293#endif // __OD_GS_MATERIAL_NODE__
true
Definition: DimVarDefs.h:2046
ENodeType
Definition: GsBaseModel.h:69
@ kMaterialNode
Definition: GsBaseModel.h:77
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
unsigned int OdUInt32
void setCachedData(OdGsBaseVectorizer &view, OdRxObject *newCachedData)
OdGiMaterialTraitsData m_materialTraits
void invalidate(OdGsContainerNode *pParent, OdGsViewImpl *pView, OdUInt32 mask)
bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
OdGsMaterialNode * m_pMatNext
OdGsMaterialNode * setNextNode(OdGsMaterialNode *newNode)
OdGsMaterialNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable, bool bSetGsNode=true)
const OdGiMaterialTraitsData & materialTraits() const
void invalidateModule(const void *pModule)
virtual void onModified(OdGsBaseVectorizer &view)
OdGiMaterialTraitsData & materialTraits()
void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)
bool extents(OdGeExtents3d &) const
bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
bool isDataModified() const
OdGsMaterialNode * setPrevNode(OdGsMaterialNode *newNode)
void setCachedDataUpdated(OdGsBaseVectorizer &view)
const OdRxObject * cachedData(OdGsBaseVectorizer &view) const
virtual void update(OdGsBaseVectorizer &view)
OdGsMaterialNode * prevNode() const
OdGsMaterialNode * nextNode() const
void display(OdGsDisplayContext &ctx)
OdGsMaterialNode * m_pMatPrev
virtual ENodeType nodeType() const
ODRX_DECLARE_MEMBERS(OdGsMaterialNode)
bool isCachedDataModified(OdGsBaseVectorizer &view) const
OdMutexPtr m_pCacheMutex
virtual void propagateLayerChanges(OdGsViewImpl &view)
std::map< const void *, DataEntry > CacheMap
OdMutexPtr & cacheMutex()
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
DataEntry()
bool m_cachedDataModified
OdRxObjectPtr m_pCachedData