Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d4e3aaa
wip: glow material addition
Pravasith Dec 14, 2025
dfb55f8
refactor: renames and utils
Pravasith Dec 15, 2025
ab80302
refactor: minor perf - changed submesh material maps to arrays
Pravasith Dec 17, 2025
aa6ab7f
wip: dynamic rendering + shadows repass - 1
Pravasith Dec 22, 2025
c5fd5dd
wip: resource abstraction
Pravasith Dec 23, 2025
afe5d8d
wip: dynamic rendering - day 3
Pravasith Dec 24, 2025
b8561b1
wip: dynamic rendering day 5
Pravasith Dec 25, 2025
fee9cac
wip: dynamic rendering - day 6
Pravasith Dec 26, 2025
4ec35ac
wip: dynamic rendering -- day 7
Pravasith Dec 27, 2025
138c063
wip: dynamic rendering - day 7
Pravasith Dec 30, 2025
52d5ed6
wip: dynamic rendering and render map for future - day 8
Pravasith Jan 2, 2026
9eb581f
wip: rehaul + dynamic renderflows design
Pravasith Jan 2, 2026
d88004c
wip: dynamic rendering + new Paint pass system
Pravasith Jan 4, 2026
e146b16
wip: paint passes - day 12
Pravasith Jan 5, 2026
d9d9ec3
wip: paint passes day - 12 b
Pravasith Jan 5, 2026
86181f0
wip: paint passes - 1
Pravasith Jan 7, 2026
3ad3995
wip: paint passes - design comments
Pravasith Jan 9, 2026
95868bd
wip: uniform buffer data revamp - paint passes
Pravasith Jan 9, 2026
aa3b028
feat: paint pass, render graph impl
Pravasith Jan 10, 2026
2642f71
feat: paint passes + uniform buffers
Pravasith Jan 11, 2026
4d30e2d
wip: uniforms + paint passes - day 2
Pravasith Jan 11, 2026
ed7ebb7
wip: uniform data runtime class
Pravasith Jan 12, 2026
1adaa93
wip: uniform sets added
Pravasith Jan 12, 2026
614a41c
wip: paintpasses - continue
Pravasith Jan 13, 2026
eca35c9
wip: dynamic render flows
Pravasith Jan 16, 2026
7f0d62e
wip: paint passes and stuff
Pravasith Jan 17, 2026
2702f9d
wip: new paintpass architecture - 1/7
Pravasith Jan 20, 2026
99e82f6
wip: renderflow - paintpass conversion
Pravasith Jan 21, 2026
086d5f0
wip: renderflows to paintpasses - 2
Pravasith Jan 21, 2026
49be7ce
feat: paint pass forward movement :D
Pravasith Jan 24, 2026
6590511
wip: paintpasses - slow progress
Pravasith Jan 24, 2026
3f0b9aa
wip: paint passes - complete rehaul
Pravasith Jan 26, 2026
7aedf30
wip: paintpasses - memory management - 1
Pravasith Jan 27, 2026
0f0a892
wip: paintpasses - memory stuff - 2
Pravasith Jan 27, 2026
982ae78
wip: paintpasses - implementation
Pravasith Jan 28, 2026
15c3281
feat: paintpass implementation -- day 1
Pravasith Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/Popcorn/Graphics>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/Popcorn/Graphics/Materials>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/Popcorn/Graphics/PaintPasses>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/Popcorn/Graphics/Animation>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/Popcorn/Scene>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/Popcorn/Platform/OpenGL>
Expand All @@ -141,6 +142,7 @@ target_include_directories(
INTERFACE $<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/Popcorn/Graphics>
$<INSTALL_INTERFACE:include/Popcorn/Graphics/Materials>
$<INSTALL_INTERFACE:include/Popcorn/Graphics/PaintPasses>
$<INSTALL_INTERFACE:include/Popcorn/Graphics/Animation>
$<INSTALL_INTERFACE:include/Popcorn/Scene>
$<INSTALL_INTERFACE:include/Popcorn/Platform/OpenGL>
Expand Down
72 changes: 54 additions & 18 deletions Engine/include/Popcorn.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Scene.h"
#include "SplineFactory.h"
#include <iostream>
#include <vector>

ENGINE_NAMESPACE_BEGIN
CTX_NAMESPACE_BEGIN
Expand Down Expand Up @@ -42,19 +43,70 @@ static void UnregisterScene(Scene &scene) { s_renderer->RemoveScene(&scene); };

static void StartGame() {
// TODO: Move the ownership of commandbuffers to Renderflow base class
s_renderer->CreateRenderFlows();
//
// NEW: --- Make your own renderflows ---
//
// const std::vector<PaintPass> paintPasses{};
// s_renderer->ProcessPaintPasses(paintPasses);

s_renderer->CreateRenderFlows(); // 1. Each renderflow takes in
// a. Attachments (and Info)
// b. RenderInfo
// c. PipelineInfo
//
s_renderer->PrepareRenderFlows(); // Creates attachments, renderflows,
// framebuffers, and command buffers
//
s_renderer->AssignSceneObjectsToRenderFlows(); // Sorts submeshes material
// wise & adds to renderflows
// 1. Calculates offsets +
// alignment and stuff
s_renderer->CreateRenderFlowResources(); // Renderflow submeshes converted and
// copied to vulkan memory objects
// 1. Alloc Memory
// 2. Create Samplers
// 3. Alloc Shaders
// 4. Alloc DSets Global
// 5. Update DSets Global
// 6. Loops renderflows -
// a. Alloc DSets Local
// b. Update DSets Local
// c. Create Pipelines
// 7. Free Shaders
#ifdef PC_DEBUG
// s_renderer->PrintScenes();
// s_renderer->DebugPreGameLoop();
#endif

s_application->StartGameLoop(); // Starts game loop
s_application
->StartGameLoop(); // Starts game loop
// 1. Update Layers - Update transforms etc. for render
// 2. Render Layers -
// a. Copy Dynamic UBOs to memory
// b. Begin command buffer
// c. Begin Renderpass/rendering
// d. Set viewport & scissor
// e. Bind VBO
// f. Bind IBO
// g. Bind basicMat pipeline
// h. Bind D-Sets (global - camera stuff)
// i. Loop over material (basicMat) buckets -
// i1. Bind D-Sets (local - basic mat)
// i2. Loop over submeshes -
// i1a. Bind D-Sets (local - submesh)
// i2a. DRAW indexed
// j. Bind pbrMat pipeline
// k. Bind D-Sets (global - camera stuff)
// l. Loop over material (pbrMat) buckets -
// l1. Bind D-Sets (local - pbr mat)
// l2. Loop over submeshes -
// l1a. Bind D-Sets (local - submesh)
// l2a. DRAW indexed
// m. End Renderpass/rendering
// n. Barrier transition stuff
// o. End command buffer
//
//
};

static SplineFactory *GetSplineFactory() { return ContextGfx::AppSplines(); }
Expand Down Expand Up @@ -86,18 +138,6 @@ static void EndContext() {
// return *s_application;
// };

static void FillNamedLookUpMap(Scene &scene, GameObject *node) {
if (node == nullptr) {
PC_WARN("node is nullptr")
return;
}
scene.AddGameObjectToNamedLookUp(node->GetName(), node);

for (GameObject *child : node->GetChildren()) {
FillNamedLookUpMap(scene, child);
}
}

static void ConvertGltfToScene(const std::string &filename, Scene &scene) {
tinygltf::Model model;
GltfLoader::LoadFromFile(filename, model);
Expand All @@ -110,10 +150,6 @@ static void ConvertGltfToScene(const std::string &filename, Scene &scene) {
scene.SetAnimationTracks(animationTracks);

PC_WARN("ANIMATION TRACK SIZE AFTER: " << animationTracks.size())

for (GameObject *gameObj : scene.GetGameObjects()) {
FillNamedLookUpMap(scene, gameObj);
}
};

CTX_NAMESPACE_END
Expand Down
14 changes: 7 additions & 7 deletions Engine/include/Popcorn/Core/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct HasPrint<

class Buffer {
public:
Buffer() {
// PC_PRINT("CREATED(DEFAULT)", TagType::Constr, "BUFFER")
Buffer() {
// PC_PRINT("CREATED(DEFAULT)", TagType::Constr, "BUFFER")
};
~Buffer() {
FreeBytes();
Expand Down Expand Up @@ -64,13 +64,13 @@ class Buffer {
m_size = size;
};

[[nodiscard]] inline byte_t *GetData() const {
return static_cast<byte_t *>(m_data);
[[nodiscard]] inline PC_Byte_t *GetData() const {
return static_cast<PC_Byte_t *>(m_data);
};

void WriteBytes(const void *data, uint64_t size, uint64_t offset = 0) {
PC_ASSERT(offset + size <= m_size, "WriteBytes out of bounds!");
memcpy(static_cast<byte_t *>(m_data) + offset, data, size);
memcpy(static_cast<PC_Byte_t *>(m_data) + offset, data, size);
}

//
Expand Down Expand Up @@ -183,13 +183,13 @@ class Buffer {
void AllocBytes(uint64_t size) {
FreeBytes();

m_data = new byte_t[size];
m_data = new PC_Byte_t[size];
m_size = size;
};

void FreeBytes() {
if (m_data)
delete[] static_cast<byte_t *>(m_data);
delete[] static_cast<PC_Byte_t *>(m_data);
m_data = nullptr;
m_size = 0;
};
Expand Down
46 changes: 36 additions & 10 deletions Engine/include/Popcorn/Core/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cstring>

#ifdef PC_DEBUG
#include <iostream>
Expand All @@ -12,37 +13,62 @@
#endif

ENGINE_NAMESPACE_BEGIN
constexpr std::size_t shift_l(std::size_t n) { return 1 << n; }

// --- TYPES & VALUES ------------------------------------------------------
// --- TYPES & VALUES ------------------------------------------------------
// --- TYPES & VALUES ------------------------------------------------------
using PC_Byte_t = uint8_t;

extern int PC_PRINT_LEVEL;

enum TagType { Constr, Destr, Print };

using byte_t = uint8_t;
// --- BITWISE HELPERS -----------------------------------------------------
// --- BITWISE HELPERS -----------------------------------------------------
// --- BITWISE HELPERS -----------------------------------------------------
constexpr std::size_t PC_ShiftLeft(std::size_t n) { return 1 << n; }

// --- STRING HELPERS ------------------------------------------------------
// --- STRING HELPERS ------------------------------------------------------
// --- STRING HELPERS ------------------------------------------------------
[[nodiscard]] static bool PC_StrEndsWith(const char *s, const char *suffix) {
if (!s || !suffix)
return false;

extern int PC_print_lvl;
size_t sLen = strlen(s);
size_t suffixLen = strlen(suffix);

if (sLen < suffixLen)
return false;

return strcmp(s + sLen - suffixLen, suffix) == 0;
}

// --- LOGGING HELPERS -----------------------------------------------------
// --- LOGGING HELPERS -----------------------------------------------------
// --- LOGGING HELPERS -----------------------------------------------------
static void PC_Print(const std::string &msg, const TagType tag,
const std::string &className) {

if (PC_print_lvl < 0) {
if (PC_PRINT_LEVEL < 0) {
std::cout << "MISSING CONSTRUCTOR MESSAGE" << '\n';
return;
};

if (tag == TagType::Constr) {
PC_print_lvl++;
PC_PRINT_LEVEL++;
} else if (tag == TagType::Destr)
PC_print_lvl--;
PC_PRINT_LEVEL--;

std::stringstream ss;
auto lvl = PC_print_lvl < 10 ? " " + std::to_string(PC_print_lvl)
: std::to_string(PC_print_lvl);
auto lvl = PC_PRINT_LEVEL < 10 ? " " + std::to_string(PC_PRINT_LEVEL)
: std::to_string(PC_PRINT_LEVEL);
if (tag == TagType::Print) {
lvl = " ";
};

ss << lvl << " ";

for (int i = 0; i < std::min(PC_print_lvl, 10); ++i) {
for (int i = 0; i < std::min(PC_PRINT_LEVEL, 10); ++i) {
ss << "| ";
}

Expand Down
3 changes: 3 additions & 0 deletions Engine/include/Popcorn/Core/Layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class Layer {
public:
virtual ~Layer() = default;

Layer(const Layer &) = delete;
Layer &operator=(const Layer &) = delete;

virtual void OnAttach();
virtual void OnDetach();

Expand Down
10 changes: 5 additions & 5 deletions Engine/include/Popcorn/Core/LayerStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,27 @@ class LayerStack {
// cb(it);
// }

for (auto it = m_layer_stack.rbegin(); it != m_layer_stack.rend(); ++it) {
for (auto it = m_layerStack.rbegin(); it != m_layerStack.rend(); ++it) {
cb(it);
}
};

// TODO: Refactor when dealing with time
void UpdateLayers(TimeEvent &e) {
for (Layer *l : m_layer_stack) {
for (Layer *l : m_layerStack) {
l->OnUpdate(e);
}
};

void RenderLayers() {
for (Layer *l : m_layer_stack) {
for (Layer *l : m_layerStack) {
l->OnRender();
}
};

private:
std::vector<Layer *> m_layer_stack;
uint32_t m_separator_index = 0;
std::vector<Layer *> m_layerStack;
uint32_t m_separatorIndex = 0;
};

ENGINE_NAMESPACE_END
12 changes: 6 additions & 6 deletions Engine/include/Popcorn/Events/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ enum class EventType {

enum class EventCategory {
None = 0,
ApplicationEvent = shift_l(1),
WindowEvent = shift_l(2),
KeyboardEvent = shift_l(3),
MouseEvent = shift_l(4),
TimeEvent = shift_l(5),
VulkanEvent = shift_l(6)
ApplicationEvent = PC_ShiftLeft(1),
WindowEvent = PC_ShiftLeft(2),
KeyboardEvent = PC_ShiftLeft(3),
MouseEvent = PC_ShiftLeft(4),
TimeEvent = PC_ShiftLeft(5),
VulkanEvent = PC_ShiftLeft(6)
};

// HASH DEFINE START ----------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Engine/include/Popcorn/Graphics/BufferObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class VertexBuffer {
return m_layout;
}

[[nodiscard]] inline byte_t *GetBufferData() const {
[[nodiscard]] inline PC_Byte_t *GetBufferData() const {
return m_buffer.GetData();
}

Expand Down Expand Up @@ -230,7 +230,7 @@ template <Is_Uint16_Or_Uint32_t T> class IndexBuffer {
m_buffer.WriteBytes(data, size, offset);
}

[[nodiscard]] inline byte_t *GetBufferData() const {
[[nodiscard]] inline PC_Byte_t *GetBufferData() const {
return m_buffer.GetData();
}

Expand Down
8 changes: 2 additions & 6 deletions Engine/include/Popcorn/Graphics/Materials/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ class Mesh;

template <MaterialTypes T> class Material {
public:
Material() {
// PC_PRINT("CREATED", TagType::Constr, "Material.h");
}
virtual ~Material() {
// PC_PRINT("DESTROYED", TagType::Destr, "Material.h");
}
Material() = default;
virtual ~Material() {}

static constexpr MaterialTypes type_value = T;

Expand Down
Empty file.
10 changes: 10 additions & 0 deletions Engine/include/Popcorn/Graphics/PaintPasses/BloomExtractPass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#pragma once

#include "GlobalMacros.h"

ENGINE_NAMESPACE_BEGIN
GFX_NAMESPACE_BEGIN

GFX_NAMESPACE_END
ENGINE_NAMESPACE_END
Empty file.
10 changes: 10 additions & 0 deletions Engine/include/Popcorn/Graphics/PaintPasses/CustomPaintPass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#pragma once

#include "GlobalMacros.h"

ENGINE_NAMESPACE_BEGIN
GFX_NAMESPACE_BEGIN

GFX_NAMESPACE_END
ENGINE_NAMESPACE_END
Loading