4 Copyright 2008-2012 Michel Pollet <buserror@gmail.com>
5 Copyright (c) 1998 Paul Rademacher
7 This file is part of simavr.
9 simavr 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 simavr 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 simavr. If not, see <http://www.gnu.org/licenses/>.
26 #include "c3algebra.h"
28 typedef struct c3cam {
30 c3vec3 up, side, forward;
35 /******************************* set_distance() ***********/
36 /* This readjusts the distance from the eye to the lookat */
37 /* (changing the eye point in the process) */
38 /* The lookat point is unaffected */
42 const c3f new_distance);
44 /******************************* set_up() ***************/
56 /******************************* set_eye() ***************/
60 const c3vec3 new_eye);
68 /******************************* set_lookat() ***************/
72 const c3vec3 new_lookat);
80 /******************************* roll() *****************/
81 /* Rotates about the forward vector */
82 /* eye and lookat remain unchanged */
88 /******************************* eye_yaw() *********************/
89 /* Rotates the eye about the lookat point, using the up vector */
90 /* Lookat is unaffected */
96 /******************************* eye_yaw_abs() ******************/
97 /* Rotates the eye about the lookat point, with a specific axis */
98 /* Lookat is unaffected */
105 /******************************* eye_pitch() ************/
106 /* Rotates the eye about the side vector */
107 /* Lookat is unaffected */
113 /******************************* lookat_yaw()************/
114 /* This assumes the up vector is correct. */
115 /* Rotates the lookat about the side vector */
116 /* Eye point is unaffected */
122 /******************************* lookat_pitch() *********/
123 /* Rotates the lookat point about the side vector */
124 /* This assumes the side vector is correct. */
125 /* Eye point is unaffected */
131 /******************************* reset_up() ******************/
132 /* Resets the up vector to a specified axis (0=X, 1=Y, 2=Z) */
133 /* Also sets the eye point level with the lookat point, */
134 /* along the specified axis */
143 /******************************* move() ********************/
144 /* Moves a specified distance in the forward, side, and up */
145 /* directions. This function does NOT move by world */
146 /* coordinates. To move by world coords, use the move_abs */
153 const c3f forw_move);
157 const c3vec3 v); /* A vector version of the above command */
159 /******************************* move_by_eye() ***********/
160 /* Sets the eye point, AND moves the lookat point by the */
161 /* same amount as the eye is moved. */
165 const c3vec3 new_eye);
167 /******************************* move_by_lookat() *********/
168 /* Sets the lookat point, AND moves the eye point by the */
169 /* same amount as the lookat is moved. */
171 c3cam_move_by_lookat(
173 const c3vec3 new_lookat);
175 /******************************* move_abs() *****************/
176 /* Move the eye and lookat in world coordinates */
182 /****************************** rot_about_eye() ************/
183 /* Rotates the lookat point about the eye, based on a 4x4 */
184 /* (pure) rotation matrix */
190 /****************************** rot_about_lookat() ************/
191 /* Rotates the lookat point about the lookat, based on a 4x4 */
192 /* (pure) rotation matrix */
194 c3cam_rot_about_lookat(
198 /******************************* make_mtx() *************/
199 /* Constructs a 4x4 matrix - used by load_to_openGL() */
204 /******************************* load_to_openGL() ********/
205 /* Sets the OpenGL modelview matrix based on the current */
206 /* camera coordinates */
207 //void c3cam_load_to_openGL();
209 /******************************* load_to_openGL_noident() ******/
210 /* Multiplies the current camera matrix by the existing openGL */
211 /* modelview matrix. This is same as above function, but */
212 /* does not set the OpenGL matrix to identity first */
213 //void c3cam_load_to_openGL_noident();
215 /******************************* reset() ****************/
216 /* Resets the parameters of this class */
221 /******************************* ViewModel() ************/
225 /******************************* update() ****************/
226 /* updates the view params. Call this after making */
227 /* direct changes to the vectors or points of this class */
231 /******************************* dump() *******************/
232 /* Prints the contents of this class to a file, typically */
233 /* stdin or stderr */
234 //void c3cam_dump(FILE *output);
236 #endif /* __C3VIEW_H___ */