mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:29:01 +02:00
cleaning up for pull request
This commit is contained in:
parent
80784a7a33
commit
4151833549
3 changed files with 18 additions and 42 deletions
|
@ -59,7 +59,7 @@ vec3 evalDirectionalColor(float shadowAttenuation, vec3 position, vec3 normal, v
|
||||||
// Diffuse Lighting
|
// Diffuse Lighting
|
||||||
float diffuseDot = dot(normal, gl_LightSource[0].position.xyz);
|
float diffuseDot = dot(normal, gl_LightSource[0].position.xyz);
|
||||||
float facingLight = step(0.0, diffuseDot) * shadowAttenuation;
|
float facingLight = step(0.0, diffuseDot) * shadowAttenuation;
|
||||||
vec3 diffuseColor = diffuse * (gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontLightProduct[0].diffuse.rgb * (diffuseDot * facingLight));
|
vec3 diffuseColor = diffuse * (/*gl_FrontLightModelProduct.sceneColor.rgb +*/ gl_FrontLightProduct[0].diffuse.rgb * (diffuseDot * facingLight));
|
||||||
|
|
||||||
// compute the specular multiplier (sans exponent)
|
// compute the specular multiplier (sans exponent)
|
||||||
float specularPower = facingLight * max(0.0,
|
float specularPower = facingLight * max(0.0,
|
||||||
|
|
|
@ -1768,6 +1768,17 @@ void Model::endScene(RenderMode mode, RenderArgs* args) {
|
||||||
GLBATCH(glCullFace)(GL_BACK);
|
GLBATCH(glCullFace)(GL_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GLBATCH(glActiveTexture)(GL_TEXTURE0 + 1);
|
||||||
|
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
||||||
|
GLBATCH(glActiveTexture)(GL_TEXTURE0 + 2);
|
||||||
|
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
||||||
|
GLBATCH(glActiveTexture)(GL_TEXTURE0 + 3);
|
||||||
|
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
||||||
|
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
||||||
|
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
|
||||||
// deactivate vertex arrays after drawing
|
// deactivate vertex arrays after drawing
|
||||||
GLBATCH(glDisableClientState)(GL_NORMAL_ARRAY);
|
GLBATCH(glDisableClientState)(GL_NORMAL_ARRAY);
|
||||||
GLBATCH(glDisableClientState)(GL_VERTEX_ARRAY);
|
GLBATCH(glDisableClientState)(GL_VERTEX_ARRAY);
|
||||||
|
@ -2437,24 +2448,14 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mesh.tangents.isEmpty()) {
|
if (!mesh.tangents.isEmpty()) {
|
||||||
// GLBATCH(glActiveTexture)(GL_TEXTURE1);
|
|
||||||
Texture* normalMap = networkPart.normalTexture.data();
|
Texture* normalMap = networkPart.normalTexture.data();
|
||||||
/* GLBATCH(glBindTexture)(GL_TEXTURE_2D, !normalMap ?
|
|
||||||
textureCache->getBlueTextureID() : normalMap->getID());
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
|
||||||
*/
|
|
||||||
batch.setUniformTexture(1, !normalMap ?
|
batch.setUniformTexture(1, !normalMap ?
|
||||||
textureCache->getBlueTexture() : normalMap->getGPUTexture());
|
textureCache->getBlueTexture() : normalMap->getGPUTexture());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locations->specularTextureUnit >= 0) {
|
if (locations->specularTextureUnit >= 0) {
|
||||||
// GLBATCH(glActiveTexture)(GL_TEXTURE0 + locations->specularTextureUnit);
|
|
||||||
Texture* specularMap = networkPart.specularTexture.data();
|
Texture* specularMap = networkPart.specularTexture.data();
|
||||||
/* GLBATCH(glBindTexture)(GL_TEXTURE_2D, !specularMap ?
|
|
||||||
textureCache->getWhiteTextureID() : specularMap->getID());
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
|
||||||
*/
|
|
||||||
batch.setUniformTexture(locations->specularTextureUnit, !specularMap ?
|
batch.setUniformTexture(locations->specularTextureUnit, !specularMap ?
|
||||||
textureCache->getWhiteTexture() : specularMap->getGPUTexture());
|
textureCache->getWhiteTexture() : specularMap->getGPUTexture());
|
||||||
}
|
}
|
||||||
|
@ -2473,12 +2474,7 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
||||||
float emissiveScale = part.emissiveParams.y;
|
float emissiveScale = part.emissiveParams.y;
|
||||||
GLBATCH(glUniform2f)(locations->emissiveParams, emissiveOffset, emissiveScale);
|
GLBATCH(glUniform2f)(locations->emissiveParams, emissiveOffset, emissiveScale);
|
||||||
|
|
||||||
// GLBATCH(glActiveTexture)(GL_TEXTURE0 + locations->emissiveTextureUnit);
|
|
||||||
Texture* emissiveMap = networkPart.emissiveTexture.data();
|
Texture* emissiveMap = networkPart.emissiveTexture.data();
|
||||||
/* GLBATCH(glBindTexture)(GL_TEXTURE_2D, !emissiveMap ?
|
|
||||||
textureCache->getWhiteTextureID() : emissiveMap->getID());
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
|
||||||
*/
|
|
||||||
batch.setUniformTexture(locations->emissiveTextureUnit, !emissiveMap ?
|
batch.setUniformTexture(locations->emissiveTextureUnit, !emissiveMap ?
|
||||||
textureCache->getWhiteTexture() : emissiveMap->getGPUTexture());
|
textureCache->getWhiteTexture() : emissiveMap->getGPUTexture());
|
||||||
}
|
}
|
||||||
|
@ -2505,27 +2501,6 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
||||||
args->_quadsRendered += part.quadIndices.size() / INDICES_PER_QUAD;
|
args->_quadsRendered += part.quadIndices.size() / INDICES_PER_QUAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (!(mesh.tangents.isEmpty() || mode == SHADOW_RENDER_MODE)) {
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE1);
|
|
||||||
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (locations->specularTextureUnit >= 0) {
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0 + locations->specularTextureUnit);
|
|
||||||
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (locations->emissiveTextureUnit >= 0) {
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0 + locations->emissiveTextureUnit);
|
|
||||||
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
|
||||||
GLBATCH(glActiveTexture)(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// GLBATCH(glPopMatrix)();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return meshPartsRendered;
|
return meshPartsRendered;
|
||||||
|
|
|
@ -532,7 +532,7 @@ void NetworkTexture::setImage(const QImage& image, bool translucent, const QColo
|
||||||
imageLoaded(image);
|
imageLoaded(image);
|
||||||
|
|
||||||
if ((_width > 0) && (_height > 0)) {
|
if ((_width > 0) && (_height > 0)) {
|
||||||
bool isLinearRGB = (_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
||||||
|
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
|
@ -572,11 +572,12 @@ QSharedPointer<Texture> DilatableNetworkTexture::getDilatedTexture(float dilatio
|
||||||
painter.fillPath(path, Qt::black);
|
painter.fillPath(path, Qt::black);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, (_type == NORMAL_TEXTURE ? gpu::RGB : gpu::SRGB));
|
bool isLinearRGB = true;// (_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::UINT8, (_type == NORMAL_TEXTURE ? gpu::RGB : gpu::SRGB));
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
|
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
if (dilatedImage.hasAlphaChannel()) {
|
if (dilatedImage.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (_type == NORMAL_TEXTURE ? gpu::RGBA : gpu::SRGBA));
|
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (_type == NORMAL_TEXTURE ? gpu::BGRA : gpu::BGRA));
|
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::BGRA));
|
||||||
}
|
}
|
||||||
texture->_gpuTexture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, dilatedImage.width(), dilatedImage.height()));
|
texture->_gpuTexture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, dilatedImage.width(), dilatedImage.height()));
|
||||||
texture->_gpuTexture->assignStoredMip(0, formatMip, dilatedImage.byteCount(), dilatedImage.constBits());
|
texture->_gpuTexture->assignStoredMip(0, formatMip, dilatedImage.byteCount(), dilatedImage.constBits());
|
||||||
|
|
Loading…
Reference in a new issue