| 72 | ); |
| 73 | |
| 74 | class NBodyWidget : public QGLWidget |
| 75 | { |
| 76 | Q_OBJECT |
| 77 | |
| 78 | public: |
| 79 | NBodyWidget(std::size_t particles, float dt, QWidget* parent = 0); |
| 80 | ~NBodyWidget(); |
| 81 | |
| 82 | void initializeGL(); |
| 83 | void resizeGL(int width, int height); |
| 84 | void paintGL(); |
| 85 | void updateParticles(); |
| 86 | void keyPressEvent(QKeyEvent* event); |
| 87 | |
| 88 | private: |
| 89 | QTimer* timer; |
| 90 | |
| 91 | compute::context m_context; |
| 92 | compute::command_queue m_queue; |
| 93 | compute::program m_program; |
| 94 | compute::opengl_buffer m_position; |
| 95 | compute::vector<float4_>* m_velocity; |
| 96 | compute::kernel m_velocity_kernel; |
| 97 | compute::kernel m_position_kernel; |
| 98 | |
| 99 | bool m_initial_draw; |
| 100 | |
| 101 | const uint_ m_particles; |
| 102 | const float m_dt; |
| 103 | }; |
| 104 | |
| 105 | NBodyWidget::NBodyWidget(std::size_t particles, float dt, QWidget* parent) |
| 106 | : QGLWidget(parent), m_initial_draw(true), m_particles(particles), m_dt(dt) |
nothing calls this directly
no outgoing calls
no test coverage detected