Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
Forces.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4#include <glm/glm.hpp>
9
10class SceneManager;
11
12class Forces : public ICustomDrawable {
13public:
14 Forces(SceneManager* sceneManager);
15 ~Forces() override = default;
16
17 Shader* getShader() const override { return basicShader; }
18 Mesh* getMesh() const override { return nullptr; }
19 uint32_t getObjectID() const override { return 0; }
20
21 void draw() const override;
22
23 void setEnabled(bool value) { enabled = value; }
24
25private:
26 struct ArrowCpu {
27 uint32_t objectID = 0;
28 glm::vec3 net{0.0f};
29 float netMag = 0.0f;
30 glm::vec3 startPos{0.0f};
31 float radius = 1.0f;
32 };
33
34 SceneManager* sceneManager;
35 Shader* basicShader = nullptr;
36 bool enabled = true;
37
39 mutable std::vector<ArrowCpu> m_arrowScratch;
40 mutable std::vector<Rendering::InstanceData> m_instanceScratch;
41};
Core interfaces for the rendering system supporting both instanced and custom drawing.
uint32_t getObjectID() const override
Gets the unique identifier for this object.
Definition Forces.h:19
Shader * getShader() const override
Gets the shader used to render this object.
Definition Forces.h:17
void setEnabled(bool value)
Definition Forces.h:23
void draw() const override
Performs custom rendering for this object.
Definition Forces.cpp:47
Mesh * getMesh() const override
Gets the mesh geometry for this object.
Definition Forces.h:18
~Forces() override=default
Interface for objects with specialized rendering requirements.
Definition IDrawable.h:181
GPU mesh representation with support for instanced rendering.
Definition Mesh.h:58
Definition Shader.h:6