1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-06 21:26:56 +02:00
This commit is contained in:
XProger
2017-02-17 04:03:43 +03:00
4 changed files with 6 additions and 7 deletions

Binary file not shown.

View File

@@ -372,8 +372,8 @@ struct Bubble : Sprite {
pos.y -= speed * Core::deltaTime; pos.y -= speed * Core::deltaTime;
angle.x += 30.0f * 13.0f * DEG2RAD * Core::deltaTime; angle.x += 30.0f * 13.0f * DEG2RAD * Core::deltaTime;
angle.y += 30.0f * 9.0f * DEG2RAD * Core::deltaTime; angle.y += 30.0f * 9.0f * DEG2RAD * Core::deltaTime;
pos.x += sin(angle.y) * 11.0f * 30.0f * Core::deltaTime; pos.x += sinf(angle.y) * 11.0f * 30.0f * Core::deltaTime;
pos.z += cos(angle.x) * 8.0f * 30.0f * Core::deltaTime; pos.z += cosf(angle.x) * 8.0f * 30.0f * Core::deltaTime;
updateEntity(); updateEntity();
Sprite::update(); Sprite::update();
} }

View File

@@ -150,7 +150,7 @@ struct vec2 {
float length2() const { return dot(*this); } float length2() const { return dot(*this); }
float length() const { return sqrtf(length2()); } float length() const { return sqrtf(length2()); }
vec2 normal() const { float s = length(); return s == 0.0 ? (*this) : (*this)*(1.0f/s); } vec2 normal() const { float s = length(); return s == 0.0 ? (*this) : (*this)*(1.0f/s); }
float angle() const { return atan2(y, x); } float angle() const { return atan2f(y, x); }
}; };
struct vec3 { struct vec3 {

View File

@@ -56,6 +56,7 @@ uniform sampler2D sNormal;
gl_Position = cp; gl_Position = cp;
} else { } else {
vProjCoord = vec4(0.0); vProjCoord = vec4(0.0);
vCoord = vec3(aCoord.xy, 0.0);
if (uType == WATER_CAUSTICS) { if (uType == WATER_CAUSTICS) {
vec3 rCoord = vec3(aCoord.x, 0.0, aCoord.y) * uPosScale[1]; vec3 rCoord = vec3(aCoord.x, 0.0, aCoord.y) * uPosScale[1];
@@ -72,8 +73,6 @@ uniform sampler2D sNormal;
gl_Position = vec4((vRefPos2.xz + 0.0 * refractedLight.xz / refractedLight.y), 0.0, 1.0); gl_Position = vec4((vRefPos2.xz + 0.0 * refractedLight.xz / refractedLight.y), 0.0, 1.0);
} else { } else {
vRefPos1 = vRefPos2 = vec3(0.0); vRefPos1 = vRefPos2 = vec3(0.0);
vCoord = vec3(aCoord.xy, 0.0);
gl_Position = vec4(aCoord.xyz, 1.0); gl_Position = vec4(aCoord.xyz, 1.0);
} }
} }
@@ -110,7 +109,7 @@ uniform sampler2D sNormal;
return v; return v;
} }
vec4 step() { vec4 calc() {
vec2 tc = gl_FragCoord.xy * uTexParam.xy; vec2 tc = gl_FragCoord.xy * uTexParam.xy;
if (texture2D(sMask, tc).x == 0.0) if (texture2D(sMask, tc).x == 0.0)
@@ -180,7 +179,7 @@ uniform sampler2D sNormal;
vec4 pass() { vec4 pass() {
if (uType == WATER_DROP) return drop(); if (uType == WATER_DROP) return drop();
if (uType == WATER_STEP) return step(); if (uType == WATER_STEP) return calc();
if (uType == WATER_CAUSTICS) return caustics(); if (uType == WATER_CAUSTICS) return caustics();
if (uType == WATER_MASK) return mask(); if (uType == WATER_MASK) return mask();
if (uType == WATER_COMPOSE) return compose(); if (uType == WATER_COMPOSE) return compose();