mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
85
include/rendering/lens_flare.hpp
Normal file
85
include/rendering/lens_flare.hpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#pragma once
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace rendering {
|
||||
|
||||
class Camera;
|
||||
class Shader;
|
||||
|
||||
/**
|
||||
* @brief Renders lens flare effect when looking at the sun
|
||||
*
|
||||
* Features:
|
||||
* - Multiple flare elements (ghosts) along sun-to-center axis
|
||||
* - Sun glow at sun position
|
||||
* - Colored flare elements (chromatic aberration simulation)
|
||||
* - Intensity based on sun visibility and angle
|
||||
* - Additive blending for realistic light artifacts
|
||||
*/
|
||||
class LensFlare {
|
||||
public:
|
||||
LensFlare();
|
||||
~LensFlare();
|
||||
|
||||
/**
|
||||
* @brief Initialize lens flare system
|
||||
* @return true if initialization succeeded
|
||||
*/
|
||||
bool initialize();
|
||||
|
||||
/**
|
||||
* @brief Render lens flare effect
|
||||
* @param camera The camera to render from
|
||||
* @param sunPosition World-space sun position
|
||||
* @param timeOfDay Current time (0-24 hours)
|
||||
*/
|
||||
void render(const Camera& camera, const glm::vec3& sunPosition, float timeOfDay);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable lens flare rendering
|
||||
*/
|
||||
void setEnabled(bool enabled) { this->enabled = enabled; }
|
||||
bool isEnabled() const { return enabled; }
|
||||
|
||||
/**
|
||||
* @brief Set flare intensity multiplier
|
||||
*/
|
||||
void setIntensity(float intensity);
|
||||
float getIntensity() const { return intensityMultiplier; }
|
||||
|
||||
private:
|
||||
struct FlareElement {
|
||||
float position; // Position along sun-center axis (-1 to 1, 0 = center)
|
||||
float size; // Size in screen space
|
||||
glm::vec3 color; // RGB color
|
||||
float brightness; // Brightness multiplier
|
||||
};
|
||||
|
||||
void generateFlareElements();
|
||||
void cleanup();
|
||||
float calculateSunVisibility(const Camera& camera, const glm::vec3& sunPosition) const;
|
||||
glm::vec2 worldToScreen(const Camera& camera, const glm::vec3& worldPos) const;
|
||||
|
||||
// OpenGL objects
|
||||
GLuint vao = 0;
|
||||
GLuint vbo = 0;
|
||||
std::unique_ptr<Shader> shader;
|
||||
|
||||
// Flare elements
|
||||
std::vector<FlareElement> flareElements;
|
||||
|
||||
// Parameters
|
||||
bool enabled = true;
|
||||
float intensityMultiplier = 1.0f;
|
||||
|
||||
// Quad vertices for rendering flare sprites
|
||||
static constexpr int VERTICES_PER_QUAD = 6;
|
||||
};
|
||||
|
||||
} // namespace rendering
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue