Particle Simulation Documentation
|
#include <renderer.h>
Public Member Functions | |
Renderer (const Config &config) | |
Initialize renderer. This method setup the GLFW library for rendering the scene and the Dear ImGui library for rendering the Graphical user interface. | |
~Renderer () | |
Destroys the renderer. | |
void | initializeGLFW () |
Initializes the GLFW library. This method is called by the constructor. | |
void | framebufferSizeCallback (int width, int height) |
Define Callback for window framebuffer size. This method is a callback function given to GLFW via glfwSetFramebufferSizeCallback in initializeGLFW. This method will be called automatically each time the window's framebuffer size change. | |
void | cursorPosCallback (double xpos, double ypos) |
Define Callback for cursor position. | |
void | keyboardCallback (int key, int scancode, int action, int mods) |
Define Callback for Keyboard inputs. | |
void | initializeImGui () |
Initializes the Dear ImGui library. This method is called by the constructor. | |
void | initializeImPlot () |
Initializes the imPlot library. This method is called by the constructor. | |
void | render (Universe &universe) |
Renders the given universe. | |
void | renderParticleTrail (const Particle &particle) |
Render the trail of the given particle. | |
void | drawBoxes () |
Draws the m_boxes boxes. | |
void | swapBuffers () |
Call glfwSwapBuffers(m_window). | |
void | renderImGui (Universe &universe) |
Render Dear ImGui. | |
void | ImGuiControlsMenu (Universe &universe, ImGuiWindowFlags window_flags) |
Render control ImGui menu. | |
void | ImGuiInformationMenu (const Universe &universe, ImGuiWindowFlags window_flags) |
Render information ImGui menu. | |
void | ImGuiParticleViewerMenu (std::vector< Particle > &particles, ImGuiWindowFlags window_flags) |
Render particles viewer ImGui menu. | |
void | ImGuiParticleEditorMenu (std::vector< Particle > &particles, ImGuiWindowFlags window_flags) |
Render particles editor ImGui menu. | |
void | toggleSpectatorMode () |
Toggle spectator mode. The spectator mode will take into account keyboard and mouse inputs for camera movement and show/hide the cursor. | |
void | clear () |
Clears the renderer. | |
bool | isRunning () |
Determines if the renderer is running. | |
const double & | getRunTime () const |
Return the run time. | |
Private Attributes | |
GLFWwindow * | m_window |
GLFW window pointer. | |
const Config & | m_config |
Reference to simulation configuration. | |
std::vector< Box > | m_boxes |
Vector of Box. | |
GLUquadric * | m_quadric |
GLU Utility for rendering quadratic shapes. | |
Camera | m_camera |
float | m_lastX = 0.0f |
Last cursor X position (in pixels). | |
float | m_lastY = 0.0f |
Last cursor Y position (in pixels). | |
double | m_lastFrameTime = 0.0 |
GLFW time of the last frame (in seconds). | |
double | m_simulationTimePaused = 0.0 |
double | m_runTime = 0.0 |
std::array< bool, 1024 > | m_keyStates { {false} } |
States of the keys. | |
bool | m_isSpectatorMode = false |
Determines if spectator is enable. | |
double | m_scaleFactor |
Scale factor applied for rendering. | |
std::vector< float > | m_lastFrameratesBuffer |
vector of last framerates values | |
std::vector< float > | m_lastFrameratesIndexes |
vector of last framerates indexes | |
Renderer::Renderer | ( | const Config & | config | ) |
Initialize renderer. This method setup the GLFW library for rendering the scene and the Dear ImGui library for rendering the Graphical user interface.
[in] | config | The simulation configuration |
Renderer::~Renderer | ( | ) |
Destroys the renderer.
void Renderer::clear | ( | ) |
Clears the renderer.
void Renderer::cursorPosCallback | ( | double | xpos, |
double | ypos ) |
Define Callback for cursor position.
[in] | xpos | The cursor x coordinate |
[in] | ypos | The cursor y coordinate |
void Renderer::drawBoxes | ( | ) |
Draws the m_boxes boxes.
void Renderer::framebufferSizeCallback | ( | int | width, |
int | height ) |
Define Callback for window framebuffer size. This method is a callback function given to GLFW via glfwSetFramebufferSizeCallback in initializeGLFW. This method will be called automatically each time the window's framebuffer size change.
[in] | width | The width |
[in] | height | The height |
|
inline |
Return the run time.
void Renderer::ImGuiControlsMenu | ( | Universe & | universe, |
ImGuiWindowFlags | window_flags ) |
Render control ImGui menu.
universe | The universe | |
[in] | window_flags | The window flags |
void Renderer::ImGuiInformationMenu | ( | const Universe & | universe, |
ImGuiWindowFlags | window_flags ) |
Render information ImGui menu.
[in] | universe | The universe |
[in] | window_flags | The window flags |
void Renderer::ImGuiParticleEditorMenu | ( | std::vector< Particle > & | particles, |
ImGuiWindowFlags | window_flags ) |
Render particles editor ImGui menu.
particles | The particles | |
[in] | window_flags | The window flags |
void Renderer::ImGuiParticleViewerMenu | ( | std::vector< Particle > & | particles, |
ImGuiWindowFlags | window_flags ) |
Render particles viewer ImGui menu.
particles | The particles |
window_flags | The window flags |
void Renderer::initializeGLFW | ( | ) |
Initializes the GLFW library. This method is called by the constructor.
void Renderer::initializeImGui | ( | ) |
Initializes the Dear ImGui library. This method is called by the constructor.
void Renderer::initializeImPlot | ( | ) |
Initializes the imPlot library. This method is called by the constructor.
bool Renderer::isRunning | ( | ) |
Determines if the renderer is running.
void Renderer::keyboardCallback | ( | int | key, |
int | scancode, | ||
int | action, | ||
int | mods ) |
Define Callback for Keyboard inputs.
[in] | key | The key |
[in] | scancode | The scancode |
[in] | action | The action |
[in] | mods | The mods |
void Renderer::render | ( | Universe & | universe | ) |
Renders the given universe.
[in] | universe | The universe |
void Renderer::renderImGui | ( | Universe & | universe | ) |
Render Dear ImGui.
universe | The universe |
void Renderer::renderParticleTrail | ( | const Particle & | particle | ) |
Render the trail of the given particle.
particle | The particle |
void Renderer::swapBuffers | ( | ) |
Call glfwSwapBuffers(m_window).
void Renderer::toggleSpectatorMode | ( | ) |
Toggle spectator mode. The spectator mode will take into account keyboard and mouse inputs for camera movement and show/hide the cursor.
|
private |
|
private |
Reference to simulation configuration.
|
private |
Determines if spectator is enable.
|
private |
States of the keys.
|
private |
vector of last framerates values
|
private |
vector of last framerates indexes
|
private |
GLFW time of the last frame (in seconds).
|
private |
Last cursor X position (in pixels).
|
private |
Last cursor Y position (in pixels).
|
private |
GLU Utility for rendering quadratic shapes.
|
private |
|
private |
Scale factor applied for rendering.
|
private |
|
private |
GLFW window pointer.