00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045
00046 #include <OSGConfig.h>
00047
00048 #include <OSGGL.h>
00049 #include <OSGGLU.h>
00050 #include <OSGGLEXT.h>
00051 #include <OSGRemoteAspect.h>
00052
00053 #include <OSGSHLChunk.h>
00054
00055 #include "OSGSHLParameterChunk.h"
00056
00057 OSG_USING_NAMESPACE
00058
00059
00064
00065
00066
00067
00068 StateChunkClass SHLParameterChunk::_class("SHLParameter");
00069
00070 UInt32 SHLParameterChunk::_shl_extension;
00071
00072
00073
00074
00075
00076 void SHLParameterChunk::initMethod (void)
00077 {
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 SHLParameterChunk::SHLParameterChunk(void) :
00092 Inherited()
00093 {
00094 }
00095
00096 SHLParameterChunk::SHLParameterChunk(const SHLParameterChunk &source) :
00097 Inherited(source)
00098 {
00099 _shl_extension = Window::registerExtension("GL_ARB_shading_language_100");
00100 }
00101
00102 SHLParameterChunk::~SHLParameterChunk(void)
00103 {
00104 }
00105
00106 const StateChunkClass *SHLParameterChunk::getClass(void) const
00107 {
00108 return &_class;
00109 }
00110
00111
00112
00113 void SHLParameterChunk::changed(BitVector whichField, UInt32 origin)
00114 {
00115 Inherited::changed(whichField, origin);
00116 }
00117
00118 void SHLParameterChunk::dump( UInt32 ,
00119 const BitVector ) const
00120 {
00121 SLOG << "Dump SHLParameterChunk NI" << std::endl;
00122 }
00123
00124
00125
00126 void SHLParameterChunk::activate(DrawActionBase *action, UInt32 )
00127 {
00128 if(!action->getWindow()->hasExtension(_shl_extension))
00129 {
00130 FWARNING(("OpenGL Shading Language is not supported, couldn't find extension 'GL_ARB_shading_language_100'!\n"));
00131 return;
00132 }
00133 updateParameters(action->getWindow());
00134 }
00135
00136 void SHLParameterChunk::changeFrom(DrawActionBase *action, StateChunk * old_chunk,
00137 UInt32 )
00138 {
00139 SHLParameterChunk *old = dynamic_cast<SHLParameterChunk *>(old_chunk);
00140
00141
00142 if(old == this)
00143 return;
00144
00145 if(!action->getWindow()->hasExtension(_shl_extension))
00146 {
00147 FWARNING(("OpenGL Shading Language is not supported, couldn't find extension 'GL_ARB_shading_language_100'!\n"));
00148 return;
00149 }
00150
00151 if(old == NULL)
00152 {
00153 FWARNING(( "SHLParameterChunk::changeFrom: caught non-SHLParameterChunk!\n"));
00154 return;
00155 }
00156
00157 updateParameters(action->getWindow());
00158 }
00159
00160
00161 void SHLParameterChunk::deactivate(DrawActionBase *OSG_CHECK_ARG(action), UInt32 OSG_CHECK_ARG(idx))
00162 {
00163 }
00164
00165
00166
00167 Real32 SHLParameterChunk::switchCost(StateChunk *OSG_CHECK_ARG(chunk))
00168 {
00169 return 0;
00170 }
00171
00172 bool SHLParameterChunk::operator < (const StateChunk &other) const
00173 {
00174 return this < &other;
00175 }
00176
00177 bool SHLParameterChunk::operator == (const StateChunk &other) const
00178 {
00179 SHLParameterChunk const *tother = dynamic_cast<SHLParameterChunk const*>(&other);
00180
00181 if(!tother)
00182 return false;
00183
00184 if(getParameters().size() != tother->getParameters().size())
00185 return false;
00186
00187 return true;
00188 }
00189
00190 bool SHLParameterChunk::operator != (const StateChunk &other) const
00191 {
00192 return ! (*this == other);
00193 }
00194
00195
00196
00197
00198 #ifdef OSG_SGI_CC
00199 #pragma set woff 1174
00200 #endif
00201
00202 #ifdef OSG_LINUX_ICC
00203 #pragma warning( disable : 177 )
00204 #endif
00205
00206 namespace
00207 {
00208 static Char8 cvsid_cpp [] = "@(#)$Id: OSGSHLParameterChunk.cpp,v 1.4 2006/09/01 16:39:42 a-m-z Exp $";
00209 static Char8 cvsid_hpp [] = OSGSHLPARAMETERCHUNKBASE_HEADER_CVSID;
00210 static Char8 cvsid_inl [] = OSGSHLPARAMETERCHUNKBASE_INLINE_CVSID;
00211
00212 static Char8 cvsid_fields_hpp[] = OSGSHLPARAMETERCHUNKFIELDS_HEADER_CVSID;
00213 }
00214
00215 #ifdef __sgi
00216 #pragma reset woff 1174
00217 #endif