diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-20 21:08:19 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-20 21:08:19 -0400 |
| commit | 40d69e7e40a18865a31af2f55efcde369d36dbbb (patch) | |
| tree | 95a2cbbe40192183d13f846f3444b32d7e12b0e8 /src/entities.cpp | |
| parent | ead9e484db969a880470d625b1884aced296e722 (diff) | |
pke: serialization overhaul + embedded assets
Diffstat (limited to 'src/entities.cpp')
| -rw-r--r-- | src/entities.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 860907c..1ffecb3 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -343,7 +343,7 @@ void EntityType_PreLoad(EntityType_LoadHelperStruct &helper) { btConvexHullShape *shape; { shape = pk_new<btConvexHullShape>(MemBkt_Bullet); - btScalar *vertDataPointer = reinterpret_cast<btScalar *>(helper.modelBinAsset->ptr); + btScalar *vertDataPointer = reinterpret_cast<btScalar *>(const_cast<void *>(helper.modelBinAsset->ptr)); /* TODO JCB - 2024-01-02 * we shouldn't assume that the first index is the vertexes */ @@ -438,7 +438,7 @@ void EntityType_PreLoad(EntityType_LoadHelperStruct &helper) { etdHelper.textureAssetHandle = AssetHandle{AM_GetHandle(etd.textureAssetKey)}; if (etdHelper.textureAssetHandle != AssetHandle_MAX) { etdHelper.textureAsset = AM_Get(etdHelper.textureAssetHandle); - stbi_uc *pixels = stbi_load_from_memory(static_cast<stbi_uc *>(etdHelper.textureAsset->ptr), etdHelper.textureAsset->size, &pixelWidth, &pixelHeight, &pixelChannels, STBI_rgb_alpha); + stbi_uc *pixels = stbi_load_from_memory(static_cast<stbi_uc *>(const_cast<void *>(etdHelper.textureAsset->ptr)), etdHelper.textureAsset->size, &pixelWidth, &pixelHeight, &pixelChannels, STBI_rgb_alpha); assert(pixels != nullptr && "sbti_load failed to load image."); stbi_image_free(pixels); } else { @@ -515,7 +515,7 @@ void EntityType_LoadTexture(EntityType_LoadHelperStruct &helper, const int64_t i int32_t pixelWidth, pixelHeight, pixelChannels; stbi_uc *pixels = nullptr; if (etdHelper.textureAssetHandle != AssetHandle_MAX) { - pixels = stbi_load_from_memory(static_cast<stbi_uc *>(etdHelper.textureAsset->ptr), etdHelper.textureAsset->size, &pixelWidth, &pixelHeight, &pixelChannels, STBI_rgb_alpha); + pixels = stbi_load_from_memory(static_cast<stbi_uc *>(const_cast<void *>(etdHelper.textureAsset->ptr)), etdHelper.textureAsset->size, &pixelWidth, &pixelHeight, &pixelChannels, STBI_rgb_alpha); assert(pixels != nullptr && "sbti_load failed to load image."); } else { pixelWidth = 2; @@ -827,19 +827,19 @@ void EntityType_LoadMesh(EntityType_LoadHelperStruct &helper, const int64_t mesh char *srcPtr = nullptr; dstPtr = static_cast<char *>(tmpBufferDetails.deviceData) + offsetVert; - srcPtr = static_cast<char *>(helper.modelBinAsset->ptr) + accVert.buffer_view->offset; + srcPtr = static_cast<char *>(const_cast<void *>(helper.modelBinAsset->ptr)) + accVert.buffer_view->offset; memcpy(dstPtr, srcPtr, accVert.buffer_view->size); dstPtr = static_cast<char *>(tmpBufferDetails.deviceData) + offsetNorm; - srcPtr = static_cast<char *>(helper.modelBinAsset->ptr) + accNorm.buffer_view->offset; + srcPtr = static_cast<char *>(const_cast<void *>(helper.modelBinAsset->ptr)) + accNorm.buffer_view->offset; memcpy(dstPtr, srcPtr, accNorm.buffer_view->size); dstPtr = static_cast<char *>(tmpBufferDetails.deviceData) + offsetUV; - srcPtr = static_cast<char *>(helper.modelBinAsset->ptr) + accUV.buffer_view->offset; + srcPtr = static_cast<char *>(const_cast<void *>(helper.modelBinAsset->ptr)) + accUV.buffer_view->offset; memcpy(dstPtr, srcPtr, accUV.buffer_view->size); dstPtr = static_cast<char *>(tmpBufferDetails.deviceData) + offsetIndex; - srcPtr = static_cast<char *>(helper.modelBinAsset->ptr) + accIndex.buffer_view->offset; + srcPtr = static_cast<char *>(const_cast<void *>(helper.modelBinAsset->ptr)) + accIndex.buffer_view->offset; memcpy(dstPtr, srcPtr, accIndex.buffer_view->size); VkCommandBufferBeginInfo vkCommandBufferBeginInfo; |
