00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 00040 OSG_BEGIN_NAMESPACE 00041 00042 /*-------------------------------------------------------------------------*/ 00043 /* Access */ 00044 00045 inline 00046 DrawTreeNode *DrawTreeNode::getFirstChild(void) 00047 { 00048 return _pFirstChild; 00049 } 00050 00051 inline 00052 DrawTreeNode *DrawTreeNode::getLastChild(void) 00053 { 00054 return _pLastChild; 00055 } 00056 00057 inline 00058 void DrawTreeNode::addChild(DrawTreeNode *pChild) 00059 { 00060 if(_pLastChild == NULL) 00061 { 00062 _pFirstChild = pChild; 00063 _pLastChild = pChild; 00064 } 00065 else 00066 { 00067 _pLastChild->setBrother(pChild); 00068 _pLastChild = pChild; 00069 } 00070 } 00071 00072 inline 00073 void DrawTreeNode::insertFirstChild (DrawTreeNode *pChild) 00074 { 00075 if(pChild == NULL) 00076 return; 00077 00078 if(_pFirstChild == NULL) 00079 { 00080 addChild(pChild); 00081 } 00082 else 00083 { 00084 pChild->setBrother(_pFirstChild); 00085 _pFirstChild = pChild; 00086 } 00087 00088 } 00089 00090 inline 00091 void DrawTreeNode::insertChildAfter(DrawTreeNode *pCurrent, 00092 DrawTreeNode *pChild) 00093 { 00094 if(pCurrent == NULL || pChild == NULL) 00095 return; 00096 00097 pChild ->setBrother(pCurrent->getBrother()); 00098 pCurrent->setBrother(pChild ); 00099 00100 if(pCurrent == _pLastChild) 00101 { 00102 _pLastChild = pChild; 00103 } 00104 } 00105 00106 inline 00107 DrawTreeNode *DrawTreeNode::getBrother(void) 00108 { 00109 return _pBrother; 00110 } 00111 00112 inline 00113 void DrawTreeNode::setBrother(DrawTreeNode *pBrother) 00114 { 00115 _pBrother = pBrother; 00116 } 00117 00118 inline 00119 void DrawTreeNode::setGeometry(Geometry *pGeo) 00120 { 00121 _pGeo = pGeo; 00122 } 00123 00124 inline 00125 Geometry *DrawTreeNode::getGeometry(void) 00126 { 00127 return _pGeo; 00128 } 00129 00130 inline 00131 void DrawTreeNode::setFunctor(Material::DrawFunctor &func) 00132 { 00133 _functor=func; 00134 _hasFunctor=true; 00135 } 00136 00137 inline 00138 Material::DrawFunctor &DrawTreeNode::getFunctor(void) 00139 { 00140 return _functor; 00141 } 00142 00143 inline 00144 bool DrawTreeNode::hasFunctor(void) 00145 { 00146 return _hasFunctor; 00147 } 00148 00149 inline 00150 void DrawTreeNode::setState(State *pState) 00151 { 00152 _pState = pState; 00153 } 00154 00155 inline 00156 State *DrawTreeNode::getState(void) 00157 { 00158 return _pState; 00159 } 00160 00161 inline 00162 void DrawTreeNode::setNode(NodePtr pNode) 00163 { 00164 _pNode = pNode; 00165 } 00166 00167 inline 00168 NodePtr DrawTreeNode::getNode(void) 00169 { 00170 return _pNode; 00171 } 00172 00173 inline 00174 void DrawTreeNode::setMatrixStore(const RenderAction::MatrixStore &oMatrixStore) 00175 { 00176 _oMatrixStore = oMatrixStore; 00177 } 00178 00179 inline 00180 RenderAction::MatrixStore &DrawTreeNode::getMatrixStore(void) 00181 { 00182 return _oMatrixStore; 00183 } 00184 00185 inline 00186 void DrawTreeNode::setScalar(Real32 rScalar) 00187 { 00188 _rScalarVal = rScalar; 00189 } 00190 00191 inline 00192 Real32 DrawTreeNode::getScalar(void) 00193 { 00194 return _rScalarVal; 00195 } 00196 00197 inline 00198 void DrawTreeNode::setLightsState(UInt64 state) 00199 { 00200 _lightsState = state; 00201 } 00202 00203 inline 00204 UInt64 DrawTreeNode::getLightsState(void) 00205 { 00206 return _lightsState; 00207 } 00208 00209 inline 00210 void DrawTreeNode::setMultiPass(void) 00211 { 00212 _flags |= DrawTreeNode::MultiPass; 00213 } 00214 00215 inline 00216 void DrawTreeNode::setLastMultiPass(void) 00217 { 00218 _flags |= DrawTreeNode::LastMultiPass; 00219 } 00220 00221 inline 00222 bool DrawTreeNode::isMultiPass(void) 00223 { 00224 return (_flags & DrawTreeNode::MultiPass) || 00225 (_flags & DrawTreeNode::LastMultiPass); 00226 } 00227 00228 inline 00229 bool DrawTreeNode::isLastMultiPass(void) 00230 { 00231 return (_flags & DrawTreeNode::LastMultiPass); 00232 } 00233 00234 inline 00235 void DrawTreeNode::setNoStateSorting(void) 00236 { 00237 _flags |= DrawTreeNode::NoStateSorting; 00238 } 00239 00240 inline 00241 bool DrawTreeNode::isNoStateSorting(void) 00242 { 00243 return (_flags & DrawTreeNode::NoStateSorting); 00244 } 00245 00246 inline 00247 void DrawTreeNode::reset(void) 00248 { 00249 _pFirstChild = NULL; 00250 _pLastChild = NULL; 00251 _pBrother = NULL; 00252 _pState = NULL; 00253 _pGeo = NULL; 00254 _hasFunctor = false; 00255 00256 _oMatrixStore.first = 0; 00257 _oMatrixStore.second.setIdentity(); 00258 00259 _rScalarVal = 0.f; 00260 00261 _lightsState = 0; 00262 _flags = 0; 00263 } 00264 00265 OSG_END_NAMESPACE 00266 00267 #define OSGDRAWTREENODE_INLINE_CVSID "@(#)$Id: $"
1.4.3