Skip to content

Commit

Permalink
Merge pull request #74 from scallyw4g/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
scallyw4g authored Aug 31, 2024
2 parents a7055ac + 061fbb1 commit 04e9d6e
Show file tree
Hide file tree
Showing 362 changed files with 5,481 additions and 11,624 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
run: sudo apt update && sudo apt install freeglut3-dev libx11-dev clang-15
- name: Build
run: ./make.sh
- name: Test
run: ./make.sh RunTests

build-and-release-ubuntu-20:
runs-on: ubuntu-20.04
Expand All @@ -30,6 +32,8 @@ jobs:
run: sudo apt update && sudo apt install freeglut3-dev libx11-dev clang
- name: Build
run: ./make.sh
- name: Test
run: ./make.sh RunTests
- name: Tar
if: startsWith(github.ref, 'refs/tags/')
run: ./make.sh BundleRelease
Expand Down Expand Up @@ -57,6 +61,9 @@ jobs:
- name: Build
shell: bash
run: ./make.sh
- name: Test
shell: bash
run: ./make.sh RunTests
- name: Tar
if: startsWith(github.ref, 'refs/tags/')
shell: bash
Expand Down
42 changes: 42 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
* 1.6.1

- Change untextured_3d_geometry_buffer to have a `data_type Type`
This is a pretty major internal change. untextured_3d_geometry_buffers can
now switch between 32-bit float and 8-bit int. When loading a model from
disk, the size of the model is taken into account and the appropriate type
is chosen dynamically.

This required a fair rewrite of the low-level vertex buffering routines to
be able to handle the permutations. This is still somewhat of a WIP; I
didn't finish all of them and the ones not done fall-back to the most
general routine, which is the slowest. I expect I'll rewrite/delete this
code again before performance in that code is the biggest problem I have.

- Change world updates to happen in serial on a dedicated thread
Previous to this, multiple world updates could be in-flight at any given
time, which if overlapping would stomp on each other. Serializing updates
onto a single thread ensures that:
a) Updates are correct
b) Updates happen in the order they were issued
c) Chunks affected by multiple updates on a single frame only have their
mesh rebuilt once

(c) is accomplished by completing all queued update jobs and then issuing
the chunk mesh rebuild jobs, one per unique chunk updated.

- Add ability to create new assets from a world selection and serialize `.chunk` assets to disk
The selection region is saved out as a world_chunk

- Add ability to load asset `.chunk`s from disk

- Add abiltiy to render AssetType_WorldChunk

- Fix layered brush previews crashing the program

- Fix crash in AreEqual if null pointers were passed

- Fixed failing tests, added test runs to CI/CD




* 1.6.0

- Renderer now lives on its own thread.
Expand Down
14 changes: 7 additions & 7 deletions examples/tools/voxel_synthesis_rule_baker/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ BONSAI_API_MAIN_THREAD_INIT_CALLBACK()
Asset->LoadState = AssetLoadState_Loaded;

model *Model = Allocate(model, Resources->GameMemory, 1);
untextured_3d_geometry_buffer *Mesh = AllocateTempMesh(Resources->GameMemory);
untextured_3d_geometry_buffer *Mesh = AllocateTempMesh(Resources->GameMemory, DataType_v3);
AtomicReplaceMesh(&Model->Meshes, MeshBit_Lod0, Mesh, __rdtsc());

Asset->Models.Start = Model;
Expand All @@ -849,12 +849,12 @@ BONSAI_API_MAIN_THREAD_INIT_CALLBACK()
/* TempMemory, */
/* VoxData->Palette ); */

BuildWorldChunkMeshFromMarkedVoxels_Greedy( ChunkData->Voxels,
ChunkData->Dim,
VoxOffset, VoxOffset+Global_TileDim,
Model->Meshes.E[0],
0,
GetTranArena() );
BuildWorldChunkMeshFromMarkedVoxels_Greedy_v3( ChunkData->Voxels,
ChunkData->Dim,
VoxOffset, VoxOffset+Global_TileDim,
Model->Meshes.E[0],
0,
GetTranArena() );


/* BuildWorldChunkMesh_DebugVoxels( ChunkData->Voxels, */
Expand Down
8 changes: 4 additions & 4 deletions examples/transparency/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ SpawnFireEmitters(entity_block_array *Entities, b32 Colorful = False)
}

link_internal void
SpawnLineOfEntities(entity **EntityTable, entity_block_array *Storage, v3 BaseP, v3 Offset, s32 Count)
SpawnLineOfEntities(entity **EntityTable, entity_block_array *Storage, v3 BaseP, v3 Stride, s32 Count)
{
RangeIterator(Index, Count)
{
entity *E = TryGetFreeEntityPtr(EntityTable);
Assert(E);

E->P.Offset = BaseP + (Offset*r32(Index));
E->P.Offset = BaseP + (Stride*r32(Index));
SpawnEntity(E);
Push(Storage, E);
}
Expand All @@ -101,7 +101,7 @@ BONSAI_API_MAIN_THREAD_INIT_CALLBACK()
GameState = Allocate(game_state, Resources->GameMemory, 1);

s32 EmitterCount = 6;
v3 xStride = V3(24, 0, 0);
v3 xStride = V3(32, 0, 0);


{
Expand All @@ -124,7 +124,7 @@ BONSAI_API_MAIN_THREAD_INIT_CALLBACK()

{
s32 yAt = 16;
SpawnLineOfEntities(EntityTable, &GameState->SplosionEmitters, V3(-32, yAt, 4), xStride, EmitterCount);
SpawnLineOfEntities(EntityTable, &GameState->SplosionEmitters, V3(-32, yAt, 6), xStride, EmitterCount);
SpawnSplosionEmitters(&GameState->SplosionEmitters);
}

Expand Down
2 changes: 1 addition & 1 deletion generated/anonymous_function_ui_render_command_RuTTrHiW.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// external/bonsai_stdlib/src/ui/ui.cpp:2210:0
// external/bonsai_stdlib/src/ui/ui.cpp:2260:0

case type_ui_render_command_window_start:
{
Expand Down
2 changes: 1 addition & 1 deletion generated/anonymous_input_Lwen2qoF.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// external/bonsai_stdlib/src/ui/ui.cpp:3159:0
// external/bonsai_stdlib/src/ui/ui.cpp:3228:0

if (Input->Dot.Clicked)
{
Expand Down
2 changes: 1 addition & 1 deletion generated/anonymous_render_settings_0_wwLVyABc.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// src/engine/serdes.cpp:387:0
// src/engine/serdes.cpp:392:0

E1->UseSsao = E0->UseSsao;
E1->UseShadowMapping = E0->UseShadowMapping;
Expand Down
2 changes: 1 addition & 1 deletion generated/anonymous_ui_render_command_nKuoMe2B.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// external/bonsai_stdlib/src/ui/ui.cpp:2163:0
// external/bonsai_stdlib/src/ui/ui.cpp:2213:0

case type_ui_render_command_window_start:
{
Expand Down
17 changes: 12 additions & 5 deletions generated/are_equal_bonsai_type_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
link_internal b32
AreEqual(bonsai_type_info *Thing1, bonsai_type_info *Thing2)
{
b32 Result = True;
Result &= AreEqual(Thing1->Name, Thing2->Name);
if (Thing1 && Thing2)
{
b32 Result = True;
Result &= AreEqual(Thing1->Name, Thing2->Name);

Result &= AreEqual(Thing1->Version, Thing2->Version);
Result &= AreEqual(Thing1->Version, Thing2->Version);

Result &= AreEqual(Thing1->SizeOfInBytes, Thing2->SizeOfInBytes);
Result &= AreEqual(Thing1->SizeOfInBytes, Thing2->SizeOfInBytes);

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
13 changes: 10 additions & 3 deletions generated/are_equal_brush_settings.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// src/engine/editor.h:887:0
// src/engine/editor.h:891:0

link_internal b32
AreEqual(brush_settings *Thing1, brush_settings *Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( brush_settings ) );
if (Thing1 && Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( brush_settings ) );

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
11 changes: 9 additions & 2 deletions generated/are_equal_debug_profile_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
link_internal b32
AreEqual(debug_profile_scope *Thing1, debug_profile_scope *Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( debug_profile_scope ) );
if (Thing1 && Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( debug_profile_scope ) );

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
17 changes: 12 additions & 5 deletions generated/are_equal_file_traversal_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
link_internal b32
AreEqual(file_traversal_node *Thing1, file_traversal_node *Thing2)
{
b32 Result = True;
Result &= AreEqual(Thing1->Type, Thing2->Type);
if (Thing1 && Thing2)
{
b32 Result = True;
Result &= AreEqual(Thing1->Type, Thing2->Type);

Result &= AreEqual(Thing1->Dir, Thing2->Dir);
Result &= AreEqual(Thing1->Dir, Thing2->Dir);

Result &= AreEqual(Thing1->Name, Thing2->Name);
Result &= AreEqual(Thing1->Name, Thing2->Name);

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
11 changes: 9 additions & 2 deletions generated/are_equal_memory_arena_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
link_internal b32
AreEqual(memory_arena_stats *Thing1, memory_arena_stats *Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( memory_arena_stats ) );
if (Thing1 && Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( memory_arena_stats ) );

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
13 changes: 10 additions & 3 deletions generated/are_equal_perlin_noise_params.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// src/engine/editor.h:653:0
// src/engine/editor.h:657:0

link_internal b32
AreEqual(perlin_noise_params *Thing1, perlin_noise_params *Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( perlin_noise_params ) );
if (Thing1 && Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( perlin_noise_params ) );

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
11 changes: 9 additions & 2 deletions generated/are_equal_rect3cp.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
link_internal b32
AreEqual(rect3cp *Thing1, rect3cp *Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( rect3cp ) );
if (Thing1 && Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( rect3cp ) );

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
27 changes: 17 additions & 10 deletions generated/are_equal_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@
link_internal b32
AreEqual(texture *Thing1, texture *Thing2)
{
b32 Result = True;
Result &= AreEqual(Thing1->ID, Thing2->ID);
if (Thing1 && Thing2)
{
b32 Result = True;
Result &= AreEqual(Thing1->ID, Thing2->ID);

Result &= AreEqual(Thing1->Dim, Thing2->Dim);
Result &= AreEqual(Thing1->Dim, Thing2->Dim);

Result &= AreEqual(Thing1->Slices, Thing2->Slices);
Result &= AreEqual(Thing1->Slices, Thing2->Slices);

Result &= AreEqual(Thing1->Channels, Thing2->Channels);
Result &= AreEqual(Thing1->Channels, Thing2->Channels);

Result &= AreEqual(Thing1->IsDepthTexture, Thing2->IsDepthTexture);
Result &= AreEqual(Thing1->IsDepthTexture, Thing2->IsDepthTexture);

Result &= AreEqual(Thing1->Format, Thing2->Format);
Result &= AreEqual(Thing1->Format, Thing2->Format);

Result &= AreEqual(Thing1->DebugName, Thing2->DebugName);
Result &= AreEqual(Thing1->DebugName, Thing2->DebugName);

Result &= AreEqual(Thing1->Queued, Thing2->Queued);
Result &= AreEqual(Thing1->Queued, Thing2->Queued);

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
13 changes: 10 additions & 3 deletions generated/are_equal_ui_toggle.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// external/bonsai_stdlib/src/ui/ui.h:114:0
// external/bonsai_stdlib/src/ui/ui.h:143:0

link_internal b32
AreEqual(ui_toggle *Thing1, ui_toggle *Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( ui_toggle ) );
if (Thing1 && Thing2)
{
b32 Result = MemoryIsEqual((u8*)Thing1, (u8*)Thing2, sizeof( ui_toggle ) );

return Result;
return Result;
}
else
{
return (Thing1 == Thing2);
}
}

link_internal b32
Expand Down
Loading

0 comments on commit 04e9d6e

Please sign in to comment.