mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
Render an animated M2 character model in the creation screen using a dedicated CharacterRenderer with an offscreen FBO. Preview updates on race/gender/appearance changes, supports mouse-drag rotation, and composites skin, face, hair scalp, and underwear textures from CharSections.dbc. Extracts getPlayerModelPath() to a shared free function in game/character.
62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "game/character.hpp"
|
|
#include "game/world_packets.hpp"
|
|
#include <imgui.h>
|
|
#include <string>
|
|
#include <functional>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace wowee {
|
|
namespace game { class GameHandler; }
|
|
namespace pipeline { class AssetManager; }
|
|
namespace rendering { class CharacterPreview; }
|
|
|
|
namespace ui {
|
|
|
|
class CharacterCreateScreen {
|
|
public:
|
|
CharacterCreateScreen();
|
|
~CharacterCreateScreen();
|
|
|
|
void render(game::GameHandler& gameHandler);
|
|
void update(float deltaTime);
|
|
void setOnCreate(std::function<void(const game::CharCreateData&)> cb) { onCreate = std::move(cb); }
|
|
void setOnCancel(std::function<void()> cb) { onCancel = std::move(cb); }
|
|
void setStatus(const std::string& msg, bool isError = false);
|
|
void reset();
|
|
void initializePreview(pipeline::AssetManager* am);
|
|
|
|
private:
|
|
char nameBuffer[13] = {}; // WoW max name = 12 chars + null
|
|
int raceIndex = 0;
|
|
int classIndex = 0;
|
|
int genderIndex = 0;
|
|
int skin = 0, face = 0, hairStyle = 0, hairColor = 0, facialHair = 0;
|
|
std::string statusMessage;
|
|
bool statusIsError = false;
|
|
|
|
std::vector<game::Class> availableClasses;
|
|
void updateAvailableClasses();
|
|
|
|
std::function<void(const game::CharCreateData&)> onCreate;
|
|
std::function<void()> onCancel;
|
|
|
|
// 3D model preview
|
|
std::unique_ptr<rendering::CharacterPreview> preview_;
|
|
int prevRaceIndex_ = -1;
|
|
int prevGenderIndex_ = -1;
|
|
int prevSkin_ = -1;
|
|
int prevFace_ = -1;
|
|
int prevHairStyle_ = -1;
|
|
int prevHairColor_ = -1;
|
|
int prevFacialHair_ = -1;
|
|
bool draggingPreview_ = false;
|
|
float dragStartX_ = 0.0f;
|
|
|
|
void updatePreviewIfNeeded();
|
|
};
|
|
|
|
} // namespace ui
|
|
} // namespace wowee
|