source: nanovis/branches/1.1/NvCamera.h @ 4804

Last change on this file since 4804 was 3502, checked in by ldelgass, 7 years ago

Add basic VTK structured points reader to nanovis, update copyright dates.

  • Property svn:eol-style set to native
File size: 2.6 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-2013  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/Matrix4x4d.h>
20#include <vrmath/Vector3f.h>
21
22#include "config.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 reset(const vrmath::Vector3f& bboxMin,
79               const vrmath::Vector3f& bboxMax,
80               bool resetOrientation = false);
81
82    void setClippingRange(float near, float far)
83    {
84        _near = near;
85        _far = far;
86    }
87
88    void resetClippingRange(const vrmath::Vector3f& bboxMin,
89                            const vrmath::Vector3f& bboxMax);
90
91    void setScreenSize(int sx, int sy, int w, int h)
92    {
93        _width = w;
94        _height = h;
95        _startX = sx;
96        _startY = sy;
97    }
98
99    /**
100     * \brief Make the camera setting active, this has to be
101     * called before drawing things
102     */
103    void initialize();
104
105    void print() const;
106
107private:
108    void getUpDirMatrix(vrmath::Matrix4x4d& upMat);
109
110    /// Location of the camera in the scene
111    vrmath::Vector3f _location;
112    /// Camera view matrix (orientation only, no translation)
113    vrmath::Matrix4x4d _cameraMatrix;
114    /// Field of view (vertical angle in degrees)
115    float _fov;
116    /// Near, far z clipping
117    float _near, _far;
118
119    /// screen width
120    int _width;
121    /// screen height
122    int _height;
123    int _startX;
124    int _startY;
125};
126
127#endif
Note: See TracBrowser for help on using the repository browser.