OpenSceneGraph 3.6.5
PolygonMode
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_POLYGONMODE
15#define OSG_POLYGONMODE 1
16
17#include <osg/StateAttribute>
18#include <osg/GL>
19
20#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
21 #define GL_POINT 0x1B00
22 #define GL_LINE 0x1B01
23 #define GL_FILL 0x1B02
24#endif
25
26namespace osg {
27
31{
32 public :
33
34 enum Mode {
35 POINT = GL_POINT,
36 LINE = GL_LINE,
37 FILL = GL_FILL
38 };
39
45
47
48 PolygonMode(Face face,Mode mode);
49
52 StateAttribute(pm,copyop),
54 _modeBack(pm._modeBack) {}
55
57
59 virtual int compare(const StateAttribute& sa) const
60 {
61 // check the types are equal and then create the rhs variable
62 // used by the COMPARE_StateAttribute_Parameter macros below.
64
65 // compare each parameter in turn against the rhs.
68
69 return 0; // passed all the above comparison macros, must be equal.
70 }
71
72 void setMode(Face face,Mode mode);
73 Mode getMode(Face face) const;
74
75 inline bool getFrontAndBack() const { return _modeFront==_modeBack; }
76
77 virtual void apply(State& state) const;
78
79 protected:
80
81 virtual ~PolygonMode();
82
85
86};
87
88}
89
90#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
Mode _modeBack
Definition PolygonMode:84
META_StateAttribute(osg, PolygonMode, POLYGONMODE)
virtual void apply(State &state) const
apply the OpenGL state attributes.
PolygonMode(const PolygonMode &pm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition PolygonMode:51
void setMode(Face face, Mode mode)
Mode _modeFront
Definition PolygonMode:83
Face
Definition PolygonMode:40
@ BACK
Definition PolygonMode:43
@ FRONT
Definition PolygonMode:42
@ FRONT_AND_BACK
Definition PolygonMode:41
bool getFrontAndBack() const
Definition PolygonMode:75
virtual ~PolygonMode()
Mode
Definition PolygonMode:34
@ FILL
Definition PolygonMode:37
@ LINE
Definition PolygonMode:36
@ POINT
Definition PolygonMode:35
PolygonMode(Face face, Mode mode)
virtual int compare(const StateAttribute &sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition PolygonMode:59
Mode getMode(Face face) const
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ POLYGONMODE
Definition StateAttribute:127
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.