forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.h
More file actions
147 lines (115 loc) · 4.36 KB
/
camera.h
File metadata and controls
147 lines (115 loc) · 4.36 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
// Filename: camera.h
// Created by: drose (26Feb02)
//
////////////////////////////////////////////////////////////////////
//
// 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."
//
////////////////////////////////////////////////////////////////////
#ifndef CAMERA_H
#define CAMERA_H
#include "pandabase.h"
#include "lensNode.h"
#include "perspectiveLens.h"
#include "nodePath.h"
#include "weakNodePath.h"
#include "drawMask.h"
#include "renderState.h"
#include "pointerTo.h"
#include "pmap.h"
#include "auxSceneData.h"
#include "displayRegionBase.h"
////////////////////////////////////////////////////////////////////
// Class : Camera
// Description : A node that can be positioned around in the scene
// graph to represent a point of view for rendering a
// scene.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_PGRAPH Camera : public LensNode {
PUBLISHED:
explicit Camera(const string &name, Lens *lens = new PerspectiveLens());
Camera(const Camera ©);
public:
virtual ~Camera();
virtual PandaNode *make_copy() const;
virtual bool safe_to_flatten() const;
virtual bool safe_to_transform() const;
PUBLISHED:
INLINE void set_active(bool active);
INLINE bool is_active() const;
INLINE void set_scene(const NodePath &scene);
INLINE const NodePath &get_scene() const;
INLINE int get_num_display_regions() const;
INLINE DisplayRegionBase *get_display_region(int n) const;
MAKE_SEQ(get_display_regions, get_num_display_regions, get_display_region);
INLINE void set_camera_mask(DrawMask mask);
INLINE DrawMask get_camera_mask() const;
INLINE void set_cull_center(const NodePath &cull_center);
INLINE const NodePath &get_cull_center() const;
INLINE void set_cull_bounds(BoundingVolume *cull_bounds);
INLINE BoundingVolume *get_cull_bounds() const;
INLINE void set_lod_center(const NodePath &lod_center);
INLINE const NodePath &get_lod_center() const;
INLINE void set_initial_state(const RenderState *state);
INLINE CPT(RenderState) get_initial_state() const;
INLINE void set_tag_state_key(const string &tag_state_key);
INLINE const string &get_tag_state_key() const;
INLINE void set_lod_scale(PN_stdfloat value);
INLINE PN_stdfloat get_lod_scale() const;
void set_tag_state(const string &tag_state, const RenderState *state);
void clear_tag_state(const string &tag_state);
bool has_tag_state(const string &tag_state) const;
CPT(RenderState) get_tag_state(const string &tag_state) const;
void set_aux_scene_data(const NodePath &node_path, AuxSceneData *data);
bool clear_aux_scene_data(const NodePath &node_path);
AuxSceneData *get_aux_scene_data(const NodePath &node_path) const;
void list_aux_scene_data(ostream &out) const;
int cleanup_aux_scene_data(Thread *current_thread = Thread::get_current_thread());
private:
void add_display_region(DisplayRegionBase *display_region);
void remove_display_region(DisplayRegionBase *display_region);
bool _active;
NodePath _scene;
NodePath _cull_center;
PT(BoundingVolume) _cull_bounds;
NodePath _lod_center;
DrawMask _camera_mask;
PN_stdfloat _lod_scale;
typedef pvector<DisplayRegionBase *> DisplayRegions;
DisplayRegions _display_regions;
CPT(RenderState) _initial_state;
string _tag_state_key;
typedef pmap<string, CPT(RenderState) > TagStates;
TagStates _tag_states;
typedef pmap<NodePath, PT(AuxSceneData) > AuxData;
AuxData _aux_data;
public:
static void register_with_read_factory();
virtual void write_datagram(BamWriter *manager, Datagram &dg);
protected:
static TypedWritable *make_from_bam(const FactoryParams ¶ms);
void fillin(DatagramIterator &scan, BamReader *manager);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
LensNode::init_type();
register_type(_type_handle, "Camera",
LensNode::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
friend class DisplayRegion;
};
#include "camera.I"
#endif