source: trunk/packages/vizservers/nanovis/NvCamera.h @ 3464

Last change on this file since 3464 was 3362, checked in by ldelgass, 7 years ago

Merge nanovis2 branch to trunk

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ----------------------------------------------------------------------
4 * NvCamera.h : NvCamera class
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
10 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16#ifndef CAMERA_H
17#define CAMERA_H
18
19#include <vrmath/vrMatrix4x4f.h>
20
21#include "config.h"
22#include "Vector3.h"
23
24class NvCamera
25{
26public:
27    NvCamera(int startx, int starty, int w, int h,
28             float loc_x, float loc_y, float loc_z);
29
30    ~NvCamera()
31    {}
32
33    //move location of camera
34    void x(float loc_x)
35    {
36        _location.x = loc_x;
37    }
38
39    float x() const
40    {
41        return _location.x;
42    }
43
44    void y(float loc_y)
45    {
46        _location.y = loc_y;
47    }
48
49    float y() const
50    {
51        return _location.y;
52    }
53
54    void z(float loc_z)
55    {
56        _location.z = loc_z;
57    }
58
59    float z() const
60    {
61        return _location.z;
62    }
63
64    void rotate(double *quat);
65
66    void rotate(float angle_x, float angle_y, float angle_z);
67
68    void fov(float fov)
69    {
70        _fov = fov;
71    }
72
73    float fov() const
74    {
75        return _fov;
76    }
77
78    void setClippingRange(float near, float far)
79    {
80        _near = near;
81        _far = far;
82    }
83
84    void setClippingRange(const Vector3& bboxMin, const Vector3& bboxMax);
85
86    void setScreenSize(int sx, int sy, int w, int h)
87    {
88        _width = w;
89        _height = h;
90        _startX = sx;
91        _startY = sy;
92    }
93
94    /**
95     * \brief Make the camera setting active, this has to be
96     * called before drawing things
97     */
98    void initialize();
99
100private:
101    /// Location of the camera in the scene
102    Vector3 _location;
103    /// Camera view matrix (orientation only, no translation)
104    vrMatrix4x4f _cameraMatrix;
105    /// Field of view (vertical angle in degrees)
106    float _fov;
107    /// Near, far z clipping
108    float _near, _far;
109
110    /// screen width
111    int _width;
112    /// screen height
113    int _height;
114    int _startX;
115    int _startY;
116};
117
118#endif
Note: See TracBrowser for help on using the repository browser.