CFx SDK Documentation  2022 SP0
GiMaterial.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 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 
36 class OdGiMaterialColor;
37 class OdGiMaterialMap;
38 class OdGiRasterImage;
39 
46 {
47 public:
49 
55  {
56  kBlinnShader = 0, // Blinn shader uses the light's color to determine the reflection color.
57  kMetalShader // Metal shader calculates the reflected light's color using the material's diffuse color and the light's color.
58  };
59 
64  {
65  kNone = 0x00000, // No material channels enabled.
66  kUseDiffuse = 0x00001, // Enables diffuse material channel.
67  kUseSpecular = 0x00002, // Enables specular material channel.
68  kUseReflection = 0x00004, // Enables reflection material channel.
69  kUseOpacity = 0x00008, // Enables opacity material channel.
70  kUseBump = 0x00010, // Enables bump material channel.
71  kUseRefraction = 0x00020, // Enables refraction material channel.
72  kUseNormalMap = 0x00040, // Enables normal map material channel.
73  // BIM extensions
74  kUseEmission = 0x00080, // Enables emission material channel.
75  kUseTint = 0x00100, // Enables tint material channel.
76 
77  kUseAll = (kUseDiffuse | kUseSpecular | kUseReflection |
78  kUseOpacity | kUseBump | kUseRefraction | kUseNormalMap), // Enables all material channels.
79  kUseAllInternal = (kUseAll | kUseEmission | kUseTint) // Enables all material channels including extension channels.
80  };
81 
85  enum Mode
86  {
87  kRealistic = 0, // Realistic material model.
88  kAdvanced // Advanced material model.
89  };
90 
91  // Returned via subSetAttributes()
92  enum
93  {
94  kByBlock = (OdGiDrawable::kLastFlag << 1), // "ByBlock" material.
95  kByLayer = (OdGiDrawable::kLastFlag << 2) // "ByLayer" material.
96  };
97 
98  // Extended material traits enumerations
99 
104  {
105  kSelfIllumination = 0, // Compute luminance from self-illumination parameters.
106  kLuminance, // Use luminance specified by the setLuminance() method.
107  kEmissionColor // Compute luminance using an emission material channel.
108  };
109 
114  {
115  kTangentSpace // Method of tangent spaces is used to compute the normal map.
116  };
117 
122  {
123  kGlobalIlluminationNone, // No global illumination.
124  kGlobalIlluminationCast, // The global illumination is casting light.
125  kGlobalIlluminationReceive, // The global illumination is receiving light.
126  kGlobalIlluminationCastAndReceive // The global illumination is casting and receiving light.
127  };
128 
133  {
134  kFinalGatherNone, // No final gathering.
135  kFinalGatherCast, // The final gathering is casting.
136  kFinalGatherReceive, // The final gathering is receiving.
137  kFinalGatherCastAndReceive // The final gathering is casting and receiving.
138  };
139 
140  // BIM extensions
145  {
146  kDiffuseRealisticColor = 0, // Use the color specified in the diffuse material channel.
147  kDiffuseShadingColor, // Use the color specified by the setShadingDiffuse() method.
148  kDiffuseStyleDependent // Chosen color depends on the active visual style.
149  };
150 
159  virtual void ambient(OdGiMaterialColor& ambientColor) const = 0;
160 
170  virtual void diffuse(OdGiMaterialColor& diffuseColor, OdGiMaterialMap& diffuseMap) const = 0;
171 
182  virtual void specular(OdGiMaterialColor& specularColor, OdGiMaterialMap& specularMap, double& glossFactor) const = 0;
183 
192  virtual void reflection(OdGiMaterialMap& reflectionMap) const = 0;
193 
200  virtual void opacity(double& opacityPercentage, OdGiMaterialMap& opacityMap) const = 0;
201 
207  virtual void bump(OdGiMaterialMap& bumpMap) const = 0;
208 
215  virtual void refraction(double& refractionIndex, OdGiMaterialMap& refractionMap) const = 0;
216 
220  virtual double translucence() const = 0;
221 
225  virtual double selfIllumination() const = 0;
226 
230  virtual double reflectivity() const = 0;
231 
236 
240  virtual ChannelFlags channelFlags() const = 0;
241 
245  virtual Mode mode() const = 0;
246 
255  virtual void setAmbient(const OdGiMaterialColor& ambientColor) = 0;
256 
266  virtual void setDiffuse(const OdGiMaterialColor& diffuseColor, const OdGiMaterialMap& diffuseMap) = 0;
267 
278  virtual void setSpecular(const OdGiMaterialColor& specularColor, const OdGiMaterialMap& specularMap, double glossFactor) = 0;
279 
288  virtual void setReflection(const OdGiMaterialMap& reflectionMap) = 0;
289 
296  virtual void setOpacity(double opacityPercentage, const OdGiMaterialMap& opacityMap) = 0;
297 
303  virtual void setBump(const OdGiMaterialMap& bumpMap) = 0;
304 
311  virtual void setRefraction(double refractionIndex, const OdGiMaterialMap& refractionMap) = 0;
312 
318  virtual void setTranslucence(double value) = 0;
319 
325  virtual void setSelfIllumination(double value) = 0;
326 
332  virtual void setReflectivity(double value) = 0;
333 
339  virtual void setIlluminationModel(IlluminationModel model) = 0;
340 
346  virtual void setChannelFlags(ChannelFlags flags) = 0;
347 
353  virtual void setMode(Mode value) = 0;
354 
355  // Extended material properties
356 
362  virtual void setColorBleedScale(double scale) = 0;
363 
367  virtual double colorBleedScale() const = 0;
368 
374  virtual void setIndirectBumpScale(double scale) = 0;
375 
379  virtual double indirectBumpScale() const = 0;
380 
386  virtual void setReflectanceScale(double scale) = 0;
387 
391  virtual double reflectanceScale() const = 0;
392 
398  virtual void setTransmittanceScale(double scale) = 0;
399 
403  virtual double transmittanceScale() const = 0;
404 
410  virtual void setTwoSided(bool flag) = 0;
411 
415  virtual bool twoSided() const = 0;
416 
422  virtual void setLuminanceMode(LuminanceMode mode) = 0;
423 
427  virtual LuminanceMode luminanceMode() const = 0;
428 
434  virtual void setLuminance(double value) = 0;
435 
439  virtual double luminance() const = 0;
440 
448  virtual void setNormalMap(const OdGiMaterialMap &normalMap, NormalMapMethod method, double strength) = 0;
449 
457  virtual void normalMap(OdGiMaterialMap &normalMap, NormalMapMethod &method, double &strength) const = 0;
458 
465 
470 
476  virtual void setFinalGather(FinalGatherMode mode) = 0;
477 
481  virtual FinalGatherMode finalGather() const = 0;
482 
483  // BIM extensions
484 
491  virtual void setEmission(const OdGiMaterialColor& emissionColor, const OdGiMaterialMap& emissionMap) = 0;
492 
499  virtual void emission(OdGiMaterialColor& emissionColor, OdGiMaterialMap& emissionMap) const = 0;
500 
506  virtual void setTint(const OdGiMaterialColor& tintColor) = 0;
507 
513  virtual void tint(OdGiMaterialColor& tintColor) const = 0;
514 
520  virtual void setShadingAmbient(const OdGiMaterialColor& ambientColor) = 0;
521 
527  virtual void shadingAmbient(OdGiMaterialColor& ambientColor) const = 0;
528 
534  virtual void setShadingDiffuse(const OdGiMaterialColor& diffuseColor) = 0;
535 
541  virtual void shadingDiffuse(OdGiMaterialColor& diffuseColor) const = 0;
542 
548  virtual void setShadingSpecular(const OdGiMaterialColor& specularColor) = 0;
549 
555  virtual void shadingSpecular(OdGiMaterialColor& specularColor) const = 0;
556 
562  virtual void setShadingOpacity(double opacityPercentage) = 0;
563 
569  virtual void shadingOpacity(double &opacityPercentage) const = 0;
570 
576  virtual void setDiffuseColorMode(DiffuseColorMode diffuseColorMode) = 0;
577 
581  virtual DiffuseColorMode diffuseColorMode() const = 0;
582 };
583 
588 
589 
599 {
600 public:
604  enum Method
605  {
606  kInherit = 0, // Uses the current drawing color.
607  kOverride = 1 // Uses the color set with setColor().
608  };
609 
611 
613 
619  OdGiMaterialColor(const OdCmEntityColor &overrideColor);
620 
635  void setMethod(Method method);
636 
645  void setFactor(double factor);
646 
651  OdCmEntityColor& color();
652 
665  Method method() const;
666 
673  double factor() const;
674 
679  const OdCmEntityColor& color() const;
680 
681  bool operator ==(const OdGiMaterialColor &other) const
682  {
683  return (m_method == other.m_method) &&
684  (m_factor == other.m_factor) &&
685  (m_color == other.m_color);
686  }
687  bool operator != (const OdGiMaterialColor &other) const
688  {
689  return (m_method != other.m_method) ||
690  (m_factor != other.m_factor) ||
691  (m_color != other.m_color);
692  }
693 
698  void setColor(const OdCmEntityColor &color);
699 
700 private:
701  Method m_method;
702  double m_factor;
703  OdCmEntityColor m_color;
704 };
705 
706 
713 {
714 public:
716  virtual bool operator==(const OdGiMaterialTexture & texture)const;
717 protected:
720 };
721 
723  return (texture.isA() == isA());
724 }
725 
730 
737 {
738 public:
740 protected:
743 };
744 
749 
756 {
757 public:
759 
765  virtual void setSourceFileName(const OdString& fileName);
766 
770  virtual const OdString sourceFileName() const;
771 
772  virtual bool operator==(const OdGiMaterialTexture & texture) const;
774 
775  // OdRxObject overrides
776 
782  void copyFrom(const OdRxObject* pSource);
783 private:
784  OdString m_sourceFileName;
785 };
786 
791 
798 {
799 public:
806  virtual void setRasterImage(const OdGiRasterImage *pRasterImage);
807 
811  virtual const OdGiRasterImage *rasterImage() const;
812 
813  virtual bool operator==(const OdGiMaterialTexture & texture) const;
815 
821  void copyFrom(const OdRxObject* pSource);
822 private:
823  OdRxObjectPtr m_pRasterImage;
824 };
825 
830 
837 {
838 public:
840 
844  enum Type
845  {
846  kWood = 0, // Wood texture.
847  kMarble = 1, // Marble texture.
848  kGeneric = 2 // Generic texture.
849  };
850 
854  virtual Type type() const = 0;
855 protected:
858 };
859 
864 
871 {
872 public:
874 
875  OdGiWoodTexture();
876 
880  virtual Type type() const {return kWood;}
881 
882  // wood properties
883 
889  virtual void setColor1(const OdGiMaterialColor &woodColor1);
890 
894  virtual const OdGiMaterialColor& color1(void) const;
895 
901  virtual void setColor2(const OdGiMaterialColor &woodColor2);
902 
906  virtual const OdGiMaterialColor& color2(void) const;
907 
913  virtual void setRadialNoise(double radialNoise);
914 
918  virtual double radialNoise(void) const;
919 
925  virtual void setAxialNoise(double axialNoise);
926 
930  virtual double axialNoise(void) const;
931 
937  virtual void setGrainThickness(double grainThickness);
938 
942  virtual double grainThickness(void) const;
943 
944  virtual bool operator==(const OdGiMaterialTexture & texture) const;
945  OdGiWoodTexture &operator =(const OdGiWoodTexture &texture);
946 
947  // OdRxObject overrides
948 
954  void copyFrom(const OdRxObject* pSource);
955 private:
956  OdGiMaterialColor m_color1;
957  OdGiMaterialColor m_color2;
958  double m_radialNoise;
959  double m_axialNoise;
960  double m_grainThickness;
961 };
962 
967 
974 {
975 public:
977 
979 
983  virtual Type type() const {return kMarble;}
984 
990  virtual void setStoneColor(const OdGiMaterialColor &stoneColor);
991 
995  virtual const OdGiMaterialColor& stoneColor(void) const;
996 
1002  virtual void setVeinColor(const OdGiMaterialColor &veinColor);
1003 
1007  virtual const OdGiMaterialColor& veinColor(void) const;
1008 
1014  virtual void setVeinSpacing(double veinSpacing);
1015 
1019  virtual double veinSpacing(void) const;
1020 
1026  virtual void setVeinWidth(double veinWidth);
1027 
1031  virtual double veinWidth(void) const;
1032 
1033  virtual bool operator==(const OdGiMaterialTexture & texture) const;
1034  OdGiMarbleTexture &operator =(const OdGiMarbleTexture &texture);
1035 
1036  // OdRxObject overrides
1037 
1043  void copyFrom(const OdRxObject* pSource);
1044 private:
1045  OdGiMaterialColor m_stoneColor;
1046  OdGiMaterialColor m_veinColor;
1047  double m_veinSpacing;
1048  double m_veinWidth;
1049 };
1050 
1055 
1062 {
1063 public:
1065 
1067 
1071  virtual Type type() const {return kGeneric;}
1072 
1078  virtual void setDefinition(const OdGiVariant &definition);
1079 
1083  virtual OdGiVariantPtr definition() const;
1084 
1088  virtual void definition(OdGiVariantPtr &pDefinition) const;
1089 
1090  virtual bool operator==(const OdGiMaterialTexture & texture) const;
1091  OdGiGenericTexture &operator =(const OdGiGenericTexture &texture);
1092 
1093  // OdRxObject overrides
1094 
1100  void copyFrom(const OdRxObject* pSource);
1101 private:
1102  OdGiVariantPtr m_definition;
1103 };
1104 
1109 
1110 
1123 {
1124 public:
1129  {
1130  kInheritProjection = 0, // Inherits projection from the current material's mapper.
1131  kPlanar = 1, // Maps directly to XY coordinates.
1132  kBox = 2, // Maps to planes perpendicular to major axes.
1133  kCylinder = 3, // Maps to cylinders aligned with the Z-axis.
1134  kSphere = 4, // Maps to spheres aligned with the Z-axis.
1135 
1136  kDgnParametric = 0x32, // Maps directly to surface coordinates. For .dgn materials.
1137  kDgnPlanar = 0x33, // Maps directly to surface coordinates. For .dgn materials.
1138  kDgnCylinder = 0x34, // Maps to cylinders aligned with the Z-axis. For .dgn materials.
1139  kDgnCylinderCapped = 0x35, // Maps to cylinders aligned with the Z-axis. If normal to surface is the same as Z-axis,
1140  // then uses planar mapping. For .dgn materials.
1141  kDgnSphere = 0x36 // Maps to spheres aligned with the Z-axis. For .dgn materials.
1142  };
1143 
1147  enum Tiling
1148  {
1149  kInheritTiling = 0, // Inherits tiling from the current material's mapper.
1150  kTile = 1, // Repeats map along image axes.
1151  kCrop = 2, // Crops map < 0.0 or > 1.0 on image axes.
1152  kClamp = 3, // Clamps (stretches) map between 0.0 and 1.0 on image axes.
1153  kMirror = 4 // Mirrors the material map at every integer boundary.
1154  };
1155 
1160  {
1161  kInheritAutoTransform = 0x0, // Inherits automatic transform mode from the current material's mapper.
1162  kNone = 0x1, // No automatic transform.
1163  kObject = 0x2, // Adjusts the mapper transform to align with and fit the current object.
1164  kModel = 0x4 // Multiplies the mapper transform by the current block transform.
1165  };
1166 
1168 
1170  : m_projection(kPlanar)
1171  , m_uTiling(kTile)
1172  , m_vTiling(kTile)
1173  , m_autoTransform(kNone)
1174  {
1175  }
1176 
1177  OdGiMapper (const OdGiMapper& mapper);
1178  OdGiMapper& operator=(const OdGiMapper& mapper);
1179  bool operator==(const OdGiMapper& mapper) const;
1180  bool operator!=(const OdGiMapper& mapper) const;
1181 
1199  void setProjection(Projection projection);
1200 
1218  void setUTiling(Tiling tiling);
1219 
1237  void setVTiling(Tiling tiling);
1238 
1255  void setAutoTransform(AutoTransform autoTransform);
1256 
1263  OdGeMatrix3d& transform();
1264 
1280  Projection projection() const;
1281 
1297  Tiling uTiling() const;
1298 
1314  Tiling vTiling() const;
1315 
1330  AutoTransform autoTransform() const;
1331 
1335  const OdGeMatrix3d& transform() const;
1336 
1342  void setTransform(const OdGeMatrix3d &tm);
1343 
1344 private:
1345  Projection m_projection;
1346  Tiling m_uTiling;
1347  Tiling m_vTiling;
1348  AutoTransform m_autoTransform;
1349  OdGeMatrix3d m_transform;
1350 };
1351 
1352 
1362 {
1363 public:
1364 
1368  enum Source
1369  {
1370  kScene = 0, // Map is created from the current scene.
1371  kFile = 1, // Map is from a file.
1372  kProcedural = 2 // Map is procedural.
1373  };
1374 
1376 
1377  OdGiMaterialMap();
1378 
1394  void setSource(Source source);
1395 
1400  void setSourceFileName(const OdString& filename);
1401 
1411  void setBlendFactor(double blendFactor);
1412 
1418  void setTexture(OdGiMaterialTexturePtr pTexture);
1419 
1426  OdGiMapper& mapper();
1427 
1441  Source source() const;
1442 
1446  OdString sourceFileName() const;
1447 
1455  double blendFactor() const;
1456 
1460  const OdGiMapper& mapper() const;
1461 
1467  void setMapper(const OdGiMapper &mapper);
1468 
1472  const OdGiMaterialTexturePtr texture(void) const;
1473 
1474  bool operator ==(const OdGiMaterialMap &other) const
1475  {
1476  if ((m_source == other.m_source) &&
1477  (m_fileName == other.m_fileName) &&
1478  (m_blendFactor == other.m_blendFactor) &&
1479  (m_mapper == other.m_mapper))
1480  {
1481  if (m_texture.isNull() && other.m_texture.isNull())
1482  return true;
1483  if (!m_texture.isNull() && !other.m_texture.isNull())
1484  return (*m_texture == *(other.m_texture));
1485  }
1486  return false;
1487  }
1488  bool operator !=(const OdGiMaterialMap &other) const
1489  {
1490  return !(*this == other);
1491  }
1492 
1493  OdGiMaterialMap &operator =(const OdGiMaterialMap& mmap)
1494  {
1495  m_source = mmap.m_source;
1496  m_fileName = mmap.m_fileName;
1497  m_blendFactor = mmap.m_blendFactor;
1498  m_mapper = mmap.m_mapper;
1499  m_texture = mmap.m_texture;
1500  return *this;
1501  }
1502 private:
1503  Source m_source;
1504  OdString m_fileName;
1505  double m_blendFactor;
1506  OdGiMapper m_mapper;
1507  OdGiMaterialTexturePtr m_texture;
1508 };
1509 
1510 // OdGiMaterialColor inline implementations
1511 
1512 inline
1514  : m_method(kInherit)
1515  , m_factor(1.0)
1516 {
1517 }
1518 
1519 inline
1521  : m_method(kOverride)
1522  , m_factor(1.0)
1523  , m_color(overrideColor)
1524 {
1525 }
1526 
1527 inline void
1529 {
1530  m_method = method;
1531 }
1532 
1533 inline void
1535 {
1536  m_factor = factor;
1537 }
1538 
1539 inline OdCmEntityColor&
1541 {
1542  return m_color;
1543 }
1544 
1547 {
1548  return m_method;
1549 }
1550 
1551 inline double
1553 {
1554  return m_factor;
1555 }
1556 
1557 inline const OdCmEntityColor&
1559 {
1560  return m_color;
1561 }
1562 
1563 inline void
1565 {
1566  m_color = color;
1567 }
1568 
1569 // OdGiMaterialMap inline implementations
1570 
1571 inline
1573  : m_source(kFile)
1574  , m_blendFactor(1.0)
1575 {
1576 }
1577 
1578 inline void
1580 {
1581  m_source = source;
1582 }
1583 
1584 inline void
1586 {
1587  m_fileName = filename;
1588 }
1589 
1590 inline void
1592 {
1593  m_blendFactor = blendFactor;
1594 }
1595 
1596 inline OdGiMapper&
1598 {
1599  return m_mapper;
1600 }
1601 
1604 {
1605  return m_source;
1606 }
1607 
1608 inline OdString
1610 {
1611  return m_fileName;
1612 }
1613 
1614 inline double
1616 {
1617  return m_blendFactor;
1618 }
1619 
1620 inline const OdGiMapper&
1622 {
1623  return m_mapper;
1624 }
1625 
1626 inline void
1628 {
1629  m_mapper = mapper;
1630 }
1631 
1632 inline void
1634 {
1635  m_texture = pTexture;
1636 }
1637 
1638 inline const OdGiMaterialTexturePtr
1640 {
1641  return m_texture;
1642 }
1643 
1644 // OdGiMapper inline implementations
1645 
1646 inline
1648  : m_projection(mapper.m_projection)
1649  , m_uTiling(mapper.m_uTiling)
1650  , m_vTiling(mapper.m_vTiling)
1651  , m_autoTransform(mapper.m_autoTransform)
1652  , m_transform(mapper.m_transform)
1653 {
1654 }
1655 
1656 inline OdGiMapper&
1658 {
1659  if (&mapper != this)
1660  {
1661  m_projection = mapper.m_projection;
1662  m_uTiling = mapper.m_uTiling;
1663  m_vTiling = mapper.m_vTiling;
1664  m_autoTransform = mapper.m_autoTransform;
1665  m_transform = mapper.m_transform;
1666  }
1667  return *this;
1668 }
1669 
1670 inline bool
1672 {
1673  return m_projection == mapper.m_projection
1674  && m_uTiling == mapper.m_uTiling
1675  && m_vTiling == mapper.m_vTiling
1676  && m_autoTransform == mapper.m_autoTransform
1677  && m_transform == mapper.m_transform;
1678 }
1679 
1680 inline bool
1682 {
1683  return !(*this == mapper);
1684 }
1685 
1686 inline void
1688 {
1689  m_projection = projection;
1690 }
1691 
1692 inline void
1694 {
1695  m_uTiling = tiling;
1696 }
1697 
1698 inline void
1700 {
1701  m_vTiling = tiling;
1702 }
1703 
1704 inline void
1706 {
1707  m_autoTransform = autoTransform;
1708 }
1709 
1712 {
1713  return m_projection;
1714 }
1715 
1716 inline OdGiMapper::Tiling
1718 {
1719  return m_uTiling;
1720 }
1721 
1722 inline OdGiMapper::Tiling
1724 {
1725  return m_vTiling;
1726 }
1727 
1730 {
1731  return m_autoTransform;
1732 }
1733 
1734 inline const OdGeMatrix3d&
1736 {
1737  return m_transform;
1738 }
1739 
1740 inline OdGeMatrix3d&
1742 {
1743  return m_transform;
1744 }
1745 
1746 inline void
1748 {
1749  transform() = tm;
1750 }
1751 
1752 // OdGiImageFileTexture inline implementations
1753 
1754 inline void
1756 {
1757  m_sourceFileName = fileName;
1758 }
1759 
1760 inline const OdString
1762 {
1763  return m_sourceFileName;
1764 }
1765 
1766 inline bool
1768 {
1769  if (!(texture.isA() == isA()))
1770  return false;
1771  const OdGiImageFileTexture &refTexture = static_cast<const OdGiImageFileTexture&>(texture);
1772  return m_sourceFileName == refTexture.m_sourceFileName;
1773 }
1774 
1775 inline OdGiImageFileTexture &
1777 {
1778  m_sourceFileName = texture.m_sourceFileName;
1779  return *this;
1780 }
1781 
1782 inline void OdGiImageFileTexture::copyFrom(const OdRxObject* pSource)
1783 {
1785  if (!pSrcTex.isNull())
1786  {
1787  setSourceFileName(pSrcTex->sourceFileName());
1788  }
1789  else
1790  {
1791  throw OdError(eNotApplicable);
1792  }
1793 }
1794 
1795 // OdGiRasterImageTexture inline implementations
1796 
1797 inline void
1799 {
1800  m_pRasterImage = reinterpret_cast<const OdRxObject*>(pRasterImage);
1801 }
1802 
1803 inline const OdGiRasterImage *
1805 {
1806  return reinterpret_cast<const OdGiRasterImage*>(m_pRasterImage.get());
1807 }
1808 
1809 inline bool
1811 {
1812  if (!(texture.isA() == isA()))
1813  return false;
1814  const OdGiRasterImageTexture &refTexture = static_cast<const OdGiRasterImageTexture&>(texture);
1815  return m_pRasterImage.get() == refTexture.m_pRasterImage.get();
1816 }
1817 
1818 inline OdGiRasterImageTexture &
1820 {
1821  m_pRasterImage = texture.m_pRasterImage;
1822  return *this;
1823 }
1824 
1826 {
1828  if (!pSrcTex.isNull())
1829  {
1830  setRasterImage(pSrcTex->rasterImage());
1831  }
1832  else
1833  {
1834  throw OdError(eNotApplicable);
1835  }
1836 }
1837 
1838 // OdGiWoodTexture inline implementations
1839 
1840 inline
1842  : m_radialNoise(0.)
1843  , m_axialNoise(0.)
1844  , m_grainThickness(0.)
1845 {
1846 }
1847 
1848 inline void
1850 {
1851  m_color1 = woodColor1;
1852 }
1853 
1854 inline const OdGiMaterialColor&
1856 {
1857  return m_color1;
1858 }
1859 
1860 inline void
1862 {
1863  m_color2 = woodColor2;
1864 }
1865 
1866 inline const OdGiMaterialColor&
1868 {
1869  return m_color2;
1870 }
1871 
1872 inline void
1874 {
1875  m_radialNoise = radialNoise;
1876 }
1877 
1878 inline double
1880 {
1881  return m_radialNoise;
1882 }
1883 
1884 inline void
1886 {
1887  m_axialNoise = axialNoise;
1888 }
1889 
1890 inline double
1892 {
1893  return m_axialNoise;
1894 }
1895 
1896 inline void
1898 {
1899  m_grainThickness = grainThickness;
1900 }
1901 
1902 inline double
1904 {
1905  return m_grainThickness;
1906 }
1907 
1908 inline bool
1910 {
1911  if (!(texture.isA() == isA()))
1912  return false;
1913  const OdGiWoodTexture &refTexture = static_cast<const OdGiWoodTexture&>(texture);
1914  return (m_color1 == refTexture.m_color1) &&
1915  (m_color2 == refTexture.m_color2) &&
1916  (m_radialNoise == refTexture.m_radialNoise) &&
1917  (m_axialNoise == refTexture.m_axialNoise) &&
1918  (m_grainThickness == refTexture.m_grainThickness);
1919 }
1920 
1921 inline OdGiWoodTexture &
1923 {
1924  m_color1 = texture.m_color1;
1925  m_color2 = texture.m_color2;
1926  m_radialNoise = texture.m_radialNoise;
1927  m_axialNoise = texture.m_axialNoise;
1928  m_grainThickness = texture.m_grainThickness;
1929  return *this;
1930 }
1931 
1932 inline void OdGiWoodTexture::copyFrom(const OdRxObject* pSource)
1933 {
1934  OdGiWoodTexturePtr pSrcTex = OdGiWoodTexture::cast(pSource);
1935  if (!pSrcTex.isNull())
1936  {
1937  setColor1(pSrcTex->color1());
1938  setColor2(pSrcTex->color2());
1939  setRadialNoise(pSrcTex->radialNoise());
1940  setAxialNoise(pSrcTex->axialNoise());
1941  setGrainThickness(pSrcTex->grainThickness());
1942  }
1943  else
1944  {
1945  throw OdError(eNotApplicable);
1946  }
1947 }
1948 
1949 // OdGiMarbleTexture inline implementations
1950 
1951 inline
1953  : m_veinSpacing(0.)
1954  , m_veinWidth(0.)
1955 {
1956 }
1957 
1958 inline void
1960 {
1961  m_stoneColor = stoneColor;
1962 }
1963 
1964 inline const OdGiMaterialColor&
1966 {
1967  return m_stoneColor;
1968 }
1969 
1970 inline void
1972 {
1973  m_veinColor = veinColor;
1974 }
1975 
1976 inline const OdGiMaterialColor&
1978 {
1979  return m_veinColor;
1980 }
1981 
1982 inline void
1984 {
1985  m_veinSpacing = veinSpacing;
1986 }
1987 
1988 inline double
1990 {
1991  return m_veinSpacing;
1992 }
1993 
1994 inline void
1996 {
1997  m_veinWidth = veinWidth;
1998 }
1999 
2000 inline double
2002 {
2003  return m_veinWidth;
2004 }
2005 
2006 inline bool
2008 {
2009  if (!(texture.isA() == isA()))
2010  return false;
2011  const OdGiMarbleTexture &refTexture = static_cast<const OdGiMarbleTexture&>(texture);
2012  return (m_stoneColor == refTexture.m_stoneColor) &&
2013  (m_veinColor == refTexture.m_veinColor) &&
2014  (m_veinSpacing == refTexture.m_veinSpacing) &&
2015  (m_veinWidth == refTexture.m_veinWidth);
2016 }
2017 
2018 inline OdGiMarbleTexture &
2020 {
2021  m_stoneColor = texture.m_stoneColor;
2022  m_veinColor = texture.m_veinColor;
2023  m_veinSpacing = texture.m_veinSpacing;
2024  m_veinWidth = texture.m_veinWidth;
2025  return *this;
2026 }
2027 
2028 inline void OdGiMarbleTexture::copyFrom(const OdRxObject* pSource)
2029 {
2030  OdGiMarbleTexturePtr pSrcTex = OdGiMarbleTexture::cast(pSource);
2031  if (!pSrcTex.isNull())
2032  {
2033  setStoneColor(pSrcTex->stoneColor());
2034  setVeinColor(pSrcTex->veinColor());
2035  setVeinSpacing(pSrcTex->veinSpacing());
2036  setVeinWidth(pSrcTex->veinWidth());
2037  }
2038  else
2039  {
2040  throw OdError(eNotApplicable);
2041  }
2042 }
2043 
2044 // OdGiGenericTexture inline implementations
2045 
2046 inline
2048 {
2049 }
2050 
2051 inline void
2053 {
2054  if (m_definition.isNull())
2055  {
2056  m_definition = OdGiVariant::createObject(definition);
2057  }
2058  else
2059  {
2060  *m_definition = definition;
2061  }
2062 }
2063 
2064 inline OdGiVariantPtr
2066 {
2067  return m_definition;
2068 }
2069 
2070 inline void
2072 {
2073  if (m_definition.isNull())
2074  {
2075  pDefinition = OdGiVariant::createObject();
2076  }
2077  else
2078  {
2079  pDefinition = OdGiVariant::createObject(*m_definition);
2080  }
2081 }
2082 
2083 inline bool
2085 {
2086  if (!(texture.isA() == isA()))
2087  return false;
2088  const OdGiGenericTexture &refTexture = static_cast<const OdGiGenericTexture&>(texture);
2089  if (m_definition.isNull() && refTexture.m_definition.isNull())
2090  return true;
2091  if (!m_definition.isNull() && !refTexture.m_definition.isNull())
2092  return (*m_definition == *(refTexture.m_definition));
2093  return false;
2094 }
2095 
2096 inline OdGiGenericTexture &
2098 {
2099  if (!texture.m_definition.isNull())
2100  m_definition = OdGiVariant::createObject(*(texture.m_definition));
2101  else
2102  m_definition.release();
2103  return *this;
2104 }
2105 
2106 inline void OdGiGenericTexture::copyFrom(const OdRxObject* pSource)
2107 {
2109  if (!pSrcTex.isNull())
2110  {
2111  setDefinition(*(pSrcTex->definition()));
2112  }
2113  else
2114  {
2115  throw OdError(eNotApplicable);
2116  }
2117 }
2118 
2119 #include "TD_PackPop.h"
2120 
2121 #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:966
OdSmartPtr< OdGiImageFileTexture > OdGiImageFileTexturePtr
Definition: GiMaterial.h:790
OdSmartPtr< OdGiRasterImageTexture > OdGiRasterImageTexturePtr
Definition: GiMaterial.h:829
OdSmartPtr< OdGiMaterialTexture > OdGiMaterialTexturePtr
Definition: GiMaterial.h:729
OdSmartPtr< OdGiMaterialTraits > OdGiMaterialTraitsPtr
Definition: GiMaterial.h:587
OdSmartPtr< OdGiImageTexture > OdGiImageTexturePtr
Definition: GiMaterial.h:748
OdSmartPtr< OdGiMarbleTexture > OdGiMarbleTexturePtr
Definition: GiMaterial.h:1054
OdSmartPtr< OdGiProceduralTexture > OdGiProceduralTexturePtr
Definition: GiMaterial.h:863
OdSmartPtr< OdGiGenericTexture > OdGiGenericTexturePtr
Definition: GiMaterial.h:1108
#define ODRX_ABSTRACT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
bool isNull() const
Definition: BaseObjectPtr.h:70
virtual OdGiVariantPtr definition() const
Definition: GiMaterial.h:2065
ODRX_DECLARE_MEMBERS(OdGiGenericTexture)
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2106
virtual void setDefinition(const OdGiVariant &definition)
Definition: GiMaterial.h:2052
virtual Type type() const
Definition: GiMaterial.h:1071
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2084
OdGiGenericTexture & operator=(const OdGiGenericTexture &texture)
Definition: GiMaterial.h:2097
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:1767
virtual void setSourceFileName(const OdString &fileName)
Definition: GiMaterial.h:1755
ODRX_DECLARE_MEMBERS(OdGiImageFileTexture)
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:1782
OdGiImageFileTexture & operator=(const OdGiImageFileTexture &texture)
Definition: GiMaterial.h:1776
virtual const OdString sourceFileName() const
Definition: GiMaterial.h:1761
ODRX_DECLARE_MEMBERS(OdGiImageTexture)
void setProjection(Projection projection)
Definition: GiMaterial.h:1687
Tiling vTiling() const
Definition: GiMaterial.h:1723
OdGiMapper & operator=(const OdGiMapper &mapper)
Definition: GiMaterial.h:1657
static ODGI_EXPORT_STATIC const OdGiMapper kIdentity
Definition: GiMaterial.h:1167
AutoTransform autoTransform() const
Definition: GiMaterial.h:1729
Projection projection() const
Definition: GiMaterial.h:1711
void setVTiling(Tiling tiling)
Definition: GiMaterial.h:1699
bool operator!=(const OdGiMapper &mapper) const
Definition: GiMaterial.h:1681
void setAutoTransform(AutoTransform autoTransform)
Definition: GiMaterial.h:1705
OdGeMatrix3d & transform()
Definition: GiMaterial.h:1741
Tiling uTiling() const
Definition: GiMaterial.h:1717
void setTransform(const OdGeMatrix3d &tm)
Definition: GiMaterial.h:1747
void setUTiling(Tiling tiling)
Definition: GiMaterial.h:1693
bool operator==(const OdGiMapper &mapper) const
Definition: GiMaterial.h:1671
OdGiMarbleTexture & operator=(const OdGiMarbleTexture &texture)
Definition: GiMaterial.h:2019
virtual void setStoneColor(const OdGiMaterialColor &stoneColor)
Definition: GiMaterial.h:1959
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:2007
virtual double veinWidth(void) const
Definition: GiMaterial.h:2001
virtual double veinSpacing(void) const
Definition: GiMaterial.h:1989
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:2028
virtual const OdGiMaterialColor & veinColor(void) const
Definition: GiMaterial.h:1977
virtual Type type() const
Definition: GiMaterial.h:983
virtual const OdGiMaterialColor & stoneColor(void) const
Definition: GiMaterial.h:1965
virtual void setVeinSpacing(double veinSpacing)
Definition: GiMaterial.h:1983
ODRX_DECLARE_MEMBERS(OdGiMarbleTexture)
virtual void setVeinColor(const OdGiMaterialColor &veinColor)
Definition: GiMaterial.h:1971
virtual void setVeinWidth(double veinWidth)
Definition: GiMaterial.h:1995
void setFactor(double factor)
Definition: GiMaterial.h:1534
OdCmEntityColor & color()
Definition: GiMaterial.h:1540
double factor() const
Definition: GiMaterial.h:1552
Method method() const
Definition: GiMaterial.h:1546
static ODGI_EXPORT_STATIC const OdGiMaterialColor kNull
Definition: GiMaterial.h:610
void setColor(const OdCmEntityColor &color)
Definition: GiMaterial.h:1564
void setMethod(Method method)
Definition: GiMaterial.h:1528
void setMapper(const OdGiMapper &mapper)
Definition: GiMaterial.h:1627
void setSourceFileName(const OdString &filename)
Definition: GiMaterial.h:1585
OdGiMapper & mapper()
Definition: GiMaterial.h:1597
void setTexture(OdGiMaterialTexturePtr pTexture)
Definition: GiMaterial.h:1633
const OdGiMaterialTexturePtr texture(void) const
Definition: GiMaterial.h:1639
OdString sourceFileName() const
Definition: GiMaterial.h:1609
Source source() const
Definition: GiMaterial.h:1603
static ODGI_EXPORT_STATIC const OdGiMaterialMap kNull
Definition: GiMaterial.h:1375
void setSource(Source source)
Definition: GiMaterial.h:1579
double blendFactor() const
Definition: GiMaterial.h:1615
void setBlendFactor(double blendFactor)
Definition: GiMaterial.h:1591
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:722
ODRX_DECLARE_MEMBERS(OdGiMaterialTexture)
virtual double luminance() const =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
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 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 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)
virtual const OdGiRasterImage * rasterImage() const
Definition: GiMaterial.h:1804
OdGiRasterImageTexture & operator=(const OdGiRasterImageTexture &texture)
Definition: GiMaterial.h:1819
ODRX_DECLARE_MEMBERS(OdGiRasterImageTexture)
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:1810
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:1825
virtual void setRasterImage(const OdGiRasterImage *pRasterImage)
Definition: GiMaterial.h:1798
static OdSmartPtr< OdGiVariant > createObject(const OdGiVariant &value)
virtual void setGrainThickness(double grainThickness)
Definition: GiMaterial.h:1897
virtual void setRadialNoise(double radialNoise)
Definition: GiMaterial.h:1873
virtual const OdGiMaterialColor & color2(void) const
Definition: GiMaterial.h:1867
virtual const OdGiMaterialColor & color1(void) const
Definition: GiMaterial.h:1855
OdGiWoodTexture & operator=(const OdGiWoodTexture &texture)
Definition: GiMaterial.h:1922
virtual double grainThickness(void) const
Definition: GiMaterial.h:1903
void copyFrom(const OdRxObject *pSource)
Definition: GiMaterial.h:1932
virtual void setColor2(const OdGiMaterialColor &woodColor2)
Definition: GiMaterial.h:1861
virtual Type type() const
Definition: GiMaterial.h:880
virtual void setAxialNoise(double axialNoise)
Definition: GiMaterial.h:1885
ODRX_DECLARE_MEMBERS(OdGiWoodTexture)
virtual double axialNoise(void) const
Definition: GiMaterial.h:1891
virtual double radialNoise(void) const
Definition: GiMaterial.h:1879
virtual bool operator==(const OdGiMaterialTexture &texture) const
Definition: GiMaterial.h:1909
virtual void setColor1(const OdGiMaterialColor &woodColor1)
Definition: GiMaterial.h:1849
virtual OdRxClass * isA() const
virtual void copyFrom(const OdRxObject *pSource)
static OdRxObjectPtr cast(const OdRxObject *pointer)
Definition: RxObject.h:640
OdRxObject * get()
Definition: RxObject.h:503
void release()
Definition: SmartPtr.h:264
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
@ kBox
Definition: AveDefs.h:119
@ kCylinder
Definition: AveDefs.h:120
@ kSphere
Definition: AveDefs.h:121
@ kWood
Definition: AveDefs.h:44
@ kMarble
Definition: AveDefs.h:43
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)
@ kPlanar
Definition: DbEntity.h:76
@ kNone
Light mode is inherited from the annotation.