24#ifndef __OD_GS_BASE_MATERIAL_VIEW__
25#define __OD_GS_BASE_MATERIAL_VIEW__
77 bool has()
const {
return !m_accumulatedLightsData.
isEmpty(); }
100 kProcessMaterials = (1 << 1),
102 kProcessMappersAndMaterials = 3,
104 kMappersForRender = (1 << 2),
105 kMaterialsForRender = (1 << 3),
107 kMappersAndMaterialsForRender = 12,
109 kProcessForRender = 15,
112 kEnableDelayCache = (1 << 4)
167 friend class OdDefDelayCacheEntryMap;
168 friend class OdManageMViewPerDrawableData;
170 enum MaterialViewRuntimeFlags
172 kMaterialCommited = (1 << 0),
173 kAccumNonCacheLights = (1 << 1),
174 kAccumCacheLights = (1 << 2),
175 kAccumLights = kAccumNonCacheLights | kAccumCacheLights
177 struct ExtentsContainer
183 kExtentsValid = (1 << 0),
184 kExtentsAwaitingCalc = (1 << 1),
185 kLastFlag = kExtentsAwaitingCalc
187 ExtentsContainer() : m_pCurrentDrawable(NULL) {}
188 void clear() { m_pCurrentDrawable = NULL; }
192 const OdGiMapper *m_pCurMapper, *m_pCopyMapper;
193 const OdDbStub *m_pCurMaterial, *m_pCopyMaterial;
194 DelayCacheEntry m_Cache;
195 DelayCacheEntry *m_pTail;
197 DelayCache() : m_pCurMapper(NULL), m_pCopyMapper(NULL)
198 , m_pCurMaterial(NULL), m_pCopyMaterial(NULL)
205 struct MViewPerDrawableData :
public ExtentsContainer
207 DelayCache m_DelayCache;
212 kMapperNeedExtents = (ExtentsContainer::kLastFlag << 1),
213 kBaseLevel = (ExtentsContainer::kLastFlag << 2),
214 kHasModelTransform = (ExtentsContainer::kLastFlag << 3),
215 kIsEntity = (ExtentsContainer::kLastFlag << 4)
217 MViewPerDrawableData()
221 ~MViewPerDrawableData()
226 ExtentsContainer::clear();
229 } *m_pCurMvDrawableData, m_mvBaseDrawableData, m_mvGlobalDrawableDataInitializer;
320 {
return (
GETBIT(m_uMaterialViewRtFlags, kAccumNonCacheLights) && !
GETBIT(m_flags, kModelCache)) ||
321 (
GETBIT(m_uMaterialViewRtFlags, kAccumCacheLights) &&
GETBIT(m_flags, kModelCache)); }
551 void updateMViewModelTransform();
552 void computeDrawableExtents();
589 resetConstructorFlags(uMaterialViewFlags);
608 resetConstructorFlags(uMaterialViewFlags);
618 return (&view() !=
this);
OdSmartPtr< OdGiMaterialTextureData > OdGiMaterialTextureDataPtr
#define GS_TOOLKIT_EXPORT
#define SETBIT_0(flags, bit)
#define GETBIT(flags, bit)
virtual void playDelayCacheEntry(const DelayCacheEntry *pEntry)
void resetCurrentMaterial(OdGiMaterialItemPtr pMaterial)
virtual void beginViewVectorization()
bool saveMaterialItem(const OdGiMaterialItem *pMatItem, OdGsFiler *pFiler)
void resetCurrentMaterial()
virtual void onTraitsModified()
virtual bool getDeviceMapperMatrix(OdGeMatrix3d &dm) const
virtual void beginMetafile(OdRxObject *pMetafile)
virtual void delayCacheProcessed(const OdGiDrawable *pDrawable)
OdGiMaterialItemPtr m_pNullMaterialItem
OdGiMaterialTraitsData m_nullMaterialTraitsData
virtual void addDistantLight(const OdGiDistantLightTraitsData &)
OdGsBaseMaterialVectorizer(OdUInt32 uMaterialViewFlags=kProcessMappersAndMaterials)
OdUInt32 m_uMaterialViewFlags
OdGiMaterialItemPtr currentMaterial() const
static OdGiMaterialTexturePtr loadMaterialTexture(OdGsFiler *pFiler)
~OdGsBaseMaterialVectorizer()
virtual bool saveClientMaterialCache(const OdRxObject *pMtl, OdGsFiler *pFiler)
OdGsLightsAccumulationContainter m_lightsAccum
bool isMapperEnabled() const
void appendDelayCacheEntry(DelayCacheEntry *pEntry)
virtual bool computeDelayedExtents(const OdGiDrawable *pDrawable, OdGeExtents3d &extents)
virtual void addWebLight(const OdGiWebLightTraitsData &)
virtual void nullMaterialStub()
virtual bool loadMaterialCache(OdGsMaterialNode *pNode, OdGsFiler *pFiler)
bool isMappingDelayed() const
virtual OdRxObjectPtr loadClientMaterialCache(OdGsFiler *pFiler, OdGiMaterialItem *pMatItem)
const OdGsLightsAccumulationContainter & getAccumulatedLights() const
virtual void addSpotLight(const OdGiSpotLightTraitsData &)
OdGsLightsAccumulationContainter & getAccumulatedLights()
virtual void endViewVectorization()
virtual bool saveMaterialCache(const OdGsMaterialNode *pNode, OdGsFiler *pFiler)
static bool saveMaterialTexture(const OdGiMaterialTexture *pTexture, OdGsFiler *pFiler)
bool isMapperAvailable() const
bool isMaterialEnabled() const
virtual void mapperChangedForDelayCache()
OdGiMaterialItemPtr m_pCurrentMaterialItem
OdGiMaterialItemPtr loadMaterialItem(OdGsFiler *pFiler)
void playAccumulatedLights(OdGsLightsAccumulationContainter *pAccumLights=NULL, bool bClear=true)
OdUInt32 m_uMaterialViewRtFlags
void resetCurrentMapper(OdGiMapperItemPtr pMapper)
bool isMaterialAvailable() const
void beginLightsAccumulation(bool bAccumNonCached=true, bool bAccumCached=false, bool bClear=false)
virtual void renderMaterialCache(OdGiMaterialItemPtr pCache, OdDbStub *materialId)
bool isLightsAccumulation() const
static bool saveMaterialTextureManager(const OdGiMaterialTextureManager *pManager, OdGsFiler *pFiler, OdGsMaterialTextureDataFiler *pSaver)
virtual void processMaterialNode(OdDbStub *materialId, OdGsMaterialNode *node)
virtual OdGiMaterialItemPtr fillMaterialCache(OdGiMaterialItemPtr prevCache, OdDbStub *materialId, const OdGiMaterialTraitsData &materialData)
virtual bool computeDrawableExtents(const OdGiDrawable *pDrawable, OdGeExtents3d &extents)
virtual bool doDraw(OdUInt32 drawableFlags, const OdGiDrawable *pDrawable)
OdGiMapperItemPtr m_pCurrentMapperItem
OdGiMapperItemPtr _itlCreateMapperItem() const
virtual void endMetafile(OdRxObject *pMetafile)
static bool loadMaterialTextureManager(OdGiMaterialTextureManager *pManager, OdGsFiler *pFiler, OdGsMaterialTextureDataFiler *pSaver)
OdGiMapperItemPtr currentMapper(bool bForCoords=true) const
virtual bool skipMaterialProcess(OdDbStub *materialId) const
virtual void addPointLight(const OdGiPointLightTraitsData &)
OdGiMaterialItemPtr _itlCreateMaterialItem() const
OdGsBaseMaterialView(OdUInt32 uMaterialViewFlags=kProcessMappersAndMaterials)
OdGsBaseMaterialViewMT(OdUInt32 uMaterialViewFlags=kProcessMappersAndMaterials)
void resetConstructorFlags(OdUInt32 uMaterialViewFlags)
DelayCacheEntry * nextEntry()
virtual ~DelayCacheEntry()
virtual void play(OdGsBaseMaterialVectorizer &mView) const
virtual DelayCacheEntryType internalType() const
void setNextEntry(DelayCacheEntry *pNext)
DelayCacheEntry * m_pNext
void append(bool bMtSync, OdGiLightTraitsData *pLightData)
OdVector< OdGiLightTraitsData * > m_accumulatedLightsData
OdMutexPtr m_lightsAccumMutex
OdGsLightsAccumulationContainter()
~OdGsLightsAccumulationContainter()
OdVector< OdGiLightTraitsData * > LightDataVector
void append(bool bMtSync, OdGsLightsAccumulationContainter &lightsAccum)
virtual OdGiMaterialTextureDataPtr loadClientMaterialTextureData(OdGsFiler *)
virtual bool saveClientMaterialTextureData(const OdGiMaterialTextureData *, OdGsFiler *)