mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-17 02:24:07 +02:00
#23 fix water for WebGL support
This commit is contained in:
@@ -236,7 +236,7 @@ struct Lara : Character {
|
|||||||
stand = STAND_ONWATER;
|
stand = STAND_ONWATER;
|
||||||
animation.setAnim(ANIM_TO_ONWATER);
|
animation.setAnim(ANIM_TO_ONWATER);
|
||||||
updateEntity();
|
updateEntity();
|
||||||
*/
|
*/
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
/*
|
/*
|
||||||
// gym
|
// gym
|
||||||
|
@@ -421,7 +421,7 @@ struct Level : IGame {
|
|||||||
|
|
||||||
Core::active.shader->setParam(uTexParam, vec4(1.0f, 1.0f, sx, sz));
|
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);
|
item.data[0]->bind(sNormal);
|
||||||
Core::setTarget(item.caustics);
|
Core::setTarget(item.caustics);
|
||||||
level->mesh->renderPlane();
|
level->mesh->renderPlane();
|
||||||
@@ -1121,8 +1121,10 @@ struct Level : IGame {
|
|||||||
camera->setup(Core::pass == Core::passCompose);
|
camera->setup(Core::pass == Core::passCompose);
|
||||||
|
|
||||||
atlas->bind(sDiffuse);
|
atlas->bind(sDiffuse);
|
||||||
cube->bind(sEnvironment);
|
Core::whiteTex->bind(sNormal);
|
||||||
Core::whiteTex->bind(sMask);
|
Core::whiteTex->bind(sMask);
|
||||||
|
Core::whiteTex->bind(sReflect);
|
||||||
|
cube->bind(sEnvironment);
|
||||||
|
|
||||||
if (!Core::support.VAO)
|
if (!Core::support.VAO)
|
||||||
mesh->bind();
|
mesh->bind();
|
||||||
|
@@ -229,7 +229,7 @@ uniform int uType;
|
|||||||
|
|
||||||
float calcCaustics(vec3 n) {
|
float calcCaustics(vec3 n) {
|
||||||
if (uCaustics != 0) {
|
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;
|
return texture2D(sReflect, vTexCoord.zw).r * (max(0.0, -n.y)) * fade.x * fade.y;
|
||||||
} else
|
} else
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@@ -62,7 +62,7 @@ struct Texture {
|
|||||||
{ GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE }, // RGBA
|
{ GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE }, // RGBA
|
||||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT }, // RGBA_FLOAT
|
{ GL_RGBA32F, GL_RGBA, GL_FLOAT }, // RGBA_FLOAT
|
||||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT }, // RGBA_HALF
|
{ 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 }, // DEPTH
|
||||||
{ GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT }, // SHADOW
|
{ GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT }, // SHADOW
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user