| 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 | | SoPickedPoint |
| 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/SoPath.h>cxx . . $ `<file>/lib/database/include/Inventor/SoPath.h`/ |
| 55 | #include <Inventor/SoPickedPoint.h>cxx . . $ `<file>/lib/database/include/Inventor/SoPickedPoint.h`/ |
| 56 | #include <Inventor/actions/SoGetMatrixAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoGetMatrixAction.h`/ |
| 57 | #include <Inventor/details/SoDetail.h>cxx . . $ `<file>/lib/database/include/Inventor/details/SoDetail.h`/ |
| 58 | #include <Inventor/elements/SoModelMatrixElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoModelMatrixElement.h`/ |
| 59 | #include <Inventor/elements/SoPickStyleElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoPickStyleElement.h`/ |
| 60 | #include <Inventor/elements/SoTextureMatrixElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoTextureMatrixElement.h`/ |
| 61 | #include <Inventor/elements/SoViewportRegionElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoViewportRegionElement.h`/ |
| 62 | #include <Inventor/errors/SoDebugError.h>cxx . . $ `<file>/lib/database/include/Inventor/errors/SoDebugError.h`/ |
| 63 | |
| 64 | SoGetMatrixActioncxx . . $ SoGetMatrixAction# *SoPickedPointcxx . . $ SoPickedPoint#::matrixActioncxx . . $ SoPickedPoint#matrixAction. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 65 | |
| 66 | //////////////////////////////////////////////////////////////////////// |
| 67 | // |
| 68 | // Description: |
| 69 | // Constructor - internal since instances are created only by the |
| 70 | // SoRayPickAction. |
| 71 | // |
| 72 | // Use: internal |
| 73 | |
| 74 | SoPickedPointcxx . . $ SoPickedPoint#::SoPickedPointcxx . . $ SoPickedPoint#SoPickedPoint(73407f32ace6b932).(const SoPathcxx . . $ SoPath# *_path, SoStatecxx . . $ SoState# *_state, |
| 75 | const SbVec3fcxx . . $ SbVec3f# &objSpacePoint) |
| 76 | // |
| 77 | //////////////////////////////////////////////////////////////////////// |
| 78 | { |
| 79 | int i, n; |
| 80 | |
| 81 | // Make a copy of the path since it most likely comes from the |
| 82 | // current traversal path in an action, which will be changed soon. |
| 83 | pathcxx . . $ SoPickedPoint#path. = _path->copycxx . . $ SoPath#copy(42f5adbf9b5b9c70).(); |
| 84 | pathcxx . . $ SoPickedPoint#path.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 85 | |
| 86 | // Save state so we can get matrices when we need them later |
| 87 | statecxx . . $ SoPickedPoint#state. = _state; |
| 88 | |
| 89 | // Transform the object space point by the current modeling matrix |
| 90 | // to get the world space point |
| 91 | SoModelMatrixElementcxx . . $ SoModelMatrixElement#::getcxx . . $ SoModelMatrixElement#get(361591dce4cd33b0).(statecxx . . $ SoPickedPoint#state.).multVecMatrixcxx . . $ SbMatrix#multVecMatrix(f4e74898890c8c54).(objSpacePoint, worldPointcxx . . $ SoPickedPoint#worldPoint.); |
| 92 | |
| 93 | // Make room in the detail list for one detail per node in the |
| 94 | // path. Set all the detail pointers to NULL. |
| 95 | n = ((const SoFullPathcxx . . $ SoFullPath# *) pathcxx . . $ SoPickedPoint#path.)->getLengthcxx . . $ SoFullPath#getLength(455f465bc33b4cdf).(); |
| 96 | detailscxx . . $ SoPickedPoint#details..setcxx . . $ SoDetailList#set(5f18fcbd799bd437).(n - 1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); // Allocates space |
| 97 | for (i = n - 2; i >= 0; --i) |
| 98 | detailscxx . . $ SoPickedPoint#details..setcxx . . $ SoDetailList#set(5f18fcbd799bd437).(i, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 99 | |
| 100 | // Initialize material index to 0, the most common value |
| 101 | materialIndexcxx . . $ SoPickedPoint#materialIndex. = 0; |
| 102 | |
| 103 | // Set on-geometry flag based on current pick style |
| 104 | onGeometrycxx . . $ SoPickedPoint#onGeometry. = (SoPickStyleElementcxx . . $ SoPickStyleElement#::getcxx . . $ SoPickStyleElement#get(98379ca455ca4bb6).(statecxx . . $ SoPickedPoint#state.) != |
| 105 | SoPickStyleElementcxx . . $ SoPickStyleElement#::BOUNDING_BOXcxx . . $ SoPickStyleElement#BOUNDING_BOX.); |
| 106 | |
| 107 | // Save the viewportRegion, we'll need it later: |
| 108 | vpRegioncxx . . $ SoPickedPoint#vpRegion. =cxx . . $ SbViewportRegion#`operator=`(6f57b312b6884eb0). SoViewportRegionElementcxx . . $ SoViewportRegionElement#::getcxx . . $ SoViewportRegionElement#get(862cff51521dc30e).(statecxx . . $ SoPickedPoint#state.); |
| 109 | } |
| 110 | |
| 111 | //////////////////////////////////////////////////////////////////////// |
| 112 | // |
| 113 | // Description: |
| 114 | // Copy constructor. |
| 115 | // |
| 116 | // Use: public |
| 117 | |
| 118 | SoPickedPointcxx . . $ SoPickedPoint#::SoPickedPointcxx . . $ SoPickedPoint#SoPickedPoint(2ad7d19e1e269389).(const SoPickedPointcxx . . $ SoPickedPoint# &pp) |
| 119 | // |
| 120 | //////////////////////////////////////////////////////////////////////// |
| 121 | { |
| 122 | worldPointcxx . . $ SoPickedPoint#worldPoint. =cxx . . $ SbVec3f#`operator=`(c7808628d070cfbe). pp.worldPointcxx . . $ SoPickedPoint#worldPoint.; |
| 123 | worldNormalcxx . . $ SoPickedPoint#worldNormal. =cxx . . $ SbVec3f#`operator=`(c7808628d070cfbe). pp.worldNormalcxx . . $ SoPickedPoint#worldNormal.; |
| 124 | imageTexCoordscxx . . $ SoPickedPoint#imageTexCoords. =cxx . . $ SbVec4f#`operator=`(15b57c07aa6334d5). pp.imageTexCoordscxx . . $ SoPickedPoint#imageTexCoords.; |
| 125 | materialIndexcxx . . $ SoPickedPoint#materialIndex. = pp.materialIndexcxx . . $ SoPickedPoint#materialIndex.; |
| 126 | pathcxx . . $ SoPickedPoint#path. = pp.pathcxx . . $ SoPickedPoint#path.; |
| 127 | onGeometrycxx . . $ SoPickedPoint#onGeometry. = pp.onGeometrycxx . . $ SoPickedPoint#onGeometry.; |
| 128 | vpRegioncxx . . $ SoPickedPoint#vpRegion. =cxx . . $ SbViewportRegion#`operator=`(6f57b312b6884eb0). pp.vpRegioncxx . . $ SoPickedPoint#vpRegion.; |
| 129 | |
| 130 | // Copy the details - note that the copy() method for SoDetailList |
| 131 | // makes copies of the detail instances. This has to be done |
| 132 | // because the instances are deleted when the list is deleted. |
| 133 | detailscxx . . $ SoPickedPoint#details. =cxx . . $ SoDetailList#`operator=`(936f46ee43dd945e). pp.detailscxx . . $ SoPickedPoint#details.; |
| 134 | |
| 135 | // Ref the path, since we unref it when we are deleted |
| 136 | pathcxx . . $ SoPickedPoint#path.->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 137 | } |
| 138 | |
| 139 | //////////////////////////////////////////////////////////////////////// |
| 140 | // |
| 141 | // Description: |
| 142 | // Destructor |
| 143 | // |
| 144 | // Use: public |
| 145 | |
| 146 | SoPickedPointcxx . . $ SoPickedPoint#::~cxx . . $ SoPickedPoint#`~SoPickedPoint`(49f6e7a06ebc5aa8).SoPickedPointcxx . . $ SoPickedPoint#() |
| 147 | // |
| 148 | //////////////////////////////////////////////////////////////////////// |
| 149 | { |
| 150 | // Free up path |
| 151 | pathcxx . . $ SoPickedPoint#path.->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 152 | |
| 153 | // The SoDetailList destructor deletes all details in the list, so |
| 154 | // we don't have to do it here |
| 155 | } |
| 156 | |
| 157 | //////////////////////////////////////////////////////////////////////// |
| 158 | // |
| 159 | // Description: |
| 160 | // Returns an instance that is a copy of this instance. The caller |
| 161 | // is responsible for deleting the copy when done. |
| 162 | // |
| 163 | // Use: public |
| 164 | |
| 165 | SoPickedPointcxx . . $ SoPickedPoint# * |
| 166 | SoPickedPointcxx . . $ SoPickedPoint#::copycxx . . $ SoPickedPoint#copy(513d025ed9dfd4e5).() const |
| 167 | // |
| 168 | //////////////////////////////////////////////////////////////////////// |
| 169 | { |
| 170 | SoPickedPointcxx . . $ SoPickedPoint# *newCopy = new SoPickedPointcxx . . $ SoPickedPoint#SoPickedPoint(2ad7d19e1e269389).(*this); |
| 171 | return newCopy; |
| 172 | } |
| 173 | |
| 174 | //////////////////////////////////////////////////////////////////////// |
| 175 | // |
| 176 | // Description: |
| 177 | // Returns the detail that corresponds to the given node in the path. |
| 178 | // |
| 179 | // Use: public |
| 180 | |
| 181 | const SoDetailcxx . . $ SoDetail# * |
| 182 | SoPickedPointcxx . . $ SoPickedPoint#::getDetailcxx . . $ SoPickedPoint#getDetail(57ca9d692aed245d).(const SoNodecxx . . $ SoNode# *node) const |
| 183 | // |
| 184 | //////////////////////////////////////////////////////////////////////// |
| 185 | { |
| 186 | int index; |
| 187 | |
| 188 | // Test for default case, corresponding to tail of path |
| 189 | if (node == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 190 | index = ((const SoFullPathcxx . . $ SoFullPath# *) pathcxx . . $ SoPickedPoint#path.)->getLengthcxx . . $ SoFullPath#getLength(455f465bc33b4cdf).() - 1; |
| 191 | |
| 192 | else |
| 193 | index = getNodeIndexcxx . . $ SoPickedPoint#getNodeIndex(25d228eba4c5059a).(node); |
| 194 | |
| 195 | return detailscxx . . $ SoPickedPoint#details.[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).index]; |
| 196 | } |
| 197 | |
| 198 | //////////////////////////////////////////////////////////////////////// |
| 199 | // |
| 200 | // Description: |
| 201 | // Returns the transformation matrix to go from the object space |
| 202 | // corresponding to the given node in the path to world space. |
| 203 | // |
| 204 | // Use: public |
| 205 | |
| 206 | SbMatrixcxx . . $ SbMatrix# |
| 207 | SoPickedPointcxx . . $ SoPickedPoint#::getObjectToWorldcxx . . $ SoPickedPoint#getObjectToWorld(dd6fa791a0b6d4b2).(const SoNodecxx . . $ SoNode# *node) const |
| 208 | // |
| 209 | //////////////////////////////////////////////////////////////////////// |
| 210 | { |
| 211 | getMatrixcxx . . $ SoPickedPoint#getMatrix(c239a52862e36ba5).(node); |
| 212 | return matrixActioncxx . . $ SoPickedPoint#matrixAction.->getMatrixcxx . . $ SoGetMatrixAction#getMatrix(2343154e5d38b214).(); |
| 213 | } |
| 214 | |
| 215 | //////////////////////////////////////////////////////////////////////// |
| 216 | // |
| 217 | // Description: |
| 218 | // Returns the transformation matrix to go from world space to the |
| 219 | // object space corresponding to the given node in the path. |
| 220 | // |
| 221 | // Use: public |
| 222 | |
| 223 | SbMatrixcxx . . $ SbMatrix# |
| 224 | SoPickedPointcxx . . $ SoPickedPoint#::getWorldToObjectcxx . . $ SoPickedPoint#getWorldToObject(dd6fa791a0b6d4b2).(const SoNodecxx . . $ SoNode# *node) const |
| 225 | // |
| 226 | //////////////////////////////////////////////////////////////////////// |
| 227 | { |
| 228 | getMatrixcxx . . $ SoPickedPoint#getMatrix(c239a52862e36ba5).(node); |
| 229 | return matrixActioncxx . . $ SoPickedPoint#matrixAction.->getInversecxx . . $ SoGetMatrixAction#getInverse(2343154e5d38b214).(); |
| 230 | } |
| 231 | |
| 232 | //////////////////////////////////////////////////////////////////////// |
| 233 | // |
| 234 | // Description: |
| 235 | // Returns the transformation matrix to go from the object space |
| 236 | // corresponding to the given node in the path to image space. |
| 237 | // |
| 238 | // Use: public |
| 239 | |
| 240 | SbMatrixcxx . . $ SbMatrix# |
| 241 | SoPickedPointcxx . . $ SoPickedPoint#::getObjectToImagecxx . . $ SoPickedPoint#getObjectToImage(dd6fa791a0b6d4b2).(const SoNodecxx . . $ SoNode# *node) const |
| 242 | // |
| 243 | //////////////////////////////////////////////////////////////////////// |
| 244 | { |
| 245 | getMatrixcxx . . $ SoPickedPoint#getMatrix(c239a52862e36ba5).(node); |
| 246 | return matrixActioncxx . . $ SoPickedPoint#matrixAction.->getTextureMatrixcxx . . $ SoGetMatrixAction#getTextureMatrix(2343154e5d38b214).(); |
| 247 | } |
| 248 | |
| 249 | //////////////////////////////////////////////////////////////////////// |
| 250 | // |
| 251 | // Description: |
| 252 | // Returns the transformation matrix to go from image space to the |
| 253 | // object space corresponding to the given node in the path. |
| 254 | // |
| 255 | // Use: public |
| 256 | |
| 257 | SbMatrixcxx . . $ SbMatrix# |
| 258 | SoPickedPointcxx . . $ SoPickedPoint#::getImageToObjectcxx . . $ SoPickedPoint#getImageToObject(dd6fa791a0b6d4b2).(const SoNodecxx . . $ SoNode# *node) const |
| 259 | // |
| 260 | //////////////////////////////////////////////////////////////////////// |
| 261 | { |
| 262 | getMatrixcxx . . $ SoPickedPoint#getMatrix(c239a52862e36ba5).(node); |
| 263 | return matrixActioncxx . . $ SoPickedPoint#matrixAction.->getTextureInversecxx . . $ SoGetMatrixAction#getTextureInverse(2343154e5d38b214).(); |
| 264 | } |
| 265 | |
| 266 | //////////////////////////////////////////////////////////////////////// |
| 267 | // |
| 268 | // Description: |
| 269 | // Returns the intersection point in object space that corresponds |
| 270 | // to the given node in the path. |
| 271 | // |
| 272 | // Use: public |
| 273 | |
| 274 | SbVec3fcxx . . $ SbVec3f# |
| 275 | SoPickedPointcxx . . $ SoPickedPoint#::getObjectPointcxx . . $ SoPickedPoint#getObjectPoint(a71b03b7175a7c10).(const SoNodecxx . . $ SoNode# *node) const |
| 276 | // |
| 277 | //////////////////////////////////////////////////////////////////////// |
| 278 | { |
| 279 | SbVec3fcxx . . $ SbVec3f# vcxx . . $ SbVec3f#SbVec3f(49f6e7a06ebc5aa8).; |
| 280 | |
| 281 | getWorldToObjectcxx . . $ SoPickedPoint#getWorldToObject(dd6fa791a0b6d4b2).(node).multVecMatrixcxx . . $ SbMatrix#multVecMatrix(f4e74898890c8c54).(worldPointcxx . . $ SoPickedPoint#worldPoint., v); |
| 282 | |
| 283 | return v; |
| 284 | } |
| 285 | |
| 286 | //////////////////////////////////////////////////////////////////////// |
| 287 | // |
| 288 | // Description: |
| 289 | // Returns the surface normal in object space that corresponds to |
| 290 | // the given node in the path. |
| 291 | // |
| 292 | // Use: public |
| 293 | |
| 294 | SbVec3fcxx . . $ SbVec3f# |
| 295 | SoPickedPointcxx . . $ SoPickedPoint#::getObjectNormalcxx . . $ SoPickedPoint#getObjectNormal(a71b03b7175a7c10).(const SoNodecxx . . $ SoNode# *node) const |
| 296 | // |
| 297 | //////////////////////////////////////////////////////////////////////// |
| 298 | { |
| 299 | SbVec3fcxx . . $ SbVec3f# vcxx . . $ SbVec3f#SbVec3f(49f6e7a06ebc5aa8).; |
| 300 | |
| 301 | getWorldToObjectcxx . . $ SoPickedPoint#getWorldToObject(dd6fa791a0b6d4b2).(node).multDirMatrixcxx . . $ SbMatrix#multDirMatrix(f4e74898890c8c54).(worldNormalcxx . . $ SoPickedPoint#worldNormal., v); |
| 302 | v.normalizecxx . . $ SbVec3f#normalize(9b8c9e39889c762c).(); |
| 303 | |
| 304 | return v; |
| 305 | } |
| 306 | |
| 307 | //////////////////////////////////////////////////////////////////////// |
| 308 | // |
| 309 | // Description: |
| 310 | // Returns the texture coordinates in object space that corresponds |
| 311 | // to the given node in the path. |
| 312 | // |
| 313 | // Use: public |
| 314 | |
| 315 | SbVec4fcxx . . $ SbVec4f# |
| 316 | SoPickedPointcxx . . $ SoPickedPoint#::getObjectTextureCoordscxx . . $ SoPickedPoint#getObjectTextureCoords(bead38850bfb5db2).(const SoNodecxx . . $ SoNode# *node) const |
| 317 | // |
| 318 | //////////////////////////////////////////////////////////////////////// |
| 319 | { |
| 320 | return multVecMatrix4cxx . . $ SoPickedPoint#multVecMatrix4(6e625d4829757fb7).(getImageToObjectcxx . . $ SoPickedPoint#getImageToObject(dd6fa791a0b6d4b2).(node), imageTexCoordscxx . . $ SoPickedPoint#imageTexCoords.); |
| 321 | } |
| 322 | |
| 323 | //////////////////////////////////////////////////////////////////////// |
| 324 | // |
| 325 | // Description: |
| 326 | // Sets the object-space normal. |
| 327 | // |
| 328 | // Use: extender |
| 329 | |
| 330 | void |
| 331 | SoPickedPointcxx . . $ SoPickedPoint#::setObjectNormalcxx . . $ SoPickedPoint#setObjectNormal(65a601b9d70571d6).(const SbVec3fcxx . . $ SbVec3f# &normal) |
| 332 | // |
| 333 | //////////////////////////////////////////////////////////////////////// |
| 334 | { |
| 335 | // Transform the object space normal by the current modeling |
| 336 | // matrix o get the world space normal. Use the inverse transpose |
| 337 | // of the odel matrix so that normals are not scaled incorrectly. |
| 338 | SbMatrixcxx . . $ SbMatrix# normalMatrix = |
| 339 | SoModelMatrixElementcxx . . $ SoModelMatrixElement#::getcxx . . $ SoModelMatrixElement#get(361591dce4cd33b0).(statecxx . . $ SoPickedPoint#state.).inversecxx . . $ SbMatrix#inverse(467bf55909e615bd).().transposecxx . . $ SbMatrix#transpose(467bf55909e615bd).(); |
| 340 | |
| 341 | normalMatrix.multDirMatrixcxx . . $ SbMatrix#multDirMatrix(f4e74898890c8c54).(normal, worldNormalcxx . . $ SoPickedPoint#worldNormal.); |
| 342 | worldNormalcxx . . $ SoPickedPoint#worldNormal..normalizecxx . . $ SbVec3f#normalize(9b8c9e39889c762c).(); |
| 343 | } |
| 344 | |
| 345 | //////////////////////////////////////////////////////////////////////// |
| 346 | // |
| 347 | // Description: |
| 348 | // Sets the object-space texture coordinates. |
| 349 | // |
| 350 | // Use: extender |
| 351 | |
| 352 | void |
| 353 | SoPickedPointcxx . . $ SoPickedPoint#::setObjectTextureCoordscxx . . $ SoPickedPoint#setObjectTextureCoords(5e0c53605d9ff01c).(const SbVec4fcxx . . $ SbVec4f# &texCoords) |
| 354 | // |
| 355 | //////////////////////////////////////////////////////////////////////// |
| 356 | { |
| 357 | // Transform the object space coords by the current texture matrix |
| 358 | // to get the image space texture coords |
| 359 | imageTexCoordscxx . . $ SoPickedPoint#imageTexCoords. =cxx . . $ SbVec4f#`operator=`(15b57c07aa6334d5). multVecMatrix4cxx . . $ SoPickedPoint#multVecMatrix4(6e625d4829757fb7).(SoTextureMatrixElementcxx . . $ SoTextureMatrixElement#::getcxx . . $ SoTextureMatrixElement#get(361591dce4cd33b0).(statecxx . . $ SoPickedPoint#state.), |
| 360 | texCoords); |
| 361 | } |
| 362 | |
| 363 | //////////////////////////////////////////////////////////////////////// |
| 364 | // |
| 365 | // Description: |
| 366 | // Sets the detail corresponding to the given node in the path. |
| 367 | // NULL may be passed to remove a detail. |
| 368 | // |
| 369 | // Use: extender |
| 370 | |
| 371 | void |
| 372 | SoPickedPointcxx . . $ SoPickedPoint#::setDetailcxx . . $ SoPickedPoint#setDetail(4236b338d5a190ee).(SoDetailcxx . . $ SoDetail# *detail, SoNodecxx . . $ SoNode# *node) |
| 373 | // |
| 374 | //////////////////////////////////////////////////////////////////////// |
| 375 | { |
| 376 | int i; |
| 377 | |
| 378 | // Find node in path |
| 379 | i = getNodeIndexcxx . . $ SoPickedPoint#getNodeIndex(25d228eba4c5059a).(node); |
| 380 | |
| 381 | #ifdef DEBUG |
| 382 | if (i < 0) |
| 383 | SoDebugError::post("SoPickedPoint::setDetail", |
| 384 | "Node %#x is not found in path", node); |
| 385 | #endif /* DEBUG */ |
| 386 | |
| 387 | detailscxx . . $ SoPickedPoint#details..setcxx . . $ SoDetailList#set(5f18fcbd799bd437).(i, detail); |
| 388 | } |
| 389 | |
| 390 | //////////////////////////////////////////////////////////////////////// |
| 391 | // |
| 392 | // Description: |
| 393 | // Returns index in path of given node, or -1 if not found. |
| 394 | // |
| 395 | // Use: private |
| 396 | |
| 397 | int |
| 398 | SoPickedPointcxx . . $ SoPickedPoint#::getNodeIndexcxx . . $ SoPickedPoint#getNodeIndex(25d228eba4c5059a).(const SoNodecxx . . $ SoNode# *node) const |
| 399 | // |
| 400 | //////////////////////////////////////////////////////////////////////// |
| 401 | { |
| 402 | int i; |
| 403 | |
| 404 | // Search from bottom up for node in path, since details are |
| 405 | // usually examined near the bottom |
| 406 | for (i = ((const SoFullPathcxx . . $ SoFullPath# *) pathcxx . . $ SoPickedPoint#path.)->getLengthcxx . . $ SoFullPath#getLength(455f465bc33b4cdf).() - 1; i >= 0; i--) |
| 407 | if (pathcxx . . $ SoPickedPoint#path.->getNodecxx . . $ SoPath#getNode(fd675789997d09c2).(i) == node) |
| 408 | return i; |
| 409 | |
| 410 | #ifdef DEBUG |
| 411 | SoDebugError::post("SoPickedPoint::getNodeIndex", |
| 412 | "Node %#x is not found in path", node); |
| 413 | #endif /* DEBUG */ |
| 414 | |
| 415 | return -1; |
| 416 | } |
| 417 | |
| 418 | //////////////////////////////////////////////////////////////////////// |
| 419 | // |
| 420 | // Description: |
| 421 | // Applies given instance of SoGetMatrixAction to path to node. |
| 422 | // |
| 423 | // Use: private |
| 424 | |
| 425 | void |
| 426 | SoPickedPointcxx . . $ SoPickedPoint#::getMatrixcxx . . $ SoPickedPoint#getMatrix(c239a52862e36ba5).(const SoNodecxx . . $ SoNode# *node) const |
| 427 | // |
| 428 | //////////////////////////////////////////////////////////////////////// |
| 429 | { |
| 430 | SoPathcxx . . $ SoPath# *xfPath; |
| 431 | |
| 432 | // Construct a path from the root down to this node. Use the given |
| 433 | // path if it's the same |
| 434 | if (node == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || node == ((SoFullPathcxx . . $ SoFullPath# *)pathcxx . . $ SoPickedPoint#path.)->getTailcxx . . $ SoFullPath#getTail(b794963b450d51b3).()) |
| 435 | xfPath = pathcxx . . $ SoPickedPoint#path.; |
| 436 | |
| 437 | else { |
| 438 | int index = getNodeIndexcxx . . $ SoPickedPoint#getNodeIndex(25d228eba4c5059a).(node); |
| 439 | xfPath = pathcxx . . $ SoPickedPoint#path.->copycxx . . $ SoPath#copy(42f5adbf9b5b9c70).(0, index + 1); |
| 440 | xfPath->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 441 | } |
| 442 | |
| 443 | // Create an action instance if necessary, then apply it to the path |
| 444 | if (matrixActioncxx . . $ SoPickedPoint#matrixAction. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 445 | matrixActioncxx . . $ SoPickedPoint#matrixAction. = new SoGetMatrixActioncxx . . $ SoGetMatrixAction#SoGetMatrixAction(6b06d788389016cd).(vpRegioncxx . . $ SoPickedPoint#vpRegion.); |
| 446 | matrixActioncxx . . $ SoPickedPoint#matrixAction.->applycxx . . $ SoAction#apply(eed4dbbaf0eca0f1).(xfPath); |
| 447 | |
| 448 | if (xfPath != pathcxx . . $ SoPickedPoint#path.) |
| 449 | xfPath->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 450 | } |
| 451 | |
| 452 | //////////////////////////////////////////////////////////////////////// |
| 453 | // |
| 454 | // Description: |
| 455 | // Multiplies SbVec4f by matrix - for transforming texture coords. |
| 456 | // |
| 457 | // Use: private, static |
| 458 | |
| 459 | SbVec4fcxx . . $ SbVec4f# |
| 460 | SoPickedPointcxx . . $ SoPickedPoint#::multVecMatrix4cxx . . $ SoPickedPoint#multVecMatrix4(6e625d4829757fb7).(const SbMatrixcxx . . $ SbMatrix# &m, const SbVec4fcxx . . $ SbVec4f# v) |
| 461 | // |
| 462 | //////////////////////////////////////////////////////////////////////// |
| 463 | { |
| 464 | int i; |
| 465 | SbVec4fcxx . . $ SbVec4f# v2cxx . . $ SbVec4f#SbVec4f(49f6e7a06ebc5aa8).; |
| 466 | |
| 467 | for (i = 0; i < 4; i++) |
| 468 | v2[cxx . . $ SbVec4f#`operator[]`(5dbdaf238659ae67).i] = (v[cxx . . $ SbVec4f#`operator[]`(c60a38c584b9a5cc).0] * m[cxx . . $ SbMatrix#`operator[]`(bab6c6b0b673bcf).0][i] + |
| 469 | v[cxx . . $ SbVec4f#`operator[]`(c60a38c584b9a5cc).1] * m[cxx . . $ SbMatrix#`operator[]`(bab6c6b0b673bcf).1][i] + |
| 470 | v[cxx . . $ SbVec4f#`operator[]`(c60a38c584b9a5cc).2] * m[cxx . . $ SbMatrix#`operator[]`(bab6c6b0b673bcf).2][i] + |
| 471 | v[cxx . . $ SbVec4f#`operator[]`(c60a38c584b9a5cc).3] * m[cxx . . $ SbMatrix#`operator[]`(bab6c6b0b673bcf).3][i]); |
| 472 | |
| 473 | return v2; |
| 474 | } |