OpenSceneGraph 3.6.5
Scissor
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_Scissor
15#define OSG_Scissor 1
16
17#include <osg/StateAttribute>
18
19namespace osg {
20
23{
24 public :
26
27 Scissor(int x,int y,int width,int height):
28 _x(x),
29 _y(y),
31 _height(height) {}
32
33
35 Scissor(const Scissor& vp,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
36 StateAttribute(vp,copyop),
37 _x(vp._x),
38 _y(vp._y),
39 _width(vp._width),
40 _height(vp._height) {}
41
43
45 virtual int compare(const StateAttribute& sa) const
46 {
47 // check the types are equal and then create the rhs variable
48 // used by the COMPARE_StateAttribute_Parameter macros below.
50
51 // compare each parameter in turn against the rhs.
56
57 return 0; // passed all the above comparison macros, must be equal.
58 }
59
60
61 virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
62 {
63 usage.usesMode(GL_SCISSOR_TEST);
64 return true;
65 }
66
67 inline void setScissor(int x,int y,int width,int height)
68 {
69 _x = x;
70 _y = y;
71 _width = width;
73 }
74
75 void getScissor(int& x,int& y,int& width,int& height) const
76 {
77 x = _x;
78 y = _y;
79 width = _width;
81 }
82
83 inline int& x() { return _x; }
84 inline int x() const { return _x; }
85
86 inline int& y() { return _y; }
87 inline int y() const { return _y; }
88
89 inline int& width() { return _width; }
90 inline int width() const { return _width; }
91
92 inline int& height() { return _height; }
93 inline int height() const { return _height; }
94
95 virtual void apply(State& state) const;
96
97 protected:
98
99 virtual ~Scissor();
100
101 int _x;
102 int _y;
105
106};
107
108}
109
110#endif
#define COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
int x() const
Definition Scissor:84
int height() const
Definition Scissor:93
int _height
Definition Scissor:104
int y() const
Definition Scissor:87
int _width
Definition Scissor:103
int & x()
Definition Scissor:83
int _x
Definition Scissor:101
int & height()
Definition Scissor:92
void setScissor(int x, int y, int width, int height)
Definition Scissor:67
int & width()
Definition Scissor:89
META_StateAttribute(osg, Scissor, SCISSOR)
int _y
Definition Scissor:102
virtual void apply(State &state) const
apply the OpenGL state attributes.
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Return the modes associated with this StateAttribute.
Definition Scissor:61
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition Scissor:45
int & y()
Definition Scissor:86
virtual ~Scissor()
int width() const
Definition Scissor:90
void getScissor(int &x, int &y, int &width, int &height) const
Definition Scissor:75
Scissor(const Scissor &vp, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition Scissor:35
Scissor(int x, int y, int width, int height)
Definition Scissor:27
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ SCISSOR
Definition StateAttribute:156
Definition StateAttribute:308
virtual void usesMode(GLMode mode)=0
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.