summaryrefslogtreecommitdiff
path: root/src/util/asset_manager.h
blob: ed7f1aad94451ff73ca7b20029a7f12f8e8d4b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// This file is part of the 64k demo project.
// Core asset management interface for basic asset retrieval.
// For typed helpers (TextureAsset, MeshAsset), include asset_manager_utils.h

#pragma once
#include "asset_manager_dcl.h"

struct AssetRecord {
  const uint8_t* data; // Pointer to asset data (static or dynamic)
  size_t size;         // Size of the asset data
  bool is_procedural;  // True if data was dynamically allocated by a procedural
                       // generator
  const char* proc_func_name_str; // Name of procedural generation function
                                  // (string literal)
  const float* proc_params; // Parameters for procedural generation (static,
                            // from assets.txt)
  int num_proc_params;      // Number of procedural parameters
};

// Generic interface
// Retrieves a pointer to the asset data.
// - Static assets are guaranteed to be 16-byte aligned.
// - Static assets are guaranteed to be null-terminated (safe as C-strings).
// - 'out_size' returns the original asset size (excluding the null terminator).
const uint8_t* GetAsset(AssetId asset_id, size_t* out_size = nullptr);
void DropAsset(AssetId asset_id, const uint8_t* asset);