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

Last change on this file since 2836 was 2836, checked in by ldelgass, 12 years ago

More cleanups, remove NEW_FLOW_ENGINE define flag

  • Property svn:eol-style set to native
File size: 2.5 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-2006  Purdue Research Foundation
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 "Vector3.h"
20
21class NvCamera
22{
23public:
24    NvCamera(int startx, int starty, int w, int h,
25             float loc_x, float loc_y, float loc_z,
26             float target_x, float target_y, float target_z,
27             float angle_x, float angle_y, float angle_z);
28
29    ~NvCamera()
30    {}
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    //move location of target
65    void xAim(float x)
66    {
67        _target.x = x;
68    }
69
70    float xAim() const
71    {
72        return _target.x;
73    }
74
75    void yAim(float y)
76    {
77        _target.y = y;
78    }
79
80    float yAim() const
81    {
82        return _target.y;
83    }
84
85    void zAim(float z)
86    {
87        _target.z = z;
88    }
89
90    float zAim() const
91    {
92        return _target.z;
93    }
94
95    void rotate(float angle_x, float angle_y, float angle_z)
96    {
97        _angle = Vector3(angle_x, angle_y, angle_z);
98    }
99
100    void rotate(const Vector3& angle)
101    {
102        _angle = angle;
103    }
104
105    Vector3 rotate() const
106    {
107        return _angle;
108    }
109
110    void set_screen_size(int sx, int sy, int w, int h)
111    {
112        _width = w;
113        _height = h;
114        _startX = sx;
115        _startY = sy;
116    }
117
118    //make the camera setting active, this has to be
119    //called before drawing things
120    void initialize();
121
122private:
123    Vector3 _location;          //Location of the camera in the scene
124    Vector3 _target;            //Location the camera is looking at. 
125                                //location and target: two points define the
126                                //line-of-sight
127    Vector3 _angle;             //rotation angles of camera along x, y, z
128    int _width;                 //screen width
129    int _height;                //screen height
130    int _startX;
131    int _startY;
132};
133
134#endif
Note: See TracBrowser for help on using the repository browser.