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
00051 #include "OSGDrawActionBase.h"
00052
00053 #include "OSGRegisterCombinersChunk.h"
00054
00055 OSG_USING_NAMESPACE
00056
00057
00058
00059
00060
00061
00090
00091
00092
00093
00094 StateChunkClass RegisterCombinersChunk::_class("RegisterCombiners");
00095
00096 UInt32 RegisterCombinersChunk::_nvRegisterCombiners;
00097 UInt32 RegisterCombinersChunk::_nvRegisterCombiners2;
00098 UInt32 RegisterCombinersChunk::_funcCombinerParameterfv
00099 = Window::invalidFunctionID;
00100 UInt32 RegisterCombinersChunk::_funcCombinerStageParameterfv
00101 = Window::invalidFunctionID;
00102 UInt32 RegisterCombinersChunk::_funcCombinerInput
00103 = Window::invalidFunctionID;
00104 UInt32 RegisterCombinersChunk::_funcCombinerOutput
00105 = Window::invalidFunctionID;
00106 UInt32 RegisterCombinersChunk::_funcFinalCombinerInput
00107 = Window::invalidFunctionID;
00108
00109
00110 static const UInt32 unused = 0xffff;
00111
00112
00113
00114
00115
00116 void RegisterCombinersChunk::initMethod (void)
00117 {
00118 }
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 RegisterCombinersChunk::RegisterCombinersChunk(void) :
00129 Inherited()
00130 {
00131 _nvRegisterCombiners = Window::registerExtension(
00132 "GL_NV_register_combiners" );
00133 _nvRegisterCombiners2 = Window::registerExtension(
00134 "GL_NV_register_combiners2" );
00135 _funcCombinerParameterfv = Window::registerFunction (
00136 OSG_DLSYM_UNDERSCORE"glCombinerParameterfvNV", _nvRegisterCombiners);
00137 _funcCombinerStageParameterfv = Window::registerFunction (
00138 OSG_DLSYM_UNDERSCORE"glCombinerStageParameterfvNV",
00139 _nvRegisterCombiners );
00140 _funcCombinerInput = Window::registerFunction (
00141 OSG_DLSYM_UNDERSCORE"glCombinerInputNV", _nvRegisterCombiners );
00142 _funcCombinerOutput = Window::registerFunction (
00143 OSG_DLSYM_UNDERSCORE"glCombinerOutputNV", _nvRegisterCombiners );
00144 _funcFinalCombinerInput = Window::registerFunction (
00145 OSG_DLSYM_UNDERSCORE"glFinalCombinerInputNV", _nvRegisterCombiners );
00146
00147 clearCombiners();
00148 }
00149
00150 RegisterCombinersChunk::RegisterCombinersChunk(const RegisterCombinersChunk &source) :
00151 Inherited(source)
00152 {
00153 clearCombiners();
00154 }
00155
00156 RegisterCombinersChunk::~RegisterCombinersChunk(void)
00157 {
00158 }
00159
00160
00161
00162 const StateChunkClass *RegisterCombinersChunk::getClass(void) const
00163 {
00164 return &_class;
00165 }
00166
00167
00168
00169 void RegisterCombinersChunk::changed(BitVector whichField, UInt32 origin)
00170 {
00171
00172
00173
00174 Inherited::changed(whichField, origin);
00175 }
00176
00177
00178
00179 void RegisterCombinersChunk::dump( UInt32 ,
00180 const BitVector ) const
00181 {
00182 SLOG << "Dump RegisterCombinersChunk NI" << std::endl;
00183 }
00184
00185
00186
00187 void RegisterCombinersChunk::activate( DrawActionBase *action, UInt32 )
00188 {
00189 Window *win = action->getWindow();
00190
00191 if(! win->hasExtension(_nvRegisterCombiners))
00192 return;
00193
00194
00195
00196
00197
00198 void (OSG_APIENTRY*CombinerParameterfv)(GLenum pname, GLfloat *params) =
00199 (void (OSG_APIENTRY*)(GLenum pname, GLfloat *params))
00200 win->getFunction(_funcCombinerParameterfv);
00201
00202 void (OSG_APIENTRY*CombinerStageParameterfv)(GLenum stage, GLenum pname, GLfloat *params) =
00203 (void (OSG_APIENTRY*)(GLenum stage, GLenum pname, GLfloat *params))
00204 win->getFunction(_funcCombinerStageParameterfv);
00205
00206 void (OSG_APIENTRY*CombinerInput)(GLenum stage, GLenum portion, GLenum variable,
00207 GLenum input, GLenum mapping, GLenum component) =
00208 (void (OSG_APIENTRY*)(GLenum stage, GLenum portion, GLenum variable,
00209 GLenum input, GLenum mapping, GLenum component))
00210 win->getFunction(_funcCombinerInput);
00211
00212 void (OSG_APIENTRY*CombinerOutput)(GLenum stage, GLenum portion,
00213 GLenum abOut, GLenum cdOut, GLenum sumOut,
00214 GLenum scale, GLenum bias,
00215 GLboolean abdot, GLboolean cddot,
00216 GLboolean muxSum) =
00217 (void (OSG_APIENTRY*)(GLenum stage, GLenum portion,
00218 GLenum abOut, GLenum cdOut, GLenum sumOut,
00219 GLenum scale, GLenum bias,
00220 GLboolean abdot, GLboolean cddot,
00221 GLboolean muxSum))
00222 win->getFunction(_funcCombinerOutput);
00223
00224 void (OSG_APIENTRY*FinalCombinerInput)(GLenum variable, GLenum input, GLenum mapping,
00225 GLenum component) =
00226 (void (OSG_APIENTRY*)(GLenum variable, GLenum input, GLenum mapping,
00227 GLenum component))
00228 win->getFunction(_funcFinalCombinerInput);
00229
00230
00231
00232 Int32 ncomb;
00233
00234 for(ncomb = OSG_NUM_COMBINERS - 1; ncomb >= 0; ncomb--)
00235 {
00236 if(getVariableArgb()[ncomb * 3] != unused)
00237 break;
00238 }
00239
00240 if(ncomb < 0)
00241 {
00242
00243
00244 glDisable(GL_REGISTER_COMBINERS_NV);
00245 return;
00246 }
00247
00248 ncomb++;
00249
00250 GLfloat dummy = GLfloat(ncomb);
00251 CombinerParameterfv(GL_NUM_GENERAL_COMBINERS_NV, &dummy);
00252 CombinerParameterfv(GL_CONSTANT_COLOR0_NV, (GLfloat*)&getColor0());
00253 CombinerParameterfv(GL_CONSTANT_COLOR1_NV, (GLfloat*)&getColor1());
00254
00255 dummy = getColorSumClamp();
00256 CombinerParameterfv(GL_COLOR_SUM_CLAMP_NV, &dummy);
00257
00258
00259
00260 bool hasRC2 = win->hasExtension(_nvRegisterCombiners2);
00261
00262 for(UInt16 i = 0; i < ncomb; i++)
00263 {
00264 if(getVariableArgb()[i * 3] != unused)
00265 {
00266
00267 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_A_NV,
00268 getVariableArgb()[i * 3],
00269 getVariableArgb()[i * 3 + 1],
00270 getVariableArgb()[i * 3 + 2] );
00271 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_B_NV,
00272 getVariableBrgb()[i * 3],
00273 getVariableBrgb()[i * 3 + 1],
00274 getVariableBrgb()[i * 3 + 2] );
00275 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_C_NV,
00276 getVariableCrgb()[i * 3],
00277 getVariableCrgb()[i * 3 + 1],
00278 getVariableCrgb()[i * 3 + 2] );
00279 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_D_NV,
00280 getVariableDrgb()[i * 3],
00281 getVariableDrgb()[i * 3 + 1],
00282 getVariableDrgb()[i * 3 + 2] );
00283
00284
00285 CombinerOutput(GL_COMBINER0_NV + i, GL_RGB,
00286 getOutputABrgb ()[i],
00287 getOutputCDrgb ()[i],
00288 getOutputSumrgb ()[i],
00289 getScalergb ()[i],
00290 getBiasrgb ()[i],
00291 getDotABrgb ()[i],
00292 getDotCDrgb ()[i],
00293 getMuxSumrgb ()[i] );
00294
00295 }
00296 else
00297 {
00298 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_A_NV,
00299 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
00300 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_B_NV,
00301 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
00302 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_C_NV,
00303 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
00304 CombinerInput(GL_COMBINER0_NV + i, GL_RGB, GL_VARIABLE_D_NV,
00305 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
00306
00307 CombinerOutput(GL_COMBINER0_NV + i, GL_RGB,
00308 GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV,
00309 GL_NONE, GL_NONE,
00310 GL_FALSE, GL_FALSE, GL_FALSE );
00311
00312 }
00313
00314 if(getVariableAalpha()[i * 3] != unused)
00315 {
00316
00317 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_A_NV,
00318 getVariableAalpha()[i * 3],
00319 getVariableAalpha()[i * 3 + 1],
00320 getVariableAalpha()[i * 3 + 2] );
00321 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_B_NV,
00322 getVariableBalpha()[i * 3],
00323 getVariableBalpha()[i * 3 + 1],
00324 getVariableBalpha()[i * 3 + 2] );
00325 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_C_NV,
00326 getVariableCalpha()[i * 3],
00327 getVariableCalpha()[i * 3 + 1],
00328 getVariableCalpha()[i * 3 + 2] );
00329 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_D_NV,
00330 getVariableDalpha()[i * 3],
00331 getVariableDalpha()[i * 3 + 1],
00332 getVariableDalpha()[i * 3 + 2] );
00333
00334
00335 CombinerOutput(GL_COMBINER0_NV + i, GL_ALPHA,
00336 getOutputABalpha ()[i],
00337 getOutputCDalpha ()[i],
00338 getOutputSumalpha ()[i],
00339 getScalealpha ()[i],
00340 getBiasalpha ()[i],
00341 GL_FALSE,
00342 GL_FALSE,
00343 getMuxSumalpha ()[i] );
00344 }
00345 else
00346 {
00347 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_A_NV,
00348 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00349 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_B_NV,
00350 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00351 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_C_NV,
00352 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00353 CombinerInput(GL_COMBINER0_NV + i, GL_ALPHA, GL_VARIABLE_D_NV,
00354 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00355
00356 CombinerOutput(GL_COMBINER0_NV + i, GL_ALPHA,
00357 GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV,
00358 GL_NONE, GL_NONE,
00359 GL_FALSE, GL_FALSE, GL_FALSE );
00360 }
00361
00362 if(getPerStageConstants())
00363 {
00364 if(hasRC2)
00365 {
00366 CombinerStageParameterfv(GL_COMBINER0_NV + i,
00367 GL_CONSTANT_COLOR0_NV,
00368 (GLfloat*)getCombinerColor0()[i].getValuesRGBA());
00369 CombinerStageParameterfv(GL_COMBINER0_NV + i,
00370 GL_CONSTANT_COLOR1_NV,
00371 (GLfloat*)getCombinerColor1()[i].getValuesRGBA());
00372
00373 }
00374 else
00375 {
00376 FWARNING(("RegisterCombinersChunk::register_combiners2 not"
00377 "supported, constant colors ignored!!\n"));
00378 }
00379 }
00380 }
00381
00382 if(hasRC2)
00383 {
00384 if(getPerStageConstants())
00385 {
00386 glEnable(GL_PER_STAGE_CONSTANTS_NV);
00387 }
00388 else
00389 {
00390 glDisable(GL_PER_STAGE_CONSTANTS_NV);
00391 }
00392 }
00393
00394 glErr("RegisterCombinersChunk::general combiners setup");
00395
00396
00397
00398 FinalCombinerInput(GL_VARIABLE_A_NV,
00399 getVariableArgb()[OSG_NUM_COMBINERS * 3],
00400 getVariableArgb()[OSG_NUM_COMBINERS * 3 + 1],
00401 getVariableArgb()[OSG_NUM_COMBINERS * 3 + 2]);
00402
00403 glErr("RegisterCombinersChunk::final combiner var a setup");
00404
00405 FinalCombinerInput(GL_VARIABLE_B_NV,
00406 getVariableBrgb()[OSG_NUM_COMBINERS * 3],
00407 getVariableBrgb()[OSG_NUM_COMBINERS * 3 + 1],
00408 getVariableBrgb()[OSG_NUM_COMBINERS * 3 + 2]);
00409
00410 glErr("RegisterCombinersChunk::final combiner var b setup");
00411
00412 FinalCombinerInput(GL_VARIABLE_C_NV,
00413 getVariableCrgb()[OSG_NUM_COMBINERS * 3],
00414 getVariableCrgb()[OSG_NUM_COMBINERS * 3 + 1],
00415 getVariableCrgb()[OSG_NUM_COMBINERS * 3 + 2]);
00416
00417 glErr("RegisterCombinersChunk::final combiner var c setup");
00418
00419 FinalCombinerInput(GL_VARIABLE_D_NV,
00420 getVariableDrgb()[OSG_NUM_COMBINERS * 3],
00421 getVariableDrgb()[OSG_NUM_COMBINERS * 3 + 1],
00422 getVariableDrgb()[OSG_NUM_COMBINERS * 3 + 2]);
00423
00424 glErr("RegisterCombinersChunk::final combiner var d setup");
00425
00426 FinalCombinerInput(GL_VARIABLE_E_NV,
00427 getVariableE()[0],
00428 getVariableE()[1],
00429 getVariableE()[2]);
00430
00431 glErr("RegisterCombinersChunk::final combiner var e setup");
00432
00433 FinalCombinerInput(GL_VARIABLE_F_NV,
00434 getVariableF()[0],
00435 getVariableF()[1],
00436 getVariableF()[2]);
00437
00438 glErr("RegisterCombinersChunk::final combiner var f setup");
00439
00440 FinalCombinerInput(GL_VARIABLE_G_NV,
00441 getVariableG()[0],
00442 getVariableG()[1],
00443 getVariableG()[2]);
00444
00445 glErr("RegisterCombinersChunk::final combiner setup");
00446
00447
00448 glEnable(GL_REGISTER_COMBINERS_NV);
00449
00450 glErr("RegisterCombinersChunk::activate");
00451 }
00452
00453
00454 void RegisterCombinersChunk::changeFrom(DrawActionBase *action,
00455 StateChunk *old ,
00456 UInt32 idx )
00457 {
00458
00459
00460
00461 if(old == this)
00462 return;
00463
00464 old->deactivate(action, idx);
00465 activate(action, idx);
00466 }
00467
00468 void RegisterCombinersChunk::deactivate ( DrawActionBase *, UInt32 )
00469 {
00470 glDisable(GL_REGISTER_COMBINERS_NV);
00471
00472 glErr("RegisterCombinersChunk::deactivate");
00473 }
00474
00475 bool RegisterCombinersChunk::isTransparent(void) const
00476 {
00477 return false;
00478 }
00479
00480
00481
00482 void RegisterCombinersChunk::ensureSizes()
00483 {
00484 getVariableArgb ().resize(OSG_NUM_COMBINERS * 3 + 3);
00485 getVariableBrgb ().resize(OSG_NUM_COMBINERS * 3 + 3);
00486 getVariableCrgb ().resize(OSG_NUM_COMBINERS * 3 + 3);
00487 getVariableDrgb ().resize(OSG_NUM_COMBINERS * 3 + 3);
00488 getVariableAalpha().resize(OSG_NUM_COMBINERS * 3 + 3);
00489 getVariableBalpha().resize(OSG_NUM_COMBINERS * 3 + 3);
00490 getVariableCalpha().resize(OSG_NUM_COMBINERS * 3 + 3);
00491 getVariableDalpha().resize(OSG_NUM_COMBINERS * 3 + 3);
00492 getOutputABrgb ().resize(OSG_NUM_COMBINERS);
00493 getOutputCDrgb ().resize(OSG_NUM_COMBINERS);
00494 getOutputSumrgb ().resize(OSG_NUM_COMBINERS);
00495 getScalergb ().resize(OSG_NUM_COMBINERS);
00496 getBiasrgb ().resize(OSG_NUM_COMBINERS);
00497 getDotABrgb ().resize(OSG_NUM_COMBINERS);
00498 getDotCDrgb ().resize(OSG_NUM_COMBINERS);
00499 getMuxSumrgb ().resize(OSG_NUM_COMBINERS);
00500 getScalealpha ().resize(OSG_NUM_COMBINERS);
00501 getBiasalpha ().resize(OSG_NUM_COMBINERS);
00502 getMuxSumalpha ().resize(OSG_NUM_COMBINERS);
00503 getCombinerColor0().resize(OSG_NUM_COMBINERS);
00504 getCombinerColor1().resize(OSG_NUM_COMBINERS);
00505 getVariableE ().resize(3);
00506 getVariableF ().resize(3);
00507 getVariableG ().resize(3);
00508 }
00509
00513 void RegisterCombinersChunk::clearCombiners(void)
00514 {
00515 ensureSizes();
00516
00517 for(UInt16 i = 0; i < OSG_NUM_COMBINERS * 3; i += 3)
00518 {
00519 getVariableArgb ()[i] = unused;
00520 getVariableAalpha()[i] = unused;
00521 }
00522
00523 setPerStageConstants(false);
00524 }
00525
00526 void RegisterCombinersChunk::clearCombiner(UInt16 which)
00527 {
00528 ensureSizes();
00529
00530 getVariableArgb ()[which * 3] = unused;
00531 getVariableAalpha()[which * 3] = unused;
00532 }
00533
00534 void RegisterCombinersChunk::setCombinerRGB(UInt16 which,
00535 GLenum ainput, GLenum amapping, GLenum acompusage,
00536 GLenum binput, GLenum bmapping, GLenum bcompusage,
00537 GLenum cinput, GLenum cmapping, GLenum ccompusage,
00538 GLenum dinput, GLenum dmapping, GLenum dcompusage,
00539 GLenum outputAB, GLenum outputCD, GLenum outputSum,
00540 GLenum scale, GLenum bias,
00541 GLboolean dotAB, GLboolean dotCD, GLboolean muxSum)
00542 {
00543 ensureSizes();
00544
00545 const UInt16 ibase = which * 3;
00546
00547 getVariableArgb()[ibase ] = ainput;
00548 getVariableArgb()[ibase + 1] = amapping;
00549 getVariableArgb()[ibase + 2] = acompusage;
00550
00551 getVariableBrgb()[ibase ] = binput;
00552 getVariableBrgb()[ibase + 1] = bmapping;
00553 getVariableBrgb()[ibase + 2] = bcompusage;
00554
00555 getVariableCrgb()[ibase ] = cinput;
00556 getVariableCrgb()[ibase + 1] = cmapping;
00557 getVariableCrgb()[ibase + 2] = ccompusage;
00558
00559 getVariableDrgb()[ibase ] = dinput;
00560 getVariableDrgb()[ibase + 1] = dmapping;
00561 getVariableDrgb()[ibase + 2] = dcompusage;
00562
00563 getOutputABrgb ()[which] = outputAB;
00564 getOutputCDrgb ()[which] = outputCD;
00565 getOutputSumrgb()[which] = outputSum;
00566 getScalergb ()[which] = scale;
00567 getBiasrgb ()[which] = bias;
00568 getDotABrgb ()[which] = dotAB;
00569 getDotCDrgb ()[which] = dotCD;
00570 getMuxSumrgb ()[which] = muxSum;
00571 }
00572
00573 void RegisterCombinersChunk::setCombinerAlpha(UInt16 which,
00574 GLenum ainput, GLenum amapping, GLenum acompusage,
00575 GLenum binput, GLenum bmapping, GLenum bcompusage,
00576 GLenum cinput, GLenum cmapping, GLenum ccompusage,
00577 GLenum dinput, GLenum dmapping, GLenum dcompusage,
00578 GLenum outputAB, GLenum outputCD, GLenum outputSum,
00579 GLenum scale, GLenum bias,
00580 GLboolean muxSum)
00581 {
00582 ensureSizes();
00583
00584 const UInt16 ibase = which * 3;
00585
00586 getVariableAalpha()[ibase ] = ainput;
00587 getVariableAalpha()[ibase + 1] = amapping;
00588 getVariableAalpha()[ibase + 2] = acompusage;
00589
00590 getVariableBalpha()[ibase ] = binput;
00591 getVariableBalpha()[ibase + 1] = bmapping;
00592 getVariableBalpha()[ibase + 2] = bcompusage;
00593
00594 getVariableCalpha()[ibase ] = cinput;
00595 getVariableCalpha()[ibase + 1] = cmapping;
00596 getVariableCalpha()[ibase + 2] = ccompusage;
00597
00598 getVariableDalpha()[ibase ] = dinput;
00599 getVariableDalpha()[ibase + 1] = dmapping;
00600 getVariableDalpha()[ibase + 2] = dcompusage;
00601
00602 getOutputABalpha ()[which] = outputAB;
00603 getOutputCDalpha ()[which] = outputCD;
00604 getOutputSumalpha()[which] = outputSum;
00605 getScalealpha ()[which] = scale;
00606 getBiasalpha ()[which] = bias;
00607 getMuxSumalpha ()[which] = muxSum;
00608 }
00609
00610 void RegisterCombinersChunk::setFinalCombiner(
00611 GLenum ainput, GLenum amapping, GLenum acompusage,
00612 GLenum binput, GLenum bmapping, GLenum bcompusage,
00613 GLenum cinput, GLenum cmapping, GLenum ccompusage,
00614 GLenum dinput, GLenum dmapping, GLenum dcompusage,
00615 GLenum einput, GLenum emapping, GLenum ecompusage,
00616 GLenum finput, GLenum fmapping, GLenum fcompusage,
00617 GLenum ginput, GLenum gmapping, GLenum gcompusage)
00618 {
00619 UInt16 ibase = OSG_NUM_COMBINERS * 3;
00620
00621 getVariableArgb()[ibase ] = ainput;
00622 getVariableArgb()[ibase + 1] = amapping;
00623 getVariableArgb()[ibase + 2] = acompusage;
00624
00625 getVariableBrgb()[ibase ] = binput;
00626 getVariableBrgb()[ibase + 1] = bmapping;
00627 getVariableBrgb()[ibase + 2] = bcompusage;
00628
00629 getVariableCrgb()[ibase ] = cinput;
00630 getVariableCrgb()[ibase + 1] = cmapping;
00631 getVariableCrgb()[ibase + 2] = ccompusage;
00632
00633 getVariableDrgb()[ibase ] = dinput;
00634 getVariableDrgb()[ibase + 1] = dmapping;
00635 getVariableDrgb()[ibase + 2] = dcompusage;
00636
00637 getVariableE()[0] = einput;
00638 getVariableE()[1] = emapping;
00639 getVariableE()[2] = ecompusage;
00640
00641 getVariableF()[0] = finput;
00642 getVariableF()[1] = fmapping;
00643 getVariableF()[2] = fcompusage;
00644
00645 getVariableG()[0] = ginput;
00646 getVariableG()[1] = gmapping;
00647 getVariableG()[2] = gcompusage;
00648 }
00649
00650 void RegisterCombinersChunk::setConstantColors(
00651 Color4f &color0, Color4f &color1)
00652 {
00653 RegisterCombinersChunkPtr tmpPtr(*this);
00654
00655 beginEditCP(tmpPtr, PerStageConstantsFieldMask);
00656
00657 getColor0() = color0;
00658 getColor1() = color1;
00659
00660 endEditCP(tmpPtr, PerStageConstantsFieldMask);
00661 }
00662
00663 void RegisterCombinersChunk::setCombinerColors(UInt16 which,
00664 Color4f &color0, Color4f &color1)
00665 {
00666 RegisterCombinersChunkPtr tmpPtr(*this);
00667
00668 beginEditCP(tmpPtr, PerStageConstantsFieldMask);
00669
00670 setPerStageConstants(true);
00671
00672 getCombinerColor0()[which] = color0;
00673 getCombinerColor1()[which] = color1;
00674
00675 endEditCP(tmpPtr, PerStageConstantsFieldMask);
00676 }
00677
00678
00679
00680 Real32 RegisterCombinersChunk::switchCost(StateChunk *OSG_CHECK_ARG(chunk))
00681 {
00682 return 0;
00683 }
00684
00685 bool RegisterCombinersChunk::operator < (const StateChunk &other) const
00686 {
00687 return this < &other;
00688 }
00689
00690 bool RegisterCombinersChunk::operator == (const StateChunk &other) const
00691 {
00692 RegisterCombinersChunk const *tother = dynamic_cast<RegisterCombinersChunk const*>(&other);
00693
00694 if(!tother)
00695 return false;
00696
00697 if(tother == this)
00698 return true;
00699
00700
00701 return false;
00702 }
00703
00704 bool RegisterCombinersChunk::operator != (const StateChunk &other) const
00705 {
00706 return ! (*this == other);
00707 }
00708
00709
00710
00711
00712
00713
00714 #ifdef __sgi
00715 #pragma set woff 1174
00716 #endif
00717
00718 #ifdef OSG_LINUX_ICC
00719 #pragma warning( disable : 177 )
00720 #endif
00721
00722 namespace
00723 {
00724 static Char8 cvsid_cpp[] = "@(#)$Id: OSGRegisterCombinersChunk.cpp,v 1.3 2002/06/13 03:16:18 vossg Exp $";
00725 static Char8 cvsid_hpp[] = OSGREGISTERCOMBINERSCHUNK_HEADER_CVSID;
00726 static Char8 cvsid_inl[] = OSGREGISTERCOMBINERSCHUNK_INLINE_CVSID;
00727 }
00728
00729 #ifdef __sgi
00730 #pragma reset woff 1174
00731 #endif
00732