From 9fd62895c7218e1e456906e78b188721e7a6b114 Mon Sep 17 00:00:00 2001 From: a pirate Date: Sun, 1 Sep 2024 13:10:01 -0700 Subject: [PATCH 1/9] Clean out some dead code, fix a couple minor bugs --- CHANGELOG.txt | 2 + external/bonsai_stdlib | 2 +- generated/gen_rect_helpers_rect2_v2.h | 3 +- generated/gen_rect_helpers_rect3_v3.h | 3 +- generated/gen_rect_helpers_rect3i_v3i.h | 3 +- ...ent_buffer_untextured_3d_geometry_buffer.h | 4 +- jesse.bonsai.rdbg | Bin 14073 -> 13194 bytes src/engine/editor.cpp | 161 ++++++++---------- src/engine/editor.h | 3 +- src/engine/render.cpp | 83 --------- src/engine/render_command.cpp | 16 -- 11 files changed, 80 insertions(+), 200 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a5c7ce152..b90ed9b04 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,8 @@ * Fix v3_u8 normal data being incorrectly encoded on negative edge +* Fix a frame of lag when changing the selection region with a brush active + * 1.6.1 - Change untextured_3d_geometry_buffer to have a `data_type Type` diff --git a/external/bonsai_stdlib b/external/bonsai_stdlib index 5663e381f..81a7f044f 160000 --- a/external/bonsai_stdlib +++ b/external/bonsai_stdlib @@ -1 +1 @@ -Subproject commit 5663e381f7e44e68f154bfb2a5b1274e8f9224fc +Subproject commit 81a7f044ff16bd9212cf2e5b03b25d19c3d6a6de diff --git a/generated/gen_rect_helpers_rect2_v2.h b/generated/gen_rect_helpers_rect2_v2.h index 310f3cb23..0d2330f80 100644 --- a/generated/gen_rect_helpers_rect2_v2.h +++ b/generated/gen_rect_helpers_rect2_v2.h @@ -1,4 +1,4 @@ -// external/bonsai_stdlib/src/rect.h:106:0 +// external/bonsai_stdlib/src/rect.h:129:0 link_internal rect2 RectMinMax(v2 Min, v2 Max) @@ -53,3 +53,4 @@ IsInside(v2 P, rect2 Rect) return Result; } + diff --git a/generated/gen_rect_helpers_rect3_v3.h b/generated/gen_rect_helpers_rect3_v3.h index f28411a38..8582f5106 100644 --- a/generated/gen_rect_helpers_rect3_v3.h +++ b/generated/gen_rect_helpers_rect3_v3.h @@ -1,4 +1,4 @@ -// external/bonsai_stdlib/src/rect.h:110:0 +// external/bonsai_stdlib/src/rect.h:133:0 link_internal rect3 RectMinMax(v3 Min, v3 Max) @@ -53,3 +53,4 @@ IsInside(v3 P, rect3 Rect) return Result; } + diff --git a/generated/gen_rect_helpers_rect3i_v3i.h b/generated/gen_rect_helpers_rect3i_v3i.h index 8626c3fa0..20d2de808 100644 --- a/generated/gen_rect_helpers_rect3i_v3i.h +++ b/generated/gen_rect_helpers_rect3i_v3i.h @@ -1,4 +1,4 @@ -// external/bonsai_stdlib/src/rect.h:113:0 +// external/bonsai_stdlib/src/rect.h:136:0 link_internal rect3i RectMinMax(v3i Min, v3i Max) @@ -53,3 +53,4 @@ IsInside(v3i P, rect3i Rect) return Result; } + diff --git a/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h b/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h index d9b8eff9c..cb04d88d3 100644 --- a/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h +++ b/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h @@ -1,4 +1,4 @@ -// src/engine/render.cpp:1041:0 +// src/engine/render.cpp:1039:0 link_internal void @@ -39,7 +39,6 @@ SyncGpuBuffersAsync(engine_resources *Engine, lod_element_buffer *Meshes) untextured_3d_geometry_buffer *Mesh = AtomicReplaceMesh( Meshes, MeshBit, 0, u64_MAX ); if (Mesh && Mesh->At) { - Handles->Flags |= GpuHandles_UpdatePending; PushReallocateBuffersCommand(&Engine->Stdlib.Plat.RenderQ, Handles, Mesh); Result = True; } @@ -70,7 +69,6 @@ SyncGpuBuffersImmediate(engine_resources *Engine, lod_element_buffer *Meshes) { if (Mesh->At) { - Handles->Flags |= GpuHandles_UpdatePending; // NOTE(Jesse): Kinda dumb, but this has to be set at the moment.. ReallocateAndSyncGpuBuffers(Handles, Mesh); Result = True; } diff --git a/jesse.bonsai.rdbg b/jesse.bonsai.rdbg index 3308eadee36fe388d6c4c168fe8a81b5f5ec4e83..7a9a746124cfd2a88696dedd6bd4d3516eae47a3 100644 GIT binary patch delta 1958 zcmYjSNo*Ts6wdE$yv24F$JuSiS!~A{$8nRUZbERHv?VlclM1z<7H48lGN#@#w!0uz zlmiF2gz{au5ld8v1Ef{Yw26?AIF&|7NJUVg9*{V-2ZXpF-uzAiBaP-?-uk`oz4<%; z(fY@y4ciS34e+xt?zv5tYAGXCWKo&G?pV~wclg>9wUreqBdcP%R9ePHG=wX$2;#92 zN&^-+WBu$bc6C9V8V#`(_!}emJ$e+S=mLx5Nqfjrmes73%f2h)g*SkefDP?YKWgG4 z^aEb(i0zJ5wOUqEIq4=jQBL6fkqIn{F2wx&8ccNK_Q(R#Ltgl-UB*H&Tb2=vP2uNZ z8^n<&)P_U&!rFtqhzCEkhw(vV5p%Sz4PRjwP!rA?*0MQL;r_cYG2F`Lxtl-2&Fmrx zT*OOnpB4+|!mW4`n&Qs2ShqucWJ1etbI<`f}icv7s^e+rmbIC?i7(_G|gsEAov> zRh2co>&R{nh7cG$L6|4-josmt3+vf}oXW_n)pb#sr}&TI;eZoKYu(XPlY_8l11Ir8 zYr<5L)m*lKXfPsFWL1@Dz3mZkzF&YiG(ul9RvQ!O?6>1i;2e^H^DNEF{FS{IeE~0f zi)VAUZ~UMFLN$B2niUl=?$Ci?UkfI>cy$C-PFF-Fp_Lv{dka$t$}@P`n=n-rRhBZS z`OaX&cZ8A;TjWf(Qlz4v;yH-EChXb5h{i3Lw?{E*wHeoQqOw4@BED;LIf`Sgm9;Gh|9eQ*|6N%reOeIr!*vo1rdx#SrHRcgzx_ zV;ZZ?x$L?^&=O@DBi5X(mQvT^TEEnUaa?L|qEKpr4@HL=uJ&d;@EjrLX?3+3$o(u` zCa~hMkuMF+HV^S7pe5@fWc_%fZI)ERc)iW4MPR@A}8xgLiHmY(}MoREQ14h^CX5$>b z?^~SvK(2I|aL+%Fw_8l4rEzGBPI_rK!FRtlyRa4v;nU`B?qzyFz>as=nl9$ZGv&Fs zPhA(DH+hKA^$b63@=;Bu^yT;%9=jGe?!R~h9T87!?OU!s=v_-}>45jP>qRw}Nu`x) z;VM=d{d_ch=5!v;qzg_rSjPwir<)?zdit@$MmD@yv08E65oDM4ZFzCr(ZWs==*JxC zVxe5j$*H`QR*Pjae432R=*Q}iS@Kdv&E61|i~FjvdaZ1nd6(<_WA-`fkvJZNHCGng zxB0PTo2<{;#=}0~-6086dSb}_csxRkoZfE&KXKQ~i$H+eQ|V$pFBLLeNu%ksWr${i z7o$2W{xbJqOL&vU-VBpCTH2(Y6})VLh&YU=ratU?!RTyt~KiY2_WCZj=~KT|05oM-2L!T#AJG>Luxj zDV(@T+8_baT0ThXqDAA+ra)T<2Ktc%McjVaKtGb8D1xAH;-DY>Xp5$SfBIv0b}uE{ zK+y|a^6t*;?97=nv-|4Ce`@C+v0Ulv>zhVAny_iD7H_NNui@Wp3fEY~wKtoapUci> z=C>y=#$6bl8O3Ea2TeV~xKw?2`a!%leHwmi0{V1})xgqKQzwUJy3F!Dl^kxT+PILa z;}6LMKC=!upK0jTV!lxB)KB9#<`goib^Iea3_YE|50cAxF_d(isx}%mwa{#q4Kpdv zeak*hMO?Y;?EJ#Q-u?U3@*z@6!Im6jnpD4(SYi*-R~kIwXUDO%Cw3u`Glcy$-YUa0 z9lFop?DP<;(uxFrmUb-P<6*wqDCT*U*Lc01Kh-IfxSqdPyulka-qyQ4nOZ&|J^209 zC_5}YI5RcQPRO};r-z6C&r;m6#?c&c;-*`{@|24$3BU1$Z&!a!E0yrWJ*(`S($J;E zD7t&XJ0W`59FB~n@wZ7gzCW46nk$a;<5m{ z4DVumjH!~Cgn6aiRm+I`gcS!O@hC2MjPDzv{b8K)QT_#OCpY!JcNQ9&O#V|J{C z7L`Jy+R$6j>?yn$9YHL*h^wPX$C<_^ujWfyfy3urvI<71W%8cD5#YZWak71KbTZ<> zt;wiNOFR;y#q(^hl>B|viIvc@(rW8mt5K+Na%32*qc&olFmz``VUPA0up1wYC^$N@ zV8mrFXf>{DYFS1}nif3oo>q)mEQeO?rAn2HgdM({Bfl4=VIR9EYkr5KH7kN~lHa@W z>24<>wJ7p^I{%#x?{GZlR-HW*$=rfWRcN;#Z<_^hVfmj``_4=x!w*!s2NkiA0SVQlwF z$Rl`-Uxh@L56GA+^-8;lHf7TnsFC&ZnI@J*YbbtuI z#=a%dJ>l8M3Zj4z@k74>&uuyU%j#!O86~wKQ?uqWTG*o`I3#=3Z6!$7WYwv7PqD$PoWK>! z2`ZmwaM}`P$4KoUf)*boZ_!q7R9ajmI>ycO_-=n-rzy_#ho}q0>mw@BVqSoeOQmmIPm&!e~Q|^Ba2$>-j75}_( zQ=#3THud#cNutoZCay0}3JaU!rz?J*^==D{JsvM>O&;E!Q@Offset.Min); Region.Max += V3(Settings->Offset.Max); - // NOTE(Jesse): Took these out because they screw up a rect that's - // negatively dialated (min(1) max(-1)) .. you end up with a dim of 1 - // which is clearly wrong.. + Sanitize(&Region); + Shape->Rect.Region.Min = Min(Region.Min, Region.Max); Shape->Rect.Region.Max = Max(Region.Min, Region.Max); - /* Shape->Rect.Region = Region; */ - /* Assert(GetDim(Shape->Rect.Region) == V3(RequiredLayerDim)); */ + Assert(GetDim(Shape->Rect.Region) == V3(RequiredLayerDim)); Assert(Chunk->Dim == RequiredLayerDim); - ApplyBrushLayer(Engine, Layer, Chunk, Settings->Offset.Min); - FinalizeChunkInitialization(Chunk); - QueueChunkForMeshRebuild(&Plat->LowPriority, Chunk); } break; case ShapeType_Sphere: @@ -1096,11 +1091,16 @@ CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, br Shape->Sphere.Radius = MaxSphereRadius; Shape->Sphere.Location = Canonical_Position(V3(MaxSphereRadius), {}); + } break; + } + + if (LengthSq(GetShapeDim(Shape)) > 0) + { ApplyBrushLayer(Engine, Layer, Chunk, Settings->Offset.Min); FinalizeChunkInitialization(Chunk); QueueChunkForMeshRebuild(&Plat->LowPriority, Chunk); - } break; } + } break; case BrushLayerType_Noise: @@ -1706,10 +1706,11 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti { world_chunk *Root_LayeredBrushPreview = &LayeredBrush->Preview.Chunk; + Assert( (Root_LayeredBrushPreview->Flags&Chunk_Queued) == False ); // // TODO(Jesse)(async, speed): It would be kinda nice if this ran async.. - if ( Editor->RootChunkNeedsNewMesh && (Root_LayeredBrushPreview->Flags&Chunk_Queued) == 0 ) + if ( Editor->RootChunkNeedsNewMesh ) { // First find the largest total dimension of all the layers, and the // largest negative minimum offset. We need this min offset such @@ -1750,9 +1751,7 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti ApplyBrushLayer(Engine, Layer, Root_LayeredBrushPreview, SmallestMinOffset); } - FinalizeChunkInitialization(Root_LayeredBrushPreview); // TODO(Jesse): @duplicate_finalize_chunk_init - - Assert( (Root_LayeredBrushPreview->Flags&Chunk_Queued) == False ); + FinalizeChunkInitialization(Root_LayeredBrushPreview); { auto Thread = GetThreadLocalState(ThreadLocal_ThreadIndex); @@ -1764,18 +1763,16 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti RebuildWorldChunkMesh(Thread, Chunk, {}, Chunk->Dim, MeshBit_Lod0, TempMesh, Thread->TempMemory); } - //NOTE(Jesse): Not sure what this was for.. - /* FinalizeChunkInitialization(Root_LayeredBrushPreview); // TODO(Jesse): @duplicate_finalize_chunk_init */ - Editor->RootChunkNeedsNewMesh = False; Editor->NextSelectionRegionMin = Editor->MostRecentSelectionRegionMin; + + if (SyncGpuBuffersAsync(Engine, &Root_LayeredBrushPreview->Meshes)) + { + Editor->EditorPreviewRegionMin = Editor->NextSelectionRegionMin; + } } - if (SyncGpuBuffersAsync(Engine, &Root_LayeredBrushPreview->Meshes)) - { - Editor->EditorPreviewRegionMin = Editor->NextSelectionRegionMin; - } } } @@ -2070,28 +2067,6 @@ DoWorldEditor(engine_resources *Engine) CurrentRef = WorldEditBrushTypeButtonGroup.UiRef; } - /* if (Editor->Tool == WorldEdit_Tool_Select) */ - /* { */ - /* PushTableStart(Ui, Position_RightOf, CurrentRef); */ - /* DoEditorUi(Ui, &Window, &Editor->SelectionFollowsCursor, CSz("SelectionFollowsCursor"), &Params); */ - /* PushTableEnd(Ui); */ - /* PushNewRow(Ui); */ - /* } */ - - /* if (Editor->Tool == WorldEdit_Tool_Brush) */ - /* { */ - /* Params.RelativePosition.Position = Position_RightOf; */ - /* Params.RelativePosition.RelativeTo = CurrentRef; */ - /* WorldEditModeButtonGroup = DoEditorUi(Ui, &Window, &Editor->Params.Mode, CSz("Mode"), &Params, ToggleButtonGroupFlags_DrawVertical); */ - /* CurrentRef = WorldEditModeButtonGroup.UiRef; */ - /* } */ - - /* if (Editor->Tool == WorldEdit_Tool_Brush) */ - /* { */ - /* Params = DefaultUiRenderParams_Generic; */ - /* WorldEditModifierButtonGroup = DoEditorUi(Ui, &Window, &Editor->Params.Modifier, CSz(""), &Params, ToggleButtonGroupFlags_DrawVertical); */ - /* } */ - PushTableEnd(Ui); @@ -2177,8 +2152,6 @@ DoWorldEditor(engine_resources *Engine) } } - DoBrushSettingsWindow(Engine, Editor->Tool, Editor->BrushType); - // // // Edit tool interactions in the world @@ -2310,63 +2283,20 @@ DoWorldEditor(engine_resources *Engine) } } break; - /* case WorldEdit_BrushType_Shape: */ - /* case WorldEdit_BrushType_Noise: */ case WorldEdit_BrushType_Layered: { if (AABBTest.Face && InputStateIsValidToApplyEdit(Input)) { - world_chunk *Chunk = 0; v3i Offset = V3i(s32_MAX); - switch (Editor->BrushType) - { - InvalidCase(WorldEdit_BrushType_Disabled); - InvalidCase(WorldEdit_BrushType_Selection); - InvalidCase(WorldEdit_BrushType_Single); - InvalidCase(WorldEdit_BrushType_Asset); - InvalidCase(WorldEdit_BrushType_Entity); - - case WorldEdit_BrushType_Layered: - { - Chunk = &Editor->LayeredBrushEditor.Preview.Chunk; - RangeIterator(LayerIndex, Editor->LayeredBrushEditor.LayerCount) - { - brush_layer *Layer = Editor->LayeredBrushEditor.Layers + LayerIndex; - Offset = Min(Layer->Settings.Offset.Min, Offset); - } - - } break; + world_chunk *Chunk = &Editor->LayeredBrushEditor.Preview.Chunk; -#if 0 - case WorldEdit_BrushType_Noise: - { - Chunk = &Editor->Noise.Preview.Chunk; - Offset = Editor->Noise.Settings.Offset.Min; - } break; - - case WorldEdit_BrushType_Shape: - { - Chunk = &Editor->Shape.Preview.Chunk; - - switch (Editor->Shape.Settings.Shape.Type) - { - case ShapeType_None: { InvalidCodePath(); } break; - - case ShapeType_Sphere: - { - Offset = V3i(V3(GetSelectionDim(World, Editor))/2.f - V3(Editor->Shape.Settings.Shape.Sphere.Radius)); - } break; - - case ShapeType_Rect: - { - Offset = {}; - } break; - } - } break; -#endif + // TODO(Jesse): Call GetSmallestMinOffset here + RangeIterator(LayerIndex, Editor->LayeredBrushEditor.LayerCount) + { + brush_layer *Layer = Editor->LayeredBrushEditor.Layers + LayerIndex; + Offset = Min(Layer->Settings.Offset.Min, Offset); } - chunk_data D = {Chunk->Flags, Chunk->Dim, Chunk->Voxels, Chunk->VoxelLighting}; world_update_op_shape_params_chunk_data ChunkDataShape = { D, V3(Offset) + GetSimSpaceP(World, Editor->SelectionRegion.Min) }; @@ -2500,6 +2430,15 @@ DoWorldEditor(engine_resources *Engine) } + // NOTE(Jesse): This has to come after the tool interactions because of a trivial + // but important interaction. If there's a previous tool to pop back to, we + // need to do that pop back before the brush settings get updated and the + // brush preview gets drawn or else when we pop back the settings window thinks + // the Select tool is active, doesn't update any of the brush stuff, then + // the preview gets drawn because we pop back to the Layered brush tool and + // there's a frame of lag. + DoBrushSettingsWindow(Engine, Editor->Tool, Editor->BrushType); + // @@ -2571,3 +2510,39 @@ DoWorldEditor(engine_resources *Engine) DEBUG_HighlightVoxel( Engine, HotVoxel, RED, 0.075f); } } + +link_internal void +DrawEditorPreview(engine_resources *Engine, shader *Shader) +{ + UNPACK_ENGINE_RESOURCES(Engine); + + world_chunk *Chunk = {}; + v3 Basis = {}; + + switch (Editor->Tool) + { + case WorldEdit_Tool_Brush: + { + switch (Editor->BrushType) + { + case WorldEdit_BrushType_Layered: + { + layered_brush_editor *LayeredBrushEditor = &Editor->LayeredBrushEditor; + v3i SmallestMinOffset = GetSmallestMinOffset(LayeredBrushEditor); + Chunk = &LayeredBrushEditor->Preview.Chunk; + Basis = V3(SmallestMinOffset) + GetRenderP(Engine, Editor->EditorPreviewRegionMin); + } break; + + default: {} break; + } + } break; + + default: {} break; + } + + if (Chunk) + { + DrawLod(Engine, Shader, &Chunk->Meshes, 0.f, Basis); + } +} + diff --git a/src/engine/editor.h b/src/engine/editor.h index aca89ead9..2f020c84c 100644 --- a/src/engine/editor.h +++ b/src/engine/editor.h @@ -1128,4 +1128,5 @@ ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, world_chunk *DestC link_internal v3i GetSmallestMinOffset(layered_brush_editor *LayeredBrush, v3i *LargestLayerDim = 0); - +link_internal void +DrawEditorPreview(engine_resources *Engine, shader *Shader); diff --git a/src/engine/render.cpp b/src/engine/render.cpp index 4c8dfeaa2..6e7e68a3f 100644 --- a/src/engine/render.cpp +++ b/src/engine/render.cpp @@ -979,7 +979,6 @@ poof( (buffer_t.name) *Mesh = AtomicReplaceMesh( Meshes, MeshBit, 0, u64_MAX ); if (Mesh && Mesh->At) { - Handles->Flags |= GpuHandles_UpdatePending; PushReallocateBuffersCommand(&Engine->Stdlib.Plat.RenderQ, Handles, Mesh); Result = True; } @@ -1010,7 +1009,6 @@ poof( { if (Mesh->At) { - Handles->Flags |= GpuHandles_UpdatePending; // NOTE(Jesse): Kinda dumb, but this has to be set at the moment.. ReallocateAndSyncGpuBuffers(Handles, Mesh); Result = True; } @@ -1044,13 +1042,10 @@ poof(gpu_buffer(lod_element_buffer, untextured_3d_geometry_buffer)) link_internal void ReallocateAndSyncGpuBuffers(gpu_element_buffer_handles *Handles, untextured_3d_geometry_buffer *Mesh) { - Assert(Handles->Flags & GpuHandles_UpdatePending); - if (Handles->VertexHandle) { GL.DeleteBuffers(3, &Handles->VertexHandle); } - UnsetBitfield(u16, Handles->Flags, GpuHandles_UpdatePending); Clear(Handles); AllocateGpuElementBuffer(Handles, Mesh->Type, Mesh->At); @@ -1144,7 +1139,6 @@ DrawLod(engine_resources *Engine, shader *Shader, lod_element_buffer *Meshes, r3 AssertNoGlErrors; auto MeshBit = MeshBit_None; -#if 1 if (DistanceSquared > Square(400*32)) { if (HasGpuMesh(Meshes, MeshBit_Lod4)) { MeshBit = MeshBit_Lod4; } @@ -1165,13 +1159,6 @@ DrawLod(engine_resources *Engine, shader *Shader, lod_element_buffer *Meshes, r3 { if (HasGpuMesh(Meshes, MeshBit_Lod0)) { MeshBit = MeshBit_Lod0; } } -#else - /* if (HasGpuMesh(Meshes, MeshBit_Lod4)) { MeshBit = MeshBit_Lod4; } */ - /* if (HasGpuMesh(Meshes, MeshBit_Lod3)) { MeshBit = MeshBit_Lod3; } */ - /* if (HasGpuMesh(Meshes, MeshBit_Lod2)) { MeshBit = MeshBit_Lod2; } */ - /* if (HasGpuMesh(Meshes, MeshBit_Lod1)) { MeshBit = MeshBit_Lod1; } */ - if (HasGpuMesh(Meshes, MeshBit_Lod0)) { MeshBit = MeshBit_Lod0; } -#endif if (MeshBit != MeshBit_None) { @@ -1551,76 +1538,6 @@ DrawWorld(engine_resources *Engine, v2i ApplicationResolution) } #endif -link_internal void -DrawEditorPreview(engine_resources *Engine, shader *Shader) -{ - UNPACK_ENGINE_RESOURCES(Engine); - - world_chunk *Chunk = {}; - v3 Basis = {}; - - switch (Editor->Tool) - { - case WorldEdit_Tool_Brush: - { - switch (Editor->BrushType) - { -#if 0 - case WorldEdit_BrushType_Noise: - { - Chunk = &Editor->Noise.Preview.Chunk; - Basis = GetRenderP(Engine, Editor->SelectionRegion.Min); - } break; - - case WorldEdit_BrushType_Shape: - { - Chunk = &Editor->Shape.Preview.Chunk; - switch (Editor->Shape.Settings.Shape.Type) - { - case ShapeType_None: {} break; - - case ShapeType_Rect: - { - Basis = GetRenderP(Engine, Editor->SelectionRegion.Min); - } break; - - case ShapeType_Sphere: - { - world_update_op_shape_params_sphere *Sphere = &Editor->Shape.Settings.Shape.Sphere; - cp Location = Canonicalize(World, Editor->SelectionRegion.Min + (GetDim(World, Editor->SelectionRegion)/2.f) - V3(Sphere->Radius)); - Location.Offset = Floor(Location.Offset); - Basis = GetRenderP(Engine, Location); - } break; - } - } break; -#endif - - case WorldEdit_BrushType_Layered: - { - layered_brush_editor *LayeredBrushEditor = &Editor->LayeredBrushEditor; - v3i SmallestMinOffset = GetSmallestMinOffset(LayeredBrushEditor); - Chunk = &LayeredBrushEditor->Preview.Chunk; - Basis = V3(SmallestMinOffset) + GetRenderP(Engine, Editor->EditorPreviewRegionMin); - /* Basis = V3(SmallestMinOffset) + GetRenderP(Engine, Editor->SelectionRegion.Min); */ - /* Basis = V3(SmallestMinOffset) + GetSimSpaceP(World, Editor->SelectionRegion.Min); */ - /* Basis = V3(SmallestMinOffset) + GetSimSpaceP(World, Editor->EditorPreviewRegionMin); */ - /* Basis = {}; */ - } break; - - default: {} break; - } - } break; - - default: {} break; - } - - if (Chunk) - { - /* SyncGpuBuffersImmediate(Engine, &Chunk->Meshes); */ - DrawLod(Engine, Shader, &Chunk->Meshes, 0.f, Basis); - } -} - link_internal void DrawStuffToGBufferTextures(engine_resources *Engine, v2i ApplicationResolution) { diff --git a/src/engine/render_command.cpp b/src/engine/render_command.cpp index 531129822..f7af231bd 100644 --- a/src/engine/render_command.cpp +++ b/src/engine/render_command.cpp @@ -30,32 +30,16 @@ poof(push_render_command(work_queue_entry__bonsai_render_command)) link_internal void PushDeallocateBuffersCommand(work_queue *RenderQueue, gpu_element_buffer_handles *Handles) { - /* Handles->ElementCount = 0; */ - /* Handles->Mapped = 0; */ - /* Handles->Flags = GpuHandles_UpdatePending; */ - // @vertex_handle_primal if (Handles->VertexHandle) { PushBonsaiRenderCommandDeallocateBuffers(RenderQueue, &Handles->VertexHandle, 3); } Clear(Handles); } -#if 0 -link_internal void -PushReallocateBuffersCommand(work_queue *RenderQueue, gpu_element_buffer_handles *Handles, world_chunk_geometry_buffer *Mesh) -{ - Assert(Mesh->At); - Handles->Flags = GpuHandles_UpdatePending; - work_queue_entry Work = WorkQueueEntry(WorkQueueEntryBonsaiRenderCommand(BonsaiRenderCommandReallocateWorldChunkBuffers(Handles, Mesh))); - PushWorkQueueEntry(RenderQueue, &Work); -} -#endif - link_internal void PushReallocateBuffersCommand(work_queue *RenderQueue, gpu_element_buffer_handles *Handles, untextured_3d_geometry_buffer *Mesh) { Assert(Mesh->Type); Assert(Mesh->At); - Handles->Flags = GpuHandles_UpdatePending; work_queue_entry Work = WorkQueueEntry(WorkQueueEntryBonsaiRenderCommand(BonsaiRenderCommandReallocateBuffers(Handles, Mesh))); PushWorkQueueEntry(RenderQueue, &Work); } From 67288995dc77d2c31bdc1c084136824fe1fd1281 Mon Sep 17 00:00:00 2001 From: a pirate Date: Sun, 1 Sep 2024 15:38:19 -0700 Subject: [PATCH 2/9] Add PersistWhitespace --- generated/are_equal_brush_settings.h | 2 +- .../asyncify_render_function_c_DrawLod.h | 2 +- ...yncify_render_function_c_RenderToTexture.h | 2 +- .../asyncify_render_function_h_DrawLod.h | 2 +- ...yncify_render_function_h_RenderToTexture.h | 2 +- .../d_union_constructors_work_queue_entry.h | 2 +- generated/d_union_work_queue_entry.h | 2 +- generated/default_marshal_brush_settings_0.h | 2 +- generated/default_marshal_brush_settings_1.h | 2 +- .../default_marshal_layered_brush_editor_0.h | 2 +- .../default_marshal_layered_brush_editor_1.h | 2 +- generated/default_marshal_noise_layer_0.h | 2 +- ..._ui_for_compound_type_white_noise_params.h | 61 +++++++++++++++++++ ...or_ui_for_compound_type_world_edit_brush.h | 2 +- ...ditor_ui_for_radio_enum_brush_layer_type.h | 2 +- ...on_pattern_199741702_161749140_632272777.h | 2 +- ..._iteration_pattern_275071431_101859599_0.h | 2 +- ..._iteration_pattern_275071431_785723886_0.h | 2 +- ..._iteration_pattern_846291950_267608728_0.h | 2 +- generated/for_datatypes_0XxWqGSZ.h | 2 +- generated/for_datatypes_fkubhsYl.h | 2 +- generated/for_datatypes_kv3WBTai.h | 2 +- .../rectalinear_iteration_pattern_398799212.h | 2 +- .../rectalinear_iteration_pattern_416827956.h | 2 +- .../rectalinear_iteration_pattern_428632106.h | 4 +- .../rectalinear_iteration_pattern_530902269.h | 2 +- .../rectalinear_iteration_pattern_583358156.h | 2 +- .../rectalinear_iteration_pattern_631222419.h | 2 +- .../rectalinear_iteration_pattern_643608995.h | 2 +- .../rectalinear_iteration_pattern_812652930.h | 2 +- .../rectalinear_iteration_pattern_920026661.h | 2 +- .../rectalinear_iteration_pattern_992879728.h | 2 +- .../rectalinear_iteration_pattern_99934950.h | 2 +- .../string_and_value_tables_shape_type.h | 2 +- src/engine/editor.cpp | 19 +++--- src/engine/editor.h | 10 +-- src/engine/game_effects.cpp | 6 +- src/engine/work_queue.h | 1 + src/engine/world_chunk.cpp | 2 + src/engine/world_update.cpp | 16 ++--- src/engine/world_update.h | 5 +- 41 files changed, 125 insertions(+), 63 deletions(-) create mode 100644 generated/do_editor_ui_for_compound_type_white_noise_params.h diff --git a/generated/are_equal_brush_settings.h b/generated/are_equal_brush_settings.h index 4de40fce1..b499deeab 100644 --- a/generated/are_equal_brush_settings.h +++ b/generated/are_equal_brush_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:903:0 +// src/engine/editor.h:899:0 link_internal b32 AreEqual(brush_settings *Thing1, brush_settings *Thing2) diff --git a/generated/asyncify_render_function_c_DrawLod.h b/generated/asyncify_render_function_c_DrawLod.h index b1f8fce91..43edcbabb 100644 --- a/generated/asyncify_render_function_c_DrawLod.h +++ b/generated/asyncify_render_function_c_DrawLod.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:362:0 +// src/engine/work_queue.h:363:0 link_internal void DrawLod_Async(work_queue *Queue,engine_resources *Engine ,shader *Shader ,lod_element_buffer *Meshes ,r32 DistanceSquared ,v3 Basis ,Quaternion Rotation ,v3 Scale ) diff --git a/generated/asyncify_render_function_c_RenderToTexture.h b/generated/asyncify_render_function_c_RenderToTexture.h index d38878c51..76f870909 100644 --- a/generated/asyncify_render_function_c_RenderToTexture.h +++ b/generated/asyncify_render_function_c_RenderToTexture.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:359:0 +// src/engine/work_queue.h:360:0 link_internal void RenderToTexture_Async(work_queue *Queue,engine_resources *Engine ,asset_thumbnail *Thumb ,lod_element_buffer *Meshes ,v3 Offset ,camera *Camera ) diff --git a/generated/asyncify_render_function_h_DrawLod.h b/generated/asyncify_render_function_h_DrawLod.h index ee15b6b83..15ffc9807 100644 --- a/generated/asyncify_render_function_h_DrawLod.h +++ b/generated/asyncify_render_function_h_DrawLod.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:239:0 +// src/engine/work_queue.h:240:0 struct draw_lod_async_params poof(@async_function_params) { diff --git a/generated/asyncify_render_function_h_RenderToTexture.h b/generated/asyncify_render_function_h_RenderToTexture.h index 148666f74..ea65b2322 100644 --- a/generated/asyncify_render_function_h_RenderToTexture.h +++ b/generated/asyncify_render_function_h_RenderToTexture.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:236:0 +// src/engine/work_queue.h:237:0 struct render_to_texture_async_params poof(@async_function_params) { diff --git a/generated/d_union_constructors_work_queue_entry.h b/generated/d_union_constructors_work_queue_entry.h index ace7a0118..87f5ac584 100644 --- a/generated/d_union_constructors_work_queue_entry.h +++ b/generated/d_union_constructors_work_queue_entry.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:324:0 +// src/engine/work_queue.h:325:0 link_internal work_queue_entry diff --git a/generated/d_union_work_queue_entry.h b/generated/d_union_work_queue_entry.h index 0daf3c79a..fc568a4b5 100644 --- a/generated/d_union_work_queue_entry.h +++ b/generated/d_union_work_queue_entry.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:296:0 +// src/engine/work_queue.h:297:0 enum work_queue_entry_type { diff --git a/generated/default_marshal_brush_settings_0.h b/generated/default_marshal_brush_settings_0.h index a041bc3f3..030a0b5b4 100644 --- a/generated/default_marshal_brush_settings_0.h +++ b/generated/default_marshal_brush_settings_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:961:0 +// src/engine/editor.h:957:0 Live->Type = Stored->Type; diff --git a/generated/default_marshal_brush_settings_1.h b/generated/default_marshal_brush_settings_1.h index 77fca28a3..42399aebb 100644 --- a/generated/default_marshal_brush_settings_1.h +++ b/generated/default_marshal_brush_settings_1.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:954:0 +// src/engine/editor.h:950:0 Live->Type = Stored->Type; diff --git a/generated/default_marshal_layered_brush_editor_0.h b/generated/default_marshal_layered_brush_editor_0.h index 521ced2fe..fa5cb830a 100644 --- a/generated/default_marshal_layered_brush_editor_0.h +++ b/generated/default_marshal_layered_brush_editor_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1027:0 +// src/engine/editor.h:1023:0 Live->LayerCount = Stored->LayerCount; diff --git a/generated/default_marshal_layered_brush_editor_1.h b/generated/default_marshal_layered_brush_editor_1.h index fc8ba4e89..b879f80fc 100644 --- a/generated/default_marshal_layered_brush_editor_1.h +++ b/generated/default_marshal_layered_brush_editor_1.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1020:0 +// src/engine/editor.h:1016:0 RangeIterator(Index, (256)) { diff --git a/generated/default_marshal_noise_layer_0.h b/generated/default_marshal_noise_layer_0.h index 0a756a41b..304ed4f3c 100644 --- a/generated/default_marshal_noise_layer_0.h +++ b/generated/default_marshal_noise_layer_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:860:0 +// src/engine/editor.h:856:0 Live->Type = Stored->Type; diff --git a/generated/do_editor_ui_for_compound_type_white_noise_params.h b/generated/do_editor_ui_for_compound_type_white_noise_params.h new file mode 100644 index 000000000..9ac21df91 --- /dev/null +++ b/generated/do_editor_ui_for_compound_type_white_noise_params.h @@ -0,0 +1,61 @@ +// src/engine/editor.cpp:113:0 + +link_internal void +DoEditorUi(renderer_2d *Ui, window_layout *Window, white_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) +{ + if (Element) + { + // NOTE(Jesse): This is wacky as fuck, but it's a pretty easy way to support + // not drawing the toggl-y thing if we just want to dump the members. + b32 DrawChildren = True; + b32 DidToggle = False; + if (Name.Count) + { + if (ToggleButton(Ui, FSz("v %S", Name), FSz("> %S", Name), UiId(Window, "toggle white_noise_params", Element), Params)) + { + DidToggle = True; + PushNewRow(Ui); + } + else + { + DrawChildren = False; + } + } + + if (DrawChildren) + { + PushTableStart(Ui); + if (DidToggle) { OPEN_INDENT_FOR_TOGGLEABLE_REGION(); } + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(r32*,&Element->Threshold), + CSz("Threshold"), + Params + ); + + + + + + + + PushNewRow(Ui); + if (DidToggle) { CLOSE_INDENT_FOR_TOGGLEABLE_REGION(); } + PushTableEnd(Ui); + } + else + { + PushNewRow(Ui); + } + + } + else + { + PushColumn(Ui, Name, Params); + PushColumn(Ui, CSz("(null)"), Params); + PushNewRow(Ui); + } + +} + diff --git a/generated/do_editor_ui_for_compound_type_world_edit_brush.h b/generated/do_editor_ui_for_compound_type_world_edit_brush.h index 38bdd9d11..0117f0858 100644 --- a/generated/do_editor_ui_for_compound_type_world_edit_brush.h +++ b/generated/do_editor_ui_for_compound_type_world_edit_brush.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:797:0 +// src/engine/editor.h:793:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_edit_brush *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_radio_enum_brush_layer_type.h b/generated/do_editor_ui_for_radio_enum_brush_layer_type.h index 053e29aba..50a20c01e 100644 --- a/generated/do_editor_ui_for_radio_enum_brush_layer_type.h +++ b/generated/do_editor_ui_for_radio_enum_brush_layer_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:874:0 +// src/engine/editor.h:870:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, brush_layer_type Selection) diff --git a/generated/flood_fill_iteration_pattern_199741702_161749140_632272777.h b/generated/flood_fill_iteration_pattern_199741702_161749140_632272777.h index 8b76e49d2..9d5e5877c 100644 --- a/generated/flood_fill_iteration_pattern_199741702_161749140_632272777.h +++ b/generated/flood_fill_iteration_pattern_199741702_161749140_632272777.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:619:0 +// src/engine/world_update.cpp:620:0 random_series ColorEntropy = {4654376543246}; diff --git a/generated/flood_fill_iteration_pattern_275071431_101859599_0.h b/generated/flood_fill_iteration_pattern_275071431_101859599_0.h index 821fa6614..c4650a042 100644 --- a/generated/flood_fill_iteration_pattern_275071431_101859599_0.h +++ b/generated/flood_fill_iteration_pattern_275071431_101859599_0.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:859:0 +// src/engine/world_update.cpp:860:0 random_series ColorEntropy = {4654376543246}; diff --git a/generated/flood_fill_iteration_pattern_275071431_785723886_0.h b/generated/flood_fill_iteration_pattern_275071431_785723886_0.h index 8bffb7436..6d60505be 100644 --- a/generated/flood_fill_iteration_pattern_275071431_785723886_0.h +++ b/generated/flood_fill_iteration_pattern_275071431_785723886_0.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:843:0 +// src/engine/world_update.cpp:844:0 random_series ColorEntropy = {4654376543246}; diff --git a/generated/flood_fill_iteration_pattern_846291950_267608728_0.h b/generated/flood_fill_iteration_pattern_846291950_267608728_0.h index a852aeb4c..2de880a70 100644 --- a/generated/flood_fill_iteration_pattern_846291950_267608728_0.h +++ b/generated/flood_fill_iteration_pattern_846291950_267608728_0.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:723:0 +// src/engine/world_update.cpp:724:0 random_series ColorEntropy = {4654376543246}; diff --git a/generated/for_datatypes_0XxWqGSZ.h b/generated/for_datatypes_0XxWqGSZ.h index 7d19e5ac3..b8bd7f857 100644 --- a/generated/for_datatypes_0XxWqGSZ.h +++ b/generated/for_datatypes_0XxWqGSZ.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:335:0 +// src/engine/work_queue.h:336:0 diff --git a/generated/for_datatypes_fkubhsYl.h b/generated/for_datatypes_fkubhsYl.h index 3932ffb01..97f9ca69a 100644 --- a/generated/for_datatypes_fkubhsYl.h +++ b/generated/for_datatypes_fkubhsYl.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:279:0 +// src/engine/work_queue.h:280:0 diff --git a/generated/for_datatypes_kv3WBTai.h b/generated/for_datatypes_kv3WBTai.h index edfeb70ce..173bd99b5 100644 --- a/generated/for_datatypes_kv3WBTai.h +++ b/generated/for_datatypes_kv3WBTai.h @@ -1,4 +1,4 @@ -// src/engine/work_queue.h:260:0 +// src/engine/work_queue.h:261:0 diff --git a/generated/rectalinear_iteration_pattern_398799212.h b/generated/rectalinear_iteration_pattern_398799212.h index 700a80a01..7b3122148 100644 --- a/generated/rectalinear_iteration_pattern_398799212.h +++ b/generated/rectalinear_iteration_pattern_398799212.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:579:0 +// src/engine/world_update.cpp:580:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_416827956.h b/generated/rectalinear_iteration_pattern_416827956.h index f2e09ff7c..f209ab38d 100644 --- a/generated/rectalinear_iteration_pattern_416827956.h +++ b/generated/rectalinear_iteration_pattern_416827956.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:750:0 +// src/engine/world_update.cpp:751:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_428632106.h b/generated/rectalinear_iteration_pattern_428632106.h index e2ec434c7..d87ba0cdf 100644 --- a/generated/rectalinear_iteration_pattern_428632106.h +++ b/generated/rectalinear_iteration_pattern_428632106.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:901:0 +// src/engine/world_update.cpp:902:0 DimIterator(x, y, z, UpdateDim) { @@ -14,7 +14,7 @@ DimIterator(x, y, z, UpdateDim) v3i OriginToCurrentVoxP = SimVoxP - SimOrigin; voxel *AssetV = TryGetVoxel(Data, OriginToCurrentVoxP); voxel *NewVoxelValue = &InvertV; - if (AssetV && (AssetV->Flags&Voxel_Filled)) + if ( (AssetV && (AssetV->Flags&Voxel_Filled)) || Params->PersistWhitespace ) { NewVoxelValue = AssetV; OverwriteVoxel = True; diff --git a/generated/rectalinear_iteration_pattern_530902269.h b/generated/rectalinear_iteration_pattern_530902269.h index 0f270c84c..97e6de798 100644 --- a/generated/rectalinear_iteration_pattern_530902269.h +++ b/generated/rectalinear_iteration_pattern_530902269.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:698:0 +// src/engine/world_update.cpp:699:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_583358156.h b/generated/rectalinear_iteration_pattern_583358156.h index 22045c1b4..fedc9869b 100644 --- a/generated/rectalinear_iteration_pattern_583358156.h +++ b/generated/rectalinear_iteration_pattern_583358156.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:875:0 +// src/engine/world_update.cpp:876:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_631222419.h b/generated/rectalinear_iteration_pattern_631222419.h index ac9bd09c7..62f7a278f 100644 --- a/generated/rectalinear_iteration_pattern_631222419.h +++ b/generated/rectalinear_iteration_pattern_631222419.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:791:0 +// src/engine/world_update.cpp:792:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_643608995.h b/generated/rectalinear_iteration_pattern_643608995.h index b5116f47e..d99cbaea6 100644 --- a/generated/rectalinear_iteration_pattern_643608995.h +++ b/generated/rectalinear_iteration_pattern_643608995.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:679:0 +// src/engine/world_update.cpp:680:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_812652930.h b/generated/rectalinear_iteration_pattern_812652930.h index 20f932109..210867881 100644 --- a/generated/rectalinear_iteration_pattern_812652930.h +++ b/generated/rectalinear_iteration_pattern_812652930.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:651:0 +// src/engine/world_update.cpp:652:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_920026661.h b/generated/rectalinear_iteration_pattern_920026661.h index 9f53ecb65..f45e49756 100644 --- a/generated/rectalinear_iteration_pattern_920026661.h +++ b/generated/rectalinear_iteration_pattern_920026661.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:599:0 +// src/engine/world_update.cpp:600:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_992879728.h b/generated/rectalinear_iteration_pattern_992879728.h index fdb50b66d..cfcfc5648 100644 --- a/generated/rectalinear_iteration_pattern_992879728.h +++ b/generated/rectalinear_iteration_pattern_992879728.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:812:0 +// src/engine/world_update.cpp:813:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/rectalinear_iteration_pattern_99934950.h b/generated/rectalinear_iteration_pattern_99934950.h index e985afe60..3c702c01f 100644 --- a/generated/rectalinear_iteration_pattern_99934950.h +++ b/generated/rectalinear_iteration_pattern_99934950.h @@ -1,4 +1,4 @@ -// src/engine/world_update.cpp:758:0 +// src/engine/world_update.cpp:759:0 DimIterator(x, y, z, UpdateDim) { diff --git a/generated/string_and_value_tables_shape_type.h b/generated/string_and_value_tables_shape_type.h index 75c06a759..3ed9b7082 100644 --- a/generated/string_and_value_tables_shape_type.h +++ b/generated/string_and_value_tables_shape_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:824:0 +// src/engine/editor.h:820:0 link_internal counted_string ToStringPrefixless(shape_type Type) diff --git a/src/engine/editor.cpp b/src/engine/editor.cpp index bc0c52925..cb7088094 100644 --- a/src/engine/editor.cpp +++ b/src/engine/editor.cpp @@ -539,14 +539,14 @@ GetMax(v3 *SelectionRegion) } link_internal void -ApplyEditToRegion(engine_resources *Engine, rect3 *SelectionAABB, u16 ColorIndex, world_edit_mode WorldEditMode, world_edit_mode_modifier Modifier) +ApplyEditToRegion(engine_resources *Engine, rect3 *SelectionAABB, u16 ColorIndex, b32 PersistWhitespace, world_edit_mode WorldEditMode, world_edit_mode_modifier Modifier) { world_edit_shape Shape = { .Type = type_world_update_op_shape_params_rect, .world_update_op_shape_params_rect.Region = *SelectionAABB }; - QueueWorldUpdateForRegion(Engine, WorldEditMode, Modifier, &Shape, ColorIndex, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, WorldEditMode, Modifier, &Shape, ColorIndex, PersistWhitespace, Engine->WorldUpdateMemory); } @@ -1354,7 +1354,7 @@ ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, world_chunk *DestC if (Iterations > 1) { Info("%d", Iterations); } RangeIterator(IterIndex, Iterations) { - work_queue_entry_update_world_region Job = WorkQueueEntryUpdateWorldRegion(Mode, Modifier, SimFloodOrigin, &Shape, ColorIndex, {}, {}, {}, 0); + work_queue_entry_update_world_region Job = WorkQueueEntryUpdateWorldRegion(Mode, Modifier, SimFloodOrigin, &Shape, ColorIndex, {}, {}, {}, {}, 0); ApplyUpdateToRegion(GetThreadLocalState(ThreadLocal_ThreadIndex), &Job, UpdateBounds, DestChunk, Layer->Settings.Invert); DestChunk->FilledCount = MarkBoundaryVoxels_MakeExteriorFaces( DestChunk->Voxels, DestChunk->Dim, {{}}, DestChunk->Dim ); } @@ -1738,7 +1738,6 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti { if (SelectionComplete(Editor->SelectionClicks)) { - /* world_chunk_ptr_buffer Chunks = GatherChunksOverlappingArea(World, Editor->CopyRegion, Engine->WorldUpdateMemory); */ world_chunk Seed = GatherVoxelsOverlappingArea(Engine, Editor->SelectionRegion, GetTranArena()); CopyChunkOffset(&Seed, Seed.Dim, Root_LayeredBrushPreview, Root_LayeredBrushPreview->Dim, -1*SmallestMinOffset); } @@ -2212,7 +2211,7 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_asset, .world_update_op_shape_params_asset = AssetUpdateShape, }; - QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, Editor->Params.Modifier, &Shape, {}, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, Editor->Params.Modifier, &Shape, {}, {}, Engine->WorldUpdateMemory); } else if (Editor->BrushType == WorldEdit_BrushType_Entity) { @@ -2277,7 +2276,7 @@ DoWorldEditor(engine_resources *Engine) { v3 P0 = GetHotVoxelForEditMode(Engine, Editor->Params.Mode); rect3 AABB = RectMinMax(P0, P0+1.f); - ApplyEditToRegion(Engine, &AABB, Engine->Editor.SelectedColorIndex, Editor->Params.Mode, Editor->Params.Modifier); + ApplyEditToRegion(Engine, &AABB, Engine->Editor.SelectedColorIndex, {}, Editor->Params.Mode, Editor->Params.Modifier); } } } @@ -2305,7 +2304,7 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_chunk_data, .world_update_op_shape_params_chunk_data = ChunkDataShape, }; - QueueWorldUpdateForRegion(Engine, Editor->Params.Mode, Editor->Params.Modifier, &Shape, Editor->SelectedColorIndex, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, Editor->Params.Mode, Editor->Params.Modifier, &Shape, Editor->SelectedColorIndex, Editor->LayeredBrushEditor.SeedBrushWithSelection, Engine->WorldUpdateMemory); } } break; @@ -2403,7 +2402,7 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_asset, .world_update_op_shape_params_asset = AssetUpdateShape, }; - QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, Editor->Params.Modifier, &Shape, {}, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, Editor->Params.Modifier, &Shape, {}, {}, Engine->WorldUpdateMemory); #endif } } @@ -2458,7 +2457,7 @@ DoWorldEditor(engine_resources *Engine) if (Editor->SelectionClicks == 2) { - if (Input->Ctrl.Pressed && Input->D.Clicked) { ApplyEditToRegion(Engine, &SelectionAABB, {}, WorldEdit_Mode_Remove, WorldEdit_Modifier_Default); } + if (Input->Ctrl.Pressed && Input->D.Clicked) { ApplyEditToRegion(Engine, &SelectionAABB, {}, {}, WorldEdit_Mode_Remove, WorldEdit_Modifier_Default); } if (Input->Ctrl.Pressed && Input->C.Clicked) { Editor->CopyRegion = Editor->SelectionRegion; } @@ -2484,7 +2483,7 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_chunk_data, .world_update_op_shape_params_chunk_data = ChunkDataShape, }; - QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, WorldEdit_Modifier_Default, &Shape, {}, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, WorldEdit_Modifier_Default, &Shape, {}, {}, Engine->WorldUpdateMemory); } } diff --git a/src/engine/editor.h b/src/engine/editor.h index 2f020c84c..7048a679f 100644 --- a/src/engine/editor.h +++ b/src/engine/editor.h @@ -743,19 +743,15 @@ struct world_update_op_shape_params_rect struct asset; struct world_update_op_shape_params_asset { - /* asset *Asset; */ - /* model *Model; */ - asset_id AssetId; - u64 ModelIndex; - cp Origin; + u64 ModelIndex; + cp Origin; }; struct world_update_op_shape_params_chunk_data { chunk_data Data; - v3 SimSpaceOrigin; - /* cp Origin; */ + v3 SimSpaceOrigin; }; struct world_update_op_shape_params_sphere diff --git a/src/engine/game_effects.cpp b/src/engine/game_effects.cpp index 1c274a712..ac8086fd0 100644 --- a/src/engine/game_effects.cpp +++ b/src/engine/game_effects.cpp @@ -280,7 +280,7 @@ DoDig( engine_resources *Resources, canonical_position PickCP, f32 Radius, f32 D .Type = type_world_update_op_shape_params_rect, .world_update_op_shape_params_rect.Region = RectMinMax(MinP,MaxP), }; - QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldEdit_Modifier_Default, &Shape, ICE_BLUE, Resources->WorldUpdateMemory); + QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldEdit_Modifier_Default, &Shape, ICE_BLUE, {}, Resources->WorldUpdateMemory); } link_internal void @@ -295,7 +295,7 @@ DoIceBlock( engine_resources *Resources, canonical_position PickCP, f32 Radius, .Type = type_world_update_op_shape_params_rect, .world_update_op_shape_params_rect.Region = RectMinMax(MinP,MaxP), }; - QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Attach, WorldEdit_Modifier_Default, &Shape, ICE_BLUE, Resources->WorldUpdateMemory); + QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Attach, WorldEdit_Modifier_Default, &Shape, ICE_BLUE, {}, Resources->WorldUpdateMemory); } link_internal void @@ -308,7 +308,7 @@ DoSplotion( engine_resources *Resources, cp PickCP, f32 Radius, random_series *E .world_update_op_shape_params_sphere.Radius = Radius, .world_update_op_shape_params_sphere.Location = PickCP, }; - QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldEdit_Modifier_Flood, &Shape, DARK_GREY, Resources->WorldUpdateMemory); + QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldEdit_Modifier_Flood, &Shape, DARK_GREY, {}, Resources->WorldUpdateMemory); /* QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldUpdateModeModifier_None, &Shape, DARK_GREY, Resources->WorldUpdateMemory); */ /* QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Attach, WorldUpdateModeModifier_None, &Shape, DARK_GREY, Resources->WorldUpdateMemory); */ /* QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Attach, WorldUpdatenModeModifier_Flood, &Shape, DARK_GREY, Resources->WorldUpdateMemory); */ diff --git a/src/engine/work_queue.h b/src/engine/work_queue.h index 7a6eec169..7f1d7591b 100644 --- a/src/engine/work_queue.h +++ b/src/engine/work_queue.h @@ -80,6 +80,7 @@ struct work_queue_entry_update_world_region // TODO(Jesse): These feel like part of the brush? u16 ColorIndex; u8 Transparency; + b32 PersistWhitespace; cp MinP; cp MaxP; diff --git a/src/engine/world_chunk.cpp b/src/engine/world_chunk.cpp index 00ec1f2f3..6723ba589 100644 --- a/src/engine/world_chunk.cpp +++ b/src/engine/world_chunk.cpp @@ -3795,6 +3795,7 @@ WorkQueueEntryUpdateWorldRegion(world_edit_mode Mode, v3 SimFloodOrigin, world_edit_shape *Shape, u16 ColorIndex, + b32 PersistWhitespace, cp MinP, cp MaxP, world_chunk** DestChunkBuffer, @@ -3810,6 +3811,7 @@ WorkQueueEntryUpdateWorldRegion(world_edit_mode Mode, }, ColorIndex, {}, + PersistWhitespace, MinP, MaxP, DestChunkBuffer, diff --git a/src/engine/world_update.cpp b/src/engine/world_update.cpp index 32bd89bdf..585cfee2b 100644 --- a/src/engine/world_update.cpp +++ b/src/engine/world_update.cpp @@ -158,6 +158,7 @@ QueueWorldUpdateForRegion( engine_resources *Engine, world_edit_mode_modifier Modifier, world_edit_shape *Shape, u16 ColorIndex, + b32 PersistWhitespace, memory_arena *Memory ) { TIMED_FUNCTION(); @@ -299,7 +300,7 @@ QueueWorldUpdateForRegion( engine_resources *Engine, work_queue_entry Entry = { .Type = type_work_queue_entry_update_world_region, - .work_queue_entry_update_world_region = WorkQueueEntryUpdateWorldRegion(Mode, Modifier, SimFloodOrigin, Shape, ColorIndex, MinP, MaxP, Buffer, ChunkIndex), + .work_queue_entry_update_world_region = WorkQueueEntryUpdateWorldRegion(Mode, Modifier, SimFloodOrigin, Shape, ColorIndex, PersistWhitespace, MinP, MaxP, Buffer, ChunkIndex), }; PushWorkQueueEntry(&Plat->WorldUpdateQ, &Entry); } @@ -902,7 +903,7 @@ WorldEdit_shape_chunk_data_Default(apply_world_edit_params *Params, v3 SimOrigin v3i OriginToCurrentVoxP = SimVoxP - SimOrigin; voxel *AssetV = TryGetVoxel(Data, OriginToCurrentVoxP); voxel *NewVoxelValue = &InvertV; - if (AssetV && (AssetV->Flags&Voxel_Filled)) + if ( (AssetV && (AssetV->Flags&Voxel_Filled)) || Params->PersistWhitespace ) { NewVoxelValue = AssetV; OverwriteVoxel = True; @@ -917,7 +918,7 @@ WorldEdit_shape_chunk_data_Default(apply_world_edit_params *Params, v3 SimOrigin link_internal void -ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_region *Job, rect3i SimSpaceUpdateBounds, world_chunk *CopiedChunk, b32 Invert /* = False */) +ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_region *Job, rect3i SimSpaceUpdateBounds, world_chunk *CopiedChunk, b32 Invert /* = False */, b32 PersistWhitespace /* = False */ ) { world *World = GetWorld(); @@ -963,7 +964,7 @@ ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_re Assert(EditCenterP < SimSpaceUpdateBounds.Max); /* rect3i SSRect = RectCenterRad(EditCenterP, V3i(Sphere->Radius)); */ - apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, NewColor, NewTransparency}; + apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, PersistWhitespace, NewColor, NewTransparency}; switch(Modifier) { @@ -997,7 +998,7 @@ ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_re rect3i SSRect = {V3i(Rect->Region.Min), V3i(Rect->Region.Max)}; v3i EditCenterP = V3i(Floor(Rect->Region.Min+(GetDim(SSRect)/2.f))); - apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, NewColor, NewTransparency}; + apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, PersistWhitespace, NewColor, NewTransparency}; switch (Modifier) { case WorldEdit_Modifier_Surface: @@ -1048,7 +1049,7 @@ ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_re rect3i SSRect = RectMinDim(V3i(SimOrigin), Data.Dim); v3i EditCenterP = V3i(SimOrigin) + V3i(Data.Dim/2.f); - apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, NewColor, NewTransparency}; + apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, PersistWhitespace, NewColor, NewTransparency}; switch (Modifier) { case WorldEdit_Modifier_Surface: @@ -1171,7 +1172,8 @@ DoWorldUpdate(work_queue *Queue, world *World, thread_local_state *Thread, work_ } #endif - ApplyUpdateToRegion(Thread, Job, SimSpaceUpdateBounds, &CopiedChunk); + b32 Invert = False; + ApplyUpdateToRegion(Thread, Job, SimSpaceUpdateBounds, &CopiedChunk, Invert, Job->PersistWhitespace); // NOTE(Jesse): We can actually do the entire dim here, but it's probably diff --git a/src/engine/world_update.h b/src/engine/world_update.h index 302cf8e2e..570a5dd3d 100644 --- a/src/engine/world_update.h +++ b/src/engine/world_update.h @@ -46,6 +46,7 @@ struct apply_world_edit_params rect3i SimSpaceUpdateBounds; world_chunk *CopiedChunk; b32 Invert; + b32 PersistWhitespace; u16 Color; u8 Transparency; }; @@ -77,10 +78,10 @@ ChunkCountForDim(v3i Dim, v3i ChunkDim) struct work_queue_entry_update_world_region; link_internal void -QueueWorldUpdateForRegion( engine_resources *Engine, world_edit_mode Mode, world_edit_mode_modifier Modifier, world_edit_shape *Shape, u16 ColorIndex, memory_arena *Memory ); +QueueWorldUpdateForRegion( engine_resources *Engine, world_edit_mode Mode, world_edit_mode_modifier Modifier, world_edit_shape *Shape, u16 ColorIndex, b32 PersistWhitespace, memory_arena *Memory ); link_internal void -ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_region *Job, rect3i SimSpaceUpdateBounds, world_chunk *CopiedChunk, b32 Invert = False); +ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_region *Job, rect3i SimSpaceUpdateBounds, world_chunk *CopiedChunk, b32 Invert = False, b32 PersistWhitespace = False); link_internal void DoWorldUpdate(work_queue *Queue, world *World, thread_local_state *Thread, work_queue_entry_update_world_region *Job); From 9a224974ef27bae977459d1a70577a027e0cc20d Mon Sep 17 00:00:00 2001 From: a pirate Date: Mon, 2 Sep 2024 09:36:38 -0700 Subject: [PATCH 3/9] Move global edit_mode into took-specific structs so it's not always visible --- CHANGELOG.txt | 2 + generated/are_equal_brush_settings.h | 2 +- generated/are_equal_perlin_noise_params.h | 2 +- generated/default_marshal_brush_settings_0.h | 2 +- generated/default_marshal_brush_settings_1.h | 2 +- .../default_marshal_layered_brush_editor_0.h | 2 +- .../default_marshal_layered_brush_editor_1.h | 2 +- generated/default_marshal_noise_layer_0.h | 2 +- ...i_for_compound_type_layered_brush_editor.h | 30 ++++++ ...editor_ui_for_compound_type_level_editor.h | 11 +-- ...or_ui_for_compound_type_world_edit_brush.h | 2 +- ...r_ui_for_compound_type_world_edit_params.h | 2 +- ...ui_for_radio_enum_asset_window_view_mode.h | 2 +- ...ditor_ui_for_radio_enum_brush_layer_type.h | 2 +- ..._ui_for_radio_enum_world_edit_brush_type.h | 3 +- ...editor_ui_for_radio_enum_world_edit_mode.h | 2 +- ..._for_radio_enum_world_edit_mode_modifier.h | 2 +- ...editor_ui_for_radio_enum_world_edit_tool.h | 2 +- generated/for_datatypes_0XxWqGSZ.h | 4 +- generated/for_datatypes_fkubhsYl.h | 4 +- generated/for_datatypes_kv3WBTai.h | 4 +- generated/serdes_struct_brush_layer.h | 2 +- generated/serdes_struct_brush_settings.h | 2 +- generated/serdes_struct_brush_settings_0.h | 2 +- generated/serdes_struct_brush_settings_1.h | 2 +- .../serdes_struct_layered_brush_editor.h | 34 ++++++- .../serdes_struct_layered_brush_editor_0.h | 2 +- .../serdes_struct_layered_brush_editor_1.h | 2 +- generated/serdes_struct_noise_layer.h | 2 +- generated/serdes_struct_noise_layer_0.h | 2 +- generated/serdes_struct_shape_layer.h | 2 +- ...struct_world_update_op_shape_params_rect.h | 2 +- ...ruct_world_update_op_shape_params_sphere.h | 2 +- .../string_and_value_tables_shape_type.h | 2 +- .../string_and_value_tables_world_edit_mode.h | 2 +- ...nd_value_tables_world_edit_mode_modifier.h | 2 +- ..._value_tables_world_update_op_shape_type.h | 2 +- ...on_group_for_enum_engine_debug_view_mode.h | 2 +- jesse.make.sh | 8 +- src/engine/debug.h | 4 +- src/engine/editor.cpp | 98 +++++++++---------- src/engine/editor.h | 77 ++++++++++----- src/engine/game_effects.cpp | 2 +- src/engine/serdes.cpp | 4 +- 44 files changed, 219 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b90ed9b04..604a98bf7 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,7 @@ * 1.6.2 +* Change "SeedBrushWithSelection" to work with destructive brushes + * Fix a race condition sometimes causing the main thread to unlock before the render thread had completed * Fix some edge cases with negatively offset brushes and small selection regions diff --git a/generated/are_equal_brush_settings.h b/generated/are_equal_brush_settings.h index b499deeab..8d13016f8 100644 --- a/generated/are_equal_brush_settings.h +++ b/generated/are_equal_brush_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:899:0 +// src/engine/editor.h:885:0 link_internal b32 AreEqual(brush_settings *Thing1, brush_settings *Thing2) diff --git a/generated/are_equal_perlin_noise_params.h b/generated/are_equal_perlin_noise_params.h index 176948791..08090b018 100644 --- a/generated/are_equal_perlin_noise_params.h +++ b/generated/are_equal_perlin_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:669:0 +// src/engine/editor.h:657:0 link_internal b32 AreEqual(perlin_noise_params *Thing1, perlin_noise_params *Thing2) diff --git a/generated/default_marshal_brush_settings_0.h b/generated/default_marshal_brush_settings_0.h index 030a0b5b4..ba273a985 100644 --- a/generated/default_marshal_brush_settings_0.h +++ b/generated/default_marshal_brush_settings_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:957:0 +// src/engine/editor.h:943:0 Live->Type = Stored->Type; diff --git a/generated/default_marshal_brush_settings_1.h b/generated/default_marshal_brush_settings_1.h index 42399aebb..f6f3b5f6d 100644 --- a/generated/default_marshal_brush_settings_1.h +++ b/generated/default_marshal_brush_settings_1.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:950:0 +// src/engine/editor.h:936:0 Live->Type = Stored->Type; diff --git a/generated/default_marshal_layered_brush_editor_0.h b/generated/default_marshal_layered_brush_editor_0.h index fa5cb830a..7788e0d9d 100644 --- a/generated/default_marshal_layered_brush_editor_0.h +++ b/generated/default_marshal_layered_brush_editor_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1023:0 +// src/engine/editor.h:1035:0 Live->LayerCount = Stored->LayerCount; diff --git a/generated/default_marshal_layered_brush_editor_1.h b/generated/default_marshal_layered_brush_editor_1.h index b879f80fc..a395b964d 100644 --- a/generated/default_marshal_layered_brush_editor_1.h +++ b/generated/default_marshal_layered_brush_editor_1.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1016:0 +// src/engine/editor.h:1028:0 RangeIterator(Index, (256)) { diff --git a/generated/default_marshal_noise_layer_0.h b/generated/default_marshal_noise_layer_0.h index 304ed4f3c..28f6ba192 100644 --- a/generated/default_marshal_noise_layer_0.h +++ b/generated/default_marshal_noise_layer_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:856:0 +// src/engine/editor.h:842:0 Live->Type = Stored->Type; diff --git a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h index a87db2227..7c0f2fdea 100644 --- a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h +++ b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h @@ -107,6 +107,36 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, layered_brush_editor *Element PushNewRow(Ui); + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(world_edit_mode*,&Element->Mode), + CSz("Mode"), + Params + ); + + + + + + + + + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(world_edit_mode_modifier*,&Element->Modifier), + CSz("Modifier"), + Params + ); + + + + + + + + DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/do_editor_ui_for_compound_type_level_editor.h b/generated/do_editor_ui_for_compound_type_level_editor.h index c107c7243..6ed9a9d21 100644 --- a/generated/do_editor_ui_for_compound_type_level_editor.h +++ b/generated/do_editor_ui_for_compound_type_level_editor.h @@ -89,8 +89,8 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, level_editor *Element, cs Nam DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there - Cast(world_edit_params*,&Element->Params), - CSz("Params"), + Cast(single_brush_settings*,&Element->SingleBrush), + CSz("SingleBrush"), Params ); @@ -104,8 +104,8 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, level_editor *Element, cs Nam DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there - Cast(b8*,&Element->SelectionFollowsCursor), - CSz("SelectionFollowsCursor"), + Cast(asset_brush_settings*,&Element->AssetBrush), + CSz("AssetBrush"), Params ); @@ -115,8 +115,7 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, level_editor *Element, cs Nam - PushNewRow(Ui); - + DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/do_editor_ui_for_compound_type_world_edit_brush.h b/generated/do_editor_ui_for_compound_type_world_edit_brush.h index 0117f0858..5cac4793e 100644 --- a/generated/do_editor_ui_for_compound_type_world_edit_brush.h +++ b/generated/do_editor_ui_for_compound_type_world_edit_brush.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:793:0 +// src/engine/editor.h:779:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_edit_brush *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_edit_params.h b/generated/do_editor_ui_for_compound_type_world_edit_params.h index 5d81c5889..101758980 100644 --- a/generated/do_editor_ui_for_compound_type_world_edit_params.h +++ b/generated/do_editor_ui_for_compound_type_world_edit_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:712:0 +// src/engine/editor.h:710:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_edit_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_radio_enum_asset_window_view_mode.h b/generated/do_editor_ui_for_radio_enum_asset_window_view_mode.h index cae545e9d..c8ec89173 100644 --- a/generated/do_editor_ui_for_radio_enum_asset_window_view_mode.h +++ b/generated/do_editor_ui_for_radio_enum_asset_window_view_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:695:0 +// src/engine/editor.h:683:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, asset_window_view_mode Selection) diff --git a/generated/do_editor_ui_for_radio_enum_brush_layer_type.h b/generated/do_editor_ui_for_radio_enum_brush_layer_type.h index 50a20c01e..0c2468b3b 100644 --- a/generated/do_editor_ui_for_radio_enum_brush_layer_type.h +++ b/generated/do_editor_ui_for_radio_enum_brush_layer_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:870:0 +// src/engine/editor.h:856:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, brush_layer_type Selection) diff --git a/generated/do_editor_ui_for_radio_enum_world_edit_brush_type.h b/generated/do_editor_ui_for_radio_enum_world_edit_brush_type.h index 6ca944d63..4dd7b4b36 100644 --- a/generated/do_editor_ui_for_radio_enum_world_edit_brush_type.h +++ b/generated/do_editor_ui_for_radio_enum_world_edit_brush_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:709:0 +// src/engine/editor.h:697:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, world_edit_brush_type Selection) @@ -19,7 +19,6 @@ RadioButtonGroup_world_edit_brush_type( renderer_2d *Ui, ui_toggle_button_handle ButtonHandles[] = { { CSz("Disabled"), UiId(Window, Cast(void*, Element), Cast(void*, "world_edit_brush_type WorldEdit_BrushType_Disabled")), WorldEdit_BrushType_Disabled }, - { CSz("Selection"), UiId(Window, Cast(void*, Element), Cast(void*, "world_edit_brush_type WorldEdit_BrushType_Selection")), WorldEdit_BrushType_Selection }, { CSz("Single"), UiId(Window, Cast(void*, Element), Cast(void*, "world_edit_brush_type WorldEdit_BrushType_Single")), WorldEdit_BrushType_Single }, { CSz("Asset"), UiId(Window, Cast(void*, Element), Cast(void*, "world_edit_brush_type WorldEdit_BrushType_Asset")), WorldEdit_BrushType_Asset }, { CSz("Entity"), UiId(Window, Cast(void*, Element), Cast(void*, "world_edit_brush_type WorldEdit_BrushType_Entity")), WorldEdit_BrushType_Entity }, diff --git a/generated/do_editor_ui_for_radio_enum_world_edit_mode.h b/generated/do_editor_ui_for_radio_enum_world_edit_mode.h index e622f7f5f..fbee1fd67 100644 --- a/generated/do_editor_ui_for_radio_enum_world_edit_mode.h +++ b/generated/do_editor_ui_for_radio_enum_world_edit_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:703:0 +// src/engine/editor.h:691:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, world_edit_mode Selection) diff --git a/generated/do_editor_ui_for_radio_enum_world_edit_mode_modifier.h b/generated/do_editor_ui_for_radio_enum_world_edit_mode_modifier.h index de6e5f0e4..4022f3c97 100644 --- a/generated/do_editor_ui_for_radio_enum_world_edit_mode_modifier.h +++ b/generated/do_editor_ui_for_radio_enum_world_edit_mode_modifier.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:682:0 +// src/engine/editor.h:670:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, world_edit_mode_modifier Selection) diff --git a/generated/do_editor_ui_for_radio_enum_world_edit_tool.h b/generated/do_editor_ui_for_radio_enum_world_edit_tool.h index 492eebb3a..7583cf80e 100644 --- a/generated/do_editor_ui_for_radio_enum_world_edit_tool.h +++ b/generated/do_editor_ui_for_radio_enum_world_edit_tool.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:706:0 +// src/engine/editor.h:694:0 link_internal void RadioSelect(ui_toggle_button_group *RadioGroup, world_edit_tool Selection) diff --git a/generated/for_datatypes_0XxWqGSZ.h b/generated/for_datatypes_0XxWqGSZ.h index b8bd7f857..6b28c5552 100644 --- a/generated/for_datatypes_0XxWqGSZ.h +++ b/generated/for_datatypes_0XxWqGSZ.h @@ -182,6 +182,7 @@ + struct render_to_texture_async_params; @@ -625,6 +626,8 @@ WorkQueueEntryAsyncFunction( render_to_texture_async_params *Params ) + + @@ -647,4 +650,3 @@ WorkQueueEntryAsyncFunction( draw_lod_async_params *Params ) - diff --git a/generated/for_datatypes_fkubhsYl.h b/generated/for_datatypes_fkubhsYl.h index 97f9ca69a..6ed1a8522 100644 --- a/generated/for_datatypes_fkubhsYl.h +++ b/generated/for_datatypes_fkubhsYl.h @@ -182,6 +182,7 @@ + render_to_texture_async_params render_to_texture_async_params; @@ -618,8 +619,9 @@ render_to_texture_async_params render_to_texture_async_params; -draw_lod_async_params draw_lod_async_params; + +draw_lod_async_params draw_lod_async_params; diff --git a/generated/for_datatypes_kv3WBTai.h b/generated/for_datatypes_kv3WBTai.h index 173bd99b5..1194d951f 100644 --- a/generated/for_datatypes_kv3WBTai.h +++ b/generated/for_datatypes_kv3WBTai.h @@ -182,6 +182,7 @@ + type_render_to_texture_async_params, @@ -618,8 +619,9 @@ type_render_to_texture_async_params, -type_draw_lod_async_params, + +type_draw_lod_async_params, diff --git a/generated/serdes_struct_brush_layer.h b/generated/serdes_struct_brush_layer.h index cd71ac514..850a40e94 100644 --- a/generated/serdes_struct_brush_layer.h +++ b/generated/serdes_struct_brush_layer.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:517:0 +// src/engine/serdes.cpp:515:0 link_internal bonsai_type_info TypeInfo(brush_layer *Ignored) diff --git a/generated/serdes_struct_brush_settings.h b/generated/serdes_struct_brush_settings.h index 78e35c7af..cf8a07e8c 100644 --- a/generated/serdes_struct_brush_settings.h +++ b/generated/serdes_struct_brush_settings.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:514:0 +// src/engine/serdes.cpp:512:0 link_internal bonsai_type_info TypeInfo(brush_settings *Ignored) diff --git a/generated/serdes_struct_brush_settings_0.h b/generated/serdes_struct_brush_settings_0.h index a52f239eb..92c01d791 100644 --- a/generated/serdes_struct_brush_settings_0.h +++ b/generated/serdes_struct_brush_settings_0.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:510:0 +// src/engine/serdes.cpp:508:0 link_internal bonsai_type_info TypeInfo(brush_settings_0 *Ignored) diff --git a/generated/serdes_struct_brush_settings_1.h b/generated/serdes_struct_brush_settings_1.h index acbbe67bc..e2f78c108 100644 --- a/generated/serdes_struct_brush_settings_1.h +++ b/generated/serdes_struct_brush_settings_1.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:512:0 +// src/engine/serdes.cpp:510:0 link_internal bonsai_type_info TypeInfo(brush_settings_1 *Ignored) diff --git a/generated/serdes_struct_layered_brush_editor.h b/generated/serdes_struct_layered_brush_editor.h index 0533b20fa..708d76f16 100644 --- a/generated/serdes_struct_layered_brush_editor.h +++ b/generated/serdes_struct_layered_brush_editor.h @@ -6,7 +6,7 @@ TypeInfo(layered_brush_editor *Ignored) bonsai_type_info Result = {}; Result.Name = CSz("layered_brush_editor"); - Result.Version =2 ; + Result.Version =3 ; /* type.map(member) */ /* { */ @@ -30,7 +30,7 @@ Serialize(u8_cursor_block_array *Bytes, layered_brush_editor *BaseElement, umm C b32 Result = True; Upsert(TypeInfo(BaseElement), &Global_SerializeTypeTable, Global_SerializeTypeTableArena ); - u64 VersionNumber =2; + u64 VersionNumber =3; Serialize(Bytes, &VersionNumber); @@ -66,6 +66,16 @@ Serialize(u8_cursor_block_array *Bytes, layered_brush_editor *BaseElement, umm C + Result &= Serialize(Bytes, (u32*)&Element->Mode); + + + + + Result &= Serialize(Bytes, (u32*)&Element->Modifier); + + + + @@ -86,7 +96,7 @@ DeserializeCurrentVersion(u8_cursor *Bytes, layered_brush_editor *Element, memor link_internal b32 DeserializeVersioned(u8_cursor *Bytes, layered_brush_editor *Element, bonsai_type_info *TypeInfo, memory_arena *Memory) { - Assert(TypeInfo->Version <=2); + Assert(TypeInfo->Version <=3); b32 Result = True; @@ -102,9 +112,15 @@ DeserializeVersioned(u8_cursor *Bytes, layered_brush_editor *Element, bonsai_typ Result &= Deserialize(Bytes, &T1, Memory); Marshal(&T1, Element); } + if (TypeInfo->Version == 2) + { + layered_brush_editor_2 T2 = {}; + Result &= Deserialize(Bytes, &T2, Memory); + Marshal(&T2, Element); + } - if (TypeInfo->Version ==2) + if (TypeInfo->Version ==3) { Result &= DeserializeCurrentVersion(Bytes, Element, Memory); } @@ -152,6 +168,16 @@ DeserializeCurrentVersion(u8_cursor *Bytes, layered_brush_editor *Element, memor + Element->Mode = Cast(world_edit_mode, Read_u32(Bytes)); + + + + + Element->Modifier = Cast(world_edit_mode_modifier, Read_u32(Bytes)); + + + + diff --git a/generated/serdes_struct_layered_brush_editor_0.h b/generated/serdes_struct_layered_brush_editor_0.h index 5da30a27a..1a43d1fb9 100644 --- a/generated/serdes_struct_layered_brush_editor_0.h +++ b/generated/serdes_struct_layered_brush_editor_0.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:520:0 +// src/engine/serdes.cpp:518:0 link_internal bonsai_type_info TypeInfo(layered_brush_editor_0 *Ignored) diff --git a/generated/serdes_struct_layered_brush_editor_1.h b/generated/serdes_struct_layered_brush_editor_1.h index fb73a3450..38cf01b48 100644 --- a/generated/serdes_struct_layered_brush_editor_1.h +++ b/generated/serdes_struct_layered_brush_editor_1.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:522:0 +// src/engine/serdes.cpp:520:0 link_internal bonsai_type_info TypeInfo(layered_brush_editor_1 *Ignored) diff --git a/generated/serdes_struct_noise_layer.h b/generated/serdes_struct_noise_layer.h index f35c21255..e1db93014 100644 --- a/generated/serdes_struct_noise_layer.h +++ b/generated/serdes_struct_noise_layer.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:501:0 +// src/engine/serdes.cpp:499:0 link_internal bonsai_type_info TypeInfo(noise_layer *Ignored) diff --git a/generated/serdes_struct_noise_layer_0.h b/generated/serdes_struct_noise_layer_0.h index d18ef2b27..79cb27ed5 100644 --- a/generated/serdes_struct_noise_layer_0.h +++ b/generated/serdes_struct_noise_layer_0.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:499:0 +// src/engine/serdes.cpp:497:0 link_internal bonsai_type_info TypeInfo(noise_layer_0 *Ignored) diff --git a/generated/serdes_struct_shape_layer.h b/generated/serdes_struct_shape_layer.h index 0a693c02c..4566f5228 100644 --- a/generated/serdes_struct_shape_layer.h +++ b/generated/serdes_struct_shape_layer.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:507:0 +// src/engine/serdes.cpp:505:0 link_internal bonsai_type_info TypeInfo(shape_layer *Ignored) diff --git a/generated/serdes_struct_world_update_op_shape_params_rect.h b/generated/serdes_struct_world_update_op_shape_params_rect.h index 4319eda18..f5d569faf 100644 --- a/generated/serdes_struct_world_update_op_shape_params_rect.h +++ b/generated/serdes_struct_world_update_op_shape_params_rect.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:503:0 +// src/engine/serdes.cpp:501:0 link_internal bonsai_type_info TypeInfo(world_update_op_shape_params_rect *Ignored) diff --git a/generated/serdes_struct_world_update_op_shape_params_sphere.h b/generated/serdes_struct_world_update_op_shape_params_sphere.h index 03427306a..3bcd03205 100644 --- a/generated/serdes_struct_world_update_op_shape_params_sphere.h +++ b/generated/serdes_struct_world_update_op_shape_params_sphere.h @@ -1,4 +1,4 @@ -// src/engine/serdes.cpp:505:0 +// src/engine/serdes.cpp:503:0 link_internal bonsai_type_info TypeInfo(world_update_op_shape_params_sphere *Ignored) diff --git a/generated/string_and_value_tables_shape_type.h b/generated/string_and_value_tables_shape_type.h index 3ed9b7082..60087d8c5 100644 --- a/generated/string_and_value_tables_shape_type.h +++ b/generated/string_and_value_tables_shape_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:820:0 +// src/engine/editor.h:806:0 link_internal counted_string ToStringPrefixless(shape_type Type) diff --git a/generated/string_and_value_tables_world_edit_mode.h b/generated/string_and_value_tables_world_edit_mode.h index 320df8791..645da345d 100644 --- a/generated/string_and_value_tables_world_edit_mode.h +++ b/generated/string_and_value_tables_world_edit_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:698:0 +// src/engine/editor.h:686:0 link_internal counted_string ToStringPrefixless(world_edit_mode Type) diff --git a/generated/string_and_value_tables_world_edit_mode_modifier.h b/generated/string_and_value_tables_world_edit_mode_modifier.h index 25dac8670..0abe04583 100644 --- a/generated/string_and_value_tables_world_edit_mode_modifier.h +++ b/generated/string_and_value_tables_world_edit_mode_modifier.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:685:0 +// src/engine/editor.h:673:0 link_internal counted_string ToStringPrefixless(world_edit_mode_modifier Type) diff --git a/generated/string_and_value_tables_world_update_op_shape_type.h b/generated/string_and_value_tables_world_update_op_shape_type.h index 4ef02b0cc..b9f821e48 100644 --- a/generated/string_and_value_tables_world_update_op_shape_type.h +++ b/generated/string_and_value_tables_world_update_op_shape_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:733:0 +// src/engine/editor.h:719:0 link_internal counted_string ToStringPrefixless(world_update_op_shape_type Type) diff --git a/generated/toggle_button_group_for_enum_engine_debug_view_mode.h b/generated/toggle_button_group_for_enum_engine_debug_view_mode.h index b8d9199fa..251e47eff 100644 --- a/generated/toggle_button_group_for_enum_engine_debug_view_mode.h +++ b/generated/toggle_button_group_for_enum_engine_debug_view_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:690:0 +// src/engine/editor.h:678:0 link_internal ui_toggle_button_group ToggleButtonGroup_engine_debug_view_mode( renderer_2d *Ui, diff --git a/jesse.make.sh b/jesse.make.sh index 8e1178b7f..714c9257b 100644 --- a/jesse.make.sh +++ b/jesse.make.sh @@ -5,13 +5,13 @@ ./make.sh RunPoof [ $? -ne 0 ] && exit 1 -# ./make.sh $OPT BuildAll +./make.sh $OPT BuildAll # ./make.sh RunTests -./make.sh $OPT \ - BuildSingleExample examples/blank_project \ - BuildExecutables \ +# ./make.sh $OPT \ +# BuildSingleExample examples/blank_project \ + # BuildExecutables \ # BuildSingleExample examples/tools/voxel_synthesis_rule_baker \ # BuildSingleExample examples/turn_based \ # BuildSingleExample examples/project_and_level_picker \ diff --git a/src/engine/debug.h b/src/engine/debug.h index 5d305f6dc..38a309cfd 100644 --- a/src/engine/debug.h +++ b/src/engine/debug.h @@ -1,4 +1,3 @@ - // TODO(Jesse): rename this to just thumbnail and move to renderer.. ? struct asset_thumbnail { @@ -9,7 +8,7 @@ struct asset_thumbnail // TODO(Jesse): Move to renderer? struct chunk_thumbnail { - world_chunk Chunk; + world_chunk Chunk; asset_thumbnail Thumbnail; }; @@ -31,7 +30,6 @@ enum asset_window_view_mode enum engine_debug_view_mode poof(@bitfield) { - // TODO(Jesse): Make these values bitfields? EngineDebugViewMode_Level = (1 << 0), EngineDebugViewMode_WorldEdit = (1 << 1), EngineDebugViewMode_Entities = (1 << 2), diff --git a/src/engine/editor.cpp b/src/engine/editor.cpp index cb7088094..28d7d2d30 100644 --- a/src/engine/editor.cpp +++ b/src/engine/editor.cpp @@ -1178,12 +1178,12 @@ BrushSettingsForShapeBrush(engine_resources *Engine, window_layout *Window, shap case ShapeType_Rect: { - DoEditorUi(Ui, Window, &Layer->Rect, CSz("Settings")); + DoEditorUi(Ui, Window, &Layer->Rect, CSz("")); } break; case ShapeType_Sphere: { - DoEditorUi(Ui, Window, &Layer->Sphere, CSz("Settings")); + DoEditorUi(Ui, Window, &Layer->Sphere, CSz("")); } break; } @@ -1203,17 +1203,17 @@ BrushSettingsForNoiseBrush(engine_resources *Engine, window_layout *Window, nois { case NoiseType_White: { - DoEditorUi(Ui, Window, &Layer->White, CSz("Settings")); + DoEditorUi(Ui, Window, &Layer->White, CSz("")); } break; case NoiseType_Perlin: { - DoEditorUi(Ui, Window, &Layer->Perlin, CSz("Settings")); + DoEditorUi(Ui, Window, &Layer->Perlin, CSz("")); } break; case NoiseType_Voronoi: { - DoEditorUi(Ui, Window, &Layer->Voronoi, CSz("Settings")); + DoEditorUi(Ui, Window, &Layer->Voronoi, CSz("")); } break; } PushTableEnd(Ui); @@ -1227,7 +1227,7 @@ BrushSettingsForNoiseBrush(engine_resources *Engine, window_layout *Window, nois } link_internal void -DoSettingsForBrush(engine_resources *Engine, brush_layer *Layer, window_layout *Window) +DoSettingsForBrushLayer(engine_resources *Engine, brush_layer *Layer, window_layout *Window) { UNPACK_ENGINE_RESOURCES(Engine); @@ -1555,8 +1555,8 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti } { - DoEditorUi(Ui, BrushSettingsWindow, &Editor->Params.Mode, CSz("Mode"), &DefaultUiRenderParams_Generic); - DoEditorUi(Ui, BrushSettingsWindow, &Editor->Params.Modifier, CSz("Modifier"), &DefaultUiRenderParams_Generic); + DoEditorUi(Ui, BrushSettingsWindow, &LayeredBrush->Mode, CSz("Mode"), &DefaultUiRenderParams_Generic); + DoEditorUi(Ui, BrushSettingsWindow, &LayeredBrush->Modifier, CSz("Modifier"), &DefaultUiRenderParams_Generic); PushNewRow(Ui); } @@ -1638,7 +1638,7 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti EditLayerIndex = LayerIndex; } - DoSettingsForBrush(Engine, Layer, BrushSettingsWindow); + DoSettingsForBrushLayer(Engine, Layer, BrushSettingsWindow); } if (IsNewBrush && LayerIndex == 0) @@ -1801,36 +1801,10 @@ DoBrushSettingsWindow(engine_resources *Engine, world_edit_tool WorldEditTool, w switch (WorldEditBrushType) { case WorldEdit_BrushType_Disabled: {} break; - case WorldEdit_BrushType_Selection: {} break; case WorldEdit_BrushType_Single: {} break; case WorldEdit_BrushType_Entity: {} break; + case WorldEdit_BrushType_Asset: {} break; - case WorldEdit_BrushType_Asset: - { - PushWindowStart(Ui, &Window); - DoEditorUi(Ui, &Window, &Editor->Params.Mode, CSz("Mode"), &DefaultUiRenderParams_Generic); - DoEditorUi(Ui, &Window, &Editor->Params.Modifier, CSz("Modifier"), &DefaultUiRenderParams_Generic); - PushWindowEnd(Ui, &Window); - } break; - - -#if 0 - case WorldEdit_BrushType_Noise: - { - CheckForChangesAndUpdate_ThenRenderToPreviewTexture(Engine, &Editor->Noise); - PushWindowStart(Ui, &Window); - DoSettingsForBrush(Engine, &Editor->Noise, &Window); - PushWindowEnd(Ui, &Window); - } break; - - case WorldEdit_BrushType_Shape: - { - CheckForChangesAndUpdate_ThenRenderToPreviewTexture(Engine, &Editor->Shape); - PushWindowStart(Ui, &Window); - DoSettingsForBrush(Engine, &Editor->Shape, &Window); - PushWindowEnd(Ui, &Window); - } break; -#endif case WorldEdit_BrushType_Layered: { @@ -2029,6 +2003,36 @@ InputStateIsValidToApplyEdit(input *Input) return Result; } +link_internal world_edit_mode +GetEditModeForSelectedTool(level_editor *Editor) +{ + // Default is attach for tools/brushes that don't have a mode in their settings + world_edit_mode Result = WorldEdit_Mode_Attach; + + switch(Editor->Tool) + { + case WorldEdit_Tool_Disabled: {} break; + case WorldEdit_Tool_Select: {} break; + case WorldEdit_Tool_Eyedropper: {} break; + case WorldEdit_Tool_BlitEntity: {} break; + + case WorldEdit_Tool_Brush: + { + switch(Editor->BrushType) + { + case WorldEdit_BrushType_Disabled: {} break; + case WorldEdit_BrushType_Entity: {} break; + case WorldEdit_BrushType_Single: { Result = Editor->SingleBrush.Mode; } break; + case WorldEdit_BrushType_Asset: { Result = Editor->AssetBrush.Mode; } break; + case WorldEdit_BrushType_Layered: { Result = Editor->LayeredBrushEditor.Mode;} break; + } + } break; + } + + return Result; +} + + link_internal void DoWorldEditor(engine_resources *Engine) { @@ -2193,6 +2197,7 @@ DoWorldEditor(engine_resources *Engine) case AssetType_WorldChunk: case AssetType_Models: { + // TODO(Jesse): There should be an unsafe version of this function, and rename this one to TryGetDimForAssetModel ..? maybe_v3i MaybeDim = GetDimForAssetModel(Asset, u32(EngineDebug->ModelIndex)); if (MaybeDim.Tag) { @@ -2211,7 +2216,7 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_asset, .world_update_op_shape_params_asset = AssetUpdateShape, }; - QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, Editor->Params.Modifier, &Shape, {}, {}, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, Editor->AssetBrush.Mode, Editor->AssetBrush.Modifier, &Shape, {}, {}, Engine->WorldUpdateMemory); } else if (Editor->BrushType == WorldEdit_BrushType_Entity) { @@ -2223,7 +2228,8 @@ DoWorldEditor(engine_resources *Engine) } else { - InvalidCodePath(); + InvalidCodePath(); // NOTE(Jesse): This is redundant because we already checked it's one of these, + // but I'm going to keep it here in case we ever move this code.. or the checks. } } else @@ -2249,6 +2255,7 @@ DoWorldEditor(engine_resources *Engine) // and we can just collapse world edits automatically in the edit thread. // // When my laptop is unplugged running on battery power, this is _much_ faster. +#if 0 if (Editor->Params.Mode == WorldEdit_Mode_Paint) { @@ -2280,6 +2287,7 @@ DoWorldEditor(engine_resources *Engine) } } } +#endif } break; case WorldEdit_BrushType_Layered: @@ -2304,18 +2312,10 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_chunk_data, .world_update_op_shape_params_chunk_data = ChunkDataShape, }; - QueueWorldUpdateForRegion(Engine, Editor->Params.Mode, Editor->Params.Modifier, &Shape, Editor->SelectedColorIndex, Editor->LayeredBrushEditor.SeedBrushWithSelection, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, Editor->LayeredBrushEditor.Mode, Editor->LayeredBrushEditor.Modifier, &Shape, Editor->SelectedColorIndex, Editor->LayeredBrushEditor.SeedBrushWithSelection, Engine->WorldUpdateMemory); } } break; - case WorldEdit_BrushType_Selection: - { - /* if (AABBTest.Face && InputStateIsValidToApplyEdit(Input)) */ - /* { */ - /* ApplyEditToRegion(Engine, &SelectionAABB, Engine->Editor.SelectedColorIndex, Editor->Params.Mode, Editor->Params.Modifier); */ - /* } */ - } break; - } } break; @@ -2402,7 +2402,7 @@ DoWorldEditor(engine_resources *Engine) type_world_update_op_shape_params_asset, .world_update_op_shape_params_asset = AssetUpdateShape, }; - QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, Editor->Params.Modifier, &Shape, {}, {}, Engine->WorldUpdateMemory); + QueueWorldUpdateForRegion(Engine, WorldEdit_Mode_Attach, WorldEdit_Modifier_Default, &Shape, {}, {}, Engine->WorldUpdateMemory); #endif } } @@ -2505,7 +2505,7 @@ DoWorldEditor(engine_resources *Engine) if (Engine->MousedOverVoxel.Tag) { - v3 HotVoxel = GetHotVoxelForEditMode(Engine, Editor->Params.Mode); + v3 HotVoxel = GetHotVoxelForEditMode(Engine, GetEditModeForSelectedTool(Editor) ); DEBUG_HighlightVoxel( Engine, HotVoxel, RED, 0.075f); } } diff --git a/src/engine/editor.h b/src/engine/editor.h index 7048a679f..31f7abc63 100644 --- a/src/engine/editor.h +++ b/src/engine/editor.h @@ -590,12 +590,9 @@ enum world_edit_tool enum world_edit_brush_type { WorldEdit_BrushType_Disabled, // poof(@ui_skip) - WorldEdit_BrushType_Selection, WorldEdit_BrushType_Single, WorldEdit_BrushType_Asset, WorldEdit_BrushType_Entity, - /* WorldEdit_BrushType_Shape, */ - /* WorldEdit_BrushType_Noise, */ WorldEdit_BrushType_Layered, }; @@ -616,15 +613,6 @@ enum world_edit_mode_modifier WorldEdit_Modifier_Surface = (1<<1), }; -struct world_edit_params -{ - world_edit_mode Mode; - world_edit_mode_modifier Modifier; - - s32 Iterations = 1; // NOTE(Jesse): Set this to do the filter multiple times. -}; - - @@ -709,8 +697,6 @@ poof(do_editor_ui_for_radio_enum(world_edit_tool)) poof(do_editor_ui_for_radio_enum(world_edit_brush_type)) #include -poof(do_editor_ui_for_compound_type(world_edit_params)) -#include @@ -972,8 +958,26 @@ struct brush_layer #define NameBuf_Len (256) // TODO(Jesse): Make this dynamic .. probably .. #define MAX_BRUSH_LAYERS 16 -#define BRUSH_PREVIEW_TEXTURE_DIM 256 -struct layered_brush_editor poof(@version(2)) +struct layered_brush_editor poof(@version(3)) +{ + // NOTE(Jesse): This is so we can just copy the name of the brush in here and + // not fuck around with allocating a single string when we load these in. + char NameBuf[NameBuf_Len+1]; poof(@no_serialize @ui_text_box) + + s32 LayerCount; + brush_layer Layers[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount)) + + b8 SeedBrushWithSelection; + b8 BrushFollowsCursor; + + // NOTE(Jesse): These are the global settings for the brush when it gets applied to the world. + world_edit_mode Mode; + world_edit_mode_modifier Modifier; + + chunk_thumbnail Preview; poof(@no_serialize) +}; + +struct layered_brush_editor_2 { // NOTE(Jesse): This is so we can just copy the name of the brush in here and // not fuck around with allocating a single string when we load these in. @@ -988,6 +992,7 @@ struct layered_brush_editor poof(@version(2)) chunk_thumbnail Preview; poof(@no_serialize) }; + struct layered_brush_editor_1 { char NameBuf[NameBuf_Len]; @@ -1010,6 +1015,13 @@ struct layered_brush_editor_0 b8 SeedBrushWithSelection; poof(@no_serialize) }; +link_internal void +Marshal(layered_brush_editor_2 *Stored, layered_brush_editor *Live) +{ + poof(default_marshal(layered_brush_editor_2)) +#include +} + link_internal void Marshal(layered_brush_editor_1 *Stored, layered_brush_editor *Live) { @@ -1029,6 +1041,29 @@ Marshal(layered_brush_editor_0 *Stored, layered_brush_editor *Live) +struct single_brush_settings +{ + world_edit_mode Mode; +}; + + +struct asset_brush_settings +{ + world_edit_mode Mode; + world_edit_mode_modifier Modifier; +}; + +/* struct entity_brush_settings */ +/* { */ +/* world_edit_mode Mode; */ +/* world_edit_mode_modifier Modifier; */ +/* }; */ + + + + + + @@ -1040,13 +1075,11 @@ struct level_editor world_edit_tool PreviousTool; // So we can 'pop' back to the last tool on select/eyedropper world_edit_brush_type BrushType; - world_edit_params Params; - - b8 SelectionFollowsCursor; - /* brush_layer Noise; */ - /* brush_layer Shape; */ - layered_brush_editor LayeredBrushEditor; + single_brush_settings SingleBrush; + asset_brush_settings AssetBrush; + /* entity_brush_settings EntityBrush; */ + layered_brush_editor LayeredBrushEditor; b32 RootChunkNeedsNewMesh; diff --git a/src/engine/game_effects.cpp b/src/engine/game_effects.cpp index ac8086fd0..b651b0933 100644 --- a/src/engine/game_effects.cpp +++ b/src/engine/game_effects.cpp @@ -280,7 +280,7 @@ DoDig( engine_resources *Resources, canonical_position PickCP, f32 Radius, f32 D .Type = type_world_update_op_shape_params_rect, .world_update_op_shape_params_rect.Region = RectMinMax(MinP,MaxP), }; - QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldEdit_Modifier_Default, &Shape, ICE_BLUE, {}, Resources->WorldUpdateMemory); + QueueWorldUpdateForRegion(Resources, WorldEdit_Mode_Remove, WorldEdit_Modifier_Default, &Shape, {}, {}, Resources->WorldUpdateMemory); } link_internal void diff --git a/src/engine/serdes.cpp b/src/engine/serdes.cpp index c40f27c08..28eeed493 100644 --- a/src/engine/serdes.cpp +++ b/src/engine/serdes.cpp @@ -494,8 +494,6 @@ poof(serdes_struct(perlin_noise_params)) #include poof(serdes_struct(voronoi_noise_params)) #include -poof(serdes_struct(world_edit_params)) -#include poof(serdes_struct(noise_layer_0)) #include poof(serdes_struct(noise_layer)) @@ -521,5 +519,7 @@ poof(serdes_struct(layered_brush_editor_0)) #include poof(serdes_struct(layered_brush_editor_1)) #include +poof(serdes_struct(layered_brush_editor_2)) +#include poof(serdes_struct(layered_brush_editor)) #include From cd2549860924d1d14e9420d9164e368014147b7c Mon Sep 17 00:00:00 2001 From: a pirate Date: Mon, 2 Sep 2024 11:05:59 -0700 Subject: [PATCH 4/9] Factor chunk_previews out of brush_layer --- .../default_marshal_layered_brush_editor_0.h | 2 +- .../default_marshal_layered_brush_editor_1.h | 2 +- .../default_marshal_layered_brush_editor_2.h | 19 +++ ..._editor_ui_for_compound_type_brush_layer.h | 8 +- ...i_for_compound_type_layered_brush_editor.h | 16 ++ ...editor_ui_for_compound_type_level_editor.h | 16 ++ .../serdes_struct_layered_brush_editor_2.h | 147 ++++++++++++++++++ jesse.make.sh | 8 +- src/engine/editor.cpp | 40 ++--- src/engine/editor.h | 25 ++- src/engine/world_zzz | 0 11 files changed, 238 insertions(+), 45 deletions(-) create mode 100644 generated/default_marshal_layered_brush_editor_2.h create mode 100644 generated/serdes_struct_layered_brush_editor_2.h create mode 100644 src/engine/world_zzz diff --git a/generated/default_marshal_layered_brush_editor_0.h b/generated/default_marshal_layered_brush_editor_0.h index 7788e0d9d..47404e901 100644 --- a/generated/default_marshal_layered_brush_editor_0.h +++ b/generated/default_marshal_layered_brush_editor_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1035:0 +// src/engine/editor.h:1038:0 Live->LayerCount = Stored->LayerCount; diff --git a/generated/default_marshal_layered_brush_editor_1.h b/generated/default_marshal_layered_brush_editor_1.h index a395b964d..8f120f788 100644 --- a/generated/default_marshal_layered_brush_editor_1.h +++ b/generated/default_marshal_layered_brush_editor_1.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1028:0 +// src/engine/editor.h:1031:0 RangeIterator(Index, (256)) { diff --git a/generated/default_marshal_layered_brush_editor_2.h b/generated/default_marshal_layered_brush_editor_2.h new file mode 100644 index 000000000..518647523 --- /dev/null +++ b/generated/default_marshal_layered_brush_editor_2.h @@ -0,0 +1,19 @@ +// src/engine/editor.h:1024:0 + +Live->LayerCount = Stored->LayerCount; + + +RangeIterator(Index, 16) +{ + Live->Layers[Index] = Stored->Layers[Index]; +} + + +Live->SeedBrushWithSelection = Stored->SeedBrushWithSelection; + + +Live->BrushFollowsCursor = Stored->BrushFollowsCursor; + + + + diff --git a/generated/do_editor_ui_for_compound_type_brush_layer.h b/generated/do_editor_ui_for_compound_type_brush_layer.h index 6b185e171..c41fd7e50 100644 --- a/generated/do_editor_ui_for_compound_type_brush_layer.h +++ b/generated/do_editor_ui_for_compound_type_brush_layer.h @@ -41,13 +41,7 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, brush_layer *Element, cs Name - DoEditorUi(Ui, - Window, - // Cast to remove const/volatile keywords if they're there - Cast(chunk_thumbnail*,&Element->Preview), - CSz("Preview"), - Params - ); + if (DidToggle) { CLOSE_INDENT_FOR_TOGGLEABLE_REGION(); } PushTableEnd(Ui); } diff --git a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h index 7c0f2fdea..9e7305ebb 100644 --- a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h +++ b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h @@ -75,6 +75,22 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, layered_brush_editor *Element + if (ToggleButton(Ui, CSz("v LayerPreviews[16]"), CSz("> LayerPreviews[16]"), UiId(Window, "toggle layered_brush_editor chunk_thumbnail LayerPreviews", Element->LayerPreviews), Params )) + { + OPEN_INDENT_FOR_TOGGLEABLE_REGION(); + PushNewRow(Ui); + RangeIterator(ArrayIndex, 16) + { + DoEditorUi(Ui, Window, Element->LayerPreviews+ArrayIndex, FSz("LayerPreviews[%d]", ArrayIndex), Params); + + } + CLOSE_INDENT_FOR_TOGGLEABLE_REGION(); + } + PushNewRow(Ui); + + + + DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/do_editor_ui_for_compound_type_level_editor.h b/generated/do_editor_ui_for_compound_type_level_editor.h index 6ed9a9d21..48c8b393a 100644 --- a/generated/do_editor_ui_for_compound_type_level_editor.h +++ b/generated/do_editor_ui_for_compound_type_level_editor.h @@ -131,6 +131,22 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, level_editor *Element, cs Nam + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(b8*,&Element->SelectionFollowsCursor), + CSz("SelectionFollowsCursor"), + Params + ); + + + + + + + + PushNewRow(Ui); + DoEditorUi(Ui, Window, Cast(b8*,&Element->RootChunkNeedsNewMesh), diff --git a/generated/serdes_struct_layered_brush_editor_2.h b/generated/serdes_struct_layered_brush_editor_2.h new file mode 100644 index 000000000..8f81d54f1 --- /dev/null +++ b/generated/serdes_struct_layered_brush_editor_2.h @@ -0,0 +1,147 @@ +// src/engine/serdes.cpp:522:0 + +link_internal bonsai_type_info +TypeInfo(layered_brush_editor_2 *Ignored) +{ + bonsai_type_info Result = {}; + + Result.Name = CSz("layered_brush_editor_2"); + Result.Version = 0 ; + + /* type.map(member) */ + /* { */ + /* { */ + /* member_info Member = {CSz("member.name"), CSz("member.name"), 0x(member.hash)}; */ + /* Push(&Result.Members, &Member); */ + /* } */ + /* } */ + + return Result; +} + +link_internal b32 +Serialize(u8_cursor_block_array *Bytes, layered_brush_editor_2 *BaseElement, umm Count = 1) +{ + Assert(Count > 0); + + u64 PointerTrue = True; + u64 PointerFalse = False; + + b32 Result = True; + + + + RangeIterator_t(umm, ElementIndex, Count) + { + layered_brush_editor_2 *Element = BaseElement + ElementIndex; + Result &= Serialize(Bytes, &Element->LayerCount); + + + + + + { + // TODO(Jesse): Should this really be a safe cast? + umm ThisCount = umm(Element->LayerCount); + + Result &= Serialize(Bytes, Element->Layers, ThisCount); + } + + + + + + Result &= Serialize(Bytes, &Element->SeedBrushWithSelection); + + + + + + Result &= Serialize(Bytes, &Element->BrushFollowsCursor); + + + + + + + + + + MAYBE_WRITE_DEBUG_OBJECT_DELIM(); + } + + return Result; +} + +link_internal b32 +Deserialize(u8_cursor *Bytes, layered_brush_editor_2 *Element, memory_arena *Memory, umm Count = 1); + +link_internal b32 +DeserializeCurrentVersion(u8_cursor *Bytes, layered_brush_editor_2 *Element, memory_arena *Memory); + + + + +link_internal b32 +DeserializeCurrentVersion(u8_cursor *Bytes, layered_brush_editor_2 *Element, memory_arena *Memory) +{ + b32 Result = True; + // NOTE(Jesse): Unfortunately we can't check for primitives because + // strings are considered primitive, but need memory to deserialize + Result &= Deserialize(Bytes, &Element->LayerCount, Memory); + + + + + + { + // TODO(Jesse): Should this really be a safe cast? + umm Count = umm(Element->LayerCount); + + Result &= Deserialize(Bytes, Element->Layers, Memory, Count); + } + + + + + + // NOTE(Jesse): Unfortunately we can't check for primitives because + // strings are considered primitive, but need memory to deserialize + Result &= Deserialize(Bytes, &Element->SeedBrushWithSelection, Memory); + + + + + + // NOTE(Jesse): Unfortunately we can't check for primitives because + // strings are considered primitive, but need memory to deserialize + Result &= Deserialize(Bytes, &Element->BrushFollowsCursor, Memory); + + + + + + + + + + MAYBE_READ_DEBUG_OBJECT_DELIM(); + return Result; +} + +link_internal b32 +Deserialize(u8_cursor *Bytes, layered_brush_editor_2 *Element, memory_arena *Memory, umm Count) +{ + Assert(Count > 0); + + b32 Result = True; + RangeIterator_t(umm, ElementIndex, Count) + { + Result &= DeserializeCurrentVersion(Bytes, Element+ElementIndex, Memory); + + } + + return Result; +} + + diff --git a/jesse.make.sh b/jesse.make.sh index 714c9257b..8e1178b7f 100644 --- a/jesse.make.sh +++ b/jesse.make.sh @@ -5,13 +5,13 @@ ./make.sh RunPoof [ $? -ne 0 ] && exit 1 -./make.sh $OPT BuildAll +# ./make.sh $OPT BuildAll # ./make.sh RunTests -# ./make.sh $OPT \ -# BuildSingleExample examples/blank_project \ - # BuildExecutables \ +./make.sh $OPT \ + BuildSingleExample examples/blank_project \ + BuildExecutables \ # BuildSingleExample examples/tools/voxel_synthesis_rule_baker \ # BuildSingleExample examples/turn_based \ # BuildSingleExample examples/project_and_level_picker \ diff --git a/src/engine/editor.cpp b/src/engine/editor.cpp index 28d7d2d30..5d6f55ad8 100644 --- a/src/engine/editor.cpp +++ b/src/engine/editor.cpp @@ -56,7 +56,7 @@ InitEditor(level_editor *Editor) RangeIterator(LayerIndex, MAX_BRUSH_LAYERS) { - Editor->LayeredBrushEditor.Layers[LayerIndex].Preview.Thumbnail.Texture.Dim = V2i(BRUSH_PREVIEW_TEXTURE_DIM); + Editor->LayeredBrushEditor.LayerPreviews[LayerIndex].Thumbnail.Texture.Dim = V2i(BRUSH_PREVIEW_TEXTURE_DIM); } return Result; @@ -1015,14 +1015,14 @@ GetLayerDim(brush_layer *Layer) case BrushLayerType_Noise: { - Result += Layer->Preview.Chunk.Dim; + Result += GetSelectionDim(GetWorld(), GetLevelEditor()); //Preview->Chunk.Dim; } break; } return Result; } link_internal b32 -CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, brush_layer *Layer) +CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, brush_layer *Layer, chunk_thumbnail *Preview) { UNPACK_ENGINE_RESOURCES(Engine); @@ -1032,7 +1032,7 @@ CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, br v3i SelectionDim = GetSelectionDim(World, Editor); v3i RequiredLayerDim = GetRequiredDimForLayer(SelectionDim, Layer); - b32 ReallocChunk = Editor->SelectionChanged || Layer->Preview.Chunk.Dim != RequiredLayerDim; + b32 ReallocChunk = Editor->SelectionChanged || Preview->Chunk.Dim != RequiredLayerDim; b32 SettingsChanged = !AreEqual(Settings, PrevSettings); b32 UpdateVoxels = ReallocChunk || SettingsChanged; @@ -1040,7 +1040,7 @@ CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, br - world_chunk *Chunk = &Layer->Preview.Chunk; + world_chunk *Chunk = &Preview->Chunk; if (ReallocChunk) { // TODO(Jesse)(leak): Figure out exactly how this works. We can't allocate from the Editor @@ -1096,9 +1096,9 @@ CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, br if (LengthSq(GetShapeDim(Shape)) > 0) { - ApplyBrushLayer(Engine, Layer, Chunk, Settings->Offset.Min); - FinalizeChunkInitialization(Chunk); - QueueChunkForMeshRebuild(&Plat->LowPriority, Chunk); + ApplyBrushLayer(Engine, Layer, Preview, Chunk, Settings->Offset.Min); + FinalizeChunkInitialization(Chunk); + QueueChunkForMeshRebuild(&Plat->LowPriority, Chunk); } } break; @@ -1156,9 +1156,9 @@ CheckForChangesAndUpdate_ThenRenderToPreviewTexture(engine_resources *Engine, br SyncGpuBuffersAsync(Engine, &Chunk->Meshes); } - if (Layer->Preview.Thumbnail.Texture.ID) // NOTE(Jesse): Avoid spamming a warning to console + if (Preview->Thumbnail.Texture.ID) // NOTE(Jesse): Avoid spamming a warning to console { - RenderToTexture_Async(&Plat->RenderQ, Engine, &Layer->Preview.Thumbnail, &Chunk->Meshes, V3(Chunk->Dim)/-2.f, 0); + RenderToTexture_Async(&Plat->RenderQ, Engine, &Preview->Thumbnail, &Chunk->Meshes, V3(Chunk->Dim)/-2.f, 0); } return UpdateVoxels; @@ -1227,7 +1227,7 @@ BrushSettingsForNoiseBrush(engine_resources *Engine, window_layout *Window, nois } link_internal void -DoSettingsForBrushLayer(engine_resources *Engine, brush_layer *Layer, window_layout *Window) +DoSettingsForBrushLayer(engine_resources *Engine, brush_layer *Layer, chunk_thumbnail *Preview, window_layout *Window) { UNPACK_ENGINE_RESOURCES(Engine); @@ -1243,7 +1243,7 @@ DoSettingsForBrushLayer(engine_resources *Engine, brush_layer *Layer, window_lay { case BrushLayerType_Noise: { - BrushSettingsForNoiseBrush(Engine, Window, &Settings->Noise, &Layer->Preview); + BrushSettingsForNoiseBrush(Engine, Window, &Settings->Noise, Preview); } break; case BrushLayerType_Shape: @@ -1280,14 +1280,14 @@ DoSettingsForBrushLayer(engine_resources *Engine, brush_layer *Layer, window_lay } PushTableStart(Ui); - InteractWithThumbnailTexture(Engine, Ui, Window, "noise preview interaction", &Layer->Preview.Thumbnail); + InteractWithThumbnailTexture(Engine, Ui, Window, "noise preview interaction", &Preview->Thumbnail); PushNewRow(Ui); PushTableEnd(Ui); CLOSE_INDENT_FOR_TOGGLEABLE_REGION(); } link_internal void -ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, world_chunk *DestChunk, v3i SmallestMinOffset) +ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, chunk_thumbnail *Preview, world_chunk *DestChunk, v3i SmallestMinOffset) { UNPACK_ENGINE_RESOURCES(Engine); @@ -1332,7 +1332,7 @@ ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, world_chunk *DestC case BrushLayerType_Noise: { noise_layer *Noise = &Settings->Noise; - world_chunk *SrcChunk = &Layer->Preview.Chunk; + world_chunk *SrcChunk = &Preview->Chunk; v3i SrcOffsetMin = Settings->Offset.Min; v3i DestRelativeMinCorner = (-1*SmallestMinOffset) + SrcOffsetMin; @@ -1446,6 +1446,7 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti layered_brush_editor *LayeredBrush = &Editor->LayeredBrushEditor; brush_layer *Layers = LayeredBrush->Layers; + chunk_thumbnail *Previews = LayeredBrush->LayerPreviews; cs BrushNameBuf = CS(LayeredBrush->NameBuf, NameBuf_Len); @@ -1581,7 +1582,8 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti RangeIterator(LayerIndex, LayeredBrush->LayerCount) { brush_layer *Layer = Layers + LayerIndex; - AnyChanges |= CheckForChangesAndUpdate_ThenRenderToPreviewTexture(Engine, Layer); + chunk_thumbnail *Preview = Previews + LayerIndex; + AnyChanges |= CheckForChangesAndUpdate_ThenRenderToPreviewTexture(Engine, Layer, Preview); } if (AnyChanges) @@ -1610,6 +1612,7 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti RangeIterator(LayerIndex, LayeredBrush->LayerCount) { brush_layer *Layer = Layers + LayerIndex; + chunk_thumbnail *Preview = Previews + LayerIndex; ui_id ToggleId = UiId(BrushSettingsWindow, "brush_layer toggle interaction", Layer); if (ToggleButton(Ui, FSz("v Layer %d", LayerIndex), FSz("> Layer %d", LayerIndex), ToggleId)) @@ -1638,7 +1641,7 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti EditLayerIndex = LayerIndex; } - DoSettingsForBrushLayer(Engine, Layer, BrushSettingsWindow); + DoSettingsForBrushLayer(Engine, Layer, Preview, BrushSettingsWindow); } if (IsNewBrush && LayerIndex == 0) @@ -1747,7 +1750,8 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti RangeIterator(LayerIndex, LayeredBrush->LayerCount) { brush_layer *Layer = Layers + LayerIndex; - ApplyBrushLayer(Engine, Layer, Root_LayeredBrushPreview, SmallestMinOffset); + chunk_thumbnail *Preview = Previews + LayerIndex; + ApplyBrushLayer(Engine, Layer, Preview, Root_LayeredBrushPreview, SmallestMinOffset); } FinalizeChunkInitialization(Root_LayeredBrushPreview); diff --git a/src/engine/editor.h b/src/engine/editor.h index 31f7abc63..35fddb16f 100644 --- a/src/engine/editor.h +++ b/src/engine/editor.h @@ -949,8 +949,6 @@ struct brush_layer { brush_settings Settings; brush_settings PrevSettings; poof(@no_serialize @ui_skip) // Change detection - - chunk_thumbnail Preview; poof(@no_serialize) }; @@ -958,14 +956,19 @@ struct brush_layer #define NameBuf_Len (256) // TODO(Jesse): Make this dynamic .. probably .. #define MAX_BRUSH_LAYERS 16 +#define BRUSH_PREVIEW_TEXTURE_DIM 256 struct layered_brush_editor poof(@version(3)) { // NOTE(Jesse): This is so we can just copy the name of the brush in here and // not fuck around with allocating a single string when we load these in. char NameBuf[NameBuf_Len+1]; poof(@no_serialize @ui_text_box) - s32 LayerCount; - brush_layer Layers[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount)) + // NOTE(Jesse): The layer previews have to be seperate from the brush_layer + // because the deserialization code isn't smart enough to not stomp on the + // texture handles when it marshals old types to the current one. + s32 LayerCount; + brush_layer Layers[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount)) + chunk_thumbnail LayerPreviews[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount) @no_serialize) b8 SeedBrushWithSelection; b8 BrushFollowsCursor; @@ -984,7 +987,7 @@ struct layered_brush_editor_2 char NameBuf[NameBuf_Len+1]; poof(@no_serialize @ui_text_box) s32 LayerCount; - brush_layer Layers[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount)) + brush_layer Layers[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount)) b8 SeedBrushWithSelection; b8 BrushFollowsCursor; @@ -1053,13 +1056,6 @@ struct asset_brush_settings world_edit_mode_modifier Modifier; }; -/* struct entity_brush_settings */ -/* { */ -/* world_edit_mode Mode; */ -/* world_edit_mode_modifier Modifier; */ -/* }; */ - - @@ -1078,9 +1074,10 @@ struct level_editor single_brush_settings SingleBrush; asset_brush_settings AssetBrush; - /* entity_brush_settings EntityBrush; */ layered_brush_editor LayeredBrushEditor; + b8 SelectionFollowsCursor; + b32 RootChunkNeedsNewMesh; cp MostRecentSelectionRegionMin; @@ -1152,7 +1149,7 @@ link_internal v3 GetHotVoxelForFlood(engine_resources *Engine, world_edit_mode WorldEditMode, world_edit_mode_modifier Modifier); link_internal void -ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, world_chunk *DestChunk, v3i SmallestMinOffset); +ApplyBrushLayer(engine_resources *Engine, brush_layer *Layer, chunk_thumbnail *Preview, world_chunk *DestChunk, v3i SmallestMinOffset); link_internal v3i GetSmallestMinOffset(layered_brush_editor *LayeredBrush, v3i *LargestLayerDim = 0); diff --git a/src/engine/world_zzz b/src/engine/world_zzz new file mode 100644 index 000000000..e69de29bb From a2f2f90aae9ebd852c19b89dd3a441017a0f1101 Mon Sep 17 00:00:00 2001 From: a pirate Date: Tue, 3 Sep 2024 08:23:30 -0700 Subject: [PATCH 5/9] Visually mask out selection region in shader --- .../block_array_c_asset_thumbnail_688856411.h | 2 +- ...do_editor_ui_for_compound_type_animation.h | 2 +- .../do_editor_ui_for_compound_type_asset.h | 2 +- .../do_editor_ui_for_compound_type_asset_id.h | 2 +- ...tor_ui_for_compound_type_asset_thumbnail.h | 2 +- ...editor_ui_for_compound_type_bonsai_futex.h | 2 +- ...ditor_ui_for_compound_type_bonsai_stdlib.h | 2 +- ..._editor_ui_for_compound_type_brush_layer.h | 2 +- ...itor_ui_for_compound_type_brush_settings.h | 2 +- .../do_editor_ui_for_compound_type_camera.h | 2 +- ...o_editor_ui_for_compound_type_chunk_data.h | 2 +- ...tor_ui_for_compound_type_chunk_thumbnail.h | 2 +- ...tor_ui_for_compound_type_collision_event.h | 2 +- ..._editor_ui_for_compound_type_debug_state.h | 2 +- ...editor_ui_for_compound_type_engine_debug.h | 2 +- ...or_ui_for_compound_type_engine_resources.h | 2 +- ...tor_ui_for_compound_type_engine_settings.h | 2 +- .../do_editor_ui_for_compound_type_entity.h | 2 +- ...do_editor_ui_for_compound_type_entity_id.h | 2 +- ...i_for_compound_type_entity_position_info.h | 2 +- ...ui_for_compound_type_file_traversal_node.h | 2 +- .../do_editor_ui_for_compound_type_frustum.h | 2 +- ..._for_compound_type_g_buffer_render_group.h | 32 ++++++++++++++++++- ..._editor_ui_for_compound_type_game_lights.h | 2 +- ...compound_type_gpu_element_buffer_handles.h | 2 +- ..._compound_type_gpu_mapped_element_buffer.h | 2 +- .../do_editor_ui_for_compound_type_graphics.h | 2 +- ...r_ui_for_compound_type_graphics_settings.h | 2 +- .../do_editor_ui_for_compound_type_input.h | 2 +- ..._editor_ui_for_compound_type_input_event.h | 2 +- .../do_editor_ui_for_compound_type_keyframe.h | 2 +- ...i_for_compound_type_layered_brush_editor.h | 2 +- ...editor_ui_for_compound_type_level_editor.h | 2 +- ..._for_compound_type_lighting_render_group.h | 2 +- ...r_ui_for_compound_type_lighting_settings.h | 2 +- ..._ui_for_compound_type_lod_element_buffer.h | 2 +- .../do_editor_ui_for_compound_type_model.h | 2 +- ..._editor_ui_for_compound_type_noise_layer.h | 2 +- .../do_editor_ui_for_compound_type_particle.h | 2 +- ...tor_ui_for_compound_type_particle_system.h | 2 +- ...ui_for_compound_type_perlin_noise_params.h | 2 +- .../do_editor_ui_for_compound_type_physics.h | 2 +- .../do_editor_ui_for_compound_type_plane.h | 2 +- .../do_editor_ui_for_compound_type_platform.h | 2 +- ...ditor_ui_for_compound_type_random_series.h | 2 +- ...r_ui_for_compound_type_render_buffers_2d.h | 2 +- ...editor_ui_for_compound_type_render_debug.h | 2 +- ...tor_ui_for_compound_type_render_settings.h | 2 +- ..._editor_ui_for_compound_type_renderer_2d.h | 2 +- .../do_editor_ui_for_compound_type_shader.h | 2 +- ..._editor_ui_for_compound_type_shape_layer.h | 2 +- .../do_editor_ui_for_compound_type_texture.h | 2 +- .../do_editor_ui_for_compound_type_ui_debug.h | 2 +- .../do_editor_ui_for_compound_type_ui_id.h | 2 +- ...do_editor_ui_for_compound_type_ui_toggle.h | 2 +- ...pound_type_untextured_3d_geometry_buffer.h | 2 +- ...tor_ui_for_compound_type_vertex_material.h | 2 +- ...i_for_compound_type_voronoi_noise_params.h | 2 +- .../do_editor_ui_for_compound_type_vox_data.h | 2 +- .../do_editor_ui_for_compound_type_voxel.h | 2 +- ...itor_ui_for_compound_type_voxel_lighting.h | 2 +- ..._ui_for_compound_type_white_noise_params.h | 2 +- ...o_editor_ui_for_compound_type_work_queue.h | 2 +- ...or_ui_for_compound_type_work_queue_entry.h | 2 +- .../do_editor_ui_for_compound_type_world.h | 2 +- ..._editor_ui_for_compound_type_world_chunk.h | 2 +- ...d_type_world_update_op_shape_params_rect.h | 2 +- ...type_world_update_op_shape_params_sphere.h | 2 +- ..._ui_for_container_entity_ptr_block_array.h | 2 +- .../do_editor_ui_for_container_model_buffer.h | 2 +- ...tor_ui_for_container_ui_toggle_hashtable.h | 2 +- .../do_editor_ui_for_container_v3_cursor.h | 2 +- generated/do_editor_ui_for_enum_asset_type.h | 2 +- generated/do_editor_ui_for_enum_chunk_flag.h | 2 +- ...ditor_ui_for_enum_engine_debug_view_mode.h | 2 +- ...editor_ui_for_enum_entity_behavior_flags.h | 2 +- .../do_editor_ui_for_enum_entity_state.h | 2 +- ...o_editor_ui_for_enum_file_traversal_type.h | 2 +- ...o_editor_ui_for_enum_particle_spawn_type.h | 2 +- ...do_editor_ui_for_enum_resolution_setting.h | 2 +- ...itor_ui_for_enum_shader_language_setting.h | 2 +- generated/do_editor_ui_for_enum_shape_type.h | 2 +- .../do_editor_ui_for_enum_tone_mapping_type.h | 2 +- .../string_and_value_tables_asset_type.h | 2 +- ..._and_value_tables_engine_debug_view_mode.h | 2 +- ...ing_and_value_tables_file_traversal_node.h | 2 +- ...ing_and_value_tables_particle_spawn_type.h | 2 +- ...tring_and_value_tables_tone_mapping_type.h | 2 +- shaders/gBuffer.fragmentshader | 15 +++++++++ shaders/gBuffer.vertexshader | 3 ++ src/engine/editor.cpp | 24 -------------- src/engine/editor.h | 20 ++++++++++++ src/engine/render.cpp | 22 +++++++++++-- src/engine/render.h | 3 ++ src/engine/render/render_init.cpp | 10 ++++-- src/engine/resources.cpp | 6 ++-- 96 files changed, 190 insertions(+), 119 deletions(-) diff --git a/generated/block_array_c_asset_thumbnail_688856411.h b/generated/block_array_c_asset_thumbnail_688856411.h index 8b45d6e7f..f8a2a5f75 100644 --- a/generated/block_array_c_asset_thumbnail_688856411.h +++ b/generated/block_array_c_asset_thumbnail_688856411.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:102:0 +// src/engine/editor.cpp:78:0 link_internal asset_thumbnail_block* diff --git a/generated/do_editor_ui_for_compound_type_animation.h b/generated/do_editor_ui_for_compound_type_animation.h index 186a970ed..eb8279418 100644 --- a/generated/do_editor_ui_for_compound_type_animation.h +++ b/generated/do_editor_ui_for_compound_type_animation.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:238:0 +// src/engine/editor.cpp:214:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, animation *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_asset.h b/generated/do_editor_ui_for_compound_type_asset.h index b253416fc..dc2fd36af 100644 --- a/generated/do_editor_ui_for_compound_type_asset.h +++ b/generated/do_editor_ui_for_compound_type_asset.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:335:0 +// src/engine/editor.cpp:311:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_asset_id.h b/generated/do_editor_ui_for_compound_type_asset_id.h index 2d7e1fcc5..436c429fc 100644 --- a/generated/do_editor_ui_for_compound_type_asset_id.h +++ b/generated/do_editor_ui_for_compound_type_asset_id.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:327:0 +// src/engine/editor.cpp:303:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset_id *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_asset_thumbnail.h b/generated/do_editor_ui_for_compound_type_asset_thumbnail.h index 97c2c15a2..980365aaf 100644 --- a/generated/do_editor_ui_for_compound_type_asset_thumbnail.h +++ b/generated/do_editor_ui_for_compound_type_asset_thumbnail.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:357:0 +// src/engine/editor.cpp:333:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset_thumbnail *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_bonsai_futex.h b/generated/do_editor_ui_for_compound_type_bonsai_futex.h index b0380f3e8..48bfd9fe7 100644 --- a/generated/do_editor_ui_for_compound_type_bonsai_futex.h +++ b/generated/do_editor_ui_for_compound_type_bonsai_futex.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:244:0 +// src/engine/editor.cpp:220:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, bonsai_futex *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h b/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h index 27a9587b0..70ecb66da 100644 --- a/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h +++ b/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:175:0 +// src/engine/editor.cpp:151:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, bonsai_stdlib *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_brush_layer.h b/generated/do_editor_ui_for_compound_type_brush_layer.h index c41fd7e50..94854936b 100644 --- a/generated/do_editor_ui_for_compound_type_brush_layer.h +++ b/generated/do_editor_ui_for_compound_type_brush_layer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:366:0 +// src/engine/editor.cpp:342:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, brush_layer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_brush_settings.h b/generated/do_editor_ui_for_compound_type_brush_settings.h index b66e60b21..d3bb0b151 100644 --- a/generated/do_editor_ui_for_compound_type_brush_settings.h +++ b/generated/do_editor_ui_for_compound_type_brush_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:130:0 +// src/engine/editor.cpp:106:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, brush_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_camera.h b/generated/do_editor_ui_for_compound_type_camera.h index e5975be02..ea57d35a1 100644 --- a/generated/do_editor_ui_for_compound_type_camera.h +++ b/generated/do_editor_ui_for_compound_type_camera.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:351:0 +// src/engine/editor.cpp:327:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, camera *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_chunk_data.h b/generated/do_editor_ui_for_compound_type_chunk_data.h index 090ddde5c..efe2a202b 100644 --- a/generated/do_editor_ui_for_compound_type_chunk_data.h +++ b/generated/do_editor_ui_for_compound_type_chunk_data.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:274:0 +// src/engine/editor.cpp:250:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, chunk_data *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h b/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h index e2b35e4e2..980f8c868 100644 --- a/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h +++ b/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:360:0 +// src/engine/editor.cpp:336:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, chunk_thumbnail *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_collision_event.h b/generated/do_editor_ui_for_compound_type_collision_event.h index 9f9d548eb..2301341fc 100644 --- a/generated/do_editor_ui_for_compound_type_collision_event.h +++ b/generated/do_editor_ui_for_compound_type_collision_event.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:338:0 +// src/engine/editor.cpp:314:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, collision_event *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_debug_state.h b/generated/do_editor_ui_for_compound_type_debug_state.h index ad4e9a742..0dae453ef 100644 --- a/generated/do_editor_ui_for_compound_type_debug_state.h +++ b/generated/do_editor_ui_for_compound_type_debug_state.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:171:0 +// src/engine/editor.cpp:147:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, debug_state *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_engine_debug.h b/generated/do_editor_ui_for_compound_type_engine_debug.h index 4a66e7566..9dc1c9e09 100644 --- a/generated/do_editor_ui_for_compound_type_engine_debug.h +++ b/generated/do_editor_ui_for_compound_type_engine_debug.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:441:0 +// src/engine/editor.cpp:417:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_debug *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_engine_resources.h b/generated/do_editor_ui_for_compound_type_engine_resources.h index 1450931ac..55ad6d4a6 100644 --- a/generated/do_editor_ui_for_compound_type_engine_resources.h +++ b/generated/do_editor_ui_for_compound_type_engine_resources.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:463:0 +// src/engine/editor.cpp:439:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_resources *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_engine_settings.h b/generated/do_editor_ui_for_compound_type_engine_settings.h index 883c0c4d0..227f96cc6 100644 --- a/generated/do_editor_ui_for_compound_type_engine_settings.h +++ b/generated/do_editor_ui_for_compound_type_engine_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:459:0 +// src/engine/editor.cpp:435:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_entity.h b/generated/do_editor_ui_for_compound_type_entity.h index a5b71e474..c7d8957d3 100644 --- a/generated/do_editor_ui_for_compound_type_entity.h +++ b/generated/do_editor_ui_for_compound_type_entity.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:313:0 +// src/engine/editor.cpp:289:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_entity_id.h b/generated/do_editor_ui_for_compound_type_entity_id.h index f946cf5b3..c81e4dc8b 100644 --- a/generated/do_editor_ui_for_compound_type_entity_id.h +++ b/generated/do_editor_ui_for_compound_type_entity_id.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:310:0 +// src/engine/editor.cpp:286:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_id *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_entity_position_info.h b/generated/do_editor_ui_for_compound_type_entity_position_info.h index a1d5a3417..cb35c2b50 100644 --- a/generated/do_editor_ui_for_compound_type_entity_position_info.h +++ b/generated/do_editor_ui_for_compound_type_entity_position_info.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:341:0 +// src/engine/editor.cpp:317:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_position_info *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_file_traversal_node.h b/generated/do_editor_ui_for_compound_type_file_traversal_node.h index 8db113a61..a0d04238e 100644 --- a/generated/do_editor_ui_for_compound_type_file_traversal_node.h +++ b/generated/do_editor_ui_for_compound_type_file_traversal_node.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:298:0 +// src/engine/editor.cpp:274:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, file_traversal_node *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_frustum.h b/generated/do_editor_ui_for_compound_type_frustum.h index 7372d9861..c431f8d84 100644 --- a/generated/do_editor_ui_for_compound_type_frustum.h +++ b/generated/do_editor_ui_for_compound_type_frustum.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:348:0 +// src/engine/editor.cpp:324:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, frustum *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h b/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h index a9fcc7397..0f41245b3 100644 --- a/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h +++ b/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:429:0 +// src/engine/editor.cpp:405:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, g_buffer_render_group *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) @@ -71,6 +71,36 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, g_buffer_render_group *Elemen + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(v3*,&Element->MinClipP_worldspace), + CSz("MinClipP_worldspace"), + Params + ); + + + + + + + + + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(v3*,&Element->MaxClipP_worldspace), + CSz("MaxClipP_worldspace"), + Params + ); + + + + + + + + DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/do_editor_ui_for_compound_type_game_lights.h b/generated/do_editor_ui_for_compound_type_game_lights.h index 9c56adb28..21523abbe 100644 --- a/generated/do_editor_ui_for_compound_type_game_lights.h +++ b/generated/do_editor_ui_for_compound_type_game_lights.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:423:0 +// src/engine/editor.cpp:399:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, game_lights *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h b/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h index c6ab670dc..1c954d6b0 100644 --- a/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h +++ b/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:280:0 +// src/engine/editor.cpp:256:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, gpu_element_buffer_handles *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h b/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h index 60bc09f66..88dcf8177 100644 --- a/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h +++ b/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:283:0 +// src/engine/editor.cpp:259:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, gpu_mapped_element_buffer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_graphics.h b/generated/do_editor_ui_for_compound_type_graphics.h index 69f26b3c0..93567c8ca 100644 --- a/generated/do_editor_ui_for_compound_type_graphics.h +++ b/generated/do_editor_ui_for_compound_type_graphics.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:432:0 +// src/engine/editor.cpp:408:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, graphics *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_graphics_settings.h b/generated/do_editor_ui_for_compound_type_graphics_settings.h index f85631b1a..8d631707f 100644 --- a/generated/do_editor_ui_for_compound_type_graphics_settings.h +++ b/generated/do_editor_ui_for_compound_type_graphics_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:456:0 +// src/engine/editor.cpp:432:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, graphics_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_input.h b/generated/do_editor_ui_for_compound_type_input.h index 89326f569..9b5c1e2ac 100644 --- a/generated/do_editor_ui_for_compound_type_input.h +++ b/generated/do_editor_ui_for_compound_type_input.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:164:0 +// src/engine/editor.cpp:140:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, input *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_input_event.h b/generated/do_editor_ui_for_compound_type_input_event.h index cc262056c..87348c9e3 100644 --- a/generated/do_editor_ui_for_compound_type_input_event.h +++ b/generated/do_editor_ui_for_compound_type_input_event.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:161:0 +// src/engine/editor.cpp:137:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, input_event *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_keyframe.h b/generated/do_editor_ui_for_compound_type_keyframe.h index 0518508f1..c2c0acf9b 100644 --- a/generated/do_editor_ui_for_compound_type_keyframe.h +++ b/generated/do_editor_ui_for_compound_type_keyframe.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:235:0 +// src/engine/editor.cpp:211:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, keyframe *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h index 9e7305ebb..ae3cce60e 100644 --- a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h +++ b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:369:0 +// src/engine/editor.cpp:345:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, layered_brush_editor *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_level_editor.h b/generated/do_editor_ui_for_compound_type_level_editor.h index 48c8b393a..8f13764f3 100644 --- a/generated/do_editor_ui_for_compound_type_level_editor.h +++ b/generated/do_editor_ui_for_compound_type_level_editor.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:447:0 +// src/engine/editor.cpp:423:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, level_editor *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_lighting_render_group.h b/generated/do_editor_ui_for_compound_type_lighting_render_group.h index 5c5e96303..2c4d78eb3 100644 --- a/generated/do_editor_ui_for_compound_type_lighting_render_group.h +++ b/generated/do_editor_ui_for_compound_type_lighting_render_group.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:426:0 +// src/engine/editor.cpp:402:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, lighting_render_group *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_lighting_settings.h b/generated/do_editor_ui_for_compound_type_lighting_settings.h index 4578063f1..c539caaa6 100644 --- a/generated/do_editor_ui_for_compound_type_lighting_settings.h +++ b/generated/do_editor_ui_for_compound_type_lighting_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:214:0 +// src/engine/editor.cpp:190:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, lighting_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_lod_element_buffer.h b/generated/do_editor_ui_for_compound_type_lod_element_buffer.h index 1fcbbfb99..9acb59d37 100644 --- a/generated/do_editor_ui_for_compound_type_lod_element_buffer.h +++ b/generated/do_editor_ui_for_compound_type_lod_element_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:286:0 +// src/engine/editor.cpp:262:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, lod_element_buffer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_model.h b/generated/do_editor_ui_for_compound_type_model.h index 7790c0b0c..937585ba9 100644 --- a/generated/do_editor_ui_for_compound_type_model.h +++ b/generated/do_editor_ui_for_compound_type_model.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:289:0 +// src/engine/editor.cpp:265:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, model *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_noise_layer.h b/generated/do_editor_ui_for_compound_type_noise_layer.h index 5c3912e11..f5f995d85 100644 --- a/generated/do_editor_ui_for_compound_type_noise_layer.h +++ b/generated/do_editor_ui_for_compound_type_noise_layer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:363:0 +// src/engine/editor.cpp:339:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, noise_layer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_particle.h b/generated/do_editor_ui_for_compound_type_particle.h index 77963ec20..eb781f6a0 100644 --- a/generated/do_editor_ui_for_compound_type_particle.h +++ b/generated/do_editor_ui_for_compound_type_particle.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:229:0 +// src/engine/editor.cpp:205:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, particle *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_particle_system.h b/generated/do_editor_ui_for_compound_type_particle_system.h index d1e258b59..c964cf251 100644 --- a/generated/do_editor_ui_for_compound_type_particle_system.h +++ b/generated/do_editor_ui_for_compound_type_particle_system.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:232:0 +// src/engine/editor.cpp:208:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, particle_system *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_perlin_noise_params.h b/generated/do_editor_ui_for_compound_type_perlin_noise_params.h index 9f3c0feb4..6c0cac418 100644 --- a/generated/do_editor_ui_for_compound_type_perlin_noise_params.h +++ b/generated/do_editor_ui_for_compound_type_perlin_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:116:0 +// src/engine/editor.cpp:92:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, perlin_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_physics.h b/generated/do_editor_ui_for_compound_type_physics.h index dec87e1ee..e88ccc2b2 100644 --- a/generated/do_editor_ui_for_compound_type_physics.h +++ b/generated/do_editor_ui_for_compound_type_physics.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:220:0 +// src/engine/editor.cpp:196:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, physics *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_plane.h b/generated/do_editor_ui_for_compound_type_plane.h index 212abc7e6..c63331a46 100644 --- a/generated/do_editor_ui_for_compound_type_plane.h +++ b/generated/do_editor_ui_for_compound_type_plane.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:345:0 +// src/engine/editor.cpp:321:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, plane *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_platform.h b/generated/do_editor_ui_for_compound_type_platform.h index 3832a3fef..db1f8e8ca 100644 --- a/generated/do_editor_ui_for_compound_type_platform.h +++ b/generated/do_editor_ui_for_compound_type_platform.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:167:0 +// src/engine/editor.cpp:143:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, platform *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_random_series.h b/generated/do_editor_ui_for_compound_type_random_series.h index fd5e91d88..3cfc0a2e0 100644 --- a/generated/do_editor_ui_for_compound_type_random_series.h +++ b/generated/do_editor_ui_for_compound_type_random_series.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:223:0 +// src/engine/editor.cpp:199:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, random_series *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_render_buffers_2d.h b/generated/do_editor_ui_for_compound_type_render_buffers_2d.h index 13e301571..ee35e6eb3 100644 --- a/generated/do_editor_ui_for_compound_type_render_buffers_2d.h +++ b/generated/do_editor_ui_for_compound_type_render_buffers_2d.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:417:0 +// src/engine/editor.cpp:393:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, render_buffers_2d *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_render_debug.h b/generated/do_editor_ui_for_compound_type_render_debug.h index a54b4b17b..45a1680a2 100644 --- a/generated/do_editor_ui_for_compound_type_render_debug.h +++ b/generated/do_editor_ui_for_compound_type_render_debug.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:435:0 +// src/engine/editor.cpp:411:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, render_debug *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_render_settings.h b/generated/do_editor_ui_for_compound_type_render_settings.h index 8818a10a3..f0ea3201d 100644 --- a/generated/do_editor_ui_for_compound_type_render_settings.h +++ b/generated/do_editor_ui_for_compound_type_render_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:217:0 +// src/engine/editor.cpp:193:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, render_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_renderer_2d.h b/generated/do_editor_ui_for_compound_type_renderer_2d.h index b1fead5dd..73565136b 100644 --- a/generated/do_editor_ui_for_compound_type_renderer_2d.h +++ b/generated/do_editor_ui_for_compound_type_renderer_2d.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:420:0 +// src/engine/editor.cpp:396:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, renderer_2d *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_shader.h b/generated/do_editor_ui_for_compound_type_shader.h index 626ac1d2f..89a239470 100644 --- a/generated/do_editor_ui_for_compound_type_shader.h +++ b/generated/do_editor_ui_for_compound_type_shader.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:414:0 +// src/engine/editor.cpp:390:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shader *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_shape_layer.h b/generated/do_editor_ui_for_compound_type_shape_layer.h index 13c2bb418..578a5884a 100644 --- a/generated/do_editor_ui_for_compound_type_shape_layer.h +++ b/generated/do_editor_ui_for_compound_type_shape_layer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:128:0 +// src/engine/editor.cpp:104:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shape_layer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_texture.h b/generated/do_editor_ui_for_compound_type_texture.h index 8c6a1722f..1cbca768b 100644 --- a/generated/do_editor_ui_for_compound_type_texture.h +++ b/generated/do_editor_ui_for_compound_type_texture.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:354:0 +// src/engine/editor.cpp:330:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, texture *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_ui_debug.h b/generated/do_editor_ui_for_compound_type_ui_debug.h index d64c14ea2..f9e81a758 100644 --- a/generated/do_editor_ui_for_compound_type_ui_debug.h +++ b/generated/do_editor_ui_for_compound_type_ui_debug.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:438:0 +// src/engine/editor.cpp:414:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_debug *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_ui_id.h b/generated/do_editor_ui_for_compound_type_ui_id.h index 702b87659..ca684d732 100644 --- a/generated/do_editor_ui_for_compound_type_ui_id.h +++ b/generated/do_editor_ui_for_compound_type_ui_id.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:137:0 +// src/engine/editor.cpp:113:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_id *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_ui_toggle.h b/generated/do_editor_ui_for_compound_type_ui_toggle.h index 857a7bd5b..639807fd5 100644 --- a/generated/do_editor_ui_for_compound_type_ui_toggle.h +++ b/generated/do_editor_ui_for_compound_type_ui_toggle.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:140:0 +// src/engine/editor.cpp:116:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_toggle *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h b/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h index 42ec9ccbf..c93da7e7c 100644 --- a/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h +++ b/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:247:0 +// src/engine/editor.cpp:223:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, untextured_3d_geometry_buffer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_vertex_material.h b/generated/do_editor_ui_for_compound_type_vertex_material.h index d38b7f905..5739a7dee 100644 --- a/generated/do_editor_ui_for_compound_type_vertex_material.h +++ b/generated/do_editor_ui_for_compound_type_vertex_material.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:241:0 +// src/engine/editor.cpp:217:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, vertex_material *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h b/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h index fa65ba386..d5602ad1c 100644 --- a/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h +++ b/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:119:0 +// src/engine/editor.cpp:95:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, voronoi_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_vox_data.h b/generated/do_editor_ui_for_compound_type_vox_data.h index dcc33b259..e2c1c90cc 100644 --- a/generated/do_editor_ui_for_compound_type_vox_data.h +++ b/generated/do_editor_ui_for_compound_type_vox_data.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:277:0 +// src/engine/editor.cpp:253:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, vox_data *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_voxel.h b/generated/do_editor_ui_for_compound_type_voxel.h index 206e804d2..aaaa36283 100644 --- a/generated/do_editor_ui_for_compound_type_voxel.h +++ b/generated/do_editor_ui_for_compound_type_voxel.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:268:0 +// src/engine/editor.cpp:244:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, voxel *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_voxel_lighting.h b/generated/do_editor_ui_for_compound_type_voxel_lighting.h index 4c7b3a57c..9911b4c84 100644 --- a/generated/do_editor_ui_for_compound_type_voxel_lighting.h +++ b/generated/do_editor_ui_for_compound_type_voxel_lighting.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:271:0 +// src/engine/editor.cpp:247:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, voxel_lighting *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_white_noise_params.h b/generated/do_editor_ui_for_compound_type_white_noise_params.h index 9ac21df91..6d4c56012 100644 --- a/generated/do_editor_ui_for_compound_type_white_noise_params.h +++ b/generated/do_editor_ui_for_compound_type_white_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:113:0 +// src/engine/editor.cpp:89:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, white_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_work_queue.h b/generated/do_editor_ui_for_compound_type_work_queue.h index 2e810b8c0..3e89c3939 100644 --- a/generated/do_editor_ui_for_compound_type_work_queue.h +++ b/generated/do_editor_ui_for_compound_type_work_queue.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:158:0 +// src/engine/editor.cpp:134:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, work_queue *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_work_queue_entry.h b/generated/do_editor_ui_for_compound_type_work_queue_entry.h index 3c2435c6c..831c731cb 100644 --- a/generated/do_editor_ui_for_compound_type_work_queue_entry.h +++ b/generated/do_editor_ui_for_compound_type_work_queue_entry.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:155:0 +// src/engine/editor.cpp:131:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, work_queue_entry *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world.h b/generated/do_editor_ui_for_compound_type_world.h index 2f4f4bbbc..25f3848d6 100644 --- a/generated/do_editor_ui_for_compound_type_world.h +++ b/generated/do_editor_ui_for_compound_type_world.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:211:0 +// src/engine/editor.cpp:187:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_chunk.h b/generated/do_editor_ui_for_compound_type_world_chunk.h index f9aa35ec2..8904e49d3 100644 --- a/generated/do_editor_ui_for_compound_type_world_chunk.h +++ b/generated/do_editor_ui_for_compound_type_world_chunk.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:320:0 +// src/engine/editor.cpp:296:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_chunk *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h index ae1ba7db3..5a196e188 100644 --- a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h +++ b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:124:0 +// src/engine/editor.cpp:100:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_update_op_shape_params_rect *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h index ef299f439..9e3845ce1 100644 --- a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h +++ b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:122:0 +// src/engine/editor.cpp:98:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_update_op_shape_params_sphere *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_container_entity_ptr_block_array.h b/generated/do_editor_ui_for_container_entity_ptr_block_array.h index 950b95bed..9eadf7aea 100644 --- a/generated/do_editor_ui_for_container_entity_ptr_block_array.h +++ b/generated/do_editor_ui_for_container_entity_ptr_block_array.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:317:0 +// src/engine/editor.cpp:293:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_ptr_block_array *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_container_model_buffer.h b/generated/do_editor_ui_for_container_model_buffer.h index 1d47a0f69..cee1da5b7 100644 --- a/generated/do_editor_ui_for_container_model_buffer.h +++ b/generated/do_editor_ui_for_container_model_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:292:0 +// src/engine/editor.cpp:268:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, model_buffer *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_container_ui_toggle_hashtable.h b/generated/do_editor_ui_for_container_ui_toggle_hashtable.h index 5dc93984c..598188b30 100644 --- a/generated/do_editor_ui_for_container_ui_toggle_hashtable.h +++ b/generated/do_editor_ui_for_container_ui_toggle_hashtable.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:149:0 +// src/engine/editor.cpp:125:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_toggle_hashtable *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_container_v3_cursor.h b/generated/do_editor_ui_for_container_v3_cursor.h index ba416af67..518124aec 100644 --- a/generated/do_editor_ui_for_container_v3_cursor.h +++ b/generated/do_editor_ui_for_container_v3_cursor.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:134:0 +// src/engine/editor.cpp:110:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, v3_cursor *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_enum_asset_type.h b/generated/do_editor_ui_for_enum_asset_type.h index 898b9fdba..4978ebf59 100644 --- a/generated/do_editor_ui_for_enum_asset_type.h +++ b/generated/do_editor_ui_for_enum_asset_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:332:0 +// src/engine/editor.cpp:308:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_chunk_flag.h b/generated/do_editor_ui_for_enum_chunk_flag.h index 40424e9e6..aa58b5864 100644 --- a/generated/do_editor_ui_for_enum_chunk_flag.h +++ b/generated/do_editor_ui_for_enum_chunk_flag.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:265:0 +// src/engine/editor.cpp:241:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, chunk_flag *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_engine_debug_view_mode.h b/generated/do_editor_ui_for_enum_engine_debug_view_mode.h index d1725c677..95d6cf9a4 100644 --- a/generated/do_editor_ui_for_enum_engine_debug_view_mode.h +++ b/generated/do_editor_ui_for_enum_engine_debug_view_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:444:0 +// src/engine/editor.cpp:420:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_debug_view_mode *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_entity_behavior_flags.h b/generated/do_editor_ui_for_enum_entity_behavior_flags.h index c6e53b7f6..b8c183009 100644 --- a/generated/do_editor_ui_for_enum_entity_behavior_flags.h +++ b/generated/do_editor_ui_for_enum_entity_behavior_flags.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:203:0 +// src/engine/editor.cpp:179:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_behavior_flags *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_entity_state.h b/generated/do_editor_ui_for_enum_entity_state.h index c93738e77..a7ecacd81 100644 --- a/generated/do_editor_ui_for_enum_entity_state.h +++ b/generated/do_editor_ui_for_enum_entity_state.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:200:0 +// src/engine/editor.cpp:176:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_state *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_file_traversal_type.h b/generated/do_editor_ui_for_enum_file_traversal_type.h index 2bcc8babf..23f1497af 100644 --- a/generated/do_editor_ui_for_enum_file_traversal_type.h +++ b/generated/do_editor_ui_for_enum_file_traversal_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:295:0 +// src/engine/editor.cpp:271:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, file_traversal_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_particle_spawn_type.h b/generated/do_editor_ui_for_enum_particle_spawn_type.h index b9f58b371..1380a9bad 100644 --- a/generated/do_editor_ui_for_enum_particle_spawn_type.h +++ b/generated/do_editor_ui_for_enum_particle_spawn_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:226:0 +// src/engine/editor.cpp:202:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, particle_spawn_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_resolution_setting.h b/generated/do_editor_ui_for_enum_resolution_setting.h index a5950fdd9..89d882e30 100644 --- a/generated/do_editor_ui_for_enum_resolution_setting.h +++ b/generated/do_editor_ui_for_enum_resolution_setting.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:450:0 +// src/engine/editor.cpp:426:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, resolution_setting *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_shader_language_setting.h b/generated/do_editor_ui_for_enum_shader_language_setting.h index 23ba09564..3585c7c8a 100644 --- a/generated/do_editor_ui_for_enum_shader_language_setting.h +++ b/generated/do_editor_ui_for_enum_shader_language_setting.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:453:0 +// src/engine/editor.cpp:429:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shader_language_setting *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_shape_type.h b/generated/do_editor_ui_for_enum_shape_type.h index b46b3b7c7..076546635 100644 --- a/generated/do_editor_ui_for_enum_shape_type.h +++ b/generated/do_editor_ui_for_enum_shape_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:126:0 +// src/engine/editor.cpp:102:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shape_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_tone_mapping_type.h b/generated/do_editor_ui_for_enum_tone_mapping_type.h index c570b2fe6..b2029aefb 100644 --- a/generated/do_editor_ui_for_enum_tone_mapping_type.h +++ b/generated/do_editor_ui_for_enum_tone_mapping_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:206:0 +// src/engine/editor.cpp:182:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, tone_mapping_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/string_and_value_tables_asset_type.h b/generated/string_and_value_tables_asset_type.h index 9cd608c15..a7afd4de4 100644 --- a/generated/string_and_value_tables_asset_type.h +++ b/generated/string_and_value_tables_asset_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:330:0 +// src/engine/editor.cpp:306:0 link_internal counted_string ToStringPrefixless(asset_type Type) diff --git a/generated/string_and_value_tables_engine_debug_view_mode.h b/generated/string_and_value_tables_engine_debug_view_mode.h index 04e6be004..1fe4f17d6 100644 --- a/generated/string_and_value_tables_engine_debug_view_mode.h +++ b/generated/string_and_value_tables_engine_debug_view_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:196:0 +// src/engine/editor.cpp:172:0 link_internal counted_string ToStringPrefixless(engine_debug_view_mode Type) diff --git a/generated/string_and_value_tables_file_traversal_node.h b/generated/string_and_value_tables_file_traversal_node.h index b1b661fe9..ba1a18e0d 100644 --- a/generated/string_and_value_tables_file_traversal_node.h +++ b/generated/string_and_value_tables_file_traversal_node.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:190:0 +// src/engine/editor.cpp:166:0 link_internal counted_string ToStringPrefixless(file_traversal_type Type) diff --git a/generated/string_and_value_tables_particle_spawn_type.h b/generated/string_and_value_tables_particle_spawn_type.h index d7490d194..17d5e1049 100644 --- a/generated/string_and_value_tables_particle_spawn_type.h +++ b/generated/string_and_value_tables_particle_spawn_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:187:0 +// src/engine/editor.cpp:163:0 link_internal counted_string ToStringPrefixless(particle_spawn_type Type) diff --git a/generated/string_and_value_tables_tone_mapping_type.h b/generated/string_and_value_tables_tone_mapping_type.h index 687898d49..62c6ec206 100644 --- a/generated/string_and_value_tables_tone_mapping_type.h +++ b/generated/string_and_value_tables_tone_mapping_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:193:0 +// src/engine/editor.cpp:169:0 link_internal counted_string ToStringPrefixless(tone_mapping_type Type) diff --git a/shaders/gBuffer.fragmentshader b/shaders/gBuffer.fragmentshader index cc8f98139..990cce3cd 100644 --- a/shaders/gBuffer.fragmentshader +++ b/shaders/gBuffer.fragmentshader @@ -8,6 +8,9 @@ layout (location = 0) out vec4 gColor; layout (location = 1) out vec3 gNormal; layout (location = 2) out vec4 gPosition; +uniform vec3 MinClipP_worldspace; +uniform vec3 MaxClipP_worldspace; + uniform vec3 OffsetOfWorldCenterToGrid; uniform vec3 CameraToWorld; uniform float FarClip; @@ -74,6 +77,18 @@ ModThresh(vec3 In, float Thresh, float ModVal) void main() { + + if (vertexP_worldspace.x >= MinClipP_worldspace.x && + vertexP_worldspace.y >= MinClipP_worldspace.y && + vertexP_worldspace.z >= MinClipP_worldspace.z && + + vertexP_worldspace.x < MaxClipP_worldspace.x && + vertexP_worldspace.y < MaxClipP_worldspace.y && + vertexP_worldspace.z < MaxClipP_worldspace.z) + { + discard; + } + gPosition.xyz = vertexP_worldspace; gPosition.w = Linearize(gl_FragCoord.z); // Depth gNormal = vertexN_worldspace; diff --git a/shaders/gBuffer.vertexshader b/shaders/gBuffer.vertexshader index 9ac187fcf..cbe48281c 100644 --- a/shaders/gBuffer.vertexshader +++ b/shaders/gBuffer.vertexshader @@ -9,6 +9,9 @@ out vec3 vertexN_worldspace; out vec3 MaterialColor; out vec2 TransEmiss; +uniform vec3 MinClipP_worldspace; +uniform vec3 MaxClipP_worldspace; + uniform vec3 OffsetOfWorldCenterToGrid; uniform vec3 CameraToWorld; uniform mat4 ModelMatrix; diff --git a/src/engine/editor.cpp b/src/engine/editor.cpp index 5d6f55ad8..ef74bca6b 100644 --- a/src/engine/editor.cpp +++ b/src/engine/editor.cpp @@ -1,27 +1,3 @@ -// -// TODO(Jeses): Move to header -link_internal rect3 -GetSelectionRect(world *World, level_editor *Editor) -{ - v3 SelectionMinP = GetSimSpaceP(World, Editor->SelectionRegion.Min); - v3 SelectionMaxP = GetSimSpaceP(World, Editor->SelectionRegion.Max); - - rect3 Result = RectMinMax(SelectionMinP, SelectionMaxP); - return Result; -} - -// -// TODO(Jeses): Move to header -link_internal v3i -GetSelectionDim(world *World, level_editor *Editor) -{ - v3 SelectionMinP = GetSimSpaceP(World, Editor->SelectionRegion.Min); - v3 SelectionMaxP = GetSimSpaceP(World, Editor->SelectionRegion.Max); - - v3i Result = V3i(SelectionMaxP - SelectionMinP); - return Result; -} - // TODO(Jesse): Should these live somewhere else? @engine_draw_file_nodes_helpers link_internal maybe_file_traversal_node EngineDrawFileNodesFilteredHelper(file_traversal_node Node, u64 Params) diff --git a/src/engine/editor.h b/src/engine/editor.h index 35fddb16f..c80e6e664 100644 --- a/src/engine/editor.h +++ b/src/engine/editor.h @@ -1139,6 +1139,26 @@ ResetSelectionIfIncomplete(level_editor *Editor) if (SelectionIncomplete(Editor->SelectionClicks)) { ResetSelection(Editor); } } +link_internal rect3 +GetSelectionRect(world *World, level_editor *Editor) +{ + v3 SelectionMinP = GetSimSpaceP(World, Editor->SelectionRegion.Min); + v3 SelectionMaxP = GetSimSpaceP(World, Editor->SelectionRegion.Max); + + rect3 Result = RectMinMax(SelectionMinP, SelectionMaxP); + return Result; +} + +link_internal v3i +GetSelectionDim(world *World, level_editor *Editor) +{ + v3 SelectionMinP = GetSimSpaceP(World, Editor->SelectionRegion.Min); + v3 SelectionMaxP = GetSimSpaceP(World, Editor->SelectionRegion.Max); + + v3i Result = V3i(SelectionMaxP - SelectionMinP); + return Result; +} + link_internal b32 HardResetEditor(level_editor *Editor); diff --git a/src/engine/render.cpp b/src/engine/render.cpp index 6e7e68a3f..2b1f74c4e 100644 --- a/src/engine/render.cpp +++ b/src/engine/render.cpp @@ -1314,9 +1314,25 @@ DrawEntity( shader *Shader, } link_internal void -SetupGBufferShader(graphics *Graphics, v2i ApplicationResolution) +SetupGBufferShader(graphics *Graphics, v2i ApplicationResolution, b32 DoSelectionMasking) { - auto GBufferRenderGroup = Graphics->gBuffer; + g_buffer_render_group *GBufferRenderGroup = Graphics->gBuffer; + + if (DoSelectionMasking) + { + + GBufferRenderGroup->MinClipP_worldspace = GetRenderP(GetEngineResources(), GetLevelEditor()->SelectionRegion.Min); + GBufferRenderGroup->MaxClipP_worldspace = GetRenderP(GetEngineResources(), GetLevelEditor()->SelectionRegion.Max); + + /* rect3 SimSelection = GetSelectionRect(GetWorld(), GetLevelEditor()); */ + /* GBufferRenderGroup->MinClipP_worldspace = SimSelection.Min; */ + /* GBufferRenderGroup->MaxClipP_worldspace = SimSelection.Max; */ + } + else + { + GBufferRenderGroup->MinClipP_worldspace = {}; + GBufferRenderGroup->MaxClipP_worldspace = {}; + } GL.BindFramebuffer(GL_FRAMEBUFFER, GBufferRenderGroup->FBO.ID); GL.UseProgram(GBufferRenderGroup->gBufferShader.ID); @@ -1404,7 +1420,7 @@ DrawEntitiesToGBuffer( v2i ApplicationResolution, Graphics->Settings.DrawMajorGrid = False; Graphics->Settings.DrawMinorGrid = False; - SetupGBufferShader(Graphics, ApplicationResolution); + SetupGBufferShader(Graphics, ApplicationResolution, False); DrawEntities(&Graphics->gBuffer->gBufferShader, EntityTable, Dest, TransparencyDest, Graphics, World, dt); diff --git a/src/engine/render.h b/src/engine/render.h index 4877ac3e4..1ae33a91e 100644 --- a/src/engine/render.h +++ b/src/engine/render.h @@ -40,6 +40,9 @@ struct g_buffer_render_group g_buffer_textures Textures; shader gBufferShader; + v3 MinClipP_worldspace; + v3 MaxClipP_worldspace; + m4 InverseViewMatrix; m4 InverseProjectionMatrix; diff --git a/src/engine/render/render_init.cpp b/src/engine/render/render_init.cpp index 7cbe34e58..546fa0620 100644 --- a/src/engine/render/render_init.cpp +++ b/src/engine/render/render_init.cpp @@ -339,12 +339,18 @@ CreateGbuffer(memory_arena *Memory) shader -CreateGbufferShader(graphics *Graphics, memory_arena *GraphicsMemory, m4 *ViewProjection, camera *Camera, texture *ColorPaletteTexture) +CreateGbufferShader(graphics *Graphics, memory_arena *GraphicsMemory, v3 *MinClipP_worldspace, v3 *MaxClipP_worldspace, m4 *ViewProjection, camera *Camera, texture *ColorPaletteTexture) { shader Shader = LoadShaders( CSz(BONSAI_SHADER_PATH "gBuffer.vertexshader"), CSz(BONSAI_SHADER_PATH "gBuffer.fragmentshader") ); shader_uniform **Current = &Shader.FirstUniform; + *Current = GetUniform(GraphicsMemory, &Shader, MinClipP_worldspace, "MinClipP_worldspace"); + Current = &(*Current)->Next; + + *Current = GetUniform(GraphicsMemory, &Shader, MaxClipP_worldspace, "MaxClipP_worldspace"); + Current = &(*Current)->Next; + *Current = GetUniform(GraphicsMemory, &Shader, ViewProjection, "ViewProjection"); Current = &(*Current)->Next; @@ -747,7 +753,7 @@ GraphicsInit(graphics *Result, engine_settings *EngineSettings, memory_arena *Gr } gBuffer->gBufferShader = - CreateGbufferShader(Result, GraphicsMemory, &gBuffer->ViewProjection, Result->Camera, &Result->ColorPaletteTexture); + CreateGbufferShader(Result, GraphicsMemory, &gBuffer->MinClipP_worldspace, &gBuffer->MaxClipP_worldspace, &gBuffer->ViewProjection, Result->Camera, &Result->ColorPaletteTexture); AoGroup->Shader = MakeSsaoShader( GraphicsMemory, &gBuffer->Textures, diff --git a/src/engine/resources.cpp b/src/engine/resources.cpp index 54641e931..f60c29eec 100644 --- a/src/engine/resources.cpp +++ b/src/engine/resources.cpp @@ -86,6 +86,8 @@ RenderLoop(thread_startup_params *ThreadParams, engine_resources *Engine) { *Texture = MakeTexture_RGBA(Texture->Dim, Cast(u32*, Command->Data), Texture->DebugName, Texture->Slices, Texture->Format); } break; + + InvalidDefaultCase; } } break; @@ -136,7 +138,7 @@ RenderLoop(thread_startup_params *ThreadParams, engine_resources *Engine) case BonsaiRenderCommand_ShaderId_gBuffer: { - SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings)); + SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings), True); } break; case BonsaiRenderCommand_ShaderId_ShadowMap: @@ -217,7 +219,7 @@ RenderLoop(thread_startup_params *ThreadParams, engine_resources *Engine) v3i Min = World->Center - Radius; v3i Max = World->Center + Radius; - SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings)); + SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings), False); /* RenderDrawList(Engine, &Graphics->MainDrawList); */ From f2801dad2112d162ebbe77c2cd5fa5ce9d19a102 Mon Sep 17 00:00:00 2001 From: a pirate Date: Fri, 6 Sep 2024 18:46:48 -0700 Subject: [PATCH 6/9] Negative brush previewing nominally working --- .../block_array_c_asset_thumbnail_688856411.h | 2 +- .../default_marshal_layered_brush_editor_0.h | 2 +- .../default_marshal_layered_brush_editor_1.h | 2 +- .../default_marshal_layered_brush_editor_2.h | 2 +- ...do_editor_ui_for_compound_type_animation.h | 2 +- .../do_editor_ui_for_compound_type_asset.h | 2 +- .../do_editor_ui_for_compound_type_asset_id.h | 2 +- ...tor_ui_for_compound_type_asset_thumbnail.h | 2 +- ...editor_ui_for_compound_type_bonsai_futex.h | 2 +- ...ditor_ui_for_compound_type_bonsai_stdlib.h | 2 +- ..._editor_ui_for_compound_type_brush_layer.h | 2 +- ...itor_ui_for_compound_type_brush_settings.h | 2 +- .../do_editor_ui_for_compound_type_camera.h | 2 +- ...o_editor_ui_for_compound_type_chunk_data.h | 2 +- ...tor_ui_for_compound_type_chunk_thumbnail.h | 2 +- ...tor_ui_for_compound_type_collision_event.h | 2 +- ..._editor_ui_for_compound_type_debug_state.h | 2 +- ...editor_ui_for_compound_type_engine_debug.h | 2 +- ...or_ui_for_compound_type_engine_resources.h | 2 +- ...tor_ui_for_compound_type_engine_settings.h | 2 +- .../do_editor_ui_for_compound_type_entity.h | 2 +- ...do_editor_ui_for_compound_type_entity_id.h | 2 +- ...i_for_compound_type_entity_position_info.h | 2 +- ...ui_for_compound_type_file_traversal_node.h | 2 +- .../do_editor_ui_for_compound_type_frustum.h | 2 +- ..._for_compound_type_g_buffer_render_group.h | 2 +- ..._editor_ui_for_compound_type_game_lights.h | 2 +- ...compound_type_gpu_element_buffer_handles.h | 2 +- ..._compound_type_gpu_mapped_element_buffer.h | 2 +- .../do_editor_ui_for_compound_type_graphics.h | 2 +- ...r_ui_for_compound_type_graphics_settings.h | 2 +- .../do_editor_ui_for_compound_type_input.h | 2 +- ..._editor_ui_for_compound_type_input_event.h | 2 +- .../do_editor_ui_for_compound_type_keyframe.h | 2 +- ...i_for_compound_type_layered_brush_editor.h | 17 +++- ...editor_ui_for_compound_type_level_editor.h | 2 +- ..._for_compound_type_lighting_render_group.h | 2 +- ...r_ui_for_compound_type_lighting_settings.h | 2 +- ..._ui_for_compound_type_lod_element_buffer.h | 2 +- .../do_editor_ui_for_compound_type_model.h | 2 +- ..._editor_ui_for_compound_type_noise_layer.h | 2 +- .../do_editor_ui_for_compound_type_particle.h | 2 +- ...tor_ui_for_compound_type_particle_system.h | 2 +- ...ui_for_compound_type_perlin_noise_params.h | 2 +- .../do_editor_ui_for_compound_type_physics.h | 2 +- .../do_editor_ui_for_compound_type_plane.h | 2 +- .../do_editor_ui_for_compound_type_platform.h | 2 +- ...ditor_ui_for_compound_type_random_series.h | 2 +- ...r_ui_for_compound_type_render_buffers_2d.h | 2 +- ...editor_ui_for_compound_type_render_debug.h | 2 +- ...tor_ui_for_compound_type_render_settings.h | 2 +- ..._editor_ui_for_compound_type_renderer_2d.h | 2 +- .../do_editor_ui_for_compound_type_shader.h | 2 +- ..._editor_ui_for_compound_type_shape_layer.h | 2 +- .../do_editor_ui_for_compound_type_texture.h | 2 +- .../do_editor_ui_for_compound_type_ui_debug.h | 2 +- .../do_editor_ui_for_compound_type_ui_id.h | 2 +- ...do_editor_ui_for_compound_type_ui_toggle.h | 2 +- ...pound_type_untextured_3d_geometry_buffer.h | 2 +- ...tor_ui_for_compound_type_vertex_material.h | 2 +- ...i_for_compound_type_voronoi_noise_params.h | 2 +- .../do_editor_ui_for_compound_type_vox_data.h | 2 +- .../do_editor_ui_for_compound_type_voxel.h | 2 +- ...itor_ui_for_compound_type_voxel_lighting.h | 2 +- ..._ui_for_compound_type_white_noise_params.h | 2 +- ...o_editor_ui_for_compound_type_work_queue.h | 2 +- ...or_ui_for_compound_type_work_queue_entry.h | 2 +- .../do_editor_ui_for_compound_type_world.h | 2 +- ..._editor_ui_for_compound_type_world_chunk.h | 2 +- ...d_type_world_update_op_shape_params_rect.h | 2 +- ...type_world_update_op_shape_params_sphere.h | 2 +- ..._ui_for_container_entity_ptr_block_array.h | 2 +- .../do_editor_ui_for_container_model_buffer.h | 2 +- ...tor_ui_for_container_ui_toggle_hashtable.h | 2 +- .../do_editor_ui_for_container_v3_cursor.h | 2 +- generated/do_editor_ui_for_enum_asset_type.h | 2 +- generated/do_editor_ui_for_enum_chunk_flag.h | 2 +- ...ditor_ui_for_enum_engine_debug_view_mode.h | 2 +- ...editor_ui_for_enum_entity_behavior_flags.h | 2 +- .../do_editor_ui_for_enum_entity_state.h | 2 +- ...o_editor_ui_for_enum_file_traversal_type.h | 2 +- ...o_editor_ui_for_enum_particle_spawn_type.h | 2 +- ...do_editor_ui_for_enum_resolution_setting.h | 2 +- ...itor_ui_for_enum_shader_language_setting.h | 2 +- generated/do_editor_ui_for_enum_shape_type.h | 2 +- .../do_editor_ui_for_enum_tone_mapping_type.h | 2 +- .../string_and_value_tables_asset_type.h | 2 +- ..._and_value_tables_engine_debug_view_mode.h | 2 +- ...ing_and_value_tables_file_traversal_node.h | 2 +- ...ing_and_value_tables_particle_spawn_type.h | 2 +- ...tring_and_value_tables_tone_mapping_type.h | 2 +- src/engine/editor.cpp | 91 ++++++++++++++++--- src/engine/editor.h | 3 + src/engine/render.cpp | 12 +-- src/engine/world_chunk.cpp | 2 +- src/engine/world_update.cpp | 9 +- 96 files changed, 198 insertions(+), 116 deletions(-) diff --git a/generated/block_array_c_asset_thumbnail_688856411.h b/generated/block_array_c_asset_thumbnail_688856411.h index f8a2a5f75..335b72e02 100644 --- a/generated/block_array_c_asset_thumbnail_688856411.h +++ b/generated/block_array_c_asset_thumbnail_688856411.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:78:0 +// src/engine/editor.cpp:80:0 link_internal asset_thumbnail_block* diff --git a/generated/default_marshal_layered_brush_editor_0.h b/generated/default_marshal_layered_brush_editor_0.h index 47404e901..e9902b41e 100644 --- a/generated/default_marshal_layered_brush_editor_0.h +++ b/generated/default_marshal_layered_brush_editor_0.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1038:0 +// src/engine/editor.h:1041:0 Live->LayerCount = Stored->LayerCount; diff --git a/generated/default_marshal_layered_brush_editor_1.h b/generated/default_marshal_layered_brush_editor_1.h index 8f120f788..d0bc87517 100644 --- a/generated/default_marshal_layered_brush_editor_1.h +++ b/generated/default_marshal_layered_brush_editor_1.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1031:0 +// src/engine/editor.h:1034:0 RangeIterator(Index, (256)) { diff --git a/generated/default_marshal_layered_brush_editor_2.h b/generated/default_marshal_layered_brush_editor_2.h index 518647523..297767c52 100644 --- a/generated/default_marshal_layered_brush_editor_2.h +++ b/generated/default_marshal_layered_brush_editor_2.h @@ -1,4 +1,4 @@ -// src/engine/editor.h:1024:0 +// src/engine/editor.h:1027:0 Live->LayerCount = Stored->LayerCount; diff --git a/generated/do_editor_ui_for_compound_type_animation.h b/generated/do_editor_ui_for_compound_type_animation.h index eb8279418..ddfeee3a3 100644 --- a/generated/do_editor_ui_for_compound_type_animation.h +++ b/generated/do_editor_ui_for_compound_type_animation.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:214:0 +// src/engine/editor.cpp:216:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, animation *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_asset.h b/generated/do_editor_ui_for_compound_type_asset.h index dc2fd36af..333841fff 100644 --- a/generated/do_editor_ui_for_compound_type_asset.h +++ b/generated/do_editor_ui_for_compound_type_asset.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:311:0 +// src/engine/editor.cpp:313:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_asset_id.h b/generated/do_editor_ui_for_compound_type_asset_id.h index 436c429fc..029589c19 100644 --- a/generated/do_editor_ui_for_compound_type_asset_id.h +++ b/generated/do_editor_ui_for_compound_type_asset_id.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:303:0 +// src/engine/editor.cpp:305:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset_id *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_asset_thumbnail.h b/generated/do_editor_ui_for_compound_type_asset_thumbnail.h index 980365aaf..44371d81e 100644 --- a/generated/do_editor_ui_for_compound_type_asset_thumbnail.h +++ b/generated/do_editor_ui_for_compound_type_asset_thumbnail.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:333:0 +// src/engine/editor.cpp:335:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset_thumbnail *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_bonsai_futex.h b/generated/do_editor_ui_for_compound_type_bonsai_futex.h index 48bfd9fe7..74eb8a5e6 100644 --- a/generated/do_editor_ui_for_compound_type_bonsai_futex.h +++ b/generated/do_editor_ui_for_compound_type_bonsai_futex.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:220:0 +// src/engine/editor.cpp:222:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, bonsai_futex *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h b/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h index 70ecb66da..9bb7e3baa 100644 --- a/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h +++ b/generated/do_editor_ui_for_compound_type_bonsai_stdlib.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:151:0 +// src/engine/editor.cpp:153:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, bonsai_stdlib *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_brush_layer.h b/generated/do_editor_ui_for_compound_type_brush_layer.h index 94854936b..185d80401 100644 --- a/generated/do_editor_ui_for_compound_type_brush_layer.h +++ b/generated/do_editor_ui_for_compound_type_brush_layer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:342:0 +// src/engine/editor.cpp:344:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, brush_layer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_brush_settings.h b/generated/do_editor_ui_for_compound_type_brush_settings.h index d3bb0b151..7a8100355 100644 --- a/generated/do_editor_ui_for_compound_type_brush_settings.h +++ b/generated/do_editor_ui_for_compound_type_brush_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:106:0 +// src/engine/editor.cpp:108:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, brush_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_camera.h b/generated/do_editor_ui_for_compound_type_camera.h index ea57d35a1..9b462e349 100644 --- a/generated/do_editor_ui_for_compound_type_camera.h +++ b/generated/do_editor_ui_for_compound_type_camera.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:327:0 +// src/engine/editor.cpp:329:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, camera *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_chunk_data.h b/generated/do_editor_ui_for_compound_type_chunk_data.h index efe2a202b..782ad1b9e 100644 --- a/generated/do_editor_ui_for_compound_type_chunk_data.h +++ b/generated/do_editor_ui_for_compound_type_chunk_data.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:250:0 +// src/engine/editor.cpp:252:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, chunk_data *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h b/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h index 980f8c868..982a1e3b5 100644 --- a/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h +++ b/generated/do_editor_ui_for_compound_type_chunk_thumbnail.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:336:0 +// src/engine/editor.cpp:338:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, chunk_thumbnail *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_collision_event.h b/generated/do_editor_ui_for_compound_type_collision_event.h index 2301341fc..dd2acd392 100644 --- a/generated/do_editor_ui_for_compound_type_collision_event.h +++ b/generated/do_editor_ui_for_compound_type_collision_event.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:314:0 +// src/engine/editor.cpp:316:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, collision_event *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_debug_state.h b/generated/do_editor_ui_for_compound_type_debug_state.h index 0dae453ef..68351bedd 100644 --- a/generated/do_editor_ui_for_compound_type_debug_state.h +++ b/generated/do_editor_ui_for_compound_type_debug_state.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:147:0 +// src/engine/editor.cpp:149:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, debug_state *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_engine_debug.h b/generated/do_editor_ui_for_compound_type_engine_debug.h index 9dc1c9e09..bef647892 100644 --- a/generated/do_editor_ui_for_compound_type_engine_debug.h +++ b/generated/do_editor_ui_for_compound_type_engine_debug.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:417:0 +// src/engine/editor.cpp:419:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_debug *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_engine_resources.h b/generated/do_editor_ui_for_compound_type_engine_resources.h index 55ad6d4a6..b113db3bd 100644 --- a/generated/do_editor_ui_for_compound_type_engine_resources.h +++ b/generated/do_editor_ui_for_compound_type_engine_resources.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:439:0 +// src/engine/editor.cpp:441:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_resources *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_engine_settings.h b/generated/do_editor_ui_for_compound_type_engine_settings.h index 227f96cc6..1e7dafaf5 100644 --- a/generated/do_editor_ui_for_compound_type_engine_settings.h +++ b/generated/do_editor_ui_for_compound_type_engine_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:435:0 +// src/engine/editor.cpp:437:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_entity.h b/generated/do_editor_ui_for_compound_type_entity.h index c7d8957d3..2e7e69ca9 100644 --- a/generated/do_editor_ui_for_compound_type_entity.h +++ b/generated/do_editor_ui_for_compound_type_entity.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:289:0 +// src/engine/editor.cpp:291:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_entity_id.h b/generated/do_editor_ui_for_compound_type_entity_id.h index c81e4dc8b..c97bd6f61 100644 --- a/generated/do_editor_ui_for_compound_type_entity_id.h +++ b/generated/do_editor_ui_for_compound_type_entity_id.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:286:0 +// src/engine/editor.cpp:288:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_id *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_entity_position_info.h b/generated/do_editor_ui_for_compound_type_entity_position_info.h index cb35c2b50..2cc0709bd 100644 --- a/generated/do_editor_ui_for_compound_type_entity_position_info.h +++ b/generated/do_editor_ui_for_compound_type_entity_position_info.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:317:0 +// src/engine/editor.cpp:319:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_position_info *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_file_traversal_node.h b/generated/do_editor_ui_for_compound_type_file_traversal_node.h index a0d04238e..561f92b11 100644 --- a/generated/do_editor_ui_for_compound_type_file_traversal_node.h +++ b/generated/do_editor_ui_for_compound_type_file_traversal_node.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:274:0 +// src/engine/editor.cpp:276:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, file_traversal_node *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_frustum.h b/generated/do_editor_ui_for_compound_type_frustum.h index c431f8d84..119d18605 100644 --- a/generated/do_editor_ui_for_compound_type_frustum.h +++ b/generated/do_editor_ui_for_compound_type_frustum.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:324:0 +// src/engine/editor.cpp:326:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, frustum *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h b/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h index 0f41245b3..b2ab0c808 100644 --- a/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h +++ b/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:405:0 +// src/engine/editor.cpp:407:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, g_buffer_render_group *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_game_lights.h b/generated/do_editor_ui_for_compound_type_game_lights.h index 21523abbe..fce7a6223 100644 --- a/generated/do_editor_ui_for_compound_type_game_lights.h +++ b/generated/do_editor_ui_for_compound_type_game_lights.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:399:0 +// src/engine/editor.cpp:401:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, game_lights *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h b/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h index 1c954d6b0..356df9acc 100644 --- a/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h +++ b/generated/do_editor_ui_for_compound_type_gpu_element_buffer_handles.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:256:0 +// src/engine/editor.cpp:258:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, gpu_element_buffer_handles *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h b/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h index 88dcf8177..e820ba9c6 100644 --- a/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h +++ b/generated/do_editor_ui_for_compound_type_gpu_mapped_element_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:259:0 +// src/engine/editor.cpp:261:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, gpu_mapped_element_buffer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_graphics.h b/generated/do_editor_ui_for_compound_type_graphics.h index 93567c8ca..e04b0abe6 100644 --- a/generated/do_editor_ui_for_compound_type_graphics.h +++ b/generated/do_editor_ui_for_compound_type_graphics.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:408:0 +// src/engine/editor.cpp:410:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, graphics *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_graphics_settings.h b/generated/do_editor_ui_for_compound_type_graphics_settings.h index 8d631707f..87fd3a714 100644 --- a/generated/do_editor_ui_for_compound_type_graphics_settings.h +++ b/generated/do_editor_ui_for_compound_type_graphics_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:432:0 +// src/engine/editor.cpp:434:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, graphics_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_input.h b/generated/do_editor_ui_for_compound_type_input.h index 9b5c1e2ac..0207b7906 100644 --- a/generated/do_editor_ui_for_compound_type_input.h +++ b/generated/do_editor_ui_for_compound_type_input.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:140:0 +// src/engine/editor.cpp:142:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, input *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_input_event.h b/generated/do_editor_ui_for_compound_type_input_event.h index 87348c9e3..90c6d4130 100644 --- a/generated/do_editor_ui_for_compound_type_input_event.h +++ b/generated/do_editor_ui_for_compound_type_input_event.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:137:0 +// src/engine/editor.cpp:139:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, input_event *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_keyframe.h b/generated/do_editor_ui_for_compound_type_keyframe.h index c2c0acf9b..2e83aae56 100644 --- a/generated/do_editor_ui_for_compound_type_keyframe.h +++ b/generated/do_editor_ui_for_compound_type_keyframe.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:211:0 +// src/engine/editor.cpp:213:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, keyframe *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h index ae3cce60e..cc75c5c69 100644 --- a/generated/do_editor_ui_for_compound_type_layered_brush_editor.h +++ b/generated/do_editor_ui_for_compound_type_layered_brush_editor.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:345:0 +// src/engine/editor.cpp:347:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, layered_brush_editor *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) @@ -91,6 +91,21 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, layered_brush_editor *Element + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(chunk_thumbnail*,&Element->SeedLayer), + CSz("SeedLayer"), + Params + ); + + + + + + + + DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/do_editor_ui_for_compound_type_level_editor.h b/generated/do_editor_ui_for_compound_type_level_editor.h index 8f13764f3..2b586373f 100644 --- a/generated/do_editor_ui_for_compound_type_level_editor.h +++ b/generated/do_editor_ui_for_compound_type_level_editor.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:423:0 +// src/engine/editor.cpp:425:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, level_editor *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_lighting_render_group.h b/generated/do_editor_ui_for_compound_type_lighting_render_group.h index 2c4d78eb3..93f7bf0b4 100644 --- a/generated/do_editor_ui_for_compound_type_lighting_render_group.h +++ b/generated/do_editor_ui_for_compound_type_lighting_render_group.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:402:0 +// src/engine/editor.cpp:404:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, lighting_render_group *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_lighting_settings.h b/generated/do_editor_ui_for_compound_type_lighting_settings.h index c539caaa6..e179411fd 100644 --- a/generated/do_editor_ui_for_compound_type_lighting_settings.h +++ b/generated/do_editor_ui_for_compound_type_lighting_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:190:0 +// src/engine/editor.cpp:192:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, lighting_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_lod_element_buffer.h b/generated/do_editor_ui_for_compound_type_lod_element_buffer.h index 9acb59d37..48e1670ad 100644 --- a/generated/do_editor_ui_for_compound_type_lod_element_buffer.h +++ b/generated/do_editor_ui_for_compound_type_lod_element_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:262:0 +// src/engine/editor.cpp:264:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, lod_element_buffer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_model.h b/generated/do_editor_ui_for_compound_type_model.h index 937585ba9..358f14709 100644 --- a/generated/do_editor_ui_for_compound_type_model.h +++ b/generated/do_editor_ui_for_compound_type_model.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:265:0 +// src/engine/editor.cpp:267:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, model *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_noise_layer.h b/generated/do_editor_ui_for_compound_type_noise_layer.h index f5f995d85..d33fa4754 100644 --- a/generated/do_editor_ui_for_compound_type_noise_layer.h +++ b/generated/do_editor_ui_for_compound_type_noise_layer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:339:0 +// src/engine/editor.cpp:341:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, noise_layer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_particle.h b/generated/do_editor_ui_for_compound_type_particle.h index eb781f6a0..edfb30b39 100644 --- a/generated/do_editor_ui_for_compound_type_particle.h +++ b/generated/do_editor_ui_for_compound_type_particle.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:205:0 +// src/engine/editor.cpp:207:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, particle *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_particle_system.h b/generated/do_editor_ui_for_compound_type_particle_system.h index c964cf251..a6c0b1692 100644 --- a/generated/do_editor_ui_for_compound_type_particle_system.h +++ b/generated/do_editor_ui_for_compound_type_particle_system.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:208:0 +// src/engine/editor.cpp:210:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, particle_system *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_perlin_noise_params.h b/generated/do_editor_ui_for_compound_type_perlin_noise_params.h index 6c0cac418..33febf5b5 100644 --- a/generated/do_editor_ui_for_compound_type_perlin_noise_params.h +++ b/generated/do_editor_ui_for_compound_type_perlin_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:92:0 +// src/engine/editor.cpp:94:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, perlin_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_physics.h b/generated/do_editor_ui_for_compound_type_physics.h index e88ccc2b2..2cc151ee9 100644 --- a/generated/do_editor_ui_for_compound_type_physics.h +++ b/generated/do_editor_ui_for_compound_type_physics.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:196:0 +// src/engine/editor.cpp:198:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, physics *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_plane.h b/generated/do_editor_ui_for_compound_type_plane.h index c63331a46..88ee35034 100644 --- a/generated/do_editor_ui_for_compound_type_plane.h +++ b/generated/do_editor_ui_for_compound_type_plane.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:321:0 +// src/engine/editor.cpp:323:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, plane *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_platform.h b/generated/do_editor_ui_for_compound_type_platform.h index db1f8e8ca..38c895136 100644 --- a/generated/do_editor_ui_for_compound_type_platform.h +++ b/generated/do_editor_ui_for_compound_type_platform.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:143:0 +// src/engine/editor.cpp:145:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, platform *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_random_series.h b/generated/do_editor_ui_for_compound_type_random_series.h index 3cfc0a2e0..d51491290 100644 --- a/generated/do_editor_ui_for_compound_type_random_series.h +++ b/generated/do_editor_ui_for_compound_type_random_series.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:199:0 +// src/engine/editor.cpp:201:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, random_series *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_render_buffers_2d.h b/generated/do_editor_ui_for_compound_type_render_buffers_2d.h index ee35e6eb3..5d1a53bdc 100644 --- a/generated/do_editor_ui_for_compound_type_render_buffers_2d.h +++ b/generated/do_editor_ui_for_compound_type_render_buffers_2d.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:393:0 +// src/engine/editor.cpp:395:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, render_buffers_2d *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_render_debug.h b/generated/do_editor_ui_for_compound_type_render_debug.h index 45a1680a2..00c0a16dc 100644 --- a/generated/do_editor_ui_for_compound_type_render_debug.h +++ b/generated/do_editor_ui_for_compound_type_render_debug.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:411:0 +// src/engine/editor.cpp:413:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, render_debug *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_render_settings.h b/generated/do_editor_ui_for_compound_type_render_settings.h index f0ea3201d..ccd6643e7 100644 --- a/generated/do_editor_ui_for_compound_type_render_settings.h +++ b/generated/do_editor_ui_for_compound_type_render_settings.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:193:0 +// src/engine/editor.cpp:195:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, render_settings *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_renderer_2d.h b/generated/do_editor_ui_for_compound_type_renderer_2d.h index 73565136b..409b78d28 100644 --- a/generated/do_editor_ui_for_compound_type_renderer_2d.h +++ b/generated/do_editor_ui_for_compound_type_renderer_2d.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:396:0 +// src/engine/editor.cpp:398:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, renderer_2d *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_shader.h b/generated/do_editor_ui_for_compound_type_shader.h index 89a239470..fca20aa40 100644 --- a/generated/do_editor_ui_for_compound_type_shader.h +++ b/generated/do_editor_ui_for_compound_type_shader.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:390:0 +// src/engine/editor.cpp:392:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shader *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_shape_layer.h b/generated/do_editor_ui_for_compound_type_shape_layer.h index 578a5884a..51abf148d 100644 --- a/generated/do_editor_ui_for_compound_type_shape_layer.h +++ b/generated/do_editor_ui_for_compound_type_shape_layer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:104:0 +// src/engine/editor.cpp:106:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shape_layer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_texture.h b/generated/do_editor_ui_for_compound_type_texture.h index 1cbca768b..135db4b0c 100644 --- a/generated/do_editor_ui_for_compound_type_texture.h +++ b/generated/do_editor_ui_for_compound_type_texture.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:330:0 +// src/engine/editor.cpp:332:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, texture *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_ui_debug.h b/generated/do_editor_ui_for_compound_type_ui_debug.h index f9e81a758..1c71a3b1e 100644 --- a/generated/do_editor_ui_for_compound_type_ui_debug.h +++ b/generated/do_editor_ui_for_compound_type_ui_debug.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:414:0 +// src/engine/editor.cpp:416:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_debug *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_ui_id.h b/generated/do_editor_ui_for_compound_type_ui_id.h index ca684d732..a9d61dd61 100644 --- a/generated/do_editor_ui_for_compound_type_ui_id.h +++ b/generated/do_editor_ui_for_compound_type_ui_id.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:113:0 +// src/engine/editor.cpp:115:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_id *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_ui_toggle.h b/generated/do_editor_ui_for_compound_type_ui_toggle.h index 639807fd5..1d75ae5d0 100644 --- a/generated/do_editor_ui_for_compound_type_ui_toggle.h +++ b/generated/do_editor_ui_for_compound_type_ui_toggle.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:116:0 +// src/engine/editor.cpp:118:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_toggle *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h b/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h index c93da7e7c..1455da6e2 100644 --- a/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h +++ b/generated/do_editor_ui_for_compound_type_untextured_3d_geometry_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:223:0 +// src/engine/editor.cpp:225:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, untextured_3d_geometry_buffer *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_vertex_material.h b/generated/do_editor_ui_for_compound_type_vertex_material.h index 5739a7dee..160f9a583 100644 --- a/generated/do_editor_ui_for_compound_type_vertex_material.h +++ b/generated/do_editor_ui_for_compound_type_vertex_material.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:217:0 +// src/engine/editor.cpp:219:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, vertex_material *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h b/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h index d5602ad1c..386ea0d09 100644 --- a/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h +++ b/generated/do_editor_ui_for_compound_type_voronoi_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:95:0 +// src/engine/editor.cpp:97:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, voronoi_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_vox_data.h b/generated/do_editor_ui_for_compound_type_vox_data.h index e2c1c90cc..754827d0e 100644 --- a/generated/do_editor_ui_for_compound_type_vox_data.h +++ b/generated/do_editor_ui_for_compound_type_vox_data.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:253:0 +// src/engine/editor.cpp:255:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, vox_data *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_voxel.h b/generated/do_editor_ui_for_compound_type_voxel.h index aaaa36283..3ab6c01ac 100644 --- a/generated/do_editor_ui_for_compound_type_voxel.h +++ b/generated/do_editor_ui_for_compound_type_voxel.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:244:0 +// src/engine/editor.cpp:246:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, voxel *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_voxel_lighting.h b/generated/do_editor_ui_for_compound_type_voxel_lighting.h index 9911b4c84..6b115127a 100644 --- a/generated/do_editor_ui_for_compound_type_voxel_lighting.h +++ b/generated/do_editor_ui_for_compound_type_voxel_lighting.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:247:0 +// src/engine/editor.cpp:249:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, voxel_lighting *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_white_noise_params.h b/generated/do_editor_ui_for_compound_type_white_noise_params.h index 6d4c56012..4d21555df 100644 --- a/generated/do_editor_ui_for_compound_type_white_noise_params.h +++ b/generated/do_editor_ui_for_compound_type_white_noise_params.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:89:0 +// src/engine/editor.cpp:91:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, white_noise_params *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_work_queue.h b/generated/do_editor_ui_for_compound_type_work_queue.h index 3e89c3939..06f28d9ca 100644 --- a/generated/do_editor_ui_for_compound_type_work_queue.h +++ b/generated/do_editor_ui_for_compound_type_work_queue.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:134:0 +// src/engine/editor.cpp:136:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, work_queue *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_work_queue_entry.h b/generated/do_editor_ui_for_compound_type_work_queue_entry.h index 831c731cb..7dce80638 100644 --- a/generated/do_editor_ui_for_compound_type_work_queue_entry.h +++ b/generated/do_editor_ui_for_compound_type_work_queue_entry.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:131:0 +// src/engine/editor.cpp:133:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, work_queue_entry *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world.h b/generated/do_editor_ui_for_compound_type_world.h index 25f3848d6..a4b0db13d 100644 --- a/generated/do_editor_ui_for_compound_type_world.h +++ b/generated/do_editor_ui_for_compound_type_world.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:187:0 +// src/engine/editor.cpp:189:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_chunk.h b/generated/do_editor_ui_for_compound_type_world_chunk.h index 8904e49d3..d0b599370 100644 --- a/generated/do_editor_ui_for_compound_type_world_chunk.h +++ b/generated/do_editor_ui_for_compound_type_world_chunk.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:296:0 +// src/engine/editor.cpp:298:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_chunk *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h index 5a196e188..b34ccc13d 100644 --- a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h +++ b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_rect.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:100:0 +// src/engine/editor.cpp:102:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_update_op_shape_params_rect *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h index 9e3845ce1..8f5e26cf8 100644 --- a/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h +++ b/generated/do_editor_ui_for_compound_type_world_update_op_shape_params_sphere.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:98:0 +// src/engine/editor.cpp:100:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, world_update_op_shape_params_sphere *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Button) diff --git a/generated/do_editor_ui_for_container_entity_ptr_block_array.h b/generated/do_editor_ui_for_container_entity_ptr_block_array.h index 9eadf7aea..c21a31bd0 100644 --- a/generated/do_editor_ui_for_container_entity_ptr_block_array.h +++ b/generated/do_editor_ui_for_container_entity_ptr_block_array.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:293:0 +// src/engine/editor.cpp:295:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_ptr_block_array *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_container_model_buffer.h b/generated/do_editor_ui_for_container_model_buffer.h index cee1da5b7..792661d54 100644 --- a/generated/do_editor_ui_for_container_model_buffer.h +++ b/generated/do_editor_ui_for_container_model_buffer.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:268:0 +// src/engine/editor.cpp:270:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, model_buffer *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_container_ui_toggle_hashtable.h b/generated/do_editor_ui_for_container_ui_toggle_hashtable.h index 598188b30..0704f5296 100644 --- a/generated/do_editor_ui_for_container_ui_toggle_hashtable.h +++ b/generated/do_editor_ui_for_container_ui_toggle_hashtable.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:125:0 +// src/engine/editor.cpp:127:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, ui_toggle_hashtable *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_container_v3_cursor.h b/generated/do_editor_ui_for_container_v3_cursor.h index 518124aec..17a3b0a23 100644 --- a/generated/do_editor_ui_for_container_v3_cursor.h +++ b/generated/do_editor_ui_for_container_v3_cursor.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:110:0 +// src/engine/editor.cpp:112:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, v3_cursor *Container, cs Name, EDITOR_UI_FUNCTION_PROTO_DEFAULTS) diff --git a/generated/do_editor_ui_for_enum_asset_type.h b/generated/do_editor_ui_for_enum_asset_type.h index 4978ebf59..73eb0a4dc 100644 --- a/generated/do_editor_ui_for_enum_asset_type.h +++ b/generated/do_editor_ui_for_enum_asset_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:308:0 +// src/engine/editor.cpp:310:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, asset_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_chunk_flag.h b/generated/do_editor_ui_for_enum_chunk_flag.h index aa58b5864..3b202e76b 100644 --- a/generated/do_editor_ui_for_enum_chunk_flag.h +++ b/generated/do_editor_ui_for_enum_chunk_flag.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:241:0 +// src/engine/editor.cpp:243:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, chunk_flag *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_engine_debug_view_mode.h b/generated/do_editor_ui_for_enum_engine_debug_view_mode.h index 95d6cf9a4..1a372facc 100644 --- a/generated/do_editor_ui_for_enum_engine_debug_view_mode.h +++ b/generated/do_editor_ui_for_enum_engine_debug_view_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:420:0 +// src/engine/editor.cpp:422:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, engine_debug_view_mode *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_entity_behavior_flags.h b/generated/do_editor_ui_for_enum_entity_behavior_flags.h index b8c183009..05094c13b 100644 --- a/generated/do_editor_ui_for_enum_entity_behavior_flags.h +++ b/generated/do_editor_ui_for_enum_entity_behavior_flags.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:179:0 +// src/engine/editor.cpp:181:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_behavior_flags *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_entity_state.h b/generated/do_editor_ui_for_enum_entity_state.h index a7ecacd81..7338e9643 100644 --- a/generated/do_editor_ui_for_enum_entity_state.h +++ b/generated/do_editor_ui_for_enum_entity_state.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:176:0 +// src/engine/editor.cpp:178:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, entity_state *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_file_traversal_type.h b/generated/do_editor_ui_for_enum_file_traversal_type.h index 23f1497af..730068ed6 100644 --- a/generated/do_editor_ui_for_enum_file_traversal_type.h +++ b/generated/do_editor_ui_for_enum_file_traversal_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:271:0 +// src/engine/editor.cpp:273:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, file_traversal_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_particle_spawn_type.h b/generated/do_editor_ui_for_enum_particle_spawn_type.h index 1380a9bad..18814311f 100644 --- a/generated/do_editor_ui_for_enum_particle_spawn_type.h +++ b/generated/do_editor_ui_for_enum_particle_spawn_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:202:0 +// src/engine/editor.cpp:204:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, particle_spawn_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_resolution_setting.h b/generated/do_editor_ui_for_enum_resolution_setting.h index 89d882e30..0921cc19b 100644 --- a/generated/do_editor_ui_for_enum_resolution_setting.h +++ b/generated/do_editor_ui_for_enum_resolution_setting.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:426:0 +// src/engine/editor.cpp:428:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, resolution_setting *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_shader_language_setting.h b/generated/do_editor_ui_for_enum_shader_language_setting.h index 3585c7c8a..537b26061 100644 --- a/generated/do_editor_ui_for_enum_shader_language_setting.h +++ b/generated/do_editor_ui_for_enum_shader_language_setting.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:429:0 +// src/engine/editor.cpp:431:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shader_language_setting *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_shape_type.h b/generated/do_editor_ui_for_enum_shape_type.h index 076546635..2dc4aeabf 100644 --- a/generated/do_editor_ui_for_enum_shape_type.h +++ b/generated/do_editor_ui_for_enum_shape_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:102:0 +// src/engine/editor.cpp:104:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, shape_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/do_editor_ui_for_enum_tone_mapping_type.h b/generated/do_editor_ui_for_enum_tone_mapping_type.h index b2029aefb..de8a2d4d1 100644 --- a/generated/do_editor_ui_for_enum_tone_mapping_type.h +++ b/generated/do_editor_ui_for_enum_tone_mapping_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:182:0 +// src/engine/editor.cpp:184:0 link_internal void DoEditorUi(renderer_2d *Ui, window_layout *Window, tone_mapping_type *Element, cs Name, ui_render_params *Params = &DefaultUiRenderParams_Generic) diff --git a/generated/string_and_value_tables_asset_type.h b/generated/string_and_value_tables_asset_type.h index a7afd4de4..18ac5d62e 100644 --- a/generated/string_and_value_tables_asset_type.h +++ b/generated/string_and_value_tables_asset_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:306:0 +// src/engine/editor.cpp:308:0 link_internal counted_string ToStringPrefixless(asset_type Type) diff --git a/generated/string_and_value_tables_engine_debug_view_mode.h b/generated/string_and_value_tables_engine_debug_view_mode.h index 1fe4f17d6..64a9f3206 100644 --- a/generated/string_and_value_tables_engine_debug_view_mode.h +++ b/generated/string_and_value_tables_engine_debug_view_mode.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:172:0 +// src/engine/editor.cpp:174:0 link_internal counted_string ToStringPrefixless(engine_debug_view_mode Type) diff --git a/generated/string_and_value_tables_file_traversal_node.h b/generated/string_and_value_tables_file_traversal_node.h index ba1a18e0d..c83a61396 100644 --- a/generated/string_and_value_tables_file_traversal_node.h +++ b/generated/string_and_value_tables_file_traversal_node.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:166:0 +// src/engine/editor.cpp:168:0 link_internal counted_string ToStringPrefixless(file_traversal_type Type) diff --git a/generated/string_and_value_tables_particle_spawn_type.h b/generated/string_and_value_tables_particle_spawn_type.h index 17d5e1049..75f2be226 100644 --- a/generated/string_and_value_tables_particle_spawn_type.h +++ b/generated/string_and_value_tables_particle_spawn_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:163:0 +// src/engine/editor.cpp:165:0 link_internal counted_string ToStringPrefixless(particle_spawn_type Type) diff --git a/generated/string_and_value_tables_tone_mapping_type.h b/generated/string_and_value_tables_tone_mapping_type.h index 62c6ec206..054e90bc2 100644 --- a/generated/string_and_value_tables_tone_mapping_type.h +++ b/generated/string_and_value_tables_tone_mapping_type.h @@ -1,4 +1,4 @@ -// src/engine/editor.cpp:169:0 +// src/engine/editor.cpp:171:0 link_internal counted_string ToStringPrefixless(tone_mapping_type Type) diff --git a/src/engine/editor.cpp b/src/engine/editor.cpp index ef74bca6b..906d1def9 100644 --- a/src/engine/editor.cpp +++ b/src/engine/editor.cpp @@ -34,6 +34,8 @@ InitEditor(level_editor *Editor) { Editor->LayeredBrushEditor.LayerPreviews[LayerIndex].Thumbnail.Texture.Dim = V2i(BRUSH_PREVIEW_TEXTURE_DIM); } + Editor->LayeredBrushEditor.SeedLayer.Thumbnail.Texture.Dim = V2i(BRUSH_PREVIEW_TEXTURE_DIM); + Editor->LayeredBrushEditor.Preview.Thumbnail.Texture.Dim = V2i(BRUSH_PREVIEW_TEXTURE_DIM); return Result; } @@ -1576,6 +1578,24 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti local_persist window_layout LayersWindow = WindowLayout("Layers", WindowLayoutFlag_Align_Right); PushWindowStart(Ui, &LayersWindow); + if (LayeredBrush->SeedBrushWithSelection) + { + PushTableStart(Ui); + world_chunk *SeedChunk = &LayeredBrush->SeedLayer.Chunk; + chunk_thumbnail *SeedPreview = &LayeredBrush->SeedLayer; + if (SeedPreview->Thumbnail.Texture.ID) { RenderToTexture_Async(&Plat->RenderQ, Engine, &SeedPreview->Thumbnail, &SeedChunk->Meshes, V3(SeedChunk->Dim)/-2.f, 0); } + InteractWithThumbnailTexture(Engine, Ui, &LayersWindow, "seed preview interaction", &Editor->LayeredBrushEditor.SeedLayer.Thumbnail); + PushNewRow(Ui); + PushTableEnd(Ui); + + PushTableStart(Ui); + world_chunk *Root_LayeredBrushPreview = &LayeredBrush->Preview.Chunk; + if (SeedPreview->Thumbnail.Texture.ID) { RenderToTexture_Async(&Plat->RenderQ, Engine, &LayeredBrush->Preview.Thumbnail, &Root_LayeredBrushPreview->Meshes, V3(Root_LayeredBrushPreview->Dim)/-2.f, 0); } + InteractWithThumbnailTexture(Engine, Ui, &LayersWindow, "root preview interaction", &Editor->LayeredBrushEditor.Preview.Thumbnail); + PushNewRow(Ui); + PushTableEnd(Ui); + } + { { @@ -1691,14 +1711,11 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti // TODO(Jesse)(async, speed): It would be kinda nice if this ran async.. if ( Editor->RootChunkNeedsNewMesh ) { - // First find the largest total dimension of all the layers, and the - // largest negative minimum offset. We need this min offset such - // that we can position layers relative to it. By doing this, we - // implicitly take into account the size of the selection, but the - // computation is simpler than if we used the selection box directly - // .. I claim .. - v3i LargestLayerDim = GetSelectionDim(World, Editor); + // TODO(Jesse): Shouldn't the LargestLayerDim take into account the largest Offset too..? + v3i LargestLayerDim = GetSelectionDim(World, Editor) + 2; v3i SmallestMinOffset = GetSmallestMinOffset(LayeredBrush, &LargestLayerDim); + /* if (SmallestMinOffset == V3i(0)) */ + /* {SmallestMinOffset = V3i(1);} */ // Clear the voxels if the size didn't change, otherwise realloc if (Root_LayeredBrushPreview->Dim == LargestLayerDim) @@ -1712,13 +1729,59 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti AllocateWorldChunk(Root_LayeredBrushPreview, {}, LargestLayerDim, Editor->Memory); } + world_chunk *SeedChunk = &LayeredBrush->SeedLayer.Chunk; + if (SeedChunk->Dim == LargestLayerDim) + { + ClearChunkVoxels(SeedChunk->Voxels, SeedChunk->Dim); + } + else + { + AllocateWorldChunk(SeedChunk, {}, LargestLayerDim, Editor->Memory); + } + + + + #if 1 + auto Thread = GetThreadLocalState(ThreadLocal_ThreadIndex); if (LayeredBrush->SeedBrushWithSelection) { if (SelectionComplete(Editor->SelectionClicks)) { - world_chunk Seed = GatherVoxelsOverlappingArea(Engine, Editor->SelectionRegion, GetTranArena()); - CopyChunkOffset(&Seed, Seed.Dim, Root_LayeredBrushPreview, Root_LayeredBrushPreview->Dim, -1*SmallestMinOffset); + rect3cp GatherRegion = Editor->SelectionRegion; + GatherRegion.Min.Offset -= V3(1); + GatherRegion.Max.Offset += V3(1); + Canonicalize(World, &GatherRegion.Min); + Canonicalize(World, &GatherRegion.Max); + + world_chunk Seed = GatherVoxelsOverlappingArea(Engine, GatherRegion, GetTranArena()); + /* CopyChunkOffset(&Seed, Seed.Dim, Root_LayeredBrushPreview, Root_LayeredBrushPreview->Dim, -1*SmallestMinOffset); */ + CopyChunkOffset(&Seed, Seed.Dim, SeedChunk, SeedChunk->Dim, {}); + + /* // NOTE(Jesse): Zero out everything on the exterior edge */ + /* RangeIterator (z, SeedChunk->Dim.z) */ + /* RangeIterator (y, SeedChunk->Dim.y) */ + /* RangeIterator (x, SeedChunk->Dim.x) */ + /* { */ + /* if (z == 0 || y == 0 || x == 0 || */ + /* z == (SeedChunk->Dim.z-1) || y == (SeedChunk->Dim.y-1) || x == (SeedChunk->Dim.x-1)) */ + /* /1* if (z == 0 || y == 0 || x == 0) *1/ */ + /* { */ + /* s32 Index = GetIndex(x,y,z, SeedChunk->Dim); */ + /* SeedChunk->Voxels[Index] = {}; */ + /* } */ + /* } */ + + MarkBoundaryVoxels_MakeExteriorFaces(SeedChunk->Voxels, SeedChunk->Dim, {}, SeedChunk->Dim); + + FinalizeChunkInitialization(SeedChunk); + + data_type Type = GetMeshDatatypeForDimension(SeedChunk->Dim); + auto *TempMesh = AllocateTempMesh(Thread->TempMemory, Type); + RebuildWorldChunkMesh(Thread, SeedChunk, {}, SeedChunk->Dim, MeshBit_Lod0, TempMesh, Thread->TempMemory); + SyncGpuBuffersAsync(Engine, &SeedChunk->Meshes); + + CopyChunkOffset(SeedChunk, SeedChunk->Dim, Root_LayeredBrushPreview, Root_LayeredBrushPreview->Dim, {}); } } #endif @@ -1727,18 +1790,19 @@ BrushSettingsForLayeredBrush(engine_resources *Engine, window_layout *BrushSetti { brush_layer *Layer = Layers + LayerIndex; chunk_thumbnail *Preview = Previews + LayerIndex; - ApplyBrushLayer(Engine, Layer, Preview, Root_LayeredBrushPreview, SmallestMinOffset); + ApplyBrushLayer(Engine, Layer, Preview, Root_LayeredBrushPreview, SmallestMinOffset+V3i(-1)); } FinalizeChunkInitialization(Root_LayeredBrushPreview); { - auto Thread = GetThreadLocalState(ThreadLocal_ThreadIndex); auto Chunk = Root_LayeredBrushPreview; data_type Type = GetMeshDatatypeForDimension(Chunk->Dim); auto *TempMesh = AllocateTempMesh(Thread->TempMemory, Type); + MarkBoundaryVoxels_MakeExteriorFaces(Root_LayeredBrushPreview->Voxels, Root_LayeredBrushPreview->Dim, {}, Root_LayeredBrushPreview->Dim-V3i(2)); + RebuildWorldChunkMesh(Thread, Chunk, {}, Chunk->Dim, MeshBit_Lod0, TempMesh, Thread->TempMemory); } @@ -2235,6 +2299,7 @@ DoWorldEditor(engine_resources *Engine) // and we can just collapse world edits automatically in the edit thread. // // When my laptop is unplugged running on battery power, this is _much_ faster. + NotImplemented; #if 0 if (Editor->Params.Mode == WorldEdit_Mode_Paint) { @@ -2285,7 +2350,7 @@ DoWorldEditor(engine_resources *Engine) } chunk_data D = {Chunk->Flags, Chunk->Dim, Chunk->Voxels, Chunk->VoxelLighting}; - world_update_op_shape_params_chunk_data ChunkDataShape = { D, V3(Offset) + GetSimSpaceP(World, Editor->SelectionRegion.Min) }; + world_update_op_shape_params_chunk_data ChunkDataShape = { D, V3(Offset) + GetSimSpaceP(World, Editor->SelectionRegion.Min) - V3i(1) }; world_edit_shape Shape = { @@ -2509,7 +2574,7 @@ DrawEditorPreview(engine_resources *Engine, shader *Shader) layered_brush_editor *LayeredBrushEditor = &Editor->LayeredBrushEditor; v3i SmallestMinOffset = GetSmallestMinOffset(LayeredBrushEditor); Chunk = &LayeredBrushEditor->Preview.Chunk; - Basis = V3(SmallestMinOffset) + GetRenderP(Engine, Editor->EditorPreviewRegionMin); + Basis = V3(SmallestMinOffset) + GetRenderP(Engine, Editor->EditorPreviewRegionMin) - V3i(1); } break; default: {} break; diff --git a/src/engine/editor.h b/src/engine/editor.h index c80e6e664..c35b7cd46 100644 --- a/src/engine/editor.h +++ b/src/engine/editor.h @@ -970,6 +970,8 @@ struct layered_brush_editor poof(@version(3)) brush_layer Layers[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount)) chunk_thumbnail LayerPreviews[MAX_BRUSH_LAYERS]; poof(@array_length(LayerCount) @no_serialize) + chunk_thumbnail SeedLayer; poof(@no_serialize) // NOTE(Jesse): Special layer that acts as the seed value + b8 SeedBrushWithSelection; b8 BrushFollowsCursor; @@ -977,6 +979,7 @@ struct layered_brush_editor poof(@version(3)) world_edit_mode Mode; world_edit_mode_modifier Modifier; + // NOTE(Jesse): This is actually just using the chunk .. should probably change it chunk_thumbnail Preview; poof(@no_serialize) }; diff --git a/src/engine/render.cpp b/src/engine/render.cpp index 2b1f74c4e..3495e5b90 100644 --- a/src/engine/render.cpp +++ b/src/engine/render.cpp @@ -1320,13 +1320,11 @@ SetupGBufferShader(graphics *Graphics, v2i ApplicationResolution, b32 DoSelectio if (DoSelectionMasking) { - - GBufferRenderGroup->MinClipP_worldspace = GetRenderP(GetEngineResources(), GetLevelEditor()->SelectionRegion.Min); - GBufferRenderGroup->MaxClipP_worldspace = GetRenderP(GetEngineResources(), GetLevelEditor()->SelectionRegion.Max); - - /* rect3 SimSelection = GetSelectionRect(GetWorld(), GetLevelEditor()); */ - /* GBufferRenderGroup->MinClipP_worldspace = SimSelection.Min; */ - /* GBufferRenderGroup->MaxClipP_worldspace = SimSelection.Max; */ + auto SelectionRegion = GetLevelEditor()->SelectionRegion; + SelectionRegion.Min.Offset += V3(0.0001f); + SelectionRegion.Max.Offset -= V3(0.0001f); + GBufferRenderGroup->MinClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Min); + GBufferRenderGroup->MaxClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Max); } else { diff --git a/src/engine/world_chunk.cpp b/src/engine/world_chunk.cpp index 6723ba589..691bf7d59 100644 --- a/src/engine/world_chunk.cpp +++ b/src/engine/world_chunk.cpp @@ -558,7 +558,7 @@ MergeChunksOffset(world_chunk *Src, world_chunk *Dest, voxel_position Offset) } link_internal void -CopyChunkOffset(world_chunk *Src, voxel_position SrcChunkDim, world_chunk *Dest, voxel_position DestChunkDim, voxel_position SrcOffset) +CopyChunkOffset(world_chunk *Src, v3i SrcChunkDim, world_chunk *Dest, v3i DestChunkDim, v3i SrcOffset) { TIMED_FUNCTION(); diff --git a/src/engine/world_update.cpp b/src/engine/world_update.cpp index 585cfee2b..d02f49b0e 100644 --- a/src/engine/world_update.cpp +++ b/src/engine/world_update.cpp @@ -960,8 +960,10 @@ ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_re r32 RadiusSquared = Square(Sphere->Radius); rect3i SSRect = SimSpaceUpdateBounds; - Assert(EditCenterP > SimSpaceUpdateBounds.Min); - Assert(EditCenterP < SimSpaceUpdateBounds.Max); + // NOTE(Jesse): In the case of a 1-wide update region, the EditCenterP + // ends up on the min edge + Assert(EditCenterP >= SimSpaceUpdateBounds.Min); + Assert(EditCenterP <= SimSpaceUpdateBounds.Max); /* rect3i SSRect = RectCenterRad(EditCenterP, V3i(Sphere->Radius)); */ apply_world_edit_params Params = {Mode, SSRect, SimSpaceUpdateBounds, CopiedChunk, Invert, PersistWhitespace, NewColor, NewTransparency}; @@ -984,8 +986,7 @@ ApplyUpdateToRegion(thread_local_state *Thread, work_queue_entry_update_world_re WorldEdit_shape_sphere_Flood(&Params, Thread, RadiusSquared, EditCenterP, FloodOrigin, NewVoxelValue); } break; } - - } break; +} break; case type_world_update_op_shape_params_rect: { From 65a0874a249e1c40d1e2fcc7c9281cd29d69e334 Mon Sep 17 00:00:00 2001 From: a pirate Date: Sat, 7 Sep 2024 15:27:35 -0700 Subject: [PATCH 7/9] Drive shadow map shader from poof shader_magic, and fix shadow mapping with the editor preview --- ..._for_compound_type_g_buffer_render_group.h | 30 --------- .../do_editor_ui_for_compound_type_graphics.h | 30 +++++++++ generated/for_datatypes_0XxWqGSZ.h | 1 + generated/for_datatypes_fkubhsYl.h | 1 + generated/for_datatypes_kv3WBTai.h | 1 + ...ent_buffer_untextured_3d_geometry_buffer.h | 2 +- .../shader_magic_bloom_downsample_shader.h | 7 ++- .../shader_magic_bloom_upsample_shader.h | 9 +-- generated/shader_magic_shadow_map_shader.h | 60 ++++++++++++++++++ jesse.make.sh | 2 +- shaders/DepthRTT.fragmentshader | 16 +++++ shaders/DepthRTT.vertexshader | 10 ++- shaders/gBuffer.vertexshader | 6 +- src/engine/api.cpp | 4 +- src/engine/bloom.cpp | 3 + src/engine/bloom.h | 5 +- src/engine/engine.h | 1 + src/engine/graphics.h | 8 +++ src/engine/light.h | 12 ---- src/engine/render.cpp | 51 ++++++++++----- src/engine/render.h | 4 +- src/engine/render/render_init.cpp | 41 ++---------- src/engine/render/shadow_map.h | 63 +++++++++++++++++++ src/engine/resources.cpp | 4 +- 24 files changed, 255 insertions(+), 116 deletions(-) create mode 100644 generated/shader_magic_shadow_map_shader.h create mode 100644 src/engine/render/shadow_map.h diff --git a/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h b/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h index b2ab0c808..8c835dfcf 100644 --- a/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h +++ b/generated/do_editor_ui_for_compound_type_g_buffer_render_group.h @@ -71,36 +71,6 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, g_buffer_render_group *Elemen - DoEditorUi(Ui, - Window, - // Cast to remove const/volatile keywords if they're there - Cast(v3*,&Element->MinClipP_worldspace), - CSz("MinClipP_worldspace"), - Params - ); - - - - - - - - - DoEditorUi(Ui, - Window, - // Cast to remove const/volatile keywords if they're there - Cast(v3*,&Element->MaxClipP_worldspace), - CSz("MaxClipP_worldspace"), - Params - ); - - - - - - - - DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/do_editor_ui_for_compound_type_graphics.h b/generated/do_editor_ui_for_compound_type_graphics.h index e04b0abe6..f036303c4 100644 --- a/generated/do_editor_ui_for_compound_type_graphics.h +++ b/generated/do_editor_ui_for_compound_type_graphics.h @@ -204,6 +204,36 @@ DoEditorUi(renderer_2d *Ui, window_layout *Window, graphics *Element, cs Name, u + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(v3*,&Element->MinClipP_worldspace), + CSz("MinClipP_worldspace"), + Params + ); + + + + + + + + + DoEditorUi(Ui, + Window, + // Cast to remove const/volatile keywords if they're there + Cast(v3*,&Element->MaxClipP_worldspace), + CSz("MaxClipP_worldspace"), + Params + ); + + + + + + + + DoEditorUi(Ui, Window, // Cast to remove const/volatile keywords if they're there diff --git a/generated/for_datatypes_0XxWqGSZ.h b/generated/for_datatypes_0XxWqGSZ.h index 6b28c5552..1c451e740 100644 --- a/generated/for_datatypes_0XxWqGSZ.h +++ b/generated/for_datatypes_0XxWqGSZ.h @@ -629,6 +629,7 @@ WorkQueueEntryAsyncFunction( render_to_texture_async_params *Params ) + struct draw_lod_async_params; diff --git a/generated/for_datatypes_fkubhsYl.h b/generated/for_datatypes_fkubhsYl.h index 6ed1a8522..606638802 100644 --- a/generated/for_datatypes_fkubhsYl.h +++ b/generated/for_datatypes_fkubhsYl.h @@ -619,6 +619,7 @@ render_to_texture_async_params render_to_texture_async_params; + draw_lod_async_params draw_lod_async_params; diff --git a/generated/for_datatypes_kv3WBTai.h b/generated/for_datatypes_kv3WBTai.h index 1194d951f..ce5bfdfb9 100644 --- a/generated/for_datatypes_kv3WBTai.h +++ b/generated/for_datatypes_kv3WBTai.h @@ -619,6 +619,7 @@ type_render_to_texture_async_params, + type_draw_lod_async_params, diff --git a/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h b/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h index cb04d88d3..149231e39 100644 --- a/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h +++ b/generated/gpu_buffer_lod_element_buffer_untextured_3d_geometry_buffer.h @@ -1,4 +1,4 @@ -// src/engine/render.cpp:1039:0 +// src/engine/render.cpp:1040:0 link_internal void diff --git a/generated/shader_magic_bloom_downsample_shader.h b/generated/shader_magic_bloom_downsample_shader.h index 6d3d4431a..619bb0a26 100644 --- a/generated/shader_magic_bloom_downsample_shader.h +++ b/generated/shader_magic_bloom_downsample_shader.h @@ -1,14 +1,15 @@ // src/engine/bloom.h:11:0 link_internal void -InitializeBloomDownsampleShader( bloom_downsample_shader *Struct , v2 *SrcResolution ) +InitializeBloomDownsampleShader( bloom_downsample_shader *Struct , v2*SrcResolution ) { Struct->Program = LoadShaders(CSz("external/bonsai_stdlib/shaders/Passthrough.vertexshader"), CSz("shaders/bloom_downsample.fragmentshader")); u32 UniformIndex = 0; - Struct->SrcResolution = *SrcResolution; - Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program, &Struct->SrcResolution, "SrcResolution"); + Struct->SrcResolution = SrcResolution; + + Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program, Struct->SrcResolution, "SrcResolution"); ++UniformIndex; if (UniformIndex != 1 ) diff --git a/generated/shader_magic_bloom_upsample_shader.h b/generated/shader_magic_bloom_upsample_shader.h index d98956175..e50d96165 100644 --- a/generated/shader_magic_bloom_upsample_shader.h +++ b/generated/shader_magic_bloom_upsample_shader.h @@ -1,14 +1,15 @@ -// src/engine/bloom.h:24:0 +// src/engine/bloom.h:25:0 link_internal void -InitializeBloomUpsampleShader( bloom_upsample_shader *Struct , f32 *FilterRadius ) +InitializeBloomUpsampleShader( bloom_upsample_shader *Struct , f32*FilterRadius ) { Struct->Program = LoadShaders(CSz("external/bonsai_stdlib/shaders/Passthrough.vertexshader"), CSz("shaders/bloom_upsample.fragmentshader")); u32 UniformIndex = 0; - Struct->FilterRadius = *FilterRadius; - Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program, &Struct->FilterRadius, "FilterRadius"); + Struct->FilterRadius = FilterRadius; + + Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program, Struct->FilterRadius, "FilterRadius"); ++UniformIndex; if (UniformIndex != 1 ) diff --git a/generated/shader_magic_shadow_map_shader.h b/generated/shader_magic_shadow_map_shader.h new file mode 100644 index 000000000..1de332f42 --- /dev/null +++ b/generated/shader_magic_shadow_map_shader.h @@ -0,0 +1,60 @@ +// src/engine/render/shadow_map.h:21:0 + +link_internal void +InitializeShadowMapShader( shadow_map_shader *Struct , m4 MVP , m4 ModelMatrix , v3*MinClipP_worldspace , v3*MaxClipP_worldspace ) +{ + Struct->Program = LoadShaders(CSz("shaders/DepthRTT.vertexshader"), CSz("shaders/DepthRTT.fragmentshader")); + + u32 UniformIndex = 0; + + + Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program,&Struct->MVP, "MVP"); + ++UniformIndex; + + + Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program,&Struct->ModelMatrix, "ModelMatrix"); + ++UniformIndex; + + Struct->MinClipP_worldspace = MinClipP_worldspace; + + Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program, Struct->MinClipP_worldspace, "MinClipP_worldspace"); + ++UniformIndex; + + Struct->MaxClipP_worldspace = MaxClipP_worldspace; + + Struct->Uniforms[UniformIndex] = ShaderUniform(&Struct->Program, Struct->MaxClipP_worldspace, "MaxClipP_worldspace"); + ++UniformIndex; + + if (UniformIndex != 4 ) + { + Error("Shader (shadow_map_shader) had an incorrect number of uniform slots!"); + } + + +} + +link_internal void +UseShader( shadow_map_shader *Struct ) +{ + GL.UseProgram(Struct->Program.ID); + + s32 TextureUnit = 0; + s32 UniformIndex = 0; + BindUnifromById(Struct->Uniforms+UniformIndex, &TextureUnit); + ++UniformIndex; + + BindUnifromById(Struct->Uniforms+UniformIndex, &TextureUnit); + ++UniformIndex; + + BindUnifromById(Struct->Uniforms+UniformIndex, &TextureUnit); + ++UniformIndex; + + BindUnifromById(Struct->Uniforms+UniformIndex, &TextureUnit); + ++UniformIndex; + + if (UniformIndex != 4 ) + { + Error("Shader (shadow_map_shader) had an incorrect number of uniform slots!"); + } +} + diff --git a/jesse.make.sh b/jesse.make.sh index 8e1178b7f..4db6f004c 100644 --- a/jesse.make.sh +++ b/jesse.make.sh @@ -10,11 +10,11 @@ # ./make.sh RunTests ./make.sh $OPT \ + BuildSingleExample examples/project_and_level_picker \ BuildSingleExample examples/blank_project \ BuildExecutables \ # BuildSingleExample examples/tools/voxel_synthesis_rule_baker \ # BuildSingleExample examples/turn_based \ -# BuildSingleExample examples/project_and_level_picker \ # BuildSingleExample examples/terrain_gen \ # BuildSingleExample examples/transparency \ # BuildSingleExample examples/the_wanderer \ diff --git a/shaders/DepthRTT.fragmentshader b/shaders/DepthRTT.fragmentshader index f5728feba..d98f9bec7 100644 --- a/shaders/DepthRTT.fragmentshader +++ b/shaders/DepthRTT.fragmentshader @@ -1,7 +1,23 @@ /* out vec4 color; */ +uniform vec3 MinClipP_worldspace; +uniform vec3 MaxClipP_worldspace; + +in vec3 vertexP_worldspace; + void main() { + if (vertexP_worldspace.x >= MinClipP_worldspace.x && + vertexP_worldspace.y >= MinClipP_worldspace.y && + vertexP_worldspace.z >= MinClipP_worldspace.z && + + vertexP_worldspace.x < MaxClipP_worldspace.x && + vertexP_worldspace.y < MaxClipP_worldspace.y && + vertexP_worldspace.z < MaxClipP_worldspace.z) + { + discard; + } + /* Depth is written linearized to the texture; our projection is orthographic */ /* color = vec4(1,0,0,1); */ /* gl_FragDepth = gl_FragCoord.z; */ diff --git a/shaders/DepthRTT.vertexshader b/shaders/DepthRTT.vertexshader index 0b11051dd..9728cf8be 100644 --- a/shaders/DepthRTT.vertexshader +++ b/shaders/DepthRTT.vertexshader @@ -1,10 +1,14 @@ layout(location = 0) in vec3 vertexPosition_modelspace; -uniform mat4 depthMVP; + +// NOTE(Jesse): Camera transform +uniform mat4 MVP; uniform mat4 ModelMatrix; +out vec3 vertexP_worldspace; + void main() { - gl_Position = depthMVP * ModelMatrix * vec4(vertexPosition_modelspace, 1); - /* gl_Position = vec4(0,0,0,0); */ + vertexP_worldspace = (ModelMatrix * vec4(vertexPosition_modelspace, 1)).xyz; // ?? + gl_Position = MVP * V4(vertexP_worldspace, 1); } diff --git a/shaders/gBuffer.vertexshader b/shaders/gBuffer.vertexshader index cbe48281c..ba11a558d 100644 --- a/shaders/gBuffer.vertexshader +++ b/shaders/gBuffer.vertexshader @@ -40,11 +40,11 @@ void main() TransEmiss = V2(float(Transparency)/255.f, float(Emission)/(255.f/RENDERER_MAX_LIGHT_EMISSION_VALUE)); /* TransEmiss = V2(0.5f, 0.5f); */ - v4 ModelVertex = ModelMatrix*vec4(V3(vertexPosition_modelspace), 1); + v4 WorldVertex = ModelMatrix*vec4(vertexPosition_modelspace, 1); - vertexP_worldspace = ModelVertex.xyz; + vertexP_worldspace = WorldVertex.xyz; vertexN_worldspace = mat3(NormalMatrix) * V3(vertexNormal_modelspace); - gl_Position = ViewProjection * ModelVertex; + gl_Position = ViewProjection * WorldVertex; } diff --git a/src/engine/api.cpp b/src/engine/api.cpp index 0c8add976..6ab69113e 100644 --- a/src/engine/api.cpp +++ b/src/engine/api.cpp @@ -373,7 +373,7 @@ Bonsai_Simulate(engine_resources *Resources) PushBonsaiRenderCommandTeardownShader(&Plat->RenderQ, BonsaiRenderCommand_ShaderId_gBuffer); PushBonsaiRenderCommandSetupShader(&Plat->RenderQ, BonsaiRenderCommand_ShaderId_ShadowMap); - PushBonsaiRenderCommandDrawWorldChunkDrawList(&Plat->RenderQ, &Graphics->ShadowMapDrawList, &Graphics->SG->DepthShader); + PushBonsaiRenderCommandDrawWorldChunkDrawList(&Plat->RenderQ, &Graphics->ShadowMapDrawList, &Graphics->SG->Shader.Program); PushBonsaiRenderCommandTeardownShader(&Plat->RenderQ, BonsaiRenderCommand_ShaderId_ShadowMap); PushBonsaiRenderCommandGlTimerEnd(&Plat->RenderQ, Graphics->gBuffer->GlTimerObject); @@ -482,7 +482,7 @@ Bonsai_Render(engine_resources *Engine) PushBonsaiRenderCommandSetupShader(&Plat->RenderQ, BonsaiRenderCommand_ShaderId_ShadowMap); - PushBonsaiRenderCommandDrawAllEntities(&Plat->RenderQ, &Graphics->SG->DepthShader); + PushBonsaiRenderCommandDrawAllEntities(&Plat->RenderQ, &Graphics->SG->Shader.Program); PushBonsaiRenderCommandTeardownShader(&Plat->RenderQ, BonsaiRenderCommand_ShaderId_ShadowMap); diff --git a/src/engine/bloom.cpp b/src/engine/bloom.cpp index 822571090..aa49f0ae0 100644 --- a/src/engine/bloom.cpp +++ b/src/engine/bloom.cpp @@ -1,3 +1,4 @@ +// TODO(Jesse): Move to engine/render/bloom.cpp link_internal void InitBloomRenderGroup(bloom_render_group *Group, render_settings *Settings, memory_arena *GraphicsMemory) @@ -27,6 +28,8 @@ InitBloomRenderGroup(bloom_render_group *Group, render_settings *Settings, memor if (CheckAndClearFramebuffer() == False) { Error("Initializing Bloom FBO"); } InitializeBloomDownsampleShader(&Group->DownsampleShader, &Settings->LuminanceMapResolution); + + // TODO(Jesse): drive this from a runtime variable for artistic control? f32 FilterRadiusInUVSpace = 0.004f; InitializeBloomUpsampleShader(&Group->UpsampleShader, &FilterRadiusInUVSpace); } diff --git a/src/engine/bloom.h b/src/engine/bloom.h index b623568b8..61f508e88 100644 --- a/src/engine/bloom.h +++ b/src/engine/bloom.h @@ -5,7 +5,7 @@ poof( @vert_source_file("external/bonsai_stdlib/shaders/Passthrough.vertexshader { shader Program; shader_uniform Uniforms[1]; - v2 SrcResolution; poof(@uniform) + v2 *SrcResolution; poof(@uniform) }; poof(shader_magic(bloom_downsample_shader)) @@ -18,9 +18,10 @@ poof( @vert_source_file("external/bonsai_stdlib/shaders/Passthrough.vertexshader shader Program; shader_uniform Uniforms[1]; - f32 FilterRadius; poof(@uniform) + f32 *FilterRadius; poof(@uniform) }; + poof(shader_magic(bloom_upsample_shader)) #include diff --git a/src/engine/engine.h b/src/engine/engine.h index 988f952e6..59529ba12 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -45,6 +45,7 @@ link_internal engine_resources *GetEngineResources(); #include #include #include +#include #include #include diff --git a/src/engine/graphics.h b/src/engine/graphics.h index 89ae41f0f..846dc1345 100644 --- a/src/engine/graphics.h +++ b/src/engine/graphics.h @@ -22,6 +22,8 @@ struct transparency_render_group /* m4 *ViewProjection; */ }; +struct shadow_render_group; + struct graphics { b32 Initialized; @@ -48,6 +50,12 @@ struct graphics world_chunk_ptr_paged_list MainDrawList; world_chunk_ptr_paged_list ShadowMapDrawList; + // NOTE(Jesse): This is a stencil region for cutting out the selection region + // such that we can reneder an appropriate temporary mesh in the case that + // our selected brush removes world geometry. + v3 MinClipP_worldspace; + v3 MaxClipP_worldspace; + // TODO(Jesse): None of these need to be pointers.. g_buffer_render_group *gBuffer; ao_render_group *AoGroup; diff --git a/src/engine/light.h b/src/engine/light.h index ce8bb0a33..d9b7dca89 100644 --- a/src/engine/light.h +++ b/src/engine/light.h @@ -17,18 +17,6 @@ struct game_lights light *Lights; }; -struct shadow_render_group -{ - u32 FramebufferName; - s32 MVP_ID; - - shader DepthShader; - - m4 MVP; - - texture ShadowMap; -}; - struct lighting_render_group diff --git a/src/engine/render.cpp b/src/engine/render.cpp index 3495e5b90..3334ac943 100644 --- a/src/engine/render.cpp +++ b/src/engine/render.cpp @@ -96,17 +96,18 @@ RenderImmediateGeometryToShadowMap(gpu_mapped_element_buffer *GpuMap, graphics * shadow_render_group *SG = Graphics->SG; GL.BindFramebuffer(GL_FRAMEBUFFER, SG->FramebufferName); - GL.UseProgram(SG->DepthShader.ID); - SetViewport(GetShadowMapResolution(&GetEngineResources()->Settings)); + // @duplicate_shadow_map_MVP_calculation v3 FrustCenter = GetFrustumCenter(Graphics->Camera); - SG->MVP = GetShadowMapMVP(Graphics->Settings.Lighting.SunP, FrustCenter); + SG->Shader.MVP = GetShadowMapMVP(Graphics->Settings.Lighting.SunP, FrustCenter); - GL.UniformMatrix4fv(SG->MVP_ID, 1, GL_FALSE, &SG->MVP.E[0].E[0]); + /* GL.UniformMatrix4fv(SG->MVP_ID, 1, GL_FALSE, &SG->MVP.E[0].E[0]); */ - BindUniformByName(&SG->DepthShader, "ModelMatrix", &IdentityMatrix); + UseShader(&SG->Shader); + + /* BindUniformByName(&SG->DepthShader, "ModelMatrix", &IdentityMatrix); */ Draw(GpuMap->Buffer.At); @@ -169,7 +170,7 @@ RenderLuminanceTexture(v2i ApplicationResolution, gpu_mapped_element_buffer *Gpu UpdateLightingTextures(&Graphics->Lighting.Lights); // TODO(Jesse): Explain this. - Graphics->SG->MVP = NdcToScreenSpace * Graphics->SG->MVP; + Graphics->SG->Shader.MVP = NdcToScreenSpace * Graphics->SG->Shader.MVP; /* GL.Enable(GL_BLEND); */ /* GL.BlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA); */ @@ -1058,7 +1059,7 @@ ReallocateAndSyncGpuBuffers(gpu_element_buffer_handles *Handles, untextured_3d_g link_internal m4 GetTransformMatrix(v3 Basis, v3 Scale, Quaternion Rotation) { - m4 Result = Translate(Basis) * ScaleTransform(Scale) * RotateTransform(Rotation) * IdentityMatrix; + m4 Result = Translate(Basis) * ScaleTransform(Scale) * RotateTransform(Rotation) * IdentityMatrix; // TODO(Jesse): wtf are we multiplying by IdentityMatrix for? return Result; } @@ -1168,6 +1169,7 @@ DrawLod(engine_resources *Engine, shader *Shader, lod_element_buffer *Meshes, r3 m4 NormalMatrix = Transpose(Inverse(LocalTransform)); AssertNoGlErrors; + // @janky_model_matrix_bs Ensure(TryBindUniform(Shader, "ModelMatrix", &LocalTransform)); AssertNoGlErrors; TryBindUniform(Shader, "NormalMatrix", &NormalMatrix); // NOTE(Jesse): Not all shaders that use this path draw normals (namely, DepthRTT) @@ -1323,13 +1325,13 @@ SetupGBufferShader(graphics *Graphics, v2i ApplicationResolution, b32 DoSelectio auto SelectionRegion = GetLevelEditor()->SelectionRegion; SelectionRegion.Min.Offset += V3(0.0001f); SelectionRegion.Max.Offset -= V3(0.0001f); - GBufferRenderGroup->MinClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Min); - GBufferRenderGroup->MaxClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Max); + Graphics->MinClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Min); + Graphics->MaxClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Max); } else { - GBufferRenderGroup->MinClipP_worldspace = {}; - GBufferRenderGroup->MaxClipP_worldspace = {}; + Graphics->MinClipP_worldspace = {}; + Graphics->MaxClipP_worldspace = {}; } GL.BindFramebuffer(GL_FRAMEBUFFER, GBufferRenderGroup->FBO.ID); @@ -1356,21 +1358,36 @@ TeardownGBufferShader(graphics *Graphics) link_internal void -SetupShadowMapShader(graphics *Graphics, v2i ShadowMapResolution) +SetupShadowMapShader(graphics *Graphics, v2i ShadowMapResolution, b32 DoSelectionMasking) { shadow_render_group *SG = Graphics->SG; + if (DoSelectionMasking) + { + auto SelectionRegion = GetLevelEditor()->SelectionRegion; + SelectionRegion.Min.Offset += V3(0.0001f); + SelectionRegion.Max.Offset -= V3(0.0001f); + Graphics->MinClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Min); + Graphics->MaxClipP_worldspace = GetRenderP(GetEngineResources(), SelectionRegion.Max); + } + else + { + Graphics->MinClipP_worldspace = {}; + Graphics->MaxClipP_worldspace = {}; + } + GL.BindFramebuffer(GL_FRAMEBUFFER, SG->FramebufferName); - GL.UseProgram(SG->DepthShader.ID); SetViewport(ShadowMapResolution); // TODO(Jesse): Duplicate MVP calculation // @duplicate_shadow_map_MVP_calculation v3 FrustCenter = GetFrustumCenter(Graphics->Camera); - SG->MVP = GetShadowMapMVP(Graphics->Settings.Lighting.SunP, FrustCenter); + SG->Shader.MVP = GetShadowMapMVP(Graphics->Settings.Lighting.SunP, FrustCenter); + + UseShader(&SG->Shader); - GL.UniformMatrix4fv(SG->MVP_ID, 1, GL_FALSE, &SG->MVP.E[0].E[0]); + /* GL.UniformMatrix4fv(SG->MVP_ID, 1, GL_FALSE, &SG->MVP.E[0].E[0]); */ GL.Disable(GL_CULL_FACE); @@ -1412,6 +1429,8 @@ DrawEntitiesToGBuffer( v2i ApplicationResolution, { TIMED_FUNCTION(); + NotImplemented; // NOTE: Unused + b32 OldMajorGrid = Graphics->Settings.DrawMajorGrid; b32 OldMinorGrid = Graphics->Settings.DrawMinorGrid; @@ -1575,7 +1594,7 @@ DrawWorldAndEntitiesToShadowMap(v2i ShadowMapResolution, engine_resources *Engin shadow_render_group *SG = Graphics->SG; - SetupShadowMapShader(Graphics, ShadowMapResolution); + SetupShadowMapShader(Graphics, ShadowMapResolution, Editor->LayeredBrushEditor.SeedBrushWithSelection); // NOTE(Jesse): So there's a visual distinction between preview and instantiated /* DrawEditorPreview(Engine, &SG->DepthShader); */ diff --git a/src/engine/render.h b/src/engine/render.h index 1ae33a91e..971ddd7a3 100644 --- a/src/engine/render.h +++ b/src/engine/render.h @@ -40,8 +40,8 @@ struct g_buffer_render_group g_buffer_textures Textures; shader gBufferShader; - v3 MinClipP_worldspace; - v3 MaxClipP_worldspace; + /* v3 MinClipP_worldspace; */ + /* v3 MaxClipP_worldspace; */ m4 InverseViewMatrix; m4 InverseProjectionMatrix; diff --git a/src/engine/render/render_init.cpp b/src/engine/render/render_init.cpp index 546fa0620..8036082c6 100644 --- a/src/engine/render/render_init.cpp +++ b/src/engine/render/render_init.cpp @@ -354,6 +354,7 @@ CreateGbufferShader(graphics *Graphics, memory_arena *GraphicsMemory, v3 *MinCli *Current = GetUniform(GraphicsMemory, &Shader, ViewProjection, "ViewProjection"); Current = &(*Current)->Next; + // @janky_model_matrix_bs *Current = GetUniform(GraphicsMemory, &Shader, &IdentityMatrix, "ModelMatrix"); Current = &(*Current)->Next; @@ -474,37 +475,6 @@ InitGbufferRenderGroup(v2i ApplicationResolution, g_buffer_render_group *gBuffer return Result; } -link_internal b32 -InitializeShadowRenderGroup(shadow_render_group *SG, v2i ShadowMapResolution) -{ - // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer. - GL.GenFramebuffers(1, &SG->FramebufferName); - Assert(SG->FramebufferName); - - GL.BindFramebuffer(GL_FRAMEBUFFER, SG->FramebufferName); - - SG->ShadowMap = MakeDepthTexture(ShadowMapResolution, CSz("ShadowDepth")); - FramebufferDepthTexture(&SG->ShadowMap); - - // TODO(Jesse, id: 119, tags: opengl, es2): Not present on ES2 .. should we use them? - // No color output in the bound framebuffer, only depth. - /* glDrawBuffer(GL_NONE); */ - /* glReadBuffer(GL_NONE); */ - - SG->DepthShader = LoadShaders( CSz(BONSAI_SHADER_PATH "DepthRTT.vertexshader"), CSz(BONSAI_SHADER_PATH "DepthRTT.fragmentshader") ); - SG->MVP_ID = GetShaderUniform(&SG->DepthShader, "depthMVP"); - - AssertNoGlErrors; - - if(GL.CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - return false; - - GL.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - GL.BindFramebuffer(GL_FRAMEBUFFER, 0); - - return true; -} - link_internal void InitRenderToTextureGroup(render_entity_to_texture_group *Group, texture *ColorPalette, memory_arena *Memory) { @@ -533,6 +503,7 @@ MakeTransparencyShader(v2 *ApplicationResolution, b32 *BravoilMyersOIT, b32 *Bra *Current = GetUniform(Memory, &Shader, ViewProjection, "ViewProjection"); Current = &(*Current)->Next; + // @janky_model_matrix_bs *Current = GetUniform(Memory, &Shader, &IdentityMatrix, "ModelMatrix"); Current = &(*Current)->Next; @@ -659,7 +630,7 @@ GraphicsInit(graphics *Result, engine_settings *EngineSettings, memory_arena *Gr } shadow_render_group *SG = Allocate(shadow_render_group, GraphicsMemory, 1); - if (!InitializeShadowRenderGroup(SG, Result->Settings.iShadowMapResolution)) + if (!InitializeShadowRenderGroup(Result, SG, Result->Settings.iShadowMapResolution)) { SoftError("Initializing Shadow Buffer");// return False; } @@ -704,7 +675,7 @@ GraphicsInit(graphics *Result, engine_settings *EngineSettings, memory_arena *Gr &gBuffer->InverseViewMatrix, &gBuffer->InverseProjectionMatrix, - &SG->MVP, + &SG->Shader.MVP, &Lighting->Lights, Result->Camera, @@ -753,7 +724,7 @@ GraphicsInit(graphics *Result, engine_settings *EngineSettings, memory_arena *Gr } gBuffer->gBufferShader = - CreateGbufferShader(Result, GraphicsMemory, &gBuffer->MinClipP_worldspace, &gBuffer->MaxClipP_worldspace, &gBuffer->ViewProjection, Result->Camera, &Result->ColorPaletteTexture); + CreateGbufferShader(Result, GraphicsMemory, &Result->MinClipP_worldspace, &Result->MaxClipP_worldspace, &gBuffer->ViewProjection, Result->Camera, &Result->ColorPaletteTexture); AoGroup->Shader = MakeSsaoShader( GraphicsMemory, &gBuffer->Textures, @@ -776,7 +747,7 @@ GraphicsInit(graphics *Result, engine_settings *EngineSettings, memory_arena *Gr &Result->Lighting.Bloom.Tex, &Result->Transparency.AccumTex, &Result->Transparency.RevealTex, - &SG->MVP, + &SG->Shader.MVP, Result->Camera, &Result->Exposure, &Result->Settings.UseLightingBloom, diff --git a/src/engine/render/shadow_map.h b/src/engine/render/shadow_map.h new file mode 100644 index 000000000..1e24f7da7 --- /dev/null +++ b/src/engine/render/shadow_map.h @@ -0,0 +1,63 @@ +struct shadow_map_shader +poof( @vert_source_file("shaders/DepthRTT.vertexshader") + @frag_source_file("shaders/DepthRTT.fragmentshader") ) +{ + shader Program; + shader_uniform Uniforms[4]; + + // TODO(Jesse)(rename): Should be ViewProjection + m4 MVP; poof(@uniform) + + // NOTE(Jesse): This never gets read from; it's strictly a placeholder/hack + // to tell shader_magic there's a uniform called ModelMatrix, which gets set + // at the time the model gets drawn. + // + // @janky_model_matrix_bs + m4 ModelMatrix; poof(@uniform) + + v3 *MinClipP_worldspace; poof(@uniform) + v3 *MaxClipP_worldspace; poof(@uniform) +}; +poof(shader_magic(shadow_map_shader)) +#include + +struct shadow_render_group +{ + u32 FramebufferName; + + texture ShadowMap; + shadow_map_shader Shader; +}; + +link_internal b32 +InitializeShadowRenderGroup(graphics *Graphics, shadow_render_group *SG, v2i ShadowMapResolution) +{ + // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer. + GL.GenFramebuffers(1, &SG->FramebufferName); + Assert(SG->FramebufferName); + GL.BindFramebuffer(GL_FRAMEBUFFER, SG->FramebufferName); + + + SG->ShadowMap = MakeDepthTexture(ShadowMapResolution, CSz("ShadowDepth")); + FramebufferDepthTexture(&SG->ShadowMap); + + // TODO(Jesse, id: 119, tags: opengl, es2): Not present on ES2 .. should we use them? + // No color output in the bound framebuffer, only depth. + /* glDrawBuffer(GL_NONE); */ + /* glReadBuffer(GL_NONE); */ + + /* SG->DepthShader = LoadShaders( CSz(BONSAI_SHADER_PATH "DepthRTT.vertexshader"), CSz(BONSAI_SHADER_PATH "DepthRTT.fragmentshader") ); */ + /* SG->MVP_ID = GetShaderUniform(&SG->DepthShader, "depthMVP"); */ + + AssertNoGlErrors; + + if(GL.CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) + return false; + + GL.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + GL.BindFramebuffer(GL_FRAMEBUFFER, 0); + + InitializeShadowMapShader( &SG->Shader , IdentityMatrix, IdentityMatrix, &Graphics->MinClipP_worldspace, &Graphics->MaxClipP_worldspace ); + + return true; +} diff --git a/src/engine/resources.cpp b/src/engine/resources.cpp index f60c29eec..2eae74dd3 100644 --- a/src/engine/resources.cpp +++ b/src/engine/resources.cpp @@ -138,12 +138,12 @@ RenderLoop(thread_startup_params *ThreadParams, engine_resources *Engine) case BonsaiRenderCommand_ShaderId_gBuffer: { - SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings), True); + SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings), Editor->LayeredBrushEditor.SeedBrushWithSelection); } break; case BonsaiRenderCommand_ShaderId_ShadowMap: { - SetupShadowMapShader(Graphics, GetShadowMapResolution(&Engine->Settings)); + SetupShadowMapShader(Graphics, GetShadowMapResolution(&Engine->Settings), Editor->LayeredBrushEditor.SeedBrushWithSelection); } break; } } break; From 581f5a64b6ee3a4954ba74c66465f231ce0047ec Mon Sep 17 00:00:00 2001 From: a pirate Date: Sat, 7 Sep 2024 15:37:43 -0700 Subject: [PATCH 8/9] Fix a minor shadow-mapping bug when "SeedBrushWithSelection" was on --- src/engine/resources.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/engine/resources.cpp b/src/engine/resources.cpp index 2eae74dd3..6ac047d3a 100644 --- a/src/engine/resources.cpp +++ b/src/engine/resources.cpp @@ -220,20 +220,14 @@ RenderLoop(thread_startup_params *ThreadParams, engine_resources *Engine) v3i Max = World->Center + Radius; SetupGBufferShader(Graphics, GetApplicationResolution(&Engine->Settings), False); - - /* RenderDrawList(Engine, &Graphics->MainDrawList); */ - shader *Shader = &Graphics->gBuffer->gBufferShader; DrawEditorPreview(Engine, Shader); - - /* { // NOTE(Jesse): Don't draw the grid on entities; it looks fucky if they're rotated. */ - /* BindUniformByName(Shader, "DrawMajorGrid", False); */ - /* BindUniformByName(Shader, "DrawMinorGrid", False); */ - /* r32 dt = Plat->dt; */ - /* DrawEntities(Shader, EntityTable, &GpuMap->Buffer, 0, Graphics, World, dt); */ - /* } */ - TeardownGBufferShader(Graphics); + + SetupShadowMapShader(Graphics, GetShadowMapResolution(&Engine->Settings), False); + Shader = &Graphics->SG->Shader.Program; + DrawEditorPreview(Engine, Shader); + TeardownShadowMapShader(Graphics); } /* DrawWorldAndEntitiesToShadowMap(GetShadowMapResolution(&Engine->Settings), Engine); */ From 7c9cbf5c8c25645113b2aaa70383d0c6fa77d7e3 Mon Sep 17 00:00:00 2001 From: a pirate Date: Sat, 7 Sep 2024 15:38:50 -0700 Subject: [PATCH 9/9] Update stdlib --- external/bonsai_stdlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/bonsai_stdlib b/external/bonsai_stdlib index 81a7f044f..944d5547c 160000 --- a/external/bonsai_stdlib +++ b/external/bonsai_stdlib @@ -1 +1 @@ -Subproject commit 81a7f044ff16bd9212cf2e5b03b25d19c3d6a6de +Subproject commit 944d5547cd52d9e791724d09d9abaa90cad025fe