Panda3D
scissorEffect.I
1 // Filename: scissorEffect.I
2 // Created by: drose (30Jul08)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ScissorEffect::is_screen
18 // Access: Published
19 // Description: Returns true if the ScissorEffect is a screen-based
20 // effect, meaning get_frame() has a meaningful value,
21 // but get_a() and get_b() do not.
22 ////////////////////////////////////////////////////////////////////
23 INLINE bool ScissorEffect::
24 is_screen() const {
25  return _screen;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: ScissorEffect::get_frame
30 // Access: Published
31 // Description: If is_screen() returns true, this method may be
32 // called to query the screen-based scissor frame. This
33 // is a series of left, right, bottom, top, representing
34 // the scissor frame relative to the current
35 // DisplayRegion. See ScissorAttrib.
36 ////////////////////////////////////////////////////////////////////
37 INLINE const LVecBase4 &ScissorEffect::
38 get_frame() const {
39  return _frame;
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: ScissorEffect::get_num_points
44 // Access: Published
45 // Description: Returns the number of node-based scissor points. See
46 // get_point().
47 ////////////////////////////////////////////////////////////////////
48 INLINE int ScissorEffect::
49 get_num_points() const {
50  return (int)_points.size();
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: ScissorEffect::get_point
55 // Access: Published
56 // Description: If is_screen() returns false, then get_num_points() and
57 // get_point() may be called to query the node-based scissor
58 // frame. These return n points (at least two), which
59 // are understood to be in the space of this node, and
60 // which define any opposite corners of the scissor
61 // frame.
62 ////////////////////////////////////////////////////////////////////
63 INLINE const LPoint3 &ScissorEffect::
64 get_point(int n) const {
65  nassertr(n >= 0 && n < (int)_points.size(), LPoint3::zero());
66  return _points[n]._p;
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function: ScissorEffect::get_node
71 // Access: Published
72 // Description: Returns the node to which the nth point is relative,
73 // or empty NodePath to indicate the current node.
74 ////////////////////////////////////////////////////////////////////
76 get_node(int n) const {
77  nassertr(n >= 0 && n < (int)_points.size(), NodePath());
78  return _points[n]._node;
79 }
80 
81 ////////////////////////////////////////////////////////////////////
82 // Function: ScissorEffect::get_clip
83 // Access: Published
84 // Description: Returns true if this ScissorEffect actually enables
85 // scissoring, or false if it culls only.
86 ////////////////////////////////////////////////////////////////////
87 INLINE bool ScissorEffect::
88 get_clip() const {
89  return _clip;
90 }
static const LPoint3f & zero()
Returns a zero-length point.
Definition: lpoint3.h:259
int get_num_points() const
Returns the number of node-based scissor points.
Definition: scissorEffect.I:49
bool is_screen() const
Returns true if the ScissorEffect is a screen-based effect, meaning get_frame() has a meaningful valu...
Definition: scissorEffect.I:24
const LVecBase4 & get_frame() const
If is_screen() returns true, this method may be called to query the screen-based scissor frame...
Definition: scissorEffect.I:38
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
const LPoint3 & get_point(int n) const
If is_screen() returns false, then get_num_points() and get_point() may be called to query the node-b...
Definition: scissorEffect.I:64
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
bool get_clip() const
Returns true if this ScissorEffect actually enables scissoring, or false if it culls only...
Definition: scissorEffect.I:88
NodePath get_node(int n) const
Returns the node to which the nth point is relative, or empty NodePath to indicate the current node...
Definition: scissorEffect.I:76
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165