mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
chore: initial commit
This commit is contained in:
commit
70b00c5c38
965 changed files with 264882 additions and 0 deletions
37
src/gx/buffer/CGxBuf.hpp
Normal file
37
src/gx/buffer/CGxBuf.hpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef GX_BUFFER_C_GX_BUF_HPP
|
||||
#define GX_BUFFER_C_GX_BUF_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <storm/List.hpp>
|
||||
|
||||
class CGxPool;
|
||||
|
||||
class CGxBuf : public TSLinkedNode<CGxBuf> {
|
||||
public:
|
||||
// Member variables
|
||||
CGxPool* m_pool;
|
||||
uint32_t m_itemSize;
|
||||
uint32_t m_itemCount;
|
||||
uint32_t m_size;
|
||||
uint32_t m_index;
|
||||
uint8_t unk1C; // TODO
|
||||
uint8_t unk1D; // TODO
|
||||
uint8_t unk1E; // TODO
|
||||
uint8_t unk1F; // TODO
|
||||
|
||||
// Member functions
|
||||
CGxBuf() = default;
|
||||
CGxBuf(CGxPool* pool, uint32_t itemSize, uint32_t itemCount, uint32_t index)
|
||||
: m_pool(pool)
|
||||
, m_itemSize(itemSize)
|
||||
, m_itemCount(itemCount)
|
||||
, m_size(itemSize * itemCount)
|
||||
, m_index(index)
|
||||
, unk1C(0)
|
||||
, unk1D(1)
|
||||
, unk1E(0)
|
||||
, unk1F(0)
|
||||
{};
|
||||
};
|
||||
|
||||
#endif
|
||||
9
src/gx/buffer/CGxPool.cpp
Normal file
9
src/gx/buffer/CGxPool.cpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "gx/buffer/CGxPool.hpp"
|
||||
|
||||
void CGxPool::Discard() {
|
||||
for (auto buf = this->m_bufList.Head(); buf; buf = this->m_bufList.Link(buf)->Next()) {
|
||||
buf->unk1C = 0;
|
||||
}
|
||||
|
||||
this->unk1C = 0;
|
||||
}
|
||||
36
src/gx/buffer/CGxPool.hpp
Normal file
36
src/gx/buffer/CGxPool.hpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef GX_BUFFER_C_GX_POOL_HPP
|
||||
#define GX_BUFFER_C_GX_POOL_HPP
|
||||
|
||||
#include "gx/buffer/CGxBuf.hpp"
|
||||
#include "gx/buffer/Types.hpp"
|
||||
#include <cstdint>
|
||||
#include <storm/List.hpp>
|
||||
|
||||
class CGxPool : public TSLinkedNode<CGxPool> {
|
||||
public:
|
||||
// Member variables
|
||||
EGxPoolTarget m_target;
|
||||
EGxPoolUsage m_usage;
|
||||
int32_t m_size;
|
||||
void* m_apiSpecific;
|
||||
void* m_mem;
|
||||
int32_t unk1C; // TODO
|
||||
TSList<CGxBuf, TSGetLink<CGxBuf>> m_bufList;
|
||||
EGxPoolHintBits m_hint;
|
||||
const char* m_name;
|
||||
|
||||
// Member functions
|
||||
CGxPool() = default;
|
||||
CGxPool(EGxPoolTarget target, EGxPoolUsage usage, uint32_t size, EGxPoolHintBits hint, const char* name)
|
||||
: m_target(target)
|
||||
, m_usage(usage)
|
||||
, m_size(size)
|
||||
, m_apiSpecific(nullptr)
|
||||
, unk1C(0)
|
||||
, m_hint(hint)
|
||||
, m_name(name)
|
||||
{};
|
||||
void Discard(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
91
src/gx/buffer/Types.hpp
Normal file
91
src/gx/buffer/Types.hpp
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#ifndef GX_BUFFER_TYPES_HPP
|
||||
#define GX_BUFFER_TYPES_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
enum EGxPoolHintBits {
|
||||
GxPoolHintBit_Unk0 = 0,
|
||||
GxPoolHintBit_Unk1 = 1,
|
||||
GxPoolHintBit_Unk2 = 2,
|
||||
GxPoolHintBit_Unk3 = 3
|
||||
};
|
||||
|
||||
enum EGxPoolTarget {
|
||||
GxPoolTarget_Vertex = 0,
|
||||
GxPoolTarget_Index = 1,
|
||||
GxPoolTargets_Last = 2
|
||||
};
|
||||
|
||||
enum EGxPoolUsage {
|
||||
GxPoolUsage_Static = 0,
|
||||
GxPoolUsage_Dynamic = 1,
|
||||
GxPoolUsage_Stream = 2,
|
||||
GxPoolUsages_Last = 3
|
||||
};
|
||||
|
||||
enum EGxVertexAttrib {
|
||||
GxVA_Position = 0,
|
||||
GxVA_BlendWeight = 1,
|
||||
GxVA_BlendIndices = 2,
|
||||
GxVA_Normal = 3,
|
||||
GxVA_Color0 = 4,
|
||||
GxVA_Color1 = 5,
|
||||
GxVA_TexCoord0 = 6,
|
||||
GxVA_TexCoord1 = 7,
|
||||
GxVA_TexCoord2 = 8,
|
||||
GxVA_TexCoord3 = 9,
|
||||
GxVA_TexCoord4 = 10,
|
||||
GxVA_TexCoord5 = 11,
|
||||
GxVA_TexCoord6 = 12,
|
||||
GxVA_TexCoord7 = 13,
|
||||
GxVAs_Last = 14
|
||||
};
|
||||
|
||||
enum EGxVertexBufferFormat {
|
||||
GxVBF_P = 0,
|
||||
GxVBF_PN = 1,
|
||||
GxVBF_PNC = 2,
|
||||
GxVBF_PNT = 3,
|
||||
GxVBF_PNCT = 4,
|
||||
GxVBF_PNT2 = 5,
|
||||
GxVBF_PNCT2 = 6,
|
||||
GxVBF_PC = 7,
|
||||
GxVBF_PCT = 8,
|
||||
GxVBF_PCT2 = 9,
|
||||
GxVBF_PT = 10,
|
||||
GxVBF_PT2 = 11,
|
||||
GxVBF_PBNT2 = 12,
|
||||
GxVBF_PNC2T2 = 13,
|
||||
GxVertexBufferFormats_Last = 14
|
||||
};
|
||||
|
||||
struct ubyte4 {
|
||||
union {
|
||||
uint8_t b[4];
|
||||
uint32_t u;
|
||||
};
|
||||
};
|
||||
|
||||
struct CGxVertexAttrib {
|
||||
EGxVertexAttrib attrib;
|
||||
uint32_t type;
|
||||
uint32_t offset;
|
||||
uint32_t bufSize;
|
||||
};
|
||||
|
||||
struct CGxVertexPBNT2 {
|
||||
C3Vector p;
|
||||
ubyte4 bw;
|
||||
ubyte4 bi;
|
||||
C3Vector n;
|
||||
C2Vector tc[2];
|
||||
};
|
||||
|
||||
struct CGxVertexPCT {
|
||||
C3Vector p;
|
||||
CImVector c;
|
||||
C2Vector tc[1];
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue