Skip to content

Commit

Permalink
OpenGL shadows fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-ushakov committed Jun 12, 2024
1 parent 7dbbe68 commit 7a0926f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Render/sokol/SokolRenderDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void cSokolRender::SetMaterialTilemap(cTileMap *TileMap) {
activeCommand.SetTexture(2, pLightMap->GetFrameImage(0)->sg->image);

TerraInterface* terra = TileMap->GetTerra();
activeWorldSize = Vect2f(terra->SizeX(), terra->SizeY());
activeWorldSize = Vect2f(1.0f / terra->SizeX(), 1.0f / terra->SizeY());

if (activePipelineType != PIPELINE_TYPE_TILE_MAP) {
FinishActiveDrawBuffer();
Expand Down
3 changes: 3 additions & 0 deletions Source/Render/sokol/shaders/tile_map.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ void main() {

float offset = 1.0f / 1024.0f;
fs_uv0 = (un_shadow * vec4(vs_position, 1.0f) + vec4(-offset, +offset*0.5f, 0, 0)).xyz;
#if SOKOL_GLSL
fs_uv0.y = 1.0f - fs_uv0.y;
#endif
fs_uv1 = vs_texcoord0;
fs_uv2 = vs_position.xy * un_inv_world_size;
}
Expand Down

0 comments on commit 7a0926f

Please sign in to comment.