engine3d-dev / engine3d

Open-source game engine to be used for developing games
Apache License 2.0
1 stars 3 forks source link

Asset System Integration #4

Open SpinnerX opened 4 months ago

SpinnerX commented 4 months ago

We need to have an asset system. Coming up with an API on how we may want developers to use our API's. Considering many flaws in our own design.

API Structure Ideas

Functionality

Synchronization

Asset Loading Examples


AssetObject* model = AssetModel::Load("backpack.obj");

if(!model.IsLoaded()){
      static_assert(false);
}

// Example API of potentially rendering our some asset into our world/screen
Renderer::RenderAsset(pos, model);

With std::future Async

// Loading a texture from our assets std::future<Ref> thumbnail = std::async(std::launch::async, [&]{ return AssetManager::GetTexture(handler); }

// Loading in a 3D model or some kind of in-game asset object std::future thumbnail = std::async(std::launch::async, [&]{ return AssetManager::Get(handler); }