Skip to content

Commit

Permalink
Renderer 2.0 work-in-progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhonnyg committed Nov 15, 2023
1 parent 9adb5d0 commit f0d554a
Show file tree
Hide file tree
Showing 200 changed files with 7,095 additions and 1,310 deletions.
14 changes: 10 additions & 4 deletions defold-rive/commonsrc/atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ namespace dmRive {
}


AtlasNameResolver::AtlasNameResolver()
AtlasNameResolver::AtlasNameResolver(HRenderContext context)
: m_RiveRenderContext(context)
{
}

void AtlasNameResolver::loadContents(rive::FileAsset& _asset)
bool AtlasNameResolver::loadContents(rive::FileAsset& _asset, rive::Span<const uint8_t> inBandBytes)
{
if (_asset.is<rive::ImageAsset>()) {
rive::ImageAsset* asset = _asset.as<rive::ImageAsset>();
Expand All @@ -219,16 +220,21 @@ namespace dmRive {
char* name_ext_end = strrchr(name_str, '.');

if (name_ext_end)
{
name_ext_end[0] = 0;
}

DEBUGLOG("Found Asset: %s", name_str);
dmhash_t name_hash = dmHashString64(name_str);

free(name_str);

// TODO: Possibly store rotation and location
asset->renderImage(std::make_unique<DefoldRenderImage>(name_hash));
asset->renderImage(CreateRiveRenderImage(m_RiveRenderContext, (void*) inBandBytes.data(), inBandBytes.size()));

return true;
}

return false;
}


Expand Down
15 changes: 2 additions & 13 deletions defold-rive/commonsrc/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,9 @@ DefoldFactory::DefoldFactory()
{
}

rive::rcp<rive::RenderBuffer> DefoldFactory::makeBufferU16(rive::Span<const uint16_t> data)
rive::rcp<rive::RenderBuffer> DefoldFactory::makeRenderBuffer(rive::RenderBufferType type, rive::RenderBufferFlags flags, size_t sizeInBytes)
{
return rive::rcp<rive::RenderBuffer>(new DefoldBuffer<uint16_t>(data));
return rive::rcp<rive::RenderBuffer>(new DefoldBuffer(type, flags, sizeInBytes));
}

rive::rcp<rive::RenderBuffer> DefoldFactory::makeBufferU32(rive::Span<const uint32_t> data)
{
return rive::rcp<rive::RenderBuffer>(new DefoldBuffer<uint32_t>(data));
}

rive::rcp<rive::RenderBuffer> DefoldFactory::makeBufferF32(rive::Span<const float> data)
{
return rive::rcp<rive::RenderBuffer>(new DefoldBuffer<float>(data));
}


} // namespace dmRive
Loading

0 comments on commit f0d554a

Please sign in to comment.