889 wip.b

This commit is contained in:
Michael Gevlich 2025-10-22 16:08:04 +04:00
parent b7be4275b2
commit ede48db407
6 changed files with 7 additions and 12 deletions

BIN
sandbox/ray/green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

View File

@ -30,7 +30,7 @@ class MyScene extends RenderNode {
endPosition: [1, 10, 1],
startColor: "white",
endColor: "white",
src: "./template.png",
src: "./template3.png",
//src: "data:image/png;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

After

Width:  |  Height:  |  Size: 107 B

BIN
sandbox/ray/template3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View File

@ -7,17 +7,18 @@ varying vec4 v_texCoord;
void main() {
float repeat = 5.0;
float repeat = 10.0;
float offset = 0.0;
vec2 uv = v_texCoord.xy;
float min = v_texCoord.z;
float height = v_texCoord.w;
float localY = fract((uv.y - min) / height * repeat);
uv.y = min + localY * height;
float EPS = 0.5 / 1024.0; //Atlas height
float localY = fract((uv.y + offset - min) / height * repeat);
uv.y = clamp(min + localY * height, min + EPS, min + height - EPS);
vec4 color = texture2D(texAtlas, uv);
gl_FragColor = v_rgba * color;
}

View File

@ -303,17 +303,11 @@ class TextureAtlasNode {
const dh = rc.getHeight() - h;
if (dw > dh) {
// this.childNodes[0].rect = new Rectangle(rc.left, rc.top, rc.left + w, rc.bottom);
// this.childNodes[1].rect = new Rectangle(rc.left + w, rc.top, rc.right, rc.bottom);
this.childNodes[0].rect.set(rc.left, rc.top, rc.left + w, rc.bottom);
this.childNodes[1].rect.set(rc.left + w, rc.top, rc.right, rc.bottom);
} else {
// this.childNodes[0].rect = new Rectangle(rc.left, rc.top, rc.right, rc.top + h);
// this.childNodes[1].rect = new Rectangle(rc.left, rc.top + h, rc.right, rc.bottom);
this.childNodes[0].rect.set(rc.left, rc.top, rc.right, rc.top + h);
this.childNodes[1].rect.set(rc.left, rc.top + h, rc.right, rc.bottom);
}
return this.childNodes[0].insert(img);