world units in meters
This commit is contained in:
parent
eb38e3d926
commit
b50aa36e4e
@ -527,8 +527,8 @@ JobDef(S_SimWorker, _, __)
|
||||
{
|
||||
f32 follow_speed = 20 * sim_dt;
|
||||
Vec2 look_ratio = ZI;
|
||||
look_ratio.x = 0.25;
|
||||
look_ratio.y = (16.0 / 9.0) * look_ratio.x;
|
||||
look_ratio.y = 0.25;
|
||||
look_ratio.x = look_ratio.y / (16.0 / 9.0);
|
||||
|
||||
Vec2 target = MulXformV2(follow->world_xf, follow->local_shape.centroid);
|
||||
target = AddVec2(target, MulVec2Vec2(follow->look, look_ratio));
|
||||
|
||||
@ -145,22 +145,23 @@ JobDef(V_VisWorker, _, __)
|
||||
ent->tint = Color_Red;
|
||||
ent->key = player_key;
|
||||
ent->camera = camera_key;
|
||||
ent->move_speed = 10;
|
||||
ent->move_speed = 0.1;
|
||||
{
|
||||
ent->local_shape = S_ShapeFromDesc(
|
||||
.mass = 10,
|
||||
.count = 1,
|
||||
.radius = 50,
|
||||
.radius = 0.4,
|
||||
);
|
||||
}
|
||||
ent->local_xf = XformFromPos(VEC2(200, 200));
|
||||
// ent->local_xf = XformFromPos(VEC2(200, 200));
|
||||
ent->local_xf = XformFromPos(VEC2(0, 0));
|
||||
} break;
|
||||
|
||||
/* Test child */
|
||||
case 1:
|
||||
{
|
||||
f32 width = 15;
|
||||
f32 height = 100;
|
||||
f32 width = 0.1;
|
||||
f32 height = 1;
|
||||
|
||||
ent->tint = Color_Cyan;
|
||||
ent->key = child_key;
|
||||
@ -170,7 +171,7 @@ JobDef(V_VisWorker, _, __)
|
||||
.count = 4,
|
||||
.points = {
|
||||
VEC2(-width / 2, -height), VEC2(width / 2, -height),
|
||||
VEC2(width / 2, 0), VEC2(-5, 0),
|
||||
VEC2(width / 2, 0), VEC2(-width / 2, 0),
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -227,6 +228,8 @@ JobDef(V_VisWorker, _, __)
|
||||
UI_Report vis_rep = UI_ReportFromKey(vis_box);
|
||||
draw_size = Vec2I32FromFields(SubVec2(vis_rep.screen_p1, vis_rep.screen_p0));
|
||||
}
|
||||
draw_size.x = MaxI32(draw_size.x, 1);
|
||||
draw_size.y = MaxI32(draw_size.y, 1);
|
||||
|
||||
//////////////////////////////
|
||||
//- Pop sim output
|
||||
@ -253,6 +256,8 @@ JobDef(V_VisWorker, _, __)
|
||||
//////////////////////////////
|
||||
//- Initialize camera
|
||||
|
||||
f32 meters_per_draw_width = 20;
|
||||
|
||||
Vec2 camera_pos = ZI;
|
||||
f32 camera_zoom = 1;
|
||||
{
|
||||
@ -268,15 +273,22 @@ JobDef(V_VisWorker, _, __)
|
||||
Xform world_to_draw_xf = XformIdentity;
|
||||
Xform draw_to_world_xf = XformIdentity;
|
||||
{
|
||||
world_to_draw_xf.og = AddVec2(NegVec2(camera_pos), MulVec2(Vec2FromFields(draw_size), 0.5));
|
||||
Vec2 scale = ZI;
|
||||
scale.x = (f32)draw_size.x / meters_per_draw_width;
|
||||
scale.y = scale.x;
|
||||
world_to_draw_xf = XformFromScale(scale);
|
||||
world_to_draw_xf = TranslateXform(world_to_draw_xf, NegVec2(camera_pos));
|
||||
world_to_draw_xf = WorldTranslateXform(world_to_draw_xf, MulVec2(Vec2FromFields(draw_size), 0.5));
|
||||
draw_to_world_xf = InvertXform(world_to_draw_xf);
|
||||
}
|
||||
|
||||
/* Draw <-> ui */
|
||||
Xform draw_to_ui_xf = XformIdentity;
|
||||
Xform ui_to_draw_xf = XformIdentity;
|
||||
{
|
||||
ui_to_draw_xf = InvertXform(draw_to_ui_xf);
|
||||
}
|
||||
|
||||
/* World <-> ui */
|
||||
Xform world_to_ui_xf = XformIdentity;
|
||||
Xform ui_to_world_xf = XformIdentity;
|
||||
|
||||
@ -445,6 +445,8 @@ WND_Frame WND_BeginFrame(void)
|
||||
monitor_rect = monitor_info.rcMonitor;
|
||||
}
|
||||
result.monitor_size = VEC2I32(monitor_rect.right - monitor_rect.left, monitor_rect.bottom - monitor_rect.top);
|
||||
result.monitor_size.x = MaxI32(result.monitor_size.x ,1);
|
||||
result.monitor_size.y = MaxI32(result.monitor_size.y ,1);
|
||||
|
||||
/* Client rect */
|
||||
RECT client_rect = ZI;
|
||||
@ -455,6 +457,8 @@ WND_Frame WND_BeginFrame(void)
|
||||
ClientToScreen(hwnd, (LPPOINT)&screen_rect.left);
|
||||
ClientToScreen(hwnd, (LPPOINT)&screen_rect.right);
|
||||
result.draw_size = VEC2I32(screen_rect.right - screen_rect.left, screen_rect.bottom - screen_rect.top);
|
||||
result.draw_size.x = MaxI32(result.draw_size.x ,1);
|
||||
result.draw_size.y = MaxI32(result.draw_size.y ,1);
|
||||
|
||||
/* Minimized / maximized / fullscreen */
|
||||
DWORD style = (DWORD)GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user