Files
jak-project/game/graphics/opengl_renderer/loader/common.h
T
water111 2e31d82fb2 Loader improvements (#1378)
* tfrag3 data for merc2

* dma hooks for merc2

* start designing merc2 opengl, seems like the simple approach will be the best here

* before bone packing experiment

* fix up bones.gc

* use uniform buffer

* speedup, fix faces and eyes

* final fixes

* first pass at loader updates, tie is still bad

* temp

* improved loader

* run iop less often
2022-05-28 20:12:33 -04:00

50 lines
1.2 KiB
C++

#pragma once
struct LevelData {
std::unique_ptr<tfrag3::Level> level;
std::vector<GLuint> textures;
u64 load_id = UINT64_MAX;
struct TieOpenGL {
GLuint vertex_buffer;
bool has_wind = false;
GLuint wind_indices;
};
std::array<std::vector<TieOpenGL>, tfrag3::TIE_GEOS> tie_data;
std::array<std::vector<GLuint>, tfrag3::TIE_GEOS> tfrag_vertex_data;
std::vector<GLuint> shrub_vertex_data;
GLuint collide_vertices;
GLuint merc_vertices;
GLuint merc_indices;
std::unordered_map<std::string, const tfrag3::MercModel*> merc_model_lookup;
int frames_since_last_used = 0;
};
struct MercRef {
const tfrag3::MercModel* model = nullptr;
u64 load_id = 0;
const LevelData* level = nullptr;
bool operator==(const MercRef& other) const {
return model == other.model && load_id == other.load_id;
}
};
struct LoaderInput {
LevelData* lev_data;
TexturePool* tex_pool;
std::unordered_map<std::string, std::vector<MercRef>>* mercs;
};
class LoaderStage {
public:
LoaderStage(const std::string& name) : m_name(name) {}
virtual bool run(Timer& timer, LoaderInput& data) = 0;
virtual void reset() = 0;
virtual ~LoaderStage() = default;
const std::string& name() const { return m_name; }
protected:
std::string m_name;
};