3d texture from image

This commit is contained in:
Gyuri Horák 2023-03-31 18:42:12 +02:00
parent 73e88916e9
commit 96f41ea6b3
Signed by: dyuri
GPG Key ID: 4993F07B3EAE8D38
4 changed files with 8 additions and 4 deletions

View File

@ -1,2 +1,6 @@
- fix mouse, add button, drag - fix mouse, add button, drag
- 3d texture
- format
- inner format
- data from external script

View File

@ -25,7 +25,7 @@
<body> <body>
<repa-shader id="demoshader" fs-input="fsinput" alpha mouse width=512 height=512> <repa-shader id="demoshader" fs-input="fsinput" alpha mouse width=512 height=512>
<repa-texture src="avatar.png" name="tex_avatar" wrap="mirrored_repeat"></repa-texture> <repa-texture src="avatar.png" name="tex_avatar" wrap="mirrored_repeat"></repa-texture>
<repa-texture t3d name="test3d" filter="nearest"></repa-texture> <repa-texture t3d src="3dt.png" name="test3d" filter="linear" width=32 height=32 depth=32></repa-texture>
void main() { void main() {
vec2 uv = gl_FragCoord.xy / resolution.xy; vec2 uv = gl_FragCoord.xy / resolution.xy;
vec3 col = texture(tex_avatar, uv).rgb; vec3 col = texture(tex_avatar, uv).rgb;

BIN
demo/3dt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -352,15 +352,15 @@ class RepaTexture extends HTMLElement {
} }
get width() { get width() {
return this._width || this.ref?.videoWidth || this.ref?.width || 0; return +(this._width || this.getAttribute("width") || this.ref?.videoWidth || this.ref?.width || 0);
} }
get height() { get height() {
return this._height || this.ref?.videoHeight || this.ref?.height || 0; return +(this._height || this.getAttribute("height") || this.ref?.videoHeight || this.ref?.height || 0);
} }
get depth() { get depth() {
return this._depth || this.ref?.depth || 0; return +(this._depth || this.getAttribute("depth") || this.ref?.depth || 0);
} }
get magFilter() { get magFilter() {