Path Tracer
camera.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2020, 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 #pragma once
47 #ifndef AI_CAMERA_H_INC
48 #define AI_CAMERA_H_INC
49 
50 #ifdef __GNUC__
51 # pragma GCC system_header
52 #endif
53 
54 #include "types.h"
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 // ---------------------------------------------------------------------------
103 struct aiCamera
104 {
111  C_STRUCT aiString mName;
112 
119 
128  C_STRUCT aiVector3D mUp;
129 
130 
138  C_STRUCT aiVector3D mLookAt;
139 
147 
154 
164 
172  float mAspect;
173 
184 #ifdef __cplusplus
185 
186  aiCamera() AI_NO_EXCEPT
187  : mUp (0.f,1.f,0.f)
188  , mLookAt (0.f,0.f,1.f)
189  , mHorizontalFOV (0.25f * (float)AI_MATH_PI)
190  , mClipPlaneNear (0.1f)
191  , mClipPlaneFar (1000.f)
192  , mAspect (0.f)
193  , mOrthographicWidth (0.f)
194  {}
195 
199  void GetCameraMatrix (aiMatrix4x4& out) const
200  {
204  aiVector3D zaxis = mLookAt; zaxis.Normalize();
205  aiVector3D yaxis = mUp; yaxis.Normalize();
206  aiVector3D xaxis = mUp^mLookAt; xaxis.Normalize();
207 
208  out.a4 = -(xaxis * mPosition);
209  out.b4 = -(yaxis * mPosition);
210  out.c4 = -(zaxis * mPosition);
211 
212  out.a1 = xaxis.x;
213  out.a2 = xaxis.y;
214  out.a3 = xaxis.z;
215 
216  out.b1 = yaxis.x;
217  out.b2 = yaxis.y;
218  out.b3 = yaxis.z;
219 
220  out.c1 = zaxis.x;
221  out.c2 = zaxis.y;
222  out.c3 = zaxis.z;
223 
224  out.d1 = out.d2 = out.d3 = 0.f;
225  out.d4 = 1.f;
226  }
227 
228 #endif
229 };
230 
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif // AI_CAMERA_H_INC
aiVector3D
Definition: vector3.h:136
types.h
aiCamera::mClipPlaneFar
float mClipPlaneFar
Definition: camera.h:163
aiCamera::mAspect
float mAspect
Definition: camera.h:172
aiCamera
Definition: camera.h:104
aiCamera::mLookAt
C_STRUCT aiVector3D mLookAt
Definition: camera.h:138
aiCamera::mName
C_STRUCT aiString mName
Definition: camera.h:111
aiString
Definition: types.h:266
aiCamera::mOrthographicWidth
float mOrthographicWidth
Definition: camera.h:183
aiCamera::mPosition
C_STRUCT aiVector3D mPosition
Definition: camera.h:118
aiCamera::mClipPlaneNear
float mClipPlaneNear
Definition: camera.h:153
aiCamera::mUp
C_STRUCT aiVector3D mUp
Definition: camera.h:128
aiMatrix4x4
Definition: matrix4x4.h:266
aiCamera::mHorizontalFOV
float mHorizontalFOV
Definition: camera.h:146