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 fa80de1
Show file tree
Hide file tree
Showing 18 changed files with 1,160 additions and 841 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
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
496 changes: 298 additions & 198 deletions sandbox/pl_ecs_tools.c → extensions/pl_ecs_tools_ext.c

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions sandbox/pl_ecs_tools.h → extensions/pl_ecs_tools_ext.h
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@

/*
pl_ecs_tools.h
pl_ecs_tools_ext.h
*/

/*
Index of this file:
// [SECTION] header mess
// [SECTION] APIs
// [SECTION] includes
// [SECTION] forward declarations
// [SECTION] public api
// [SECTION] public api structs
*/

//-----------------------------------------------------------------------------
// [SECTION] header mess
//-----------------------------------------------------------------------------

#ifndef PL_ECS_TOOLS_H
#define PL_ECS_TOOLS_H
#ifndef PL_ECS_TOOLS_EXT_H
#define PL_ECS_TOOLS_EXT_H

//-----------------------------------------------------------------------------
// [SECTION] APIs
//-----------------------------------------------------------------------------

#define plEcsToolsI_version (plVersion){0, 1, 0}

//-----------------------------------------------------------------------------
// [SECTION] includes
//-----------------------------------------------------------------------------

#include <stdint.h>
#include <stdbool.h>

//-----------------------------------------------------------------------------
// [SECTION] forward declarations
//-----------------------------------------------------------------------------

// external
typedef struct _plApiRegistryI plApiRegistryI; // pl.h
typedef struct _plComponentLibrary plComponentLibrary; // pl_ecs_ext.h
typedef union _plEntity plEntity;
typedef union _plEntity plEntity; // pl_ecs_ext.h

//-----------------------------------------------------------------------------
// [SECTION] public api
// [SECTION] public api structs
//-----------------------------------------------------------------------------

bool pl_show_ecs_window(plEntity* ptSelectedEntity, uint32_t uSceneHandle, bool*);
typedef struct _plEcsToolsI
{
bool (*show_ecs_window)(plEntity* ptSelectedEntity, uint32_t uSceneHandle, bool*);
} plEcsToolsI;

#endif // PL_ECS_TOOLS_H
#endif // PL_ECS_TOOLS_EXT_H
Loading

0 comments on commit fa80de1

Please sign in to comment.