This commit is contained in:
sam 2024-08-19 16:20:49 +12:00
parent f32afaa7ec
commit 1db8d530c5
2 changed files with 7 additions and 4 deletions

View file

@ -1,3 +1,4 @@
@ctype vec2 HMM_Vec2
@ctype mat4 HMM_Mat4
@vs vs
in vec4 pos;
@ -6,6 +7,7 @@ in vec2 texcoord0;
uniform vs_params {
mat4 mvp;
vec2 texture_scale;
};
out vec4 color;
@ -14,7 +16,7 @@ out vec2 uv;
void main() {
gl_Position = mvp * pos;
color = color0;
uv = texcoord0;
uv = texcoord0 * texture_scale;
}
@end

View file

@ -60,11 +60,11 @@ static void init(void) {
.height = 2,
.data.subimage[0][0] = SG_RANGE(pixels),
.label = "triangle-texture",
.pixel_format = SG_PIXELFORMAT_BGRA8,
.pixel_format = SG_PIXELFORMAT_RGBA8,
});
bind->fs.samplers[SLOT_smp] = sg_make_sampler(&(sg_sampler_desc){
.label = "triangle-sampler"
.label = "triangle-sampler",
});
sg_shader shd = sg_make_shader(transform_shader_desc(sg_query_backend()));
@ -110,7 +110,8 @@ void frame(void) {
HMM_Mat4 mvp = HMM_MulM4(view_proj, model);
vs_params_t params = {
.mvp = mvp
.mvp = mvp,
.texture_scale = HMM_V2(1.0f, 1.0f),
};
sg_apply_bindings(state.bindings.data[i]);