-----------------------------------------------------------------------
| 418 | } |
| 419 | //----------------------------------------------------------------------- |
| 420 | void RenderSystem::_setTextureUnitSettings(size_t texUnit, TextureUnitState& tl) |
| 421 | { |
| 422 | if(texUnit >= getCapabilities()->getNumTextureUnits()) |
| 423 | return; |
| 424 | |
| 425 | // This method is only ever called to set a texture unit to valid details |
| 426 | // The method _disableTextureUnit is called to turn a unit off |
| 427 | TexturePtr tex = tl._getTexturePtr(); |
| 428 | if(!tex || tl.isTextureLoadFailing()) |
| 429 | tex = mTextureManager->_getWarningTexture(); |
| 430 | |
| 431 | if(tl.getUnorderedAccessMipLevel() > -1) |
| 432 | { |
| 433 | tex->createShaderAccessPoint(texUnit, TA_READ_WRITE, tl.getUnorderedAccessMipLevel()); |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | // Bind texture (may be blank) |
| 438 | _setTexture(texUnit, true, tex); |
| 439 | |
| 440 | _setSampler(texUnit, *tl.getSampler()); |
| 441 | |
| 442 | if(!getCapabilities()->hasCapability(RSC_FIXED_FUNCTION)) |
| 443 | return; |
| 444 | |
| 445 | // Set texture coordinate set |
| 446 | _setTextureCoordSet(texUnit, tl.getTextureCoordSet()); |
| 447 | |
| 448 | // Set blend modes |
| 449 | // Note, colour before alpha is important |
| 450 | _setTextureBlendMode(texUnit, tl.getColourBlendMode()); |
| 451 | _setTextureBlendMode(texUnit, tl.getAlphaBlendMode()); |
| 452 | |
| 453 | auto calcMode = tl._deriveTexCoordCalcMethod(); |
| 454 | if(calcMode == TEXCALC_PROJECTIVE_TEXTURE) |
| 455 | { |
| 456 | _setTextureCoordCalculation(texUnit, calcMode, tl.getProjectiveTexturingFrustum()); |
| 457 | } |
| 458 | else |
| 459 | { |
| 460 | _setTextureCoordCalculation(texUnit, calcMode); |
| 461 | } |
| 462 | |
| 463 | // Change tetxure matrix |
| 464 | _setTextureMatrix(texUnit, tl.getTextureTransform()); |
| 465 | } |
| 466 | //----------------------------------------------------------------------- |
| 467 | void RenderSystem::_disableTextureUnit(size_t texUnit) |
| 468 | { |
no test coverage detected