Coin: SoGLRenderAction.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoGLRenderAction.h
1#ifndef COIN_SOGLRENDERACTION_H
2#define COIN_SOGLRENDERACTION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/actions/SoAction.h>
37#include <Inventor/actions/SoSubAction.h>
38#include <Inventor/SbBasic.h>
39#include <Inventor/SbViewportRegion.h>
40#include <Inventor/system/inttypes.h>
41#include <Inventor/lists/SoPathList.h>
42#include <Inventor/lists/SbList.h>
43
44typedef void SoGLRenderPassCB(void * userdata);
45typedef void SoGLPreRenderCB(void * userdata, class SoGLRenderAction * action);
46typedef float SoGLSortedObjectOrderCB(void * userdata, SoGLRenderAction * action);
47
48class SoGLRenderActionP;
49
50 class COIN_DLL_API SoGLRenderAction : public SoAction {
51 typedef SoAction inherited;
52
53 SO_ACTION_HEADER(SoGLRenderAction);
54
55public:
56 static void initClass(void);
57
58 SoGLRenderAction(const SbViewportRegion & viewportregion);
59 virtual ~SoGLRenderAction(void);
60
61 enum TransparencyType {
62 SCREEN_DOOR,
63 ADD, DELAYED_ADD, SORTED_OBJECT_ADD,
64 BLEND, DELAYED_BLEND, SORTED_OBJECT_BLEND,
65 // The remaining are Coin extensions to the common Inventor API
66 SORTED_OBJECT_SORTED_TRIANGLE_ADD,
67 SORTED_OBJECT_SORTED_TRIANGLE_BLEND,
68 NONE, SORTED_LAYERS_BLEND
69 };
70
71 enum TransparentDelayedObjectRenderType {
72 ONE_PASS,
73 NONSOLID_SEPARATE_BACKFACE_PASS
74 };
75
76 enum AbortCode {
77 CONTINUE, ABORT, PRUNE, DELAY
78 };
79
80 enum SortedObjectOrderStrategy {
81 BBOX_CENTER,
82 BBOX_CLOSEST_CORNER,
83 BBOX_FARTHEST_CORNER,
84 CUSTOM_CALLBACK
85 };
86
87 typedef AbortCode SoGLRenderAbortCB(void * userdata);
88
89 void setViewportRegion(const SbViewportRegion & newregion);
90 const SbViewportRegion & getViewportRegion(void) const;
91 void setUpdateArea(const SbVec2f & origin, const SbVec2f & size);
92 void getUpdateArea(SbVec2f & origin, SbVec2f & size) const;
93 void setAbortCallback(SoGLRenderAbortCB * const func, void * const userdata);
94 void getAbortCallback(SoGLRenderAbortCB * & func_out, void * & userdata_out) const;
95 void setTransparencyType(const TransparencyType type);
96 TransparencyType getTransparencyType(void) const;
97 void setTransparentDelayedObjectRenderType(TransparentDelayedObjectRenderType type);
98 TransparentDelayedObjectRenderType getTransparentDelayedObjectRenderType(void) const;
99 void setSmoothing(const SbBool smooth);
100 SbBool isSmoothing(void) const;
101 void setNumPasses(const int num);
102 int getNumPasses(void) const;
103 void setPassUpdate(const SbBool flag);
104 SbBool isPassUpdate(void) const;
105 void setPassCallback(SoGLRenderPassCB * const func, void * const userdata);
106 void setCacheContext(const uint32_t context);
107 uint32_t getCacheContext(void) const;
108
109 void addDelayedPath(SoPath * path);
110 SbBool isRenderingDelayedPaths(void) const;
111
112 SbBool handleTransparency(SbBool istransparent = FALSE);
113 void setCurPass(const int passnum, const int numpasses);
114 int getCurPass(void) const;
115 SbBool abortNow(void);
116
117 void setRenderingIsRemote(SbBool isremote);
118 SbBool getRenderingIsRemote(void) const;
119
120 virtual void invalidateState(void);
121
122 void addPreRenderCallback(SoGLPreRenderCB * func, void * userdata);
123 void removePreRenderCallback(SoGLPreRenderCB * func, void * userdata);
124
125 void setSortedLayersNumPasses(int num);
126 int getSortedLayersNumPasses(void) const;
127
128 void setSortedObjectOrderStrategy(const SortedObjectOrderStrategy strategy,
129 SoGLSortedObjectOrderCB * cb = NULL,
130 void * closure = NULL);
131
132 void setDelayedObjDepthWrite(SbBool write);
133 SbBool getDelayedObjDepthWrite(void) const;
134
135 SbBool isRenderingTranspPaths(void) const;
136 SbBool isRenderingTranspBackfaces(void) const;
137
138protected:
139 friend class SoGLRenderActionP; // calls beginTraversal
140 virtual void beginTraversal(SoNode * node);
141 virtual void endTraversal(SoNode * node);
142
143private:
144 SbPimplPtr<SoGLRenderActionP> pimpl;
145
146 SoGLRenderAction(const SoGLRenderAction & rhs);
147 SoGLRenderAction & operator = (const SoGLRenderAction & rhs);
148
149}; // SoGLRenderAction
150
151#endif // !COIN_SOGLRENDERACTION_H
SbPimplPtr
Definition SbPimplPtr.h:55
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
SoAction::invalidateState
virtual void invalidateState(void)
Definition SoAction.cpp:821
SoAction::initClass
static void initClass(void)
Definition SoAction.cpp:370
SoAction::SoAction
SoAction(void)
Definition SoAction.cpp:337
SoAction::beginTraversal
virtual void beginTraversal(SoNode *node)
Definition SoAction.cpp:1269
SoAction::endTraversal
virtual void endTraversal(SoNode *node)
Definition SoAction.cpp:1279
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
SoGLRenderAction::addDelayedPath
void addDelayedPath(SoPath *path)
Definition SoGLRenderAction.cpp:1443
SoGLRenderAction::AbortCode
AbortCode
Definition SoGLRenderAction.h:76
SoGLRenderAction::DELAY
@ DELAY
Definition SoGLRenderAction.h:77
SoGLRenderAction::ABORT
@ ABORT
Definition SoGLRenderAction.h:77
SoGLRenderAction::PRUNE
@ PRUNE
Definition SoGLRenderAction.h:77
SoGLRenderAction::CONTINUE
@ CONTINUE
Definition SoGLRenderAction.h:77
SoGLRenderAction::setPassCallback
void setPassCallback(SoGLRenderPassCB *const func, void *const userdata)
Definition SoGLRenderAction.cpp:961
SoGLRenderAction::setPassUpdate
void setPassUpdate(const SbBool flag)
Definition SoGLRenderAction.cpp:940
SoGLRenderAction::setCurPass
void setCurPass(const int passnum, const int numpasses)
Definition SoGLRenderAction.cpp:1326
SoGLRenderAction::SoGLRenderAbortCB
AbortCode SoGLRenderAbortCB(void *userdata)
Definition SoGLRenderAction.h:87
SoGLRenderAction::SoGLRenderAction
SoGLRenderAction(const SbViewportRegion &viewportregion)
Definition SoGLRenderAction.cpp:698
SoGLRenderAction::getDelayedObjDepthWrite
SbBool getDelayedObjDepthWrite(void) const
Definition SoGLRenderAction.cpp:1989
SoGLRenderAction::abortNow
SbBool abortNow(void)
Definition SoGLRenderAction.cpp:1350
SoGLRenderAction::isPassUpdate
SbBool isPassUpdate(void) const
Definition SoGLRenderAction.cpp:951
SoGLRenderAction::setSmoothing
void setSmoothing(const SbBool smooth)
Definition SoGLRenderAction.cpp:898
SoGLRenderAction::getViewportRegion
const SbViewportRegion & getViewportRegion(void) const
Definition SoGLRenderAction.cpp:766
SoGLRenderAction::setTransparentDelayedObjectRenderType
void setTransparentDelayedObjectRenderType(TransparentDelayedObjectRenderType type)
Definition SoGLRenderAction.cpp:2025
SoGLRenderAction::addPreRenderCallback
void addPreRenderCallback(SoGLPreRenderCB *func, void *userdata)
Definition SoGLRenderAction.cpp:1535
SoGLRenderAction::setTransparencyType
void setTransparencyType(const TransparencyType type)
Definition SoGLRenderAction.cpp:862
SoGLRenderAction::getSortedLayersNumPasses
int getSortedLayersNumPasses(void) const
Definition SoGLRenderAction.cpp:1017
SoGLRenderAction::isRenderingDelayedPaths
SbBool isRenderingDelayedPaths(void) const
Definition SoGLRenderAction.cpp:1456
SoGLRenderAction::setSortedLayersNumPasses
void setSortedLayersNumPasses(int num)
Definition SoGLRenderAction.cpp:1007
SoGLRenderAction::isSmoothing
SbBool isSmoothing(void) const
Definition SoGLRenderAction.cpp:910
SoGLRenderAction::getCacheContext
uint32_t getCacheContext(void) const
Definition SoGLRenderAction.cpp:995
SoGLRenderAction::removePreRenderCallback
void removePreRenderCallback(SoGLPreRenderCB *func, void *userdata)
Definition SoGLRenderAction.cpp:1548
SoGLRenderAction::getTransparencyType
TransparencyType getTransparencyType(void) const
Definition SoGLRenderAction.cpp:874
SoGLRenderAction::getNumPasses
int getNumPasses(void) const
Definition SoGLRenderAction.cpp:931
SoGLRenderAction::getRenderingIsRemote
SbBool getRenderingIsRemote(void) const
Definition SoGLRenderAction.cpp:1427
SoGLRenderAction::isRenderingTranspBackfaces
SbBool isRenderingTranspBackfaces(void) const
Definition SoGLRenderAction.cpp:2014
SoGLRenderAction::getTransparentDelayedObjectRenderType
TransparentDelayedObjectRenderType getTransparentDelayedObjectRenderType(void) const
Definition SoGLRenderAction.cpp:2036
SoGLRenderAction::isRenderingTranspPaths
SbBool isRenderingTranspPaths(void) const
Definition SoGLRenderAction.cpp:2002
SoGLRenderAction::setSortedObjectOrderStrategy
void setSortedObjectOrderStrategy(const SortedObjectOrderStrategy strategy, SoGLSortedObjectOrderCB *cb=NULL, void *closure=NULL)
Definition SoGLRenderAction.cpp:1573
SoGLRenderAction::TransparencyType
TransparencyType
Definition SoGLRenderAction.h:61
SoGLRenderAction::ADD
@ ADD
Definition SoGLRenderAction.h:63
SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_ADD
@ SORTED_OBJECT_SORTED_TRIANGLE_ADD
Definition SoGLRenderAction.h:66
SoGLRenderAction::SCREEN_DOOR
@ SCREEN_DOOR
Definition SoGLRenderAction.h:62
SoGLRenderAction::BLEND
@ BLEND
Definition SoGLRenderAction.h:64
SoGLRenderAction::SORTED_OBJECT_BLEND
@ SORTED_OBJECT_BLEND
Definition SoGLRenderAction.h:64
SoGLRenderAction::SORTED_LAYERS_BLEND
@ SORTED_LAYERS_BLEND
Definition SoGLRenderAction.h:68
SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND
@ SORTED_OBJECT_SORTED_TRIANGLE_BLEND
Definition SoGLRenderAction.h:67
SoGLRenderAction::DELAYED_ADD
@ DELAYED_ADD
Definition SoGLRenderAction.h:63
SoGLRenderAction::SORTED_OBJECT_ADD
@ SORTED_OBJECT_ADD
Definition SoGLRenderAction.h:63
SoGLRenderAction::NONE
@ NONE
Definition SoGLRenderAction.h:68
SoGLRenderAction::DELAYED_BLEND
@ DELAYED_BLEND
Definition SoGLRenderAction.h:64
SoGLRenderAction::setAbortCallback
void setAbortCallback(SoGLRenderAbortCB *const func, void *const userdata)
Definition SoGLRenderAction.cpp:834
SoGLRenderAction::setNumPasses
void setNumPasses(const int num)
Definition SoGLRenderAction.cpp:921
SoGLRenderAction::TransparentDelayedObjectRenderType
TransparentDelayedObjectRenderType
Definition SoGLRenderAction.h:71
SoGLRenderAction::NONSOLID_SEPARATE_BACKFACE_PASS
@ NONSOLID_SEPARATE_BACKFACE_PASS
Definition SoGLRenderAction.h:73
SoGLRenderAction::ONE_PASS
@ ONE_PASS
Definition SoGLRenderAction.h:72
SoGLRenderAction::getCurPass
int getCurPass(void) const
Definition SoGLRenderAction.cpp:1338
SoGLRenderAction::handleTransparency
SbBool handleTransparency(SbBool istransparent=FALSE)
Definition SoGLRenderAction.cpp:1205
SoGLRenderAction::setRenderingIsRemote
void setRenderingIsRemote(SbBool isremote)
Definition SoGLRenderAction.cpp:1414
SoGLRenderAction::setViewportRegion
void setViewportRegion(const SbViewportRegion &newregion)
Definition SoGLRenderAction.cpp:754
SoGLRenderAction::getUpdateArea
void getUpdateArea(SbVec2f &origin, SbVec2f &size) const
Definition SoGLRenderAction.cpp:791
SoGLRenderAction::setDelayedObjDepthWrite
void setDelayedObjDepthWrite(SbBool write)
Definition SoGLRenderAction.cpp:1977
SoGLRenderAction::SortedObjectOrderStrategy
SortedObjectOrderStrategy
Definition SoGLRenderAction.h:80
SoGLRenderAction::BBOX_CENTER
@ BBOX_CENTER
Definition SoGLRenderAction.h:81
SoGLRenderAction::BBOX_CLOSEST_CORNER
@ BBOX_CLOSEST_CORNER
Definition SoGLRenderAction.h:82
SoGLRenderAction::BBOX_FARTHEST_CORNER
@ BBOX_FARTHEST_CORNER
Definition SoGLRenderAction.h:83
SoGLRenderAction::CUSTOM_CALLBACK
@ CUSTOM_CALLBACK
Definition SoGLRenderAction.h:84
SoGLRenderAction::setCacheContext
void setCacheContext(const uint32_t context)
Definition SoGLRenderAction.cpp:983
SoGLRenderAction::setUpdateArea
void setUpdateArea(const SbVec2f &origin, const SbVec2f &size)
Definition SoGLRenderAction.cpp:780
SoGLRenderAction::getAbortCallback
void getAbortCallback(SoGLRenderAbortCB *&func_out, void *&userdata_out) const
Definition SoGLRenderAction.cpp:848
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52