History

Merge branch 'master' of https://github.com/highfidelity/hifi into cuckoo

Stephen Birarda committed 11 years ago

Commit 737741c2 parents a3cc578 61ec1bd103 files · +893 −542Browse files

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

Unified · Split

interface/src/MetavoxelSystem.cpp+28−25
@@ -21,17 +21,18 @@ · 20 unmodified lines
2121
2222 #include <glm/gtx/transform.hpp>
2323
24+#include <DeferredLightingEffect.h>
2425 #include <GeometryUtil.h>
26+#include <Model.h>
2527 #include <SharedUtil.h>
2628
2729 #include <MetavoxelMessages.h>
2830 #include <MetavoxelUtil.h>
31+#include <PathUtils.h>
2932 #include <ScriptCache.h>
3033
3134 #include "Application.h"
3235 #include "MetavoxelSystem.h"
33−#include "renderer/Model.h"
34−#include "renderer/RenderUtil.h"
3536
3637 REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation)
3738 REGISTER_META_OBJECT(SphereRenderer)
@@ -63,9 +64,9 @@ void MetavoxelSystem::init() { · 25 unmodified lines
6364 _voxelBufferAttribute->setLODThresholdMultiplier(
6465 AttributeRegistry::getInstance()->getVoxelColorAttribute()->getLODThresholdMultiplier());
6566
66− _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
67+ _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
6768 "shaders/metavoxel_heightfield_base.vert");
68− _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
69+ _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
6970 "shaders/metavoxel_heightfield_base.frag");
7071 _baseHeightfieldProgram.link();
7172
@@ -78,9 +79,9 @@ void MetavoxelSystem::init() { · 6 unmodified lines
7879
7980 loadSplatProgram("heightfield", _splatHeightfieldProgram, _splatHeightfieldLocations);
8081
81− _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
82+ _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
8283 "shaders/metavoxel_heightfield_cursor.vert");
83− _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
84+ _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
8485 "shaders/metavoxel_cursor.frag");
8586 _heightfieldCursorProgram.link();
8687
@@ -88,17 +89,17 @@ void MetavoxelSystem::init() { · 1 unmodified line
8889 _heightfieldCursorProgram.setUniformValue("heightMap", 0);
8990 _heightfieldCursorProgram.release();
9091
91− _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
92+ _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
9293 "shaders/metavoxel_voxel_base.vert");
93− _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
94+ _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
9495 "shaders/metavoxel_voxel_base.frag");
9596 _baseVoxelProgram.link();
9697
9798 loadSplatProgram("voxel", _splatVoxelProgram, _splatVoxelLocations);
9899
99− _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
100+ _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
100101 "shaders/metavoxel_voxel_cursor.vert");
101− _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
102+ _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
102103 "shaders/metavoxel_cursor.frag");
103104 _voxelCursorProgram.link();
104105 }
@@ -205,7 +206,7 @@ void MetavoxelSystem::render() { · 100 unmodified lines
205206 glEnableClientState(GL_VERTEX_ARRAY);
206207 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
207208
208− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true);
209+ DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, true);
209210
210211 glDisable(GL_BLEND);
211212 glEnable(GL_CULL_FACE);
@@ -251,7 +252,7 @@ void MetavoxelSystem::render() { · 39 unmodified lines
251252 glPopMatrix();
252253 }
253254
254− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
255+ DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, false);
255256
256257 _baseHeightfieldProgram.release();
257258
@@ -348,7 +349,7 @@ void MetavoxelSystem::render() { · 90 unmodified lines
348349 }
349350
350351 if (!_voxelBaseBatches.isEmpty()) {
351− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true);
352+ DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, true);
352353
353354 glEnableClientState(GL_VERTEX_ARRAY);
354355 glDisable(GL_BLEND);
@@ -383,7 +384,7 @@ void MetavoxelSystem::render() { · 28 unmodified lines
383384 glDisable(GL_ALPHA_TEST);
384385 glEnable(GL_BLEND);
385386
386− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
387+ DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, false);
387388
388389 if (!_voxelSplatBatches.isEmpty()) {
389390 glDepthFunc(GL_LEQUAL);
@@ -463,14 +464,14 @@ void MetavoxelSystem::render() { · 73 unmodified lines
463464 }
464465
465466 if (!_hermiteBatches.isEmpty() && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHermiteData)) {
466− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true);
467+ DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, true);
467468
468469 glEnableClientState(GL_VERTEX_ARRAY);
469470
470471 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
471472 glNormal3f(0.0f, 1.0f, 0.0f);
472473
473− Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();
474+ DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
474475
475476 foreach (const HermiteBatch& batch, _hermiteBatches) {
476477 batch.vertexBuffer->bind();
@@ -482,11 +483,11 @@ void MetavoxelSystem::render() { · 5 unmodified lines
482483 batch.vertexBuffer->release();
483484 }
484485
485− Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();
486+ DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
486487
487488 glDisableClientState(GL_VERTEX_ARRAY);
488489
489− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
490+ DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, false);
490491 }
491492 _hermiteBatches.clear();
492493
@@ -797,7 +798,7 @@ void MetavoxelSystem::applyMaterialEdit(const MetavoxelEditMessage& message, boo · 304 unmodified lines
797798 Q_ARG(bool, reliable));
798799 return;
799800 }
800− QSharedPointer<NetworkTexture> texture = Application::getInstance()->getTextureCache()->getTexture(
801+ QSharedPointer<NetworkTexture> texture = DependencyManager::get<TextureCache>()->getTexture(
801802 material->getDiffuse(), SPLAT_TEXTURE);
802803 if (texture->isLoaded()) {
803804 MetavoxelEditMessage newMessage = message;
@@ -836,9 +837,9 @@ void MetavoxelSystem::guideToAugmented(MetavoxelVisitor& visitor, bool render) { · 32 unmodified lines
836837 }
837838
838839 void MetavoxelSystem::loadSplatProgram(const char* type, ProgramObject& program, SplatLocations& locations) {
839− program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
840+ program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
840841 "shaders/metavoxel_" + type + "_splat.vert");
841− program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
842+ program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
842843 "shaders/metavoxel_" + type + "_splat.frag");
843844 program.link();
844845
@@ -1177,10 +1178,11 @@ void VoxelBuffer::render(bool cursor) { · 332 unmodified lines
11771178
11781179 if (!_materials.isEmpty()) {
11791180 _networkTextures.resize(_materials.size());
1181+ TextureCache* textureCache = DependencyManager::get<TextureCache>();
11801182 for (int i = 0; i < _materials.size(); i++) {
11811183 const SharedObjectPointer material = _materials.at(i);
11821184 if (material) {
1183− _networkTextures[i] = Application::getInstance()->getTextureCache()->getTexture(
1185+ _networkTextures[i] = textureCache->getTexture(
11841186 static_cast<MaterialObject*>(material.data())->getDiffuse(), SPLAT_TEXTURE);
11851187 }
11861188 }
@@ -1980,7 +1982,7 @@ void SphereRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor · 793 unmodified lines
19801982 glm::vec3 axis = glm::axis(rotation);
19811983 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
19821984
1983− Application::getInstance()->getDeferredLightingEffect()->renderSolidSphere(sphere->getScale(), 32, 32);
1985+ DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(sphere->getScale(), 32, 32);
19841986
19851987 glPopMatrix();
19861988 }
@@ -2001,7 +2003,7 @@ void CuboidRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor · 14 unmodified lines
20012003 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
20022004 glScalef(1.0f, cuboid->getAspectY(), cuboid->getAspectZ());
20032005
2004− Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(cuboid->getScale() * 2.0f);
2006+ DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(cuboid->getScale() * 2.0f);
20052007
20062008 glPopMatrix();
20072009 }
@@ -2231,10 +2233,11 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g · 223 unmodified lines
22312233
22322234 const QVector<SharedObjectPointer>& materials = node->getMaterial()->getMaterials();
22332235 _networkTextures.resize(materials.size());
2236+ TextureCache* textureCache = DependencyManager::get<TextureCache>();
22342237 for (int i = 0; i < materials.size(); i++) {
22352238 const SharedObjectPointer& material = materials.at(i);
22362239 if (material) {
2237− _networkTextures[i] = Application::getInstance()->getTextureCache()->getTexture(
2240+ _networkTextures[i] = textureCache->getTexture(
22382241 static_cast<MaterialObject*>(material.data())->getDiffuse(), SPLAT_TEXTURE);
22392242 }
22402243 }

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