twn_rendering: have triangle uvs represented by floating vectors
This commit is contained in:
parent
ba70a566e1
commit
0dc3cf4160
@ -70,17 +70,17 @@ static void ingame_tick(State *state) {
|
|||||||
(Vec3){ (float)x, d0, (float)y },
|
(Vec3){ (float)x, d0, (float)y },
|
||||||
(Vec3){ (float)x + 1, d1, (float)y },
|
(Vec3){ (float)x + 1, d1, (float)y },
|
||||||
(Vec3){ (float)x, d3, (float)y - 1 },
|
(Vec3){ (float)x, d3, (float)y - 1 },
|
||||||
(Vec2sh){ 128, 128 },
|
(Vec2){ 128, 128 },
|
||||||
(Vec2sh){ 128, 0 },
|
(Vec2){ 128, 0 },
|
||||||
(Vec2sh){ 0, 128 });
|
(Vec2){ 0, 128 });
|
||||||
|
|
||||||
unfurl_triangle("/assets/grass.png",
|
unfurl_triangle("/assets/grass.png",
|
||||||
(Vec3){ (float)x + 1, d1, (float)y },
|
(Vec3){ (float)x + 1, d1, (float)y },
|
||||||
(Vec3){ (float)x + 1, d2, (float)y - 1 },
|
(Vec3){ (float)x + 1, d2, (float)y - 1 },
|
||||||
(Vec3){ (float)x, d3, (float)y - 1 },
|
(Vec3){ (float)x, d3, (float)y - 1 },
|
||||||
(Vec2sh){ 128, 0 },
|
(Vec2){ 128, 0 },
|
||||||
(Vec2sh){ 0, 0 },
|
(Vec2){ 0, 0 },
|
||||||
(Vec2sh){ 0, 128 });
|
(Vec2){ 0, 128 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ typedef struct PushSpriteArgs {
|
|||||||
Rect rect;
|
Rect rect;
|
||||||
|
|
||||||
m_option_list(
|
m_option_list(
|
||||||
Rect, texture_region,
|
Rect, texture_region,
|
||||||
Color, color,
|
Color, color,
|
||||||
float, rotation,
|
float, rotation,
|
||||||
bool, flip_x,
|
bool, flip_x,
|
||||||
bool, flip_y,
|
bool, flip_y,
|
||||||
@ -45,9 +45,9 @@ TWN_API void unfurl_triangle(const char *path,
|
|||||||
Vec3 v0,
|
Vec3 v0,
|
||||||
Vec3 v1,
|
Vec3 v1,
|
||||||
Vec3 v2,
|
Vec3 v2,
|
||||||
Vec2sh uv0,
|
Vec2 uv0,
|
||||||
Vec2sh uv1,
|
Vec2 uv1,
|
||||||
Vec2sh uv2);
|
Vec2 uv2);
|
||||||
|
|
||||||
// TODO: decide whether it's needed to begin with?
|
// TODO: decide whether it's needed to begin with?
|
||||||
// intended usage for it is baked lighting, i would think.
|
// intended usage for it is baked lighting, i would think.
|
||||||
|
@ -12,9 +12,9 @@ void unfurl_triangle(const char *path,
|
|||||||
Vec3 v0,
|
Vec3 v0,
|
||||||
Vec3 v1,
|
Vec3 v1,
|
||||||
Vec3 v2,
|
Vec3 v2,
|
||||||
Vec2sh uv0,
|
Vec2 uv0,
|
||||||
Vec2sh uv1,
|
Vec2 uv1,
|
||||||
Vec2sh uv2)
|
Vec2 uv2)
|
||||||
{
|
{
|
||||||
const TextureKey texture_key = textures_get_key(&ctx.texture_cache, path);
|
const TextureKey texture_key = textures_get_key(&ctx.texture_cache, path);
|
||||||
|
|
||||||
@ -29,9 +29,9 @@ void unfurl_triangle(const char *path,
|
|||||||
.v0 = v0,
|
.v0 = v0,
|
||||||
.v1 = v1,
|
.v1 = v1,
|
||||||
.v2 = v2,
|
.v2 = v2,
|
||||||
.uv1 = m_vec2_from(uv1),
|
.uv1 = uv1,
|
||||||
.uv0 = m_vec2_from(uv0),
|
.uv0 = uv0,
|
||||||
.uv2 = m_vec2_from(uv2),
|
.uv2 = uv2,
|
||||||
}};
|
}};
|
||||||
|
|
||||||
union UncoloredSpaceTriangle *triangles = (union UncoloredSpaceTriangle *)batch_p->value.primitives;
|
union UncoloredSpaceTriangle *triangles = (union UncoloredSpaceTriangle *)batch_p->value.primitives;
|
||||||
|
Loading…
Reference in New Issue
Block a user