| 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 | #include <Inventor/SoLists.h>cxx . . $ `<file>/lib/database/include/Inventor/SoLists.h`/ |
| 38 | #include <Inventor/actions/SoSearchAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoSearchAction.h`/ |
| 39 | #include <Inventor/elements/SoModelMatrixElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoModelMatrixElement.h`/ |
| 40 | #include <Inventor/nodekits/SoBaseKit.h>cxx . . $ `<file>/lib/nodekits/include/Inventor/nodekits/SoBaseKit.h`/ |
| 41 | #include <Inventor/nodes/SoCamera.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoCamera.h`/ |
| 42 | #include <Inventor/nodes/SoClipPlane.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoClipPlane.h`/ |
| 43 | #include <Inventor/nodes/SoComplexity.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoComplexity.h`/ |
| 44 | #include <Inventor/nodes/SoCoordinate3.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoCoordinate3.h`/ |
| 45 | #include <Inventor/nodes/SoDrawStyle.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoDrawStyle.h`/ |
| 46 | #include <Inventor/nodes/SoEnvironment.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoEnvironment.h`/ |
| 47 | #include <Inventor/nodes/SoFile.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoFile.h`/ |
| 48 | #include <Inventor/nodes/SoFont.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoFont.h`/ |
| 49 | #include <Inventor/nodes/SoGroup.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoGroup.h`/ |
| 50 | #include <Inventor/nodes/SoInfo.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoInfo.h`/ |
| 51 | #include <Inventor/nodes/SoLOD.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoLOD.h`/ |
| 52 | #include <Inventor/nodes/SoLabel.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoLabel.h`/ |
| 53 | #include <Inventor/nodes/SoLevelOfDetail.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoLevelOfDetail.h`/ |
| 54 | #include <Inventor/nodes/SoLight.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoLight.h`/ |
| 55 | #include <Inventor/nodes/SoLightModel.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoLightModel.h`/ |
| 56 | #include <Inventor/nodes/SoMaterial.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoMaterial.h`/ |
| 57 | #include <Inventor/nodes/SoMaterialBinding.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoMaterialBinding.h`/ |
| 58 | #include <Inventor/nodes/SoNormal.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoNormal.h`/ |
| 59 | #include <Inventor/nodes/SoNormalBinding.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoNormalBinding.h`/ |
| 60 | #include <Inventor/nodes/SoPointSet.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoPointSet.h`/ |
| 61 | #include <Inventor/nodes/SoProfile.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoProfile.h`/ |
| 62 | #include <Inventor/nodes/SoProfileCoordinate2.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoProfileCoordinate2.h`/ |
| 63 | #include <Inventor/nodes/SoShape.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoShape.h`/ |
| 64 | #include <Inventor/nodes/SoShapeHints.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoShapeHints.h`/ |
| 65 | #include <Inventor/nodes/SoTexture2.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoTexture2.h`/ |
| 66 | #include <Inventor/nodes/SoTexture2Transform.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoTexture2Transform.h`/ |
| 67 | #include <Inventor/nodes/SoTextureCoordinate2.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoTextureCoordinate2.h`/ |
| 68 | #include <Inventor/nodes/SoTextureCoordinateBinding.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoTextureCoordinateBinding.h`/ |
| 69 | #include <Inventor/nodes/SoTransformation.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoTransformation.h`/ |
| 70 | #include <Inventor/nodes/SoVertexProperty.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoVertexProperty.h`/ |
| 71 | #include <Inventor/nodes/SoWWWAnchor.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoWWWAnchor.h`/ |
| 72 | #include <Inventor/nodes/SoWWWInline.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoWWWInline.h`/ |
| 73 | |
| 74 | #include "IfAssert.h"cxx . . $ `<file>/apps/tools/ivfix/IfAssert.h`/ |
| 75 | #include "IfCollector.h"cxx . . $ `<file>/apps/tools/ivfix/IfCollector.h`/ |
| 76 | #include "IfShape.h"cxx . . $ `<file>/apps/tools/ivfix/IfShape.h`/ |
| 77 | #include "IfTypes.h"cxx . . $ `<file>/apps/tools/ivfix/IfTypes.h`/ |
| 78 | |
| 79 | ///////////////////////////////////////////////////////////////////////////// |
| 80 | // |
| 81 | // Constructor. |
| 82 | // |
| 83 | ///////////////////////////////////////////////////////////////////////////// |
| 84 | |
| 85 | IfCollectorcxx . . $ IfCollector#::IfCollectorcxx . . $ IfCollector#IfCollector(49f6e7a06ebc5aa8).() |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | ///////////////////////////////////////////////////////////////////////////// |
| 90 | // |
| 91 | // Destructor. |
| 92 | // |
| 93 | ///////////////////////////////////////////////////////////////////////////// |
| 94 | |
| 95 | IfCollectorcxx . . $ IfCollector#::~cxx . . $ IfCollector#`~IfCollector`(49f6e7a06ebc5aa8).IfCollectorcxx . . $ IfCollector#() |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | ///////////////////////////////////////////////////////////////////////////// |
| 100 | // |
| 101 | // Finds all shapes in the given scene, creating a list of IfShape |
| 102 | // instances. The number of shapes is returned. |
| 103 | // |
| 104 | ///////////////////////////////////////////////////////////////////////////// |
| 105 | |
| 106 | int |
| 107 | IfCollectorcxx . . $ IfCollector#::collectcxx . . $ IfCollector#collect(663bdc897b8c5c8c).(SoNodecxx . . $ SoNode# *sceneRoot, IfShapecxx . . $ IfShape# *&shapeList, |
| 108 | SbBoolcxx . . $ SbBool# doTexCoords) |
| 109 | { |
| 110 | doingTexCoordscxx . . $ IfCollector#doingTexCoords. = doTexCoords; |
| 111 | |
| 112 | // These are all the types that we consider to be "shapes"; in |
| 113 | // other words, we do not want to go below these nodes when |
| 114 | // processing a scene. |
| 115 | SoTypeListcxx . . $ SoTypeList# shapeTypescxx . . $ SoTypeList#SoTypeList(49f6e7a06ebc5aa8).; |
| 116 | IfTypescxx . . $ IfTypes#::getShapeTypescxx . . $ IfTypes#getShapeTypes(5bda5d4fa9a25a2f).(&shapeTypes); |
| 117 | |
| 118 | // To find all the shapes in the scene, we apply an |
| 119 | // SoCallbackAction to the root. We would like to use an |
| 120 | // SoSearchAction, which is much faster, but we have to search for |
| 121 | // a variety of different node types, and we don't want to keep |
| 122 | // searching once we have found one. If we used an SoSearchAction, |
| 123 | // we would have to apply it once for each type and then somehow |
| 124 | // merge the returned lists of paths. |
| 125 | |
| 126 | SoCallbackActioncxx . . $ SoCallbackAction# cbacxx . . $ SoCallbackAction#SoCallbackAction(49f6e7a06ebc5aa8).; |
| 127 | int i; |
| 128 | for (i = 0; i < shapeTypes.getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) |
| 129 | cba.addPreCallbackcxx . . $ SoCallbackAction#addPreCallback(1d0ccca0114e1b6f).(shapeTypes[cxx . . $ SoTypeList#`operator[]`(eb1adc4f4b160d08).i], storePathCBcxx . . $ IfCollector#storePathCB(6eea413111466577)., this); |
| 130 | cba.applycxx . . $ SoAction#apply(da6c7544ccee32bd).(sceneRoot); |
| 131 | |
| 132 | // Determine the number of shapes |
| 133 | int numShapes = pathsToShapescxx . . $ IfCollector#pathsToShapes..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); |
| 134 | if (numShapes == 0) { |
| 135 | shapeList = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | // Allocate an array of IfShape instances of the correct size |
| 140 | shapeList = new IfShapecxx . . $ IfShape#IfShape(49f6e7a06ebc5aa8).[numShapes]; |
| 141 | |
| 142 | // For each shape, fill in the corresponding IfShape instance |
| 143 | for (i = 0; i < numShapes; i++) |
| 144 | collectShapecxx . . $ IfCollector#collectShape(5fd7836cf0d12d51).(pathsToShapescxx . . $ IfCollector#pathsToShapes.[cxx . . $ SoPathList#`operator[]`(81b2b9099fcfac9c).i], &shapeList[i]); |
| 145 | |
| 146 | return numShapes; |
| 147 | } |
| 148 | |
| 149 | ///////////////////////////////////////////////////////////////////////////// |
| 150 | // |
| 151 | // Stores a path to a shape found in the scene |
| 152 | // |
| 153 | ///////////////////////////////////////////////////////////////////////////// |
| 154 | |
| 155 | void |
| 156 | IfCollectorcxx . . $ IfCollector#::storePathcxx . . $ IfCollector#storePath(425635c2081b81c8).(SoCallbackActioncxx . . $ SoCallbackAction# *cba) |
| 157 | { |
| 158 | pathsToShapescxx . . $ IfCollector#pathsToShapes..appendcxx . . $ SoPathList#append(eed4dbbaf0eca0f1).(cba->getCurPathcxx . . $ SoAction#getCurPath(10165cdcf501ddd2).()->copycxx . . $ SoPath#copy(42f5adbf9b5b9c70).()); |
| 159 | } |
| 160 | |
| 161 | ///////////////////////////////////////////////////////////////////////////// |
| 162 | // |
| 163 | // Collects properties for a single shape. |
| 164 | // |
| 165 | ///////////////////////////////////////////////////////////////////////////// |
| 166 | |
| 167 | void |
| 168 | IfCollectorcxx . . $ IfCollector#::collectShapecxx . . $ IfCollector#collectShape(5fd7836cf0d12d51).(const SoPathcxx . . $ SoPath# *pathToShape, IfShapecxx . . $ IfShape# *shape) |
| 169 | { |
| 170 | // Find and remember the shape we're looking for. Note that if |
| 171 | // there is a special group (such as an Array or MultipleCopy) node |
| 172 | // in the path, we have to consider that to be the shape, since we |
| 173 | // don't want to ignore its special properties |
| 174 | currentShapecxx . . $ IfCollector#currentShape. = shape; |
| 175 | |
| 176 | const SoFullPathcxx . . $ SoFullPath# *fullPath = (const SoFullPathcxx . . $ SoFullPath# *) pathToShape; |
| 177 | for (int i = 0; i < fullPath->getLengthcxx . . $ SoFullPath#getLength(455f465bc33b4cdf).(); i++) { |
| 178 | SoNodecxx . . $ SoNode# *node = fullPath->getNodecxx . . $ SoPath#getNode(fd675789997d09c2).(i); |
| 179 | SoTypecxx . . $ SoType# type = node->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).(); |
| 180 | |
| 181 | // File, LOD, line- and point-based shape nodes, and some others |
| 182 | // are handled specially, since we want to make sure they are |
| 183 | // never flattened |
| 184 | if (IfTypescxx . . $ IfTypes#::isOpaqueGroupTypecxx . . $ IfTypes#isOpaqueGroupType(34bb3eef6b2c25d5).(type) || |
| 185 | IfTypescxx . . $ IfTypes#::isUnflattenableShapecxx . . $ IfTypes#isUnflattenableShape(34bb3eef6b2c25d5).(type)) { |
| 186 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(currentShape->shape == NULL); |
| 187 | currentShapecxx . . $ IfCollector#currentShape.->shapecxx . . $ IfShape#shape. = node; |
| 188 | currentShapecxx . . $ IfCollector#currentShape.->shapecxx . . $ IfShape#shape.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 189 | currentShapecxx . . $ IfCollector#currentShape.->dontFlattencxx . . $ IfShape#dontFlatten. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 190 | break; |
| 191 | } |
| 192 | |
| 193 | // Handle nodes that should be considered shapes: |
| 194 | if (IfTypescxx . . $ IfTypes#::isShapecxx . . $ IfTypes#isShape(34bb3eef6b2c25d5).(type)) { |
| 195 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(currentShape->shape == NULL); |
| 196 | currentShapecxx . . $ IfCollector#currentShape.->shapecxx . . $ IfShape#shape. = node; |
| 197 | currentShapecxx . . $ IfCollector#currentShape.->shapecxx . . $ IfShape#shape.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 198 | break; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | // Set up a callback to invoke at each node encountered |
| 203 | SoCallbackActioncxx . . $ SoCallbackAction# cacxx . . $ SoCallbackAction#SoCallbackAction(49f6e7a06ebc5aa8).; |
| 204 | ca.addPreCallbackcxx . . $ SoCallbackAction#addPreCallback(1d0ccca0114e1b6f).(SoNodecxx . . $ SoNode#::getClassTypeIdcxx . . $ SoNode#getClassTypeId(c00c150378d2b968).(), storeNodeCBcxx . . $ IfCollector#storeNodeCB(6eea413111466577)., this); |
| 205 | |
| 206 | // Examine each node that affects the shape |
| 207 | ca.applycxx . . $ SoAction#apply(eed4dbbaf0eca0f1).((SoPathcxx . . $ SoPath# *) pathToShape); |
| 208 | |
| 209 | // If the shape is derived from SoVertexShape and has a non-NULL |
| 210 | // vertexProperty field, this has to be handled specially |
| 211 | if (shape->shapecxx . . $ IfShape#shape.->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoVertexShapecxx . . $ SoVertexShape#::getClassTypeIdcxx . . $ SoVertexShape#getClassTypeId(c00c150378d2b968).())) { |
| 212 | SoVertexShapecxx . . $ SoVertexShape# *vs = (SoVertexShapecxx . . $ SoVertexShape# *) shape->shapecxx . . $ IfShape#shape.; |
| 213 | SoVertexPropertycxx . . $ SoVertexProperty# *vp = |
| 214 | (SoVertexPropertycxx . . $ SoVertexProperty# *) vs->vertexPropertycxx . . $ SoVertexShape#vertexProperty..getValuecxx . . $ SoSFNode#getValue(b794963b450d51b3).(); |
| 215 | if (vp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 216 | // Copy the properties from the SoVertexProperty node |
| 217 | // into separate property nodes |
| 218 | handleVertexPropertycxx . . $ IfCollector#handleVertexProperty(27ca9d28c62cfe73).(shape, vp); |
| 219 | |
| 220 | // Create a copy of the shape that does not have an |
| 221 | // SoVertexProperty node in it. Otherwise, the primitive |
| 222 | // generation code for the shape can get confused. |
| 223 | SoNodecxx . . $ SoNode# *shapeCopy = shape->shapecxx . . $ IfShape#shape.->copycxx . . $ SoNode#copy(fd675789997d09c2).(); |
| 224 | shapeCopy->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 225 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(shapeCopy->isOfType(SoVertexShape::getClassTypeId())); |
| 226 | SoVertexShapecxx . . $ SoVertexShape# *vsCopy = (SoVertexShapecxx . . $ SoVertexShape# *) shapeCopy; |
| 227 | vsCopy->vertexPropertycxx . . $ SoVertexShape#vertexProperty. =cxx . . $ SoSFNode#`operator=`(4a10d168dc65ab48). NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 228 | shape->shapecxx . . $ IfShape#shape.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 229 | shape->shapecxx . . $ IfShape#shape. = shapeCopy; |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | ///////////////////////////////////////////////////////////////////////////// |
| 235 | // |
| 236 | // Stores a node encountered during traversal of a path to a shape. |
| 237 | // |
| 238 | ///////////////////////////////////////////////////////////////////////////// |
| 239 | |
| 240 | SoCallbackActioncxx . . $ SoCallbackAction#::Responsecxx . . $ SoCallbackAction#Response# |
| 241 | IfCollectorcxx . . $ IfCollector#::storeNodecxx . . $ IfCollector#storeNode(137c9e99dd0fd55f).(SoCallbackActioncxx . . $ SoCallbackAction# *cba, SoNodecxx . . $ SoNode# *node) |
| 242 | { |
| 243 | ////////////////////////////////////////////////////////////////// |
| 244 | // |
| 245 | // Make sure we stop when we hit the shape we are collecting. If |
| 246 | // we do hit the shape, also get the current matrix from the |
| 247 | // state. |
| 248 | // |
| 249 | |
| 250 | if (node == currentShapecxx . . $ IfCollector#currentShape.->shapecxx . . $ IfShape#shape.) { |
| 251 | currentShapecxx . . $ IfCollector#currentShape.->transformcxx . . $ IfShape#transform. =cxx . . $ SbMatrix#`operator=`(5bda0b2cfca989a9). SoModelMatrixElementcxx . . $ SoModelMatrixElement#::getcxx . . $ SoModelMatrixElement#get(361591dce4cd33b0).(cba->getStatecxx . . $ SoAction#getState(5c8eb8fe6550a03).()); |
| 252 | return SoCallbackActioncxx . . $ SoCallbackAction#::PRUNEcxx . . $ SoCallbackAction#PRUNE.; |
| 253 | } |
| 254 | |
| 255 | // Get the type of the node |
| 256 | SoTypecxx . . $ SoType# nodeType = node->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).(); |
| 257 | |
| 258 | // Based on the type of the node, store the appropriate pointer to |
| 259 | // it in the IfShape instance |
| 260 | |
| 261 | #define IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(classname) \ |
| 262 | nodeType.isDerivedFrom(classname::getClassTypeId()) |
| 263 | |
| 264 | #define SET_TO_NULLcxx . . $ `apps/tools/ivfix/IfCollector.c++:264:9`!(field) \ |
| 265 | if (currentShape->field != NULL) \ |
| 266 | currentShape->field->unref(); \ |
| 267 | currentShape->field = NULL |
| 268 | |
| 269 | #define SET_TO_NODEcxx . . $ `apps/tools/ivfix/IfCollector.c++:269:9`!(field, classname) \ |
| 270 | if (currentShape->field != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) \ |
| 271 | currentShape->field->unref(); \ |
| 272 | currentShape->field = (classname *) node; \ |
| 273 | currentShape->field->ref() |
| 274 | |
| 275 | #define ADD_TO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:275:9`!(field) \ |
| 276 | if (currentShape->field == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) \ |
| 277 | currentShape->field = new SoNodeList; \ |
| 278 | currentShape->field->append(node) |
| 279 | |
| 280 | #define DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(classname, field) \ |
| 281 | else if (IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(classname)) { \ |
| 282 | SET_TO_NODEcxx . . $ `apps/tools/ivfix/IfCollector.c++:269:9`!(field, classname); \ |
| 283 | } |
| 284 | |
| 285 | #define DO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:285:9`!(classname, field) \ |
| 286 | else if (IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(classname)) { \ |
| 287 | ADD_TO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:275:9`!(field); \ |
| 288 | } |
| 289 | |
| 290 | ////////////////////////////////////////////////////////////////// |
| 291 | // |
| 292 | // Special cases: |
| 293 | // |
| 294 | |
| 295 | // Skip over any shapes, groups, node kits, labels, info, and |
| 296 | // transformations |
| 297 | if (IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoShape) || |
| 298 | IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoGroup) || |
| 299 | IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoBaseKit) || |
| 300 | IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoNodeKitListPart) || |
| 301 | IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoLabel) || |
| 302 | IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoInfo) || |
| 303 | IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoTransformation)) |
| 304 | ; // Do nothing |
| 305 | |
| 306 | // These node types are kept in lists: |
| 307 | DO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:285:9`!(SoClipPlane, clipPlanes) |
| 308 | DO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:285:9`!(SoLight, lights) |
| 309 | DO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:285:9`!(SoProfile, profiles) |
| 310 | |
| 311 | // Special handling of texture transform nodes. If we are NOT |
| 312 | // producing texture coordinates, we need to save and output these |
| 313 | // transforms, so they are added to the "other" list. |
| 314 | else if (IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoTexture2Transform)) { |
| 315 | if (doingTexCoordscxx . . $ IfCollector#doingTexCoords.) { |
| 316 | ADD_TO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:275:9`!(textureTransforms); |
| 317 | } |
| 318 | else { |
| 319 | ADD_TO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:275:9`!(other); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | // Vertex property nodes are handled specially |
| 324 | else if (IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoVertexProperty)) |
| 325 | handleVertexPropertycxx . . $ IfCollector#handleVertexProperty(27ca9d28c62cfe73).(currentShapecxx . . $ IfCollector#currentShape., (SoVertexPropertycxx . . $ SoVertexProperty# *) node); |
| 326 | |
| 327 | // Materials have to be copied. We may be playing around with |
| 328 | // their values later on, so we want to make sure that changing a |
| 329 | // material does not affect other objects. (This is especially |
| 330 | // important if fixing is done on several objects in the same |
| 331 | // scene graph.) |
| 332 | else if (IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`!(SoMaterial)) { |
| 333 | if (currentShapecxx . . $ IfCollector#currentShape.->materialcxx . . $ IfShape#material. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 334 | currentShapecxx . . $ IfCollector#currentShape.->materialcxx . . $ IfShape#material.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 335 | currentShapecxx . . $ IfCollector#currentShape.->materialcxx . . $ IfShape#material. = (SoMaterialcxx . . $ SoMaterial# *) node->copycxx . . $ SoNode#copy(fd675789997d09c2).(); |
| 336 | currentShapecxx . . $ IfCollector#currentShape.->materialcxx . . $ IfShape#material.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 337 | } |
| 338 | |
| 339 | ////////////////////////////////////////////////////////////////// |
| 340 | // |
| 341 | // Typical cases: |
| 342 | // |
| 343 | |
| 344 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoCamera, camera) |
| 345 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoComplexity, complexity) |
| 346 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoCoordinate3, coords) |
| 347 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoDrawStyle, drawStyle) |
| 348 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoEnvironment, environment) |
| 349 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoFont, font) |
| 350 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoLightModel, lightModel) |
| 351 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoMaterialBinding, materialBinding) |
| 352 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoNormal, normals) |
| 353 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoNormalBinding, normalBinding) |
| 354 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoProfileCoordinate2, profileCoords) |
| 355 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoShapeHints, shapeHints) |
| 356 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoTexture2, texture) |
| 357 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoTextureCoordinate2, texCoords) |
| 358 | DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`!(SoTextureCoordinateBinding, texCoordBinding) |
| 359 | |
| 360 | ////////////////////////////////////////////////////////////////// |
| 361 | // |
| 362 | // Anything else: |
| 363 | // |
| 364 | |
| 365 | else { |
| 366 | ADD_TO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:275:9`!(other); |
| 367 | } |
| 368 | |
| 369 | return SoCallbackActioncxx . . $ SoCallbackAction#::CONTINUEcxx . . $ SoCallbackAction#CONTINUE.; |
| 370 | |
| 371 | #undef IS_OF_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:261:9`! |
| 372 | #undef SET_TO_NULLcxx . . $ `apps/tools/ivfix/IfCollector.c++:264:9`! |
| 373 | #undef SET_TO_NODEcxx . . $ `apps/tools/ivfix/IfCollector.c++:269:9`! |
| 374 | #undef ADD_TO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:275:9`! |
| 375 | #undef DO_TYPEcxx . . $ `apps/tools/ivfix/IfCollector.c++:280:9`! |
| 376 | #undef DO_LISTcxx . . $ `apps/tools/ivfix/IfCollector.c++:285:9`! |
| 377 | } |
| 378 | |
| 379 | ///////////////////////////////////////////////////////////////////////////// |
| 380 | // |
| 381 | // Handles properties stored in a vertexProperty node. |
| 382 | // |
| 383 | ///////////////////////////////////////////////////////////////////////////// |
| 384 | |
| 385 | void |
| 386 | IfCollectorcxx . . $ IfCollector#::handleVertexPropertycxx . . $ IfCollector#handleVertexProperty(27ca9d28c62cfe73).(IfShapecxx . . $ IfShape# *shape, SoVertexPropertycxx . . $ SoVertexProperty# *vp) |
| 387 | { |
| 388 | int num; |
| 389 | |
| 390 | // Coordinates |
| 391 | num = vp->vertexcxx . . $ SoVertexProperty#vertex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); |
| 392 | if (num > 0) { |
| 393 | if (shape->coordscxx . . $ IfShape#coords. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 394 | shape->coordscxx . . $ IfShape#coords.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 395 | shape->coordscxx . . $ IfShape#coords. = new SoCoordinate3cxx . . $ SoCoordinate3#; |
| 396 | shape->coordscxx . . $ IfShape#coords.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 397 | shape->coordscxx . . $ IfShape#coords.->pointcxx . . $ SoCoordinate3#point..setValuescxx . . $ SoMFVec3f#setValues(5f546bd7717b455b).(0, num, vp->vertexcxx . . $ SoVertexProperty#vertex..getValuescxx . . $ SoMFVec3f#getValues(aa6f7bb3bba6ed95).(0)); |
| 398 | } |
| 399 | |
| 400 | // Normals |
| 401 | num = vp->normalcxx . . $ SoVertexProperty#normal..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); |
| 402 | if (num > 0) { |
| 403 | if (shape->normalscxx . . $ IfShape#normals. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 404 | shape->normalscxx . . $ IfShape#normals.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 405 | shape->normalscxx . . $ IfShape#normals. = new SoNormalcxx . . $ SoNormal#; |
| 406 | shape->normalscxx . . $ IfShape#normals.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 407 | shape->normalscxx . . $ IfShape#normals.->vectorcxx . . $ SoNormal#vector..setValuescxx . . $ SoMFVec3f#setValues(5f546bd7717b455b).(0, num, vp->normalcxx . . $ SoVertexProperty#normal..getValuescxx . . $ SoMFVec3f#getValues(aa6f7bb3bba6ed95).(0)); |
| 408 | |
| 409 | // Steal normal binding |
| 410 | shape->normalBindingcxx . . $ IfShape#normalBinding. = new SoNormalBindingcxx . . $ SoNormalBinding#; |
| 411 | shape->normalBindingcxx . . $ IfShape#normalBinding.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 412 | shape->normalBindingcxx . . $ IfShape#normalBinding.->valuecxx . . $ SoNormalBinding#value. =cxx . . $ SoSFEnum#`operator=`(7864480464b09eea). vp->normalBindingcxx . . $ SoVertexProperty#normalBinding..getValuecxx . . $ SoSFEnum#getValue(455f465bc33b4cdf).(); |
| 413 | } |
| 414 | |
| 415 | // Colors |
| 416 | num = vp->orderedRGBAcxx . . $ SoVertexProperty#orderedRGBA..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); |
| 417 | if (num > 0) { |
| 418 | SoMaterialcxx . . $ SoMaterial# *oldMaterial = shape->materialcxx . . $ IfShape#material.; |
| 419 | if (oldMaterial != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 420 | shape->materialcxx . . $ IfShape#material. = (SoMaterialcxx . . $ SoMaterial# *) oldMaterial->copycxx . . $ SoNode#copy(fd675789997d09c2).(); |
| 421 | oldMaterial->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 422 | } |
| 423 | else |
| 424 | shape->materialcxx . . $ IfShape#material. = new SoMaterialcxx . . $ SoMaterial#; |
| 425 | shape->materialcxx . . $ IfShape#material.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 426 | |
| 427 | // Unpack the colors |
| 428 | shape->materialcxx . . $ IfShape#material.->diffuseColorcxx . . $ SoMaterial#diffuseColor..setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(num); |
| 429 | shape->materialcxx . . $ IfShape#material.->transparencycxx . . $ SoMaterial#transparency..setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(num); |
| 430 | SbColorcxx . . $ SbColor# *dc = shape->materialcxx . . $ IfShape#material.->diffuseColorcxx . . $ SoMaterial#diffuseColor..startEditingcxx . . $ SoMFColor#startEditing(bb43ce3e427ef7d0).(); |
| 431 | float *tr = shape->materialcxx . . $ IfShape#material.->transparencycxx . . $ SoMaterial#transparency..startEditingcxx . . $ SoMFFloat#startEditing(a3aba87f01dec7c2).(); |
| 432 | const uint32_tcxx . . $ uint32_t# *pc = vp->orderedRGBAcxx . . $ SoVertexProperty#orderedRGBA..getValuescxx . . $ SoMFUInt32#getValues(a038480544947692).(0); |
| 433 | |
| 434 | for (int i = 0; i < num; i++) |
| 435 | dc[i].setPackedValuecxx . . $ SbColor#setPackedValue(e2bedabf26994b1f).(pc[i], tr[i]); |
| 436 | |
| 437 | shape->materialcxx . . $ IfShape#material.->diffuseColorcxx . . $ SoMaterial#diffuseColor..finishEditingcxx . . $ SoMFColor#finishEditing(49f6e7a06ebc5aa8).(); |
| 438 | shape->materialcxx . . $ IfShape#material.->transparencycxx . . $ SoMaterial#transparency..finishEditingcxx . . $ SoMFFloat#finishEditing(49f6e7a06ebc5aa8).(); |
| 439 | |
| 440 | // Steal material binding |
| 441 | shape->materialBindingcxx . . $ IfShape#materialBinding. = new SoMaterialBindingcxx . . $ SoMaterialBinding#; |
| 442 | shape->materialBindingcxx . . $ IfShape#materialBinding.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 443 | shape->materialBindingcxx . . $ IfShape#materialBinding.->valuecxx . . $ SoMaterialBinding#value. =cxx . . $ SoSFEnum#`operator=`(7864480464b09eea). vp->materialBindingcxx . . $ SoVertexProperty#materialBinding..getValuecxx . . $ SoSFEnum#getValue(455f465bc33b4cdf).(); |
| 444 | } |
| 445 | |
| 446 | // Texture coordinates |
| 447 | num = vp->texCoordcxx . . $ SoVertexProperty#texCoord..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); |
| 448 | if (num > 0) { |
| 449 | if (shape->texCoordscxx . . $ IfShape#texCoords. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 450 | shape->texCoordscxx . . $ IfShape#texCoords.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 451 | shape->texCoordscxx . . $ IfShape#texCoords. = new SoTextureCoordinate2cxx . . $ SoTextureCoordinate2#; |
| 452 | shape->texCoordscxx . . $ IfShape#texCoords.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 453 | shape->texCoordscxx . . $ IfShape#texCoords.->pointcxx . . $ SoTextureCoordinate2#point..setValuescxx . . $ SoMFVec2f#setValues(21d0784f834d9cf3).(0, num, vp->texCoordcxx . . $ SoVertexProperty#texCoord..getValuescxx . . $ SoMFVec2f#getValues(5bca09746864a3ee).(0)); |
| 454 | } |
| 455 | } |