Skip to content

Commit

Permalink
feat: add shader hot reload back #40
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Dec 3, 2024
1 parent 505fb71 commit ef8bf2c
Show file tree
Hide file tree
Showing 8 changed files with 4,099 additions and 3,571 deletions.
28 changes: 14 additions & 14 deletions extensions/pl_model_loader_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ static void pl__refr_load_gltf_animation(plGltfLoadingData* ptSceneData, const c
static void
pl__free_data(plModelLoaderData* ptData)
{
pl_sb_free(ptData->atOpaqueObjects);
pl_sb_free(ptData->atTransparentObjects);
ptData->uOpaqueCount = 0;
ptData->uTransparentCount = 0;
ptData->atOpaqueObjects = NULL;
ptData->atTransparentObjects = NULL;
pl_sb_free(ptData->atDeferredObjects);
pl_sb_free(ptData->atForwardObjects);
ptData->uDeferredCount = 0;
ptData->uForwardCount = 0;
ptData->atDeferredObjects = NULL;
ptData->atForwardObjects = NULL;
}

static bool
Expand Down Expand Up @@ -151,11 +151,11 @@ pl__load_stl(plComponentLibrary* ptLibrary, const char* pcPath, plVec4 tColor, c
}

if(tColor.a == 1.0f)
pl_sb_push(ptDataOut->atOpaqueObjects, tEntity);
pl_sb_push(ptDataOut->atDeferredObjects, tEntity);
else
pl_sb_push(ptDataOut->atTransparentObjects, tEntity);
ptDataOut->uOpaqueCount = pl_sb_size(ptDataOut->atOpaqueObjects);
ptDataOut->uTransparentCount = pl_sb_size(ptDataOut->atTransparentObjects);
pl_sb_push(ptDataOut->atForwardObjects, tEntity);
ptDataOut->uDeferredCount = pl_sb_size(ptDataOut->atDeferredObjects);
ptDataOut->uForwardCount = pl_sb_size(ptDataOut->atForwardObjects);
return true;
}

Expand Down Expand Up @@ -354,8 +354,8 @@ pl__load_gltf(plComponentLibrary* ptLibrary, const char* pcPath, const plMat4* p
pl_hm_free(tLoadingData.ptSkinHashmap);
pl_hm_free(tLoadingData.ptMaterialHashMap);
pl_sb_free(tLoadingData.sbtMaterialEntities);
ptDataOut->uOpaqueCount = pl_sb_size(ptDataOut->atOpaqueObjects);
ptDataOut->uTransparentCount = pl_sb_size(ptDataOut->atTransparentObjects);
ptDataOut->uDeferredCount = pl_sb_size(ptDataOut->atDeferredObjects);
ptDataOut->uForwardCount = pl_sb_size(ptDataOut->atForwardObjects);
return true;
}

Expand Down Expand Up @@ -975,9 +975,9 @@ pl__refr_load_gltf_object(plModelLoaderData* ptData, plGltfLoadingData* ptSceneD
bOpaque = false;

if(bOpaque)
pl_sb_push(ptData->atOpaqueObjects, tNewObject);
pl_sb_push(ptData->atDeferredObjects, tNewObject);
else
pl_sb_push(ptData->atTransparentObjects, tNewObject);
pl_sb_push(ptData->atForwardObjects, tNewObject);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions extensions/pl_model_loader_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Index of this file:
// [SECTION] APIs
//-----------------------------------------------------------------------------

#define plModelLoaderI_version (plVersion){0, 1, 0}
#define plModelLoaderI_version (plVersion){0, 2, 0}

//-----------------------------------------------------------------------------
// [SECTION] forward declarations
Expand Down Expand Up @@ -62,10 +62,10 @@ typedef struct _plModelLoaderI

typedef struct _plModelLoaderData
{
uint32_t uOpaqueCount;
plEntity* atOpaqueObjects;
uint32_t uTransparentCount;
plEntity* atTransparentObjects;
uint32_t uDeferredCount;
plEntity* atDeferredObjects;
uint32_t uForwardCount;
plEntity* atForwardObjects;
} plModelLoaderData;

#endif // PL_MODEL_LOADER_EXT_H
Loading

0 comments on commit ef8bf2c

Please sign in to comment.