-----------------------------------------------------------------------
| 606 | |
| 607 | //----------------------------------------------------------------------- |
| 608 | void FFPTexturing::setTextureUnit(unsigned short index, TextureUnitState* textureUnitState) |
| 609 | { |
| 610 | OgreAssert(index < mTextureUnitParamsList.size(), "FFPTexturing unit index out of bounds"); |
| 611 | |
| 612 | TextureUnitParams& curParams = mTextureUnitParamsList[index]; |
| 613 | |
| 614 | |
| 615 | curParams.mTextureSamplerIndex = index; |
| 616 | curParams.mTextureUnitState = textureUnitState; |
| 617 | |
| 618 | if(textureUnitState->isTextureLoadFailing()) // -> will be set to a 2D texture |
| 619 | return; |
| 620 | |
| 621 | bool isGLES2 = ShaderGenerator::getSingleton().getTargetLanguage() == "glsles"; |
| 622 | |
| 623 | switch (curParams.mTextureUnitState->getTextureType()) |
| 624 | { |
| 625 | case TEX_TYPE_1D: |
| 626 | curParams.mTextureSamplerType = GCT_SAMPLER1D; |
| 627 | curParams.mVSInTextureCoordinateType = GCT_FLOAT1; |
| 628 | if(!isGLES2) // no 1D texture support |
| 629 | break; |
| 630 | OGRE_FALLTHROUGH; |
| 631 | case TEX_TYPE_2D: |
| 632 | case TEX_TYPE_2D_MULTISAMPLE: |
| 633 | curParams.mTextureSamplerType = GCT_SAMPLER2D; |
| 634 | curParams.mVSInTextureCoordinateType = GCT_FLOAT2; |
| 635 | break; |
| 636 | case TEX_TYPE_EXTERNAL_OES: |
| 637 | curParams.mTextureSamplerType = GCT_SAMPLER_EXTERNAL_OES; |
| 638 | curParams.mVSInTextureCoordinateType = GCT_FLOAT2; |
| 639 | break; |
| 640 | case TEX_TYPE_2D_ARRAY: |
| 641 | curParams.mTextureSamplerType = GCT_SAMPLER2DARRAY; |
| 642 | curParams.mVSInTextureCoordinateType = GCT_FLOAT3; |
| 643 | break; |
| 644 | case TEX_TYPE_3D: |
| 645 | curParams.mTextureSamplerType = GCT_SAMPLER3D; |
| 646 | curParams.mVSInTextureCoordinateType = GCT_FLOAT3; |
| 647 | break; |
| 648 | case TEX_TYPE_CUBE_MAP: |
| 649 | curParams.mTextureSamplerType = GCT_SAMPLERCUBE; |
| 650 | curParams.mVSInTextureCoordinateType = GCT_FLOAT3; |
| 651 | break; |
| 652 | } |
| 653 | |
| 654 | curParams.mVSOutTextureCoordinateType = curParams.mVSInTextureCoordinateType; |
| 655 | curParams.mTexCoordCalcMethod = textureUnitState->_deriveTexCoordCalcMethod(); |
| 656 | |
| 657 | if (curParams.mTexCoordCalcMethod == TEXCALC_PROJECTIVE_TEXTURE) |
| 658 | curParams.mVSOutTextureCoordinateType = GCT_FLOAT4; |
| 659 | |
| 660 | // let TexCalcMethod override texture type, as it might be wrong for |
| 661 | // content_type shadow & content_type compositor |
| 662 | if (curParams.mTexCoordCalcMethod == TEXCALC_ENVIRONMENT_MAP_REFLECTION || |
| 663 | curParams.mTexCoordCalcMethod == TEXCALC_ENVIRONMENT_MAP_NORMAL) |
| 664 | { |
| 665 | curParams.mVSOutTextureCoordinateType = GCT_FLOAT3; |
nothing calls this directly
no test coverage detected