Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Feb 12, 2025
1 parent 9590c7a commit 3172b33
Show file tree
Hide file tree
Showing 34 changed files with 1,449 additions and 997 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ jobs:
if not exist ../out/pl_draw_backend_ext.dll exit 1
if not exist ../out/pl_draw_ext.dll exit 1
if not exist ../out/pl_ecs_ext.dll exit 1
if not exist ../out/pl_ecs_tools_ext.dll exit 1
if not exist ../out/pl_gizmo_ext.dll exit 1
if not exist ../out/pl_gpu_allocators_ext.dll exit 1
if not exist ../out/pl_graphics_ext.dll exit 1
if not exist ../out/pl_image_ext.dll exit 1
Expand Down Expand Up @@ -237,6 +239,8 @@ jobs:
test -f ./out/pl_draw_backend_ext.dylib || exit 1
test -f ./out/pl_draw_ext.dylib || exit 1
test -f ./out/pl_ecs_ext.dylib || exit 1
test -f ./out/pl_ecs_tools_ext.dylib || exit 1
test -f ./out/pl_gizmo_ext.dylib || exit 1
test -f ./out/pl_gpu_allocators_ext.dylib || exit 1
test -f ./out/pl_graphics_ext.dylib || exit 1
test -f ./out/pl_image_ext.dylib || exit 1
Expand Down Expand Up @@ -374,6 +378,8 @@ jobs:
test -f ./out/pl_draw_backend_ext.so || exit 1
test -f ./out/pl_draw_ext.so || exit 1
test -f ./out/pl_ecs_ext.so || exit 1
test -f ./out/pl_ecs_tools_ext.so || exit 1
test -f ./out/pl_gizmo_ext.so || exit 1
test -f ./out/pl_gpu_allocators_ext.so || exit 1
test -f ./out/pl_graphics_ext.so || exit 1
test -f ./out/pl_image_ext.so || exit 1
Expand Down
3 changes: 3 additions & 0 deletions examples/example_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../shaders/"
},
.apcDirectories = {
"../shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down
3 changes: 3 additions & 0 deletions examples/example_3.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../shaders/"
},
.apcDirectories = {
"../shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down
8 changes: 6 additions & 2 deletions examples/example_4.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../examples/shaders/"
},
.apcDirectories = {
"../shaders/",
"../examples/shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down Expand Up @@ -272,8 +276,8 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~shaders~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

const plShaderDesc tShaderDesc = {
.tVertexShader = gptShader->load_glsl("../examples/shaders/example_4.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("../examples/shaders/example_4.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("example_4.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("example_4.frag", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = 0,
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
Expand Down
8 changes: 6 additions & 2 deletions examples/example_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../examples/shaders/"
},
.apcDirectories = {
"../shaders/",
"../examples/shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down Expand Up @@ -346,8 +350,8 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~shaders~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

const plShaderDesc tShaderDesc = {
.tVertexShader = gptShader->load_glsl("../examples/shaders/example_4.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("../examples/shaders/example_4.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("example_4.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("example_4.frag", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = 0,
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
Expand Down
8 changes: 6 additions & 2 deletions examples/example_6.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../examples/shaders/"
},
.apcDirectories = {
"../shaders/",
"../examples/shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down Expand Up @@ -486,8 +490,8 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~shaders~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

const plShaderDesc tShaderDesc = {
.tVertexShader = gptShader->load_glsl("../examples/shaders/example_6.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("../examples/shaders/example_6.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("example_6.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("example_6.frag", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = 0,
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
Expand Down
3 changes: 3 additions & 0 deletions examples/example_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../examples/shaders/"
},
.apcDirectories = {
"../shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down
3 changes: 3 additions & 0 deletions examples/example_9.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
static const plShaderOptions tDefaultShaderOptions = {
.apcIncludeDirectories = {
"../examples/shaders/"
},
.apcDirectories = {
"../shaders/"
}
};
gptShader->initialize(&tDefaultShaderOptions);
Expand Down
16 changes: 8 additions & 8 deletions extensions/pl_draw_backend_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ pl__get_3d_pipeline(plRenderPassHandle tRenderPass, uint32_t uMSAASampleCount, p

{
const plShaderDesc t3DShaderDesc = {
.tPixelShader = gptShader->load_glsl("../shaders/draw_3d.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("../shaders/draw_3d.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("draw_3d.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("draw_3d.vert", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = tFlags & PL_DRAW_FLAG_DEPTH_WRITE ? 1 : 0,
.ulDepthMode = tFlags & PL_DRAW_FLAG_DEPTH_TEST ? (tFlags & PL_DRAW_FLAG_REVERSE_Z_DEPTH ? PL_COMPARE_MODE_GREATER : PL_COMPARE_MODE_LESS) : PL_COMPARE_MODE_ALWAYS,
Expand Down Expand Up @@ -430,8 +430,8 @@ pl__get_3d_pipeline(plRenderPassHandle tRenderPass, uint32_t uMSAASampleCount, p

{
const plShaderDesc t3DLineShaderDesc = {
.tPixelShader = gptShader->load_glsl("../shaders/draw_3d.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("../shaders/draw_3d_line.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("draw_3d.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("draw_3d_line.vert", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = tFlags & PL_DRAW_FLAG_DEPTH_WRITE,
.ulDepthMode = tFlags & PL_DRAW_FLAG_DEPTH_TEST ? (tFlags & PL_DRAW_FLAG_REVERSE_Z_DEPTH ? PL_COMPARE_MODE_GREATER : PL_COMPARE_MODE_LESS) : PL_COMPARE_MODE_ALWAYS,
Expand Down Expand Up @@ -499,8 +499,8 @@ pl__get_2d_pipeline(plRenderPassHandle tRenderPass, uint32_t uMSAASampleCount, u
ptEntry->uSubpassIndex = uSubpassIndex;

const plShaderDesc tRegularShaderDesc = {
.tPixelShader = gptShader->load_glsl("../shaders/draw_2d.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("../shaders/draw_2d.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("draw_2d.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("draw_2d.vert", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = 0,
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
Expand Down Expand Up @@ -554,8 +554,8 @@ pl__get_2d_pipeline(plRenderPassHandle tRenderPass, uint32_t uMSAASampleCount, u
pl_temp_allocator_reset(&gptDrawBackendCtx->tTempAllocator);

const plShaderDesc tSecondaryShaderDesc = {
.tPixelShader = gptShader->load_glsl("../shaders/draw_2d_sdf.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("../shaders/draw_2d.vert", "main", NULL, NULL),
.tPixelShader = gptShader->load_glsl("draw_2d_sdf.frag", "main", NULL, NULL),
.tVertexShader = gptShader->load_glsl("draw_2d.vert", "main", NULL, NULL),
.tGraphicsState = {
.ulDepthWriteEnabled = 0,
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
Expand Down
6 changes: 5 additions & 1 deletion extensions/pl_ecs_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,11 @@ pl_ecs_add_component(plComponentLibrary* ptLibrary, plComponentType tType, plEnt
if(bAddSlot)
pl_sb_add(sbComponents);
ptManager->pComponents = sbComponents;
sbComponents[uComponentIndex] = (plObjectComponent){.tMesh= {UINT32_MAX, UINT32_MAX}, .tTransform ={UINT32_MAX, UINT32_MAX}};
sbComponents[uComponentIndex] = (plObjectComponent){
.tFlags = PL_OBJECT_FLAGS_RENDERABLE | PL_OBJECT_FLAGS_CAST_SHADOW | PL_OBJECT_FLAGS_DYNAMIC,
.tMesh = {UINT32_MAX, UINT32_MAX},
.tTransform = {UINT32_MAX, UINT32_MAX}
};
return &sbComponents[uComponentIndex];
}

Expand Down
17 changes: 14 additions & 3 deletions extensions/pl_ecs_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ typedef int plLightType;
typedef int plHumanoidBone;
typedef int plEnvironmentProbeFlags;
typedef int plTransformFlags;
typedef int plObjectFlags;

typedef union _plEntity
{
Expand Down Expand Up @@ -399,6 +400,15 @@ enum _plTransformFlags
PL_TRANSFORM_FLAGS_DIRTY = 1 << 0,
};

enum _plObjectFlags
{
PL_OBJECT_FLAGS_NONE = 0,
PL_OBJECT_FLAGS_RENDERABLE = 1 << 0,
PL_OBJECT_FLAGS_CAST_SHADOW = 1 << 1,
PL_OBJECT_FLAGS_DYNAMIC = 1 << 2,
PL_OBJECT_FLAGS_FOREGROUND = 1 << 3,
};

//-----------------------------------------------------------------------------
// [SECTION] structs
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -514,9 +524,10 @@ typedef struct _plLightComponent

typedef struct _plObjectComponent
{
plEntity tMesh;
plEntity tTransform;
plAABB tAABB;
plObjectFlags tFlags;
plEntity tMesh;
plEntity tTransform;
plAABB tAABB;
} plObjectComponent;

typedef struct _plHierarchyComponent
Expand Down
Loading

0 comments on commit 3172b33

Please sign in to comment.