down
This commit is contained in:
parent
5d7b7880ef
commit
33a56e4dc5
|
@ -176,7 +176,8 @@ void tex_draw(struct Texture *tex, HMM_Vec2 pos, float angle, HMM_Vec2 size, HMM
|
|||
|
||||
HMM_Vec2 t_scale = {
|
||||
tex->width * st_s_w(r) * size.X,
|
||||
tex->height * st_s_h(r) * size.Y};
|
||||
tex->height * st_s_h(r) * size.Y
|
||||
};
|
||||
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -184,7 +185,7 @@ void tex_draw(struct Texture *tex, HMM_Vec2 pos, float angle, HMM_Vec2 size, HMM
|
|||
sposes[i] = HMM_MulV2(sposes[i], t_scale);
|
||||
sposes[i] = HMM_MulM2V2(rot, sposes[i]);
|
||||
sposes[i] = HMM_AddV2(sposes[i], pos);
|
||||
verts[i].pos = sposes[0];
|
||||
verts[i].pos = sposes[i];
|
||||
verts[i].color = color;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,14 +154,17 @@ var GUI = {
|
|||
|
||||
image(path,pos) {
|
||||
let wh = cmd(64,path);
|
||||
gui_img(path,screen2world(pos));
|
||||
return cwh2bb([0,0], cmd(64,path));
|
||||
gui_img(path,pos.slice().sub(wh), 1.0, 0.0);
|
||||
return cwh2bb([0,0], wh);
|
||||
},
|
||||
|
||||
column(items,pos) {
|
||||
column(items,pos, defn) {
|
||||
defn ??= {};
|
||||
defn.padding ??= 5;
|
||||
items.forEach(function(item) {
|
||||
let bb = item(pos);
|
||||
pos.y += bb.b;
|
||||
pos.y -= defn.padding*2;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#version 330 core
|
||||
in vec2 texcoords;
|
||||
in vec4 fcolor;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
uniform sampler2D image;
|
||||
uniform vec3 spriteColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
color = vec4(spriteColor, 1.f) * texture(image, texcoords);
|
||||
color = fcolor * texture(image, texcoords);
|
||||
|
||||
if (color.a <= 0.1f)
|
||||
discard;
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
layout (location = 0) in vec2 vertex;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec4 vColor;
|
||||
|
||||
out vec2 texcoords;
|
||||
out vec4 fcolor;
|
||||
|
||||
uniform mat4 proj;
|
||||
uniform mat4 mpv;
|
||||
|
||||
void main()
|
||||
{
|
||||
texcoords = uv;
|
||||
gl_Position = mpv * proj * vec4(vertex, 0.0, 1.0);
|
||||
fcolor = vColor;
|
||||
texcoords = uv;
|
||||
gl_Position = proj * vec4(vertex, 0.0, 1.0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue