|
WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
|
#include <Renderer.h>
Classes | |
| struct | LightSettings |
| Plain-data description of a single light source. More... | |
| struct | RenderState |
| Aggregate rendering state exposed for UI binding. More... | |
Public Types | |
| enum class | LightType : int { Directional = 0 , Point , Spot , AmbientOnly } |
Public Member Functions | |
| Renderer ()=default | |
| ~Renderer () | |
| Renderer (const Renderer &)=delete | |
| Renderer & | operator= (const Renderer &)=delete |
| void | init () |
| Create GPU resources. Call once after the OpenGL context is current. | |
| void | shutdown () |
| Release GPU resources. | |
| RenderState & | state () noexcept |
| const RenderState & | state () const noexcept |
| void | applyLighting () |
| Configure OpenGL fixed-function lighting from the current state. | |
| void | applyLighting (const LightSettings &light) |
| Configure OpenGL fixed-function lighting from explicit settings. | |
| void | drawCheckerboard (int w, int h) |
| Draw a tiled checkerboard pattern in screen space. | |
| void | drawGradient (int w, int h, const glm::vec3 &top, const glm::vec3 &bottom) |
| Draw a vertical gradient quad in screen space. | |
| void | drawBackground (int w, int h) |
| Draw the background (checker or gradient) based on current state. | |
| void | drawGrid (float size=40.0f, float step=1.0f) |
| Draw a ground grid with highlighted centre axes. | |
| void | applyProjection (int w, int h, float fov, float nearPlane=0.1f, float farPlane=6400.0f) |
| Load a perspective projection matrix. | |
| void | applyView (const glm::mat4 &viewMatrix) |
| Load a view (camera) matrix. | |
| void | beginPass (ViewportFBO &fbo, int w, int h, const glm::vec3 &clearColor) |
| Begin an off-screen FBO render pass (resize, bind, clear). | |
| void | endPass (ViewportFBO &fbo) |
| End the current FBO render pass (unbind). | |
| void | renderScene (ViewportFBO &fbo, int w, int h, const OrbitCamera &camera, float fov, const glm::vec3 &clearColor, bool drawGrid, const std::function< void()> &drawObjects) |
| GLuint | checkerTexture () const noexcept |
Private Attributes | |
| GLuint | m_checkerTex = 0 |
| RenderState | m_state |
Low-level rendering operations for the engine's OpenGL pipeline.
Encapsulates GPU resource management, fixed-function lighting, common backgrounds, grid drawing, and FBO render-pass bookkeeping. The application layer calls individual primitives or the composite renderScene() helper to draw a complete frame.
Definition at line 17 of file Renderer.h.
|
strong |
| Enumerator | |
|---|---|
| Directional | |
| Point | |
| Spot | |
| AmbientOnly | |
Definition at line 22 of file Renderer.h.
|
default |
| Renderer::~Renderer | ( | ) |
|
delete |
| void Renderer::applyLighting | ( | ) |
Configure OpenGL fixed-function lighting from the current state.
Definition at line 261 of file Renderer.cpp.
| void Renderer::applyLighting | ( | const LightSettings & | light | ) |
Configure OpenGL fixed-function lighting from explicit settings.
Definition at line 44 of file Renderer.cpp.
| void Renderer::applyProjection | ( | int | w, |
| int | h, | ||
| float | fov, | ||
| float | nearPlane = 0.1f, |
||
| float | farPlane = 6400.0f |
||
| ) |
Load a perspective projection matrix.
Definition at line 224 of file Renderer.cpp.
| void Renderer::applyView | ( | const glm::mat4 & | viewMatrix | ) |
Load a view (camera) matrix.
Definition at line 235 of file Renderer.cpp.
| void Renderer::beginPass | ( | ViewportFBO & | fbo, |
| int | w, | ||
| int | h, | ||
| const glm::vec3 & | clearColor | ||
| ) |
Begin an off-screen FBO render pass (resize, bind, clear).
Definition at line 244 of file Renderer.cpp.
|
inlinenoexcept |
Definition at line 118 of file Renderer.h.
| void Renderer::drawBackground | ( | int | w, |
| int | h | ||
| ) |
Draw the background (checker or gradient) based on current state.
Definition at line 266 of file Renderer.cpp.
| void Renderer::drawCheckerboard | ( | int | w, |
| int | h | ||
| ) |
Draw a tiled checkerboard pattern in screen space.
Definition at line 110 of file Renderer.cpp.
| void Renderer::drawGradient | ( | int | w, |
| int | h, | ||
| const glm::vec3 & | top, | ||
| const glm::vec3 & | bottom | ||
| ) |
Draw a vertical gradient quad in screen space.
Definition at line 151 of file Renderer.cpp.
| void Renderer::drawGrid | ( | float | size = 40.0f, |
| float | step = 1.0f |
||
| ) |
Draw a ground grid with highlighted centre axes.
Definition at line 186 of file Renderer.cpp.
| void Renderer::endPass | ( | ViewportFBO & | fbo | ) |
End the current FBO render pass (unbind).
Definition at line 254 of file Renderer.cpp.
| void Renderer::init | ( | ) |
Create GPU resources. Call once after the OpenGL context is current.
Definition at line 16 of file Renderer.cpp.
| void Renderer::renderScene | ( | ViewportFBO & | fbo, |
| int | w, | ||
| int | h, | ||
| const OrbitCamera & | camera, | ||
| float | fov, | ||
| const glm::vec3 & | clearColor, | ||
| bool | drawGrid, | ||
| const std::function< void()> & | drawObjects | ||
| ) |
Composite render pass: background, projection, lighting, grid, then invoke drawObjects for application-specific geometry.
Definition at line 280 of file Renderer.cpp.
| void Renderer::shutdown | ( | ) |
Release GPU resources.
Definition at line 33 of file Renderer.cpp.
|
inlinenoexcept |
Definition at line 72 of file Renderer.h.
|
inlinenoexcept |
|
private |
Definition at line 121 of file Renderer.h.
|
private |
Definition at line 122 of file Renderer.h.