00001 /********************************************************************* 00002 * lescegra * 00003 * * 00004 * http://geeky.kicks-ass.org/projects/lescegra.html * 00005 * * 00006 * Copyright 2003 by Enno Cramer <uebergeek@web.de> * 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Library General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free * 00020 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 *********************************************************************/ 00022 00023 #ifndef LSG_PERSPECTIVECAM_H 00024 #define LSG_PERSPECTIVECAM_H 1 00025 00026 /** 00027 * \file perspectivecam.h 00028 * \brief Perspective camera with location and lookat 00029 */ 00030 00031 #include <lescegra/sg/camera.h> 00032 00033 #include <lescegra/util/vertex.h> 00034 00035 /** 00036 * \brief Perspective camera with location and lookat 00037 * 00038 * A perspective camera that is defined by the three vertices location, lookat 00039 * and up, the field-of-view and a minimal and maximal viewing distance. 00040 */ 00041 typedef struct { 00042 LsgCamera super; 00043 Vertex location; 00044 Vertex lookat; 00045 Vertex up; 00046 float fovy; 00047 float aspect; 00048 float dmin; 00049 float dmax; 00050 } LsgPerspectiveCam; 00051 00052 00053 /** 00054 * Allocate and initialize a LsgPerspectiveCam. 00055 * @return A new LsgPerspectiveCam instance 00056 */ 00057 LsgPerspectiveCam* LsgPerspectiveCam_create(void); 00058 00059 /** 00060 * Constructor method for LsgPerspectiveCam. Initialize the camera as looking from 00061 * {0, 0, -1} to the center of the coordinate system with the second (y) axis 00062 * being up. The initial field-of-view is 45 degrees in both directions. 00063 * @param self The instance variable 00064 */ 00065 void LsgPerspectiveCam_init(LsgPerspectiveCam* self); 00066 00067 /** 00068 * Display a node as seen using this camera. 00069 * @param self The instance variable 00070 * @param frustum The initial view frustum 00071 * @param node The node to display 00072 */ 00073 void LsgPerspectiveCam_display(LsgPerspectiveCam* self, LsgFrustum* frust, LsgNode* node); 00074 00075 /** 00076 * Destructor method for LsgPerspectiveCam. Reuse parent implementation. 00077 */ 00078 #define LsgPerspectiveCam_destroy(self) LsgCamera_destroy(&(self)->super) 00079 00080 #endif