1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-14 00:54:05 +02:00

#23 fix water for WebGL support

This commit is contained in:
XProger
2017-02-03 07:36:27 +03:00
parent 7abd204a5e
commit 40378ebd20
4 changed files with 7 additions and 5 deletions

View File

@@ -236,7 +236,7 @@ struct Lara : Character {
stand = STAND_ONWATER;
animation.setAnim(ANIM_TO_ONWATER);
updateEntity();
*/
*/
#ifdef _DEBUG
/*
// gym

View File

@@ -421,7 +421,7 @@ struct Level : IGame {
Core::active.shader->setParam(uTexParam, vec4(1.0f, 1.0f, sx, sz));
item.caustics->unbind(sReflect);
Core::whiteTex->bind(sReflect);
item.data[0]->bind(sNormal);
Core::setTarget(item.caustics);
level->mesh->renderPlane();
@@ -1121,8 +1121,10 @@ struct Level : IGame {
camera->setup(Core::pass == Core::passCompose);
atlas->bind(sDiffuse);
cube->bind(sEnvironment);
Core::whiteTex->bind(sNormal);
Core::whiteTex->bind(sMask);
Core::whiteTex->bind(sReflect);
cube->bind(sEnvironment);
if (!Core::support.VAO)
mesh->bind();

View File

@@ -229,7 +229,7 @@ uniform int uType;
float calcCaustics(vec3 n) {
if (uCaustics != 0) {
vec2 fade = smoothstep(uRoomSize.xy, uRoomSize.xy + vec2(256.0), vCoord.xz) * (1.0f - smoothstep(uRoomSize.zw - vec2(256.0), uRoomSize.zw, vCoord.xz));
vec2 fade = smoothstep(uRoomSize.xy, uRoomSize.xy + vec2(256.0), vCoord.xz) * (1.0 - smoothstep(uRoomSize.zw - vec2(256.0), uRoomSize.zw, vCoord.xz));
return texture2D(sReflect, vTexCoord.zw).r * (max(0.0, -n.y)) * fade.x * fade.y;
} else
return 0.0;

View File

@@ -62,7 +62,7 @@ struct Texture {
{ GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE }, // RGBA
{ GL_RGBA32F, GL_RGBA, GL_FLOAT }, // RGBA_FLOAT
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT }, // RGBA_HALF
{ GL_RED, GL_RED, GL_UNSIGNED_BYTE }, // RED
{ GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE }, // RED
{ GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT }, // DEPTH
{ GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT }, // SHADOW
};