fix textures being drawn upside down on macos
This commit is contained in:
parent
543b088341
commit
e58a4fd20c
@ -54,3 +54,18 @@ get_render_size :: () -> (s32, s32) {
|
||||
// wl, hl := get_low_res(w,h, 360);
|
||||
return w, h;
|
||||
}
|
||||
|
||||
flip_y_if_plat :: inline (v: Vector2) -> Vector2 {
|
||||
return .{v.x, flip_if_plat(v.y)};
|
||||
}
|
||||
|
||||
// Some platforms draw UVs in weird reverse way
|
||||
// so this function here does the flip on those platforms
|
||||
// so we don't need to do the platform check in many places.
|
||||
flip_if_plat :: inline (n: float) -> float {
|
||||
#if OS == .MACOS {
|
||||
return 1 - n;
|
||||
} else {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,10 +544,10 @@ create_postprocess_pipeline :: () {
|
||||
gPipelines.postprocess.pipeline = sg_make_pipeline(*pipeline);
|
||||
|
||||
quad_vertices : [16]float = .[
|
||||
-1.0, 1.0, 0.0, 1.0, // top-let
|
||||
-1.0, -1.0, 0.0, 0.0, // bottom-let
|
||||
1.0, -1.0, 1.0, 0.0, // bottom-right
|
||||
1.0, 1.0, 1.0, 1.0, // top-right
|
||||
-1.0, 1.0, 0.0, flip_if_plat(1.0), // top-let
|
||||
-1.0, -1.0, 0.0, flip_if_plat(0.0), // bottom-let
|
||||
1.0, -1.0, 1.0, flip_if_plat(0.0), // bottom-right
|
||||
1.0, 1.0, 1.0, flip_if_plat(1.0), // top-right
|
||||
];
|
||||
quad_indices : [6]u16 = .[
|
||||
0, 1, 2, 0, 2, 3
|
||||
|
||||
@ -253,9 +253,9 @@ immediate_triangle :: (p0: Vector3, p1: Vector3, p2: Vector3, c0 := Vector4.{1,1
|
||||
tri.uv[1] = nullUV;
|
||||
tri.uv[2] = nullUV;
|
||||
} else {
|
||||
tri.uv[0] = uv0;
|
||||
tri.uv[1] = uv1;
|
||||
tri.uv[2] = uv2;
|
||||
tri.uv[0] = flip_y_if_plat(uv0);
|
||||
tri.uv[1] = flip_y_if_plat(uv1);
|
||||
tri.uv[2] = flip_y_if_plat(uv2);
|
||||
}
|
||||
|
||||
arb_tri_add(tri);
|
||||
|
||||
@ -8,7 +8,7 @@ current_world : struct {
|
||||
valid : bool = false;
|
||||
};
|
||||
|
||||
world_table :: Table(string, World);
|
||||
world_table : Table(string, World);
|
||||
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ lworlds :: () {
|
||||
s := load_string_from_pack("./game/resources/worlds.json");
|
||||
success, worlds := Jaison.json_parse_string(s, [..]World,, temp);
|
||||
for worlds {
|
||||
set_trile(sprint("%",it.name), trile_from_serialize_form(it));
|
||||
print("Loaded %\n", it.name);
|
||||
// set_trile(sprint("%",it.name), trile_from_serialize_form(it));
|
||||
// print("Loaded %\n", it.name);
|
||||
}
|
||||
} @Command
|
||||
|
||||
@ -81,9 +81,9 @@ TrilePositions :: struct {
|
||||
}
|
||||
|
||||
Ground_Tile :: enum {
|
||||
WATER = 0;
|
||||
GRASS = 1;
|
||||
SAND = 2;
|
||||
WATER;
|
||||
GRASS;
|
||||
SAND;
|
||||
}
|
||||
|
||||
World :: struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user