| 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/SbDict.h>cxx . . $ `<file>/lib/database/include/Inventor/SbDict.h`/ |
| 38 | #include <Inventor/nodes/SoCoordinate3.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoCoordinate3.h`/ |
| 39 | #include <Inventor/nodes/SoIndexedTriangleStripSet.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoIndexedTriangleStripSet.h`/ |
| 40 | |
| 41 | #include "IfAssert.h"cxx . . $ `<file>/apps/tools/ivfix/IfAssert.h`/ |
| 42 | #include "IfStripper.h"cxx . . $ `<file>/apps/tools/ivfix/IfStripper.h`/ |
| 43 | #include "IfHolder.h"cxx . . $ `<file>/apps/tools/ivfix/IfHolder.h`/ |
| 44 | |
| 45 | ///////////////////////////////////////////////////////////////////////////// |
| 46 | // |
| 47 | // Constructor. Initializes data structures. |
| 48 | // |
| 49 | ///////////////////////////////////////////////////////////////////////////// |
| 50 | |
| 51 | IfStrippercxx . . $ IfStripper#::IfStrippercxx . . $ IfStripper#IfStripper(49f6e7a06ebc5aa8).() |
| 52 | { |
| 53 | holdercxx . . $ IfStripper#holder. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 54 | } |
| 55 | |
| 56 | ///////////////////////////////////////////////////////////////////////////// |
| 57 | // |
| 58 | // Destructor. |
| 59 | // |
| 60 | ///////////////////////////////////////////////////////////////////////////// |
| 61 | |
| 62 | IfStrippercxx . . $ IfStripper#::~cxx . . $ IfStripper#`~IfStripper`(49f6e7a06ebc5aa8).IfStrippercxx . . $ IfStripper#() |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | ///////////////////////////////////////////////////////////////////////////// |
| 67 | // |
| 68 | // This takes a scene graph produced by flattening and condensing a |
| 69 | // graph and produces better triangle strips, if possible. |
| 70 | // |
| 71 | ///////////////////////////////////////////////////////////////////////////// |
| 72 | |
| 73 | void |
| 74 | IfStrippercxx . . $ IfStripper#::stripcxx . . $ IfStripper#strip(405e200fcf6cafee).(IfHoldercxx . . $ IfHolder# *_holder) |
| 75 | { |
| 76 | holdercxx . . $ IfStripper#holder. = _holder; |
| 77 | |
| 78 | // There had better be an SoIndexedTriangleStripSet in the IfHolder |
| 79 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(holder->stripSet != NULL); |
| 80 | |
| 81 | // This assumes that there is currently 1 triangle per strip in |
| 82 | // the SoIndexedTriangleStripSet |
| 83 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(holder->stripSet->coordIndex.getNum() % 4 == 0); |
| 84 | numTrianglescxx . . $ IfStripper#numTriangles. = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() / 4; |
| 85 | |
| 86 | // See if there are any normal, texture coord, and material indices |
| 87 | haveNormalscxx . . $ IfStripper#haveNormals. = (holdercxx . . $ IfStripper#holder.->doNormalscxx . . $ IfHolder#doNormals. && |
| 88 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->normalIndexcxx . . $ SoIndexedShape#normalIndex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() > 1); |
| 89 | haveTexCoordscxx . . $ IfStripper#haveTexCoords. = (holdercxx . . $ IfStripper#holder.->doTexCoordscxx . . $ IfHolder#doTexCoords. && |
| 90 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->textureCoordIndexcxx . . $ SoIndexedShape#textureCoordIndex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() > 1); |
| 91 | haveMaterialscxx . . $ IfStripper#haveMaterials. = (holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->materialIndexcxx . . $ SoIndexedShape#materialIndex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() > 1); |
| 92 | |
| 93 | // Coordinate, normal, and texture coordinate values have been |
| 94 | // condensed, but we don't know how many distinct vertices there |
| 95 | // are. If two vertices have all identical indices, they are |
| 96 | // duplicates. (It's possible for two vertices to share |
| 97 | // coordinates, but not normals, for example.) Determine |
| 98 | // how many distinct vertices there are and allocate StripVertex |
| 99 | // structures for them. |
| 100 | createVertexListcxx . . $ IfStripper#createVertexList(49f6e7a06ebc5aa8).(); |
| 101 | |
| 102 | // Allocate and fill in triangle data structures |
| 103 | createTriangleListcxx . . $ IfStripper#createTriangleList(49f6e7a06ebc5aa8).(); |
| 104 | |
| 105 | // Find adjacent triangles |
| 106 | findNeighborTrianglescxx . . $ IfStripper#findNeighborTriangles(49f6e7a06ebc5aa8).(); |
| 107 | |
| 108 | // Set up the pending triangle lists |
| 109 | setUpPendingTriangleListscxx . . $ IfStripper#setUpPendingTriangleLists(49f6e7a06ebc5aa8).(); |
| 110 | |
| 111 | // We are going to fill in the vertex pointer list (vertexPtrList) |
| 112 | // with pointers to the vertices forming the new triangle |
| 113 | // strips. A NULL pointer indicates the end of a strip. First, |
| 114 | // create the list with a reasonable size guess, to avoid lots of |
| 115 | // reallocing. |
| 116 | vertexPtrListcxx . . $ IfStripper#vertexPtrList. = new SbPListcxx . . $ SbPList#(numTrianglescxx . . $ IfStripper#numTriangles. * 2); |
| 117 | |
| 118 | // Create strips from the connected triangles |
| 119 | createStripscxx . . $ IfStripper#createStrips(49f6e7a06ebc5aa8).(); |
| 120 | |
| 121 | // Change the indices in the triangle strip |
| 122 | adjustIndicescxx . . $ IfStripper#adjustIndices(49f6e7a06ebc5aa8).(); |
| 123 | |
| 124 | // Clean up |
| 125 | delete [] verticescxx . . $ IfStripper#vertices.; |
| 126 | delete [] trianglescxx . . $ IfStripper#triangles.; |
| 127 | delete vertexPtrListcxx . . $ IfStripper#vertexPtrList.; |
| 128 | } |
| 129 | |
| 130 | //////////////////////////////////////////////////////////////////////// |
| 131 | // |
| 132 | // Fills in StripVertex structures that represent triangle |
| 133 | // vertices. Returns the number of distinct vertices. |
| 134 | // |
| 135 | //////////////////////////////////////////////////////////////////////// |
| 136 | |
| 137 | void |
| 138 | IfStrippercxx . . $ IfStripper#::createVertexListcxx . . $ IfStripper#createVertexList(49f6e7a06ebc5aa8).() |
| 139 | { |
| 140 | // Step 0: Access the fields we will need to use |
| 141 | int numCoordIndices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); |
| 142 | const int32_tcxx . . $ int32_t# *coordIndices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..getValuescxx . . $ SoMFInt32#getValues(7547fac9af83ee5e).(0); |
| 143 | const int32_tcxx . . $ int32_t# *normalIndices = (! haveNormalscxx . . $ IfStripper#haveNormals. ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! : |
| 144 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->normalIndexcxx . . $ SoIndexedShape#normalIndex..getValuescxx . . $ SoMFInt32#getValues(7547fac9af83ee5e).(0)); |
| 145 | const int32_tcxx . . $ int32_t# *texCoordIndices = (! haveTexCoordscxx . . $ IfStripper#haveTexCoords. ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! : |
| 146 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.-> |
| 147 | textureCoordIndexcxx . . $ SoIndexedShape#textureCoordIndex..getValuescxx . . $ SoMFInt32#getValues(7547fac9af83ee5e).(0)); |
| 148 | const int32_tcxx . . $ int32_t# *mtlIndices = (! haveMaterialscxx . . $ IfStripper#haveMaterials. ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! : |
| 149 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->materialIndexcxx . . $ SoIndexedShape#materialIndex..getValuescxx . . $ SoMFInt32#getValues(7547fac9af83ee5e).(0)); |
| 150 | |
| 151 | // Step 1: Assume the worst: all coordinates are distinct |
| 152 | int maxNumVertices = numTrianglescxx . . $ IfStripper#numTriangles. * 3; |
| 153 | |
| 154 | // Step 2: Allocate an array of StripVertex instances big enough |
| 155 | // to hold all of them |
| 156 | StripVertexcxx . . $ IfStripper#StripVertex# *allVertices = new StripVertexcxx . . $ IfStripper#StripVertex#[maxNumVertices]; |
| 157 | |
| 158 | // Step 3: Create an array of pointers to StripVertex instances, |
| 159 | // indexed by coordinate index. This will allow use to find |
| 160 | // duplicates very easily. (Note that the maximum coordinate index |
| 161 | // we can find is the number of coordinate values - 1.) |
| 162 | int i, numCoords = holdercxx . . $ IfStripper#holder.->coordscxx . . $ IfHolder#coords.->pointcxx . . $ SoCoordinate3#point..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); |
| 163 | StripVertexcxx . . $ IfStripper#StripVertex# **table = new StripVertexcxx . . $ IfStripper#StripVertex# *[numCoords]; |
| 164 | for (i = 0; i < numCoords; i++) |
| 165 | table[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 166 | |
| 167 | // Step 4: Also create an array of indices into the StripVertex |
| 168 | // instances, indexed by the index into the coordIndex field. This |
| 169 | // is used later on to create triangles from the StripVertex |
| 170 | // instances. |
| 171 | vertexMapcxx . . $ IfStripper#vertexMap. = new int [numCoordIndices]; |
| 172 | |
| 173 | // Step 5: Fill in the StripVertex instances with actual indices, |
| 174 | // checking for duplicates. If we find a duplicate, we don't save |
| 175 | // it. |
| 176 | StripVertexcxx . . $ IfStripper#StripVertex# *curVert = allVertices; |
| 177 | for (i = 0; i < numCoordIndices; i++) { |
| 178 | |
| 179 | int coordIndex = coordIndices[i]; |
| 180 | |
| 181 | if (coordIndex < 0) { |
| 182 | vertexMapcxx . . $ IfStripper#vertexMap.[i] = -1; |
| 183 | continue; |
| 184 | } |
| 185 | |
| 186 | // Fill in the next StripVertex instance |
| 187 | curVert->coordIndexcxx . . $ IfStripper#StripVertex#coordIndex. = coordIndex; |
| 188 | curVert->normIndexcxx . . $ IfStripper#StripVertex#normIndex. = (haveNormalscxx . . $ IfStripper#haveNormals. ? normalIndices[i] : -1); |
| 189 | curVert->texCoordIndexcxx . . $ IfStripper#StripVertex#texCoordIndex. = (haveTexCoordscxx . . $ IfStripper#haveTexCoords. ? texCoordIndices[i] : -1); |
| 190 | curVert->mtlIndexcxx . . $ IfStripper#StripVertex#mtlIndex. = (haveMaterialscxx . . $ IfStripper#haveMaterials. ? mtlIndices[i] : -1); |
| 191 | curVert->uniqueIDcxx . . $ IfStripper#StripVertex#uniqueID. = curVert - allVertices; |
| 192 | |
| 193 | // See if we have any entries at that slot in the table |
| 194 | StripVertexcxx . . $ IfStripper#StripVertex# *oldVert; |
| 195 | for (oldVert = table[coordIndex]; oldVert != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 196 | oldVert = oldVert->nextcxx . . $ IfStripper#StripVertex#next.) { |
| 197 | |
| 198 | if (oldVert->normIndexcxx . . $ IfStripper#StripVertex#normIndex. == curVert->normIndexcxx . . $ IfStripper#StripVertex#normIndex. && |
| 199 | oldVert->texCoordIndexcxx . . $ IfStripper#StripVertex#texCoordIndex. == curVert->texCoordIndexcxx . . $ IfStripper#StripVertex#texCoordIndex. && |
| 200 | oldVert->mtlIndexcxx . . $ IfStripper#StripVertex#mtlIndex. == curVert->mtlIndexcxx . . $ IfStripper#StripVertex#mtlIndex.) |
| 201 | break; |
| 202 | } |
| 203 | |
| 204 | // If we found a match, re-use the old vertex |
| 205 | if (oldVert != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 206 | vertexMapcxx . . $ IfStripper#vertexMap.[i] = oldVert->uniqueIDcxx . . $ IfStripper#StripVertex#uniqueID.; |
| 207 | |
| 208 | // Otherwise, store this vertex in the table and prepare for |
| 209 | // the next vertex |
| 210 | else { |
| 211 | curVert->nextcxx . . $ IfStripper#StripVertex#next. = table[coordIndex]; |
| 212 | table[coordIndex] = curVert; |
| 213 | vertexMapcxx . . $ IfStripper#vertexMap.[i] = curVert->uniqueIDcxx . . $ IfStripper#StripVertex#uniqueID.; |
| 214 | curVert++; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | // Step 6: The number of vertices we stored is the number of |
| 219 | // distinct vertices |
| 220 | numVerticescxx . . $ IfStripper#numVertices. = curVert - allVertices; |
| 221 | |
| 222 | // Step 7: Copy the distinct vertices into the real array |
| 223 | verticescxx . . $ IfStripper#vertices. = new StripVertexcxx . . $ IfStripper#StripVertex#[numVerticescxx . . $ IfStripper#numVertices.]; |
| 224 | for (i = 0; i < numVerticescxx . . $ IfStripper#numVertices.; i++) |
| 225 | verticescxx . . $ IfStripper#vertices.[i] =cxx . . $ IfStripper#StripVertex#`operator=`(53e91820a8770fb0). allVertices[i]; |
| 226 | |
| 227 | // Step 8: Get rid of the stuff we don't need any more |
| 228 | delete [] table; |
| 229 | delete [] allVertices; |
| 230 | } |
| 231 | |
| 232 | //////////////////////////////////////////////////////////////////////// |
| 233 | // |
| 234 | // Creates structures that will be easier to deal with when creating |
| 235 | // triangle strips. |
| 236 | // |
| 237 | //////////////////////////////////////////////////////////////////////// |
| 238 | |
| 239 | void |
| 240 | IfStrippercxx . . $ IfStripper#::createTriangleListcxx . . $ IfStripper#createTriangleList(49f6e7a06ebc5aa8).() |
| 241 | { |
| 242 | const int32_tcxx . . $ int32_t# *coordIndices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..getValuescxx . . $ SoMFInt32#getValues(7547fac9af83ee5e).(0); |
| 243 | |
| 244 | // Allocate triangles |
| 245 | trianglescxx . . $ IfStripper#triangles. = new StripTrianglecxx . . $ IfStripper#StripTriangle#[numTrianglescxx . . $ IfStripper#numTriangles.]; |
| 246 | |
| 247 | // Fill in triangle structures, using the vertexMap created in |
| 248 | // createVertexList |
| 249 | for (int i = 0; i < numTrianglescxx . . $ IfStripper#numTriangles.; i++) { |
| 250 | |
| 251 | StripTrianglecxx . . $ IfStripper#StripTriangle# *tri = &trianglescxx . . $ IfStripper#triangles.[i]; |
| 252 | |
| 253 | tri->indexcxx . . $ IfStripper#StripTriangle#index. = i; |
| 254 | |
| 255 | for (int j = 0; j < 3; j++) { |
| 256 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(coordIndices[4*i + j] >= 0); |
| 257 | int vertexIndex = vertexMapcxx . . $ IfStripper#vertexMap.[4*i + j]; |
| 258 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(vertexIndex >= 0); |
| 259 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(vertexIndex < numVertices); |
| 260 | tri->vcxx . . $ IfStripper#StripTriangle#v.[j] = &verticescxx . . $ IfStripper#vertices.[vertexIndex]; |
| 261 | } |
| 262 | |
| 263 | // No neighbors yet |
| 264 | tri->tcxx . . $ IfStripper#StripTriangle#t.[0] = tri->tcxx . . $ IfStripper#StripTriangle#t.[1] = tri->tcxx . . $ IfStripper#StripTriangle#t.[2] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 265 | |
| 266 | // Not used in a real strip yet |
| 267 | tri->isUsedcxx . . $ IfStripper#StripTriangle#isUsed. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 268 | |
| 269 | // We have no neighbor info yet. We will compute this later. |
| 270 | tri->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors. = -1; |
| 271 | |
| 272 | // Not in a list yet |
| 273 | tri->prevcxx . . $ IfStripper#StripTriangle#prev. = tri->nextcxx . . $ IfStripper#StripTriangle#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 274 | } |
| 275 | |
| 276 | // We don't need this any more |
| 277 | delete [] vertexMapcxx . . $ IfStripper#vertexMap.; |
| 278 | } |
| 279 | |
| 280 | ///////////////////////////////////////////////////////////////////////////// |
| 281 | // |
| 282 | // Finds adjacent triangles |
| 283 | // |
| 284 | ///////////////////////////////////////////////////////////////////////////// |
| 285 | |
| 286 | void |
| 287 | IfStrippercxx . . $ IfStripper#::findNeighborTrianglescxx . . $ IfStripper#findNeighborTriangles(49f6e7a06ebc5aa8).() |
| 288 | { |
| 289 | // Allocate edge structures |
| 290 | StripEdgecxx . . $ IfStripper#StripEdge# *edges = new StripEdgecxx . . $ IfStripper#StripEdge#[3 * numTrianglescxx . . $ IfStripper#numTriangles.]; |
| 291 | |
| 292 | // Create a dictionary for finding edges |
| 293 | edgeDictcxx . . $ IfStripper#edgeDict. = new SbDictcxx . . $ SbDict#SbDict(d4f767463ce0a6b3).(1235); |
| 294 | |
| 295 | // Run through triangles, storing edge structures and finding neighbors |
| 296 | StripEdgecxx . . $ IfStripper#StripEdge# *edge = edges; |
| 297 | for (int i = 0; i < numTrianglescxx . . $ IfStripper#numTriangles.; i++) { |
| 298 | |
| 299 | StripTrianglecxx . . $ IfStripper#StripTriangle# *tri = &trianglescxx . . $ IfStripper#triangles.[i]; |
| 300 | |
| 301 | // Look for a neighbor edge for each of the 3 edges. If found, |
| 302 | // mark the two triangles as neighbors and remove the neighbor |
| 303 | // edge from the list of unpaired edges. If not found, add the |
| 304 | // edge to the list. |
| 305 | |
| 306 | #define DO_EDGEcxx . . $ `apps/tools/ivfix/IfStripper.c++:306:9`!(VA, VB, WHICH) \ |
| 307 | edge->v1 = tri->v[VA]; \ |
| 308 | edge->v2 = tri->v[VB]; \ |
| 309 | edge->tri = tri; \ |
| 310 | edge->which = WHICH; \ |
| 311 | edge->next = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; \ |
| 312 | addEdge(edge); \ |
| 313 | edge++ |
| 314 | |
| 315 | DO_EDGEcxx . . $ `apps/tools/ivfix/IfStripper.c++:306:9`!(1, 2, 0); |
| 316 | DO_EDGEcxx . . $ `apps/tools/ivfix/IfStripper.c++:306:9`!(2, 0, 1); |
| 317 | DO_EDGEcxx . . $ `apps/tools/ivfix/IfStripper.c++:306:9`!(0, 1, 2); |
| 318 | |
| 319 | #undef DO_EDGEcxx . . $ `apps/tools/ivfix/IfStripper.c++:306:9`! |
| 320 | } |
| 321 | |
| 322 | // We created the edges only to set up the neighbor relationships |
| 323 | // in triangles. Now that that is done, we don't need the edges |
| 324 | // any more |
| 325 | delete [] edges; |
| 326 | delete edgeDictcxx . . $ IfStripper#edgeDict.; |
| 327 | } |
| 328 | |
| 329 | ///////////////////////////////////////////////////////////////////////////// |
| 330 | // |
| 331 | // Adds an edge to the list of edges, checking for neighbors |
| 332 | // |
| 333 | ///////////////////////////////////////////////////////////////////////////// |
| 334 | |
| 335 | void |
| 336 | IfStrippercxx . . $ IfStripper#::addEdgecxx . . $ IfStripper#addEdge(ecb15f764c57e204).(StripEdgecxx . . $ IfStripper#StripEdge# *newEdge) |
| 337 | { |
| 338 | // See if any edges like this one are already in the dictionary |
| 339 | uint32_tcxx . . $ uint32_t# key = hashEdgecxx . . $ IfStripper#hashEdge(c8faac2b0a41628c).(newEdge); |
| 340 | void *listPtr; |
| 341 | if (edgeDictcxx . . $ IfStripper#edgeDict.->findcxx . . $ SbDict#find(a750591cf51bff5e).(key, listPtr)) { |
| 342 | |
| 343 | // Look through edge list for a neighbor |
| 344 | SbBoolcxx . . $ SbBool# foundNeighbor = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 345 | StripEdgecxx . . $ IfStripper#StripEdge# *prevEdge = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 346 | for (StripEdgecxx . . $ IfStripper#StripEdge# *edge = (StripEdgecxx . . $ IfStripper#StripEdge# *) listPtr; |
| 347 | edge != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 348 | edge = edge->nextcxx . . $ IfStripper#StripEdge#next.) { |
| 349 | |
| 350 | // See if the edges are neighbors |
| 351 | if (edge->v1cxx . . $ IfStripper#StripEdge#v1. == newEdge->v2cxx . . $ IfStripper#StripEdge#v2. && edge->v2cxx . . $ IfStripper#StripEdge#v2. == newEdge->v1cxx . . $ IfStripper#StripEdge#v1.) { |
| 352 | |
| 353 | // Store the neighbor relationship in both triangles |
| 354 | edge->tricxx . . $ IfStripper#StripEdge#tri.->tcxx . . $ IfStripper#StripTriangle#t.[edge->whichcxx . . $ IfStripper#StripEdge#which.] = newEdge->tricxx . . $ IfStripper#StripEdge#tri.; |
| 355 | newEdge->tricxx . . $ IfStripper#StripEdge#tri.->tcxx . . $ IfStripper#StripTriangle#t.[newEdge->whichcxx . . $ IfStripper#StripEdge#which.] = edge->tricxx . . $ IfStripper#StripEdge#tri.; |
| 356 | |
| 357 | // Remove the neighbor edge from the dictionary |
| 358 | if (prevEdge != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 359 | prevEdge->nextcxx . . $ IfStripper#StripEdge#next. = edge->nextcxx . . $ IfStripper#StripEdge#next.; |
| 360 | else { |
| 361 | listPtr = edge->nextcxx . . $ IfStripper#StripEdge#next.; |
| 362 | |
| 363 | // If nothing left in list, remove the whole list |
| 364 | // from dictionary |
| 365 | if (listPtr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 366 | edgeDictcxx . . $ IfStripper#edgeDict.->removecxx . . $ SbDict#remove(15f694ef3c96d230).(key); |
| 367 | } |
| 368 | |
| 369 | // No need to keep looking |
| 370 | foundNeighbor = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 371 | break; |
| 372 | } |
| 373 | |
| 374 | prevEdge = edge; |
| 375 | } |
| 376 | |
| 377 | // Add the new edge to the end of the list if no neighbor was found |
| 378 | if (! foundNeighbor) |
| 379 | prevEdge->nextcxx . . $ IfStripper#StripEdge#next. = newEdge; |
| 380 | } |
| 381 | |
| 382 | // If no list exists yet for this hash key, create a new one |
| 383 | else |
| 384 | edgeDictcxx . . $ IfStripper#edgeDict.->entercxx . . $ SbDict#enter(9b3d2d56e494888).(key, newEdge); |
| 385 | } |
| 386 | |
| 387 | ///////////////////////////////////////////////////////////////////////////// |
| 388 | // |
| 389 | // Hash function for edges. This function is guaranteed to return the |
| 390 | // same value for two edges containing the same vertices, regardless |
| 391 | // of direction; i.e., it's symmetric. |
| 392 | // |
| 393 | ///////////////////////////////////////////////////////////////////////////// |
| 394 | |
| 395 | uint32_tcxx . . $ uint32_t# |
| 396 | IfStrippercxx . . $ IfStripper#::hashEdgecxx . . $ IfStripper#hashEdge(c8faac2b0a41628c).(StripEdgecxx . . $ IfStripper#StripEdge# *edge) |
| 397 | { |
| 398 | // Use the unique ID in each vertex to create the hashing key. |
| 399 | // Since we have to maintain symmetry, use the smaller index first. |
| 400 | int i1 = edge->v1cxx . . $ IfStripper#StripEdge#v1.->uniqueIDcxx . . $ IfStripper#StripVertex#uniqueID.; |
| 401 | int i2 = edge->v2cxx . . $ IfStripper#StripEdge#v2.->uniqueIDcxx . . $ IfStripper#StripVertex#uniqueID.; |
| 402 | if (i2 < i1) { |
| 403 | int t = i1; |
| 404 | i1 = i2; |
| 405 | i2 = t; |
| 406 | } |
| 407 | |
| 408 | // Note: this function is not guaranteed to produce all unique |
| 409 | // keys (if there are > 65536 unique vertices), but that's no |
| 410 | // problem, because there is a list of edges in each hash slot. |
| 411 | return (i1 << 16) + i2; |
| 412 | } |
| 413 | |
| 414 | ///////////////////////////////////////////////////////////////////////////// |
| 415 | // |
| 416 | // Sets up the pending triangle lists. |
| 417 | // |
| 418 | ///////////////////////////////////////////////////////////////////////////// |
| 419 | |
| 420 | void |
| 421 | IfStrippercxx . . $ IfStripper#::setUpPendingTriangleListscxx . . $ IfStripper#setUpPendingTriangleLists(49f6e7a06ebc5aa8).() |
| 422 | { |
| 423 | int i; |
| 424 | for (i = 0; i < 4; i++) |
| 425 | pendingTriListcxx . . $ IfStripper#pendingTriList.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 426 | |
| 427 | // Now that all neighbors are known, figure out how many neighbors |
| 428 | // each triangle has and set numUnusedNeighbors to that |
| 429 | // number. Then add the triangle to the appropriate list. |
| 430 | for (i = 0; i < numTrianglescxx . . $ IfStripper#numTriangles.; i++) { |
| 431 | StripTrianglecxx . . $ IfStripper#StripTriangle# *tri = &trianglescxx . . $ IfStripper#triangles.[i]; |
| 432 | |
| 433 | tri->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors. = 0; |
| 434 | |
| 435 | for (int j = 0; j < 3; j++) |
| 436 | if (tri->tcxx . . $ IfStripper#StripTriangle#t.[j] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 437 | tri->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors.++; |
| 438 | |
| 439 | addTrianglecxx . . $ IfStripper#addTriangle(ad31f253029d0a82).(tri, tri->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors.); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | ///////////////////////////////////////////////////////////////////////////// |
| 444 | // |
| 445 | // Creates strips from the connected triangles. |
| 446 | // |
| 447 | ///////////////////////////////////////////////////////////////////////////// |
| 448 | |
| 449 | void |
| 450 | IfStrippercxx . . $ IfStripper#::createStripscxx . . $ IfStripper#createStrips(49f6e7a06ebc5aa8).() |
| 451 | { |
| 452 | StripTrianglecxx . . $ IfStripper#StripTriangle# *tri; |
| 453 | |
| 454 | // Repeat until there are no more unmarked triangles |
| 455 | while (chooseStartTrianglecxx . . $ IfStripper#chooseStartTriangle(1b56d43c317d5af8).(tri)) { |
| 456 | |
| 457 | // Find a shared edge (if any) |
| 458 | int shared = 3; |
| 459 | for (int j = 0; j < 3; j++) { |
| 460 | if (tri->tcxx . . $ IfStripper#StripTriangle#t.[j] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && ! tri->tcxx . . $ IfStripper#StripTriangle#t.[j]->isUsedcxx . . $ IfStripper#StripTriangle#isUsed.) { |
| 461 | shared = j; |
| 462 | break; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | // Add 3 vertices of triangle, starting with vertex opposite |
| 467 | // shared edge to strip |
| 468 | switch (shared) { |
| 469 | case 0: |
| 470 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[0]); |
| 471 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[1]); |
| 472 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[2]); |
| 473 | break; |
| 474 | case 1: |
| 475 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[1]); |
| 476 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[2]); |
| 477 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[0]); |
| 478 | break; |
| 479 | case 2: |
| 480 | case 3: // No shared edges; order doesn't matter |
| 481 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[2]); |
| 482 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[0]); |
| 483 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(tri->vcxx . . $ IfStripper#StripTriangle#v.[1]); |
| 484 | break; |
| 485 | } |
| 486 | |
| 487 | // No shared edges? Mark triangle as used, terminate strip, |
| 488 | // and try another triangle |
| 489 | if (shared == 3) { |
| 490 | markTriangleUsedcxx . . $ IfStripper#markTriangleUsed(e0d0002fc2f5abc8).(tri); |
| 491 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 492 | continue; |
| 493 | } |
| 494 | |
| 495 | // This is used to choose which edge to go to next. It |
| 496 | // alternates after each triangle, to form a proper strip. |
| 497 | SbBoolcxx . . $ SbBool# oddFace = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 498 | |
| 499 | while (TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) { |
| 500 | |
| 501 | markTriangleUsedcxx . . $ IfStripper#markTriangleUsed(e0d0002fc2f5abc8).(tri); |
| 502 | |
| 503 | // Get the next triangle |
| 504 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(shared != 3); |
| 505 | StripTrianglecxx . . $ IfStripper#StripTriangle# *nextTri = tri->tcxx . . $ IfStripper#StripTriangle#t.[shared]; |
| 506 | |
| 507 | // Stop if there isn't any next triangle |
| 508 | if (nextTri == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || nextTri->isUsedcxx . . $ IfStripper#StripTriangle#isUsed.) |
| 509 | break; |
| 510 | |
| 511 | // Add the vertex of this triangle opposite the shared edge |
| 512 | if (nextTri->tcxx . . $ IfStripper#StripTriangle#t.[0] == tri) { |
| 513 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(nextTri->vcxx . . $ IfStripper#StripTriangle#v.[0]); |
| 514 | shared = (oddFace ? 2 : 1); |
| 515 | } |
| 516 | else if (nextTri->tcxx . . $ IfStripper#StripTriangle#t.[1] == tri) { |
| 517 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(nextTri->vcxx . . $ IfStripper#StripTriangle#v.[1]); |
| 518 | shared = (oddFace ? 0 : 2); |
| 519 | } |
| 520 | else if (nextTri->tcxx . . $ IfStripper#StripTriangle#t.[2] == tri) { |
| 521 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(nextTri->vcxx . . $ IfStripper#StripTriangle#v.[2]); |
| 522 | shared = (oddFace ? 1 : 0); |
| 523 | } |
| 524 | |
| 525 | // It's possible (if more than 2 triangles share an edge) |
| 526 | // that nextTri does not consider tri to be a neighbor. If |
| 527 | // this happens, end the current strip and start another. |
| 528 | else |
| 529 | break; |
| 530 | |
| 531 | // Prepare for next triangle |
| 532 | tri = nextTri; |
| 533 | oddFace = ! oddFace; |
| 534 | } |
| 535 | |
| 536 | // Terminate the strip |
| 537 | vertexPtrListcxx . . $ IfStripper#vertexPtrList.->appendcxx . . $ SbPList#append(5d22bdacc48458e8).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | //////////////////////////////////////////////////////////////////////// |
| 542 | // |
| 543 | // Chooses and returns a good starting triangle for tstrip generation. |
| 544 | // |
| 545 | //////////////////////////////////////////////////////////////////////// |
| 546 | |
| 547 | SbBoolcxx . . $ SbBool# |
| 548 | IfStrippercxx . . $ IfStripper#::chooseStartTrianglecxx . . $ IfStripper#chooseStartTriangle(1b56d43c317d5af8).(StripTrianglecxx . . $ IfStripper#StripTriangle# *&tri) |
| 549 | { |
| 550 | // Choose the triangle with the fewest unused neighbors |
| 551 | |
| 552 | for (int i = 0; i < 4; i++) { |
| 553 | if (pendingTriListcxx . . $ IfStripper#pendingTriList.[i] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 554 | tri = pendingTriListcxx . . $ IfStripper#pendingTriList.[i]; |
| 555 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(! tri->isUsed); |
| 556 | return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | tri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 561 | return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; |
| 562 | } |
| 563 | |
| 564 | ///////////////////////////////////////////////////////////////////////////// |
| 565 | // |
| 566 | // Marks a triangle as used, removing it from the pending list and |
| 567 | // changing the status of all neighbor triangles. |
| 568 | // |
| 569 | ///////////////////////////////////////////////////////////////////////////// |
| 570 | |
| 571 | void |
| 572 | IfStrippercxx . . $ IfStripper#::markTriangleUsedcxx . . $ IfStripper#markTriangleUsed(e0d0002fc2f5abc8).(StripTrianglecxx . . $ IfStripper#StripTriangle# *tri) |
| 573 | { |
| 574 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(! tri->isUsed); |
| 575 | |
| 576 | tri->isUsedcxx . . $ IfStripper#StripTriangle#isUsed. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 577 | |
| 578 | // Remove it from its current list |
| 579 | removeTrianglecxx . . $ IfStripper#removeTriangle(ad31f253029d0a82).(tri, tri->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors.); |
| 580 | |
| 581 | // Decrement the numUnusedNeighbors in all neighbors and move them |
| 582 | // to the correct list |
| 583 | for (int i = 0; i < 3; i++) { |
| 584 | StripTrianglecxx . . $ IfStripper#StripTriangle# *neigh = tri->tcxx . . $ IfStripper#StripTriangle#t.[i]; |
| 585 | if (neigh != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && ! neigh->isUsedcxx . . $ IfStripper#StripTriangle#isUsed.) { |
| 586 | ASSERTcxx . . $ `apps/tools/ivfix/IfAssert.h:54:9`!(neigh->numUnusedNeighbors > 0); |
| 587 | removeTrianglecxx . . $ IfStripper#removeTriangle(ad31f253029d0a82).(neigh, neigh->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors.); |
| 588 | addTrianglecxx . . $ IfStripper#addTriangle(ad31f253029d0a82).(neigh, --neigh->numUnusedNeighborscxx . . $ IfStripper#StripTriangle#numUnusedNeighbors.); |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | ///////////////////////////////////////////////////////////////////////////// |
| 594 | // |
| 595 | // Adds a triangle to the given pending list. |
| 596 | // |
| 597 | ///////////////////////////////////////////////////////////////////////////// |
| 598 | |
| 599 | void |
| 600 | IfStrippercxx . . $ IfStripper#::addTrianglecxx . . $ IfStripper#addTriangle(ad31f253029d0a82).(StripTrianglecxx . . $ IfStripper#StripTriangle# *tri, int listIndex) |
| 601 | { |
| 602 | StripTrianglecxx . . $ IfStripper#StripTriangle# *first = pendingTriListcxx . . $ IfStripper#pendingTriList.[listIndex]; |
| 603 | |
| 604 | if (first != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 605 | first->prevcxx . . $ IfStripper#StripTriangle#prev. = tri; |
| 606 | tri->nextcxx . . $ IfStripper#StripTriangle#next. = first; |
| 607 | tri->prevcxx . . $ IfStripper#StripTriangle#prev. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 608 | pendingTriListcxx . . $ IfStripper#pendingTriList.[listIndex] = tri; |
| 609 | } |
| 610 | |
| 611 | ///////////////////////////////////////////////////////////////////////////// |
| 612 | // |
| 613 | // Removes a triangle from the given pending list. |
| 614 | // |
| 615 | ///////////////////////////////////////////////////////////////////////////// |
| 616 | |
| 617 | void |
| 618 | IfStrippercxx . . $ IfStripper#::removeTrianglecxx . . $ IfStripper#removeTriangle(ad31f253029d0a82).(StripTrianglecxx . . $ IfStripper#StripTriangle# *tri, int listIndex) |
| 619 | { |
| 620 | if (tri->prevcxx . . $ IfStripper#StripTriangle#prev. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 621 | tri->prevcxx . . $ IfStripper#StripTriangle#prev.->nextcxx . . $ IfStripper#StripTriangle#next. = tri->nextcxx . . $ IfStripper#StripTriangle#next.; |
| 622 | else |
| 623 | pendingTriListcxx . . $ IfStripper#pendingTriList.[listIndex] = tri->nextcxx . . $ IfStripper#StripTriangle#next.; |
| 624 | |
| 625 | if (tri->nextcxx . . $ IfStripper#StripTriangle#next. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 626 | tri->nextcxx . . $ IfStripper#StripTriangle#next.->prevcxx . . $ IfStripper#StripTriangle#prev. = tri->prevcxx . . $ IfStripper#StripTriangle#prev.; |
| 627 | } |
| 628 | |
| 629 | ///////////////////////////////////////////////////////////////////////////// |
| 630 | // |
| 631 | // Changes the indices in the triangle strip. |
| 632 | // |
| 633 | ///////////////////////////////////////////////////////////////////////////// |
| 634 | |
| 635 | void |
| 636 | IfStrippercxx . . $ IfStripper#::adjustIndicescxx . . $ IfStripper#adjustIndices(49f6e7a06ebc5aa8).() |
| 637 | { |
| 638 | int numVertices = vertexPtrListcxx . . $ IfStripper#vertexPtrList.->getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); |
| 639 | |
| 640 | // Fill in the coordinate indices |
| 641 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(numVertices); |
| 642 | int32_tcxx . . $ int32_t# *indices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..startEditingcxx . . $ SoMFInt32#startEditing(a7741f82f5fc3640).(); |
| 643 | for (int i = 0; i < numVertices; i++) { |
| 644 | StripVertexcxx . . $ IfStripper#StripVertex# *vert = (StripVertexcxx . . $ IfStripper#StripVertex# *) (*vertexPtrListcxx . . $ IfStripper#vertexPtrList.)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i]; |
| 645 | indices[i] = (vert == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! ? -1 : vert->coordIndexcxx . . $ IfStripper#StripVertex#coordIndex.); |
| 646 | } |
| 647 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->coordIndexcxx . . $ SoIndexedShape#coordIndex..finishEditingcxx . . $ SoMFInt32#finishEditing(49f6e7a06ebc5aa8).(); |
| 648 | |
| 649 | // Do same for normal indices, if necessary |
| 650 | if (haveNormalscxx . . $ IfStripper#haveNormals.) { |
| 651 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->normalIndexcxx . . $ SoIndexedShape#normalIndex..setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(numVertices); |
| 652 | indices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->normalIndexcxx . . $ SoIndexedShape#normalIndex..startEditingcxx . . $ SoMFInt32#startEditing(a7741f82f5fc3640).(); |
| 653 | for (int i = 0; i < numVertices; i++) { |
| 654 | StripVertexcxx . . $ IfStripper#StripVertex# *vert = (StripVertexcxx . . $ IfStripper#StripVertex# *) (*vertexPtrListcxx . . $ IfStripper#vertexPtrList.)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i]; |
| 655 | indices[i] = (vert == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! ? -1 : vert->normIndexcxx . . $ IfStripper#StripVertex#normIndex.); |
| 656 | } |
| 657 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->normalIndexcxx . . $ SoIndexedShape#normalIndex..finishEditingcxx . . $ SoMFInt32#finishEditing(49f6e7a06ebc5aa8).(); |
| 658 | } |
| 659 | |
| 660 | // Do same for texture coordinate indices, if necessary |
| 661 | if (haveTexCoordscxx . . $ IfStripper#haveTexCoords.) { |
| 662 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->textureCoordIndexcxx . . $ SoIndexedShape#textureCoordIndex..setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(numVertices); |
| 663 | indices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->textureCoordIndexcxx . . $ SoIndexedShape#textureCoordIndex..startEditingcxx . . $ SoMFInt32#startEditing(a7741f82f5fc3640).(); |
| 664 | for (int i = 0; i < numVertices; i++) { |
| 665 | StripVertexcxx . . $ IfStripper#StripVertex# *vert = (StripVertexcxx . . $ IfStripper#StripVertex# *) (*vertexPtrListcxx . . $ IfStripper#vertexPtrList.)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i]; |
| 666 | indices[i] = (vert == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! ? -1 : vert->texCoordIndexcxx . . $ IfStripper#StripVertex#texCoordIndex.); |
| 667 | } |
| 668 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->textureCoordIndexcxx . . $ SoIndexedShape#textureCoordIndex..finishEditingcxx . . $ SoMFInt32#finishEditing(49f6e7a06ebc5aa8).(); |
| 669 | } |
| 670 | |
| 671 | // Do same for material indices, if necessary |
| 672 | if (haveMaterialscxx . . $ IfStripper#haveMaterials.) { |
| 673 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->materialIndexcxx . . $ SoIndexedShape#materialIndex..setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(numVertices); |
| 674 | indices = holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->materialIndexcxx . . $ SoIndexedShape#materialIndex..startEditingcxx . . $ SoMFInt32#startEditing(a7741f82f5fc3640).(); |
| 675 | for (int i = 0; i < numVertices; i++) { |
| 676 | StripVertexcxx . . $ IfStripper#StripVertex# *vert = (StripVertexcxx . . $ IfStripper#StripVertex# *) (*vertexPtrListcxx . . $ IfStripper#vertexPtrList.)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i]; |
| 677 | indices[i] = (vert == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! ? -1 : vert->mtlIndexcxx . . $ IfStripper#StripVertex#mtlIndex.); |
| 678 | } |
| 679 | holdercxx . . $ IfStripper#holder.->stripSetcxx . . $ IfHolder#stripSet.->materialIndexcxx . . $ SoIndexedShape#materialIndex..finishEditingcxx . . $ SoMFInt32#finishEditing(49f6e7a06ebc5aa8).(); |
| 680 | } |
| 681 | } |