
####################
A3DGraphMaterialData
####################

.. c:struct:: A3DGraphMaterialData

   Material properties descriptor.
   
   
      2.0
   
   
   Material properties describes the behaviour of a surface to light emissions, allowing a 3D surface to be represented with realistic responses to light source emissions.
   
   Basic lighting refers to the most standard lighting methods applied within 3D rendering applications, such as with classic OpenGL.
   
   Basic material properties are:
   
   
   - *Ambient lighting*\ (``m_uiAmbient``\ ) is the light an object gives even in the absence of lighting environment.
   - *Diffuse lighting*\ (``m_uiDiffuse``\ ) relies on the surface orientation and light direction. It results in changes across the surface of an object.
   - *Specular lighting*\ (``m_uiEmissive``\ ) simulates the bright effect when a light hits an object and reflects back to the viewer. It relies on the surface and light properties as well ad the viewer's position.
   - *Emissive lighting*\ (``m_uiSpecular``\ , ``m_dShininess``\ ) is the light which is emitted by an object, such as a light bulb. When an emissive light is used in a graphics scene, it is processed the same as a light source.
   
   These properties are used within graphical applications to simulate shading, such as with`Gouraud <https://en.wikipedia.org/wiki/Gouraud_shading>`__\ or`Phong <https://en.wikipedia.org/wiki/Phong_shading>`__\ .
   
   Lights are represented using red-green-blue (RGB) color codes. Within ``A3DGraphMaterialData``\ these colors are indexed into a global state and can be queried using their respective indexes and ``A3DGlobalGetGraphRgbColorData``\ . The following code retrieves the diffuse color from ``material``\ , assuming a light gray as default:
   
   
   ::
   
      A3DGraphRgbColorDatargb_diffuse=A3D_MAKE_DATA(A3DGraphRgbColorData);
      rgb_diffuse.m_dRed=rgb_diffuse.m_dGreen=rgb_diffuse.m_dBlue=0.75f;
      A3DStatusresult=A3DGlobalGetGraphRgbColorData(material.m_uiDiffuse,&rgb_diffuse);
      assert(result==A3D_SUCCESS||result==A3D_DEFAULT_COLOR);
   
   Most material instances are stored within the global state and identified using an index. It is then possible to retrieve the actual material content by calling ``A3DGlobalGetGraphMaterialData``\ . Like with any other entity, a material can be associated to metadata known as generic attributes. These attributes can hold any data and extend the capabilities of the associated ``A3DGraphMaterialData``\ instance. For example, physically-based rendering is implemented in HOOPS using generic attributes. To obtain these attributes, use ``A3DMiscPointerFromIndexGet``\ instead which returns the underlying ``A3DSDKRootEntity``\ instance.
   
   
   ::
   
      //Retrievestheunderlyingentityofagloballystoredmaterialobjectusing
      //itsindex`i`.
      A3DEntity*material_handle=A3D_NULL_HANDLE;
      A3DStatusresult=A3DMiscPointerFromIndexGet(i,kA3DTypeGraphMaterial,&material_handle);
      assert(result==A3D_SUCCESS);
      assert(material_handle!=0);
      
      A3DRootBaseDataroot_base=A3D_MAKE_DATA(A3DRootBaseData);
      result=A3DRootBaseGet(material_handle,&root_base);
      assert(result==A3D_SUCCESS);
   
   Then the generic attributes can be browsed from the ``A3DRootBaseData``\ instance.
   
   
   Index
   =====
   
   .. rubric:: Variables
   
   
   .. rst-class:: api-xref-list
   
   
   * :c:member:`~A3DGraphMaterialData.m_uiAmbient`
   * :c:member:`~A3DGraphMaterialData.m_uiDiffuse`
   * :c:member:`~A3DGraphMaterialData.m_uiEmissive`
   * :c:member:`~A3DGraphMaterialData.m_uiSpecular`
   * :c:member:`~A3DGraphMaterialData.m_dAmbientAlpha`
   * :c:member:`~A3DGraphMaterialData.m_dDiffuseAlpha`
   * :c:member:`~A3DGraphMaterialData.m_dEmissiveAlpha`
   * :c:member:`~A3DGraphMaterialData.m_dSpecularAlpha`
   * :c:member:`~A3DGraphMaterialData.m_dShininess`
   
   



.. rst-class:: kind-group kind-variable

.. rubric:: Variables
   :class: kind-group-title


.. c:member:: A3DUns32 A3DGraphMaterialData.m_uiAmbient

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      The global index for the Ambient light.
      



.. c:member:: A3DUns32 A3DGraphMaterialData.m_uiDiffuse

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      The global index for the Diffuse light.
      



.. c:member:: A3DUns32 A3DGraphMaterialData.m_uiEmissive

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      The global index for the Emissive light.
      



.. c:member:: A3DUns32 A3DGraphMaterialData.m_uiSpecular

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DUns32`
      
      The global index for the Specular light.
      



.. c:member:: A3DDouble A3DGraphMaterialData.m_dAmbientAlpha

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DDouble`
      
      An additional alpha channel for ambient ligthing.
      



.. c:member:: A3DDouble A3DGraphMaterialData.m_dDiffuseAlpha

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DDouble`
      
      An additional alpha channel for diffuse ligthing.
      



.. c:member:: A3DDouble A3DGraphMaterialData.m_dEmissiveAlpha

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DDouble`
      
      An additional alpha channel for emissive ligthing.
      



.. c:member:: A3DDouble A3DGraphMaterialData.m_dSpecularAlpha

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DDouble`
      
      An additional alpha channel for specular ligthing.
      



.. c:member:: A3DDouble A3DGraphMaterialData.m_dShininess

      .. rst-class:: sig-pretty-signature
      
         | :c:type:`~A3DDouble`
      
      The shininess value. For example, usual values may range into 0.0 (no shininess), 5.0 (low) or 100.0 (high).
      




