Remove pointless optimization
This commit is contained in:
parent
184d1a1e39
commit
7b483c197c
4 changed files with 8 additions and 74 deletions
|
|
@ -39,7 +39,6 @@ float shadowTransparency(float startingDistance, float lightCenterDistance, vec2
|
|||
uniform vec2 circleLightCenters[CIRCLE_LIGHT_COUNT];
|
||||
uniform float circleLightIntensities[CIRCLE_LIGHT_COUNT];
|
||||
uniform vec3 circleLightColors[CIRCLE_LIGHT_COUNT];
|
||||
varying vec2 circleLightDirections[CIRCLE_LIGHT_COUNT];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -49,7 +48,6 @@ float shadowTransparency(float startingDistance, float lightCenterDistance, vec2
|
|||
uniform float flashlightIntensities[FLASHLIGHT_COUNT];
|
||||
uniform vec3 flashlightColors[FLASHLIGHT_COUNT];
|
||||
uniform vec2 flashlightDirections[FLASHLIGHT_COUNT];
|
||||
varying vec2 flashlightActualDirections[FLASHLIGHT_COUNT];
|
||||
|
||||
float intensityInDirection(vec2 lightDirection, vec2 targetDirection) {
|
||||
return smoothstep(
|
||||
|
|
@ -79,7 +77,7 @@ void main() {
|
|||
lightCenterDistance / circleLightIntensities[i] + 1.0, 2.0
|
||||
);
|
||||
|
||||
vec2 direction = normalize(circleLightDirections[i]) / squareToAspectRatioTimes2;
|
||||
vec2 direction = normalize(circleLightCenters[i] - position) / squareToAspectRatioTimes2;
|
||||
lighting += lightColorAtPosition * shadowTransparency(
|
||||
startingDistance,
|
||||
lightCenterDistance,
|
||||
|
|
@ -94,7 +92,7 @@ void main() {
|
|||
#ifdef FLASHLIGHT_COUNT
|
||||
#if FLASHLIGHT_COUNT > 0
|
||||
for (int i = 0; i < FLASHLIGHT_COUNT; i++) {
|
||||
vec2 originalDirection = normalize(flashlightActualDirections[i]);
|
||||
vec2 originalDirection = normalize(flashlightCenters[i] - position);
|
||||
|
||||
float lightCenterDistance = distance(flashlightCenters[i], position);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ float shadowTransparency(float startingDistance, float lightCenterDistance, vec2
|
|||
uniform float circleLightIntensities[CIRCLE_LIGHT_COUNT];
|
||||
uniform vec3 circleLightColors[CIRCLE_LIGHT_COUNT];
|
||||
|
||||
in vec2 circleLightDirections[CIRCLE_LIGHT_COUNT];
|
||||
|
||||
vec3 colorInPosition(int lightIndex, out float lightCenterDistance) {
|
||||
lightCenterDistance = distance(circleLightCenters[lightIndex], position);
|
||||
return circleLightColors[lightIndex] / pow(
|
||||
|
|
@ -59,8 +57,6 @@ float shadowTransparency(float startingDistance, float lightCenterDistance, vec2
|
|||
uniform vec2 flashlightDirections[FLASHLIGHT_COUNT];
|
||||
uniform float flashlightStartCutoffs[FLASHLIGHT_COUNT];
|
||||
|
||||
in vec2 flashlightActualDirections[FLASHLIGHT_COUNT];
|
||||
|
||||
float intensityInDirection(vec2 lightDirection, vec2 targetDirection) {
|
||||
return smoothstep(
|
||||
0.0,
|
||||
|
|
@ -95,7 +91,7 @@ void main() {
|
|||
float lightCenterDistance;
|
||||
vec3 lightColorAtPosition = colorInPosition(i, lightCenterDistance);
|
||||
|
||||
vec2 direction = normalize(circleLightDirections[i]) / squareToAspectRatioTimes2;
|
||||
vec2 direction = normalize(circleLightCenters[i] - position) / squareToAspectRatioTimes2;
|
||||
lighting += lightColorAtPosition * shadowTransparency(
|
||||
startingDistance,
|
||||
lightCenterDistance,
|
||||
|
|
@ -110,7 +106,7 @@ void main() {
|
|||
#ifdef FLASHLIGHT_COUNT
|
||||
#if FLASHLIGHT_COUNT > 0
|
||||
for (int i = 0; i < FLASHLIGHT_COUNT; i++) {
|
||||
vec2 originalDirection = normalize(flashlightActualDirections[i]);
|
||||
vec2 originalDirection = normalize(flashlightCenters[i] - position);
|
||||
|
||||
float lightCenterDistance;
|
||||
vec3 lightColorAtPosition = colorInPosition(
|
||||
|
|
|
|||
|
|
@ -5,27 +5,13 @@ precision lowp float;
|
|||
{macroDefinitions}
|
||||
|
||||
uniform mat3 modelTransform;
|
||||
uniform vec2 squareToAspectRatio;
|
||||
|
||||
attribute vec4 vertexPosition;
|
||||
|
||||
varying vec2 position;
|
||||
varying vec2 uvCoordinates;
|
||||
|
||||
uniform vec2 squareToAspectRatio;
|
||||
|
||||
#ifdef CIRCLE_LIGHT_COUNT
|
||||
#if CIRCLE_LIGHT_COUNT > 0
|
||||
uniform vec2 circleLightCenters[CIRCLE_LIGHT_COUNT];
|
||||
varying vec2 circleLightDirections[CIRCLE_LIGHT_COUNT];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FLASHLIGHT_COUNT
|
||||
#if FLASHLIGHT_COUNT > 0
|
||||
uniform vec2 flashlightCenters[FLASHLIGHT_COUNT];
|
||||
varying vec2 flashlightActualDirections[FLASHLIGHT_COUNT];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
vec3 vertexPosition2D = vec3(vertexPosition.xy, 1.0) * modelTransform;
|
||||
gl_Position = vec4(vertexPosition2D.xy, 0.0, 1.0);
|
||||
|
|
@ -36,20 +22,4 @@ void main() {
|
|||
0.0, 0.5, 0.5,
|
||||
0.0, 0.0, 1.0
|
||||
)).xy;
|
||||
|
||||
#ifdef CIRCLE_LIGHT_COUNT
|
||||
#if CIRCLE_LIGHT_COUNT > 0
|
||||
for (int i = 0; i < CIRCLE_LIGHT_COUNT; i++) {
|
||||
circleLightDirections[i] = circleLightCenters[i] - position;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FLASHLIGHT_COUNT
|
||||
#if FLASHLIGHT_COUNT > 0
|
||||
for (int i = 0; i < FLASHLIGHT_COUNT; i++) {
|
||||
flashlightActualDirections[i] = flashlightCenters[i] - position;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,27 +5,13 @@ precision lowp float;
|
|||
{macroDefinitions}
|
||||
|
||||
uniform mat3 modelTransform;
|
||||
uniform vec2 squareToAspectRatio;
|
||||
|
||||
in vec4 vertexPosition;
|
||||
|
||||
out vec2 position;
|
||||
out vec2 uvCoordinates;
|
||||
|
||||
uniform vec2 squareToAspectRatio;
|
||||
|
||||
#ifdef CIRCLE_LIGHT_COUNT
|
||||
#if CIRCLE_LIGHT_COUNT > 0
|
||||
uniform vec2 circleLightCenters[CIRCLE_LIGHT_COUNT];
|
||||
out vec2[CIRCLE_LIGHT_COUNT] circleLightDirections;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FLASHLIGHT_COUNT
|
||||
#if FLASHLIGHT_COUNT > 0
|
||||
uniform vec2 flashlightCenters[FLASHLIGHT_COUNT];
|
||||
out vec2[FLASHLIGHT_COUNT] flashlightActualDirections;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
vec3 vertexPosition2D = vec3(vertexPosition.xy, 1.0) * modelTransform;
|
||||
gl_Position = vec4(vertexPosition2D.xy, 0.0, 1.0);
|
||||
|
|
@ -36,20 +22,4 @@ void main() {
|
|||
0.0, 0.5, 0.5,
|
||||
0.0, 0.0, 1.0
|
||||
)).xy;
|
||||
|
||||
#ifdef CIRCLE_LIGHT_COUNT
|
||||
#if CIRCLE_LIGHT_COUNT > 0
|
||||
for (int i = 0; i < CIRCLE_LIGHT_COUNT; i++) {
|
||||
circleLightDirections[i] = circleLightCenters[i] - position;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FLASHLIGHT_COUNT
|
||||
#if FLASHLIGHT_COUNT > 0
|
||||
for (int i = 0; i < FLASHLIGHT_COUNT; i++) {
|
||||
flashlightActualDirections[i] = flashlightCenters[i] - position;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue