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 #include "OSGMaterial.h" 00050 00051 OSG_USING_NAMESPACE 00052 00053 00054 /***************************************************************************\ 00055 * Description * 00056 \***************************************************************************/ 00057 00096 /***************************************************************************\ 00097 * Class variables * 00098 \***************************************************************************/ 00099 00100 OSG_BEGIN_NAMESPACE 00101 OSG_SYSTEMLIB_DLLMAPPING MaterialPtr NullMaterial; 00102 OSG_END_NAMESPACE 00103 00104 const Int32 Material::NoStateSorting = 0x7fffffff; 00105 const Int32 Material::TransparencyAutoDetection = 0; 00106 const Int32 Material::TransparencyForceTransparent = 1; 00107 const Int32 Material::TransparencyForceOpaque = 2; 00108 00109 /***************************************************************************\ 00110 * Class methods * 00111 \***************************************************************************/ 00112 00113 /*-------------------------------------------------------------------------*\ 00114 - private - 00115 \*-------------------------------------------------------------------------*/ 00116 00117 void Material::initMethod (void) 00118 { 00119 } 00120 00121 /***************************************************************************\ 00122 * Instance methods * 00123 \***************************************************************************/ 00124 00125 /*-------------------------------------------------------------------------*\ 00126 - public - 00127 \*-------------------------------------------------------------------------*/ 00128 00129 00130 /*------------- constructors & destructors --------------------------------*/ 00131 00132 Material::Material(void) : 00133 Inherited(), 00134 _pState () 00135 { 00136 } 00137 00138 Material::Material(const Material &source) : 00139 Inherited(source), 00140 _pState () 00141 { 00142 // Doing this kills using prototypes with preset states. 00143 // What's the point of this anyway? Sharing _pState between Materials never 00144 // makes sense 00145 // setRefdCP(_pState, source._pState); 00146 } 00147 00148 Material::~Material(void) 00149 { 00150 subRefCP(_pState); 00151 } 00152 00153 #if defined(OSG_FIXED_MFIELDSYNC) 00154 void Material::onDestroyAspect(UInt32 uiId, UInt32 uiAspect) 00155 { 00156 Inherited::onDestroyAspect(uiId, uiAspect); 00157 00158 subRefCP(_pState); 00159 00160 _pState = NullFC; 00161 } 00162 #endif 00163 00164 StatePtr Material::getState(UInt32 OSG_CHECK_ARG(index)) 00165 { 00166 return _pState; 00167 } 00168 00169 bool Material::isMultiPass(void) const 00170 { 00171 return false; 00172 } 00173 00174 UInt32 Material::getNPasses(void) const 00175 { 00176 return 1; 00177 } 00178 00179 void Material::changed(BitVector whichField, UInt32 origin) 00180 { 00181 Inherited::changed(whichField, origin); 00182 00183 rebuildState(); 00184 } 00185 00186 Int32 Material::getRealSortKey(void) const 00187 { 00188 return _sfSortKey.getValue(); 00189 } 00190 00191 /*------------------------------- dump ----------------------------------*/ 00192 00193 void Material::dump( UInt32 , 00194 const BitVector ) const 00195 { 00196 SLOG << "Material::dump called: NIY!" << std::endl; 00197 // Inherited::dump(uiIndent, bvFlags); 00198 } 00199 00200 /*-------------------------- comparison -----------------------------------*/ 00201 00202 bool Material::operator < (const Material &other) const 00203 { 00204 return this < &other; 00205 } 00206 00207 bool Material::operator == (const Material& other) const 00208 { 00209 return _pState == other._pState; 00210 } 00211 00212 bool Material::operator != (const Material &other) const 00213 { 00214 return ! (*this == other); 00215 } 00216 00217 00218 /*------------------------------------------------------------------------*/ 00219 /* cvs id's */ 00220 00221 #ifdef OSG_SGI_CC 00222 #pragma set woff 1174 00223 #endif 00224 00225 #ifdef OSG_LINUX_ICC 00226 #pragma warning( disable : 177 ) 00227 #endif 00228 00229 namespace 00230 { 00231 static Char8 cvsid_cpp [] = "@(#)$Id: FCTemplate_cpp.h,v 1.13 2002/06/01 10:37:25 vossg Exp $"; 00232 static Char8 cvsid_hpp [] = OSGMATERIAL_HEADER_CVSID; 00233 static Char8 cvsid_inl [] = OSGMATERIAL_INLINE_CVSID; 00234 00235 static Char8 cvsid_fields_hpp[] = OSGMATERIALFIELDS_HEADER_CVSID; 00236 } 00237 00238 #ifdef __sgi 00239 #pragma reset woff 1174 00240 #endif 00241
1.5.5