dbmaterial.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #pragma once
  11. #include "dbmain.h"
  12. #include "acgimaterial.h"
  13. #pragma pack (push, 8)
  14. class AcDbMaterial : public AcDbObject
  15. {
  16. public:
  17. ACDB_DECLARE_MEMBERS(AcDbMaterial);
  18. AcDbMaterial();
  19. virtual ~AcDbMaterial();
  20. // AcDbMaterial protocol
  21. //
  22. virtual Acad::ErrorStatus setName (const ACHAR * pName);
  23. virtual const ACHAR * name (void) const;
  24. virtual Acad::ErrorStatus setDescription(const ACHAR * pDescription);
  25. virtual const ACHAR * description(void) const;
  26. virtual void setAmbient (const AcGiMaterialColor & color);
  27. virtual void ambient (AcGiMaterialColor & color) const;
  28. virtual void setDiffuse (const AcGiMaterialColor & color,
  29. const AcGiMaterialMap & map);
  30. virtual void diffuse (AcGiMaterialColor & color,
  31. AcGiMaterialMap & map) const;
  32. virtual void setSpecular (const AcGiMaterialColor & color,
  33. const AcGiMaterialMap & map,
  34. double dGloss);
  35. virtual void specular (AcGiMaterialColor & color,
  36. AcGiMaterialMap & map,
  37. double & dGloss) const;
  38. virtual void setReflection (const AcGiMaterialMap & map);
  39. virtual void reflection (AcGiMaterialMap & map) const;
  40. virtual void setOpacity (double dPercentage,
  41. const AcGiMaterialMap & map);
  42. virtual void opacity (double & dPercentage,
  43. AcGiMaterialMap & map) const;
  44. virtual void setBump (const AcGiMaterialMap & map);
  45. virtual void bump (AcGiMaterialMap & map) const;
  46. virtual void setRefraction (double dIndex,
  47. const AcGiMaterialMap & map);
  48. virtual void refraction (double & dIndex,
  49. AcGiMaterialMap & map) const;
  50. virtual double translucence() const;
  51. virtual Acad::ErrorStatus setTranslucence(double value);
  52. virtual double selfIllumination() const;
  53. virtual Acad::ErrorStatus setSelfIllumination(double value);
  54. virtual double reflectivity() const;
  55. virtual Acad::ErrorStatus setReflectivity(double value);
  56. virtual AcGiMaterialTraits::IlluminationModel illuminationModel() const;
  57. virtual Acad::ErrorStatus setIlluminationModel(AcGiMaterialTraits::IlluminationModel model);
  58. virtual AcGiMaterialTraits::ChannelFlags channelFlags() const;
  59. virtual Acad::ErrorStatus setChannelFlags(AcGiMaterialTraits::ChannelFlags value);
  60. virtual AcGiMaterialTraits::Mode mode() const;
  61. virtual Acad::ErrorStatus setMode(AcGiMaterialTraits::Mode value);
  62. // AcDbObject protocol
  63. //
  64. virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
  65. virtual Acad::ErrorStatus dwgOutFields (AcDbDwgFiler* pFiler) const;
  66. virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler* pFiler);
  67. virtual Acad::ErrorStatus dxfOutFields (AcDbDxfFiler* pFiler) const;
  68. virtual AcGiDrawable* drawable (void);
  69. // AcDbMaterial protocol, new material properties for Spago
  70. double colorBleedScale () const;
  71. Acad::ErrorStatus setColorBleedScale (double value);
  72. double indirectBumpScale () const;
  73. Acad::ErrorStatus setIndirectBumpScale (double value);
  74. double reflectanceScale () const;
  75. Acad::ErrorStatus setReflectanceScale (double value);
  76. double transmittanceScale () const;
  77. Acad::ErrorStatus setTransmittanceScale (double value);
  78. Adesk::Boolean twoSided () const;
  79. Acad::ErrorStatus setTwoSided (Adesk::Boolean value);
  80. AcGiMaterialTraits::LuminanceMode luminanceMode () const;
  81. Acad::ErrorStatus setLuminanceMode (AcGiMaterialTraits::LuminanceMode value);
  82. double luminance () const;
  83. Acad::ErrorStatus setLuminance (double value);
  84. double shininess () const;
  85. Acad::ErrorStatus setShininess (double value);
  86. Acad::ErrorStatus normalMap (AcGiMaterialMap & map,
  87. AcGiMaterialTraits::NormalMapMethod & method,
  88. double & strength) const;
  89. Acad::ErrorStatus setNormalMap (const AcGiMaterialMap & map,
  90. AcGiMaterialTraits::NormalMapMethod method,
  91. double strength);
  92. Adesk::Boolean isAnonymous () const;
  93. Acad::ErrorStatus setAnonymous (Adesk::Boolean isAnonymous);
  94. AcGiMaterialTraits::GlobalIlluminationMode globalIllumination() const;
  95. void setGlobalIllumination (AcGiMaterialTraits::GlobalIlluminationMode mode);
  96. AcGiMaterialTraits::FinalGatherMode finalGather() const;
  97. void setFinalGather (AcGiMaterialTraits::FinalGatherMode mode);
  98. bool isRenamable () const;
  99. // WARNING: Caller must **NOT** delete the returned pointer.
  100. //
  101. #ifdef _ADESK_MAC_
  102. void* getAdskMaterialData();
  103. #else
  104. void* getAdskMaterialData() const;
  105. #endif
  106. // WARNING: If bCacheIt == true, then AcDbMaterial takes over responsibility for
  107. // deleting pMatObj and caller must ensure that nothing else deletes it.
  108. //
  109. Acad::ErrorStatus setAdskMaterialData(const void* pMatObj, bool bCacheIt = false);
  110. void clearAdskMaterialCache();
  111. enum MaterialFlags {
  112. kNone = 0,
  113. kIsLegacy = 0x1,
  114. kIsModifiedIsValid = 0x2,
  115. kIsModified = 0x4,
  116. kIsModifiedAndValid = 0x6 // kIsModifiedIsValid | kIsModified
  117. };
  118. Acad::ErrorStatus getAdskMaterialFlags(MaterialFlags& flags) const;
  119. Acad::ErrorStatus setAdskMaterialFlags(MaterialFlags flags);
  120. protected:
  121. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  122. };
  123. #pragma pack (pop)