CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiMaterialItem.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// Material data entry for Gs material cache and textures processing.
25
26#ifndef __ODGIMATERIALITEM_H__
27#define __ODGIMATERIALITEM_H__
28
29#include "GiExport.h"
30#include "GiImage.h"
31#include "GiMaterial.h"
32#include "GiCommonDraw.h"
33
34#include "RxObject.h"
35
36#include "TD_PackPush.h"
37
38class OdDbStub;
39
49{
50 public:
51 // Simple variant type for external device information
52
57 {
62 {
64 DevDataVariantType_Void = 0,
68 DevDataVariantType_RxObject
69 };
70
75 DevDataVariant() : m_ddvType(DevDataVariantType_Void), m_pVoid(NULL)
76 {
77 }
78
83 DevDataVariant(void *ptr) : m_ddvType(DevDataVariantType_Ptr), m_pVoid(ptr)
84 {
85 if (m_pVoid == NULL)
86 m_ddvType = DevDataVariantType_Void;
87 }
88
93 DevDataVariant(OdRxObjectPtr ptr) : m_ddvType(DevDataVariantType_RxObject), m_pVoid(NULL)
94 {
95 m_pRxObject = ptr;
96 }
97
105 {
106 return m_ddvType;
107 }
108
115 void *getPtr() const
116 {
117 return m_pVoid;
118 }
119
127 {
128 return m_pRxObject;
129 }
130
138 DevDataVariant &operator =(void *ptr)
139 {
140 return setPtr(ptr);
141 }
142
151 {
152 return setRxObject(ptr);
153 }
154
163 {
164 clear();
165 if (ptr != NULL)
166 {
167 m_ddvType = DevDataVariantType_Ptr;
168 m_pVoid = ptr;
169 }
170 return *this;
171 }
172
181 {
182 clear();
183 m_ddvType = DevDataVariantType_RxObject;
184 m_pRxObject = ptr;
185 return *this;
186 }
187
191 void clear()
192 {
193 m_ddvType = DevDataVariantType_Void;
194 m_pVoid = NULL;
195 if (m_pRxObject.isNull())
196 m_pRxObject.release();
197 }
198
199 protected:
201 void *m_pVoid;
203 };
204
205 public:
207 friend class OdGiModuleObject;
208
214 virtual void setTextureData(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, const OdGiImageBGRA32 &image) = 0;
222
226 virtual bool haveData() const = 0;
227
238
239 private:
241 static void rxInitDefaultTextureDataImplementation();
243 static void rxUninitDefaultTextureDataImplementation();
244};
245
252
261{
262 public:
264
269
276 virtual void startTextureLoading(OdString &fileName, OdDbBaseDatabase* pDb) = 0;
277
283 virtual void textureLoaded(const OdString &fileName, OdDbBaseDatabase* pDb) = 0;
289 virtual void textureLoadingFailed(const OdString &fileName, OdDbBaseDatabase* pDb) = 0;
290};
291
298
300
310{
311 public:
313
320 virtual bool allowTextureLoading(OdGiMaterialTexturePtr pTexture) = 0;
321
333};
334
341
351{
352 public:
354
359 {
360 kFileTexturesOnly = 0, // @def
361 kFileAndProceduralTextures, // not efficient for search
362 kDisable // only loading from LoaderExt will be active
363 };
364
369 virtual void setManageType(ManageType type) = 0;
375 virtual ManageType manageType() const = 0;
376
389
411
444 virtual OdGiMaterialTextureDataPtr tryToLoad(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTextureEntry *pEntry, const OdString &fileName) = 0;
445
451 virtual void linkTexture(const OdGiMaterialMap &matMap, OdGiMaterialTextureDataPtr pData) = 0;
463 virtual void linkTexture(const OdString &fileName, OdGiMaterialTextureDataPtr pData) = 0;
464
471 virtual bool isAvailable(const OdGiMaterialTextureData *pData) const = 0;
472
477 virtual void unlinkTexture(OdGiMaterialTextureData *pData) = 0;
478
482 virtual void clear() = 0;
483
489 virtual OdUInt32 numTextureEntries() const = 0;
490
498
506};
507
514
524{
525 public:
527
539 virtual bool isTextureInitialized() const = 0;
540
546 virtual OdUInt32 proceduralTextureWidth() const = 0;
569
575 virtual double proceduralTextureQuality() const = 0;
580 virtual void setProceduralTextureQuality(double coef) = 0;
581
592 virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, const OdGiMaterialMap &matMap, OdGiMaterialTextureManager *pManager = NULL) = 0;
593
604 virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTexturePtr pTexture, OdGiMaterialTextureManager *pManager = NULL) = 0;
605 // Load texture from raster file
616 virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, const OdString &fileName, OdGiMaterialTextureManager *pManager = NULL) = 0;
627 virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, double opacity, OdGiMaterialTextureManager *pManager = NULL) = 0;
628
634 virtual void setTextureData(OdGiMaterialTextureData *pTextureData, OdGiMaterialTextureManager *pManager = NULL) = 0;
635};
636
643
653{
654 public:
656
678 virtual void removeDiffuseTexture() = 0;
684 virtual bool haveDiffuseTexture() const = 0;
685
686 // Container data
687
693 virtual OdRxObjectPtr cachedData() const = 0;
699
705 virtual const OdDbStub *materialId() const = 0;
710 virtual void setMaterialId(const OdDbStub *matId = NULL) = 0;
716 virtual bool isMaterialIdValid(const OdDbStub *matId) = 0;
717};
718
725
735{
736 public:
738
760 virtual void removeSpecularTexture() = 0;
766 virtual bool haveSpecularTexture() const = 0;
767
789 virtual void removeReflectionTexture() = 0;
795 virtual bool haveReflectionTexture() const = 0;
796
818 virtual void removeOpacityTexture() = 0;
824 virtual bool haveOpacityTexture() const = 0;
825
847 virtual void removeBumpTexture() = 0;
853 virtual bool haveBumpTexture() const = 0;
854
876 virtual void removeRefractionTexture() = 0;
882 virtual bool haveRefractionTexture() const = 0;
883
905 virtual void removeNormalMapTexture() = 0;
911 virtual bool haveNormalMapTexture() const = 0;
912
934 virtual void removeEmissionTexture() = 0;
940 virtual bool haveEmissionTexture() const = 0;
941};
942
949
950#include "TD_PackPop.h"
951
952#endif // __ODGIMATERIALITEM_H__
#define ODGI_EXPORT
Definition: GiExport.h:35
OdSmartPtr< OdGiMaterialRenderItem > OdGiMaterialRenderItemPtr
OdSmartPtr< OdGiMaterialItem > OdGiMaterialItemPtr
OdSmartPtr< OdGiMaterialTextureManager > OdGiMaterialTextureManagerPtr
OdSmartPtr< OdGiMaterialTextureEntry > OdGiMaterialTextureEntryPtr
OdSmartPtr< OdGiMaterialTextureLoadPE > OdGiMaterialTextureLoadPEPtr
OdSmartPtr< OdGiMaterialTextureLoaderExt > OdGiMaterialTextureLoaderExtPtr
OdSmartPtr< OdGiMaterialTextureData > OdGiMaterialTextureDataPtr
unsigned int OdUInt32
virtual void setMaterialId(const OdDbStub *matId=NULL)=0
virtual void setCachedData(OdRxObjectPtr data)=0
virtual const OdDbStub * materialId() const =0
ODRX_DECLARE_MEMBERS(OdGiMaterialItem)
virtual OdGiMaterialTextureEntryPtr diffuseTexture() const =0
virtual bool haveDiffuseTexture() const =0
virtual OdRxObjectPtr cachedData() const =0
virtual OdGiMaterialTextureEntryPtr diffuseTexture()=0
virtual OdGiMaterialTextureEntryPtr createDiffuseTexture()=0
virtual void removeDiffuseTexture()=0
virtual bool isMaterialIdValid(const OdDbStub *matId)=0
ODRX_DECLARE_MEMBERS(OdGiMaterialRenderItem)
virtual bool haveSpecularTexture() const =0
virtual bool haveOpacityTexture() const =0
virtual OdGiMaterialTextureEntryPtr createRefractionTexture()=0
virtual OdGiMaterialTextureEntryPtr reflectionTexture() const =0
virtual OdGiMaterialTextureEntryPtr reflectionTexture()=0
virtual void removeBumpTexture()=0
virtual void removeEmissionTexture()=0
virtual bool haveNormalMapTexture() const =0
virtual OdGiMaterialTextureEntryPtr normalMapTexture()=0
virtual OdGiMaterialTextureEntryPtr createOpacityTexture()=0
virtual OdGiMaterialTextureEntryPtr bumpTexture()=0
virtual void removeNormalMapTexture()=0
virtual OdGiMaterialTextureEntryPtr bumpTexture() const =0
virtual OdGiMaterialTextureEntryPtr refractionTexture()=0
virtual bool haveEmissionTexture() const =0
virtual OdGiMaterialTextureEntryPtr createBumpTexture()=0
virtual OdGiMaterialTextureEntryPtr createSpecularTexture()=0
virtual void removeRefractionTexture()=0
virtual OdGiMaterialTextureEntryPtr emissionTexture()=0
virtual OdGiMaterialTextureEntryPtr specularTexture() const =0
virtual OdGiMaterialTextureEntryPtr createReflectionTexture()=0
virtual OdGiMaterialTextureEntryPtr refractionTexture() const =0
virtual bool haveBumpTexture() const =0
virtual void removeSpecularTexture()=0
virtual OdGiMaterialTextureEntryPtr emissionTexture() const =0
virtual OdGiMaterialTextureEntryPtr normalMapTexture() const =0
virtual void removeReflectionTexture()=0
virtual OdGiMaterialTextureEntryPtr opacityTexture()=0
virtual OdGiMaterialTextureEntryPtr createNormalMapTexture()=0
virtual bool haveRefractionTexture() const =0
virtual OdGiMaterialTextureEntryPtr createEmissionTexture()=0
virtual OdGiMaterialTextureEntryPtr specularTexture()=0
virtual bool haveReflectionTexture() const =0
virtual OdGiMaterialTextureEntryPtr opacityTexture() const =0
virtual void removeOpacityTexture()=0
static OdRxClass * defaultTextureDataImplementationDesc()
virtual void setTextureData(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, const OdGiImageBGRA32 &image)=0
virtual bool haveData() const =0
virtual void textureData(OdGiPixelBGRA32Array &data, OdUInt32 &width, OdUInt32 &height) const =0
ODRX_DECLARE_MEMBERS(OdGiMaterialTextureData)
static OdSmartPtr< OdGiMaterialTextureData > createDefaultTextureDataImplementation()
virtual OdUInt32 proceduralTextureWidth() const =0
virtual OdGiMaterialTextureDataPtr textureData() const =0
virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTexturePtr pTexture, OdGiMaterialTextureManager *pManager=NULL)=0
virtual OdUInt32 proceduralTextureHeight() const =0
virtual void setTextureData(OdGiMaterialTextureData *pTextureData, OdGiMaterialTextureManager *pManager=NULL)=0
virtual void setProceduralTextureHeight(OdUInt32 height)=0
virtual void setProceduralTextureResolution(OdUInt32 width, OdUInt32 height)=0
virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, const OdString &fileName, OdGiMaterialTextureManager *pManager=NULL)=0
virtual bool isTextureInitialized() const =0
virtual void setProceduralTextureWidth(OdUInt32 width)=0
ODRX_DECLARE_MEMBERS(OdGiMaterialTextureEntry)
virtual double proceduralTextureQuality() const =0
virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, const OdGiMaterialMap &matMap, OdGiMaterialTextureManager *pManager=NULL)=0
virtual void setProceduralTextureQuality(double coef)=0
virtual bool setGiMaterialTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, double opacity, OdGiMaterialTextureManager *pManager=NULL)=0
virtual void textureLoadingFailed(const OdString &fileName, OdDbBaseDatabase *pDb)=0
ODRX_DECLARE_MEMBERS(OdGiMaterialTextureLoadPE)
virtual void startTextureLoading(OdString &fileName, OdDbBaseDatabase *pDb)=0
virtual void textureLoaded(const OdString &fileName, OdDbBaseDatabase *pDb)=0
virtual OdGiMaterialTextureDataPtr loadTexture(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTextureEntry *pEntry, OdGiMaterialTexturePtr pTexture)=0
virtual bool allowTextureLoading(OdGiMaterialTexturePtr pTexture)=0
ODRX_DECLARE_MEMBERS(OdGiMaterialTextureLoaderExt)
virtual OdUInt32 numTextureEntries() const =0
virtual OdGiMaterialTextureDataPtr searchTexture(OdGiMaterialTexturePtr pTexture)=0
virtual OdGiMaterialTexturePtr textureEntryKey(OdUInt32 nIndex) const =0
virtual ManageType manageType() const =0
virtual void clear()=0
virtual void setManageType(ManageType type)=0
virtual void linkTexture(const OdGiMaterialMap &matMap, OdGiMaterialTextureDataPtr pData)=0
virtual OdGiMaterialTextureDataPtr searchTexture(const OdString &fileName)=0
virtual OdGiMaterialTextureDataPtr tryToLoad(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTextureEntry *pEntry, OdGiMaterialTexturePtr pTexture)=0
virtual void linkTexture(const OdString &fileName, OdGiMaterialTextureDataPtr pData)=0
ODRX_DECLARE_MEMBERS(OdGiMaterialTextureManager)
virtual OdGiMaterialTextureLoaderExtPtr materialLoaderExt() const =0
virtual OdGiMaterialTextureDataPtr tryToLoad(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTextureEntry *pEntry, const OdGiMaterialMap &matMap)=0
virtual OdGiMaterialTextureDataPtr searchTexture(const OdGiMaterialMap &matMap)=0
virtual void unlinkTexture(OdGiMaterialTextureData *pData)=0
virtual void linkTexture(OdGiMaterialTexturePtr pTexture, OdGiMaterialTextureDataPtr pData)=0
virtual void setMaterialLoaderExt(OdGiMaterialTextureLoaderExt *pExt)=0
virtual OdGiMaterialTextureDataPtr tryToLoad(OdGiMaterialTextureData::DevDataVariant pDeviceInfo, OdRxClass *pTexDataImpl, const OdGiContext &giCtx, OdGiMaterialTextureEntry *pEntry, const OdString &fileName)=0
virtual OdGiMaterialTextureDataPtr textureEntryData(OdUInt32 nIndex) const =0
virtual bool isAvailable(const OdGiMaterialTextureData *pData) const =0
GLint GLenum GLsizei width
Definition: gles2_ext.h:110
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
GLint GLenum GLsizei GLsizei height
Definition: gles2_ext.h:110
DevDataVariant & setRxObject(OdRxObjectPtr ptr)
DevDataVariant & setPtr(void *ptr)