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
2020 #include "MetavoxelSystem.h"
2121 #include "renderer/Model.h"
2222
23+REGISTER_META_OBJECT(SphereRenderer)
2324 REGISTER_META_OBJECT(StaticModelRenderer)
2425
2526 ProgramObject MetavoxelSystem::_program;
@@ -256,6 +257,26 @@ void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) { · 230 unmodified lines
256257 }
257258 }
258259
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+
259280 StaticModelRenderer::StaticModelRenderer() :
260281 _model(new Model(this)) {
261282 }

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