Skip to content
Permalink
Browse files

R2: testing some lightstuff on entity renderer

  • Loading branch information...
thunderpwn committed Sep 29, 2019
1 parent 1733a35 commit d8fbd8d1c2c820423d583601f94979dc51117d51
Showing with 36 additions and 7 deletions.
  1. +36 −7 src/renderer2/tr_shade.c
@@ -680,17 +680,46 @@ static void Render_vertexLighting_DBS_entity(int stage)

GLSL_SetUniform_AlphaTest(pStage->stateBits);

if (r_normalMapping->integer)
{
SetUniformVec3(UNIFORM_VIEWORIGIN, backEnd.viewParms.orientation.origin); // in world space
}

SetUniformVec3(UNIFORM_VIEWORIGIN, backEnd.viewParms.orientation.origin); // in world space


SetUniformMatrix16(UNIFORM_MODELMATRIX, MODEL_MATRIX); // same as backEnd.orientation.transformMatrix);
SetUniformMatrix16(UNIFORM_MODELVIEWPROJECTIONMATRIX, GLSTACK_MVPM);

SetUniformVec3(UNIFORM_AMBIENTCOLOR, backEnd.currentEntity->ambientLight);
SetUniformVec3(UNIFORM_LIGHTDIR, backEnd.currentEntity->lightDir);
SetUniformVec3(UNIFORM_LIGHTCOLOR, backEnd.currentEntity->directedLight);

//if ents miss ambient color, use tess
if (!backEnd.currentEntity->ambientLight)
{
//lets use the ambient color in map
SetUniformVec3(UNIFORM_AMBIENTCOLOR, tr.worldEntity.ambientLight);

}
else
{
SetUniformVec3(UNIFORM_AMBIENTCOLOR, backEnd.currentEntity->ambientLight);
}

//if we miss lightdir from ents, use sun
if (!backEnd.currentEntity->lightDir)
{
SetUniformVec3(UNIFORM_LIGHTDIR, tr.sunDirection);
}
else
{
SetUniformVec3(UNIFORM_LIGHTDIR, backEnd.currentEntity->lightDir);
}
//if we miss directed light use tess
if (!backEnd.currentEntity->directedLight)
{
SetUniformVec3(UNIFORM_LIGHTCOLOR, tess.svars.color);
}
else
{
SetUniformVec3(UNIFORM_LIGHTCOLOR, backEnd.currentEntity->directedLight);
}



if (r_wrapAroundLighting->integer)
{

0 comments on commit d8fbd8d

Please sign in to comment.
You can’t perform that action at this time.