Add loading screen with random WOWEE splash images

- Add loading screen system with stb_image for JPEG loading
- Two loading screen images (orc and dwarf) randomly selected
- Display loading screen while terrain data loads
- Cache WMO inverse matrices to reduce per-frame computation
- Stub WMO liquid rendering (needs coordinate system fix)
- Update spawn point to Stormwind Trade District
This commit is contained in:
Kelsi 2026-02-03 13:33:31 -08:00
parent 665a73e75f
commit 01bf3b4c08
14 changed files with 8395 additions and 165 deletions

View file

@ -100,6 +100,20 @@ struct WMOPortalPlane {
float distance;
};
// WMO Liquid (MLIQ chunk data)
struct WMOLiquid {
uint32_t xVerts = 0; // Vertices in X direction
uint32_t yVerts = 0; // Vertices in Y direction
uint32_t xTiles = 0; // Tiles in X (= xVerts - 1)
uint32_t yTiles = 0; // Tiles in Y (= yVerts - 1)
glm::vec3 basePosition; // Corner position in model space
uint16_t materialId = 0; // Liquid material/type
std::vector<float> heights; // Height per vertex (xVerts * yVerts)
std::vector<uint8_t> flags; // Flags per tile (xTiles * yTiles)
bool hasLiquid() const { return xVerts > 0 && yVerts > 0; }
};
// WMO Group Vertex
struct WMOVertex {
glm::vec3 position;
@ -143,6 +157,9 @@ struct WMOGroup {
// BSP tree (for collision - optional)
std::vector<uint8_t> bspNodes;
// Liquid data (MLIQ chunk)
WMOLiquid liquid;
std::string name;
std::string description;
};

View file

@ -126,10 +126,9 @@ private:
static constexpr float WOW_GRAVITY = -19.29f;
static constexpr float WOW_JUMP_VELOCITY = 7.96f;
// Default spawn position (on terrain near Stormwind)
// Terrain chunks are around X=[-9100, -9066], Y=[-533, 0]
glm::vec3 defaultPosition = glm::vec3(-9080.0f, -100.0f, 100.0f);
float defaultYaw = 180.0f; // Look south toward Stormwind gate
// Default spawn position (Stormwind Trade District)
glm::vec3 defaultPosition = glm::vec3(-8830.0f, 640.0f, 200.0f);
float defaultYaw = 0.0f; // Look north toward canals
float defaultPitch = -5.0f;
};

View file

@ -0,0 +1,50 @@
#pragma once
#include <GL/glew.h>
#include <string>
#include <vector>
namespace wowee {
namespace rendering {
class LoadingScreen {
public:
LoadingScreen();
~LoadingScreen();
bool initialize();
void shutdown();
// Select a random loading screen image
void selectRandomImage();
// Render the loading screen (call in a loop while loading)
void render();
// Update loading progress (0.0 to 1.0)
void setProgress(float progress) { loadProgress = progress; }
// Set loading status text
void setStatus(const std::string& status) { statusText = status; }
private:
bool loadImage(const std::string& path);
void createQuad();
GLuint textureId = 0;
GLuint vao = 0;
GLuint vbo = 0;
GLuint shaderId = 0;
std::vector<std::string> imagePaths;
int currentImageIndex = 0;
float loadProgress = 0.0f;
std::string statusText = "Loading...";
int imageWidth = 0;
int imageHeight = 0;
};
} // namespace rendering
} // namespace wowee

View file

@ -9,6 +9,7 @@ namespace wowee {
namespace pipeline {
struct ADTTerrain;
struct LiquidData;
struct WMOLiquid;
}
namespace rendering {
@ -28,6 +29,9 @@ struct WaterSurface {
// Owning tile coordinates (for per-tile removal)
int tileX = -1, tileY = -1;
// Owning WMO instance ID (for WMO liquid removal, 0 = terrain water)
uint32_t wmoId = 0;
// Water layer dimensions within chunk (0-7 offset, 1-8 size)
uint8_t xOffset = 0;
uint8_t yOffset = 0;
@ -73,6 +77,20 @@ public:
void loadFromTerrain(const pipeline::ADTTerrain& terrain, bool append = false,
int tileX = -1, int tileY = -1);
/**
* Load water surface from WMO liquid data
* @param liquid WMO liquid data from MLIQ chunk
* @param modelMatrix WMO instance model matrix for transforming to world space
* @param wmoId WMO instance ID for tracking ownership
*/
void loadFromWMO(const pipeline::WMOLiquid& liquid, const glm::mat4& modelMatrix, uint32_t wmoId);
/**
* Remove all water surfaces belonging to a specific WMO instance
* @param wmoId WMO instance ID
*/
void removeWMO(uint32_t wmoId);
/**
* Remove all water surfaces belonging to a specific tile
* @param tileX Tile X coordinate

View file

@ -221,6 +221,7 @@ private:
glm::vec3 rotation; // Euler angles (radians)
float scale;
glm::mat4 modelMatrix;
glm::mat4 invModelMatrix; // Cached inverse for collision
void updateModelMatrix();
};