summaryrefslogtreecommitdiff
path: root/src/util/asset_manager_utils.h
blob: b738692c9884c2677084690068b239bede548c77 (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
27
28
29
30
31
32
// This file is part of the 64k demo project.
// Typed asset helpers for specialized asset retrieval.
// Only include this if you need TextureAsset or MeshAsset structs.

#pragma once
#include "asset_manager.h"

struct TextureAsset {
  int width;
  int height;
  const uint8_t* pixels;
};

struct MeshVertex {
  float p[3];
  float n[3];
  float u[2];
};

struct MeshAsset {
  uint32_t num_vertices;
  const MeshVertex* vertices;
  uint32_t num_indices;
  const uint32_t* indices;
};

// Helper to retrieve and parse a simple texture asset (from packer's
// [w][h][pixels] format)
TextureAsset GetTextureAsset(AssetId asset_id);

// Helper to retrieve and parse a mesh asset (from packer's binary format)
MeshAsset GetMeshAsset(AssetId asset_id);