mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
commit
b1bf83e0a4
1 changed files with 29 additions and 14 deletions
|
@ -122,21 +122,36 @@ void Model::setOffset(const glm::vec3& offset) {
|
|||
|
||||
void Model::initProgram(ProgramObject& program, Model::Locations& locations, int specularTextureUnit) {
|
||||
program.bind();
|
||||
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);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue