aiCamera.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2008, 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. /** @file Defines the aiCamera data structure
  35. */
  36. #ifndef AI_CAMERA_H_INC
  37. #define AI_CAMERA_H_INC
  38. #include "aiTypes.h"
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. // ---------------------------------------------------------------------------
  43. /** Helper structure to describe a virtual camera.
  44. *
  45. * Cameras have a representation in the node graph and can be animated.
  46. * Note - some file formats (such as 3DS, ASE) export a "target point" -
  47. * the point the camera is looking at (it can even be animated). Assimp
  48. * writes the target point as a subnode of the camera's main node,
  49. * called "<camName>.Target". However, this is just additional information
  50. * then, the transformation tracks of the camera main node make the
  51. * camera already point in the right direction.
  52. *
  53. */
  54. struct aiCamera
  55. {
  56. /** The name of the camera.
  57. *
  58. * There must be a node in the scenegraph with the same name.
  59. * This node specifies the position of the camera in the scene
  60. * hierarchy and can be animated.
  61. */
  62. aiString mName;
  63. /** Position of the camera relative to the coordinate space
  64. * defined by the corresponding node.
  65. *
  66. * The default value is 0|0|0.
  67. */
  68. aiVector3D mPosition;
  69. /** 'Up' - vector of the camera coordinate system relative to
  70. * the coordinate space defined by the corresponding node.
  71. *
  72. * The 'right' vector of the camera coordinate system is
  73. * the cross product of the up and lookAt vectors.
  74. * The default value is 0|1|0. The vector
  75. * may be normalized, but it needn't.
  76. */
  77. aiVector3D mUp;
  78. /** 'LookAt' - vector of the camera coordinate system relative to
  79. * the coordinate space defined by the corresponding node.
  80. *
  81. * This is the viewing direction of the user.
  82. * The default value is 0|0|1. The vector
  83. * may be normalized, but it needn't.
  84. */
  85. aiVector3D mLookAt;
  86. /** Half horizontal field of view angle, in radians.
  87. *
  88. * The field of view angle is the angle between the center
  89. * line of the screen and the left or right border.
  90. * The default value is 1/4PI.
  91. */
  92. float mHorizontalFOV;
  93. /** Distance of the near clipping plane from the camera.
  94. *
  95. * The value may not be 0.f (for arithmetic reasons to prevent
  96. * a division through zero). The default value is 0.1f.
  97. */
  98. float mClipPlaneNear;
  99. /** Distance of the far clipping plane from the camera.
  100. *
  101. * The far clipping plane must, of course, be farer away than the
  102. * near clipping plane. The default value is 1000.f. The radio
  103. * between the near and the far plane should not be too
  104. * large (between 1000-10000 should be ok) to avoid floating-point
  105. * inaccuracies which could lead to z-fighting.
  106. */
  107. float mClipPlaneFar;
  108. /** Screen aspect ratio.
  109. *
  110. * This is the ration between the width and the height of the
  111. * screen. Typical values are 4/3, 1/2 or 1/1. This value is
  112. * 0 if the aspect ratio is not defined in the source file.
  113. * 0 is also the default value.
  114. */
  115. float mAspect;
  116. #ifdef __cplusplus
  117. aiCamera()
  118. : mUp (0.f,1.f,0.f)
  119. , mLookAt (0.f,0.f,1.f)
  120. , mHorizontalFOV (0.25f * (float)AI_MATH_PI)
  121. , mClipPlaneNear (0.1f)
  122. , mClipPlaneFar (1000.f)
  123. , mAspect (0.f)
  124. {
  125. }
  126. #endif
  127. };
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif // AI_CAMERA_H_INC