BRE12
camera.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2012, assimp team
7 
8 All rights reserved.
9 
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
13 
14 * Redistributions of source code must retain the above
15  copyright notice, this list of conditions and the
16  following disclaimer.
17 
18 * Redistributions in binary form must reproduce the above
19  copyright notice, this list of conditions and the
20  following disclaimer in the documentation and/or other
21  materials provided with the distribution.
22 
23 * Neither the name of the assimp team, nor the names of its
24  contributors may be used to endorse or promote products
25  derived from this software without specific prior
26  written permission of the assimp team.
27 
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
41 
46 #ifndef AI_CAMERA_H_INC
47 #define AI_CAMERA_H_INC
48 
49 #include "types.h"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 // ---------------------------------------------------------------------------
98 struct aiCamera
99 {
106  C_STRUCT aiString mName;
107 
114 
115 
124  C_STRUCT aiVector3D mUp;
125 
126 
134  C_STRUCT aiVector3D mLookAt;
135 
136 
144 
151 
161 
162 
170  float mAspect;
171 
172 #ifdef __cplusplus
173 
174  aiCamera()
175  : mUp (0.f,1.f,0.f)
176  , mLookAt (0.f,0.f,1.f)
177  , mHorizontalFOV (0.25f * (float)AI_MATH_PI)
178  , mClipPlaneNear (0.1f)
179  , mClipPlaneFar (1000.f)
180  , mAspect (0.f)
181  {}
182 
186  void GetCameraMatrix (aiMatrix4x4& out) const
187  {
191  aiVector3D zaxis = mLookAt; zaxis.Normalize();
192  aiVector3D yaxis = mUp; yaxis.Normalize();
193  aiVector3D xaxis = mUp^mLookAt; xaxis.Normalize();
194 
195  out.a4 = -(xaxis * mPosition);
196  out.b4 = -(yaxis * mPosition);
197  out.c4 = -(zaxis * mPosition);
198 
199  out.a1 = xaxis.x;
200  out.a2 = xaxis.y;
201  out.a3 = xaxis.z;
202 
203  out.b1 = yaxis.x;
204  out.b2 = yaxis.y;
205  out.b3 = yaxis.z;
206 
207  out.c1 = zaxis.x;
208  out.c2 = zaxis.y;
209  out.c3 = zaxis.z;
210 
211  out.d1 = out.d2 = out.d3 = 0.f;
212  out.d4 = 1.f;
213  }
214 
215 #endif
216 };
217 
218 
219 #ifdef __cplusplus
220 }
221 #endif
222 
223 #endif // AI_CAMERA_H_INC
Basic data types and primitives, such as vectors or colors.
Definition: matrix4x4.h:236
C_STRUCT aiVector3D mUp
'Up' - vector of the camera coordinate system relative to the coordinate space defined by the corresp...
Definition: camera.h:124
Helper structure to describe a virtual camera.
Definition: camera.h:98
C_STRUCT aiVector3D mPosition
Position of the camera relative to the coordinate space defined by the corresponding node...
Definition: camera.h:113
Represents an UTF-8 string, zero byte terminated.
Definition: types.h:251
float mClipPlaneNear
Distance of the near clipping plane from the camera.
Definition: camera.h:150
Definition: vector3.h:134
float mClipPlaneFar
Distance of the far clipping plane from the camera.
Definition: camera.h:160
C_STRUCT aiString mName
The name of the camera.
Definition: camera.h:106
float mHorizontalFOV
Half horizontal field of view angle, in radians.
Definition: camera.h:143
C_STRUCT aiVector3D mLookAt
'LookAt' - vector of the camera coordinate system relative to the coordinate space defined by the cor...
Definition: camera.h:134
float mAspect
Screen aspect ratio.
Definition: camera.h:170