Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoCube.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25** Modified by : Nick Thompson (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2021 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_CUBE_
52#define _SO_CUBE_
53
54#include <Inventor/SbVec.h>
55#include <Inventor/SbBox.h>
56#include <Inventor/fields/SoSFFloat.h>
57#include <Inventor/nodes/SoShape.h>
58#include <Inventor/SbPImpl.h>
59
60SO_PIMPL_PUBLIC_DECLARATION( SoCube );
61
122class SoCube : public SoShape
123{
124 SO_NODE_HEADER(SoCube);
125 SO_PIMPL_PUBLIC_HEADER( SoCube );
126
127 public:
128 // Fields
132 SoSFFloat width; // Size in x dimension
136 SoSFFloat height; // Size in y dimension
141
146
147 private:
148 // Implements actions
149 virtual void GLRender( SoGLRenderAction* action );
150 virtual void rayPick( SoRayPickAction* action );
151 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action );
152
153 // Computes bounding box of cube
154 virtual void computeBBox( SoAction* action, SbBox3f& box, SbVec3f& center );
155
156 private:
157
159 static void initClass();
161 static void exitClass();
162
163 // Renders or picks cube representing given bounding box. These
164 // are used by SoShape to implement BOUNDING_BOX complexity.
165 void GLRenderBoundingBox( SoGLRenderAction* action, const SbXfBox3d& bbox );
166 void GLRenderBoundingBox( SoGLRenderAction* action, const SbBox3f& bbox );
167
168 void rayPickBoundingBox( SoRayPickAction* action, const SbBox3f& bbox );
169
170 virtual SoChildList* getChildren() const;
171
172private:
173 // Generates triangles representing a cube
174 virtual void generatePrimitives( SoAction* action );
175
176 // Overrides standard method to create an SoCubeDetail instance
177 virtual SoDetail* createTriangleDetail( SoRayPickAction* action,
178 const SoPrimitiveVertex* v1,
179 const SoPrimitiveVertex* v2,
180 const SoPrimitiveVertex* v3,
181 SoPickedPoint* pp );
182
183 virtual ~SoCube();
184
185 using SoShape::GLRenderBoundingBox;
186};
187
188#endif /* _SO_CUBE_ */
3D box class.
Definition SbBox.h:649
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box with an a...
Definition SbBox.h:1513
Abstract base class for all actions.
Definition SoAction.h:132
Cube shape node.
Definition SoCube.h:123
SoSFFloat width
Size in the x dimension.
Definition SoCube.h:132
SoSFFloat depth
Size in the z dimension.
Definition SoCube.h:140
SoSFFloat height
Size in the y dimension.
Definition SoCube.h:136
SoCube()
Creates a cube node with default settings.
Base class for describing detail information about a shape node.
Definition SoDetail.h:99
Renders a scene graph using Open Inventor's Render Engine.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
friend class SoChildList
Definition SoNode.h:473
Represents point on surface of picked object.
Represents a vertex of a generated primitive.
Intersects objects with a ray cast into scene.
Field containing a floating-point value.
Definition SoSFFloat.h:78
Abstract base class for all shape nodes.
Definition SoShape.h:115