[oden] Texture Coordinates are pixels too
This commit is contained in:
parent
17e40c2a36
commit
f232f095f5
3 changed files with 6 additions and 6 deletions
|
|
@ -19,10 +19,8 @@ export function spr(
|
|||
h: number,
|
||||
sx: number,
|
||||
sy: number,
|
||||
sw: number | undefined = undefined,
|
||||
sh: number | undefined = undefined
|
||||
sw: number,
|
||||
sh: number
|
||||
) {
|
||||
sw = sw || 1.0;
|
||||
sh = sh || 1.0;
|
||||
core.spr(x, y, w, h, sx, sy, sw, sh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ export function update() {}
|
|||
|
||||
export function draw() {
|
||||
cls(0.1, 0.2, 0.3);
|
||||
spr(0, 0, 320, 240, 0, 0);
|
||||
spr(0, 0, 320, 240, 0, 0, 256, 256);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,5 +54,7 @@ const RES = vec2f(320.0, 240.0); // The logical resolution of the screen.
|
|||
@group(0) @binding(1) var s_diffuse : sampler;
|
||||
|
||||
@fragment fn fs_main(in : VertexOutput)->@location(0) vec4<f32> {
|
||||
return textureSample(t_diffuse, s_diffuse, in.tex_coords);
|
||||
let dims = vec2f(textureDimensions(t_diffuse));
|
||||
|
||||
return textureSample(t_diffuse, s_diffuse, in.tex_coords / dims);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue