Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions src/engine/renderer/glsl_source/lightMapping_vp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
uniform mat3x2 u_TextureMatrix;
#endif

#if defined(USE_MODEL_SURFACE)
uniform mat4 u_ModelMatrix;
#endif

uniform mat4 u_ModelMatrix;
uniform mat4 u_ModelViewProjectionMatrix;

uniform float u_Time;
Expand Down Expand Up @@ -84,21 +81,12 @@ void main()
// transform vertex position into homogenous clip-space
gl_Position = u_ModelViewProjectionMatrix * position;

#if defined(USE_BSP_SURFACE)
// assign vertex Position
var_Position = position.xyz;
// transform position into world space
var_Position = (u_ModelMatrix * position).xyz;

var_Tangent = LB.tangent;
var_Binormal = LB.binormal;
var_Normal = LB.normal;
#else
// transform position into world space
var_Position = (u_ModelMatrix * position).xyz;

var_Tangent = (u_ModelMatrix * vec4(LB.tangent, 0.0)).xyz;
var_Binormal = (u_ModelMatrix * vec4(LB.binormal, 0.0)).xyz;
var_Normal = (u_ModelMatrix * vec4(LB.normal, 0.0)).xyz;
#endif
var_Tangent = (u_ModelMatrix * vec4(LB.tangent, 0.0)).xyz;
var_Binormal = (u_ModelMatrix * vec4(LB.binormal, 0.0)).xyz;
var_Normal = (u_ModelMatrix * vec4(LB.normal, 0.0)).xyz;

#if defined(USE_LIGHT_MAPPING) || defined(USE_DELUXE_MAPPING)
var_TexLight = lmCoord;
Expand Down
28 changes: 9 additions & 19 deletions src/engine/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,32 +1057,22 @@ void Render_lightMapping( shaderStage_t *pStage )
// end choose right shader program ------------------------------

// now we are ready to set the shader program uniforms
vec3_t viewOrigin;

if ( tess.bspSurface )
if ( glConfig.vboVertexSkinningAvailable && tess.vboVertexSkinning )
{
VectorCopy( backEnd.orientation.viewOrigin, viewOrigin ); // in world space
gl_lightMappingShader->SetUniform_Bones( tess.numBones, tess.bones );
}
else
{
VectorCopy( backEnd.viewParms.orientation.origin, viewOrigin ); // in world space

if ( glConfig.vboVertexSkinningAvailable && tess.vboVertexSkinning )
{
gl_lightMappingShader->SetUniform_Bones( tess.numBones, tess.bones );
}

// u_VertexInterpolation
if ( tess.vboVertexAnimation )
{
gl_lightMappingShader->SetUniform_VertexInterpolation( glState.vertexAttribsInterpolation );
}

gl_lightMappingShader->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
// u_VertexInterpolation
if ( tess.vboVertexAnimation )
{
gl_lightMappingShader->SetUniform_VertexInterpolation( glState.vertexAttribsInterpolation );
}

gl_lightMappingShader->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );

// u_ViewOrigin
gl_lightMappingShader->SetUniform_ViewOrigin( viewOrigin );
gl_lightMappingShader->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin );

gl_lightMappingShader->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[ glState.stackIndex ] );

Expand Down
3 changes: 2 additions & 1 deletion src/engine/renderer/tr_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ void R_AddBSPModelSurfaces( trRefEntity_t *ent )

for ( i = 0; i < bspModel->numSurfaces; i++ )
{
R_AddWorldSurface( bspModel->firstSurface + i, fogNum, -1, FRUSTUM_CLIPALL );
bspSurface_t *surf = bspModel->firstSurface + i;
R_AddDrawSurf( surf->data, surf->shader, surf->lightmapNum, fogNum, true );
}
}

Expand Down
Loading