remove noise texture

This commit is contained in:
jacob 2026-04-06 09:41:34 -05:00
parent 3af5d804fb
commit fb5aec6bac
18 changed files with 133 additions and 165 deletions

View File

@ -41,7 +41,7 @@ void AsyncWorkerEntryPoint(WaveLaneCtx *lane)
// Tick forever // Tick forever
for (;;) for (;;)
ProfZoneDF("Async Tick") // ProfZoneDF("Async Tick")
{ {
AsyncWorkerCtx *w = &Base.async.worker; AsyncWorkerCtx *w = &Base.async.worker;
{ {

View File

@ -27,9 +27,9 @@
#define PROFILING_ENABLED 0 #define PROFILING_ENABLED 0
#define PROFILER_PRIORITY_ASYNC 10 #define PROFILER_PRIORITY_ASYNC 30
#define PROFILER_PRIORITY_SIM 20 #define PROFILER_PRIORITY_SIM 20
#define PROFILER_PRIORITY_VIS 30 #define PROFILER_PRIORITY_VIS 10

View File

@ -270,10 +270,7 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
ResourceKey resource = glyph->desc.font.r; ResourceKey resource = glyph->desc.font.r;
GC_GlyphDesc desc = glyph->desc; GC_GlyphDesc desc = glyph->desc;
TTF_GlyphResult ttf_result = Zi; TTF_GlyphResult ttf_result = Zi;
ProfZoneDF("Rasterize glyph") ttf_result = TTF_RasterizeGlyphFromCodepoint(frame_arena, desc.codepoint, resource, desc.font_size);
{
ttf_result = TTF_RasterizeGlyphFromCodepoint(frame_arena, desc.codepoint, resource, desc.font_size);
}
glyph->font_size = desc.font_size; glyph->font_size = desc.font_size;
glyph->font_ascent = ttf_result.font_ascent; glyph->font_ascent = ttf_result.font_ascent;
glyph->font_descent = ttf_result.font_descent; glyph->font_descent = ttf_result.font_descent;

View File

@ -5,11 +5,6 @@
@Dep platform @Dep platform
//////////////////////////////
//- Resources
@EmbedDir G_Resources gpu_res
////////////////////////////// //////////////////////////////
//- Api //- Api

View File

@ -31,29 +31,6 @@ void G_BootstrapCommon(void)
); );
} }
// Init noise texture
{
String noise_data = DataFromResource(ResourceKeyFromStore(&G_Resources, Lit("noise_128x128x64_16.dat")));
Vec3I32 noise_dims = G_BasicNoiseDims;
if (noise_data.len != noise_dims.x * noise_dims.y * noise_dims.z * 2)
{
Panic(Lit("Unexpected noise texture size"));
}
G.basic_noise_tex3d = G_PushTexture3D(
cl, gpu_perm,
G_TextureLayout_Common,
G_Format_R16_Uint,
noise_dims,
.name = Lit("Noise texture")
);
G_CopyCpuToTexture(
cl,
G.basic_noise_tex3d, VEC3I32(0, 0, 0),
noise_data.text, noise_dims,
RNG3I32(VEC3I32(0, 0, 0), noise_dims)
);
}
// Init basic samplers // Init basic samplers
{ {
{ {
@ -216,8 +193,3 @@ G_TextureRef G_Blank2D(void)
{ {
return G.blank_tex2d; return G.blank_tex2d;
} }
G_TextureRef G_BasicNoise3D(void)
{
return G.basic_noise_tex3d;
}

View File

@ -6,7 +6,6 @@ Struct(G_Ctx)
// Common shared resources // Common shared resources
G_IndexBufferDesc quad_indices; G_IndexBufferDesc quad_indices;
G_TextureRef blank_tex2d; G_TextureRef blank_tex2d;
G_TextureRef basic_noise_tex3d;
G_SamplerRef basic_samplers[G_BasicSamplerKind_COUNT]; G_SamplerRef basic_samplers[G_BasicSamplerKind_COUNT];
}; };
@ -50,4 +49,3 @@ Rng2 G_ScissorFromTexture(G_TextureRef texture);
G_SamplerRef G_BasicSamplerFromKind(G_BasicSamplerKind kind); G_SamplerRef G_BasicSamplerFromKind(G_BasicSamplerKind kind);
G_IndexBufferDesc G_QuadIndices(void); G_IndexBufferDesc G_QuadIndices(void);
G_TextureRef G_Blank2D(void); G_TextureRef G_Blank2D(void);
G_TextureRef G_BasicNoise3D(void);

BIN
src/gpu/gpu_res/noise_128x128x64_16.dat (Stored with Git LFS)

Binary file not shown.

View File

@ -76,11 +76,6 @@ Enum(G_BasicSamplerKind)
G_BasicSamplerKind_COUNT G_BasicSamplerKind_COUNT
}; };
////////////////////////////////////////////////////////////
//~ Basic noise
#define G_BasicNoiseDims VEC3I32(128, 128, 64)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Index buffers //~ Index buffers

View File

@ -2376,6 +2376,10 @@ void P_StepFrame(P_Frame *frame)
guy->is_guy = 1; guy->is_guy = 1;
guy->key = player->guy; guy->key = player->guy;
guy->source = player->key; guy->source = player->key;
if (player->is_bot)
{
guy->xf.r = Vec2FromAngle(Norm24(RandU64FromState(&world->rand)) * Tau);
}
//- Choose guy spawn point //- Choose guy spawn point
{ {

View File

@ -496,6 +496,7 @@ Enum(P_MsgKind)
P_MsgKind_SaveWorld, P_MsgKind_SaveWorld,
P_MsgKind_ResetWorld, P_MsgKind_ResetWorld,
P_MsgKind_ClearBullets, P_MsgKind_ClearBullets,
P_MsgKind_KillBots,
P_MsgKind_Teleport, P_MsgKind_Teleport,
P_MsgKind_TileEdit, P_MsgKind_TileEdit,
P_MsgKind_Prefab, P_MsgKind_Prefab,

View File

@ -204,6 +204,7 @@ void S_TickForever(WaveLaneCtx *lane)
////////////////////////////// //////////////////////////////
//- Connect clients //- Connect clients
ProfZoneDF("Connect clients")
for (P_MsgNode *msg_node = in_msgs.first; msg_node; msg_node = msg_node->next) for (P_MsgNode *msg_node = in_msgs.first; msg_node; msg_node = msg_node->next)
{ {
P_Msg *msg = &msg_node->msg; P_Msg *msg = &msg_node->msg;
@ -308,6 +309,7 @@ void S_TickForever(WaveLaneCtx *lane)
////////////////////////////// //////////////////////////////
//- Read snapshots //- Read snapshots
ProfZoneDF("Read snapshots")
for (P_MsgNode *msg_node = in_msgs.first; msg_node; msg_node = msg_node->next) for (P_MsgNode *msg_node = in_msgs.first; msg_node; msg_node = msg_node->next)
{ {
P_Msg *msg = &msg_node->msg; P_Msg *msg = &msg_node->msg;
@ -432,7 +434,7 @@ void S_TickForever(WaveLaneCtx *lane)
//- Apply bot controls //- Apply bot controls
{ {
b32 should_bots_target_player = TweakBool("Swarm bots to player", 1); b32 should_bots_target_player = TweakBool("Swarm bots to player", 0);
if (should_bots_target_player) if (should_bots_target_player)
{ {
P_Ent *target_player = &P_NilEnt; P_Ent *target_player = &P_NilEnt;
@ -455,6 +457,7 @@ void S_TickForever(WaveLaneCtx *lane)
bots_count += 1; bots_count += 1;
} }
} }
f32 damp = 1;
{ {
u64 bot_idx = 0; u64 bot_idx = 0;
@ -469,6 +472,7 @@ void S_TickForever(WaveLaneCtx *lane)
{ {
P_Ent *bot_guy = P_EntFromKey(world_frame, bot->guy); P_Ent *bot_guy = P_EntFromKey(world_frame, bot->guy);
Vec2 dir_to_target = SubVec2(target_pos, bot_guy->xf.t); Vec2 dir_to_target = SubVec2(target_pos, bot_guy->xf.t);
dir_to_target = MulVec2(dir_to_target, Vec2Len(dir_to_target) / damp);
bot->control.move = dir_to_target; bot->control.move = dir_to_target;
bot->control.look = dir_to_target; bot->control.look = dir_to_target;
} }
@ -729,6 +733,21 @@ void S_TickForever(WaveLaneCtx *lane)
} }
P_SpawnEntsFromList(world_frame, ents); P_SpawnEntsFromList(world_frame, ents);
} break; } break;
//- Kill bots
case P_MsgKind_KillBots:
{
for (P_Ent *ent = P_FirstEnt(world_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
{
if (ent->is_bot)
{
P_Ent *bot_guy = P_EntFromKey(world_frame, ent->guy);
if (bot_guy->is_guy)
{
bot_guy->health = 0;
}
}
}
} break;
//- Delete entity //- Delete entity
case P_MsgKind_Delete: case P_MsgKind_Delete:
{ {
@ -837,6 +856,7 @@ void S_TickForever(WaveLaneCtx *lane)
////////////////////////////// //////////////////////////////
//- Send snapshots //- Send snapshots
ProfZoneDF("Send snapshots")
for (S_Client *client = S.first_client; !S_IsClientNil(client); client = client->next) for (S_Client *client = S.first_client; !S_IsClientNil(client); client = client->next)
{ {
Struct(PackedDeltaNode) Struct(PackedDeltaNode)
@ -973,6 +993,7 @@ void S_TickForever(WaveLaneCtx *lane)
////////////////////////////// //////////////////////////////
//- Send messages //- Send messages
ProfZoneDF("Send network messages")
{ {
// Group messages by client // Group messages by client
for (P_MsgNode *msg_node = P_tl.out_msgs.first; msg_node; msg_node = msg_node->next) for (P_MsgNode *msg_node = P_tl.out_msgs.first; msg_node; msg_node = msg_node->next)

View File

@ -3429,7 +3429,7 @@ void V_TickForever(WaveLaneCtx *lane)
{ {
V_Emitter emitter = Zi; V_Emitter emitter = Zi;
emitter.kind = V_ParticleKind_Debris; emitter.kind = V_ParticleKind_Debris;
emitter.count = 32; emitter.count = 128;
f32 angle = AngleFromVec2(impact_dir); f32 angle = AngleFromVec2(impact_dir);
@ -3743,39 +3743,55 @@ void V_TickForever(WaveLaneCtx *lane)
emitter.angle.max = angle + angle_spread * 0.5; emitter.angle.max = angle + angle_spread * 0.5;
V_PushParticles(emitter); V_PushParticles(emitter);
} }
// {
// V_Emitter emitter = Zi;
// // emitter.kind = V_ParticleKind_BloodTrail;
// emitter.kind = V_ParticleKind_BloodDebris;
// f32 angle = AngleFromVec2(frame->look);
// // f32 angle = 0;
// f32 angle_spread = Tau * 0.25;
// // f32 angle_spread = Tau;
// // f32 angle_spread = 0;
// // f32 speed = 5;
// f32 speed = 10;
// // f32 speed = 50;
// // f32 speed = 100;
// f32 speed_spread = speed * 2;
// emitter.pos.p0 = emitter.pos.p1 = frame->world_cursor;
// emitter.speed.min = speed - speed_spread * 0.5;
// emitter.speed.max = speed + speed_spread * 0.5;
// emitter.angle.min = angle - angle_spread * 0.5;
// emitter.angle.max = angle + angle_spread * 0.5;
// emitter.count = Kibi(32) * frame->dt;
// V_PushParticles(emitter);
// }
} }
if (frame->held_buttons[Button_B])
// if (frame->held_buttons[Button_F] && !prev_frame->held_buttons[Button_F])
// if (0)
{
{
V_Emitter emitter = Zi;
emitter.kind = V_ParticleKind_BloodTrail;
// emitter.kind = V_ParticleKind_BloodDebris;
f32 angle = AngleFromVec2(frame->look);
// f32 angle = 0;
// f32 angle_spread = Tau * 0.25;
f32 angle_spread = Tau;
// f32 angle_spread = 0;
// f32 speed = 5;
// f32 speed = 25;
f32 speed = 500;
// f32 speed = 100;
f32 speed_spread = speed * 2;
emitter.pos.p0 = prev_frame->world_cursor;
emitter.pos.p1 = frame->world_cursor;
emitter.count = Kibi(512) * frame->dt;
emitter.speed.min = speed - speed_spread * 0.5;
emitter.speed.max = speed + speed_spread * 0.5;
emitter.angle.min = angle - angle_spread * 0.5;
emitter.angle.max = angle + angle_spread * 0.5;
V_PushParticles(emitter);
}
}
////////////////////////////// //////////////////////////////
//- Push test explosion //- Push test explosion
@ -3802,7 +3818,7 @@ void V_TickForever(WaveLaneCtx *lane)
emitter.pos.p0 = prev_frame->world_cursor; emitter.pos.p0 = prev_frame->world_cursor;
emitter.pos.p1 = frame->world_cursor; emitter.pos.p1 = frame->world_cursor;
emitter.count = Kibi(128) * frame->dt; emitter.count = Mebi(1) * frame->dt;
emitter.speed.min = speed - speed_spread * 0.5; emitter.speed.min = speed - speed_spread * 0.5;
emitter.speed.max = speed + speed_spread * 0.5; emitter.speed.max = speed + speed_spread * 0.5;
@ -4207,6 +4223,8 @@ void V_TickForever(WaveLaneCtx *lane)
panel->bg = theme.col.panel_bg; panel->bg = theme.col.panel_bg;
panel->bd = theme.col.panel_bd; panel->bd = theme.col.panel_bd;
panel->opacity = theme.col.panel_opacity; panel->opacity = theme.col.panel_opacity;
panel->resizer_opacity = theme.col.panel_resizer_opacity;
panel->rounding = UI_Rpx(0);
UI_PushDF(Tag, panel->contents_box.v) UI_PushDF(Tag, panel->contents_box.v)
UI_PushDF(Parent, panel->contents_box) UI_PushDF(Parent, panel->contents_box)
@ -4717,6 +4735,9 @@ void V_TickForever(WaveLaneCtx *lane)
{ {
// FIXME: Finalize // FIXME: Finalize
panel->rounding = UI_Rpx(10 * theme.rounding);
panel->resizer_opacity = 0;
// // FIXME: Remove this // // FIXME: Remove this
@ -4770,7 +4791,7 @@ void V_TickForever(WaveLaneCtx *lane)
// UI_Size profiler_height = UI_Fnt(70, 1); // UI_Size profiler_height = UI_Fnt(70, 1);
UI_Size profiler_height = UI_Grow(1, 0); UI_Size profiler_height = UI_Grow(1, 0);
UI_Size header_height = UI_Fnt(2, 1); UI_Size header_height = UI_Fnt(1.5, 1);
UI_Size footer_height = UI_Fnt(2, 1); UI_Size footer_height = UI_Fnt(2, 1);
UI_Size window_padding = UI_Fnt(0.60, 1); UI_Size window_padding = UI_Fnt(0.60, 1);
UI_Size minor_padding = UI_Fnt(0.15, 1); UI_Size minor_padding = UI_Fnt(0.15, 1);
@ -5259,6 +5280,7 @@ void V_TickForever(WaveLaneCtx *lane)
// UI_PushDF(Parent, UI_BuildColumnEx(profiler_box)) // UI_PushDF(Parent, UI_BuildColumnEx(profiler_box))
// UI_PushDF(Parent, UI_BuildRow()) // UI_PushDF(Parent, UI_BuildRow())
{ {
UI_BuildSpacer(window_padding, Axis_X);
UI_BuildSpacer(window_padding, Axis_X); UI_BuildSpacer(window_padding, Axis_X);
UI_PushDF(Parent, UI_BuildColumn()) UI_PushDF(Parent, UI_BuildColumn())
{ {
@ -5266,13 +5288,13 @@ void V_TickForever(WaveLaneCtx *lane)
// UI_PushDF(BackgroundColor, Color_Red) // UI_PushDF(BackgroundColor, Color_Red)
// UI_SetNext(BorderColor, Color_Red); // UI_SetNext(BorderColor, Color_Red);
// UI_SetNext(BorderSize, 1); // UI_SetNext(BorderSize, 1);
// UI_SetNext(ChildAlignment, UI_Region_Center); UI_SetNext(ChildAlignment, UI_Region_Center);
// UI_PushDF(Height, header_height) UI_PushDF(Height, header_height)
// UI_PushDF(Parent, UI_BuildBoxEx(UI_KeyF("profiler header"))) UI_PushDF(Parent, UI_BuildBoxEx(UI_KeyF("profiler header")))
// { {
// UI_PushDF(TextColor, theme.col.hint) UI_PushDF(TextColor, theme.col.hint)
// UI_BuildLabelF("Profiler"); UI_BuildLabelF("Profiler");
// } }
// UI_BuildSpacer(window_padding, Axis_Y); // UI_BuildSpacer(window_padding, Axis_Y);
// UI_BuildSpacer(window_padding, Axis_Y); // UI_BuildSpacer(window_padding, Axis_Y);
@ -5280,10 +5302,10 @@ void V_TickForever(WaveLaneCtx *lane)
//- Graph //- Graph
// UI_SetNext(BackgroundColor, Color_Cyan); // UI_SetNext(BackgroundColor, Color_Cyan);
UI_SetNext(Height, graph_height); // UI_SetNext(Height, graph_height);
UI_PushDF(Parent, UI_BuildBoxEx(profiler_graph_box)) // UI_PushDF(Parent, UI_BuildBoxEx(profiler_graph_box))
{ // {
} // }
// UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); // UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y);
// UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); // UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y);
@ -5786,7 +5808,8 @@ void V_TickForever(WaveLaneCtx *lane)
// UI_SetNext(TextColor, theme.col.positive); // UI_SetNext(TextColor, theme.col.positive);
// UI_SetNext(TextColor, theme.col.button_active); // UI_SetNext(TextColor, theme.col.button_active);
UI_SetNext(TextColor, theme.col.button_selected); // UI_SetNext(TextColor, theme.col.button_selected);
UI_SetNext(TextColor, VEC4(1, 0.8, 0, 1));
UI_BuildLabelF("%F", FmtTimeNs(ruler_len_ns, .p = 2)); UI_BuildLabelF("%F", FmtTimeNs(ruler_len_ns, .p = 2));
// UI_SetNext(TextColor, theme.col.button_selected); // UI_SetNext(TextColor, theme.col.button_selected);
@ -5893,6 +5916,7 @@ void V_TickForever(WaveLaneCtx *lane)
} }
} }
UI_BuildSpacer(window_padding, Axis_X); UI_BuildSpacer(window_padding, Axis_X);
UI_BuildSpacer(window_padding, Axis_X);
} }
} }
} }
@ -6117,12 +6141,12 @@ void V_TickForever(WaveLaneCtx *lane)
// { // {
// V_Panel *panel = left_panel; // V_Panel *panel = left_panel;
// panel->parent = V.root_panel; // panel->parent = V.root_panel;
// panel->axis = Axis_X; // panel->axis = Axis_Y;
// DllQueuePush(panel->parent->first, panel->parent->last, panel); // DllQueuePush(panel->parent->first, panel->parent->last, panel);
// panel->box = UI_RandKey(); // panel->box = UI_RandKey();
// panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v));
// panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
// panel->pct = 0.10; // panel->pct = 0.20;
// panel->is_organizational = 1; // panel->is_organizational = 1;
// } // }
@ -6140,6 +6164,20 @@ void V_TickForever(WaveLaneCtx *lane)
// } // }
// } // }
// //- Test stats panel
// {
// V_Panel *parent = left_panel;
// V_Panel *panel = PushStruct(perm, V_Panel);
// panel->axis = Axis_X;
// DllQueuePush(parent->first, parent->last, panel);
// panel->box = UI_RandKey();
// panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v));
// panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
// panel->flags |= V_PanelFlag_Stats;
// panel->pct = 0.5;
// }
// //- Test spawn panel // //- Test spawn panel
// { // {
// V_Panel *panel = PushStruct(perm, V_Panel); // V_Panel *panel = PushStruct(perm, V_Panel);
@ -6163,7 +6201,7 @@ void V_TickForever(WaveLaneCtx *lane)
// panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v));
// panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
// panel->flags |= V_PanelFlag_Profiler; // panel->flags |= V_PanelFlag_Profiler;
// panel->pct = 0.75; // panel->pct = 0.15;
// } // }
// //- Vis screen panel // //- Vis screen panel
@ -6176,7 +6214,7 @@ void V_TickForever(WaveLaneCtx *lane)
// panel->contents_box = vis_screen_panel_box; // panel->contents_box = vis_screen_panel_box;
// panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
// panel->flags |= V_PanelFlag_Screen; // panel->flags |= V_PanelFlag_Screen;
// panel->pct = 0.25; // panel->pct = 0.52;
// } // }
// //- Test console panel // //- Test console panel
@ -6190,7 +6228,7 @@ void V_TickForever(WaveLaneCtx *lane)
// panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
// panel->flags |= V_PanelFlag_Console; // panel->flags |= V_PanelFlag_Console;
// // panel->flags |= V_PanelFlag_Spawn; // // panel->flags |= V_PanelFlag_Spawn;
// panel->pct = 0.25; // panel->pct = 0.10;
// } // }
// } // }
@ -6509,7 +6547,7 @@ void V_TickForever(WaveLaneCtx *lane)
Vec4 panel_bd = panel->bd; Vec4 panel_bd = panel->bd;
Vec4 resizer_color = theme.col.divider; Vec4 resizer_color = theme.col.divider;
resizer_color.a *= theme.col.panel_resizer_opacity; resizer_color.a *= panel->resizer_opacity;
panel_bd.a *= theme.col.panel_border_opacity; panel_bd.a *= theme.col.panel_border_opacity;
Vec2 dims_rate = VEC2(Inf, Inf); Vec2 dims_rate = VEC2(Inf, Inf);
@ -6567,6 +6605,7 @@ void V_TickForever(WaveLaneCtx *lane)
UI_SetNext(BorderSize, 2); UI_SetNext(BorderSize, 2);
UI_SetNext(DimsRate, dims_rate); UI_SetNext(DimsRate, dims_rate);
// UI_SetNext(Rounding, UI_Rpx(10 * theme.rounding)); // UI_SetNext(Rounding, UI_Rpx(10 * theme.rounding));
UI_SetNext(Rounding, panel->rounding);
UI_SetNext(Flags, UI_BoxFlag_Scissor | (UI_BoxFlag_CaptureMouse * (!is_screen_panel_box && !panel->is_organizational))); UI_SetNext(Flags, UI_BoxFlag_Scissor | (UI_BoxFlag_CaptureMouse * (!is_screen_panel_box && !panel->is_organizational)));
UI_PushDF(Parent, UI_BuildBoxEx(contents_box)) UI_PushDF(Parent, UI_BuildBoxEx(contents_box))
{ {
@ -8491,6 +8530,7 @@ void V_TickForever(WaveLaneCtx *lane)
msg->prefab = P_PrefabKind_Bot; msg->prefab = P_PrefabKind_Bot;
msg->key = P_RandEntKey(); msg->key = P_RandEntKey();
msg->xf.t = frame->world_cursor; msg->xf.t = frame->world_cursor;
msg->xf.r = Vec2FromAngle(Norm24(RandU64FromState(&frame->rand)) * Tau);
if (V_CountVisCmds(V_CmdKind_spawn_tp_bot)) if (V_CountVisCmds(V_CmdKind_spawn_tp_bot))
{ {
for (P_Ent *ent = P_FirstEnt(local_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent)) for (P_Ent *ent = P_FirstEnt(local_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
@ -8504,6 +8544,11 @@ void V_TickForever(WaveLaneCtx *lane)
} }
} }
if (V_CountVisCmds(V_CmdKind_kill_bots))
{
P_PushMsg(P_MsgKind_KillBots, Zstr);
}
if (V_CountVisCmds(V_CmdKind_delete)) if (V_CountVisCmds(V_CmdKind_delete))
{ {
if (!P_IsEntNil(hovered_ent)) if (!P_IsEntNil(hovered_ent))
@ -8721,7 +8766,6 @@ void V_TickForever(WaveLaneCtx *lane)
// Init registers // Init registers
G_SetRegister(cl, V_GpuReg_Flags, gpu_flags); G_SetRegister(cl, V_GpuReg_Flags, gpu_flags);
G_SetRegister(cl, V_GpuReg_Frame, gpu_frame); G_SetRegister(cl, V_GpuReg_Frame, gpu_frame);
G_SetRegister(cl, V_GpuReg_NoiseTex, G_BasicNoise3D());
} }
G_Sync(cl); G_Sync(cl);
@ -8929,57 +8973,9 @@ void V_TickForever(WaveLaneCtx *lane)
} }
} }
//////////////////////////////
//- Prune sim ents
// {
// i64 ents_to_prune_count = 0;
// P_Ent **ents_to_prune = PushStructsNoZero(frame->arena, P_Ent *, sim_frame->ents_count);
// for (P_Ent *ent = P_FirstEnt(sim_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
// {
// if (ent->exists <= 0)
// {
// ents_to_prune[ents_to_prune_count] = ent;
// ents_to_prune_count += 1;
// }
// }
// for (i64 prune_idx = 0; prune_idx < ents_to_prune_count; ++prune_idx)
// {
// P_Ent *ent = ents_to_prune[prune_idx];
// P_EntBin *bin = &sim_frame->ent_bins[ent->key.v % sim_frame->ent_bins_count];
// DllQueueRemoveNP(bin->first, bin->last, ent, next_in_bin, prev_in_bin);
// DllQueueRemoveNPZ(&P_NilEnt, sim_frame->first_ent, sim_frame->last_ent, ent, next, prev);
// sim_frame->ents_count -= 1;
// SllStackPush(sim_world->first_free_ent, ent);
// }
// }
////////////////////////////// //////////////////////////////
//- Send messages //- Send messages
// FIXME: Remove this (testing)
// if (frame->held_buttons[Button_R] && !prev_frame->held_buttons[Button_R])
// {
// LogDebugF("Sending test payload");
// NET_Send(net_pipe, frame->sim_key, STRING(P_TilesCount, predict_world->tiles), NET_SendFlag_None);
// // NET_Send(net_pipe, frame->sim_key, Lit("Hello there!"), NET_SendFlag_None);
// }
// for (P_MsgNode *msg_node = P_tl.out_msgs.first; msg_node; msg_node = msg_node->next)
// {
// P_Msg *msg = &msg_node->msg;
// String packed = P_PackMessage(frame->arena, msg);
// NET_Send(net_pipe, frame->sim_key, packed, NET_SendFlag_None);
// }
ProfZoneDF("Publish net msgs") ProfZoneDF("Publish net msgs")
{ {
if (P_tl.out_msgs.count > 0) if (P_tl.out_msgs.count > 0)
@ -9004,7 +9000,7 @@ void V_TickForever(WaveLaneCtx *lane)
//- End frame //- End frame
i32 vsync = !!TweakBool("Vsync", 1); i32 vsync = !!TweakBool("Vsync", 0);
UI_EndFrame(ui_frame, vsync); UI_EndFrame(ui_frame, vsync);
if (frame->tick == 1) if (frame->tick == 1)

View File

@ -20,6 +20,7 @@
X(tp_player, Teleport Player, V_CmdDescFlag_None, V_HOTKEY( Button_Q, .alt = 1 ), ) \ X(tp_player, Teleport Player, V_CmdDescFlag_None, V_HOTKEY( Button_Q, .alt = 1 ), ) \
X(spawn_tp_bot, Spawn/Teleport Bot, V_CmdDescFlag_None, V_HOTKEY( Button_T, .alt = 1 ), ) \ X(spawn_tp_bot, Spawn/Teleport Bot, V_CmdDescFlag_None, V_HOTKEY( Button_T, .alt = 1 ), ) \
X(spawn_bot, Spawn Bot, V_CmdDescFlag_None, V_HOTKEY( Button_T, .alt = 1, .shift = 1 ), ) \ X(spawn_bot, Spawn Bot, V_CmdDescFlag_None, V_HOTKEY( Button_T, .alt = 1, .shift = 1 ), ) \
X(kill_bots, Kill Bots, V_CmdDescFlag_None, V_HOTKEY( Button_K, .alt = 1 ), ) \
X(delete, Delete entity at cursor, V_CmdDescFlag_None, V_HOTKEY( Button_M2 ), ) \ X(delete, Delete entity at cursor, V_CmdDescFlag_None, V_HOTKEY( Button_M2 ), ) \
X(reset_world, Reset world, V_CmdDescFlag_None, V_HOTKEY( Button_R, .ctrl = 1, .alt = 1 ), ) \ X(reset_world, Reset world, V_CmdDescFlag_None, V_HOTKEY( Button_R, .ctrl = 1, .alt = 1 ), ) \
X(clear_particles, Clear particles, V_CmdDescFlag_None, V_HOTKEY( Button_C, .alt = 1, ), ) \ X(clear_particles, Clear particles, V_CmdDescFlag_None, V_HOTKEY( Button_C, .alt = 1, ), ) \
@ -366,6 +367,8 @@ Struct(V_Panel)
Vec4 bg; Vec4 bg;
Vec4 bd; Vec4 bd;
f32 opacity; f32 opacity;
f32 resizer_opacity;
UI_Round rounding;
}; };
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -1,14 +1,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Helpers //~ Helpers
f32 V_RandFromPos(Vec3 pos)
{
Texture3D<u32> noise3d = G_Deref(V_GpuReg_NoiseTex, Texture3D<u32>);
u32 noise = noise3d[(Vec3U32)pos % G_BasicNoiseDims];
f32 rand = Norm16(noise);
return rand;
}
f32 V_LifetimeFromParticleDesc(V_ParticleDesc desc, u32 particle_idx) f32 V_LifetimeFromParticleDesc(V_ParticleDesc desc, u32 particle_idx)
{ {
u64 seed = MixU64(V_ParticleLifetimeBasis ^ particle_idx); u64 seed = MixU64(V_ParticleLifetimeBasis ^ particle_idx);

View File

@ -44,7 +44,6 @@ Struct(V_DVertPSOutput)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Helpers //~ Helpers
f32 V_RandFromPos(Vec3 pos);
f32 V_LifetimeFromParticleDesc(V_ParticleDesc desc, u32 particle_idx); f32 V_LifetimeFromParticleDesc(V_ParticleDesc desc, u32 particle_idx);
f32 V_FalloffFromParticleDesc(V_ParticleDesc desc, u32 particle_idx); f32 V_FalloffFromParticleDesc(V_ParticleDesc desc, u32 particle_idx);
Vec4 V_ColorFromParticleDesc(V_ParticleDesc desc, u32 particle_idx, f32 alive_seconds, u32 density); Vec4 V_ColorFromParticleDesc(V_ParticleDesc desc, u32 particle_idx, f32 alive_seconds, u32 density);

View File

@ -15,9 +15,8 @@ Enum(V_GpuFlag)
G_DeclRegister(V_GpuFlag, V_GpuReg_Flags, 0); G_DeclRegister(V_GpuFlag, V_GpuReg_Flags, 0);
G_DeclRegister(G_BufferRef, V_GpuReg_Frame, 1); G_DeclRegister(G_BufferRef, V_GpuReg_Frame, 1);
G_DeclRegister(G_TextureRef, V_GpuReg_NoiseTex, 2); G_DeclRegister(i32, V_GpuReg_MipsCount, 2);
G_DeclRegister(i32, V_GpuReg_MipsCount, 3); G_DeclRegister(i32, V_GpuReg_MipIdx, 3);
G_DeclRegister(i32, V_GpuReg_MipIdx, 4);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Particle types //~ Particle types
@ -104,7 +103,7 @@ Enum(V_ParticleLayer)
/* Stain rate, pen chance */ 0, 0, \ /* Stain rate, pen chance */ 0, 0, \
/* Lifetime */ Inf, Inf, \ /* Lifetime */ Inf, Inf, \
/* Falloff */ 20, 30, \ /* Falloff */ 20, 30, \
/* Prune speed threshold */ 0.1, \ /* Prune speed threshold */ 0.01, \
/* Base color */ VEC4(2, 0.5, 0, 1), \ /* Base color */ VEC4(2, 0.5, 0, 1), \
/* Dry color factor */ VEC4(0.2, 0.1, 0.1, 1) \ /* Dry color factor */ VEC4(0.2, 0.1, 0.1, 1) \
) \ ) \

View File

@ -25,7 +25,6 @@ void PT_RunForever(WaveLaneCtx *lane)
// Gpu upload pass // Gpu upload pass
{ {
G_ResetArena(cl, gpu_frame_arena); G_ResetArena(cl, gpu_frame_arena);
frame->noise_tex = G_BasicNoise3D();
frame->sampler = G_BasicSamplerFromKind(G_BasicSamplerKind_PointClamp); frame->sampler = G_BasicSamplerFromKind(G_BasicSamplerKind_PointClamp);
frame->compute_target = G_PushTexture2D( frame->compute_target = G_PushTexture2D(
cl, gpu_frame_arena, cl, gpu_frame_arena,

View File

@ -107,7 +107,7 @@ TTF_GlyphResult TTF_RasterizeGlyphFromCodepoint(Arena *arena, u32 codepoint, Res
Unlock(&lock); Unlock(&lock);
} }
if (!font) if (!font)
ProfZoneDF("Load & cache DirectWrite font") ProfZoneDF("Cache font")
{ {
Lock lock = LockE(&TTF_DW.font_bins_mutex); Lock lock = LockE(&TTF_DW.font_bins_mutex);
{ {
@ -180,7 +180,7 @@ TTF_GlyphResult TTF_RasterizeGlyphFromCodepoint(Arena *arena, u32 codepoint, Res
f32 font_cap = font->design_metrics.capHeight * pixels_per_design_unit; f32 font_cap = font->design_metrics.capHeight * pixels_per_design_unit;
TTF_GlyphResult result = Zi; TTF_GlyphResult result = Zi;
ProfZoneDF("Rasterize") ProfZoneDF("Rasterize DirectWrite Glyph")
{ {
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {