-----------------------------------------------------------------------------
| 1388 | } |
| 1389 | //----------------------------------------------------------------------------- |
| 1390 | void GLRenderSystem::_setTextureCoordCalculation(size_t stage, TexCoordCalcMethod m, |
| 1391 | const Frustum* frustum) |
| 1392 | { |
| 1393 | if (stage >= mFixedFunctionTextureUnits) |
| 1394 | { |
| 1395 | // Can't do this |
| 1396 | return; |
| 1397 | } |
| 1398 | |
| 1399 | GLfloat M[16]; |
| 1400 | Matrix4 projectionBias; |
| 1401 | |
| 1402 | // Default to no extra auto texture matrix |
| 1403 | mUseAutoTextureMatrix = false; |
| 1404 | |
| 1405 | GLfloat eyePlaneS[] = {1.0, 0.0, 0.0, 0.0}; |
| 1406 | GLfloat eyePlaneT[] = {0.0, 1.0, 0.0, 0.0}; |
| 1407 | GLfloat eyePlaneR[] = {0.0, 0.0, 1.0, 0.0}; |
| 1408 | GLfloat eyePlaneQ[] = {0.0, 0.0, 0.0, 1.0}; |
| 1409 | |
| 1410 | mStateCacheManager->activateGLTextureUnit(stage); |
| 1411 | |
| 1412 | switch( m ) |
| 1413 | { |
| 1414 | case TEXCALC_NONE: |
| 1415 | mStateCacheManager->disableTextureCoordGen( GL_TEXTURE_GEN_S ); |
| 1416 | mStateCacheManager->disableTextureCoordGen( GL_TEXTURE_GEN_T ); |
| 1417 | mStateCacheManager->disableTextureCoordGen( GL_TEXTURE_GEN_R ); |
| 1418 | mStateCacheManager->disableTextureCoordGen( GL_TEXTURE_GEN_Q ); |
| 1419 | break; |
| 1420 | |
| 1421 | case TEXCALC_ENVIRONMENT_MAP_PLANAR: |
| 1422 | // should be view position .xy, according to doc, but we want to match OGRE D3D9 behaviour here |
| 1423 | case TEXCALC_ENVIRONMENT_MAP: |
| 1424 | glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP ); |
| 1425 | glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP ); |
| 1426 | |
| 1427 | mStateCacheManager->enableTextureCoordGen( GL_TEXTURE_GEN_S ); |
| 1428 | mStateCacheManager->enableTextureCoordGen( GL_TEXTURE_GEN_T ); |
| 1429 | mStateCacheManager->disableTextureCoordGen( GL_TEXTURE_GEN_R ); |
| 1430 | mStateCacheManager->disableTextureCoordGen( GL_TEXTURE_GEN_Q ); |
| 1431 | |
| 1432 | // Need to use a texture matrix to flip the spheremap |
| 1433 | mUseAutoTextureMatrix = true; |
| 1434 | memset(mAutoTextureMatrix, 0, sizeof(GLfloat)*16); |
| 1435 | mAutoTextureMatrix[0] = mAutoTextureMatrix[10] = mAutoTextureMatrix[15] = 1.0f; |
| 1436 | mAutoTextureMatrix[5] = -1.0f; |
| 1437 | |
| 1438 | break; |
| 1439 | |
| 1440 | case TEXCALC_ENVIRONMENT_MAP_REFLECTION: |
| 1441 | |
| 1442 | glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP ); |
| 1443 | glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP ); |
| 1444 | glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP ); |
| 1445 | |
| 1446 | mStateCacheManager->enableTextureCoordGen( GL_TEXTURE_GEN_S ); |
| 1447 | mStateCacheManager->enableTextureCoordGen( GL_TEXTURE_GEN_T ); |
nothing calls this directly
no test coverage detected