Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 4 files). Show all
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include "MetavoxelSystem.h" | 20 | #include "MetavoxelSystem.h" |
| 21 | #include "renderer/Model.h" | 21 | #include "renderer/Model.h" |
| 22 | 22 | ||
| 23 | REGISTER_META_OBJECT(SphereRenderer) | ||
| 23 | REGISTER_META_OBJECT(StaticModelRenderer) | 24 | REGISTER_META_OBJECT(StaticModelRenderer) |
| 24 | 25 | ||
| 25 | ProgramObject MetavoxelSystem::_program; | 26 | ProgramObject MetavoxelSystem::_program; |
| @@ -256,6 +257,26 @@ void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) { · 230 unmodified lines | |||
| 256 | } | 257 | } |
| 257 | } | 258 | } |
| 258 | 259 | ||
| 260 | SphereRenderer::SphereRenderer() { | ||
| 261 | } | ||
| 262 | |||
| 263 | void SphereRenderer::render(float alpha) { | ||
| 264 | Sphere* sphere = static_cast<Sphere*>(parent()); | ||
| 265 | const QColor& color = sphere->getColor(); | ||
| 266 | glColor4f(color.redF(), color.greenF(), color.blueF(), color.alphaF() * alpha); | ||
| 267 | |||
| 268 | glPushMatrix(); | ||
| 269 | const glm::vec3& translation = sphere->getTranslation(); | ||
| 270 | glTranslatef(translation.x, translation.y, translation.z); | ||
| 271 | glm::quat rotation = glm::quat(glm::radians(sphere->getRotation())); | ||
| 272 | glm::vec3 axis = glm::axis(rotation); | ||
| 273 | glRotatef(glm::angle(rotation), axis.x, axis.y, axis.z); | ||
| 274 | |||
| 275 | glutSolidSphere(sphere->getScale(), 10, 10); | ||
| 276 | |||
| 277 | glPopMatrix(); | ||
| 278 | } | ||
| 279 | |||
| 259 | StaticModelRenderer::StaticModelRenderer() : | 280 | StaticModelRenderer::StaticModelRenderer() : |
| 260 | _model(new Model(this)) { | 281 | _model(new Model(this)) { |
| 261 | } | 282 | } |