WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
ModelLoader.h
Go to the documentation of this file.
1#pragma once
2
3// ---- Model loading and management helpers ---------------------------------
4// Extracted from main.cpp — handles model loading, animation/character/model
5// control init, equipment, item sets, start outfits, NPC/item browsers,
6// mounts, and all related filter-rebuilding functions.
7
8#include <string>
9#include <vector>
10
11struct AppState;
12class GameFile;
13class ItemDatabase;
14struct NPCRecord;
15class OrbitCamera;
16class WoWModel;
17
18namespace ModelLoader
19{
20
22std::string wstringToString(const std::wstring& ws);
23
26
28void resetCameraToModel(OrbitCamera& camera, const WoWModel* model, float fov);
29
31void applySkin(WoWModel* model, int skinIndex, AppState& app);
32
34void initAnimationControl(WoWModel* model, AppState& app);
35
37void initCharacterControl(WoWModel* model, AppState& app);
38
40void initModelControl(WoWModel* model, AppState& app);
41
43void loadModel(GameFile* file, AppState& app, float fov);
44
46void clearModel(AppState& app);
47
48// ---- Equipment helpers ----------------------------------------------------
49
51void tryToEquipItem(WoWModel* model, int id, AppState& app, const ItemDatabase& db);
52
53// ---- Item Sets ------------------------------------------------------------
54
55void buildItemSets(AppState& app);
57void applyItemSet(WoWModel* model, int setId, AppState& app, const ItemDatabase& db);
58
59// ---- Start Outfits --------------------------------------------------------
60
61void buildStartOutfits(WoWModel* model, AppState& app);
63void applyStartOutfit(WoWModel* model, int outfitId, AppState& app, const ItemDatabase& db);
64
65// ---- NPC Browser ----------------------------------------------------------
66
67void rebuildNpcFilter(AppState& app, const std::vector<NPCRecord>& npcs);
68void loadNPC(unsigned int creatureID, AppState& app, float fov);
69
70// ---- Item Browser ---------------------------------------------------------
71
73void loadItemModel(unsigned int itemId, AppState& app, float fov);
74
75// ---- Mounts ---------------------------------------------------------------
76
77void buildMountList(AppState& app);
79void mountCharacter(int displayID, GameFile* creatureFile, AppState& app, float fov);
80void dismountCharacter(AppState& app, float fov);
81
82} // namespace ModelLoader
Abstract base class representing a file within the game data archive.
Definition GameFile.h:12
In-memory item database loaded from the CSV item list.
Definition database.h:41
Orbit camera that revolves around a target point.
Definition OrbitCamera.h:10
Core WoW .m2 model: geometry, animation, textures, and character data.
Definition WoWModel.h:50
std::vector< NPCRecord > npcs
Definition database.cpp:8
std::string wstringToString(const std::wstring &ws)
Convert a wide string to narrow ASCII (lossy, for display only).
void initAnimationControl(WoWModel *model, AppState &app)
Populate app.animEntries / app.skinEntries from the model.
void tryToEquipItem(WoWModel *model, int id, AppState &app, const ItemDatabase &db)
void rebuildItemBrowseFilter(AppState &app, const ItemDatabase &db)
void rebuildMountFilter(AppState &app)
void applySkin(WoWModel *model, int skinIndex, AppState &app)
Apply a creature / item skin variant to the model.
void mountCharacter(int displayID, GameFile *creatureFile, AppState &app, float fov)
void rebuildNpcFilter(AppState &app, const std::vector< NPCRecord > &npcList)
void loadModel(GameFile *file, AppState &app, float fov)
Load a .m2 GameFile, create a WoWModel, attach to root, init controls.
void buildStartOutfits(WoWModel *model, AppState &app)
void initModelControl(WoWModel *model, AppState &app)
Populate app.geosetGroups and app.pcrState from the model.
void clearModel(AppState &app)
Tear down the current model and reset related state.
void applyStartOutfit(WoWModel *model, int outfitId, AppState &app, const ItemDatabase &db)
void rebuildEquipFilteredItems(AppState &app, const ItemDatabase &db)
void rebuildStartOutfitFilter(AppState &app)
void initCharacterControl(WoWModel *model, AppState &app)
Populate app.customizationOptions from the model's ChrCustomization DB.
void dismountCharacter(AppState &app, float fov)
void loadNPC(unsigned int creatureID, AppState &app, float fov)
void loadItemModel(unsigned int itemId, AppState &app, float fov)
void applyItemSet(WoWModel *model, int setId, AppState &app, const ItemDatabase &db)
void rebuildItemSetFilter(AppState &app)
void resetCameraToModel(OrbitCamera &camera, const WoWModel *model, float fov)
Reset the orbit camera to frame the given model.
void buildMountList(AppState &app)
WoWModel * getLoadedModel(AppState &app)
Return the currently loaded WoWModel (first child of root), or nullptr.
void buildItemSets(AppState &app)
Top-level aggregate of all mutable application state.
Definition AppState.h:261
A single NPC record (creature display info).
Definition database.h:53