Debian Codegraph @

lib/database/src/so/nodes/SoComplexity.c++

raw
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990,91 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Classes:
46 | SoComplexity
47 |
48 | Author(s) : Paul S. Strauss
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #include <Inventor/actions/SoCallbackAction.h>
55 #include <Inventor/actions/SoGetBoundingBoxAction.h>
56 #include <Inventor/actions/SoGLRenderAction.h>
57 #include <Inventor/actions/SoPickAction.h>
58 #include <Inventor/elements/SoComplexityElement.h>
59 #include <Inventor/elements/SoTextureQualityElement.h>
60 #include <Inventor/elements/SoOverrideElement.h>
61 #include <Inventor/nodes/SoComplexity.h>
62
63 SO_NODE_SOURCE(SoComplexity);
64
65 ////////////////////////////////////////////////////////////////////////
66 //
67 // Description:
68 // Constructor
69 //
70 // Use: public
71
72 SoComplexity::SoComplexity()
73 //
74 ////////////////////////////////////////////////////////////////////////
75 {
76 SO_NODE_CONSTRUCTOR(SoComplexity);
77
78 SO_NODE_ADD_FIELD(type, (SoComplexityTypeElement::getDefault()));
79 SO_NODE_ADD_FIELD(value, (SoComplexityElement::getDefault()));
80 SO_NODE_ADD_FIELD(textureQuality,
81 (SoTextureQualityElement::getDefault()));
82
83 // Set up static info for enumerated type field
84 SO_NODE_DEFINE_ENUM_VALUE(Type, OBJECT_SPACE);
85 SO_NODE_DEFINE_ENUM_VALUE(Type, SCREEN_SPACE);
86 SO_NODE_DEFINE_ENUM_VALUE(Type, BOUNDING_BOX);
87
88 // Set up info in enumerated type field
89 SO_NODE_SET_SF_ENUM_TYPE(type, Type);
90
91 isBuiltIn = TRUE;
92 }
93
94 ////////////////////////////////////////////////////////////////////////
95 //
96 // Description:
97 // Destructor
98 //
99 // Use: public
100
101 SoComplexity::~SoComplexity()
102 //
103 ////////////////////////////////////////////////////////////////////////
104 {
105 }
106
107 ////////////////////////////////////////////////////////////////////////
108 //
109 // Description:
110 // Handles any action.
111 //
112 // Use: extender
113
114 void
115 SoComplexity::doAction(SoAction *action)
116 //
117 ////////////////////////////////////////////////////////////////////////
118 {
119 SoState *state = action->getState();
120
121 if (! type.isIgnored()
122 && ! SoOverrideElement::getComplexityTypeOverride(state)) {
123 if (isOverride()) {
124 SoOverrideElement::setComplexityTypeOverride(state, this, TRUE);
125 }
126 SoComplexityTypeElement::set(state, (SoComplexityTypeElement::Type)
127 type.getValue());
128 }
129
130 if (! value.isIgnored()
131 && ! SoOverrideElement::getComplexityOverride(state)) {
132 if (isOverride()) {
133 SoOverrideElement::setComplexityOverride(state, this, TRUE);
134 }
135 SoComplexityElement::set(state, value.getValue());
136 }
137 }
138
139 ////////////////////////////////////////////////////////////////////////
140 //
141 // Description:
142 // Does callback action thing.
143 //
144 // Use: extender
145
146 void
147 SoComplexity::callback(SoCallbackAction *action)
148 //
149 ////////////////////////////////////////////////////////////////////////
150 {
151 SoComplexity::doAction(action);
152 }
153
154 ////////////////////////////////////////////////////////////////////////
155 //
156 // Description:
157 // Does the get bounding box thing
158 //
159 // Use: extender
160
161 void
162 SoComplexity::getBoundingBox(SoGetBoundingBoxAction *action)
163 //
164 ////////////////////////////////////////////////////////////////////////
165 {
166 SoComplexity::doAction(action);
167 }
168
169 ////////////////////////////////////////////////////////////////////////
170 //
171 // Description:
172 // Does GL render action.
173 //
174 // Use: extender
175
176 void
177 SoComplexity::GLRender(SoGLRenderAction *action)
178 //
179 ////////////////////////////////////////////////////////////////////////
180 {
181 SoState *state = action->getState();
182
183 if (! textureQuality.isIgnored()
184 && ! SoTextureOverrideElement::getQualityOverride(state)) {
185 if (isOverride()) {
186 SoTextureOverrideElement::setQualityOverride(state, TRUE);
187 }
188 SoTextureQualityElement::set(state, textureQuality.getValue());
189 }
190
191 SoComplexity::doAction(action);
192 }
193
194 ////////////////////////////////////////////////////////////////////////
195 //
196 // Description:
197 // Does pick action thing.
198 //
199 // Use: extender
200
201 void
202 SoComplexity::pick(SoPickAction *action)
203 //
204 ////////////////////////////////////////////////////////////////////////
205 {
206 SoComplexity::doAction(action);
207 }