From ac3a963eca78f064c472b6fa5b0f74d6ff58e490 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 29 Oct 2014 12:01:43 -0700 Subject: [PATCH] fix build buster --- interface/src/renderer/Model.cpp | 88 +++++++++++++++++++++----------- interface/src/renderer/Model.h | 2 +- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index a934a2a79f..fc99970fea 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -35,6 +35,7 @@ using namespace std; static int modelPointerTypeId = qRegisterMetaType >(); static int weakNetworkGeometryPointerTypeId = qRegisterMetaType >(); static int vec3VectorTypeId = qRegisterMetaType >(); +float Model::FAKE_DIMENSION_PLACEHOLDER = -1.0f; Model::Model(QObject* parent) : QObject(parent), @@ -123,35 +124,64 @@ void Model::setOffset(const glm::vec3& offset) { void Model::initProgram(ProgramObject& program, Model::Locations& locations, int specularTextureUnit) { program.bind(); -#ifdef Q_OS_MAC - // HACK: Assign explicitely the attribute channel to avoid a bug on Yosemite - glBindAttribLocation(program.programId(), 4, "tangent"); - glLinkProgram(program.programId()); -#endif - - locations.tangent = program.attributeLocation("tangent"); - locations.alphaThreshold = program.uniformLocation("alphaThreshold"); - program.setUniformValue("diffuseMap", 0); - program.setUniformValue("normalMap", 1); - program.setUniformValue("specularMap", specularTextureUnit); - program.release(); -} - -void Model::initSkinProgram(ProgramObject& program, Model::SkinLocations& locations, int specularTextureUnit) { - initProgram(program, locations, specularTextureUnit); - -#ifdef Q_OS_MAC - // HACK: Assign explicitely the attribute channel to avoid a bug on Yosemite - glBindAttribLocation(program.programId(), 5, "clusterIndices"); - glBindAttribLocation(program.programId(), 6, "clusterWeights"); - glLinkProgram(program.programId()); -#endif - - program.bind(); - locations.clusterMatrices = program.uniformLocation("clusterMatrices"); - - locations.clusterIndices = program.attributeLocation("clusterIndices"); - locations.clusterWeights = program.attributeLocation("clusterWeights"); +#ifdef Q_OS_MAC + + // HACK: Assign explicitely the attribute channel to avoid a bug on Yosemite + + glBindAttribLocation(program.programId(), 4, "tangent"); + + glLinkProgram(program.programId()); + +#endif + + + + locations.tangent = program.attributeLocation("tangent"); + + locations.alphaThreshold = program.uniformLocation("alphaThreshold"); + + program.setUniformValue("diffuseMap", 0); + + program.setUniformValue("normalMap", 1); + + program.setUniformValue("specularMap", specularTextureUnit); + + program.release(); + +} + + + +void Model::initSkinProgram(ProgramObject& program, Model::SkinLocations& locations, int specularTextureUnit) { + + initProgram(program, locations, specularTextureUnit); + + + +#ifdef Q_OS_MAC + + // HACK: Assign explicitely the attribute channel to avoid a bug on Yosemite + + glBindAttribLocation(program.programId(), 5, "clusterIndices"); + + glBindAttribLocation(program.programId(), 6, "clusterWeights"); + + glLinkProgram(program.programId()); + +#endif + + + + program.bind(); + + locations.clusterMatrices = program.uniformLocation("clusterMatrices"); + + + + locations.clusterIndices = program.attributeLocation("clusterIndices"); + + locations.clusterWeights = program.attributeLocation("clusterWeights"); + program.release(); } diff --git a/interface/src/renderer/Model.h b/interface/src/renderer/Model.h index d25273cfe7..9892a12c9d 100644 --- a/interface/src/renderer/Model.h +++ b/interface/src/renderer/Model.h @@ -199,7 +199,7 @@ protected: glm::vec3 _scale; glm::vec3 _offset; - const float FAKE_DIMENSION_PLACEHOLDER = -1.0f; + static float FAKE_DIMENSION_PLACEHOLDER; bool _scaleToFit; /// If you set scaleToFit, we will calculate scale based on MeshExtents glm::vec3 _scaleToFitDimensions; /// this is the dimensions that scale to fit will use