mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 08:43:52 +02:00
No more Magic numbers and fixing the code path for linux
This commit is contained in:
parent
8634d86167
commit
6b55b4ff82
3 changed files with 15 additions and 3 deletions
|
@ -498,9 +498,12 @@ void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) {
|
||||||
// NOT working so we ll stick to the uniform float array until we move to core profile
|
// NOT working so we ll stick to the uniform float array until we move to core profile
|
||||||
// GLuint bo = getBufferID(*uniformBuffer);
|
// GLuint bo = getBufferID(*uniformBuffer);
|
||||||
//glUniformBufferEXT(_shader._program, slot, bo);
|
//glUniformBufferEXT(_shader._program, slot, bo);
|
||||||
#else
|
#elif defined(Q_OS_WIN)
|
||||||
GLuint bo = getBufferID(*uniformBuffer);
|
GLuint bo = getBufferID(*uniformBuffer);
|
||||||
glBindBufferRange(GL_UNIFORM_BUFFER, slot, bo, rangeStart, rangeSize);
|
glBindBufferRange(GL_UNIFORM_BUFFER, slot, bo, rangeStart, rangeSize);
|
||||||
|
#else
|
||||||
|
GLfloat* data = (GLfloat*) (uniformBuffer->getData() + rangeStart);
|
||||||
|
glUniform4fv(slot, rangeSize / sizeof(GLfloat[4]), data);
|
||||||
#endif
|
#endif
|
||||||
CHECK_GL_ERROR();
|
CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,8 @@ public:
|
||||||
glm::vec3 L21 ; float spare7;
|
glm::vec3 L21 ; float spare7;
|
||||||
glm::vec3 L22 ; float spare8;
|
glm::vec3 L22 ; float spare8;
|
||||||
|
|
||||||
|
static const int NUM_COEFFICIENTS = 9;
|
||||||
|
|
||||||
void assignPreset(int p) {
|
void assignPreset(int p) {
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case DeferredLightingEffect::OLD_TOWN_SQUARE: {
|
case DeferredLightingEffect::OLD_TOWN_SQUARE: {
|
||||||
|
@ -387,7 +389,7 @@ void DeferredLightingEffect::render() {
|
||||||
sh.assignPreset(0);
|
sh.assignPreset(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i =0; i <9; i++) {
|
for (int i =0; i <SphericalHarmonics::NUM_COEFFICIENTS; i++) {
|
||||||
program->setUniformValue(locations->ambientSphere + i, *(((QVector4D*) &sh) + i));
|
program->setUniformValue(locations->ambientSphere + i, *(((QVector4D*) &sh) + i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ void Model::initProgram(ProgramObject& program, Model::Locations& locations, boo
|
||||||
} else {
|
} else {
|
||||||
locations.materialBufferUnit = -1;
|
locations.materialBufferUnit = -1;
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(Q_OS_WIN)
|
||||||
loc = glGetUniformBlockIndex(program.programId(), "materialBuffer");
|
loc = glGetUniformBlockIndex(program.programId(), "materialBuffer");
|
||||||
if (loc >= 0) {
|
if (loc >= 0) {
|
||||||
glUniformBlockBinding(program.programId(), loc, 1);
|
glUniformBlockBinding(program.programId(), loc, 1);
|
||||||
|
@ -214,6 +214,13 @@ void Model::initProgram(ProgramObject& program, Model::Locations& locations, boo
|
||||||
} else {
|
} else {
|
||||||
locations.materialBufferUnit = -1;
|
locations.materialBufferUnit = -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
loc = program.uniformLocation("materialBuffer");
|
||||||
|
if (loc >= 0) {
|
||||||
|
locations.materialBufferUnit = loc;
|
||||||
|
} else {
|
||||||
|
locations.materialBufferUnit = -1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!program.isLinked()) {
|
if (!program.isLinked()) {
|
||||||
|
|
Loading…
Reference in a new issue