+++ /dev/null
-/*\r
- * GPAC - Multimedia Framework C SDK\r
- *\r
- * Copyright (c) Jean Le Feuvre 2000-2005\r
- * All rights reserved\r
- *\r
- * This file is part of GPAC / Scene Compositor sub-project\r
- *\r
- * GPAC is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU Lesser General Public License as published by\r
- * the Free Software Foundation; either version 2, or (at your option)\r
- * any later version.\r
- * \r
- * GPAC is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; see the file COPYING. If not, write to\r
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
- *\r
- */\r
-\r
-#ifndef _CAMERA_H_\r
-#define _CAMERA_H_\r
-\r
-//#include <gpac/internal/compositor_dev.h>\r
-#include <gpac/scenegraph_vrml.h>\r
-\r
-/*camera flags*/\r
-enum\r
-{\r
- /*if set frustum needs to be recomputed\r
- we avoid computing it at each frame/interaction since that's a lot of matrix maths*/\r
- CAM_IS_DIRTY = 1,\r
- /*if set when ortho, indicates the viewport matrix shall be used when computing modelview (2D only)*/\r
- CAM_HAS_VIEWPORT = 1<<2,\r
-};\r
-\r
-enum\r
-{\r
- /*only valid at root node*/\r
- CULL_NOT_SET = 0,\r
- /*subtree completely outside view vol*/\r
- CULL_OUTSIDE,\r
- /*subtree completely inside view vol*/\r
- CULL_INSIDE,\r
- /*subtree overlaps view vol - FIXME: would be nice to keep track of intersecting planes*/\r
- CULL_INTERSECTS\r
-};\r
-\r
-/*navigation info flags - non-VRML ones are simply blaxxun contact ones */\r
-enum\r
-{\r
- /*headlight is on*/\r
- NAV_HEADLIGHT = 1,\r
- /*any navigation (eg, user-interface navigation control allowed)*/\r
- NAV_ANY = 1<<1\r
-};\r
-\r
-/*frustum object*/\r
-enum\r
-{\r
- FRUS_NEAR_PLANE = 0,\r
- FRUS_FAR_PLANE,\r
- FRUS_LEFT_PLANE,\r
- FRUS_RIGHT_PLANE,\r
- FRUS_BOTTOM_PLANE,\r
- FRUS_TOP_PLANE\r
-};\r
-\r
-\r
-\r
-enum\r
-{\r
- /*nothing detected*/\r
- CF_NONE = 0,\r
- /*collision detected*/\r
- CF_COLLISION = 1,\r
- /*gravity detecion enabled*/\r
- CF_DO_GRAVITY = (1<<1),\r
- /*gravity detected*/\r
- CF_GRAVITY = (1<<2),\r
- /*viewpoint is stored at end of animation*/\r
- CF_STORE_VP = (1<<3),\r
-};\r
-\r
-typedef struct _camera\r
-{\r
- /*this flag MUST be set by the owner of the camera*/\r
- Bool is_3D;\r
-\r
- u32 flags;\r
-\r
- /*viewport info*/\r
- GF_Rect vp;\r
- /*not always same as VP due to aspect ratio*/\r
- Fixed width, height;\r
- Fixed z_near, z_far;\r
-\r
- /*current vectors*/\r
- Fixed fieldOfView;\r
- SFVec3f up, position, target;\r
-\r
- /*initial vp for reset*/\r
- SFVec3f vp_position;\r
- SFRotation vp_orientation;\r
- Fixed vp_fov, vp_dist;\r
-\r
- /*animation path*/\r
- SFVec3f start_pos, end_pos;\r
- SFRotation start_ori, end_ori;\r
- Fixed start_fov, end_fov;\r
- /*for 2D cameras we never animate except for vp reset*/\r
- Fixed start_zoom;\r
- SFVec2f start_trans, start_rot;\r
-\r
- /*center of examine movement*/\r
- SFVec3f examine_center;\r
-\r
- /*anim*/\r
- u32 anim_len, anim_start;\r
- Bool jumping;\r
- Fixed dheight;\r
-\r
- /*navigation info - overwridden by any bindable NavigationInfo node*/\r
- u32 navigation_flags, navigate_mode;\r
- SFVec3f avatar_size;\r
- Fixed visibility, speed;\r
- Bool had_viewpoint, had_nav_info;\r
-\r
- /*last camera position before collision& gravity detection*/\r
- SFVec3f last_pos;\r
- u32 collide_flags;\r
- /*collision point in world coord*/\r
- SFVec3f collide_point;\r
- /*collide dist in world coord, used to check if we have a closer collision*/\r
- Fixed collide_dist;\r
- /*ground in world coord*/\r
- SFVec3f ground_point;\r
- /*ground dist in world coord, used to check if we have a closer ground*/\r
- Fixed ground_dist;\r
- /*for obstacle detection*/\r
- Bool last_had_ground;\r
- Bool last_had_col;\r
-\r
- /*projection & modelview matrices*/\r
- GF_Matrix projection, modelview;\r
- /*unprojection matrix = INV(P*M) used for screen->world compute*/\r
- GF_Matrix unprojection;\r
- /*viewport matrix*/\r
- GF_Matrix viewport;\r
- /*frustum planes*/\r
- GF_Plane planes[6];\r
- /*p vertex idx per plane (for bbox-frustum intersection checks)*/\r
- u32 p_idx[6];\r
- /*frustrum bounding sphere (for sphere-sphere frustum intersection checks)*/\r
- SFVec3f center;\r
- Fixed radius;\r
-} GF_Camera;\r
-\r
-/*invalidate camera to force recompute of all params*/\r
-void camera_invalidate(GF_Camera *cam);\r
-/*updates camera. user transform is only used in 2D to set global user zoom/pan/translate*/\r
-void camera_update(GF_Camera *cam, GF_Matrix2D *user_transform, Bool center_coords);\r
-/*reset to last viewport*/\r
-void camera_reset_viewpoint(GF_Camera *cam, Bool animate);\r
-/*move camera to given vp*/\r
-void camera_move_to(GF_Camera *cam, SFVec3f pos, SFVec3f target, SFVec3f up);\r
-Bool camera_animate(GF_Camera *cam);\r
-void camera_stop_anim(GF_Camera *cam);\r
-/*start jump mode*/\r
-void camera_jump(GF_Camera *cam);\r
-\r
-void camera_set_vectors(GF_Camera *cam, SFVec3f pos, SFRotation ori, Fixed fov);\r
-\r
-SFRotation camera_get_orientation(SFVec3f pos, SFVec3f target, SFVec3f up);\r
-SFVec3f camera_get_pos_dir(GF_Camera *cam);\r
-SFVec3f camera_get_target_dir(GF_Camera *cam);\r
-SFVec3f camera_get_right_dir(GF_Camera *cam);\r
-\r
-#endif\r
-\r