Skip to content
Snippets Groups Projects
Commit b3336636 authored by BATON Theau's avatar BATON Theau
Browse files

Add generator selection for mesh generator scene

parent f322c5fc
No related branches found
No related tags found
No related merge requests found
ParticleGenerator/res/textures/grid.png

11.5 KiB | W: | H:

ParticleGenerator/res/textures/grid.png

11.5 KiB | W: | H:

ParticleGenerator/res/textures/grid.png
ParticleGenerator/res/textures/grid.png
ParticleGenerator/res/textures/grid.png
ParticleGenerator/res/textures/grid.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -11,6 +11,10 @@ namespace pg {
: _generator(generator) {}
void PhysicGeneratorInterface::render(double) {
if(this->_generator == nullptr) {
return;
}
if(ImGui::CollapsingHeader("Generator Information")) {
ImGui::Text("Physic generator at %f / %f / %f (x, y, z) - variation : %f.", this->_generator->m_position.x, this->_generator->m_position.y, this->_generator->m_position.z, this->_generator->m_positionVariation);
ImGui::SeparatorText("Velocity");
......
......@@ -12,6 +12,7 @@ namespace pg {
PhysicGeneratorInterface(PhysicsParticleGenerator *);
inline PhysicsParticleGenerator * getGenerator() const {return this->_generator;}
inline void setGenerator(PhysicsParticleGenerator * generator) {this->_generator = generator;}
virtual void render(double);
inline std::string title() const {return "Physic Generator Interface";}
......
......@@ -7,6 +7,7 @@
namespace pg {
MeshGeneratorInterface::MeshGeneratorInterface(scene::MeshGenerator * scene, size_t max)
: _scene(scene),
_interface(nullptr),
_max(max),
_spawnFrequence(2500),
_spawnCount(1),
......@@ -49,5 +50,30 @@ namespace pg {
}
}
ImGui::SeparatorText("Generators");
if(!this->_scene->_generators.empty()) {
std::string name = std::to_string(reinterpret_cast<intptr_t>(&this->_scene->_generators.front()));
if(this->_interface.getGenerator() != nullptr) {
name = std::to_string(reinterpret_cast<intptr_t>(this->_interface.getGenerator()));
}
if(ImGui::BeginCombo("Current Generator", name.c_str())) {
for(auto & generator : this->_scene->_generators) {
bool is_selected = std::to_string(reinterpret_cast<intptr_t>(&generator)) == std::to_string(reinterpret_cast<intptr_t>(this->_interface.getGenerator()));
if(ImGui::Selectable(std::to_string(reinterpret_cast<intptr_t>(&generator)).c_str(), is_selected)) {
this->_interface.setGenerator(&generator);
}
if (is_selected) {
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
}
this->_interface.render(current_time);
}
}
\ No newline at end of file
#pragma once
#include "../Interface.hpp"
#include "../Generator/PhysicGeneratorInterface.hpp"
namespace pg {
namespace scene {
......@@ -10,6 +11,7 @@ namespace pg {
class MeshGeneratorInterface : public Interface {
private:
scene::MeshGenerator * _scene;
PhysicGeneratorInterface _interface;
size_t _max;
int _spawnFrequence;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment