From 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:46 -0500 Subject: Second Life viewer sources 1.13.2.12 --- linden/indra/llmath/llcamera.h | 188 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 linden/indra/llmath/llcamera.h (limited to 'linden/indra/llmath/llcamera.h') diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h new file mode 100644 index 0000000..82b6130 --- /dev/null +++ b/linden/indra/llmath/llcamera.h @@ -0,0 +1,188 @@ +/** + * @file llcamera.h + * @brief Header file for the LLCamera class. + * + * Copyright (c) 2000-2007, Linden Research, Inc. + * + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#ifndef LL_CAMERA_H +#define LL_CAMERA_H + + +#include "llmath.h" +#include "llcoordframe.h" +#include "llplane.h" + +const F32 DEFAULT_FIELD_OF_VIEW = 60.f * DEG_TO_RAD; +const F32 DEFAULT_ASPECT_RATIO = 640.f / 480.f; +const F32 DEFAULT_NEAR_PLANE = 0.25f; +const F32 DEFAULT_FAR_PLANE = 64.f; // far reaches across two horizontal, not diagonal, regions + +const F32 MAX_FIELD_OF_VIEW = F_PI; +const F32 MAX_ASPECT_RATIO = 50.0f; +const F32 MAX_NEAR_PLANE = 10.f; +const F32 MAX_FAR_PLANE = 100000.0f; //1000000.0f; // Max allowed. Not good Z precision though. +const F32 MAX_FAR_CLIP = 1024.0f; + +const F32 MIN_FIELD_OF_VIEW = 0.1f; +const F32 MIN_ASPECT_RATIO = 0.02f; +const F32 MIN_NEAR_PLANE = 0.1f; +const F32 MIN_FAR_PLANE = 0.2f; + +static const LLVector3 X_AXIS(1.f,0.f,0.f); +static const LLVector3 Y_AXIS(0.f,1.f,0.f); +static const LLVector3 Z_AXIS(0.f,0.f,1.f); + +static const LLVector3 NEG_X_AXIS(-1.f,0.f,0.f); +static const LLVector3 NEG_Y_AXIS(0.f,-1.f,0.f); +static const LLVector3 NEG_Z_AXIS(0.f,0.f,-1.f); + + +// An LLCamera is an LLCoorFrame with a view frustum. +// This means that it has several methods for moving it around +// that are inherited from the LLCoordFrame() class : +// +// setOrigin(), setAxes() +// translate(), rotate() +// roll(), pitch(), yaw() +// etc... + + +class LLCamera +: public LLCoordFrame +{ +public: + enum { + PLANE_LEFT = 0, + PLANE_RIGHT = 1, + PLANE_BOTTOM = 2, + PLANE_TOP = 3, + PLANE_NUM = 4 + }; + enum { + PLANE_LEFT_MASK = (1<