resonance 1.0.1
Loading...
Searching...
No Matches
metfreqmakerassetmanager.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <map>
5#include <vector>
6
7#include "math/color.h"
8#include "math/vector2.h"
10#include "os/hxstr.h"
11
13class MetFreqLoader;
14class RndAsyncLoader;
15namespace Rnd {
16class Mat;
17class Mesh;
18class Object;
19class Tex;
20} // namespace Rnd
21
50public:
59 static void Create();
60
71
80 static void Destroy();
81
90 static void CreateInstance();
91
100 static void DestroyInstance();
101
112
123
133
148 bool PollLoad();
149
158
171 std::vector<MetPersonaData *> *GetIdentityList();
172
185 std::vector<MetPersonaData *> *GetAllIdentities();
186
196
208
219
232
244
257 Rnd::Mesh *CloneMesh(const HxStr &name);
258
277 FreqPartTemplate *pTemplate,
278 float *pScaleX,
279 float *pScaleZ,
280 float flFactorX,
281 float flFactorZ);
282
294 Color *ColorAt(const Vector2 &position);
295
310 Color *SampleTexture(Rnd::Tex *pTex, float flU, float flV);
311
327 bool PaintTexel(Rnd::Tex *pTex, const Color &color, float flU, float flV);
328
346 Rnd::Mesh *pMesh, int nOrthonormalize, float flScaleX, float flScaleY, float flScaleZ);
347
357 std::map<HxStr, FreqPartTemplate *> *GetPartsByName();
358
370
372 static constexpr int kCategoryCount = 11;
373
384 std::list<FreqPartTemplate *> *TemplatesInCategory(int nCategory);
385
398
409
420 std::list<Rnd::Object *> GetLoadedObjects();
421
422private:
432 FreqPartTemplate *RegisterPart(Rnd::Object *pObject);
433
434 int mReserved; // +0x00, starts at 0, no reader identified
435 MetFreqLoader *mPrefabLoader; // +0x04, owned
436 MetFreqLoader *mTeamFreqLoader; // +0x08, owned
437 RndAsyncLoader *mAssetLoader; // +0x0c, created by StartAssetLoad()
438 int mLoaded; // +0x10, set once PollLoad() completes
439 std::map<HxStr, FreqPartTemplate *> mPartsByName; // +0x14
440 std::vector<FreqPartTemplate *> mParts; // +0x20, by template identifier
441 Rnd::Mat *mMaterialTemplate; // +0x2c, copied by RegisterPart()
442 Rnd::Mesh *mMeshTemplate; // +0x30, copied by CloneMesh()
443 Rnd::Tex *mPaletteTex; // +0x34, resolved by ColorAt()
444 std::list<FreqPartTemplate *> mCategoryLists[kCategoryCount]; // +0x38, categories 1 to 11
445 // Advanced by NextMeshName().
446 int mMeshCount; // +0x64
447 std::vector<MetPersonaData *> mPrefabIdentities; // +0x68, filled by mPrefabLoader
448 std::vector<MetPersonaData *> mTeamFreqIdentities; // +0x74, filled by mTeamFreqLoader
449};
450
459
One kind of part the FreQ maker offers, shared by every FreqPart placed from it.
Definition freqparttemplate.h:25
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Asynchronous reader of one pre-fab persona file.
Definition metfreqloader.h:25
void WaitForLoad()
Block until PollLoad() reports the assets resident, running RndAsyncLoader::PollAsyncLoads() between ...
std::list< Rnd::Object * > GetLoadedObjects()
Report a copy of the objects the asset load produced, once PollLoad() has run and its result is disca...
static void Create()
Allocate the one instance through CreateInstance().
std::vector< MetPersonaData * > * GetIdentityList()
Resolve the list of prefabricated identities the FreQ maker offers.
static MetFreqMakerAssetManager * Instance()
Return the one instance, or null before CreateInstance() has created it.
void StartIdentityLoads()
Queue the reads of both persona files.
bool ScaleMesh(Rnd::Mesh *pMesh, int nOrthonormalize, float flScaleX, float flScaleY, float flScaleZ)
Scale the three basis rows of a mesh's local transform.
static MetFreqMakerAssetManager * shared()
Return the one instance through Instance().
Color * SampleTexture(Rnd::Tex *pTex, float flU, float flV)
Read the colour of one texel of a texture.
bool AreLoadersReady()
Report through both loaders whether the assets are resident.
static constexpr int kCategoryCount
The number of part categories, which count from 1.
Definition metfreqmakerassetmanager.h:372
static void Destroy()
Delete the one instance through DestroyInstance().
FreqPartTemplate * GetPart(int nId)
Report the part template with one identifier.
static void DestroyInstance()
Delete the one instance through its virtual destructor.
void StartAssetLoad()
Create and queue the load of the FreQ maker asset file once.
std::vector< MetPersonaData * > * GetAllIdentities()
Resolve the full list of identities, the one at +0x74.
void ReleaseParts()
Delete every part template and forget them, so the next PollLoad() reloads.
bool PollLoad()
Advance the asset load by one step and report whether it has finished.
bool PaintTexel(Rnd::Tex *pTex, const Color &color, float flU, float flV)
Write one colour into one texel of a texture.
virtual ~MetFreqMakerAssetManager()
Delete the two persona loaders.
std::list< FreqPartTemplate * > * TemplatesInCategory(int nCategory)
Report the templates of one category.
Color * ColorAt(const Vector2 &position)
Report the colour at one position of the spectrum palette.
Rnd::Mesh * CloneMesh(const HxStr &name)
Create a mesh under one name as a copy of the template mesh, in the default colour.
std::map< HxStr, FreqPartTemplate * > * GetPartsByName()
Report the part templates by name, once PollLoad() has run and its result is discarded.
void ApplyPartScale(Rnd::Mesh *pMesh, FreqPartTemplate *pTemplate, float *pScaleX, float *pScaleZ, float flFactorX, float flFactorZ)
Scale a mesh to one part template.
HxStr NextMeshName()
Generate a fresh object name, autogen_obj_ followed by the value of a counter the call then advances.
bool AreIdentitiesLoaded()
Pump the asynchronous layer and report whether both persona files are parsed.
static void CreateInstance()
Allocate the one instance and record it for Instance().
FreqPartTemplate * FindPart(const HxStr &name)
Report the part template registered under one name.
MetFreqMakerAssetManager()
Start with no assets, no loaded templates, and two persona loaders.
Request to load one renderer file in the background.
Definition asyncloader.h:29
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Indexed triangle mesh with one material.
Definition mesh.h:46
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Texture, as a bitmap path plus the load state of its mip levels.
Definition tex.h:43
HxStr g_spectrumTextureName
Registry key of the palette texture MetFreqMakerAssetManager::ColorAt() samples, spectrum....
Color g_freqMakerDefaultColor
Colour a freshly cloned FreQ maker mesh and a reset FreqPart start with, an opaque grey of 0....
The rendering engine.
Definition animhelper.h:3
Linear colour with four float components.
Definition color.h:10
Two-component vector, used for texture coordinates.
Definition vector2.h:10