00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul S. Strauss (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2017 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifndef _SO_BBOX_MODEL_MATRIX_ELEMENT 00051 #define _SO_BBOX_MODEL_MATRIX_ELEMENT 00052 00053 #include <Inventor/SbBasic.h> 00054 #include <Inventor/elements/SoModelMatrixElement.h> 00055 00056 #ifdef _DEBUG 00057 #include <Inventor/threads/SbThreadLocalStorage.h> 00058 #endif 00059 00079 SoEXTENDER_Documented class SoBBoxModelMatrixElement : public SoModelMatrixElement { 00080 00081 SO_ELEMENT_HEADER(SoBBoxModelMatrixElement); 00082 00083 public: 00084 00088 virtual void push(SoState *state); 00089 00095 static void reset(SoState *state, SoNode *node); 00096 00106 static void pushMatrix(SoState *state, 00107 SbMatrix &matrix, 00108 SbMatrix &localmatrix); 00112 static void popMatrix(SoState *state, 00113 const SbMatrix &matrix, 00114 const SbMatrix &localmatrix); 00115 00116 private: 00117 00119 virtual void init(SoState *state); 00120 00121 private: 00122 // Initializes the SoBBoxModelMatrixElement class 00123 static void initClass(); 00124 static void exitClass(); 00125 00130 static void pushForwardMatrix(SoState *state, SbMatrix &matrix, SbMatrix &ftmatrix, SbMatrix &localmatrix); 00131 00136 static void popForwardMatrix(SoState *state, const SbMatrix &matrix, const SbMatrix &ftmatrix, const SbMatrix &localmatrix); 00137 00138 private: 00139 // These all override the methods on SoModelMatrixElement to also 00140 // set the SoLocalBBoxMatrixElement 00141 virtual void makeEltIdentity(); 00142 virtual void setElt(const SbMatrix &matrix); 00143 virtual void setElt(const SbMatrix &matrix, SbBool sendToGL); 00144 virtual void multElt(const SbMatrix &matrix); 00145 virtual void translateEltBy(const SbVec3f &translation); 00146 virtual void rotateEltBy(const SbRotation &translation); 00147 virtual void scaleEltBy(const SbVec3f &scaleFactor); 00148 00149 // These must never be called; they print debug errors if called: 00150 virtual SbMatrix pushMatrixElt(); 00151 virtual void popMatrixElt(const SbMatrix &m); 00152 00153 virtual ~SoBBoxModelMatrixElement(); 00154 00155 private: 00156 // Stores pointer to state so we can access the SoLocalBBoxMatrixElement 00157 SoState* state; 00158 00159 #ifdef _DEBUG 00160 // This is used to make sure the pushMatrix/popMatrix methods are 00161 // called correctly. 00162 struct MTstruct 00163 { 00164 bool pushPopCallOK; 00165 }; 00166 SB_THREAD_TLS_HEADER(); 00167 #endif 00168 00169 }; 00170 00171 inline void 00172 SoBBoxModelMatrixElement::setElt(const SbMatrix &matrix, SbBool ) 00173 { 00174 setElt(matrix); 00175 } 00176 00177 #endif /* _SO_BBOX_MODEL_MATRIX_ELEMENT */ 00178 00179 00180