CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GiMaterial.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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
63
100
104 enum Mode
105 {
110 };
111
112 // Returned via subSetAttributes()
113 enum
114 {
115 kByBlock = (OdGiDrawable::kLastFlag << 1), // "ByBlock" material.
116 kByLayer = (OdGiDrawable::kLastFlag << 2) // "ByLayer" material.
117 };
118
119 // Extended material traits enumerations
120
133
144
159
174
175 // BIM extensions
188
199
208 virtual void ambient(OdGiMaterialColor& ambientColor) const = 0;
209
219 virtual void diffuse(OdGiMaterialColor& diffuseColor, OdGiMaterialMap& diffuseMap) const = 0;
220
231 virtual void specular(OdGiMaterialColor& specularColor, OdGiMaterialMap& specularMap, double& glossFactor) const = 0;
232
241 virtual void reflection(OdGiMaterialMap& reflectionMap) const = 0;
242
249 virtual void opacity(double& opacityPercentage, OdGiMaterialMap& opacityMap) const = 0;
250
256 virtual void bump(OdGiMaterialMap& bumpMap) const = 0;
257
264 virtual void refraction(double& refractionIndex, OdGiMaterialMap& refractionMap) const = 0;
265
272 virtual double translucence() const = 0;
273
280 virtual double selfIllumination() const = 0;
281
288 virtual double reflectivity() const = 0;
289
297
304 virtual ChannelFlags channelFlags() const = 0;
305
312 virtual Mode mode() const = 0;
313
322 virtual void setAmbient(const OdGiMaterialColor& ambientColor) = 0;
323
333 virtual void setDiffuse(const OdGiMaterialColor& diffuseColor, const OdGiMaterialMap& diffuseMap) = 0;
334
345 virtual void setSpecular(const OdGiMaterialColor& specularColor, const OdGiMaterialMap& specularMap, double glossFactor) = 0;
346
355 virtual void setReflection(const OdGiMaterialMap& reflectionMap) = 0;
356
363 virtual void setOpacity(double opacityPercentage, const OdGiMaterialMap& opacityMap) = 0;
364
370 virtual void setBump(const OdGiMaterialMap& bumpMap) = 0;
371
378 virtual void setRefraction(double refractionIndex, const OdGiMaterialMap& refractionMap) = 0;
379
385 virtual void setTranslucence(double value) = 0;
386
392 virtual void setSelfIllumination(double value) = 0;
393
399 virtual void setReflectivity(double value) = 0;
400
407
413 virtual void setChannelFlags(ChannelFlags flags) = 0;
414
420 virtual void setMode(Mode value) = 0;
421
422 // Extended material properties
423
429 virtual void setColorBleedScale(double scale) = 0;
430
437 virtual double colorBleedScale() const = 0;
438
444 virtual void setIndirectBumpScale(double scale) = 0;
445
452 virtual double indirectBumpScale() const = 0;
453
459 virtual void setReflectanceScale(double scale) = 0;
460
467 virtual double reflectanceScale() const = 0;
468
474 virtual void setTransmittanceScale(double scale) = 0;
475
482 virtual double transmittanceScale() const = 0;
483
489 virtual void setTwoSided(bool flag) = 0;
490
494 virtual bool twoSided() const = 0;
495
502
509 virtual LuminanceMode luminanceMode() const = 0;
510
516 virtual void setLuminance(double value) = 0;
517
524 virtual double luminance() const = 0;
525
533 virtual void setNormalMap(const OdGiMaterialMap &normalMap, NormalMapMethod method, double strength) = 0;
534
542 virtual void normalMap(OdGiMaterialMap &normalMap, NormalMapMethod &method, double &strength) const = 0;
543
550
558
565
572 virtual FinalGatherMode finalGather() const = 0;
573
574 // BIM extensions
575
582 virtual void setEmission(const OdGiMaterialColor& emissionColor, const OdGiMaterialMap& emissionMap) = 0;
583
590 virtual void emission(OdGiMaterialColor& emissionColor, OdGiMaterialMap& emissionMap) const = 0;
591
597 virtual void setTint(const OdGiMaterialColor& tintColor) = 0;
598
604 virtual void tint(OdGiMaterialColor& tintColor) const = 0;
605
611 virtual void setShadingAmbient(const OdGiMaterialColor& ambientColor) = 0;
612
618 virtual void shadingAmbient(OdGiMaterialColor& ambientColor) const = 0;
619
625 virtual void setShadingDiffuse(const OdGiMaterialColor& diffuseColor) = 0;
626
632 virtual void shadingDiffuse(OdGiMaterialColor& diffuseColor) const = 0;
633
639 virtual void setShadingSpecular(const OdGiMaterialColor& specularColor) = 0;
640
646 virtual void shadingSpecular(OdGiMaterialColor& specularColor) const = 0;
647
653 virtual void setShadingOpacity(double opacityPercentage) = 0;
654
660 virtual void shadingOpacity(double &opacityPercentage) const = 0;
661
668
675
676 // Visualize extensions
677
684 virtual void setShadowsOpacityEffect(double effectPercentage, double nonShadowLightsMergeEffect = 1.0) = 0;
685
692 virtual double shadowsOpacityEffect(double &nonShadowLightsMergeEffect) const = 0;
693
704 virtual void setSpecularHighlightingOverride(double overrideVal) = 0;
705
714 virtual double specularHighlightingOverride() const = 0;
715
722 virtual void setRoughness(const OdGiMaterialMap& roughnessMap, double strength) = 0;
723
730 virtual void roughness(OdGiMaterialMap& roughnessMap, double &strength) const = 0;
731
737 virtual void setCutouts(const OdGiMaterialMap& cutoutsMap) = 0;
738
744 virtual void cutouts(OdGiMaterialMap& cutoutsMap) const = 0;
745
751 virtual void setReflectionMethod(ReflectionMethod method) = 0;
752
760};
761
766
767
777{
778public:
783 {
790 };
791
794
799
805 OdGiMaterialColor(const OdCmEntityColor &overrideColor);
806
822 void setMethod(Method method);
823
832 void setFactor(double factor);
833
841
855 Method method() const;
856
866 double factor() const;
867
874 const OdCmEntityColor& color() const;
875
888 bool operator ==(const OdGiMaterialColor &other) const
889 {
890 return (m_method == other.m_method) &&
891 (m_factor == other.m_factor) &&
892 (m_color == other.m_color);
893 }
894
907 bool operator != (const OdGiMaterialColor &other) const
908 {
909 return (m_method != other.m_method) ||
910 (m_factor != other.m_factor) ||
911 (m_color != other.m_color);
912 }
913
918 void setColor(const OdCmEntityColor &color);
919
924 void setBlendFactor(double factor);
925
931 double blendFactor() const;
932private:
933 Method m_method;
934 double m_factor;
935 OdCmEntityColor m_color;
936};
937
938
947{
948public:
950
958 virtual bool operator==(const OdGiMaterialTexture & texture)const;
959protected:
962};
963
965 return (texture.isA() == isA());
966}
967
972
988
993
1002{
1003public:
1005
1011 virtual void setSourceFileName(const OdString& fileName);
1012
1018 virtual const OdString sourceFileName() const;
1019
1031 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1032
1043
1044 // OdRxObject overrides
1045
1051 void copyFrom(const OdRxObject* pSource);
1052private:
1053 OdString m_sourceFileName;
1054};
1055
1060
1069{
1070public:
1077 virtual void setRasterImage(const OdGiRasterImage *pRasterImage);
1078
1084 virtual const OdGiRasterImage *rasterImage() const;
1085
1097 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1098
1109
1115 void copyFrom(const OdRxObject* pSource);
1116private:
1117 OdRxObjectPtr m_pRasterImage;
1118};
1119
1124
1133{
1134public:
1141 virtual void setRasterImage(const OdGiRasterImage *pRasterImage);
1142
1148 virtual const OdGiRasterImage *rasterImage() const;
1149
1155 virtual void setRasterImageTexture(const OdGiRasterImageTexture *pRasterImage);
1156
1162 virtual const OdGiRasterImageTexture *rasterImageTexture() const;
1163
1175 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1176
1187
1193 void copyFrom(const OdRxObject* pSource);
1194private:
1195 OdGiRasterImageTexturePtr m_pRasterImage;
1196};
1197
1202
1209{
1210public:
1212
1216 enum Type
1217 {
1218 kWood = 0, // Wood texture.
1219 kMarble = 1, // Marble texture.
1220 kGeneric = 2 // Generic texture.
1221 };
1222
1228 virtual Type type() const = 0;
1229protected:
1232};
1233
1238
1245{
1246public:
1248
1253
1259 virtual Type type() const {return kWood;}
1260
1261 // wood properties
1262
1268 virtual void setColor1(const OdGiMaterialColor &woodColor1);
1269
1275 virtual const OdGiMaterialColor& color1(void) const;
1276
1282 virtual void setColor2(const OdGiMaterialColor &woodColor2);
1283
1289 virtual const OdGiMaterialColor& color2(void) const;
1290
1296 virtual void setRadialNoise(double radialNoise);
1297
1303 virtual double radialNoise(void) const;
1304
1310 virtual void setAxialNoise(double axialNoise);
1311
1317 virtual double axialNoise(void) const;
1318
1324 virtual void setGrainThickness(double grainThickness);
1325
1331 virtual double grainThickness(void) const;
1332
1348 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1349
1360 OdGiWoodTexture &operator =(const OdGiWoodTexture &texture);
1361
1362 // OdRxObject overrides
1363
1369 void copyFrom(const OdRxObject* pSource);
1370private:
1371 OdGiMaterialColor m_color1;
1372 OdGiMaterialColor m_color2;
1373 double m_radialNoise;
1374 double m_axialNoise;
1375 double m_grainThickness;
1376};
1377
1382
1389{
1390public:
1392
1397
1403 virtual Type type() const {return kMarble;}
1404
1410 virtual void setStoneColor(const OdGiMaterialColor &stoneColor);
1411
1418 virtual const OdGiMaterialColor& stoneColor(void) const;
1419
1425 virtual void setVeinColor(const OdGiMaterialColor &veinColor);
1426
1433 virtual const OdGiMaterialColor& veinColor(void) const;
1434
1440 virtual void setVeinSpacing(double veinSpacing);
1441
1448 virtual double veinSpacing(void) const;
1449
1455 virtual void setVeinWidth(double veinWidth);
1456
1463 virtual double veinWidth(void) const;
1464
1479 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1480
1491 OdGiMarbleTexture &operator =(const OdGiMarbleTexture &texture);
1492
1493 // OdRxObject overrides
1494
1500 void copyFrom(const OdRxObject* pSource);
1501private:
1502 OdGiMaterialColor m_stoneColor;
1503 OdGiMaterialColor m_veinColor;
1504 double m_veinSpacing;
1505 double m_veinWidth;
1506};
1507
1512
1519{
1520public:
1522
1527
1533 virtual Type type() const {return kGeneric;}
1534
1540 virtual void setDefinition(const OdGiVariant &definition);
1541
1547 virtual OdGiVariantPtr definition() const;
1548
1554 virtual void definition(OdGiVariantPtr &pDefinition) const;
1555
1567 virtual bool operator==(const OdGiMaterialTexture & texture) const;
1568
1576 OdGiGenericTexture &operator =(const OdGiGenericTexture &texture);
1577
1578 // OdRxObject overrides
1579
1585 void copyFrom(const OdRxObject* pSource);
1586private:
1587 OdGiVariantPtr m_definition;
1588};
1589
1594
1601{
1602public:
1604
1609
1614
1621
1628 OdUInt8 softness() const { return m_softness; }
1629
1640 virtual bool operator==(const OdGiMaterialTexture &texture) const
1642 (static_cast<const OdGiSceneTexture&>(texture).softness() == softness()); }
1643
1653 {
1654 setSoftness(texture.softness());
1655 return *this;
1656 }
1657
1658 // OdRxObject overrides
1659
1665 void copyFrom(const OdRxObject* pSource)
1666 {
1668 if (!pSrcTex.isNull())
1669 setSoftness(pSrcTex->softness());
1670 else
1671 throw OdError(eNotApplicable);
1672 }
1673protected:
1675};
1676
1681
1682
1694{
1695public:
1722
1727 {
1738 };
1739
1744 {
1748 kNone = 0x1,
1750 kObject = 0x2,
1752 kModel = 0x4,
1753
1756 };
1757
1760
1766 : m_projection(kPlanar)
1767 , m_uTiling(kTile)
1768 , m_vTiling(kTile)
1769 , m_autoTransform(kNone)
1770 {
1771 }
1772
1778 OdGiMapper(const OdGiMapper& mapper) = default;
1779
1788 OdGiMapper& operator=(const OdGiMapper& mapper) = default;
1789
1803 bool operator==(const OdGiMapper& mapper) const;
1804
1818 bool operator!=(const OdGiMapper& mapper) const;
1819
1838
1856 void setUTiling(Tiling tiling);
1857
1875 void setVTiling(Tiling tiling);
1876
1894
1905
1921 Projection projection() const;
1922
1938 Tiling uTiling() const;
1939
1955 Tiling vTiling() const;
1956
1972
1978 const OdGeMatrix3d& transform() const;
1979
1985 void setTransform(const OdGeMatrix3d &tm);
1986
1987private:
1988 Projection m_projection;
1989 Tiling m_uTiling;
1990 Tiling m_vTiling;
1991 AutoTransform m_autoTransform;
1992 OdGeMatrix3d m_transform;
1993};
1994
1995
2006{
2007public:
2008
2013 {
2020 };
2021
2024
2030
2047
2052 void setSourceFileName(const OdString& filename);
2053
2063 void setBlendFactor(double blendFactor);
2064
2073 void setBrightness(double brightness);
2074
2080 void setInverted(bool bInvert);
2081
2087 void setInvertedBrightness(bool bInvert);
2088
2095
2105 OdGiMapper& mapper();
2106
2120 Source source() const;
2121
2129
2140 double blendFactor() const;
2141
2151 double brightness() const;
2152
2159 bool isInverted() const;
2160
2167 bool isInvertedBrightness() const;
2168
2174 const OdGiMapper& mapper() const;
2175
2181 void setMapper(const OdGiMapper &mapper);
2182
2189 const OdGiMaterialTexturePtr texture(void) const;
2190
2206 bool operator ==(const OdGiMaterialMap &other) const
2207 {
2208 if ((m_source == other.m_source) &&
2209 (m_flags == other.m_flags) &&
2210 (m_blendFactor == other.m_blendFactor) &&
2211 (m_brightness == other.m_brightness) &&
2212 (m_mapper == other.m_mapper))
2213 {
2214 if (m_texture.isNull() && other.m_texture.isNull())
2215 return true;
2216 if (!m_texture.isNull() && !other.m_texture.isNull())
2217 return (*m_texture == *(other.m_texture));
2218 }
2219 return false;
2220 }
2221
2237 bool operator !=(const OdGiMaterialMap &other) const
2238 {
2239 return !(*this == other);
2240 }
2241
2251 OdGiMaterialMap &operator =(const OdGiMaterialMap& mmap)
2252 {
2253 m_source = mmap.m_source;
2254 m_flags = mmap.m_flags;
2255 m_blendFactor = mmap.m_blendFactor;
2256 m_brightness = mmap.m_brightness;
2257 m_mapper = mmap.m_mapper;
2258 m_texture = mmap.m_texture;
2259 return *this;
2260 }
2261private:
2262 enum Flags
2263 {
2264 kInvertImage = (1 << 0),
2265 kInvertBrightness = (1 << 1)
2266 };
2267private:
2268 Source m_source;
2269 OdUInt32 m_flags;
2270 double m_blendFactor;
2271 double m_brightness;
2272 OdGiMapper m_mapper;
2273 OdGiMaterialTexturePtr m_texture;
2274};
2275
2276// OdGiMaterialColor inline implementations
2277
2278inline
2280 : m_method(kInherit)
2281 , m_factor(1.0)
2282{
2283}
2284
2285inline
2287 : m_method(kOverride)
2288 , m_factor(1.0)
2289 , m_color(overrideColor)
2290{
2291}
2292
2293inline void
2295{
2296 m_method = method;
2297}
2298
2299inline void
2301{
2302 m_factor = factor;
2303}
2304
2305inline OdCmEntityColor&
2307{
2308 return m_color;
2309}
2310
2313{
2314 return m_method;
2315}
2316
2317inline double
2319{
2320 return m_factor;
2321}
2322
2323inline const OdCmEntityColor&
2325{
2326 return m_color;
2327}
2328
2329inline void
2331{
2332 m_color = color;
2333}
2334
2335inline void
2337{
2338 if (OdLessOrEqual(factor, 0.0))
2339 m_method = kInherit, m_factor = 0.0;
2340 else if (OdGreaterOrEqual(factor, 1.0f))
2341 m_method = kOverride, m_factor = 1.0;
2342 else
2343 m_method = kBlend, m_factor = factor;
2344}
2345
2346inline double
2348{
2349 switch (m_method)
2350 {
2351 case kInherit: return 0.0;
2352 case kOverride: return 1.0;
2353 default: return m_factor;
2354 }
2355}
2356
2357// OdGiMaterialMap inline implementations
2358
2359inline
2361 : m_source(kFile)
2362 , m_flags(0)
2363 , m_blendFactor(1.0)
2364 , m_brightness(1.0)
2365{
2366}
2367
2368inline void
2370{
2371 m_blendFactor = blendFactor;
2372}
2373
2374inline void
2376{
2377 m_brightness = brightness;
2378}
2379
2380inline void
2382{
2383 SETBIT(m_flags, kInvertImage, bInvert);
2384}
2385
2386inline void
2388{
2389 SETBIT(m_flags, kInvertBrightness, bInvert);
2390}
2391
2392inline OdGiMapper&
2394{
2395 return m_mapper;
2396}
2397
2400{
2401 return m_source;
2402}
2403
2404inline double
2406{
2407 return m_blendFactor;
2408}
2409
2410inline double
2412{
2413 return m_brightness;
2414}
2415
2416inline bool
2418{
2419 return GETBIT(m_flags, kInvertImage);
2420}
2421
2422inline bool
2424{
2425 return GETBIT(m_flags, kInvertBrightness);
2426}
2427
2428inline const OdGiMapper&
2430{
2431 return m_mapper;
2432}
2433
2434inline void
2436{
2437 m_mapper = mapper;
2438}
2439
2440inline const OdGiMaterialTexturePtr
2442{
2443 return m_texture;
2444}
2445
2446// OdGiMapper inline implementations
2447
2448inline bool
2450{
2451 return m_projection == mapper.m_projection
2452 && m_uTiling == mapper.m_uTiling
2453 && m_vTiling == mapper.m_vTiling
2454 && m_autoTransform == mapper.m_autoTransform
2455 && m_transform == mapper.m_transform;
2456}
2457
2458inline bool
2460{
2461 return !(*this == mapper);
2462}
2463
2464inline void
2469
2470inline void
2472{
2473 m_uTiling = tiling;
2474}
2475
2476inline void
2478{
2479 m_vTiling = tiling;
2480}
2481
2482inline void
2487
2490{
2491 return m_projection;
2492}
2493
2494inline OdGiMapper::Tiling
2496{
2497 return m_uTiling;
2498}
2499
2500inline OdGiMapper::Tiling
2502{
2503 return m_vTiling;
2504}
2505
2508{
2509 return m_autoTransform;
2510}
2511
2512inline const OdGeMatrix3d&
2514{
2515 return m_transform;
2516}
2517
2518inline OdGeMatrix3d&
2520{
2521 return m_transform;
2522}
2523
2524inline void
2529
2530// OdGiImageFileTexture inline implementations
2531
2532inline void
2534{
2535 m_sourceFileName = fileName;
2536}
2537
2538inline const OdString
2540{
2541 return m_sourceFileName;
2542}
2543
2544inline bool
2546{
2547 if (!(texture.isA() == isA()))
2548 return false;
2549 const OdGiImageFileTexture &refTexture = static_cast<const OdGiImageFileTexture&>(texture);
2550 return m_sourceFileName == refTexture.m_sourceFileName;
2551}
2552
2553inline OdGiImageFileTexture &
2555{
2556 m_sourceFileName = texture.m_sourceFileName;
2557 return *this;
2558}
2559
2560inline void OdGiImageFileTexture::copyFrom(const OdRxObject* pSource)
2561{
2563 if (!pSrcTex.isNull())
2564 {
2566 }
2567 else
2568 {
2569 throw OdError(eNotApplicable);
2570 }
2571}
2572
2573// OdGiRasterImageTexture inline implementations
2574
2575inline void
2577{
2578 m_pRasterImage = reinterpret_cast<const OdRxObject*>(pRasterImage);
2579}
2580
2581inline const OdGiRasterImage *
2583{
2584 return reinterpret_cast<const OdGiRasterImage*>(m_pRasterImage.get());
2585}
2586
2587inline bool
2589{
2590 if (!(texture.isA() == isA()))
2591 return false;
2592 const OdGiRasterImageTexture &refTexture = static_cast<const OdGiRasterImageTexture&>(texture);
2593 return m_pRasterImage.get() == refTexture.m_pRasterImage.get();
2594}
2595
2598{
2599 m_pRasterImage = texture.m_pRasterImage;
2600 return *this;
2601}
2602
2603inline void OdGiRasterImageTexture::copyFrom(const OdRxObject* pSource)
2604{
2606 if (!pSrcTex.isNull())
2607 {
2608 setRasterImage(pSrcTex->rasterImage());
2609 }
2610 else
2611 {
2612 throw OdError(eNotApplicable);
2613 }
2614}
2615
2616// OdGiRasterImageFileTexture inline implementations
2617
2618inline void
2620{
2621 if (pRasterImage)
2622 {
2623 if (m_pRasterImage.isNull())
2624 m_pRasterImage = OdGiRasterImageTexture::createObject();
2625 m_pRasterImage->setRasterImage(pRasterImage);
2626 } else
2627 m_pRasterImage.release();
2628}
2629
2630inline const OdGiRasterImage *
2632{
2633 if (m_pRasterImage.isNull())
2634 return NULL;
2635 return m_pRasterImage->rasterImage();
2636}
2637
2638inline void
2640{
2641 m_pRasterImage = pRasterImage;
2642}
2643
2644inline const OdGiRasterImageTexture *
2646{
2647 return m_pRasterImage;
2648}
2649
2650inline bool
2652{
2653 if (!(texture.isA() == isA()))
2654 return false;
2655 const OdGiRasterImageFileTexture &refTexture = static_cast<const OdGiRasterImageFileTexture &>(texture);
2656 return (rasterImage() == refTexture.rasterImage()) && (sourceFileName() == refTexture.sourceFileName());
2657}
2658
2661{
2662 setRasterImage(texture.rasterImage());
2663 setSourceFileName(texture.sourceFileName());
2664 return *this;
2665}
2666
2668{
2670 if (!pSrcTex.isNull())
2671 {
2672 setRasterImage(pSrcTex->rasterImage());
2674 }
2675 else
2676 {
2677 throw OdError(eNotApplicable);
2678 }
2679}
2680
2681// OdGiWoodTexture inline implementations
2682
2683inline
2685 : m_radialNoise(0.)
2686 , m_axialNoise(0.)
2687 , m_grainThickness(0.)
2688{
2689}
2690
2691inline void
2693{
2694 m_color1 = woodColor1;
2695}
2696
2697inline const OdGiMaterialColor&
2699{
2700 return m_color1;
2701}
2702
2703inline void
2705{
2706 m_color2 = woodColor2;
2707}
2708
2709inline const OdGiMaterialColor&
2711{
2712 return m_color2;
2713}
2714
2715inline void
2717{
2718 m_radialNoise = radialNoise;
2719}
2720
2721inline double
2723{
2724 return m_radialNoise;
2725}
2726
2727inline void
2729{
2730 m_axialNoise = axialNoise;
2731}
2732
2733inline double
2735{
2736 return m_axialNoise;
2737}
2738
2739inline void
2741{
2742 m_grainThickness = grainThickness;
2743}
2744
2745inline double
2747{
2748 return m_grainThickness;
2749}
2750
2751inline bool
2753{
2754 if (!(texture.isA() == isA()))
2755 return false;
2756 const OdGiWoodTexture &refTexture = static_cast<const OdGiWoodTexture&>(texture);
2757 return (m_color1 == refTexture.m_color1) &&
2758 (m_color2 == refTexture.m_color2) &&
2759 (m_radialNoise == refTexture.m_radialNoise) &&
2760 (m_axialNoise == refTexture.m_axialNoise) &&
2761 (m_grainThickness == refTexture.m_grainThickness);
2762}
2763
2764inline OdGiWoodTexture &
2766{
2767 m_color1 = texture.m_color1;
2768 m_color2 = texture.m_color2;
2769 m_radialNoise = texture.m_radialNoise;
2770 m_axialNoise = texture.m_axialNoise;
2771 m_grainThickness = texture.m_grainThickness;
2772 return *this;
2773}
2774
2775inline void OdGiWoodTexture::copyFrom(const OdRxObject* pSource)
2776{
2777 OdGiWoodTexturePtr pSrcTex = OdGiWoodTexture::cast(pSource);
2778 if (!pSrcTex.isNull())
2779 {
2780 setColor1(pSrcTex->color1());
2781 setColor2(pSrcTex->color2());
2782 setRadialNoise(pSrcTex->radialNoise());
2783 setAxialNoise(pSrcTex->axialNoise());
2785 }
2786 else
2787 {
2788 throw OdError(eNotApplicable);
2789 }
2790}
2791
2792// OdGiMarbleTexture inline implementations
2793
2794inline
2796 : m_veinSpacing(0.)
2797 , m_veinWidth(0.)
2798{
2799}
2800
2801inline void
2806
2807inline const OdGiMaterialColor&
2809{
2810 return m_stoneColor;
2811}
2812
2813inline void
2818
2819inline const OdGiMaterialColor&
2821{
2822 return m_veinColor;
2823}
2824
2825inline void
2827{
2828 m_veinSpacing = veinSpacing;
2829}
2830
2831inline double
2833{
2834 return m_veinSpacing;
2835}
2836
2837inline void
2839{
2840 m_veinWidth = veinWidth;
2841}
2842
2843inline double
2845{
2846 return m_veinWidth;
2847}
2848
2849inline bool
2851{
2852 if (!(texture.isA() == isA()))
2853 return false;
2854 const OdGiMarbleTexture &refTexture = static_cast<const OdGiMarbleTexture&>(texture);
2855 return (m_stoneColor == refTexture.m_stoneColor) &&
2856 (m_veinColor == refTexture.m_veinColor) &&
2857 (m_veinSpacing == refTexture.m_veinSpacing) &&
2858 (m_veinWidth == refTexture.m_veinWidth);
2859}
2860
2861inline OdGiMarbleTexture &
2863{
2864 m_stoneColor = texture.m_stoneColor;
2865 m_veinColor = texture.m_veinColor;
2866 m_veinSpacing = texture.m_veinSpacing;
2867 m_veinWidth = texture.m_veinWidth;
2868 return *this;
2869}
2870
2871inline void OdGiMarbleTexture::copyFrom(const OdRxObject* pSource)
2872{
2874 if (!pSrcTex.isNull())
2875 {
2876 setStoneColor(pSrcTex->stoneColor());
2877 setVeinColor(pSrcTex->veinColor());
2878 setVeinSpacing(pSrcTex->veinSpacing());
2879 setVeinWidth(pSrcTex->veinWidth());
2880 }
2881 else
2882 {
2883 throw OdError(eNotApplicable);
2884 }
2885}
2886
2887// OdGiGenericTexture inline implementations
2888
2889inline
2893
2894inline void
2896{
2897 if (m_definition.isNull())
2898 {
2899 m_definition = OdGiVariant::createObject(definition);
2900 }
2901 else
2902 {
2903 *m_definition = definition;
2904 }
2905}
2906
2907inline OdGiVariantPtr
2909{
2910 return m_definition;
2911}
2912
2913inline void
2915{
2916 if (m_definition.isNull())
2917 {
2918 pDefinition = OdGiVariant::createObject();
2919 }
2920 else
2921 {
2922 pDefinition = OdGiVariant::createObject(*m_definition);
2923 }
2924}
2925
2926inline bool
2928{
2929 if (!(texture.isA() == isA()))
2930 return false;
2931 const OdGiGenericTexture &refTexture = static_cast<const OdGiGenericTexture&>(texture);
2932 if (m_definition.isNull() && refTexture.m_definition.isNull())
2933 return true;
2934 if (!m_definition.isNull() && !refTexture.m_definition.isNull())
2935 return (*m_definition == *(refTexture.m_definition));
2936 return false;
2937}
2938
2939inline OdGiGenericTexture &
2941{
2942 if (!texture.m_definition.isNull())
2943 m_definition = OdGiVariant::createObject(*(texture.m_definition));
2944 else
2945 m_definition.release();
2946 return *this;
2947}
2948
2949inline void OdGiGenericTexture::copyFrom(const OdRxObject* pSource)
2950{
2952 if (!pSrcTex.isNull())
2953 {
2954 setDefinition(*(pSrcTex->definition()));
2955 }
2956 else
2957 {
2958 throw OdError(eNotApplicable);
2959 }
2960}
2961
2962#include "TD_PackPop.h"
2963
2964#endif //#ifndef __ODGIMATERIAL_H__
tm
scale
@ color1
Definition FxUIEnum.h:78
#define ODGI_EXPORT
Definition GiExport.h:35
#define ODGI_EXPORT_STATIC
Definition GiExport.h:36
OdSmartPtr< OdGiWoodTexture > OdGiWoodTexturePtr
OdSmartPtr< OdGiImageFileTexture > OdGiImageFileTexturePtr
OdSmartPtr< OdGiRasterImageFileTexture > OdGiRasterImageFileTexturePtr
OdSmartPtr< OdGiRasterImageTexture > OdGiRasterImageTexturePtr
OdSmartPtr< OdGiMaterialTexture > OdGiMaterialTexturePtr
Definition GiMaterial.h:971
OdSmartPtr< OdGiMaterialTraits > OdGiMaterialTraitsPtr
Definition GiMaterial.h:765
OdSmartPtr< OdGiImageTexture > OdGiImageTexturePtr
Definition GiMaterial.h:992
OdSmartPtr< OdGiSceneTexture > OdGiSceneTexturePtr
OdSmartPtr< OdGiMarbleTexture > OdGiMarbleTexturePtr
OdSmartPtr< OdGiProceduralTexture > OdGiProceduralTexturePtr
OdSmartPtr< OdGiGenericTexture > OdGiGenericTexturePtr
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:405
OdSmartPtr< OdGiVariant > OdGiVariantPtr
Definition GiVariant.h:415
bool operator==(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:399
unsigned int OdUInt32
#define ODRX_ABSTRACT
unsigned char OdUInt8
#define SETBIT(flags, bit, value)
Definition OdaDefs.h:516
bool OdLessOrEqual(double x, double y, double tol=1.e-10)
Definition OdaDefs.h:552
#define GETBIT(flags, bit)
Definition OdaDefs.h:517
bool OdGreaterOrEqual(double x, double y, double tol=1.e-10)
Definition OdaDefs.h:562
#define FIRSTDLL_EXPORT
Definition RootExport.h:39
bool isNull() const
virtual OdGiVariantPtr definition() const
ODRX_DECLARE_MEMBERS(OdGiGenericTexture)
void copyFrom(const OdRxObject *pSource)
virtual void setDefinition(const OdGiVariant &definition)
virtual Type type() const
virtual bool operator==(const OdGiMaterialTexture &texture) const
OdGiGenericTexture & operator=(const OdGiGenericTexture &texture)
virtual bool operator==(const OdGiMaterialTexture &texture) const
virtual void setSourceFileName(const OdString &fileName)
ODRX_DECLARE_MEMBERS(OdGiImageFileTexture)
void copyFrom(const OdRxObject *pSource)
OdGiImageFileTexture & operator=(const OdGiImageFileTexture &texture)
virtual const OdString sourceFileName() const
ODRX_DECLARE_MEMBERS(OdGiImageTexture)
void setProjection(Projection projection)
Tiling vTiling() const
OdGiMapper(const OdGiMapper &mapper)=default
static ODGI_EXPORT_STATIC const OdGiMapper kIdentity
OdGiMapper & operator=(const OdGiMapper &mapper)=default
AutoTransform autoTransform() const
Projection projection() const
void setVTiling(Tiling tiling)
@ kInheritAutoTransform
bool operator!=(const OdGiMapper &mapper) const
void setAutoTransform(AutoTransform autoTransform)
OdGeMatrix3d & transform()
Tiling uTiling() const
void setTransform(const OdGeMatrix3d &tm)
void setUTiling(Tiling tiling)
bool operator==(const OdGiMapper &mapper) const
OdGiMarbleTexture & operator=(const OdGiMarbleTexture &texture)
virtual void setStoneColor(const OdGiMaterialColor &stoneColor)
virtual bool operator==(const OdGiMaterialTexture &texture) const
virtual double veinWidth(void) const
virtual double veinSpacing(void) const
void copyFrom(const OdRxObject *pSource)
virtual const OdGiMaterialColor & veinColor(void) const
virtual Type type() const
virtual const OdGiMaterialColor & stoneColor(void) const
virtual void setVeinSpacing(double veinSpacing)
ODRX_DECLARE_MEMBERS(OdGiMarbleTexture)
virtual void setVeinColor(const OdGiMaterialColor &veinColor)
virtual void setVeinWidth(double veinWidth)
void setFactor(double factor)
OdCmEntityColor & color()
double factor() const
void setBlendFactor(double factor)
double blendFactor() const
Method method() const
static ODGI_EXPORT_STATIC const OdGiMaterialColor kNull
Definition GiMaterial.h:793
void setColor(const OdCmEntityColor &color)
void setMethod(Method method)
void setBrightness(double brightness)
void setMapper(const OdGiMapper &mapper)
void setSourceFileName(const OdString &filename)
OdGiMapper & mapper()
void setInverted(bool bInvert)
void setTexture(OdGiMaterialTexturePtr pTexture)
const OdGiMaterialTexturePtr texture(void) const
OdString sourceFileName() const
void setInvertedBrightness(bool bInvert)
bool isInverted() const
Source source() const
static ODGI_EXPORT_STATIC const OdGiMaterialMap kNull
void setSource(Source source)
double blendFactor() const
double brightness() const
bool isInvertedBrightness() const
void setBlendFactor(double blendFactor)
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition GiMaterial.h:964
ODRX_DECLARE_MEMBERS(OdGiMaterialTexture)
virtual void cutouts(OdGiMaterialMap &cutoutsMap) const =0
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 void setRoughness(const OdGiMaterialMap &roughnessMap, double strength)=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 ReflectionMethod reflectionMethod() 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 roughness(OdGiMaterialMap &roughnessMap, double &strength) const =0
@ kGlobalIlluminationCastAndReceive
Definition GiMaterial.h:157
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 void setReflectionMethod(ReflectionMethod method)=0
virtual double selfIllumination() const =0
virtual void setCutouts(const OdGiMaterialMap &cutoutsMap)=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)
void copyFrom(const OdRxObject *pSource)
virtual const OdGiRasterImage * rasterImage() const
virtual void setRasterImage(const OdGiRasterImage *pRasterImage)
virtual bool operator==(const OdGiMaterialTexture &texture) const
virtual void setRasterImageTexture(const OdGiRasterImageTexture *pRasterImage)
virtual const OdGiRasterImageTexture * rasterImageTexture() const
ODRX_DECLARE_MEMBERS(OdGiRasterImageFileTexture)
virtual const OdGiRasterImage * rasterImage() const
OdGiRasterImageTexture & operator=(const OdGiRasterImageTexture &texture)
ODRX_DECLARE_MEMBERS(OdGiRasterImageTexture)
virtual bool operator==(const OdGiMaterialTexture &texture) const
void copyFrom(const OdRxObject *pSource)
virtual void setRasterImage(const OdGiRasterImage *pRasterImage)
virtual bool operator==(const OdGiMaterialTexture &texture) const
void copyFrom(const OdRxObject *pSource)
OdUInt8 softness() const
ODRX_DECLARE_MEMBERS(OdGiSceneTexture)
void setSoftness(OdUInt8 softness)
static OdSmartPtr< OdGiVariant > createObject(const OdGiVariant &value)
virtual void setGrainThickness(double grainThickness)
virtual void setRadialNoise(double radialNoise)
virtual const OdGiMaterialColor & color2(void) const
virtual const OdGiMaterialColor & color1(void) const
OdGiWoodTexture & operator=(const OdGiWoodTexture &texture)
virtual double grainThickness(void) const
void copyFrom(const OdRxObject *pSource)
virtual void setColor2(const OdGiMaterialColor &woodColor2)
virtual Type type() const
virtual void setAxialNoise(double axialNoise)
ODRX_DECLARE_MEMBERS(OdGiWoodTexture)
virtual double axialNoise(void) const
virtual double radialNoise(void) const
virtual bool operator==(const OdGiMaterialTexture &texture) const
virtual void setColor1(const OdGiMaterialColor &woodColor1)
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
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