diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index b6c07f63..5460bed2 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -490,7 +490,6 @@ void V_TickForever(WaveLaneCtx *lane) ////////////////////////////// //- Init shortcuts - // Init shortcuts u64 shortcut_bins_count = 1024; V_ShortcutBin *shortcut_bins = PushStructs(perm, V_ShortcutBin, shortcut_bins_count); { @@ -839,11 +838,8 @@ void V_TickForever(WaveLaneCtx *lane) f32 look_radius = 5; - if (!frame->is_editing && !frame->palette.is_showing) - { - WND_PushCmd(window_frame, .kind = WND_CmdKind_SetLockedCursor, .v = 1); - WND_SetCursor(window_frame, WND_CursorKind_Hidden); - } + frame->is_looking = !frame->is_editing && !frame->palette.is_showing && !frame->held_buttons[Button_Alt]; + frame->is_moving = !frame->is_editing; { Vec2 move = Zi; @@ -865,26 +861,26 @@ void V_TickForever(WaveLaneCtx *lane) look = AddVec2(look, MulVec2(mouse_delta, mouse_sensitivity * mouse_scale_factor)); look = ClampVec2Len(look, look_radius); } - if (frame->is_editing) + + if (frame->is_looking) + { + frame->look = look; + frame->fire_held = fire_held; + frame->fire_presses = fire_presses; + } + + if (frame->is_moving) + { + frame->move = move; + } + + if (!frame->is_looking) { if (!frame->is_panning) { f32 edit_move_speed = 20.0 * MaxF32(frame->edit_camera_zoom, min_zoom); frame->edit_camera_pos = AddVec2(frame->edit_camera_pos, MulVec2(move, edit_move_speed * frame->dt)); } - - // FIXME: Remove this - frame->move = prev_frame->move; - frame->look = prev_frame->look; - frame->fire_held = prev_frame->fire_held; - frame->fire_presses = prev_frame->fire_presses; - } - else - { - frame->move = move; - frame->look = look; - frame->fire_held = fire_held; - frame->fire_presses = fire_presses; } frame->look = frame->look; } @@ -1101,87 +1097,6 @@ void V_TickForever(WaveLaneCtx *lane) frame->af.tile_to_world = InvertAffine(frame->af.world_to_tile); } - ////////////////////////////// - //- Update cursors / selection - - frame->screen_cursor = ui_frame->cursor_pos; - frame->shade_cursor = MulAffineVec2(frame->af.screen_to_shade, frame->screen_cursor); - frame->world_cursor = MulAffineVec2(frame->af.screen_to_world, frame->screen_cursor); - - b32 show_editor_ui = TweakBool("Show editor UI", 0); - - frame->world_selection_start = frame->world_cursor; - if (frame->is_editing) - { - b32 m1_held = frame->held_buttons[Button_M1]; - b32 m2_held = frame->held_buttons[Button_M2]; - if (show_editor_ui) - { - frame->selection_mode = V_SelectionMode_Tile; - } - if (m1_held) - { - frame->is_selecting = 1; - // frame->equipped_tile = P_TileKind_Floor; - } - - if (frame->is_selecting && prev_frame->is_selecting) - { - frame->world_selection_start = prev_frame->world_selection_start; - } - } - - frame->world_selection.p0.x = MinF32(frame->world_cursor.x, frame->world_selection_start.x); - frame->world_selection.p0.y = MinF32(frame->world_cursor.y, frame->world_selection_start.y); - frame->world_selection.p1.x = MaxF32(frame->world_cursor.x, frame->world_selection_start.x); - frame->world_selection.p1.y = MaxF32(frame->world_cursor.y, frame->world_selection_start.y); - - frame->screen_selection.p0 = MulAffineVec2(frame->af.world_to_screen, frame->world_selection.p0); - frame->screen_selection.p1 = MulAffineVec2(frame->af.world_to_screen, frame->world_selection.p1); - - frame->shade_selection.p0 = MulAffineVec2(frame->af.world_to_shade, frame->world_selection.p0); - frame->shade_selection.p1 = MulAffineVec2(frame->af.world_to_shade, frame->world_selection.p1); - - ////////////////////////////// - //- Place tiles - - // TODO: Push vis cmd instead - - if (frame->is_editing && prev_frame->is_selecting && !frame->is_selecting) - { - if (prev_frame->selection_mode == V_SelectionMode_Tile) - { - // TODO: Fix clamp when both start & end are outside of world - Rng2I32 tile_range = Zi; - tile_range.p0 = Vec2I32FromVec(FloorVec2(MulAffineVec2(frame->af.world_to_tile, prev_frame->world_selection.p0))); - tile_range.p1 = Vec2I32FromVec(CeilVec2(MulAffineVec2(frame->af.world_to_tile, prev_frame->world_selection.p1))); - - P_Msg *msg = P_PushMsg(P_MsgKind_TileEdit, Zstr); - msg->tile_kind = prev_frame->equipped_tile; - msg->tile_range = tile_range; - } - } - - ////////////////////////////// - //- Query entities - - P_Ent *local_player = P_EntFromKey(local_world->last_frame, V.player_key); - P_Ent *local_guy = P_EntFromKey(local_world->last_frame, local_player->guy); - P_Ent *hovered_ent = &P_NilEnt; - { - // TODO: Real world query - P_Shape cursor_shape = P_ShapeFromDesc(.count = 1, .points = { frame->world_cursor }); - for (P_Ent *ent = P_FirstEnt(local_world->last_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent)) - { - P_Shape ent_shape = P_WorldShapeFromEnt(ent); - b32 is_hovered = P_CollisionResultFromShapes(ent_shape, cursor_shape).collision_points_count > 0; - if (is_hovered) - { - hovered_ent = ent; - } - } - } - ////////////////////////////// //- Try to connect to server @@ -1910,7 +1825,7 @@ void V_TickForever(WaveLaneCtx *lane) P_ClearFrames(local_world, I64Min, I64Max); local_frame = P_PushFrame(local_world, predict_world->last_frame, predict_world->last_frame->tick); - P_DebugDrawFrame(local_frame); + P_DebugDrawFrame(local_frame); } @@ -1937,164 +1852,17 @@ void V_TickForever(WaveLaneCtx *lane) - ////////////////////////////// - //- Draw guy sprites - for (P_Ent *ent = P_FirstEnt(local_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent)) - { - if (ent->is_guy) - { - P_Anim anim = P_AnimFromEnt(ent, local_frame->time_ns); - SPR_Sprite body = SPR_SpriteFromSheet(anim.sheet, anim.span, anim.frame_seq); - SPR_Sprite wep = SPR_SpriteFromSheet(anim.wep_sheet, anim.span, anim.frame_seq); - //- Compute sprite transforms - Affine body_pix_to_world_af = AffineIdentity; - Affine wep_pix_to_world_af = AffineIdentity; - { - Vec2 pix_scale = VEC2(1.0 / P_CellsPerMeter, 1.0 / P_CellsPerMeter); - Affine ent_to_world_af = MulAffineXform(AffineIdentity, ent->xf); - - //- Compute body transform - { - body_pix_to_world_af = MulAffine(body_pix_to_world_af, ent_to_world_af); - body_pix_to_world_af = ScaleAffine(body_pix_to_world_af, pix_scale); - - SPR_Ray anchor_ray = body.rays[SPR_RayKind_Anchor]; - body_pix_to_world_af = RotateAffine(body_pix_to_world_af, InvertRot(anchor_ray.dir)); - body_pix_to_world_af = TranslateAffine(body_pix_to_world_af, NegVec2(anchor_ray.pos)); - } - - //- Compute weapon transform - { - wep_pix_to_world_af = MulAffine(wep_pix_to_world_af, ent_to_world_af); - wep_pix_to_world_af = ScaleAffine(wep_pix_to_world_af, pix_scale); - - SPR_Ray body_anchor_ray = body.rays[SPR_RayKind_Anchor]; - SPR_Ray body_ap_ray = body.rays[SPR_RayKind_Ap]; - wep_pix_to_world_af = RotateAffine(wep_pix_to_world_af, InvertRot(body_anchor_ray.dir)); - wep_pix_to_world_af = TranslateAffine(wep_pix_to_world_af, SubVec2(body_ap_ray.pos, body_anchor_ray.pos)); - wep_pix_to_world_af = RotateAffine(wep_pix_to_world_af, InvertRot(body_ap_ray.dir)); - - SPR_Ray anchor_ray = wep.rays[SPR_RayKind_Anchor]; - wep_pix_to_world_af = RotateAffine(wep_pix_to_world_af, anchor_ray.dir); - wep_pix_to_world_af = TranslateAffine(wep_pix_to_world_af, NegVec2(anchor_ray.pos)); - } - } - - //- Push weapon quad - if (body.ready && wep.ready) - { - Affine wep_uv_to_world_af = ScaleAffine(wep_pix_to_world_af, DimsFromRng2(wep.tex_rect)); - - V_Quad *quad = PushStruct(frame->quads_arena, V_Quad); - quad->quad_uv_to_screen_af = MulAffine(frame->af.world_to_screen, wep_uv_to_world_af); - quad->tex = wep.tex; - quad->tex_slice_uv = DivRng2Vec2(wep.tex_rect, wep.tex_dims); - } - - //- Push body quad - if (body.ready) - { - Affine body_uv_to_world_af = ScaleAffine(body_pix_to_world_af, DimsFromRng2(body.tex_rect)); - - V_Quad *quad = PushStruct(frame->quads_arena, V_Quad); - quad->quad_uv_to_screen_af = MulAffine(frame->af.world_to_screen, body_uv_to_world_af); - quad->tex = body.tex; - quad->tex_slice_uv = DivRng2Vec2(body.tex_rect, body.tex_dims); - } - } - } ////////////////////////////// - //- Draw crosshair - - // // TODO: Alive / weapon check - // if (!P_IsEntNil(local_guy)) - // { - // P_Ent *ent = local_guy; - - // P_Anim anim = P_AnimFromEnt(ent, local_frame->time_ns); - // SPR_Sprite body = SPR_SpriteFromSheet(anim.sheet, anim.span, anim.frame_seq); - // SPR_Sprite wep = SPR_SpriteFromSheet(anim.wep_sheet, anim.span, anim.frame_seq); - - // Vec2 look = ent->control.look; - // if (P_MatchKey(ent->key, local_guy->key)) - // { - // // Late latch local player aim direction for lower-latency - // look = frame->look; - // } - - // //- Compute sprite transforms - // Affine cur_ent_to_world_af = MulAffineXform(AffineIdentity, ent->xf); - // Affine desired_ent_to_world_af = MulAffineXform(AffineIdentity, XformTR(ent->xf.t, NormRot(look))); - // Affine cur_body_pix_to_world_af = AffineIdentity; - // Affine cur_wep_pix_to_world_af = AffineIdentity; - // Affine desired_body_pix_to_world_af = AffineIdentity; - // Affine desired_wep_pix_to_world_af = AffineIdentity; - // { - // Vec2 pix_scale = VEC2(1.0 / P_CellsPerMeter, 1.0 / P_CellsPerMeter); - - // //- Compute body transform - // Affine body_pix_to_ent_af = AffineIdentity; - // { - // body_pix_to_ent_af = ScaleAffine(body_pix_to_ent_af, pix_scale); - - // SPR_Ray anchor_ray = body.rays[SPR_RayKind_Anchor]; - // body_pix_to_ent_af = RotateAffine(body_pix_to_ent_af, InvertRot(anchor_ray.dir)); - // body_pix_to_ent_af = TranslateAffine(body_pix_to_ent_af, NegVec2(anchor_ray.pos)); - // } - - // //- Compute weapon transform - // Affine wep_pix_to_ent_af = AffineIdentity; - // { - // wep_pix_to_ent_af = ScaleAffine(wep_pix_to_ent_af, pix_scale); - - // SPR_Ray body_anchor_ray = body.rays[SPR_RayKind_Anchor]; - // SPR_Ray body_ap_ray = body.rays[SPR_RayKind_Ap]; - // wep_pix_to_ent_af = RotateAffine(wep_pix_to_ent_af, InvertRot(body_anchor_ray.dir)); - // wep_pix_to_ent_af = TranslateAffine(wep_pix_to_ent_af, SubVec2(body_ap_ray.pos, body_anchor_ray.pos)); - // wep_pix_to_ent_af = RotateAffine(wep_pix_to_ent_af, InvertRot(body_ap_ray.dir)); - - // SPR_Ray anchor_ray = wep.rays[SPR_RayKind_Anchor]; - // wep_pix_to_ent_af = RotateAffine(wep_pix_to_ent_af, anchor_ray.dir); - // wep_pix_to_ent_af = TranslateAffine(wep_pix_to_ent_af, NegVec2(anchor_ray.pos)); - // } - - // cur_body_pix_to_world_af = MulAffine(cur_ent_to_world_af, body_pix_to_ent_af); - // cur_wep_pix_to_world_af = MulAffine(cur_ent_to_world_af, wep_pix_to_ent_af); - // desired_body_pix_to_world_af = MulAffine(desired_ent_to_world_af, body_pix_to_ent_af); - // desired_wep_pix_to_world_af = MulAffine(desired_ent_to_world_af, wep_pix_to_ent_af); - // } - - // SPR_Ray fire_ray = wep.rays[SPR_RayKind_Ap]; - - // Vec2 cur_fire_pos = MulAffineVec2(cur_wep_pix_to_world_af, fire_ray.pos); - // Vec2 cur_fire_dir = NormRot(MulAffineBasisVec2(cur_wep_pix_to_world_af, fire_ray.dir)); - // Vec2 desired_fire_pos = MulAffineVec2(desired_wep_pix_to_world_af, fire_ray.pos); - // Vec2 desired_fire_dir = NormRot(MulAffineBasisVec2(desired_wep_pix_to_world_af, fire_ray.dir)); - - // Vec2 look_rot = NormRot(look); - - // Vec2 line_start = cur_fire_pos; - // Vec2 line_end = AddVec2(line_start, cur_fire_dir); - // P_DebugDrawLine(line_start, line_end, Color_Yellow); - - // // Vec2 cross = fire_pos; - // // Vec2 cross = MulAffineVec2(frame->af.screen_to_world, look); - - // // f32 cross_dist = 1.0; - // f32 cross_dist = Vec2Len(look); - - // Vec2 cross = AddVec2(desired_fire_pos, MulVec2(look_rot, cross_dist)); - - // // P_DebugDrawPoint(AddVec2(MulAffineVec2(frame->af.screen_to_world, MulVec2(frame->screen_dims, 0.5)), look), Color_Red); - // P_DebugDrawPoint(AddVec2(cur_ent_to_world_af.og, look), Color_Red); - // P_DebugDrawPoint(cross, Color_Green); - // } - + //- Query local player + P_Ent *local_player = P_EntFromKey(local_world->last_frame, V.player_key); + P_Ent *local_guy = P_EntFromKey(local_world->last_frame, local_player->guy); + ////////////////////////////// + //- Compute crosshair position // TODO: Alive / weapon check if (!P_IsEntNil(local_guy)) @@ -2182,6 +1950,171 @@ void V_TickForever(WaveLaneCtx *lane) // P_DebugDrawPoint(frame->crosshair, Color_Green); } + ////////////////////////////// + //- Update cursors / selection + + if (frame->is_looking) + { + frame->screen_cursor = frame->screen_crosshair; + WND_PushCmd(window_frame, .kind = WND_CmdKind_SetLockedCursor, .v = 1); + WND_SetCursor(window_frame, WND_CursorKind_Hidden); + } + else + { + frame->screen_cursor = ui_frame->cursor_pos; + } + frame->shade_cursor = MulAffineVec2(frame->af.screen_to_shade, frame->screen_cursor); + frame->world_cursor = MulAffineVec2(frame->af.screen_to_world, frame->screen_cursor); + + b32 show_editor_ui = TweakBool("Show editor UI", 0); + + frame->world_selection_start = frame->world_cursor; + if (frame->is_editing) + { + b32 m1_held = frame->held_buttons[Button_M1]; + b32 m2_held = frame->held_buttons[Button_M2]; + if (show_editor_ui) + { + frame->selection_mode = V_SelectionMode_Tile; + } + if (m1_held) + { + frame->is_selecting = 1; + // frame->equipped_tile = P_TileKind_Floor; + } + + if (frame->is_selecting && prev_frame->is_selecting) + { + frame->world_selection_start = prev_frame->world_selection_start; + } + } + + frame->world_selection.p0.x = MinF32(frame->world_cursor.x, frame->world_selection_start.x); + frame->world_selection.p0.y = MinF32(frame->world_cursor.y, frame->world_selection_start.y); + frame->world_selection.p1.x = MaxF32(frame->world_cursor.x, frame->world_selection_start.x); + frame->world_selection.p1.y = MaxF32(frame->world_cursor.y, frame->world_selection_start.y); + + frame->screen_selection.p0 = MulAffineVec2(frame->af.world_to_screen, frame->world_selection.p0); + frame->screen_selection.p1 = MulAffineVec2(frame->af.world_to_screen, frame->world_selection.p1); + + frame->shade_selection.p0 = MulAffineVec2(frame->af.world_to_shade, frame->world_selection.p0); + frame->shade_selection.p1 = MulAffineVec2(frame->af.world_to_shade, frame->world_selection.p1); + + ////////////////////////////// + //- Place tiles + + // TODO: Push vis cmd instead + + if (frame->is_editing && prev_frame->is_selecting && !frame->is_selecting) + { + if (prev_frame->selection_mode == V_SelectionMode_Tile) + { + // TODO: Fix clamp when both start & end are outside of world + Rng2I32 tile_range = Zi; + tile_range.p0 = Vec2I32FromVec(FloorVec2(MulAffineVec2(frame->af.world_to_tile, prev_frame->world_selection.p0))); + tile_range.p1 = Vec2I32FromVec(CeilVec2(MulAffineVec2(frame->af.world_to_tile, prev_frame->world_selection.p1))); + + P_Msg *msg = P_PushMsg(P_MsgKind_TileEdit, Zstr); + msg->tile_kind = prev_frame->equipped_tile; + msg->tile_range = tile_range; + } + } + + ////////////////////////////// + //- Query hovered ent + + P_Ent *hovered_ent = &P_NilEnt; + { + // TODO: Real world query + P_Shape cursor_shape = P_ShapeFromDesc(.count = 1, .points = { frame->world_cursor }); + for (P_Ent *ent = P_FirstEnt(local_world->last_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent)) + { + P_Shape ent_shape = P_WorldShapeFromEnt(ent); + b32 is_hovered = P_CollisionResultFromShapes(ent_shape, cursor_shape).collision_points_count > 0; + if (is_hovered) + { + hovered_ent = ent; + } + } + } + + + + + + + + + + + ////////////////////////////// + //- Draw guy sprites + + for (P_Ent *ent = P_FirstEnt(local_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent)) + { + if (ent->is_guy) + { + P_Anim anim = P_AnimFromEnt(ent, local_frame->time_ns); + SPR_Sprite body = SPR_SpriteFromSheet(anim.sheet, anim.span, anim.frame_seq); + SPR_Sprite wep = SPR_SpriteFromSheet(anim.wep_sheet, anim.span, anim.frame_seq); + + //- Compute sprite transforms + Affine body_pix_to_world_af = AffineIdentity; + Affine wep_pix_to_world_af = AffineIdentity; + { + Vec2 pix_scale = VEC2(1.0 / P_CellsPerMeter, 1.0 / P_CellsPerMeter); + Affine ent_to_world_af = MulAffineXform(AffineIdentity, ent->xf); + + //- Compute body transform + { + body_pix_to_world_af = MulAffine(body_pix_to_world_af, ent_to_world_af); + body_pix_to_world_af = ScaleAffine(body_pix_to_world_af, pix_scale); + + SPR_Ray anchor_ray = body.rays[SPR_RayKind_Anchor]; + body_pix_to_world_af = RotateAffine(body_pix_to_world_af, InvertRot(anchor_ray.dir)); + body_pix_to_world_af = TranslateAffine(body_pix_to_world_af, NegVec2(anchor_ray.pos)); + } + + //- Compute weapon transform + { + wep_pix_to_world_af = MulAffine(wep_pix_to_world_af, ent_to_world_af); + wep_pix_to_world_af = ScaleAffine(wep_pix_to_world_af, pix_scale); + + SPR_Ray body_anchor_ray = body.rays[SPR_RayKind_Anchor]; + SPR_Ray body_ap_ray = body.rays[SPR_RayKind_Ap]; + wep_pix_to_world_af = RotateAffine(wep_pix_to_world_af, InvertRot(body_anchor_ray.dir)); + wep_pix_to_world_af = TranslateAffine(wep_pix_to_world_af, SubVec2(body_ap_ray.pos, body_anchor_ray.pos)); + wep_pix_to_world_af = RotateAffine(wep_pix_to_world_af, InvertRot(body_ap_ray.dir)); + + SPR_Ray anchor_ray = wep.rays[SPR_RayKind_Anchor]; + wep_pix_to_world_af = RotateAffine(wep_pix_to_world_af, anchor_ray.dir); + wep_pix_to_world_af = TranslateAffine(wep_pix_to_world_af, NegVec2(anchor_ray.pos)); + } + } + + //- Push weapon quad + if (body.ready && wep.ready) + { + Affine wep_uv_to_world_af = ScaleAffine(wep_pix_to_world_af, DimsFromRng2(wep.tex_rect)); + + V_Quad *quad = PushStruct(frame->quads_arena, V_Quad); + quad->quad_uv_to_screen_af = MulAffine(frame->af.world_to_screen, wep_uv_to_world_af); + quad->tex = wep.tex; + quad->tex_slice_uv = DivRng2Vec2(wep.tex_rect, wep.tex_dims); + } + + //- Push body quad + if (body.ready) + { + Affine body_uv_to_world_af = ScaleAffine(body_pix_to_world_af, DimsFromRng2(body.tex_rect)); + + V_Quad *quad = PushStruct(frame->quads_arena, V_Quad); + quad->quad_uv_to_screen_af = MulAffine(frame->af.world_to_screen, body_uv_to_world_af); + quad->tex = body.tex; + quad->tex_slice_uv = DivRng2Vec2(body.tex_rect, body.tex_dims); + } + } + } @@ -4573,15 +4506,7 @@ void V_TickForever(WaveLaneCtx *lane) ); G_StructuredBufferRef gpu_frame_ref = G_PushStructuredBufferRef(frame->gpu_arena, gpu_frame, V_SharedFrame); - // Gpu flags - V_GpuFlag gpu_flags = 0; - if (frame->show_console) - { - gpu_flags |= V_GpuFlag_DebugDraw; - } - // Set constants - G_SetConstant(frame->cl, V_ShaderConst_GpuFlags, gpu_flags); G_SetConstant(frame->cl, V_ShaderConst_Frame, gpu_frame_ref); G_SetConstant(frame->cl, V_ShaderConst_NoiseTex, G_BasicNoiseTexture()); } diff --git a/src/pp/pp_vis/pp_vis_gpu.g b/src/pp/pp_vis/pp_vis_gpu.g index 34fb7441..8306e5a3 100644 --- a/src/pp/pp_vis/pp_vis_gpu.g +++ b/src/pp/pp_vis/pp_vis_gpu.g @@ -56,7 +56,7 @@ ComputeShader2D(V_PrepareCellsCS, 8, 8) } // Clear stain - if (frame.should_clear_stains) + if (frame.should_clear_particles) { RWTexture2D stains = G_Dereference(frame.stains); stains[cells_pos] = 0; @@ -577,8 +577,10 @@ PixelShader(V_CompositePS, V_CompositePSOutput, V_CompositePSInput input) Vec4 grid_color = 0; if (is_in_world) { + b32 debug_draw = !!frame.show_console; + // Grid outline - if (V_ShaderConst_GpuFlags & V_GpuFlag_DebugDraw) + if (frame.show_console) { const Vec4 line_color = LinearFromSrgb(Vec4(1, 1, 1, 0.1)); Vec2 line_screen_p0 = mul(frame.af.world_to_screen, Vec3(floor(world_pos), 1)); @@ -595,7 +597,7 @@ PixelShader(V_CompositePS, V_CompositePSOutput, V_CompositePSInput input) } // Axis - if (V_ShaderConst_GpuFlags & V_GpuFlag_DebugDraw) + if (frame.show_console) { const Vec4 x_axis_color = LinearFromSrgb(Vec4(0.75, 0, 0, 1)); const Vec4 y_axis_color = LinearFromSrgb(Vec4(0, 0.75, 0, 1)); @@ -637,6 +639,7 @@ PixelShader(V_CompositePS, V_CompositePSOutput, V_CompositePSInput input) // TODO: Remove this Vec4 crosshair_color = 0; + if (frame.is_looking) { f32 dist = length(frame.screen_crosshair - screen_pos); if (dist < 4) diff --git a/src/pp/pp_vis/pp_vis_shared.cgh b/src/pp/pp_vis/pp_vis_shared.cgh index bc2559dc..096bba07 100644 --- a/src/pp/pp_vis/pp_vis_shared.cgh +++ b/src/pp/pp_vis/pp_vis_shared.cgh @@ -6,15 +6,8 @@ //////////////////////////////////////////////////////////// //~ State types -Enum(V_GpuFlag) -{ - V_GpuFlag_None = 0, - V_GpuFlag_DebugDraw = (1 << 0), -}; - -G_DeclConstant(V_GpuFlag, V_ShaderConst_GpuFlags, 0); -G_DeclConstant(G_StructuredBufferRef, V_ShaderConst_Frame, 1); -G_DeclConstant(G_Texture3DRef, V_ShaderConst_NoiseTex, 2); +G_DeclConstant(G_StructuredBufferRef, V_ShaderConst_Frame, 0); +G_DeclConstant(G_Texture3DRef, V_ShaderConst_NoiseTex, 1); Struct(V_TileDesc) { @@ -68,9 +61,14 @@ Struct(V_SharedFrame) //- Modes + // TODO: Move to shader-constant flags + b32 tiles_dirty; b32 should_clear_particles; + b32 is_looking; + b32 is_moving; + b32 is_editing; b32 ui_debug; b32 show_console; @@ -144,7 +142,6 @@ Struct(V_SharedFrame) G_StructuredBufferRef emitters; G_RWStructuredBufferRef particles; - b32 should_clear_stains; G_RWTexture2DRef cells; G_RWTexture2DRef stains; G_RWTexture2DRef drynesses;