Merge pull request #1176 from chkr-private/screen-texture-lighting-fixes

EMI: Check bit in mesh face flags to disable lighting
This commit is contained in:
Christian Krause 2015-04-27 22:21:03 +02:00
commit a2e1c64d36
4 changed files with 6 additions and 3 deletions

View File

@ -64,6 +64,7 @@ public:
EMIModel *_parent;
enum MeshFaceFlags {
kNoLighting = 0x20, // guessed, but distinctive for screen actors
kAlphaBlend = 0x10000,
kUnknownBlend = 0x40000 // used only in intro screen actors
};

View File

@ -763,6 +763,7 @@ void GfxOpenGL::drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face)
if (model->_meshAlphaMode == Actor::AlphaReplace) {
alpha *= model->_meshAlpha;
}
Math::Vector3d noLighting(1.f, 1.f, 1.f);
for (uint j = 0; j < face->_faceLength * 3; j++) {
int index = indices[j];
@ -770,7 +771,7 @@ void GfxOpenGL::drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face)
if (face->_hasTexture) {
glTexCoord2f(model->_texVerts[index].getX(), model->_texVerts[index].getY());
}
Math::Vector3d lighting = model->_lighting[index];
Math::Vector3d lighting = (face->_flags & EMIMeshFace::kNoLighting) ? noLighting : model->_lighting[index];
byte r = (byte)(model->_colorMap[index].r * lighting.x());
byte g = (byte)(model->_colorMap[index].g * lighting.y());
byte b = (byte)(model->_colorMap[index].b * lighting.z());

View File

@ -935,7 +935,7 @@ void GfxOpenGLS::drawEMIModelFace(const EMIModel* model, const EMIMeshFace* face
mud->_shader->use();
bool textured = face->_hasTexture && !_currentShadowArray;
mud->_shader->setUniform("textured", textured ? GL_TRUE : GL_FALSE);
mud->_shader->setUniform("lightsEnabled", _lightsEnabled);
mud->_shader->setUniform("lightsEnabled", (face->_flags & EMIMeshFace::kNoLighting) ? false : _lightsEnabled);
mud->_shader->setUniform("swapRandB", _selectedTexture->_colorFormat == BM_BGRA || _selectedTexture->_colorFormat == BM_BGR888);
mud->_shader->setUniform("useVertexAlpha", _selectedTexture->_colorFormat == BM_BGRA);
mud->_shader->setUniform1f("meshAlpha", (model->_meshAlphaMode == Actor::AlphaReplace) ? model->_meshAlpha : 1.0f);

View File

@ -690,6 +690,7 @@ void GfxTinyGL::drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face)
if (model->_meshAlphaMode == Actor::AlphaReplace) {
alpha *= model->_meshAlpha;
}
Math::Vector3d noLighting(1.f, 1.f, 1.f);
for (uint j = 0; j < face->_faceLength * 3; j++) {
int index = indices[j];
if (!_currentShadowArray) {
@ -697,7 +698,7 @@ void GfxTinyGL::drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face)
tglTexCoord2f(model->_texVerts[index].getX(), model->_texVerts[index].getY());
}
Math::Vector3d lighting = model->_lighting[index];
Math::Vector3d lighting = (face->_flags & EMIMeshFace::kNoLighting) ? noLighting : model->_lighting[index];
byte r = (byte)(model->_colorMap[index].r * lighting.x());
byte g = (byte)(model->_colorMap[index].g * lighting.y());
byte b = (byte)(model->_colorMap[index].b * lighting.z());