History

Added spheres as simpler spanners for testing.

Andrzej Kapolka committed 12 years ago

Commit 4130d0f1 parent 61a7c614 files · +85 −0Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 4 files). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+21−0
@@ -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
23REGISTER_META_OBJECT(SphereRenderer)
23REGISTER_META_OBJECT(StaticModelRenderer)24REGISTER_META_OBJECT(StaticModelRenderer)
24 25
25ProgramObject MetavoxelSystem::_program;26ProgramObject MetavoxelSystem::_program;
@@ -256,6 +257,26 @@ void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) { · 230 unmodified lines
256 }257 }
257}258}
258 259
260SphereRenderer::SphereRenderer() {
261}
262
263void 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
259StaticModelRenderer::StaticModelRenderer() :280StaticModelRenderer::StaticModelRenderer() :
260 _model(new Model(this)) {281 _model(new Model(this)) {
261}282}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t