Panda3D
Loading...
Searching...
No Matches
portalClipper.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file portalClipper.h
10 * @author masad
11 * @date 2004-05-04
12 */
13
14#ifndef PORTALCLIPPER_H
15#define PORTALCLIPPER_H
16
17#include "pandabase.h"
18
19#include "geom.h"
20#include "geomVertexData.h"
21#include "sceneSetup.h"
22#include "renderState.h"
23#include "portalNode.h"
24#include "transformState.h"
26#include "boundingHexahedron.h"
27#include "pointerTo.h"
28#include "drawMask.h"
29#include "typedObject.h"
30#include "pStatCollector.h"
31#include "config_pgraph.h"
32
33#include "geom.h"
34#include "geomNode.h"
35
36class PandaNode;
37class PortalNode;
38class CullHandler;
40class CullableObject;
41class NodePath;
42
43/**
44 * This object performs a depth-first traversal of the scene graph, with
45 * optional view-frustum culling, collecting CullState and searching for
46 * GeomNodes. Each renderable Geom encountered is passed along with its
47 * associated RenderState to the CullHandler object.
48 */
49class EXPCL_PANDA_PGRAPH PortalClipper : public TypedObject {
50public:
51 PortalClipper(GeometricBoundingVolume *frustum, SceneSetup *scene_setup);
53
54 INLINE bool is_partial_portal_in_view();
55 INLINE bool is_facing_view(const LPlane &portal_plane);
56 INLINE bool is_whole_portal_in_view(const LMatrix4 &cmat);
57
58 bool prepare_portal(const NodePath &node_path);
59
60 void draw_lines();
61 INLINE void draw_camera_frustum();
62 void draw_hexahedron(BoundingHexahedron *frustum);
63
64 INLINE void move_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
65 void move_to(const LVecBase3 &v);
66
67 INLINE void draw_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
68 void draw_to(const LVecBase3 &v);
69
70 void draw_current_portal();
71
72 INLINE BoundingHexahedron *get_reduced_frustum() const;
73 INLINE void set_reduced_frustum(BoundingHexahedron *bh);
74 INLINE void get_reduced_viewport(LPoint2& min, LPoint2& max) const;
75 INLINE void set_reduced_viewport(const LPoint2& min, const LPoint2& max);
76 INLINE const RenderState* get_clip_state() const;
77 INLINE void set_clip_state(const RenderState* clip_state);
78
79public:
80 static TypeHandle get_class_type() {
81 return _type_handle;
82 }
83 static void init_type() {
85 register_type(_type_handle, "PortalClipper",
86 TypedObject::get_class_type());
87 }
88 virtual TypeHandle get_type() const {
89 return get_class_type();
90 }
91 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
92
93private:
94 static TypeHandle _type_handle;
95
96private:
97 class Point {
98 public:
99 INLINE Point();
100 INLINE Point(const LVecBase3 &point, const LColor &color);
101 INLINE Point(const Point &copy);
102 INLINE void operator = (const Point &copy);
103
104 LVertex _point;
105 UnalignedLVecBase4 _color;
106 };
107
110
111 LineList _list;
112 LColor _color;
113
114 PT(GeomVertexData) _created_data;
115
116 BoundingHexahedron *_view_frustum;
117 BoundingHexahedron *_reduced_frustum;
118 LPoint2 _reduced_viewport_min;
119 LPoint2 _reduced_viewport_max;
120 CPT(RenderState) _clip_state; // each portal node needs to know the clip state of its "parent" portal Node
121
122 const PortalNode *_portal_node; // current working portal for dereference ease
123
124 // int _num_vert; LVertex _coords[4];
125
126public:
127 PT(GeomNode) _previous;
128 SceneSetup *_scene_setup;
129};
130
131#include "portalClipper.I"
132
133#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines a bounding convex hexahedron.
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
Definition cullHandler.h:28
This collects together the pieces of data that are accumulated for each node while walking the scene ...
The smallest atom of cull.
A node that holds Geom objects, renderable pieces of geometry.
Definition geomNode.h:34
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
A node in the scene graph that can hold a Portal Polygon, which is a rectangle.
Definition portalNode.h:30
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition renderState.h:47
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition sceneSetup.h:32
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition typedObject.h:88
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.