forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.I
More file actions
210 lines (190 loc) · 5.75 KB
/
camera.I
File metadata and controls
210 lines (190 loc) · 5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file camera.I
* @author drose
* @date 2002-02-26
*/
/**
* Sets the active flag on the camera. When the camera is not active, nothing
* will be rendered.
*/
INLINE void Camera::
set_active(bool active) {
_active = active;
}
/**
* Returns the current setting of the active flag on the camera.
*/
INLINE bool Camera::
is_active() const {
return _active;
}
/**
* Sets the scene that will be rendered by the camera. This is normally the
* root node of a scene graph, typically a node called 'render', although it
* could represent the root of any subgraph.
*
* Note that the use of this method is now deprecated. In the absence of an
* explicit scene set on the camera, the camera will render whatever scene it
* is parented into. This is the preferred way to specify the scene, since it
* is the more intuitive mechanism.
*/
INLINE void Camera::
set_scene(const NodePath &scene) {
_scene = scene;
}
/**
* Returns the scene that will be rendered by the camera. See set_scene().
*/
INLINE const NodePath &Camera::
get_scene() const {
return _scene;
}
/**
* Returns the number of display regions associated with the camera.
*/
INLINE size_t Camera::
get_num_display_regions() const {
return _display_regions.size();
}
/**
* Returns the nth display region associated with the camera.
*/
INLINE DisplayRegion *Camera::
get_display_region(size_t n) const {
nassertr(n < (int)_display_regions.size(), nullptr);
return _display_regions[n];
}
/**
* Changes the set of bits that represent the subset of the scene graph the
* camera will render.
*
* During the cull traversal, a node is not visited if none of its draw mask
* bits intersect with the camera's camera mask bits. These masks can be used
* to selectively hide and show different parts of the scene graph from
* different cameras that are otherwise viewing the same scene.
*/
INLINE void Camera::
set_camera_mask(DrawMask mask) {
// You shouldn't attempt to use Panda's reserved "overall" bit as a camera
// mask.
nassertv((mask & PandaNode::get_overall_bit()).is_zero());
_camera_mask = mask;
}
/**
* Returns the set of bits that represent the subset of the scene graph the
* camera will render. See set_camera_mask().
*/
INLINE DrawMask Camera::
get_camera_mask() const {
return _camera_mask;
}
/**
* Specifies the point from which the culling operations are performed.
* Normally, this is the same as the camera, and that is the default if this
* is not specified; but it may sometimes be useful to perform the culling
* from some other viewpoint, particularly when you are debugging the culling
* itself.
*/
INLINE void Camera::
set_cull_center(const NodePath &cull_center) {
_cull_center = cull_center;
}
/**
* Returns the point from which the culling operations will be performed, if
* it was set by set_cull_center(), or the empty NodePath otherwise.
*/
INLINE const NodePath &Camera::
get_cull_center() const {
return _cull_center;
}
/**
* Specifies the bounding volume that should be used to perform culling from
* this camera. Normally, this is the bounding volume returned from the
* active lens' make_bounds() call, but you may override this to specify a
* custom volume if you require. The specified bounding volume will be
* understood to be in the coordinate space of the get_cull_center() node.
*/
INLINE void Camera::
set_cull_bounds(BoundingVolume *cull_bounds) {
_cull_bounds = cull_bounds;
}
/**
* Returns the custom cull volume that was set by set_cull_bounds(), if any,
* or NULL if no custom cull volume was set.
*/
INLINE BoundingVolume *Camera::
get_cull_bounds() const {
return _cull_bounds;
}
/**
* Specifies the point from which the LOD distances are measured. Normally,
* this is the same as the camera, and that is the default if this is not
* specified; but it may sometimes be useful to perform the distance test from
* some other viewpoint. This may be used, for instance, to reduce LOD
* popping when the camera rotates in a small circle about an avatar.
*/
INLINE void Camera::
set_lod_center(const NodePath &lod_center) {
_lod_center = lod_center;
}
/**
* Returns the point from which the LOD distances will be measured, if it was
* set by set_lod_center(), or the empty NodePath otherwise.
*/
INLINE const NodePath &Camera::
get_lod_center() const {
return _lod_center;
}
/**
* Sets the initial state which is applied to all nodes in the scene, as if it
* were set at the top of the scene graph.
*/
INLINE void Camera::
set_initial_state(const RenderState *state) {
_initial_state = state;
}
/**
* Returns the initial state as set by a previous call to set_initial_state().
*/
INLINE CPT(RenderState) Camera::
get_initial_state() const {
return _initial_state;
}
/**
* Sets the tag key which, when encountered as a tag on nodes in the scene
* graph, causes this Camera to apply an arbitrary state transition based on
* the value of the tag (as specified to set_tag_state()).
*/
INLINE void Camera::
set_tag_state_key(const string &tag_state_key) {
_tag_state_key = tag_state_key;
}
/**
* Returns the tag key as set by a previous call to set_tag_state_key().
*/
INLINE const string &Camera::
get_tag_state_key() const {
return _tag_state_key;
}
/**
* Returns the multiplier for LOD distances.
*/
INLINE PN_stdfloat Camera::
get_lod_scale() const {
return _lod_scale;
}
/**
* Sets the multiplier for LOD distances. This value is multiplied with the
* LOD scale set on LodNodes.
*/
INLINE void Camera::
set_lod_scale(PN_stdfloat value) {
_lod_scale = value;
}