OpenBF1942-Plus
Refractor 1, rebuilt from scratch
Loading...
Searching...
No Matches
tm.h
Go to the documentation of this file.
1// Tree meshes (.tm v3). Spec: docs/formats/tm.md; reference: tools/tm.py
2#pragma once
3#include <cstdint>
4#include <string>
5#include <vector>
6
7namespace obf {
8
9struct TmPart {
10 uint32_t first, count; // index range: count * (24, 3, 24) indices for groups 1, 2, 3
11 std::string texture;
12};
13
14struct TmMesh {
15 std::vector<TmPart> groups[3]; // 1: geometry blocks, 2: triangles, 3: camera-facing sprite blocks
16 std::vector<float> vertices; // 10 floats each: pos, normal, uv, sprite corner offset (colour dropped)
17 std::vector<uint16_t> indices;
18};
19
20constexpr uint32_t kTmIndicesPer[3] = {24, 3, 24};
21
22TmMesh tm_parse(const std::vector<uint8_t>& data); // throws std::runtime_error
23
24} // namespace obf
Definition anim.cpp:7
TmMesh tm_parse(const std::vector< uint8_t > &d)
Definition tm.cpp:15
constexpr uint32_t kTmIndicesPer[3]
Definition tm.h:20
Definition tm.h:14
std::vector< float > vertices
Definition tm.h:16
std::vector< uint16_t > indices
Definition tm.h:17
std::vector< TmPart > groups[3]
Definition tm.h:15
Definition tm.h:9
uint32_t count
Definition tm.h:10
uint32_t first
Definition tm.h:10
std::string texture
Definition tm.h:11