Go to the documentation of this file.00001
00002
00003
00004
00005 #pragma once
00006 #include "constants.h"
00007 #include "GVec4f.h"
00008 #include "GMatrix16.h"
00009 #include "GMathManager.h"
00010 #include "GModel.h"
00011 #include "GObject.h"
00012
00013 class GCamera: public GObject
00014 {
00015 protected:
00016
00017 GMatrix16 projection;
00018 GMatrix16 ortho;
00019 GMatrix16 world;
00020
00021 GVec4f position;
00022 GVec4f rotation;
00023 GMatrix16 transformations;
00024 GMatrix16 transformations_inv;
00025
00026 GMatrix16 transformations_translations;
00027 GMatrix16 transformations_translations_inv;
00028 GMatrix16 transformations_rotations;
00029 GMatrix16 transformations_rotations_inv;
00030
00031 bool ismodelviewingcamera;
00032 float distance;
00033 GModel* model;
00034
00035 plane clipping[6];
00036
00037 public:
00038 GCamera(void);
00039 ~GCamera(void);
00040
00041 void queryCameraPosition(GVec4f *pos);
00042 void setCameraPosition(GVec4f pos);
00043 int setRotation(GVec4f _rotation);
00044 int queryRotation(GVec4f *_rotation);
00045 int rotate(float angleX, float angleY, float angleZ = 0.0f);
00046 void translate(GVec4f delta);
00047 int move(float x, float y, float z, float speed);
00048 int RecalculateMatrix(void);
00049 GMatrix16 *GetViewMatrix(int FLAGS = 0);
00050 GMatrix16 *GetProjectionMatrix();
00051 GMatrix16 *GetOrthoMatrix();
00052 int CreatePerspectiveProjectionMatrix(float fov, float aspect, float znear, float zfar);
00053 int CreateOrthoProjectionMatrix(float left, float right, float bottom, float top, float znear, float zfar);
00054 int GetCameraPickDirection(float x, float y, float z, GVec4f *origin, GMatrix16 *modelview, GVec4f *pickDir);
00055 void setModelViewing(GModel* model, float distance);
00056 void setWorldViewing();
00057 void ReAttachToModel();
00058 bool isModelViewing();
00059 int SetWorldMatrix(const GMatrix16 &world);
00060
00061
00062 int SetupViewFrustum();
00063 bool SphereInside(GVec4f center, float radius);
00064 virtual int Update(double time, double dtime);
00065 };