CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiMaterial.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 __ODGIMATERIAL_H__
25#define __ODGIMATERIAL_H__
26
27#include "TD_PackPush.h"
28#include "RootExport.h"
29#include "GiExport.h"
30
31#include "CmColorBase.h"
32#include "Ge/GeMatrix3d.h"
33#include "Gi/GiDrawable.h"
34#include "Gi/GiVariant.h"
35
37class OdGiMaterialMap;
38class OdGiRasterImage;
39
48{
49public:
51
57 {
59 kBlinnShader = 0,
61 kMetalShader
62 };
63
68 {
70 kNone = 0x00000,
72 kUseDiffuse = 0x00001,
74 kUseSpecular = 0x00002,
76 kUseReflection = 0x00004,
78 kUseOpacity = 0x00008,
80 kUseBump = 0x00010,
82 kUseRefraction = 0x00020,
84 kUseNormalMap = 0x00040,
85 // BIM extensions
87 kUseEmission = 0x00080,
89 kUseTint = 0x00100,
91 kUseAll = (kUseDiffuse | kUseSpecular | kUseReflection |
92 kUseOpacity | kUseBump | kUseRefraction | kUseNormalMap),
94 kUseAllInternal = (kUseAll | kUseEmission | kUseTint)
95 };
96
100 enum Mode
101 {
103 kRealistic = 0,
105 kAdvanced
106 };
107
108 // Returned via subSetAttributes()
109 enum
110 {
111 kByBlock = (OdGiDrawable::kLastFlag << 1), // "ByBlock" material.
112 kByLayer = (OdGiDrawable::kLastFlag << 2) // "ByLayer" material.
113 };
114
115 // Extended material traits enumerations
116
121 {
123 kSelfIllumination = 0,
127 kEmissionColor
128 };
129
134 {
136 kTangentSpace
137 };
138
143 {
151 kGlobalIlluminationCastAndReceive
152 };
153
158 {
166 kFinalGatherCastAndReceive
167 };
168
169 // BIM extensions
174 {
176 kDiffuseRealisticColor = 0,
180 kDiffuseStyleDependent
181 };
182
191 virtual void ambient(OdGiMaterialColor& ambientColor) const = 0;
192
202 virtual void diffuse(OdGiMaterialColor& diffuseColor, OdGiMaterialMap& diffuseMap) const = 0;
203
214 virtual void specular(OdGiMaterialColor& specularColor, OdGiMaterialMap& specularMap, double& glossFactor) const = 0;
215
224 virtual void reflection(OdGiMaterialMap& reflectionMap) const = 0;
225
232 virtual void opacity(double& opacityPercentage, OdGiMaterialMap& opacityMap) const = 0;
233
239 virtual void bump(OdGiMaterialMap& bumpMap) const = 0;
240
247 virtual void refraction(double& refractionIndex, OdGiMaterialMap& refractionMap) const = 0;
248
255 virtual double translucence() const = 0;
256
263 virtual double selfIllumination() const = 0;
264
271 virtual double reflectivity() const = 0;
272
280
287 virtual ChannelFlags channelFlags() const = 0;
288
295 virtual Mode mode() const = 0;
296
305 virtual void setAmbient(const OdGiMaterialColor& ambientColor) = 0;
306
316 virtual void setDiffuse(const OdGiMaterialColor& diffuseColor, const OdGiMaterialMap& diffuseMap) = 0;
317
328 virtual void setSpecular(const OdGiMaterialColor& specularColor, const OdGiMaterialMap& specularMap, double glossFactor) = 0;
329
338 virtual void setReflection(const OdGiMaterialMap& reflectionMap) = 0;
339
346 virtual void setOpacity(double opacityPercentage, const OdGiMaterialMap& opacityMap) = 0;
347
353 virtual void setBump(const OdGiMaterialMap& bumpMap) = 0;
354
361 virtual void setRefraction(double refractionIndex, const OdGiMaterialMap& refractionMap) = 0;
362
368 virtual void setTranslucence(double value) = 0;
369
375 virtual void setSelfIllumination(double value) = 0;
376
382 virtual void setReflectivity(double value) = 0;
383
390
396 virtual void setChannelFlags(ChannelFlags flags) = 0;
397
403 virtual void setMode(Mode value) = 0;
404
405 // Extended material properties
406
412 virtual void setColorBleedScale(double scale) = 0;
413
420 virtual double colorBleedScale() const = 0;
421
427 virtual void setIndirectBumpScale(double scale) = 0;
428
435 virtual double indirectBumpScale() const = 0;
436
442 virtual void setReflectanceScale(double scale) = 0;
443
450 virtual double reflectanceScale() const = 0;
451
457 virtual void setTransmittanceScale(double scale) = 0;
458
465 virtual double transmittanceScale() const = 0;
466
472 virtual void setTwoSided(bool flag) = 0;
473
477 virtual bool twoSided() const = 0;
478
484 virtual void setLuminanceMode(LuminanceMode mode) = 0;
485
492 virtual LuminanceMode luminanceMode() const = 0;
493
499 virtual void setLuminance(double value) = 0;
500
507 virtual double luminance() const = 0;
508
516 virtual void setNormalMap(const OdGiMaterialMap &normalMap, NormalMapMethod method, double strength) = 0;
517
525 virtual void normalMap(OdGiMaterialMap &normalMap, NormalMapMethod &method, double &strength) const = 0;
526
533
541
547 virtual void setFinalGather(FinalGatherMode mode) = 0;
548
555 virtual FinalGatherMode finalGather() const = 0;
556
557 // BIM extensions
558
565 virtual void setEmission(const OdGiMaterialColor& emissionColor, const OdGiMaterialMap& emissionMap) = 0;
566
573 virtual void emission(OdGiMaterialColor& emissionColor, OdGiMaterialMap& emissionMap) const = 0;
574
580 virtual void setTint(const OdGiMaterialColor& tintColor) = 0;
581
587 virtual void tint(OdGiMaterialColor& tintColor) const = 0;
588
594 virtual void setShadingAmbient(const OdGiMaterialColor& ambientColor) = 0;
595
601 virtual void shadingAmbient(OdGiMaterialColor& ambientColor) const = 0;
602
608 virtual void setShadingDiffuse(const OdGiMaterialColor& diffuseColor) = 0;
609
615 virtual void shadingDiffuse(OdGiMaterialColor& diffuseColor) const = 0;
616
622 virtual void setShadingSpecular(const OdGiMaterialColor& specularColor) = 0;
623
629 virtual void shadingSpecular(OdGiMaterialColor& specularColor) const = 0;
630
636 virtual void setShadingOpacity(double opacityPercentage) = 0;
637
643 virtual void shadingOpacity(double &opacityPercentage) const = 0;
644
650 virtual void setDiffuseColorMode(DiffuseColorMode diffuseColorMode) = 0;
651
658
659 // Visualize extensions
660
667 virtual void setShadowsOpacityEffect(double effectPercentage, double nonShadowLightsMergeEffect = 1.0) = 0;
668
675 virtual double shadowsOpacityEffect(double &nonShadowLightsMergeEffect) const = 0;
676
687 virtual void setSpecularHighlightingOverride(double overrideVal) = 0;
688
692 virtual double specularHighlightingOverride() const = 0;
693};
694
699
700
710{
711public:
716 {
718 kInherit = 0,
720 kOverride = 1
721 };
722
724
729
735 OdGiMaterialColor(const OdCmEntityColor &overrideColor);
736
751 void setMethod(Method method);
752
761 void setFactor(double factor);
762
769 OdCmEntityColor& color();
770
783 Method method() const;
784
794 double factor() const;
795
802 const OdCmEntityColor& color() const;
803
816 bool operator ==(const OdGiMaterialColor &other) const
817 {
818 return (m_method == other.m_method) &&
819 (m_factor == other.m_factor) &&
820 (m_color == other.m_color);
821 }
822
835 bool operator != (const OdGiMaterialColor &other) const
836 {
837 return (m_method != other.m_method) ||
838 (m_factor != other.m_factor) ||
839 (m_color != other.m_color);
840 }
841
846 void setColor(const OdCmEntityColor &color);
847
848private:
849 Method m_method;
850 double m_factor;
851 OdCmEntityColor m_color;
852};
853
854
863{
864public:
866 virtual bool operator==(const OdGiMaterialTexture & texture)const;
867protected:
870};
871
873 return (texture.isA() == isA());
874}
875
880
889{
890public:
892protected:
895};
896
901
910{
911public:
913
919 virtual void setSourceFileName(const OdString& fileName);
920
926 virtual const OdString sourceFileName() const;
927
939 virtual bool operator==(const OdGiMaterialTexture & texture) const;
940
951
952 // OdRxObject overrides
953
959 void copyFrom(const OdRxObject* pSource);
960private:
961 OdString m_sourceFileName;
962};
963
968
977{
978public:
985 virtual void setRasterImage(const OdGiRasterImage *pRasterImage);
986
992 virtual const OdGiRasterImage *rasterImage() const;
993
1005 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1006
1017
1023 void copyFrom(const OdRxObject* pSource);
1024private:
1025 OdRxObjectPtr m_pRasterImage;
1026};
1027
1032
1041{
1042public:
1049 virtual void setRasterImage(const OdGiRasterImage *pRasterImage);
1050
1056 virtual const OdGiRasterImage *rasterImage() const;
1057
1063 virtual void setRasterImageTexture(const OdGiRasterImageTexture *pRasterImage);
1064
1070 virtual const OdGiRasterImageTexture *rasterImageTexture() const;
1071
1083 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1084
1095
1101 void copyFrom(const OdRxObject* pSource);
1102private:
1103 OdGiRasterImageTexturePtr m_pRasterImage;
1104};
1105
1110
1117{
1118public:
1120
1124 enum Type
1125 {
1126 kWood = 0, // Wood texture.
1127 kMarble = 1, // Marble texture.
1128 kGeneric = 2 // Generic texture.
1130
1136 virtual Type type() const = 0;
1137protected:
1140};
1141
1146
1153{
1154public:
1156
1161
1167 virtual Type type() const {return kWood;}
1168
1169 // wood properties
1170
1176 virtual void setColor1(const OdGiMaterialColor &woodColor1);
1177
1183 virtual const OdGiMaterialColor& color1(void) const;
1184
1190 virtual void setColor2(const OdGiMaterialColor &woodColor2);
1191
1197 virtual const OdGiMaterialColor& color2(void) const;
1198
1204 virtual void setRadialNoise(double radialNoise);
1205
1211 virtual double radialNoise(void) const;
1212
1218 virtual void setAxialNoise(double axialNoise);
1219
1225 virtual double axialNoise(void) const;
1226
1232 virtual void setGrainThickness(double grainThickness);
1233
1239 virtual double grainThickness(void) const;
1240
1256 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1257
1268 OdGiWoodTexture &operator =(const OdGiWoodTexture &texture);
1269
1270 // OdRxObject overrides
1271
1277 void copyFrom(const OdRxObject* pSource);
1278private:
1279 OdGiMaterialColor m_color1;
1280 OdGiMaterialColor m_color2;
1281 double m_radialNoise;
1282 double m_axialNoise;
1283 double m_grainThickness;
1284};
1285
1290
1297{
1298public:
1300
1305
1311 virtual Type type() const {return kMarble;}
1312
1318 virtual void setStoneColor(const OdGiMaterialColor &stoneColor);
1319
1326 virtual const OdGiMaterialColor& stoneColor(void) const;
1327
1333 virtual void setVeinColor(const OdGiMaterialColor &veinColor);
1334
1341 virtual const OdGiMaterialColor& veinColor(void) const;
1342
1348 virtual void setVeinSpacing(double veinSpacing);
1349
1356 virtual double veinSpacing(void) const;
1357
1363 virtual void setVeinWidth(double veinWidth);
1364
1371 virtual double veinWidth(void) const;
1372
1387 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1388
1399 OdGiMarbleTexture &operator =(const OdGiMarbleTexture &texture);
1400
1401 // OdRxObject overrides
1402
1408 void copyFrom(const OdRxObject* pSource);
1409private:
1410 OdGiMaterialColor m_stoneColor;
1411 OdGiMaterialColor m_veinColor;
1412 double m_veinSpacing;
1413 double m_veinWidth;
1414};
1415
1420
1427{
1428public:
1430
1435
1441 virtual Type type() const {return kGeneric;}
1442
1448 virtual void setDefinition(const OdGiVariant &definition);
1449
1455 virtual OdGiVariantPtr definition() const;
1456
1462 virtual void definition(OdGiVariantPtr &pDefinition) const;
1463
1475 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1476
1484 OdGiGenericTexture &operator =(const OdGiGenericTexture &texture);
1485
1486 // OdRxObject overrides
1487
1493 void copyFrom(const OdRxObject* pSource);
1494private:
1495 OdGiVariantPtr m_definition;
1496};
1497
1502
1503
1515{
1516public:
1521 {
1523 kInheritProjection = 0,
1525 kPlanar = 1,
1527 kBox = 2,
1529 kCylinder = 3,
1531 kSphere = 4,
1533 kDgnParametric = 0x32,
1535 kDgnPlanar = 0x33,
1537 kDgnCylinder = 0x34,
1539 kDgnCylinderCapped = 0x35,
1541 kDgnSphere = 0x36
1543
1548 {
1550 kInheritTiling = 0,
1552 kTile = 1,
1554 kCrop = 2,
1556 kClamp = 3,
1558 kMirror = 4
1560
1565 {
1567 kInheritAutoTransform = 0x0,
1569 kNone = 0x1,
1571 kObject = 0x2,
1573 kModel = 0x4
1575
1577
1583 : m_projection(kPlanar)
1584 , m_uTiling(kTile)
1585 , m_vTiling(kTile)
1586 , m_autoTransform(kNone)
1587 {
1588 }
1589
1595 OdGiMapper (const OdGiMapper& mapper);
1596
1605 OdGiMapper& operator=(const OdGiMapper& mapper);
1606
1620 bool operator==(const OdGiMapper& mapper) const;
1621
1635 bool operator!=(const OdGiMapper& mapper) const;
1636
1654 void setProjection(Projection projection);
1655
1673 void setUTiling(Tiling tiling);
1674
1692 void setVTiling(Tiling tiling);
1693
1710 void setAutoTransform(AutoTransform autoTransform);
1711
1721 OdGeMatrix3d& transform();
1722
1738 Projection projection() const;
1739
1755 Tiling uTiling() const;
1756
1772 Tiling vTiling() const;
1773
1788 AutoTransform autoTransform() const;
1789
1795 const OdGeMatrix3d& transform() const;
1796
1802 void setTransform(const OdGeMatrix3d &tm);
1803
1804private:
1805 Projection m_projection;
1806 Tiling m_uTiling;
1807 Tiling m_vTiling;
1808 AutoTransform m_autoTransform;
1809 OdGeMatrix3d m_transform;
1810};
1811
1812
1823{
1824public:
1825
1830 {
1832 kScene = 0,
1834 kFile = 1,
1836 kProcedural = 2
1838
1840
1846
1863
1868 void setSourceFileName(const OdString& filename);
1869
1879 void setBlendFactor(double blendFactor);
1880
1887
1897 OdGiMapper& mapper();
1898
1912 Source source() const;
1913
1921
1932 double blendFactor() const;
1933
1939 const OdGiMapper& mapper() const;
1940
1946 void setMapper(const OdGiMapper &mapper);
1947
1954 const OdGiMaterialTexturePtr texture(void) const;
1955
1969 bool operator ==(const OdGiMaterialMap &other) const
1970 {
1971 if ((m_source == other.m_source) &&
1972 (m_blendFactor == other.m_blendFactor) &&
1973 (m_mapper == other.m_mapper))
1974 {
1975 if (m_texture.isNull() && other.m_texture.isNull())
1976 return true;
1977 if (!m_texture.isNull() && !other.m_texture.isNull())
1978 return (*m_texture == *(other.m_texture));
1979 }
1980 return false;
1981 }
1982
1996 bool operator !=(const OdGiMaterialMap &other) const
1997 {
1998 return !(*this == other);
1999 }
2000
2010 OdGiMaterialMap &operator =(const OdGiMaterialMap& mmap)
2011 {
2012 m_source = mmap.m_source;
2013 m_blendFactor = mmap.m_blendFactor;
2014 m_mapper = mmap.m_mapper;
2015 m_texture = mmap.m_texture;
2016 return *this;
2017 }
2018private:
2019 Source m_source;
2020 double m_blendFactor;
2021 OdGiMapper m_mapper;
2022 OdGiMaterialTexturePtr m_texture;
2023};
2024
2025// OdGiMaterialColor inline implementations
2026
2027inline
2029 : m_method(kInherit)
2030 , m_factor(1.0)
2031{
2032}
2033
2034inline
2036 : m_method(kOverride)
2037 , m_factor(1.0)
2038 , m_color(overrideColor)
2039{
2040}
2041
2042inline void
2044{
2045 m_method = method;
2046}
2047
2048inline void
2050{
2051 m_factor = factor;
2052}
2053
2054inline OdCmEntityColor&
2056{
2057 return m_color;
2058}
2059
2062{
2063 return m_method;
2064}
2065
2066inline double
2068{
2069 return m_factor;
2070}
2071
2072inline const OdCmEntityColor&
2074{
2075 return m_color;
2076}
2077
2078inline void
2080{
2081 m_color = color;
2082}
2083
2084// OdGiMaterialMap inline implementations
2085
2086inline
2088 : m_source(kFile)
2089 , m_blendFactor(1.0)
2090{
2091}
2092
2093inline void
2095{
2096 m_blendFactor = blendFactor;
2097}
2098
2099inline OdGiMapper&
2101{
2102 return m_mapper;
2103}
2104
2107{
2108 return m_source;
2109}
2110
2111inline double
2113{
2114 return m_blendFactor;
2115}
2116
2117inline const OdGiMapper&
2119{
2120 return m_mapper;
2121}
2122
2123inline void
2125{
2126 m_mapper = mapper;
2127}
2128
2129inline const OdGiMaterialTexturePtr
2131{
2132 return m_texture;
2133}
2134
2135// OdGiMapper inline implementations
2136
2137inline
2139 : m_projection(mapper.m_projection)
2140 , m_uTiling(mapper.m_uTiling)
2141 , m_vTiling(mapper.m_vTiling)
2142 , m_autoTransform(mapper.m_autoTransform)
2143 , m_transform(mapper.m_transform)
2144{
2145}
2146
2147inline OdGiMapper&
2149{
2150 if (&mapper != this)
2151 {
2152 m_projection = mapper.m_projection;
2153 m_uTiling = mapper.m_uTiling;
2154 m_vTiling = mapper.m_vTiling;
2155 m_autoTransform = mapper.m_autoTransform;
2156 m_transform = mapper.m_transform;
2157 }
2158 return *this;
2159}
2160
2161inline bool
2163{
2164 return m_projection == mapper.m_projection
2165 && m_uTiling == mapper.m_uTiling
2166 && m_vTiling == mapper.m_vTiling
2167 && m_autoTransform == mapper.m_autoTransform
2168 && m_transform == mapper.m_transform;
2169}
2170
2171inline bool
2173{
2174 return !(*this == mapper);
2175}
2176
2177inline void
2179{
2180 m_projection = projection;
2181}
2182
2183inline void
2185{
2186 m_uTiling = tiling;
2187}
2188
2189inline void
2191{
2192 m_vTiling = tiling;
2193}
2194
2195inline void
2197{
2198 m_autoTransform = autoTransform;
2199}
2200
2203{
2204 return m_projection;
2205}
2206
2207inline OdGiMapper::Tiling
2209{
2210 return m_uTiling;
2211}
2212
2213inline OdGiMapper::Tiling
2215{
2216 return m_vTiling;
2217}
2218
2221{
2222 return m_autoTransform;
2223}
2224
2225inline const OdGeMatrix3d&
2227{
2228 return m_transform;
2229}
2230
2231inline OdGeMatrix3d&
2233{
2234 return m_transform;
2235}
2236
2237inline void
2239{
2240 transform() = tm;
2241}
2242
2243// OdGiImageFileTexture inline implementations
2244
2245inline void
2247{
2248 m_sourceFileName = fileName;
2249}
2250
2251inline const OdString
2253{
2254 return m_sourceFileName;
2255}
2256
2257inline bool
2259{
2260 if (!(texture.isA() == isA()))
2261 return false;
2262 const OdGiImageFileTexture &refTexture = static_cast<const OdGiImageFileTexture&>(texture);
2263 return m_sourceFileName == refTexture.m_sourceFileName;
2264}
2265
2266inline OdGiImageFileTexture &
2268{
2269 m_sourceFileName = texture.m_sourceFileName;
2270 return *this;
2271}
2272
2274{
2276 if (!pSrcTex.isNull())
2277 {
2278 setSourceFileName(pSrcTex->sourceFileName());
2279 }
2280 else
2281 {
2282 throw OdError(eNotApplicable);
2283 }
2284}
2285
2286// OdGiRasterImageTexture inline implementations
2287
2288inline void
2290{
2291 m_pRasterImage = reinterpret_cast<const OdRxObject*>(pRasterImage);
2292}
2293
2294inline const OdGiRasterImage *
2296{
2297 return reinterpret_cast<const OdGiRasterImage*>(m_pRasterImage.get());
2298}
2299
2300inline bool
2302{
2303 if (!(texture.isA() == isA()))
2304 return false;
2305 const OdGiRasterImageTexture &refTexture = static_cast<const OdGiRasterImageTexture&>(texture);
2306 return m_pRasterImage.get() == refTexture.m_pRasterImage.get();
2307}
2308
2311{
2312 m_pRasterImage = texture.m_pRasterImage;
2313 return *this;
2314}
2315
2317{
2319 if (!pSrcTex.isNull())
2320 {
2321 setRasterImage(pSrcTex->rasterImage());
2322 }
2323 else
2324 {
2325 throw OdError(eNotApplicable);
2326 }
2327}
2328
2329// OdGiRasterImageFileTexture inline implementations
2330
2331inline void
2333{
2334 if (pRasterImage)
2335 {
2336 if (m_pRasterImage.isNull())
2337 m_pRasterImage = OdGiRasterImageTexture::createObject();
2338 m_pRasterImage->setRasterImage(pRasterImage);
2339 } else
2340 m_pRasterImage.release();
2341}
2342
2343inline const OdGiRasterImage *
2345{
2346 if (m_pRasterImage.isNull())
2347 return NULL;
2348 return m_pRasterImage->rasterImage();
2349}
2350
2351inline void
2353{
2354 m_pRasterImage = pRasterImage;
2355}
2356
2357inline const OdGiRasterImageTexture *
2359{
2360 return m_pRasterImage;
2361}
2362
2363inline bool
2365{
2366 if (!(texture.isA() == isA()))
2367 return false;
2368 const OdGiRasterImageFileTexture &refTexture = static_cast<const OdGiRasterImageFileTexture &>(texture);
2369 return (rasterImage() == refTexture.rasterImage()) && (sourceFileName() == refTexture.sourceFileName());
2370}
2371
2374{
2375 setRasterImage(texture.rasterImage());
2376 setSourceFileName(texture.sourceFileName());
2377 return *this;
2378}
2379
2381{
2383 if (!pSrcTex.isNull())
2384 {
2385 setRasterImage(pSrcTex->rasterImage());
2386 setSourceFileName(pSrcTex->sourceFileName());
2387 }
2388 else
2389 {
2390 throw OdError(eNotApplicable);
2391 }
2392}
2393
2394// OdGiWoodTexture inline implementations
2395
2396inline
2398 : m_radialNoise(0.)
2399 , m_axialNoise(0.)
2400 , m_grainThickness(0.)
2401{
2402}
2403
2404inline void
2406{
2407 m_color1 = woodColor1;
2408}
2409
2410inline const OdGiMaterialColor&
2412{
2413 return m_color1;
2414}
2415
2416inline void
2418{
2419 m_color2 = woodColor2;
2420}
2421
2422inline const OdGiMaterialColor&
2424{
2425 return m_color2;
2426}
2427
2428inline void
2430{
2431 m_radialNoise = radialNoise;
2432}
2433
2434inline double
2436{
2437 return m_radialNoise;
2438}
2439
2440inline void
2442{
2443 m_axialNoise = axialNoise;
2444}
2445
2446inline double
2448{
2449 return m_axialNoise;
2450}
2451
2452inline void
2454{
2455 m_grainThickness = grainThickness;
2456}
2457
2458inline double
2460{
2461 return m_grainThickness;
2462}
2463
2464inline bool
2466{
2467 if (!(texture.isA() == isA()))
2468 return false;
2469 const OdGiWoodTexture &refTexture = static_cast<const OdGiWoodTexture&>(texture);
2470 return (m_color1 == refTexture.m_color1) &&
2471 (m_color2 == refTexture.m_color2) &&
2472 (m_radialNoise == refTexture.m_radialNoise) &&
2473 (m_axialNoise == refTexture.m_axialNoise) &&
2474 (m_grainThickness == refTexture.m_grainThickness);
2475}
2476
2477inline OdGiWoodTexture &
2479{
2480 m_color1 = texture.m_color1;
2481 m_color2 = texture.m_color2;
2482 m_radialNoise = texture.m_radialNoise;
2483 m_axialNoise = texture.m_axialNoise;
2484 m_grainThickness = texture.m_grainThickness;
2485 return *this;
2486}
2487
2488inline void OdGiWoodTexture::copyFrom(const OdRxObject* pSource)
2489{
2490 OdGiWoodTexturePtr pSrcTex = OdGiWoodTexture::cast(pSource);
2491 if (!pSrcTex.isNull())
2492 {
2493 setColor1(pSrcTex->color1());
2494 setColor2(pSrcTex->color2());
2495 setRadialNoise(pSrcTex->radialNoise());
2496 setAxialNoise(pSrcTex->axialNoise());
2497 setGrainThickness(pSrcTex->grainThickness());
2498 }
2499 else
2500 {
2501 throw OdError(eNotApplicable);
2502 }
2503}
2504
2505// OdGiMarbleTexture inline implementations
2506
2507inline
2509 : m_veinSpacing(0.)
2510 , m_veinWidth(0.)
2511{
2512}
2513
2514inline void
2516{
2517 m_stoneColor = stoneColor;
2518}
2519
2520inline const OdGiMaterialColor&
2522{
2523 return m_stoneColor;
2524}
2525
2526inline void
2528{
2529 m_veinColor = veinColor;
2530}
2531
2532inline const OdGiMaterialColor&
2534{
2535 return m_veinColor;
2536}
2537
2538inline void
2540{
2541 m_veinSpacing = veinSpacing;
2542}
2543
2544inline double
2546{
2547 return m_veinSpacing;
2548}
2549
2550inline void
2552{
2553 m_veinWidth = veinWidth;
2554}
2555
2556inline double
2558{
2559 return m_veinWidth;
2560}
2561
2562inline bool
2564{
2565 if (!(texture.isA() == isA()))
2566 return false;
2567 const OdGiMarbleTexture &refTexture = static_cast<const OdGiMarbleTexture&>(texture);
2568 return (m_stoneColor == refTexture.m_stoneColor) &&
2569 (m_veinColor == refTexture.m_veinColor) &&
2570 (m_veinSpacing == refTexture.m_veinSpacing) &&
2571 (m_veinWidth == refTexture.m_veinWidth);
2572}
2573
2574inline OdGiMarbleTexture &
2576{
2577 m_stoneColor = texture.m_stoneColor;
2578 m_veinColor = texture.m_veinColor;
2579 m_veinSpacing = texture.m_veinSpacing;
2580 m_veinWidth = texture.m_veinWidth;
2581 return *this;
2582}
2583
2584inline void OdGiMarbleTexture::copyFrom(const OdRxObject* pSource)
2585{
2587 if (!pSrcTex.isNull())
2588 {
2589 setStoneColor(pSrcTex->stoneColor());
2590 setVeinColor(pSrcTex->veinColor());
2591 setVeinSpacing(pSrcTex->veinSpacing());
2592 setVeinWidth(pSrcTex->veinWidth());
2593 }
2594 else
2595 {
2596 throw OdError(eNotApplicable);
2597 }
2598}
2599
2600// OdGiGenericTexture inline implementations
2601
2602inline
2604{
2605}
2606
2607inline void
2609{
2610 if (m_definition.isNull())
2611 {
2612 m_definition = OdGiVariant::createObject(definition);
2613 }
2614 else
2615 {
2616 *m_definition = definition;
2617 }
2618}
2619
2620inline OdGiVariantPtr
2622{
2623 return m_definition;
2624}
2625
2626inline void
2628{
2629 if (m_definition.isNull())
2630 {
2631 pDefinition = OdGiVariant::createObject();
2632 }
2633 else
2634 {
2635 pDefinition = OdGiVariant::createObject(*m_definition);
2636 }
2637}
2638
2639inline bool
2641{
2642 if (!(texture.isA() == isA()))
2643 return false;
2644 const OdGiGenericTexture &refTexture = static_cast<const OdGiGenericTexture&>(texture);
2645 if (m_definition.isNull() && refTexture.m_definition.isNull())
2646 return true;
2647 if (!m_definition.isNull() && !refTexture.m_definition.isNull())
2648 return (*m_definition == *(refTexture.m_definition));
2649 return false;
2650}
2651
2652inline OdGiGenericTexture &
2654{
2655 if (!texture.m_definition.isNull())
2656 m_definition = OdGiVariant::createObject(*(texture.m_definition));
2657 else
2658 m_definition.release();
2659 return *this;
2660}
2661
2662inline void OdGiGenericTexture::copyFrom(const OdRxObject* pSource)
2663{
2665 if (!pSrcTex.isNull())
2666 {
2667 setDefinition(*(pSrcTex->definition()));
2668 }
2669 else
2670 {
2671 throw OdError(eNotApplicable);
2672 }
2673}
2674
2675#include "TD_PackPop.h"
2676
2677#endif //#ifndef __ODGIMATERIAL_H__
tm
Definition: DimVarDefs.h:2122
scale
Definition: DimVarDefs.h:1684
#define ODGI_EXPORT
Definition: GiExport.h:35
#define ODGI_EXPORT_STATIC
Definition: GiExport.h:36
OdSmartPtr< OdGiWoodTexture > OdGiWoodTexturePtr
Definition: GiMaterial.h:1289
OdSmartPtr< OdGiImageFileTexture > OdGiImageFileTexturePtr
Definition: GiMaterial.h:967
OdSmartPtr< OdGiRasterImageFileTexture > OdGiRasterImageFileTexturePtr
Definition: GiMaterial.h:1109
OdSmartPtr< OdGiRasterImageTexture > OdGiRasterImageTexturePtr
Definition: GiMaterial.h:1031
OdSmartPtr< OdGiMaterialTexture > OdGiMaterialTexturePtr
Definition: GiMaterial.h:879
OdSmartPtr< OdGiMaterialTraits > OdGiMaterialTraitsPtr
Definition: GiMaterial.h:698
OdSmartPtr< OdGiImageTexture > OdGiImageTexturePtr
Definition: GiMaterial.h:900
OdSmartPtr< OdGiMarbleTexture > OdGiMarbleTexturePtr
Definition: GiMaterial.h:1419
OdSmartPtr< OdGiProceduralTexture > OdGiProceduralTexturePtr
Definition: GiMaterial.h:1145
OdSmartPtr< OdGiGenericTexture > OdGiGenericTexturePtr
Definition: GiMaterial.h:1501
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
#define ODRX_ABSTRACT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
bool isNull() const
Definition: BaseObjectPtr.h:86
virtual OdGiVariantPtr definition() const
Definition: GiMaterial.h:2621
ODRX_DECLARE_MEMBERS(OdGiGenericTexture)
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2662
virtual void setDefinition(const OdGiVariant &definition)
Definition: GiMaterial.h:2608
virtual Type type() const
Definition: GiMaterial.h:1441
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2640
OdGiGenericTexture & operator=(const OdGiGenericTexture &texture)
Definition: GiMaterial.h:2653
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2258
virtual void setSourceFileName(const OdString &fileName)
Definition: GiMaterial.h:2246
ODRX_DECLARE_MEMBERS(OdGiImageFileTexture)
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2273
OdGiImageFileTexture & operator=(const OdGiImageFileTexture &texture)
Definition: GiMaterial.h:2267
virtual const OdString sourceFileName() const
Definition: GiMaterial.h:2252
ODRX_DECLARE_MEMBERS(OdGiImageTexture)
void setProjection(Projection projection)
Definition: GiMaterial.h:2178
Tiling vTiling() const
Definition: GiMaterial.h:2214
OdGiMapper & operator=(const OdGiMapper &mapper)
Definition: GiMaterial.h:2148
static ODGI_EXPORT_STATIC const OdGiMapper kIdentity
Definition: GiMaterial.h:1576
AutoTransform autoTransform() const
Definition: GiMaterial.h:2220
Projection projection() const
Definition: GiMaterial.h:2202
void setVTiling(Tiling tiling)
Definition: GiMaterial.h:2190
bool operator!=(const OdGiMapper &mapper) const
Definition: GiMaterial.h:2172
void setAutoTransform(AutoTransform autoTransform)
Definition: GiMaterial.h:2196
OdGeMatrix3d & transform()
Definition: GiMaterial.h:2232
Tiling uTiling() const
Definition: GiMaterial.h:2208
void setTransform(const OdGeMatrix3d &tm)
Definition: GiMaterial.h:2238
void setUTiling(Tiling tiling)
Definition: GiMaterial.h:2184
bool operator==(const OdGiMapper &mapper) const
Definition: GiMaterial.h:2162
OdGiMarbleTexture & operator=(const OdGiMarbleTexture &texture)
Definition: GiMaterial.h:2575
virtual void setStoneColor(const OdGiMaterialColor &stoneColor)
Definition: GiMaterial.h:2515
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2563
virtual double veinWidth(void) const
Definition: GiMaterial.h:2557
virtual double veinSpacing(void) const
Definition: GiMaterial.h:2545
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2584
virtual const OdGiMaterialColor & veinColor(void) const
Definition: GiMaterial.h:2533
virtual Type type() const
Definition: GiMaterial.h:1311
virtual const OdGiMaterialColor & stoneColor(void) const
Definition: GiMaterial.h:2521
virtual void setVeinSpacing(double veinSpacing)
Definition: GiMaterial.h:2539
ODRX_DECLARE_MEMBERS(OdGiMarbleTexture)
virtual void setVeinColor(const OdGiMaterialColor &veinColor)
Definition: GiMaterial.h:2527
virtual void setVeinWidth(double veinWidth)
Definition: GiMaterial.h:2551
void setFactor(double factor)
Definition: GiMaterial.h:2049
OdCmEntityColor & color()
Definition: GiMaterial.h:2055
double factor() const
Definition: GiMaterial.h:2067
Method method() const
Definition: GiMaterial.h:2061
static ODGI_EXPORT_STATIC const OdGiMaterialColor kNull
Definition: GiMaterial.h:723
void setColor(const OdCmEntityColor &color)
Definition: GiMaterial.h:2079
void setMethod(Method method)
Definition: GiMaterial.h:2043
void setMapper(const OdGiMapper &mapper)
Definition: GiMaterial.h:2124
void setSourceFileName(const OdString &filename)
OdGiMapper & mapper()
Definition: GiMaterial.h:2100
void setTexture(OdGiMaterialTexturePtr pTexture)
const OdGiMaterialTexturePtr texture(void) const
Definition: GiMaterial.h:2130
OdString sourceFileName() const
Source source() const
Definition: GiMaterial.h:2106
static ODGI_EXPORT_STATIC const OdGiMaterialMap kNull
Definition: GiMaterial.h:1839
void setSource(Source source)
double blendFactor() const
Definition: GiMaterial.h:2112
void setBlendFactor(double blendFactor)
Definition: GiMaterial.h:2094
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:872
ODRX_DECLARE_MEMBERS(OdGiMaterialTexture)
virtual double luminance() const =0
virtual void setSpecularHighlightingOverride(double overrideVal)=0
virtual void setChannelFlags(ChannelFlags flags)=0
virtual void reflection(OdGiMaterialMap &reflectionMap) const =0
virtual void setShadingDiffuse(const OdGiMaterialColor &diffuseColor)=0
virtual double reflectanceScale() const =0
virtual ChannelFlags channelFlags() const =0
virtual void opacity(double &opacityPercentage, OdGiMaterialMap &opacityMap) const =0
virtual void bump(OdGiMaterialMap &bumpMap) const =0
virtual void diffuse(OdGiMaterialColor &diffuseColor, OdGiMaterialMap &diffuseMap) const =0
virtual void setTranslucence(double value)=0
virtual double transmittanceScale() const =0
virtual void setLuminance(double value)=0
virtual void setReflection(const OdGiMaterialMap &reflectionMap)=0
virtual double colorBleedScale() const =0
virtual void setFinalGather(FinalGatherMode mode)=0
virtual void setIndirectBumpScale(double scale)=0
virtual void setBump(const OdGiMaterialMap &bumpMap)=0
virtual void setColorBleedScale(double scale)=0
virtual void setIlluminationModel(IlluminationModel model)=0
virtual void shadingAmbient(OdGiMaterialColor &ambientColor) const =0
virtual double shadowsOpacityEffect(double &nonShadowLightsMergeEffect) const =0
ODRX_DECLARE_MEMBERS(OdGiMaterialTraits)
virtual FinalGatherMode finalGather() const =0
virtual void setNormalMap(const OdGiMaterialMap &normalMap, NormalMapMethod method, double strength)=0
virtual double indirectBumpScale() const =0
virtual void setDiffuseColorMode(DiffuseColorMode diffuseColorMode)=0
virtual void setReflectivity(double value)=0
virtual LuminanceMode luminanceMode() const =0
virtual bool twoSided() const =0
virtual void setShadowsOpacityEffect(double effectPercentage, double nonShadowLightsMergeEffect=1.0)=0
virtual void setRefraction(double refractionIndex, const OdGiMaterialMap &refractionMap)=0
virtual void shadingOpacity(double &opacityPercentage) const =0
virtual void tint(OdGiMaterialColor &tintColor) const =0
virtual void setMode(Mode value)=0
virtual void setShadingOpacity(double opacityPercentage)=0
virtual void setTwoSided(bool flag)=0
virtual GlobalIlluminationMode globalIllumination() const =0
virtual void shadingSpecular(OdGiMaterialColor &specularColor) const =0
virtual void setShadingSpecular(const OdGiMaterialColor &specularColor)=0
virtual void ambient(OdGiMaterialColor &ambientColor) const =0
virtual DiffuseColorMode diffuseColorMode() const =0
virtual void setTint(const OdGiMaterialColor &tintColor)=0
virtual void setOpacity(double opacityPercentage, const OdGiMaterialMap &opacityMap)=0
virtual void setLuminanceMode(LuminanceMode mode)=0
virtual void emission(OdGiMaterialColor &emissionColor, OdGiMaterialMap &emissionMap) const =0
virtual void setSelfIllumination(double value)=0
virtual void refraction(double &refractionIndex, OdGiMaterialMap &refractionMap) const =0
virtual double selfIllumination() const =0
virtual void setEmission(const OdGiMaterialColor &emissionColor, const OdGiMaterialMap &emissionMap)=0
virtual void setTransmittanceScale(double scale)=0
virtual double specularHighlightingOverride() const =0
virtual void setSpecular(const OdGiMaterialColor &specularColor, const OdGiMaterialMap &specularMap, double glossFactor)=0
virtual void setAmbient(const OdGiMaterialColor &ambientColor)=0
virtual void setDiffuse(const OdGiMaterialColor &diffuseColor, const OdGiMaterialMap &diffuseMap)=0
virtual void setShadingAmbient(const OdGiMaterialColor &ambientColor)=0
virtual void setGlobalIllumination(GlobalIlluminationMode mode)=0
virtual Mode mode() const =0
virtual void normalMap(OdGiMaterialMap &normalMap, NormalMapMethod &method, double &strength) const =0
virtual double reflectivity() const =0
virtual IlluminationModel illuminationModel() const =0
virtual void shadingDiffuse(OdGiMaterialColor &diffuseColor) const =0
virtual void specular(OdGiMaterialColor &specularColor, OdGiMaterialMap &specularMap, double &glossFactor) const =0
virtual void setReflectanceScale(double scale)=0
virtual double translucence() const =0
virtual Type type() const =0
ODRX_DECLARE_MEMBERS(OdGiProceduralTexture)
OdGiRasterImageFileTexture & operator=(const OdGiRasterImageFileTexture &texture)
Definition: GiMaterial.h:2373
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2380
virtual const OdGiRasterImage * rasterImage() const
Definition: GiMaterial.h:2344
virtual void setRasterImage(const OdGiRasterImage *pRasterImage)
Definition: GiMaterial.h:2332
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2364
virtual void setRasterImageTexture(const OdGiRasterImageTexture *pRasterImage)
Definition: GiMaterial.h:2352
virtual const OdGiRasterImageTexture * rasterImageTexture() const
Definition: GiMaterial.h:2358
ODRX_DECLARE_MEMBERS(OdGiRasterImageFileTexture)
virtual const OdGiRasterImage * rasterImage() const
Definition: GiMaterial.h:2295
OdGiRasterImageTexture & operator=(const OdGiRasterImageTexture &texture)
Definition: GiMaterial.h:2310
ODRX_DECLARE_MEMBERS(OdGiRasterImageTexture)
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2301
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2316
virtual void setRasterImage(const OdGiRasterImage *pRasterImage)
Definition: GiMaterial.h:2289
static OdSmartPtr< OdGiVariant > createObject(const OdGiVariant &value)
virtual void setGrainThickness(double grainThickness)
Definition: GiMaterial.h:2453
virtual void setRadialNoise(double radialNoise)
Definition: GiMaterial.h:2429
virtual const OdGiMaterialColor & color2(void) const
Definition: GiMaterial.h:2423
virtual const OdGiMaterialColor & color1(void) const
Definition: GiMaterial.h:2411
OdGiWoodTexture & operator=(const OdGiWoodTexture &texture)
Definition: GiMaterial.h:2478
virtual double grainThickness(void) const
Definition: GiMaterial.h:2459
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2488
virtual void setColor2(const OdGiMaterialColor &woodColor2)
Definition: GiMaterial.h:2417
virtual Type type() const
Definition: GiMaterial.h:1167
virtual void setAxialNoise(double axialNoise)
Definition: GiMaterial.h:2441
ODRX_DECLARE_MEMBERS(OdGiWoodTexture)
virtual double axialNoise(void) const
Definition: GiMaterial.h:2447
virtual double radialNoise(void) const
Definition: GiMaterial.h:2435
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2465
virtual void setColor1(const OdGiMaterialColor &woodColor1)
Definition: GiMaterial.h:2405
virtual void copyFrom(const OdRxObject *pSource)
virtual OdRxClass * isA() const
static OdRxObjectPtr cast(const OdRxObject *pointer)
Definition: RxObject.h:640
OdRxObject * get()
Definition: RxObject.h:503
void release()
Definition: SmartPtr.h:269
GLsizei GLsizei GLchar * source
Definition: gles2_ext.h:282
GLenum GLenum GLuint texture
Definition: gles2_ext.h:501
GLsizei const GLfloat * value
Definition: gles2_ext.h:302