OpenSceneGraph 3.6.5
CullFace
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_CULLFACE
15#define OSG_CULLFACE 1
16
17#include <osg/GL>
18#include <osg/StateAttribute>
19
20namespace osg {
21
25{
26 public :
27
28 enum Mode {
29 FRONT = GL_FRONT,
30 BACK = GL_BACK,
31 FRONT_AND_BACK = GL_FRONT_AND_BACK
32 };
33
35 _mode(mode) {}
36
38 CullFace(const CullFace& cf,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
39 StateAttribute(cf,copyop),
40 _mode(cf._mode) {}
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.
53
54 return 0; // passed all the above comparison macros, must be equal.
55 }
56
57 virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
58 {
59 usage.usesMode(GL_CULL_FACE);
60 return true;
61 }
62
63 inline void setMode(Mode mode) { _mode = mode; }
64
65 inline Mode getMode() const { return _mode; }
66
67 virtual void apply(State& state) const;
68
69 protected:
70
71 virtual ~CullFace();
72
74
75};
76
77}
78
79#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
virtual int compare(const StateAttribute &sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition CullFace:45
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Return the modes associated with this StateAttribute.
Definition CullFace:57
virtual void apply(State &state) const
apply the OpenGL state attributes.
void setMode(Mode mode)
Definition CullFace:63
CullFace(const CullFace &cf, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition CullFace:38
Mode _mode
Definition CullFace:73
CullFace(Mode mode=BACK)
Definition CullFace:34
Mode
Definition CullFace:28
@ FRONT
Definition CullFace:29
@ FRONT_AND_BACK
Definition CullFace:31
@ BACK
Definition CullFace:30
Mode getMode() const
Definition CullFace:65
META_StateAttribute(osg, CullFace, CULLFACE)
virtual ~CullFace()
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ CULLFACE
Definition StateAttribute:133
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.