'dummy' -> 'bot'
This commit is contained in:
parent
bc32417ba1
commit
003bdb2d55
@ -493,6 +493,7 @@
|
|||||||
typedef uint u32;
|
typedef uint u32;
|
||||||
typedef uint64_t u64;
|
typedef uint64_t u64;
|
||||||
typedef float f32;
|
typedef float f32;
|
||||||
|
typedef double f64;
|
||||||
typedef bool b32; // bool has 32-bit size & alignment in HLSL
|
typedef bool b32; // bool has 32-bit size & alignment in HLSL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -52,16 +52,26 @@ i32 SignF64(f64 v)
|
|||||||
return (v >= 0) - (v < 0);
|
return (v >= 0) - (v < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Norm
|
//- Normalize
|
||||||
|
|
||||||
f32 NormU32(u32 v)
|
f32 Norm8(u32 v)
|
||||||
{
|
{
|
||||||
return (f32)(v & (((u32)1 << 24) - 1)) / (f32)((u32)1 << 24);
|
return (v & 0xFF) / (f32)0x1FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
f64 NormU64(u64 v)
|
f32 Norm16(u32 v)
|
||||||
{
|
{
|
||||||
return (f64)(v & (((u64)1 << 53) - 1)) / (f64)((u64)1 << 53);
|
return (v & 0xFFFF) / (f32)0x10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 Norm24(u32 v)
|
||||||
|
{
|
||||||
|
return (v & 0xFFFFFF) / (f32)0x1000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
f64 Norm53(u64 v)
|
||||||
|
{
|
||||||
|
return (v & 0x1FFFFFFFFFFFFFull) / (f64)0x20000000000000ull;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -261,9 +261,11 @@ f64 SaturateF64(f64 v);
|
|||||||
i32 SignF32(f32 v);
|
i32 SignF32(f32 v);
|
||||||
i32 SignF64(f64 v);
|
i32 SignF64(f64 v);
|
||||||
|
|
||||||
//- Norm
|
//- Normalize
|
||||||
f32 NormU32(u32 v);
|
f32 Norm8(u32 v);
|
||||||
f64 NormU64(u64 v);
|
f32 Norm16(u32 v);
|
||||||
|
f32 Norm24(u32 v);
|
||||||
|
f64 Norm53(u64 v);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Exponential ops
|
//~ Exponential ops
|
||||||
|
|||||||
@ -11,10 +11,10 @@ u64 RandU64FromState(RandState *state)
|
|||||||
|
|
||||||
f32 RandF32FromState(RandState *state, f32 range_start, f32 range_end)
|
f32 RandF32FromState(RandState *state, f32 range_start, f32 range_end)
|
||||||
{
|
{
|
||||||
return range_start + (range_end - range_start) * NormU32(RandU64FromState(state));
|
return range_start + (range_end - range_start) * Norm24(RandU64FromState(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
f64 RandF64FromState(RandState *state, f64 range_start, f64 range_end)
|
f64 RandF64FromState(RandState *state, f64 range_start, f64 range_end)
|
||||||
{
|
{
|
||||||
return range_start + (range_end - range_start) * NormU64(RandU64FromState(state));
|
return range_start + (range_end - range_start) * Norm53(RandU64FromState(state));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,6 +108,33 @@ u32 countof(T arr[N])
|
|||||||
#define SmoothstepF32 (f32)smoothstep
|
#define SmoothstepF32 (f32)smoothstep
|
||||||
#define SmoothstepF64 (f64)smoothstep
|
#define SmoothstepF64 (f64)smoothstep
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//~ Float ops
|
||||||
|
|
||||||
|
//- Normalize
|
||||||
|
|
||||||
|
Inline f32 Norm8(u32 v)
|
||||||
|
{
|
||||||
|
return (v & 0xFF) / (f32)0x1FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inline f32 Norm16(u32 v)
|
||||||
|
{
|
||||||
|
return (v & 0xFFFF) / (f32)0x10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inline f32 Norm24(u32 v)
|
||||||
|
{
|
||||||
|
return (v & 0xFFFFFF) / (f32)0x1000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inline f64 Norm53(u64 v)
|
||||||
|
{
|
||||||
|
return (v & 0x1FFFFFFFFFFFFFull) / (f64)0x20000000000000ull;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Match floor
|
||||||
|
|
||||||
#define MatchFloor(a, b) all(floor(a) == floor(b))
|
#define MatchFloor(a, b) all(floor(a) == floor(b))
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -104,15 +104,6 @@ Inline void Mergesort(void *items, u64 item_count, u64 item_size, MergesortCompa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Shuffle utils
|
|
||||||
|
|
||||||
#define ShuffleStructs(ptr, count, seed) ShuffleStructs_((ptr), sizeof(*(ptr)), (count), (seed))
|
|
||||||
Inline void ShuffleStructs_(void *items, u64 item_count, u64 item_size, u64 seed)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Dict utils
|
//~ Dict utils
|
||||||
|
|
||||||
|
|||||||
@ -436,6 +436,7 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
// Disable warnings
|
// Disable warnings
|
||||||
PushStringToList(perm, &cp.warnings_dxc, Lit("-Wno-unused-variable"));
|
PushStringToList(perm, &cp.warnings_dxc, Lit("-Wno-unused-variable"));
|
||||||
|
PushStringToList(perm, &cp.warnings_dxc, Lit("-Wno-conversion"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1589,7 +1589,7 @@ void P_StepFrame(P_Frame *frame)
|
|||||||
if (!ignore_spawn)
|
if (!ignore_spawn)
|
||||||
{
|
{
|
||||||
f32 rand_score_spread = 5;
|
f32 rand_score_spread = 5;
|
||||||
f32 virtual_score = spawn->score + rand_score_spread * NormU32(RandU64FromState(&world->rand));
|
f32 virtual_score = spawn->score + rand_score_spread * Norm24(RandU64FromState(&world->rand));
|
||||||
if (virtual_score > highest_score)
|
if (virtual_score > highest_score)
|
||||||
{
|
{
|
||||||
highest_score = virtual_score;
|
highest_score = virtual_score;
|
||||||
@ -2457,8 +2457,8 @@ void P_StepFrame(P_Frame *frame)
|
|||||||
bullet->is_bullet = 1;
|
bullet->is_bullet = 1;
|
||||||
bullet->key = P_RandKey();
|
bullet->key = P_RandKey();
|
||||||
|
|
||||||
f32 rand_speed = ((f32)P_RandU64FromEnt(firer) / (f32)0xFFFFFFFFFFFFFFFFull) - 0.5;
|
f32 rand_speed = Norm24(P_RandU64FromEnt(firer)) - 0.5;
|
||||||
f32 rand_angle = ((f32)P_RandU64FromEnt(firer) / (f32)0xFFFFFFFFFFFFFFFFull) - 0.5;
|
f32 rand_angle = Norm24(P_RandU64FromEnt(firer)) - 0.5;
|
||||||
|
|
||||||
f32 speed = tweak_speed * sim_dt;
|
f32 speed = tweak_speed * sim_dt;
|
||||||
f32 angle = AngleFromVec2(fire_dir);
|
f32 angle = AngleFromVec2(fire_dir);
|
||||||
|
|||||||
@ -108,7 +108,7 @@ Struct(P_Ent)
|
|||||||
f32 exists;
|
f32 exists;
|
||||||
|
|
||||||
b32 is_guy;
|
b32 is_guy;
|
||||||
b32 is_dummy;
|
b32 is_bot;
|
||||||
f32 health;
|
f32 health;
|
||||||
|
|
||||||
Xform xf;
|
Xform xf;
|
||||||
@ -325,7 +325,7 @@ Struct(P_Msg)
|
|||||||
NET_Key src;
|
NET_Key src;
|
||||||
NET_Key dst;
|
NET_Key dst;
|
||||||
|
|
||||||
b32 affect_dummies;
|
b32 affect_bots;
|
||||||
|
|
||||||
P_PrefabKind prefab;
|
P_PrefabKind prefab;
|
||||||
P_Key key;
|
P_Key key;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Enum(P_TileKind)
|
|||||||
#define P_PrefabsXList(X) \
|
#define P_PrefabsXList(X) \
|
||||||
X(None, P_PrefabFlag_HideFromEditor) \
|
X(None, P_PrefabFlag_HideFromEditor) \
|
||||||
X(Guy, P_PrefabFlag_None) \
|
X(Guy, P_PrefabFlag_None) \
|
||||||
X(Dummy, P_PrefabFlag_None) \
|
X(Bot, P_PrefabFlag_None) \
|
||||||
X(GuySpawn, P_PrefabFlag_None) \
|
X(GuySpawn, P_PrefabFlag_None) \
|
||||||
/* --------------------------------------------------- */
|
/* --------------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
@ -412,23 +412,23 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Apply dummy controls
|
//- Apply bot controls
|
||||||
|
|
||||||
{
|
{
|
||||||
b32 dummy_movement_enabled = TweakBool("Dummy movement enabled", 0);
|
b32 bot_movement_enabled = TweakBool("Bot movement enabled", 0);
|
||||||
for (P_Ent *dummy = P_FirstEnt(world_frame); !P_IsEntNil(dummy); dummy = P_NextEnt(dummy))
|
for (P_Ent *bot = P_FirstEnt(world_frame); !P_IsEntNil(bot); bot = P_NextEnt(bot))
|
||||||
{
|
{
|
||||||
if (dummy->is_dummy)
|
if (bot->is_bot)
|
||||||
{
|
{
|
||||||
if (dummy_movement_enabled)
|
if (bot_movement_enabled)
|
||||||
{
|
{
|
||||||
i64 alive_time_ns = time_ns - dummy->created_at_ns;
|
i64 alive_time_ns = time_ns - bot->created_at_ns;
|
||||||
i64 frequency_ns = NsFromSeconds(0.1);
|
i64 frequency_ns = NsFromSeconds(0.1);
|
||||||
dummy->control.move.y = SinF32((f64)alive_time_ns / (f64)frequency_ns);
|
bot->control.move.y = SinF32((f64)alive_time_ns / (f64)frequency_ns);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZeroStruct(&dummy->control.move);
|
ZeroStruct(&bot->control.move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -549,7 +549,7 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
// TODO: Real reset
|
// TODO: Real reset
|
||||||
for (P_Ent *ent = P_FirstEnt(world_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
|
for (P_Ent *ent = P_FirstEnt(world_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
|
||||||
{
|
{
|
||||||
if (!ent->is_player || (msg->affect_dummies && ent->is_dummy))
|
if (!ent->is_player || (msg->affect_bots && ent->is_bot))
|
||||||
{
|
{
|
||||||
ent->exists = 0;
|
ent->exists = 0;
|
||||||
}
|
}
|
||||||
@ -572,25 +572,25 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
guy->has_weapon = 1;
|
guy->has_weapon = 1;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case P_PrefabKind_Dummy:
|
case P_PrefabKind_Bot:
|
||||||
{
|
{
|
||||||
P_Ent *dummy = P_EntFromKey(world_frame, msg->key);
|
P_Ent *bot = P_EntFromKey(world_frame, msg->key);
|
||||||
if (!dummy->is_dummy)
|
if (!bot->is_bot)
|
||||||
{
|
{
|
||||||
dummy = P_PushTempEnt(frame_arena, &ents);
|
bot = P_PushTempEnt(frame_arena, &ents);
|
||||||
dummy->key = msg->key;
|
bot->key = msg->key;
|
||||||
dummy->is_player = 1;
|
bot->is_player = 1;
|
||||||
dummy->is_dummy = 1;
|
bot->is_bot = 1;
|
||||||
P_SetEntString(dummy, name);
|
P_SetEntString(bot, Lit("Bot"));
|
||||||
}
|
}
|
||||||
P_Ent *guy = P_EntFromKey(world_frame, dummy->guy);
|
P_Ent *guy = P_EntFromKey(world_frame, bot->guy);
|
||||||
if (!guy->is_guy)
|
if (!guy->is_guy)
|
||||||
{
|
{
|
||||||
guy = P_PushTempEnt(frame_arena, &ents);
|
guy = P_PushTempEnt(frame_arena, &ents);
|
||||||
guy->key = P_RandKey();
|
guy->key = P_RandKey();
|
||||||
guy->is_guy = 1;
|
guy->is_guy = 1;
|
||||||
guy->has_weapon = 1;
|
guy->has_weapon = 1;
|
||||||
dummy->guy = guy->key;
|
bot->guy = guy->key;
|
||||||
}
|
}
|
||||||
guy->xf = msg->xf;
|
guy->xf = msg->xf;
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
@ -42,9 +42,9 @@ String P_PackWorld(Arena *arena, P_World *src_world)
|
|||||||
{
|
{
|
||||||
result.len += PushString(arena, Lit(" guy\n")).len;
|
result.len += PushString(arena, Lit(" guy\n")).len;
|
||||||
}
|
}
|
||||||
if (ent->is_dummy)
|
if (ent->is_bot)
|
||||||
{
|
{
|
||||||
result.len += PushString(arena, Lit(" dummy\n")).len;
|
result.len += PushString(arena, Lit(" bot\n")).len;
|
||||||
}
|
}
|
||||||
if (ent->has_weapon)
|
if (ent->has_weapon)
|
||||||
{
|
{
|
||||||
@ -150,9 +150,9 @@ P_UnpackedWorld P_UnpackWorld(Arena *arena, String packed)
|
|||||||
{
|
{
|
||||||
ent->is_guy = 1;
|
ent->is_guy = 1;
|
||||||
}
|
}
|
||||||
if (MatchString(prop->value, Lit("dummy")))
|
if (MatchString(prop->value, Lit("bot")))
|
||||||
{
|
{
|
||||||
ent->is_dummy = 1;
|
ent->is_bot = 1;
|
||||||
}
|
}
|
||||||
if (MatchString(prop->value, Lit("has_weapon")))
|
if (MatchString(prop->value, Lit("has_weapon")))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4092,6 +4092,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
Vec2 cell_pos = MulAffineVec2(frame->af.world_to_cell, frame->world_cursor);
|
Vec2 cell_pos = MulAffineVec2(frame->af.world_to_cell, frame->world_cursor);
|
||||||
i32 tile_idx = P_TileIdxFromTilePos(tile_pos);
|
i32 tile_idx = P_TileIdxFromTilePos(tile_pos);
|
||||||
UI_BuildLabelF("Camera pos: %F", FmtFloat2(frame->camera_pos));
|
UI_BuildLabelF("Camera pos: %F", FmtFloat2(frame->camera_pos));
|
||||||
|
UI_BuildLabelF("Camera zoom: %F", FmtFloat(frame->camera_zoom));
|
||||||
UI_BuildLabelF("Cursor world pos: %F", FmtFloat2(frame->world_cursor));
|
UI_BuildLabelF("Cursor world pos: %F", FmtFloat2(frame->world_cursor));
|
||||||
UI_BuildLabelF("Cursor tile pos: %F", FmtFloat2(tile_pos));
|
UI_BuildLabelF("Cursor tile pos: %F", FmtFloat2(tile_pos));
|
||||||
UI_BuildLabelF("Cursor tile idx: %F", FmtSint(tile_idx));
|
UI_BuildLabelF("Cursor tile idx: %F", FmtSint(tile_idx));
|
||||||
@ -4512,7 +4513,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
if (kind == V_CmdKind_reset_world)
|
if (kind == V_CmdKind_reset_world)
|
||||||
{
|
{
|
||||||
P_Msg *msg = P_PushMsg(P_MsgKind_ResetWorld, Zstr);
|
P_Msg *msg = P_PushMsg(P_MsgKind_ResetWorld, Zstr);
|
||||||
msg->affect_dummies = 1;
|
msg->affect_bots = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4527,19 +4528,18 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case V_CmdKind_spawn_tp_dummy:
|
case V_CmdKind_spawn_tp_bot:
|
||||||
case V_CmdKind_spawn_dummy:
|
case V_CmdKind_spawn_bot:
|
||||||
{
|
{
|
||||||
P_Msg *msg = P_PushMsg(P_MsgKind_Prefab, Zstr);
|
P_Msg *msg = P_PushMsg(P_MsgKind_Prefab, Zstr);
|
||||||
msg->prefab = P_PrefabKind_Dummy;
|
msg->prefab = P_PrefabKind_Bot;
|
||||||
msg->key = P_RandKey();
|
msg->key = P_RandKey();
|
||||||
msg->xf.t = frame->world_cursor;
|
msg->xf.t = frame->world_cursor;
|
||||||
msg->data = Lit("Dummy");
|
if (kind == V_CmdKind_spawn_tp_bot)
|
||||||
if (kind == V_CmdKind_spawn_tp_dummy)
|
|
||||||
{
|
{
|
||||||
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))
|
||||||
{
|
{
|
||||||
if (ent->is_dummy)
|
if (ent->is_bot)
|
||||||
{
|
{
|
||||||
msg->key = ent->key;
|
msg->key = ent->key;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -14,8 +14,8 @@
|
|||||||
X(toggle_fullscreen, Toggle Fullscreen Mode, V_CmdDescFlag_None, V_HOTKEY( Button_Enter, .alt = 1 ) ) \
|
X(toggle_fullscreen, Toggle Fullscreen Mode, V_CmdDescFlag_None, V_HOTKEY( Button_Enter, .alt = 1 ) ) \
|
||||||
X(toggle_window_topmost, Toggle Window Topmost, V_CmdDescFlag_None, V_HOTKEY( Button_F4 ), ) \
|
X(toggle_window_topmost, Toggle Window Topmost, V_CmdDescFlag_None, V_HOTKEY( Button_F4 ), ) \
|
||||||
X(spawn_tp_player, Spawn/Teleport Player, V_CmdDescFlag_None, V_HOTKEY( Button_Q ), ) \
|
X(spawn_tp_player, Spawn/Teleport Player, V_CmdDescFlag_None, V_HOTKEY( Button_Q ), ) \
|
||||||
X(spawn_tp_dummy, Spawn/Teleport Dummy, V_CmdDescFlag_None, V_HOTKEY( Button_T ), ) \
|
X(spawn_tp_bot, Spawn/Teleport Bot, V_CmdDescFlag_None, V_HOTKEY( Button_T ), ) \
|
||||||
X(spawn_dummy, Spawn Dummy, V_CmdDescFlag_None, V_HOTKEY( Button_T, .ctrl = 1 ), ) \
|
X(spawn_bot, Spawn Bot, V_CmdDescFlag_None, V_HOTKEY( Button_T, .ctrl = 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 ), ) \
|
X(clear_particles, Clear particles, V_CmdDescFlag_None, V_HOTKEY( Button_C ), ) \
|
||||||
|
|||||||
@ -6,7 +6,7 @@ f32 V_RandFromPos(Vec3 pos)
|
|||||||
Texture3D<u32> noise3d = G_Dereference<u32>(V_ShaderConst_NoiseTex);
|
Texture3D<u32> noise3d = G_Dereference<u32>(V_ShaderConst_NoiseTex);
|
||||||
// TODO: Compile-time noise dims
|
// TODO: Compile-time noise dims
|
||||||
u32 noise = noise3d[(Vec3U32)pos % countof(noise3d)];
|
u32 noise = noise3d[(Vec3U32)pos % countof(noise3d)];
|
||||||
f32 rand = (f32)noise / 0xFFFF;
|
f32 rand = Norm16(noise);
|
||||||
return rand;
|
return rand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,16 +176,16 @@ ComputeShader(V_SimParticlesCS, 64)
|
|||||||
u64 seed0 = MixU64(particle.seq);
|
u64 seed0 = MixU64(particle.seq);
|
||||||
u64 seed1 = MixU64(seed0);
|
u64 seed1 = MixU64(seed0);
|
||||||
|
|
||||||
f32 rand_speed = (f32)((seed0 >> 0) & 0xFFFF) / (f32)0xFFFF;
|
f32 rand_speed = Norm16(seed0 >> 0);
|
||||||
f32 rand_angle = (f32)((seed0 >> 16) & 0xFFFF) / (f32)0xFFFF;
|
f32 rand_angle = Norm16(seed0 >> 16);
|
||||||
f32 rand_offset = (f32)((seed0 >> 32) & 0xFFFF) / (f32)0xFFFF;
|
f32 rand_offset = Norm16(seed0 >> 32);
|
||||||
f32 rand_falloff = (f32)((seed0 >> 48) & 0xFFFF) / (f32)0xFFFF;
|
f32 rand_falloff = Norm16(seed0 >> 48);
|
||||||
|
|
||||||
f32 rand_r = (f32)((seed1 >> 0) & 0xFF) / (f32)0xFF;
|
f32 rand_r = Norm8(seed1 >> 0);
|
||||||
f32 rand_g = (f32)((seed1 >> 8) & 0xFF) / (f32)0xFF;
|
f32 rand_g = Norm8(seed1 >> 8);
|
||||||
f32 rand_b = (f32)((seed1 >> 16) & 0xFF) / (f32)0xFF;
|
f32 rand_b = Norm8(seed1 >> 16);
|
||||||
f32 rand_a = (f32)((seed1 >> 24) & 0xFF) / (f32)0xFF;
|
f32 rand_a = Norm8(seed1 >> 24);
|
||||||
f32 rand_lifetime = (f32)((seed1 >> 32) & 0xFFFF) / (f32)0xFFFF;
|
f32 rand_lifetime = Norm16(seed1 >> 32);
|
||||||
|
|
||||||
f32 speed = emitter.speed + (rand_speed - 0.5) * emitter.speed_spread;
|
f32 speed = emitter.speed + (rand_speed - 0.5) * emitter.speed_spread;
|
||||||
f32 angle = emitter.angle + (rand_angle - 0.5) * emitter.angle_spread;
|
f32 angle = emitter.angle + (rand_angle - 0.5) * emitter.angle_spread;
|
||||||
@ -255,8 +255,6 @@ ComputeShader(V_SimParticlesCS, 64)
|
|||||||
(AnyBit(particle.flags, V_ParticleFlag_StainOnPrune) && particle.exists == 0)
|
(AnyBit(particle.flags, V_ParticleFlag_StainOnPrune) && particle.exists == 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Stain
|
|
||||||
if (should_stain)
|
if (should_stain)
|
||||||
{
|
{
|
||||||
f32 old_dryness = drynesses[cell_pos];
|
f32 old_dryness = drynesses[cell_pos];
|
||||||
@ -400,14 +398,14 @@ PixelShader(V_CompositePS, V_CompositePSOutput, V_CompositePSInput input)
|
|||||||
b32 tile_is_wall = 0;
|
b32 tile_is_wall = 0;
|
||||||
Vec4 tile_color = 0;
|
Vec4 tile_color = 0;
|
||||||
{
|
{
|
||||||
P_TileKind tile_tl = tiles.Load(Vec3(tile_pos.x - 1, tile_pos.y - 1, 0));
|
P_TileKind tile_tl = tiles.Load(Vec3(tile_pos.x - 0.99, tile_pos.y - 0.99, 0));
|
||||||
P_TileKind tile_tr = tiles.Load(Vec3(tile_pos.x + 1, tile_pos.y - 1, 0));
|
P_TileKind tile_tr = tiles.Load(Vec3(tile_pos.x + 0.99, tile_pos.y - 0.99, 0));
|
||||||
P_TileKind tile_br = tiles.Load(Vec3(tile_pos.x + 1, tile_pos.y + 1, 0));
|
P_TileKind tile_br = tiles.Load(Vec3(tile_pos.x + 0.99, tile_pos.y + 0.99, 0));
|
||||||
P_TileKind tile_bl = tiles.Load(Vec3(tile_pos.x - 1, tile_pos.y + 1, 0));
|
P_TileKind tile_bl = tiles.Load(Vec3(tile_pos.x - 0.99, tile_pos.y + 0.99, 0));
|
||||||
P_TileKind tile_t = tiles.Load(Vec3(tile_pos.x, tile_pos.y - 1, 0));
|
P_TileKind tile_t = tiles.Load(Vec3(tile_pos.x, tile_pos.y - 0.99, 0));
|
||||||
P_TileKind tile_r = tiles.Load(Vec3(tile_pos.x + 1, tile_pos.y, 0));
|
P_TileKind tile_r = tiles.Load(Vec3(tile_pos.x + 0.99, tile_pos.y, 0));
|
||||||
P_TileKind tile_b = tiles.Load(Vec3(tile_pos.x, tile_pos.y + 1, 0));
|
P_TileKind tile_b = tiles.Load(Vec3(tile_pos.x, tile_pos.y + 0.99, 0));
|
||||||
P_TileKind tile_l = tiles.Load(Vec3(tile_pos.x - 1, tile_pos.y, 0));
|
P_TileKind tile_l = tiles.Load(Vec3(tile_pos.x - 0.99, tile_pos.y, 0));
|
||||||
|
|
||||||
f32 tile_edge_dist = Inf;
|
f32 tile_edge_dist = Inf;
|
||||||
P_TileKind edge_tile = tile;
|
P_TileKind edge_tile = tile;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ PixelShader(PT_BlitPS, PT_BlitPSOutput, PT_BlitPSInput input)
|
|||||||
u32 noise_val = noise[noise_coord];
|
u32 noise_val = noise[noise_coord];
|
||||||
|
|
||||||
Vec4 result = tex_col;
|
Vec4 result = tex_col;
|
||||||
result.r = (f32)noise_val / (f32)U16Max;
|
result.r = Norm16(noise_val);
|
||||||
|
|
||||||
PT_BlitPSOutput output;
|
PT_BlitPSOutput output;
|
||||||
output.sv_target0 = result;
|
output.sv_target0 = result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user