Trying to put the texture activation back into setMaterial. This had been changed in early versions of Irrlicht for render state problems. I hope we got them all fixed and can this way make external materials possible again. (problems are all OpenGL only)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2900 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-11-20 14:20:07 +00:00
parent f30d47b667
commit 9a14224c6f
2 changed files with 1 additions and 17 deletions

View File

@ -2025,6 +2025,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material)
for (s32 i = MaxTextureUnits-1; i>= 0; --i) for (s32 i = MaxTextureUnits-1; i>= 0; --i)
{ {
setActiveTexture(i, material.getTexture(i));
setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i),
Material.getTextureMatrix(i)); Material.getTextureMatrix(i));
} }

View File

@ -87,7 +87,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType)) if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType))
@ -112,7 +111,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
// if (material.MaterialType != lastMaterial.MaterialType || // if (material.MaterialType != lastMaterial.MaterialType ||
@ -215,8 +213,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
@ -261,7 +257,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates) if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates)
@ -297,7 +292,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
@ -345,7 +339,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates
@ -395,7 +388,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
@ -431,8 +423,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
@ -519,8 +509,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
@ -563,7 +551,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setActiveTexture(0, material.getTexture(0));
// texture needs to be flipped for OpenGL // texture needs to be flipped for OpenGL
core::matrix4 tmp = Driver->getTransform(ETS_TEXTURE_0); core::matrix4 tmp = Driver->getTransform(ETS_TEXTURE_0);
tmp[5]*=-1; tmp[5]*=-1;
@ -600,8 +587,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
@ -650,8 +635,6 @@ public:
bool resetAllRenderstates, IMaterialRendererServices* services) bool resetAllRenderstates, IMaterialRendererServices* services)
{ {
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setActiveTexture(1, material.getTexture(1));
Driver->setActiveTexture(0, material.getTexture(0));
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)