|
|
@ -452,13 +452,13 @@ bool CDriverGL3::setupMaterial(CMaterial& mat)
|
|
|
|
enableLightingVP(mat.getFlags() & IDRV_MAT_LIGHTING);
|
|
|
|
enableLightingVP(mat.getFlags() & IDRV_MAT_LIGHTING);
|
|
|
|
if (mat.getFlags()&IDRV_MAT_LIGHTING)
|
|
|
|
if (mat.getFlags()&IDRV_MAT_LIGHTING)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_DriverGLStates.setEmissive(pShader->PackedEmissive, pShader->Emissive);
|
|
|
|
/*_DriverGLStates.setEmissive(pShader->PackedEmissive, pShader->Emissive);
|
|
|
|
_DriverGLStates.setAmbient(pShader->PackedAmbient, pShader->Ambient);
|
|
|
|
_DriverGLStates.setAmbient(pShader->PackedAmbient, pShader->Ambient);
|
|
|
|
_DriverGLStates.setDiffuse(pShader->PackedDiffuse, pShader->Diffuse);
|
|
|
|
_DriverGLStates.setDiffuse(pShader->PackedDiffuse, pShader->Diffuse);
|
|
|
|
_DriverGLStates.setSpecular(pShader->PackedSpecular, pShader->Specular);
|
|
|
|
_DriverGLStates.setSpecular(pShader->PackedSpecular, pShader->Specular);
|
|
|
|
_DriverGLStates.setShininess(mat.getShininess());
|
|
|
|
_DriverGLStates.setShininess(mat.getShininess());
|
|
|
|
_DriverGLStates.setVertexColorLighted(mat.isLightedVertexColor ());
|
|
|
|
_DriverGLStates.setVertexColorLighted(mat.isLightedVertexColor ());*/
|
|
|
|
|
|
|
|
// FIXME GL3 VERTEX COLOR VP
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -466,7 +466,8 @@ bool CDriverGL3::setupMaterial(CMaterial& mat)
|
|
|
|
// CRGBA col= mat.getColor();
|
|
|
|
// CRGBA col= mat.getColor();
|
|
|
|
// glColor4ub(col.R, col.G, col.B, col.A);
|
|
|
|
// glColor4ub(col.R, col.G, col.B, col.A);
|
|
|
|
|
|
|
|
|
|
|
|
_DriverGLStates.setVertexColorLighted(false);
|
|
|
|
// _DriverGLStates.setVertexColorLighted(false);
|
|
|
|
|
|
|
|
// FIXME GL3 VERTEX COLOR VP
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fog Part.
|
|
|
|
// Fog Part.
|
|
|
@ -790,11 +791,12 @@ sint CDriverGL3::beginLightMapMultiPass ()
|
|
|
|
setupLightMapDynamicLighting(true);
|
|
|
|
setupLightMapDynamicLighting(true);
|
|
|
|
|
|
|
|
|
|
|
|
// reset Ambient and specular lighting
|
|
|
|
// reset Ambient and specular lighting
|
|
|
|
static uint32 packedColorBlack= CRGBA(0,0,0,255).getPacked();
|
|
|
|
// static uint32 packedColorBlack= CRGBA(0,0,0,255).getPacked();
|
|
|
|
static GLfloat glcolBlack[4]= {0,0,0,1};
|
|
|
|
// static GLfloat glcolBlack[4]= {0,0,0,1};
|
|
|
|
// lightmap get no specular/ambient. Emissive and Diffuse are setuped in setupLightMapPass()
|
|
|
|
// lightmap get no specular/ambient. Emissive and Diffuse are setuped in setupLightMapPass()
|
|
|
|
_DriverGLStates.setAmbient(packedColorBlack, glcolBlack);
|
|
|
|
// _DriverGLStates.setAmbient(packedColorBlack, glcolBlack);
|
|
|
|
_DriverGLStates.setSpecular(packedColorBlack, glcolBlack);
|
|
|
|
// _DriverGLStates.setSpecular(packedColorBlack, glcolBlack);
|
|
|
|
|
|
|
|
// FIXME GL3 LIGHTMAP
|
|
|
|
|
|
|
|
|
|
|
|
// Manage too if no lightmaps.
|
|
|
|
// Manage too if no lightmaps.
|
|
|
|
return std::max (_NLightMapPass, (uint)1);
|
|
|
|
return std::max (_NLightMapPass, (uint)1);
|
|
|
@ -829,7 +831,8 @@ void CDriverGL3::setupLightMapPass(uint pass)
|
|
|
|
|
|
|
|
|
|
|
|
// Since Lighting is disabled, as well as colorArray, must setup alpha.
|
|
|
|
// Since Lighting is disabled, as well as colorArray, must setup alpha.
|
|
|
|
// setup color to 0 => blackness. in emissive cause texture can still be lighted by dynamic light
|
|
|
|
// setup color to 0 => blackness. in emissive cause texture can still be lighted by dynamic light
|
|
|
|
_DriverGLStates.setEmissive(packedColorBlack, glcolBlack);
|
|
|
|
// _DriverGLStates.setEmissive(packedColorBlack, glcolBlack);
|
|
|
|
|
|
|
|
// FIXME GL3 LIGHTMAP
|
|
|
|
|
|
|
|
|
|
|
|
// Setup gen tex off
|
|
|
|
// Setup gen tex off
|
|
|
|
_DriverGLStates.activeTexture(0);
|
|
|
|
_DriverGLStates.activeTexture(0);
|
|
|
@ -877,10 +880,11 @@ void CDriverGL3::setupLightMapPass(uint pass)
|
|
|
|
b= std::min(b, (uint32)255);
|
|
|
|
b= std::min(b, (uint32)255);
|
|
|
|
|
|
|
|
|
|
|
|
// this color will be added to the first lightmap (with help of emissive)
|
|
|
|
// this color will be added to the first lightmap (with help of emissive)
|
|
|
|
CRGBA col((uint8)r,(uint8)g,(uint8)b,255);
|
|
|
|
// CRGBA col((uint8)r,(uint8)g,(uint8)b,255);
|
|
|
|
GLfloat glcol[4];
|
|
|
|
// GLfloat glcol[4];
|
|
|
|
convColor(col, glcol);
|
|
|
|
// convColor(col, glcol);
|
|
|
|
_DriverGLStates.setEmissive(col.getPacked(), glcol);
|
|
|
|
// _DriverGLStates.setEmissive(col.getPacked(), glcol);
|
|
|
|
|
|
|
|
// FIXME GL3 LIGHTMAP
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// setup all stages.
|
|
|
|
// setup all stages.
|
|
|
@ -1025,14 +1029,18 @@ void CDriverGL3::setupLightMapPass(uint pass)
|
|
|
|
if (pass==0)
|
|
|
|
if (pass==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// If the lightmap is in x2 mode, then must divide effect of the dynamic light too
|
|
|
|
// If the lightmap is in x2 mode, then must divide effect of the dynamic light too
|
|
|
|
if (mat._LightMapsMulx2)
|
|
|
|
// if (mat._LightMapsMulx2)
|
|
|
|
_DriverGLStates.setDiffuse(packedColorGrey, glcolGrey);
|
|
|
|
// _DriverGLStates.setDiffuse(packedColorGrey, glcolGrey);
|
|
|
|
else
|
|
|
|
// else
|
|
|
|
_DriverGLStates.setDiffuse(packedColorWhite, glcolWhite);
|
|
|
|
// _DriverGLStates.setDiffuse(packedColorWhite, glcolWhite);
|
|
|
|
|
|
|
|
// FIXME GL3 LIGHTMAP
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// no need to reset for pass after 1, since same than prec pass (black)!
|
|
|
|
// no need to reset for pass after 1, since same than prec pass (black)!
|
|
|
|
else if (pass==1)
|
|
|
|
else if (pass==1)
|
|
|
|
_DriverGLStates.setDiffuse(packedColorBlack, glcolBlack);
|
|
|
|
{
|
|
|
|
|
|
|
|
// _DriverGLStates.setDiffuse(packedColorBlack, glcolBlack);
|
|
|
|
|
|
|
|
// FIXME GL3 LIGHTMAP
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|