Commit a446dc04 authored by bbguimaraes's avatar bbguimaraes
Browse files

sms: make texturing a per-simulation option

parent b09e2c65
......@@ -11,10 +11,14 @@ class Simulation {
bool m_paused;
bool m_draw_masses;
bool m_textured;
bool m_texturable;
public:
Simulation() : m_paused(false), m_draw_masses(true), m_textured(false)
{}
Simulation() :
m_paused(false),
m_draw_masses(true),
m_textured(false),
m_texturable(false) {}
const std::vector<SpringMassSystem *> * systems() const
{return &this->m_systems;}
......@@ -22,6 +26,7 @@ class Simulation {
bool paused() const {return this->m_paused;}
bool draw_masses() const {return this->m_draw_masses;}
bool textured() const {return this->m_textured;}
bool texturable() const {return this->m_texturable;}
void set_systems(const std::vector<SpringMassSystem *> & v)
{this->m_systems = v;}
......@@ -29,6 +34,7 @@ class Simulation {
void set_paused(bool p) {this->m_paused = p;}
void set_draw_masses(bool d) {this->m_draw_masses = d;}
void set_textured(bool t) {this->m_textured = t;}
void set_texturable(bool t) {this->m_texturable = t;}
void update();
};
......
......@@ -155,7 +155,8 @@ void Display::keyPressEvent(QKeyEvent * event) {
break;
case 'T':
for(auto x : this->m_simulations)
x->set_textured(!x->textured());
if(x->texturable())
x->set_textured(!x->textured());
break;
case Qt::Key_Control:
this->m_ctrl_key_down = true;
......
......@@ -27,6 +27,8 @@ int main(int argc, char ** argv) {
simulations[1].set_paused(true);
simulations[0].set_update_rate(UPDATE_RATE);
simulations[1].set_update_rate(UPDATE_RATE);
simulations[0].set_texturable(true);
simulations[1].set_texturable(true);
for(auto & mass : *sms0.masses())
mass.set_position(mass.position() + Vector(-10.0f));
for(auto & mass : *sms1.masses())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment