-
Notifications
You must be signed in to change notification settings - Fork 0
Update from task de872a38-c33d-412a-94b3-c7df7ffebd4e #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tronpis
wants to merge
3
commits into
world-optimization-techniques-4a1ea
Choose a base branch
from
chunkkeyubfixsimulationmoduleperformance-ebd4e
base: world-optimization-techniques-4a1ea
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,69 +1,51 @@ | ||
| ``` | ||
| # Compiled and build artifacts | ||
| # Build artifacts | ||
| *.o | ||
| *.obj | ||
| *.exe | ||
| *.a | ||
| *.lib | ||
| *.dll | ||
| *.so | ||
| *.a | ||
| *.dylib | ||
| *.exe | ||
| *.out | ||
|
|
||
| # Dependencies | ||
| venv/ | ||
| .venv/ | ||
| __pycache__/ | ||
| .mypy_cache/ | ||
| .pytest_cache/ | ||
| node_modules/ | ||
| dist/ | ||
| # CMake build directories | ||
| build/ | ||
| target/ | ||
| .gradle/ | ||
| cmake-build-*/ | ||
| CMakeFiles/ | ||
| CMakeCache.txt | ||
| Makefile | ||
| compile_commands.json | ||
|
|
||
| # Dependencies | ||
| vendor/ | ||
| external/ | ||
|
|
||
| # Logs and temp files | ||
| # Logs | ||
| *.log | ||
|
|
||
| # Temporary files | ||
| *.tmp | ||
| *.swp | ||
| *.temp | ||
|
|
||
| # Environment | ||
| .env | ||
| .env.local | ||
| *.env.* | ||
| .env.* | ||
|
|
||
| # Editors | ||
| .vscode/ | ||
| .idea/ | ||
|
|
||
| # System files | ||
| .DS_Store | ||
| Thumbs.db | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Coverage | ||
| coverage/ | ||
| htmlcov/ | ||
| .coverage | ||
|
|
||
| # Compressed files | ||
| *.zip | ||
| *.gz | ||
| *.tar | ||
| *.tgz | ||
| *.bz2 | ||
| *.xz | ||
| *.7z | ||
| *.rar | ||
| *.zst | ||
| *.lz4 | ||
| *.lzh | ||
| *.cab | ||
| *.arj | ||
| *.rpm | ||
| *.deb | ||
| *.Z | ||
| *.lz | ||
| *.lzo | ||
| *.tar.gz | ||
| *.tar.bz2 | ||
| *.tar.xz | ||
| *.tar.zst | ||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,11 @@ endif() | |
| add_library(FarmEngineRenderer STATIC | ||
| renderer/Renderer.cpp | ||
| renderer/Renderer.h | ||
| # Render Graph System | ||
| rendering/graph/RenderGraph.h | ||
| rendering/graph/RenderGraph.cpp | ||
| rendering/graph/RenderPipeline.h | ||
| rendering/graph/RenderPipeline.cpp | ||
| ) | ||
|
Comment on lines
96
to
104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Wrong cmake paths FarmEngineRenderer lists new RenderGraph sources under rendering/graph/... but the added files are under src/rendering/graph/..., so the build will fail when CMake can’t find the sources. Agent Prompt
|
||
|
|
||
| target_include_directories(FarmEngineRenderer PUBLIC | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| #pragma once | ||
|
|
||
| /** | ||
| * @file ExampleUsage.h | ||
| * @brief Ejemplos de uso del Render Graph para diferentes casos del FarmEngine | ||
| */ | ||
|
|
||
| #include "RenderGraph.h" | ||
| #include "RenderPipeline.h" | ||
|
|
||
| namespace FarmEngine::Render::Examples { | ||
|
|
||
| /** | ||
| * @brief Ejemplo: Pipeline completo para rendering de chunks de terreno | ||
| * | ||
| * Este es el caso de uso principal para FarmEngine - renderizar chunks | ||
| * voxel con iluminación dinámica y oclusión ambiental. | ||
| */ | ||
| inline void ChunkRenderingExample(RenderGraph& graph, VkExtent2D swapchainExtent) { | ||
| RenderGraphBuilder builder; | ||
|
|
||
| // 1. Recursos principales | ||
| builder.addColorTarget("SceneColor", VK_FORMAT_R16G16B16A16_SFLOAT, swapchainExtent, ResourceLifetime::Frame); | ||
| builder.addDepthTarget("SceneDepth", VK_FORMAT_D32_SFLOAT, swapchainExtent, ResourceLifetime::Frame); | ||
|
|
||
| // 2. Geometry Pass - Renderiza todos los chunks visibles | ||
| builder.addPass("ChunkGeometry", [](RenderPass& pass) { | ||
| pass.colorAttachments.push_back("SceneColor"); | ||
| pass.depthAttachment = "SceneDepth"; | ||
| pass.clearColor = true; | ||
| pass.clearDepth = true; | ||
| pass.clearColorValue = {{0.4f, 0.6f, 0.9f, 1.0f}}; // Sky blue | ||
|
|
||
| // Callback que se ejecutará durante el render pass | ||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Aquí se integrarían con ChunkManager::getVisibleChunks() | ||
| // for (auto* chunk : visibleChunks) { | ||
| // chunk->renderOpaque(cmd); | ||
| // } | ||
| }; | ||
| }); | ||
|
|
||
| // 3. Transparency Pass - Plantas, agua, partículas | ||
| builder.addPass("Transparency", [](RenderPass& pass) { | ||
| pass.colorAttachments.push_back("SceneColor"); | ||
| pass.depthAttachment = "SceneDepth"; | ||
| pass.colorLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD; // Preserve previous pass | ||
| pass.depthLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD; | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Render transparent crops, water, animals | ||
| }; | ||
| }); | ||
|
|
||
| // 4. Post-Processing - Tonemapping a swapchain | ||
| builder.addPass("Tonemapping", [](RenderPass& pass) { | ||
| pass.inputAttachments = {"SceneColor"}; | ||
| pass.colorAttachments.push_back("Swapchain"); // External | ||
| pass.clearColor = false; | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // ACES tonemapping + gamma correction | ||
| }; | ||
| }); | ||
|
|
||
| graph.compile(std::move(builder)); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Ejemplo: Shadow mapping para iluminación dinámica | ||
| * | ||
| * Muestra cómo añadir un pass de shadow map antes del geometry pass | ||
| */ | ||
| inline void ShadowMappingExample(RenderGraph& graph, VkExtent2D extent) { | ||
| RenderGraphBuilder builder; | ||
|
|
||
| // Shadow map resource (alta resolución para calidad) | ||
| builder.addDepthTarget("ShadowMap", VK_FORMAT_D32_SFLOAT, {2048, 2048}, ResourceLifetime::Frame); | ||
|
|
||
| // Shadow pass - renderiza desde perspectiva de la luz | ||
| builder.addPass("ShadowPass", [](RenderPass& pass) { | ||
| pass.depthAttachment = "ShadowMap"; | ||
| pass.clearDepth = true; | ||
| pass.clearDepthValue = {1.0f, 0}; | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Bind shadow pipeline | ||
| // Set light view/projection matrices | ||
| // Render depth-only pass de chunks | ||
| }; | ||
| }); | ||
|
|
||
| // Main geometry pass que usa el shadow map | ||
| builder.addPass("MainGeometry", [](RenderPass& pass) { | ||
| pass.colorAttachments.push_back("SceneColor"); | ||
| pass.depthAttachment = "SceneDepth"; | ||
| pass.inputAttachments.push_back("ShadowMap"); // Para sampling en shader | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Fragment shader samplea ShadowMap para calcular oclusión | ||
| }; | ||
| }); | ||
|
|
||
| // Dependencia explícita: ShadowPass -> MainGeometry | ||
| builder.addDependency( | ||
| 0, 1, // From pass 0 to pass 1 | ||
| VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, | ||
| VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, | ||
| VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, | ||
| VK_ACCESS_SHADER_READ_BIT | ||
| ); | ||
|
|
||
| graph.compile(std::move(builder)); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Ejemplo: SSAO (Screen Space Ambient Occlusion) | ||
| * | ||
| * Técnica post-process para oclusión ambiental en tiempo real | ||
| */ | ||
| inline void SSAOExample(RenderGraph& graph, VkExtent2D extent) { | ||
| RenderGraphBuilder builder; | ||
|
|
||
| // GBuffer básico | ||
| builder.addColorTarget("GBuffer_Albedo", VK_FORMAT_R8G8B8A8_UNORM, extent, ResourceLifetime::Frame); | ||
| builder.addColorTarget("GBuffer_Normals", VK_FORMAT_A2B10G10R10_UNORM_PACK32, extent, ResourceLifetime::Frame); | ||
| builder.addDepthTarget("SceneDepth", VK_FORMAT_D32_SFLOAT, extent, ResourceLifetime::Frame); | ||
|
|
||
| // SSAO buffer (half-res para performance) | ||
| builder.addColorTarget("SSAO_Buffer", VK_FORMAT_R8_UNORM, {extent.width / 2, extent.height / 2}, ResourceLifetime::Frame); | ||
|
|
||
| // 1. Geometry | ||
| builder.addPass("Geometry", [](RenderPass& pass) { | ||
| pass.colorAttachments = {"GBuffer_Albedo", "GBuffer_Normals"}; | ||
| pass.depthAttachment = "SceneDepth"; | ||
| // ... configurar callbacks | ||
| }); | ||
|
|
||
| // 2. SSAO Pass | ||
| builder.addPass("SSAO", [](RenderPass& pass) { | ||
| pass.inputAttachments = {"GBuffer_Normals", "SceneDepth"}; | ||
| pass.colorAttachments.push_back("SSAO_Buffer"); | ||
| pass.clearColor = true; | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Full-screen quad con SSAO calculation | ||
| // Samplea normals + depth para calcular oclusión | ||
| }; | ||
| }); | ||
|
|
||
| // 3. Lighting con SSAO aplicado | ||
| builder.addPass("Lighting", [](RenderPass& pass) { | ||
| pass.inputAttachments = {"GBuffer_Albedo", "GBuffer_Normals", "SSAO_Buffer"}; | ||
| pass.colorAttachments.push_back("FinalColor"); | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Lighting calculation con SSAO factor | ||
| }; | ||
| }); | ||
|
|
||
| graph.compile(std::move(builder)); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Ejemplo: Minimizado para testing | ||
| * | ||
| * Pipeline más simple posible para validar integración | ||
| */ | ||
| inline void MinimalExample(RenderGraph& graph, VkExtent2D extent) { | ||
| RenderGraphBuilder builder; | ||
|
|
||
| builder.addColorTarget("Backbuffer", VK_FORMAT_B8G8R8A8_SRGB, extent, ResourceLifetime::External); | ||
| builder.addDepthTarget("Depth", VK_FORMAT_D32_SFLOAT, extent, ResourceLifetime::Frame); | ||
|
|
||
| builder.addPass("ClearAndDraw", [](RenderPass& pass) { | ||
| pass.colorAttachments.push_back("Backbuffer"); | ||
| pass.depthAttachment = "Depth"; | ||
| pass.clearColor = true; | ||
| pass.clearDepth = true; | ||
|
|
||
| pass.executeCallback = [](VkCommandBuffer cmd, const ResourceRegistry& registry) { | ||
| // Draw single triangle or quad | ||
| }; | ||
| }); | ||
|
|
||
| graph.compile(std::move(builder)); | ||
| } | ||
|
|
||
| } // namespace FarmEngine::Render::Examples |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.gitignorefile contains markdown code block delimiters (```) at the beginning and end of the file. These should be removed as they are not valid gitignore syntax and were likely included by mistake during code generation.