mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
fixes after review by Brad
This commit is contained in:
parent
1a044b4ea6
commit
4592bdcb4f
4 changed files with 33 additions and 41 deletions
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
class GLBuffer {
|
||||
public:
|
||||
Stamp _stamp;
|
||||
Stamp _stamp;
|
||||
GLuint _buffer;
|
||||
GLuint _size;
|
||||
|
||||
|
@ -46,8 +46,8 @@ public:
|
|||
|
||||
class GLTexture {
|
||||
public:
|
||||
Stamp _storageStamp;
|
||||
Stamp _contentStamp;
|
||||
Stamp _storageStamp;
|
||||
Stamp _contentStamp;
|
||||
GLuint _texture;
|
||||
GLuint _size;
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ public:
|
|||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case gpu::VEC2: {
|
||||
texel.format = GL_RG;
|
||||
|
@ -69,8 +69,8 @@ public:
|
|||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case gpu::VEC3: {
|
||||
texel.format = GL_RGB;
|
||||
|
@ -85,8 +85,9 @@ public:
|
|||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case gpu::VEC4: {
|
||||
texel.format = GL_RGBA;
|
||||
|
@ -121,8 +122,8 @@ public:
|
|||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
|
@ -147,8 +148,9 @@ public:
|
|||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case gpu::VEC2: {
|
||||
texel.format = GL_RG;
|
||||
|
@ -166,8 +168,8 @@ public:
|
|||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case gpu::VEC3: {
|
||||
texel.format = GL_RGB;
|
||||
|
@ -186,8 +188,8 @@ public:
|
|||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case gpu::VEC4: {
|
||||
texel.format = GL_RGBA;
|
||||
|
@ -209,8 +211,8 @@ public:
|
|||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
qDebug() << "Unknown combination of texel format";
|
||||
|
@ -304,8 +306,8 @@ void GLBackend::syncGPUObject(const Texture& texture) {
|
|||
object->_storageStamp = texture.getStamp();
|
||||
object->_size = texture.getSize();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug() << "GLBackend::syncGPUObject(const Texture&) case for Texture Type " << texture.getType() << " not supported";
|
||||
}
|
||||
|
@ -315,16 +317,15 @@ void GLBackend::syncGPUObject(const Texture& texture) {
|
|||
|
||||
|
||||
GLuint GLBackend::getTextureID(const TexturePointer& texture) {
|
||||
if (texture) {
|
||||
GLBackend::syncGPUObject(*texture);
|
||||
GLTexture* object = Backend::getGPUObject<GLBackend::GLTexture>(*texture);
|
||||
if (object) {
|
||||
return object->_texture;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (!texture) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
GLBackend::syncGPUObject(*texture);
|
||||
GLTexture* object = Backend::getGPUObject<GLBackend::GLTexture>(*texture);
|
||||
if (object) {
|
||||
return object->_texture;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,8 @@ Stamp Texture::Storage::getStamp(uint16 level) const {
|
|||
PixelsPointer mip = getMip(level);
|
||||
if (mip) {
|
||||
return mip->_sysmem.getStamp();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Texture::Storage::reset() {
|
||||
|
@ -43,17 +42,15 @@ void Texture::Storage::reset() {
|
|||
Texture::PixelsPointer Texture::Storage::editMip(uint16 level) {
|
||||
if (level < _mips.size()) {
|
||||
return _mips[level];
|
||||
} else {
|
||||
return PixelsPointer();
|
||||
}
|
||||
return PixelsPointer();
|
||||
}
|
||||
|
||||
const Texture::PixelsPointer Texture::Storage::getMip(uint16 level) const {
|
||||
if (level < _mips.size()) {
|
||||
return _mips[level];
|
||||
} else {
|
||||
return PixelsPointer();
|
||||
}
|
||||
return PixelsPointer();
|
||||
}
|
||||
|
||||
bool Texture::Storage::isMipAvailable(uint16 level) const {
|
||||
|
@ -277,49 +274,43 @@ uint16 Texture::getStoredMipWidth(uint16 level) const {
|
|||
PixelsPointer mip = accessStoredMip(level);
|
||||
if (mip && mip->_sysmem.getSize()) {
|
||||
return evalMipWidth(level);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16 Texture::getStoredMipHeight(uint16 level) const {
|
||||
PixelsPointer mip = accessStoredMip(level);
|
||||
if (mip && mip->_sysmem.getSize()) {
|
||||
return evalMipHeight(level);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16 Texture::getStoredMipDepth(uint16 level) const {
|
||||
PixelsPointer mip = accessStoredMip(level);
|
||||
if (mip && mip->_sysmem.getSize()) {
|
||||
return evalMipDepth(level);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 Texture::getStoredMipNumTexels(uint16 level) const {
|
||||
PixelsPointer mip = accessStoredMip(level);
|
||||
if (mip && mip->_sysmem.getSize()) {
|
||||
return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 Texture::getStoredMipSize(uint16 level) const {
|
||||
PixelsPointer mip = accessStoredMip(level);
|
||||
if (mip && mip->_sysmem.getSize()) {
|
||||
return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level) * getTexelFormat().getSize();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16 Texture::evalNumSamplesUsed(uint16 numSamplesTried)
|
||||
{
|
||||
uint16 Texture::evalNumSamplesUsed(uint16 numSamplesTried) {
|
||||
uint16 sample = numSamplesTried;
|
||||
if (numSamplesTried <= 1)
|
||||
sample = 1;
|
||||
|
|
|
@ -59,7 +59,7 @@ vec3 evalDirectionalColor(float shadowAttenuation, vec3 position, vec3 normal, v
|
|||
// Diffuse Lighting
|
||||
float diffuseDot = dot(normal, gl_LightSource[0].position.xyz);
|
||||
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_FrontLightProduct[0].diffuse.rgb * (diffuseDot * facingLight));
|
||||
|
||||
// compute the specular multiplier (sans exponent)
|
||||
float specularPower = facingLight * max(0.0,
|
||||
|
|
Loading…
Reference in a new issue