openscenegraph
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
40 enum Face {
43 BACK
44 };
45
47
48 PolygonMode(Face face,Mode mode);
49
51 PolygonMode(const PolygonMode& pm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
52 StateAttribute(pm,copyop),
53 _modeFront(pm._modeFront),
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)
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
Definition CopyOp:41
Definition PolygonMode:31
Mode _modeBack
Definition PolygonMode:84
META_StateAttribute(osg, PolygonMode, POLYGONMODE)
virtual void apply(State &state) const
PolygonMode(const PolygonMode &pm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PolygonMode:51
void setMode(Face face, Mode mode)
Mode _modeFront
Definition PolygonMode:83
Face
Definition PolygonMode:40
@ FRONT
Definition PolygonMode:42
@ FRONT_AND_BACK
Definition PolygonMode:41
bool getFrontAndBack() const
Definition PolygonMode:75
virtual ~PolygonMode()
Mode
Definition PolygonMode:34
PolygonMode(Face face, Mode mode)
virtual int compare(const StateAttribute &sa) const
Definition PolygonMode:59
Mode getMode(Face face) const
Definition StateAttribute:77
Definition State:80
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39