Fix rendering issues
This commit is contained in:
parent
56dca9fa60
commit
eb39846b75
7 changed files with 25 additions and 29 deletions
|
|
@ -4,8 +4,6 @@ services:
|
|||
declared-frontend:
|
||||
init: true
|
||||
image: schmelczera/declared-frontend
|
||||
ports:
|
||||
- "80"
|
||||
networks:
|
||||
- network
|
||||
deploy:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "webpack-dev-server --mode development",
|
||||
"start-unsafe": "webpack-dev-server --mode development --useLocalIp",
|
||||
"build": "webpack && find dist -type f -not -name '*.html' | xargs rm"
|
||||
},
|
||||
"keywords": [],
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ export const settings = {
|
|||
shaderMacros: {
|
||||
distanceScale: 64,
|
||||
distanceOffset: 0.15,
|
||||
//edgeSmoothing: 0,
|
||||
edgeSmoothing: 10,
|
||||
},
|
||||
shaderCombinations: {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ void main() {
|
|||
float minDistance = maxMinDistance;
|
||||
|
||||
for (int i = 0; i < LINE_COUNT; i++) {
|
||||
vec2 pa = worldCoordinates - lines[i].from;
|
||||
vec2 ba = lines[i].toFromDelta;
|
||||
float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
|
||||
float lineDistance = distance(pa, ba * h) - mix(lines[i].fromRadius, lines[i].toRadius, h);
|
||||
vec2 targetFromDelta = worldCoordinates - lines[i].from;
|
||||
vec2 toFromDelta = lines[i].toFromDelta;
|
||||
float h = clamp(dot(targetFromDelta, toFromDelta) / dot(toFromDelta, toFromDelta), 0.0, 1.0);
|
||||
float lineDistance = distance(targetFromDelta, toFromDelta * h) - mix(lines[i].fromRadius, lines[i].toRadius, h);
|
||||
|
||||
minDistance = min(minDistance, lineDistance);
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ void main() {
|
|||
|
||||
fragmentColor = vec4(
|
||||
mix(CAVE_COLOR, AIR_COLOR, clamp(realDistance, 0.0, 1.0)),
|
||||
(realDistance + DISTANCE_OFFSET) / DISTANCE_SCALE - 1.0/255.0
|
||||
(realDistance + DISTANCE_OFFSET) / DISTANCE_SCALE
|
||||
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ precision mediump float;
|
|||
|
||||
#define INFINITY 1000.0
|
||||
#define LIGHT_DROP 500.0
|
||||
#define MIN_STEP 1.0
|
||||
#define AMBIENT_LIGHT vec3(0.15)
|
||||
|
||||
#define CIRCLE_LIGHT_COUNT {circleLightCount}
|
||||
|
|
@ -59,9 +58,6 @@ void main() {
|
|||
for (int i = 0; i < CIRCLE_LIGHT_COUNT; i++) {
|
||||
float lightCenterDistance = distance(circleLights[i].center, worldCoordinates);
|
||||
|
||||
/*if (lightCenterDistance < circleLights[i].radius) {
|
||||
lighting = vec3(1.0, 1.0, 0.0);
|
||||
}*/
|
||||
|
||||
vec3 lightColorAtPosition = circleLights[i].value / pow(
|
||||
lightCenterDistance / LIGHT_DROP + 1.0, 2.0
|
||||
|
|
@ -73,19 +69,22 @@ void main() {
|
|||
vec2 direction = normalize(circleLightDirections[i]) / viewBoxSize;
|
||||
|
||||
for (int j = 0; j < 48; j++) {
|
||||
if (rayLength > lightCenterDistance) {
|
||||
if (rayLength > lightCenterDistance - circleLights[i].radius) {
|
||||
rayLength = lightCenterDistance - circleLights[i].radius;
|
||||
float minDistance = getDistance(uvCoordinates + direction * rayLength);
|
||||
exponentialDecayDistance = (exponentialDecayDistance + minDistance) / 2.0;
|
||||
q = min(q, exponentialDecayDistance / rayLength);
|
||||
|
||||
lighting += lightColorAtPosition * clamp(
|
||||
q / circleLights[i].radius * (lightCenterDistance + 1.0), 0.0, 1.0
|
||||
) * step(circleLights[i].radius, getDistance(
|
||||
uvCoordinates + direction * lightCenterDistance
|
||||
));
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
float minDistance = getDistance(uvCoordinates + direction * rayLength);
|
||||
exponentialDecayDistance = (exponentialDecayDistance + minDistance) / 2.0;
|
||||
q = min(q, exponentialDecayDistance / rayLength);
|
||||
rayLength += max(MIN_STEP, minDistance);
|
||||
rayLength += minDistance;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -115,7 +114,7 @@ void main() {
|
|||
float minDistance = getDistance(uvCoordinates + direction * rayLength);
|
||||
exponentialDecayDistance = (exponentialDecayDistance + minDistance) / 2.0;
|
||||
q = min(q, exponentialDecayDistance);
|
||||
rayLength += max(MIN_STEP, minDistance);
|
||||
rayLength += minDistance;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,15 +43,15 @@ export class Character extends GameObject {
|
|||
const nextPrimitive = this.primitive.clone();
|
||||
nextPrimitive.center = value;
|
||||
|
||||
if (
|
||||
this.physics
|
||||
const intersects = this.physics
|
||||
.findIntersecting(nextPrimitive.boundingBox)
|
||||
.filter((b) => b.value)
|
||||
.map(
|
||||
(b) => b.value.distance(nextPrimitive.center) + nextPrimitive.radius
|
||||
)
|
||||
.find((d) => d < 0) !== undefined
|
||||
) {
|
||||
);
|
||||
|
||||
console.log(intersects);
|
||||
if (intersects.find((d) => d < 0) !== undefined) {
|
||||
this.setPosition(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue