You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

216 lines
7.5 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2009, ASSIMP Development Team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the ASSIMP team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the ASSIMP Development Team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /**
  35. * Contains the data structures which are used to store the imported information
  36. * about the light sources in the scene.
  37. */
  38. module assimp.light;
  39. import assimp.math;
  40. import assimp.types;
  41. extern ( C ) {
  42. /**
  43. * Enumerates all supported types of light sources.
  44. */
  45. enum aiLightSourceType : uint {
  46. UNDEFINED = 0x0,
  47. /**
  48. * A directional light source has a well-defined direction but is
  49. * infinitely far away. That's quite a good approximation for sun light.
  50. */
  51. DIRECTIONAL = 0x1,
  52. /**
  53. * A point light source has a well-defined position in space but no
  54. * direction – it emits light in all directions. A normal bulb is a point
  55. * light.
  56. */
  57. POINT = 0x2,
  58. /**
  59. * A spot light source emits light in a specific angle. It has a position
  60. * and a direction it is pointing to. A good example for a spot light is
  61. * a light spot in sport arenas.
  62. */
  63. SPOT = 0x3
  64. }
  65. /**
  66. * Helper structure to describe a light source.
  67. *
  68. * Assimp supports multiple sorts of light sources, including directional,
  69. * point and spot lights. All of them are defined with just a single
  70. * structure and distinguished by their parameters.
  71. *
  72. * Note: Some file formats (such as 3DS, ASE) export a "target point" – the
  73. * point a spot light is looking at (it can even be animated). Assimp
  74. * writes the target point as a subnode of a spotlights's main node, called
  75. * <code>[spotName].Target</code>. However, this is just additional
  76. * information then, the transformation tracks of the main node make the
  77. * spot light already point in the right direction.
  78. */
  79. struct aiLight {
  80. /**
  81. * The name of the light source.
  82. *
  83. * There must be a node in the scenegraph with the same name. This node
  84. * specifies the position of the light in the scenehierarchy and can be
  85. * animated.
  86. */
  87. aiString mName;
  88. /**
  89. * The type of the light source.
  90. *
  91. * <code>aiLightSource.UNDEFINED</code> is not a valid value for this
  92. * member.
  93. */
  94. aiLightSourceType mType;
  95. /**
  96. * Position of the light source in space. Relative to the transformation
  97. * of the node corresponding to the light.
  98. *
  99. * The position is undefined for directional lights.
  100. */
  101. aiVector3D mPosition;
  102. /**
  103. * Direction of the light source in space. Relative to the transformation
  104. * of the node corresponding to the light.
  105. *
  106. * The direction is undefined for point lights. The vector may be
  107. * normalized, but it needn't.
  108. */
  109. aiVector3D mDirection;
  110. /**
  111. * Constant light attenuation factor.
  112. *
  113. * The intensity of the light source at a given distance
  114. * <code>d</code> from the light's position is
  115. * <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
  116. * corresponds to the <code>att0</code> variable in the equation.
  117. *
  118. * Naturally undefined for directional lights.
  119. */
  120. float mAttenuationConstant;
  121. /**
  122. * Linear light attenuation factor.
  123. *
  124. * The intensity of the light source at a given distance
  125. * <code>d</code> from the light's position is
  126. * <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
  127. * corresponds to the <code>att1</code> variable in the equation.
  128. *
  129. * Naturally undefined for directional lights.
  130. */
  131. float mAttenuationLinear;
  132. /**
  133. * Quadratic light attenuation factor.
  134. *
  135. * The intensity of the light source at a given distance
  136. * <code>d</code> from the light's position is
  137. * <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
  138. * corresponds to the <code>att2</code> variable in the equation.
  139. *
  140. * Naturally undefined for directional lights.
  141. */
  142. float mAttenuationQuadratic;
  143. /**
  144. * Diffuse color of the light source
  145. *
  146. * The diffuse light color is multiplied with the diffuse material color
  147. * to obtain the final color that contributes to the diffuse shading term.
  148. */
  149. aiColor3D mColorDiffuse;
  150. /**
  151. * Specular color of the light source
  152. *
  153. * The specular light color is multiplied with the specular material
  154. * color to obtain the final color that contributes to the specular
  155. * shading term.
  156. */
  157. aiColor3D mColorSpecular;
  158. /**
  159. * Ambient color of the light source
  160. *
  161. * The ambient light color is multiplied with the ambient material color
  162. * to obtain the final color that contributes to the ambient shading term.
  163. *
  164. * Most renderers will ignore this value it, is just a remaining of the
  165. * fixed-function pipeline that is still supported by quite many file
  166. * formats.
  167. */
  168. aiColor3D mColorAmbient;
  169. /**
  170. * Inner angle of a spot light's light cone.
  171. *
  172. * The spot light has maximum influence on objects inside this angle. The
  173. * angle is given in radians. It is 2PI for point lights and undefined
  174. * for directional lights.
  175. */
  176. float mAngleInnerCone;
  177. /**
  178. * Outer angle of a spot light's light cone.
  179. *
  180. * The spot light does not affect objects outside this angle. The angle
  181. * is given in radians. It is 2PI for point lights and undefined for
  182. * directional lights. The outer angle must be greater than or equal to
  183. * the inner angle.
  184. *
  185. * It is assumed that the application uses a smooth interpolation between
  186. * the inner and the outer cone of the spot light.
  187. */
  188. float mAngleOuterCone;
  189. }
  190. }