2025-04-24 16:39:24 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2026-03-16 17:33:46 +01:00
|
|
|
#include <cstddef>
|
2026-03-16 06:37:51 +01:00
|
|
|
#include <pd/core/pool.hpp>
|
2026-03-16 17:33:46 +01:00
|
|
|
#include <pd/lithium/pools.hpp>
|
2025-04-24 16:39:24 +02:00
|
|
|
#include <pd/lithium/vertex.hpp>
|
|
|
|
|
|
|
|
|
|
namespace PD {
|
2025-06-22 21:05:09 +02:00
|
|
|
namespace Li {
|
|
|
|
|
class Command {
|
2025-04-24 16:39:24 +02:00
|
|
|
public:
|
2026-03-16 17:33:46 +01:00
|
|
|
Command() { Reset(); }
|
2026-03-16 06:37:51 +01:00
|
|
|
~Command() {}
|
2026-01-22 16:34:46 +01:00
|
|
|
|
2026-03-16 17:33:46 +01:00
|
|
|
void Reserve(size_t vtx, size_t idx) {
|
|
|
|
|
if (!FirstVertex)
|
|
|
|
|
FirstVertex = AllocateVertices(vtx);
|
|
|
|
|
else
|
|
|
|
|
AllocateVertices(vtx);
|
|
|
|
|
if (!FirstIndex)
|
|
|
|
|
FirstIndex = AllocateIndices(idx);
|
|
|
|
|
else
|
|
|
|
|
AllocateIndices(idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Reset() {
|
|
|
|
|
Layer = 0;
|
|
|
|
|
Tex = 0;
|
|
|
|
|
FirstIndex = nullptr;
|
|
|
|
|
FirstVertex = nullptr;
|
|
|
|
|
IndexCount = 0;
|
|
|
|
|
VertexCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Command& Add(const Vertex& vtx) {
|
|
|
|
|
FirstVertex[VertexCount++] = vtx;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
Command& Add(u16 idx) {
|
|
|
|
|
FirstIndex[IndexCount++] = VertexCount + idx;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
Command& Add(u16 a, u16 b, u16 c) {
|
|
|
|
|
FirstIndex[IndexCount++] = VertexCount + a;
|
|
|
|
|
FirstIndex[IndexCount++] = VertexCount + b;
|
|
|
|
|
FirstIndex[IndexCount++] = VertexCount + c;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-16 12:13:48 +01:00
|
|
|
int Layer = 0;
|
2026-03-16 06:37:51 +01:00
|
|
|
ptr Tex = 0;
|
|
|
|
|
Vertex* FirstVertex = nullptr;
|
|
|
|
|
u16* FirstIndex = nullptr;
|
2026-03-16 17:33:46 +01:00
|
|
|
size_t VertexCount = 0;
|
|
|
|
|
size_t IndexCount = 0;
|
|
|
|
|
// Todo: implement
|
|
|
|
|
size_t VertexCountMax = 0;
|
|
|
|
|
size_t IndexCountMax = 0;
|
2026-01-16 12:13:48 +01:00
|
|
|
};
|
2025-06-22 21:05:09 +02:00
|
|
|
} // namespace Li
|
2025-02-22 00:23:48 +01:00
|
|
|
} // namespace PD
|