Skip to content
Snippets Groups Projects
Commit 5e77bdb3 authored by HASPEKIAN Yvan's avatar HASPEKIAN Yvan
Browse files

Merge

parents 84523faf cbfcd09e
No related branches found
No related tags found
No related merge requests found
Showing
with 63 additions and 15 deletions
......@@ -4,5 +4,4 @@ Size=400,400
[Window][Particle Generator]
Pos=60,60
Size=141,81
Size=733,329
\ No newline at end of file
......@@ -47,5 +47,6 @@ namespace pg::interface {
ImGui::Checkbox("Enable Spawning", &this->_scene->_enableSpawn);
ImGui::Checkbox("Enable Rendering", &this->_scene->_enableRender);
ImGui::Checkbox("Freezing", &this->_scene->_enableFreeze);
ImGui::Checkbox("Wireframe", &this->_scene->_enableWireframe);
}
}
\ No newline at end of file
......@@ -18,8 +18,7 @@ namespace pg {
public:
SkyBox() = delete;
SkyBox(const std::string &, const std::string &);
SkyBox(const std::string & = "res/shaders/system/Skybox.vert", const std::string & = "res/shaders/system/Skybox.frag");
inline const CubemapMaterial & material() const {return this->_material;}
......
......@@ -2,5 +2,5 @@
namespace pg::scene {
SceneParticle::SceneParticle(int max)
: Scene(), _max(max), _spawn(1), _frequence(500), _lifetime(5), _enableRender(true), _enableSpawn(true), _enableFreeze(false) {}
: Scene(), _max(max), _spawn(1), _frequence(500), _lifetime(5), _enableRender(true), _enableSpawn(true), _enableFreeze(false), _enableWireframe(false) {}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@ namespace pg::scene {
bool _enableRender;
bool _enableSpawn;
bool _enableFreeze;
bool _enableWireframe;
protected:
ParticleContainer _particles;
......@@ -48,9 +49,10 @@ namespace pg::scene {
inline int getSpawnCount() const {return this->_spawn;}
inline int getSpawnFrequence() const {return this->_frequence;}
inline int getLifetime() const {return this->_lifetime;}
inline bool isRenderEnable() {return this->_enableRender;}
inline bool isSpawnEnable() {return this->_enableSpawn;}
inline bool isFreezeEnable() {return this->_enableFreeze;}
inline bool isRenderEnable() const {return this->_enableRender;}
inline bool isSpawnEnable() const {return this->_enableSpawn;}
inline bool isFreezeEnable() const {return this->_enableFreeze;}
inline bool isWireframeEnable() const {return this->_enableWireframe;}
inline void setSpawnCount(int sc) {this->_spawn = sc;}
inline void setSpawnFrequence(int sf) {this->_frequence = sf;}
......
......@@ -26,6 +26,15 @@ namespace pg::scene {
this->changeMesh("res/models/sphere.obj");
}
this->_skybox.load({
"res/textures/skybox/snow/right.png",
"res/textures/skybox/snow/left.png",
"res/textures/skybox/snow/top.png",
"res/textures/skybox/snow/bottom.png",
"res/textures/skybox/snow/front.png",
"res/textures/skybox/snow/back.png"
}, Texture::AUTO, false);
if(!this->_meshProgram.usable()) {
Source vert("res/shaders/scene/Color.vert", Source::Categorie::VERTEX);
Source frag("res/shaders/scene/Color.frag", Source::Categorie::FRAGMENT);
......@@ -98,6 +107,8 @@ namespace pg::scene {
// --------
this->_skybox.draw(camera);
this->_meshProgram.use();
glm::mat4 model = glm::mat4(1.f);
......@@ -144,16 +155,16 @@ namespace pg::scene {
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
if(this->isRenderEnable()) {
this->_billboard.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
particle_accumulator += 1024;
}
// --------
}
void MeshGenerator::destroy() {
......
......@@ -6,6 +6,7 @@
#include <memory>
#include "../../Mesh/Mesh.hpp"
#include "../../Mesh/Skybox.hpp"
#include "../../Mesh/Billboard.hpp"
#include "../../Renderer/Renderer.hpp"
#include "../../Particle/generator/PhysicsGenerator.hpp"
......@@ -15,6 +16,7 @@ namespace pg::scene {
class MeshGenerator : public SceneParticle {
private:
Mesh _mesh;
SkyBox _skybox;
Program _meshProgram;
glm::vec3 _meshPosition;
glm::vec3 _meshRotation;
......
......@@ -26,6 +26,15 @@ namespace pg::scene {
this->changeMesh("res/models/sphere.obj");
}
this->_skybox.load({
"res/textures/skybox/snow/right.png",
"res/textures/skybox/snow/left.png",
"res/textures/skybox/snow/top.png",
"res/textures/skybox/snow/bottom.png",
"res/textures/skybox/snow/front.png",
"res/textures/skybox/snow/back.png"
}, Texture::AUTO, false);
if(!this->_meshParticle.isGenerated()) {
this->changeMeshParticle("res/models/sphere.obj");
}
......@@ -116,8 +125,6 @@ namespace pg::scene {
pg::error::OpenGLError::check();
// --------
size_t particle_accumulator = 0;
while(particle_accumulator < this->_particles.size()) {
std::vector<glm::mat4> models;
......@@ -142,9 +149,11 @@ namespace pg::scene {
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
if(this->isRenderEnable()) {
this->_meshParticle.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
......
......@@ -6,6 +6,7 @@
#include <memory>
#include "../../Mesh/Mesh.hpp"
#include "../../Mesh/Skybox.hpp"
#include "../../Mesh/Billboard.hpp"
#include "../../Renderer/Renderer.hpp"
#include "../../Particle/generator/PhysicsGenerator.hpp"
......@@ -21,6 +22,7 @@ namespace pg::scene {
private:
Mesh _mesh;
Program _meshProgram;
SkyBox _skybox;
glm::vec3 _meshPosition;
glm::vec3 _meshRotation;
......
......@@ -23,6 +23,15 @@ namespace pg::scene {
}
void MultyPath::initialize() {
this->_skybox.load({
"res/textures/skybox/snow/right.png",
"res/textures/skybox/snow/left.png",
"res/textures/skybox/snow/top.png",
"res/textures/skybox/snow/bottom.png",
"res/textures/skybox/snow/front.png",
"res/textures/skybox/snow/back.png"
}, Texture::AUTO, false);
this->_billboard.initialize();
this->_trajectory.initialize();
if(!this->_program.usable()) {
......@@ -88,6 +97,8 @@ namespace pg::scene {
const glm::mat4 VIEW_MATRIX = camera.getViewMatrix();
const glm::mat4 PROJECTION_MATRIX = camera.getViewFrustum().getProjectionMatrix();
this->_skybox.draw(camera);
this->_trajectory.render(camera, current_time);
pg::error::OpenGLError::check();
......@@ -113,10 +124,12 @@ namespace pg::scene {
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
this->_texture.bind();
if(this->isRenderEnable()) {
this->_billboard.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
}
......
......@@ -3,6 +3,7 @@
#include "../Scene.hpp"
#include "../../Renderer/Renderer.hpp"
#include "../../Mesh/Skybox.hpp"
#include "../../Particle/generator/PathMultyGenerator.hpp"
#include "../../Mesh/Billboard.hpp"
#include "TrajectoryMulty.hpp"
......@@ -12,6 +13,7 @@
namespace pg::scene {
class MultyPath : public SceneParticle {
private:
SkyBox _skybox;
GLuint _ubo;
Program _program;
Billboard _billboard;
......
......@@ -10,7 +10,7 @@ namespace pg::scene {
_program(),
_texture(),
_generator(generator, ctrlpoint),
_trajectory(&this->_generator),
_trajectory(&this->_generator, 0.01),
_color(1.f),
_interface(this, &this->_generator, &this->_trajectory) {}
......@@ -104,10 +104,12 @@ namespace pg::scene {
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
this->_texture.bind();
if(this->isRenderEnable()) {
this->_billboard.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
}
......
......@@ -130,10 +130,12 @@ namespace pg::scene {
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
this->_texture.bind();
if(this->isRenderEnable()) {
this->_mesh.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
glDisable(GL_DEPTH_TEST);
......
......@@ -104,9 +104,11 @@ namespace pg::scene {
pg::error::OpenGLError::check();
this->_texture.bind();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
if(this->isRenderEnable()) {
this->_billboard.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
}
......
......@@ -98,10 +98,11 @@ namespace pg::scene {
this->_program.setUniform("uColor", this->_color);
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
if(this->isRenderEnable()) {
this->_billboards.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
}
......
......@@ -109,10 +109,11 @@ namespace pg::scene {
this->_program.setUniform("uColor", this->_color);
pg::error::OpenGLError::check();
glPolygonMode(GL_FRONT_AND_BACK, this->isWireframeEnable() ? GL_LINE : GL_FILL);
if(this->isRenderEnable()) {
this->_billboards.draw(this->_particles.size());
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pg::error::OpenGLError::check();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment