From 40d69e7e40a18865a31af2f55efcde369d36dbbb Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Tue, 20 May 2025 21:08:19 -0400 Subject: pke: serialization overhaul + embedded assets --- src/entities.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/entities.cpp') 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(MemBkt_Bullet); - btScalar *vertDataPointer = reinterpret_cast(helper.modelBinAsset->ptr); + btScalar *vertDataPointer = reinterpret_cast(const_cast(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(etdHelper.textureAsset->ptr), etdHelper.textureAsset->size, &pixelWidth, &pixelHeight, &pixelChannels, STBI_rgb_alpha); + stbi_uc *pixels = stbi_load_from_memory(static_cast(const_cast(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(etdHelper.textureAsset->ptr), etdHelper.textureAsset->size, &pixelWidth, &pixelHeight, &pixelChannels, STBI_rgb_alpha); + pixels = stbi_load_from_memory(static_cast(const_cast(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(tmpBufferDetails.deviceData) + offsetVert; - srcPtr = static_cast(helper.modelBinAsset->ptr) + accVert.buffer_view->offset; + srcPtr = static_cast(const_cast(helper.modelBinAsset->ptr)) + accVert.buffer_view->offset; memcpy(dstPtr, srcPtr, accVert.buffer_view->size); dstPtr = static_cast(tmpBufferDetails.deviceData) + offsetNorm; - srcPtr = static_cast(helper.modelBinAsset->ptr) + accNorm.buffer_view->offset; + srcPtr = static_cast(const_cast(helper.modelBinAsset->ptr)) + accNorm.buffer_view->offset; memcpy(dstPtr, srcPtr, accNorm.buffer_view->size); dstPtr = static_cast(tmpBufferDetails.deviceData) + offsetUV; - srcPtr = static_cast(helper.modelBinAsset->ptr) + accUV.buffer_view->offset; + srcPtr = static_cast(const_cast(helper.modelBinAsset->ptr)) + accUV.buffer_view->offset; memcpy(dstPtr, srcPtr, accUV.buffer_view->size); dstPtr = static_cast(tmpBufferDetails.deviceData) + offsetIndex; - srcPtr = static_cast(helper.modelBinAsset->ptr) + accIndex.buffer_view->offset; + srcPtr = static_cast(const_cast(helper.modelBinAsset->ptr)) + accIndex.buffer_view->offset; memcpy(dstPtr, srcPtr, accIndex.buffer_view->size); VkCommandBufferBeginInfo vkCommandBufferBeginInfo; -- cgit v1.2.3