4 Copyright 2008-2012 Michel Pollet <buserror@gmail.com>
5 Copyright (c) 1998 Paul Rademacher
7 This file is part of libc3.
9 libc3 is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 libc3 is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with libc3. If not, see <http://www.gnu.org/licenses/>.
26 #include "c3algebra.h"
28 typedef struct c3cam_t {
30 c3vec3 up, side, forward;
36 /******************************* set_distance() ***********/
37 /* This readjusts the distance from the eye to the lookat */
38 /* (changing the eye point in the process) */
39 /* The lookat point is unaffected */
43 const c3f new_distance);
45 /******************************* set_up() ***************/
57 /******************************* set_eye() ***************/
61 const c3vec3 new_eye);
69 /******************************* set_lookat() ***************/
73 const c3vec3 new_lookat);
81 /******************************* roll() *****************/
82 /* Rotates about the forward vector */
83 /* eye and lookat remain unchanged */
89 /******************************* eye_yaw() *********************/
90 /* Rotates the eye about the lookat point, using the up vector */
91 /* Lookat is unaffected */
97 /******************************* eye_yaw_abs() ******************/
98 /* Rotates the eye about the lookat point, with a specific axis */
99 /* Lookat is unaffected */
106 /******************************* eye_pitch() ************/
107 /* Rotates the eye about the side vector */
108 /* Lookat is unaffected */
114 /******************************* lookat_yaw()************/
115 /* This assumes the up vector is correct. */
116 /* Rotates the lookat about the side vector */
117 /* Eye point is unaffected */
123 /******************************* lookat_pitch() *********/
124 /* Rotates the lookat point about the side vector */
125 /* This assumes the side vector is correct. */
126 /* Eye point is unaffected */
132 /******************************* reset_up() ******************/
133 /* Resets the up vector to a specified axis (0=X, 1=Y, 2=Z) */
134 /* Also sets the eye point level with the lookat point, */
135 /* along the specified axis */
144 /******************************* move() ********************/
145 /* Moves a specified distance in the forward, side, and up */
146 /* directions. This function does NOT move by world */
147 /* coordinates. To move by world coords, use the move_abs */
154 const c3f forw_move);
158 const c3vec3 v); /* A vector version of the above command */
160 /******************************* move_by_eye() ***********/
161 /* Sets the eye point, AND moves the lookat point by the */
162 /* same amount as the eye is moved. */
166 const c3vec3 new_eye);
168 /******************************* move_by_lookat() *********/
169 /* Sets the lookat point, AND moves the eye point by the */
170 /* same amount as the lookat is moved. */
172 c3cam_move_by_lookat(
174 const c3vec3 new_lookat);
176 /******************************* move_abs() *****************/
177 /* Move the eye and lookat in world coordinates */
183 /****************************** rot_about_eye() ************/
184 /* Rotates the lookat point about the eye, based on a 4x4 */
185 /* (pure) rotation matrix */
191 /****************************** rot_about_lookat() ************/
192 /* Rotates the lookat point about the lookat, based on a 4x4 */
193 /* (pure) rotation matrix */
195 c3cam_rot_about_lookat(
199 /******************************* make_mtx() *************/
200 /* Constructs a 4x4 matrix - used by load_to_openGL() */
205 /******************************* load_to_openGL() ********/
206 /* Sets the OpenGL modelview matrix based on the current */
207 /* camera coordinates */
208 //void c3cam_load_to_openGL();
210 /******************************* load_to_openGL_noident() ******/
211 /* Multiplies the current camera matrix by the existing openGL */
212 /* modelview matrix. This is same as above function, but */
213 /* does not set the OpenGL matrix to identity first */
214 //void c3cam_load_to_openGL_noident();
216 /******************************* reset() ****************/
217 /* Resets the parameters of this class */
222 /******************************* c3cam_t() ************/
230 /******************************* update() ****************/
231 /* updates the view params. Call this after making */
232 /* direct changes to the vectors or points of this class */
236 #endif /* __C3VIEW_H___ */