History

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

Atlante45 committed 11 years ago

Commit 11a2eca2 parents 2039895 7632dbe92 files · +607 −340Browse files

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

Unified · Split

interface/src/MetavoxelSystem.cpp+17−16
@@ -21,17 +21,18 @@ · 20 unmodified lines
21 21
22#include <glm/gtx/transform.hpp>22#include <glm/gtx/transform.hpp>
23 23
24#include <DeferredLightingEffect.h>
24#include <GeometryUtil.h>25#include <GeometryUtil.h>
26#include <Model.h>
25#include <SharedUtil.h>27#include <SharedUtil.h>
26 28
27#include <MetavoxelMessages.h>29#include <MetavoxelMessages.h>
28#include <MetavoxelUtil.h>30#include <MetavoxelUtil.h>
31#include <PathUtils.h>
29#include <ScriptCache.h>32#include <ScriptCache.h>
30 33
31#include "Application.h"34#include "Application.h"
32#include "MetavoxelSystem.h"35#include "MetavoxelSystem.h"
33#include "renderer/Model.h"
34#include "renderer/RenderUtil.h"
35 36
36REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation)37REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation)
37REGISTER_META_OBJECT(SphereRenderer)38REGISTER_META_OBJECT(SphereRenderer)
@@ -63,9 +64,9 @@ void MetavoxelSystem::init() { · 25 unmodified lines
63 _voxelBufferAttribute->setLODThresholdMultiplier(64 _voxelBufferAttribute->setLODThresholdMultiplier(
64 AttributeRegistry::getInstance()->getVoxelColorAttribute()->getLODThresholdMultiplier());65 AttributeRegistry::getInstance()->getVoxelColorAttribute()->getLODThresholdMultiplier());
65 66
66 _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +67 _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
67 "shaders/metavoxel_heightfield_base.vert");68 "shaders/metavoxel_heightfield_base.vert");
68 _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +69 _baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
69 "shaders/metavoxel_heightfield_base.frag");70 "shaders/metavoxel_heightfield_base.frag");
70 _baseHeightfieldProgram.link();71 _baseHeightfieldProgram.link();
71 72
@@ -78,9 +79,9 @@ void MetavoxelSystem::init() { · 6 unmodified lines
78 79
79 loadSplatProgram("heightfield", _splatHeightfieldProgram, _splatHeightfieldLocations);80 loadSplatProgram("heightfield", _splatHeightfieldProgram, _splatHeightfieldLocations);
80 81
81 _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +82 _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
82 "shaders/metavoxel_heightfield_cursor.vert");83 "shaders/metavoxel_heightfield_cursor.vert");
83 _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +84 _heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
84 "shaders/metavoxel_cursor.frag");85 "shaders/metavoxel_cursor.frag");
85 _heightfieldCursorProgram.link();86 _heightfieldCursorProgram.link();
86 87
@@ -88,17 +89,17 @@ void MetavoxelSystem::init() { · 1 unmodified line
88 _heightfieldCursorProgram.setUniformValue("heightMap", 0);89 _heightfieldCursorProgram.setUniformValue("heightMap", 0);
89 _heightfieldCursorProgram.release();90 _heightfieldCursorProgram.release();
90 91
91 _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +92 _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
92 "shaders/metavoxel_voxel_base.vert");93 "shaders/metavoxel_voxel_base.vert");
93 _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +94 _baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
94 "shaders/metavoxel_voxel_base.frag");95 "shaders/metavoxel_voxel_base.frag");
95 _baseVoxelProgram.link();96 _baseVoxelProgram.link();
96 97
97 loadSplatProgram("voxel", _splatVoxelProgram, _splatVoxelLocations);98 loadSplatProgram("voxel", _splatVoxelProgram, _splatVoxelLocations);
98 99
99 _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +100 _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
100 "shaders/metavoxel_voxel_cursor.vert");101 "shaders/metavoxel_voxel_cursor.vert");
101 _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +102 _voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
102 "shaders/metavoxel_cursor.frag");103 "shaders/metavoxel_cursor.frag");
103 _voxelCursorProgram.link();104 _voxelCursorProgram.link();
104}105}
@@ -470,7 +471,7 @@ void MetavoxelSystem::render() { · 365 unmodified lines
470 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);471 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
471 glNormal3f(0.0f, 1.0f, 0.0f);472 glNormal3f(0.0f, 1.0f, 0.0f);
472 473
473 Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();474 DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
474 475
475 foreach (const HermiteBatch& batch, _hermiteBatches) {476 foreach (const HermiteBatch& batch, _hermiteBatches) {
476 batch.vertexBuffer->bind();477 batch.vertexBuffer->bind();
@@ -482,7 +483,7 @@ void MetavoxelSystem::render() { · 5 unmodified lines
482 batch.vertexBuffer->release();483 batch.vertexBuffer->release();
483 }484 }
484 485
485 Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();486 DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
486 487
487 glDisableClientState(GL_VERTEX_ARRAY);488 glDisableClientState(GL_VERTEX_ARRAY);
488 489
@@ -836,9 +837,9 @@ void MetavoxelSystem::guideToAugmented(MetavoxelVisitor& visitor, bool render) { · 347 unmodified lines
836}837}
837 838
838void MetavoxelSystem::loadSplatProgram(const char* type, ProgramObject& program, SplatLocations& locations) {839void MetavoxelSystem::loadSplatProgram(const char* type, ProgramObject& program, SplatLocations& locations) {
839 program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +840 program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
840 "shaders/metavoxel_" + type + "_splat.vert");841 "shaders/metavoxel_" + type + "_splat.vert");
841 program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +842 program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
842 "shaders/metavoxel_" + type + "_splat.frag");843 "shaders/metavoxel_" + type + "_splat.frag");
843 program.link();844 program.link();
844 845
@@ -1981,7 +1982,7 @@ void SphereRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor · 1136 unmodified lines
1981 glm::vec3 axis = glm::axis(rotation);1982 glm::vec3 axis = glm::axis(rotation);
1982 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);1983 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
1983 1984
1984 Application::getInstance()->getDeferredLightingEffect()->renderSolidSphere(sphere->getScale(), 32, 32);1985 DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(sphere->getScale(), 32, 32);
1985 1986
1986 glPopMatrix();1987 glPopMatrix();
1987}1988}
@@ -2002,7 +2003,7 @@ void CuboidRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor · 14 unmodified lines
2002 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);2003 glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
2003 glScalef(1.0f, cuboid->getAspectY(), cuboid->getAspectZ());2004 glScalef(1.0f, cuboid->getAspectY(), cuboid->getAspectZ());
2004 2005
2005 Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(cuboid->getScale() * 2.0f);2006 DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(cuboid->getScale() * 2.0f);
2006 2007
2007 glPopMatrix();2008 glPopMatrix();
2008}2009}

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