diff --git a/apps/demos/scenery/scenes/ingame.c b/apps/demos/scenery/scenes/ingame.c index 6be5306..25af050 100644 --- a/apps/demos/scenery/scenes/ingame.c +++ b/apps/demos/scenery/scenes/ingame.c @@ -15,7 +15,7 @@ #define TERRAIN_FREQUENCY 0.1f #define TERRAIN_DISTANCE 32 #define HALF_TERRAIN_DISTANCE ((float)TERRAIN_DISTANCE / 2) -#define PLAYER_HEIGHT 0.7f +#define PLAYER_HEIGHT 0.6f static float heightmap[TERRAIN_DISTANCE][TERRAIN_DISTANCE]; diff --git a/src/rendering/twn_billboards.c b/src/rendering/twn_billboards.c index 3d172cf..783d367 100644 --- a/src/rendering/twn_billboards.c +++ b/src/rendering/twn_billboards.c @@ -80,10 +80,10 @@ void finally_draw_billboard_batch(struct MeshBatch const *batch, const float xr = srcrect.x / dims.w; const float yr = srcrect.y / dims.h; - const Vec2 uv0 = { xr + 1 * wr, yr + 0 * hr }; - const Vec2 uv1 = { xr + 1 * wr, yr + 1 * hr }; - const Vec2 uv2 = { xr + 0 * wr, yr + 1 * hr }; - const Vec2 uv3 = { xr + 0 * wr, yr + 0 * hr }; + const Vec2 uv0 = { xr + wr, yr }; + const Vec2 uv1 = { xr + wr, yr + hr }; + const Vec2 uv2 = { xr, yr + hr }; + const Vec2 uv3 = { xr, yr }; /* emit vertex data */ VertexBuffer const buffer = get_scratch_vertex_array(); @@ -95,11 +95,11 @@ void finally_draw_billboard_batch(struct MeshBatch const *batch, /* a = (right + up) * size, b = (right - up) * size*/ Vec3 a, b; if (billboard.cylindrical) { - a = vec3_mul(right_plus_up_cylindrical, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x})); - b = vec3_mul(right_minus_up_cylindrical, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x})); + a = vec3_mul(right_plus_up_cylindrical, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x })); + b = vec3_mul(right_minus_up_cylindrical, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x })); } else { - a = vec3_mul(right_plus_up, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x})); - b = vec3_mul(right_minus_up, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x})); + a = vec3_mul(right_plus_up, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x })); + b = vec3_mul(right_minus_up, ((Vec3){billboard.size.x, billboard.size.y, billboard.size.x })); } struct ElementIndexedBillboard const payload = { diff --git a/src/twn_camera.c b/src/twn_camera.c index 620d77b..8d7c3b5 100644 --- a/src/twn_camera.c +++ b/src/twn_camera.c @@ -39,7 +39,7 @@ Matrix4 camera_perspective(const Camera *const camera) { /* from cglm */ Matrix4 result = {0}; - const float aspect = (float)(ctx.base_render_width / ctx.base_render_height); + const float aspect = ((float)ctx.base_render_width / (float)ctx.base_render_height); const float f = 1.0f / tanf(camera->fov * 0.5f); const float fn = 1.0f / (CAMERA_NEAR_Z - CAMERA_FAR_Z);