Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGTransformChunk.cpp

Go to the documentation of this file.
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 //  Includes
00041 //---------------------------------------------------------------------------
00042 
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 
00046 #include "OSGConfig.h"
00047 
00048 #include <OSGGL.h>
00049 
00050 #include "OSGTransformChunk.h"
00051 
00052 OSG_USING_NAMESPACE
00053 
00054 
00055 /***************************************************************************\
00056  *                            Description                                  *
00057 \***************************************************************************/
00058 
00068 /***************************************************************************\
00069  *                           Class variables                               *
00070 \***************************************************************************/
00071 
00072 StateChunkClass TransformChunk::_class("Transform");
00073 
00074 /***************************************************************************\
00075  *                           Class methods                                 *
00076 \***************************************************************************/
00077 
00078 void TransformChunk::initMethod (void)
00079 {
00080 
00081 }
00082 
00083 /***************************************************************************\
00084  *                           Instance methods                              *
00085 \***************************************************************************/
00086 
00087 /*-------------------------------------------------------------------------*\
00088  -  private                                                                 -
00089 \*-------------------------------------------------------------------------*/
00090 
00091 TransformChunk::TransformChunk(void) :
00092     Inherited()
00093 {
00094 }
00095 
00096 TransformChunk::TransformChunk(const TransformChunk &source) :
00097     Inherited(source)
00098 {
00099 }
00100 
00101 TransformChunk::~TransformChunk(void)
00102 {
00103 }
00104 
00105 /*------------------------- Chunk Class Access ---------------------------*/
00106 
00107 const StateChunkClass *TransformChunk::getClass(void) const
00108 {
00109     return &_class;
00110 }
00111 
00112 /*------------------------------- Sync -----------------------------------*/
00113 
00114 void TransformChunk::changed(BitVector whichField, UInt32 origin)
00115 {
00116     Inherited::changed(whichField, origin);
00117 }
00118 
00119 /*------------------------------ Output ----------------------------------*/
00120 
00121 void TransformChunk::dump(      UInt32    OSG_CHECK_ARG(uiIndent),
00122                           const BitVector OSG_CHECK_ARG(bvFlags )) const
00123 {
00124     SLOG << "Dump TransformChunk NI" << std::endl;
00125 }
00126 
00127 
00128 /*------------------------------ State ------------------------------------*/
00129 
00130 void TransformChunk::activate ( DrawActionBase *,  UInt32 )
00131 {
00132     glPushMatrix();
00133     glMultMatrixf( getMatrix().getValues() );
00134 }
00135 
00136 void TransformChunk::changeFrom( DrawActionBase *,  StateChunk * old, UInt32 )
00137 {
00138     // change from me to me?
00139     // this assumes I haven't changed in the meantime. is that a valid assumption?
00140     if ( old == this )
00141         return;
00142 
00143     glPopMatrix();
00144     glPushMatrix();
00145     glMultMatrixf( getMatrix().getValues() );
00146 }
00147 
00148 void TransformChunk::deactivate ( DrawActionBase *,  UInt32 )
00149 {
00150     glPopMatrix();
00151 }
00152 
00153 /*-------------------------- Comparison -----------------------------------*/
00154 
00155 Real32 TransformChunk::switchCost(StateChunk *OSG_CHECK_ARG(chunk))
00156 {
00157     return 0;
00158 }
00159 
00160 bool TransformChunk::operator < (const StateChunk &other) const
00161 {
00162     return this < &other;
00163 }
00164 
00165 bool TransformChunk::operator == (const StateChunk &other) const
00166 {
00167     TransformChunk const *tother = dynamic_cast<TransformChunk const*>(&other);
00168 
00169     if ( !tother )
00170         return false;
00171 
00172     if(tother == this)
00173         return true;
00174 
00175     return getMatrix().equals( tother->getMatrix(), Eps );
00176 }
00177 
00178 bool TransformChunk::operator != (const StateChunk &other) const
00179 {
00180     return ! (*this == other);
00181 }
00182 
00183 /*------------------------------------------------------------------------*/
00184 /*                              cvs id's                                  */
00185 
00186 #ifdef OSG_SGI_CC
00187 #pragma set woff 1174
00188 #endif
00189 
00190 #ifdef OSG_LINUX_ICC
00191 #pragma warning( disable : 177 )
00192 #endif
00193 
00194 namespace
00195 {
00196     static Char8 cvsid_cpp       [] = "@(#)$Id: FCTemplate_cpp.h,v 1.13 2002/06/01 10:37:25 vossg Exp $";
00197     static Char8 cvsid_hpp       [] = OSGTRANSFORMCHUNK_HEADER_CVSID;
00198     static Char8 cvsid_inl       [] = OSGTRANSFORMCHUNK_INLINE_CVSID;
00199 
00200     static Char8 cvsid_fields_hpp[] = OSGTRANSFORMCHUNKFIELDS_HEADER_CVSID;
00201 }
00202 
00203 #ifdef __sgi
00204 #pragma reset woff 1174
00205 #endif
00206 
00207 

Generated on Thu Aug 25 04:11:47 2005 for OpenSG by  doxygen 1.4.3