mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 19:03:07 +02:00
CHanging the lighting BUffer format and adding tone mapping
This commit is contained in:
parent
9ddc3c27bf
commit
9faec326da
14 changed files with 120 additions and 47 deletions
|
@ -160,6 +160,7 @@ enum Semantic {
|
||||||
RGB,
|
RGB,
|
||||||
RGBA,
|
RGBA,
|
||||||
BGRA,
|
BGRA,
|
||||||
|
|
||||||
XY,
|
XY,
|
||||||
XYZ,
|
XYZ,
|
||||||
XYZW,
|
XYZW,
|
||||||
|
@ -176,6 +177,8 @@ enum Semantic {
|
||||||
SRGBA,
|
SRGBA,
|
||||||
SBGRA,
|
SBGRA,
|
||||||
|
|
||||||
|
R11G11B10,
|
||||||
|
|
||||||
UNIFORM,
|
UNIFORM,
|
||||||
UNIFORM_BUFFER,
|
UNIFORM_BUFFER,
|
||||||
SAMPLER,
|
SAMPLER,
|
||||||
|
|
|
@ -224,6 +224,11 @@ public:
|
||||||
case gpu::SRGBA:
|
case gpu::SRGBA:
|
||||||
texel.internalFormat = GL_SRGB; // standard 2.2 gamma correction color
|
texel.internalFormat = GL_SRGB; // standard 2.2 gamma correction color
|
||||||
break;
|
break;
|
||||||
|
case gpu::R11G11B10: {
|
||||||
|
// the type should be float
|
||||||
|
texel.internalFormat = GL_R11F_G11F_B10F;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
qCDebug(gpulogging) << "Unknown combination of texel format";
|
qCDebug(gpulogging) << "Unknown combination of texel format";
|
||||||
}
|
}
|
||||||
|
@ -240,6 +245,59 @@ public:
|
||||||
break;
|
break;
|
||||||
case gpu::RGBA:
|
case gpu::RGBA:
|
||||||
texel.internalFormat = GL_RGBA;
|
texel.internalFormat = GL_RGBA;
|
||||||
|
switch (dstFormat.getType()) {
|
||||||
|
case gpu::UINT32:
|
||||||
|
texel.format = GL_RGBA_INTEGER;
|
||||||
|
texel.internalFormat = GL_RGBA32UI;
|
||||||
|
break;
|
||||||
|
case gpu::INT32:
|
||||||
|
texel.format = GL_RGBA_INTEGER;
|
||||||
|
texel.internalFormat = GL_RGBA32I;
|
||||||
|
break;
|
||||||
|
case gpu::FLOAT:
|
||||||
|
texel.internalFormat = GL_RGBA32F;
|
||||||
|
break;
|
||||||
|
case gpu::UINT16:
|
||||||
|
texel.format = GL_RGBA_INTEGER;
|
||||||
|
texel.internalFormat = GL_RGBA16UI;
|
||||||
|
break;
|
||||||
|
case gpu::INT16:
|
||||||
|
texel.format = GL_RGBA_INTEGER;
|
||||||
|
texel.internalFormat = GL_RGBA16I;
|
||||||
|
break;
|
||||||
|
case gpu::NUINT16:
|
||||||
|
texel.format = GL_RGBA;
|
||||||
|
texel.internalFormat = GL_RGBA16;
|
||||||
|
break;
|
||||||
|
case gpu::NINT16:
|
||||||
|
texel.format = GL_RGBA;
|
||||||
|
texel.internalFormat = GL_RGBA16_SNORM;
|
||||||
|
break;
|
||||||
|
case gpu::HALF:
|
||||||
|
texel.format = GL_RGBA;
|
||||||
|
texel.internalFormat = GL_RGBA16F;
|
||||||
|
break;
|
||||||
|
case gpu::UINT8:
|
||||||
|
texel.format = GL_RGBA_INTEGER;
|
||||||
|
texel.internalFormat = GL_RGBA8UI;
|
||||||
|
break;
|
||||||
|
case gpu::INT8:
|
||||||
|
texel.format = GL_RGBA_INTEGER;
|
||||||
|
texel.internalFormat = GL_RGBA8I;
|
||||||
|
break;
|
||||||
|
case gpu::NUINT8:
|
||||||
|
texel.format = GL_RGBA;
|
||||||
|
texel.internalFormat = GL_RGBA8;
|
||||||
|
break;
|
||||||
|
case gpu::NINT8:
|
||||||
|
texel.format = GL_RGBA;
|
||||||
|
texel.internalFormat = GL_RGBA8_SNORM;
|
||||||
|
break;
|
||||||
|
case gpu::NUINT32:
|
||||||
|
case gpu::NINT32:
|
||||||
|
case gpu::NUM_TYPES: // quiet compiler
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case gpu::SRGB:
|
case gpu::SRGB:
|
||||||
texel.internalFormat = GL_SRGB;
|
texel.internalFormat = GL_SRGB;
|
||||||
|
|
|
@ -407,7 +407,7 @@ public:
|
||||||
|
|
||||||
TexturePointer _texture = TexturePointer(NULL);
|
TexturePointer _texture = TexturePointer(NULL);
|
||||||
uint16 _subresource = 0;
|
uint16 _subresource = 0;
|
||||||
Element _element = Element(gpu::VEC4, gpu::UINT8, gpu::RGBA);
|
Element _element = Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
||||||
|
|
||||||
TextureView() {};
|
TextureView() {};
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ void ViveControllerManager::activate() {
|
||||||
// sizeof(vr::RenderModel_Vertex_t),
|
// sizeof(vr::RenderModel_Vertex_t),
|
||||||
// gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::RAW)));
|
// gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::RAW)));
|
||||||
|
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA);
|
gpu::Element formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA);
|
gpu::Element formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
||||||
_texture = gpu::TexturePointer(
|
_texture = gpu::TexturePointer(
|
||||||
gpu::Texture::create2D(formatGPU, model.diffuseTexture.unWidth, model.diffuseTexture.unHeight,
|
gpu::Texture::create2D(formatGPU, model.diffuseTexture.unWidth, model.diffuseTexture.unHeight,
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
||||||
|
|
|
@ -85,7 +85,7 @@ const gpu::TexturePointer& TextureCache::getPermutationNormalTexture() {
|
||||||
data[i + 2] = ((randvec.z + 1.0f) / 2.0f) * 255.0f;
|
data[i + 2] = ((randvec.z + 1.0f) / 2.0f) * 255.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
_permutationNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::UINT8, gpu::RGB), 256, 2));
|
_permutationNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB), 256, 2));
|
||||||
_permutationNormalTexture->assignStoredMip(0, _blueTexture->getTexelFormat(), sizeof(data), data);
|
_permutationNormalTexture->assignStoredMip(0, _blueTexture->getTexelFormat(), sizeof(data), data);
|
||||||
}
|
}
|
||||||
return _permutationNormalTexture;
|
return _permutationNormalTexture;
|
||||||
|
@ -98,7 +98,7 @@ const unsigned char OPAQUE_BLACK[] = { 0x00, 0x00, 0x00, 0xFF };
|
||||||
|
|
||||||
const gpu::TexturePointer& TextureCache::getWhiteTexture() {
|
const gpu::TexturePointer& TextureCache::getWhiteTexture() {
|
||||||
if (!_whiteTexture) {
|
if (!_whiteTexture) {
|
||||||
_whiteTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA), 1, 1));
|
_whiteTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1));
|
||||||
_whiteTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_WHITE), OPAQUE_WHITE);
|
_whiteTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_WHITE), OPAQUE_WHITE);
|
||||||
}
|
}
|
||||||
return _whiteTexture;
|
return _whiteTexture;
|
||||||
|
@ -106,7 +106,7 @@ const gpu::TexturePointer& TextureCache::getWhiteTexture() {
|
||||||
|
|
||||||
const gpu::TexturePointer& TextureCache::getGrayTexture() {
|
const gpu::TexturePointer& TextureCache::getGrayTexture() {
|
||||||
if (!_grayTexture) {
|
if (!_grayTexture) {
|
||||||
_grayTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA), 1, 1));
|
_grayTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1));
|
||||||
_grayTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_WHITE), OPAQUE_GRAY);
|
_grayTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_WHITE), OPAQUE_GRAY);
|
||||||
}
|
}
|
||||||
return _grayTexture;
|
return _grayTexture;
|
||||||
|
@ -114,7 +114,7 @@ const gpu::TexturePointer& TextureCache::getGrayTexture() {
|
||||||
|
|
||||||
const gpu::TexturePointer& TextureCache::getBlueTexture() {
|
const gpu::TexturePointer& TextureCache::getBlueTexture() {
|
||||||
if (!_blueTexture) {
|
if (!_blueTexture) {
|
||||||
_blueTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA), 1, 1));
|
_blueTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1));
|
||||||
_blueTexture->assignStoredMip(0, _blueTexture->getTexelFormat(), sizeof(OPAQUE_BLUE), OPAQUE_BLUE);
|
_blueTexture->assignStoredMip(0, _blueTexture->getTexelFormat(), sizeof(OPAQUE_BLUE), OPAQUE_BLUE);
|
||||||
}
|
}
|
||||||
return _blueTexture;
|
return _blueTexture;
|
||||||
|
@ -122,7 +122,7 @@ const gpu::TexturePointer& TextureCache::getBlueTexture() {
|
||||||
|
|
||||||
const gpu::TexturePointer& TextureCache::getBlackTexture() {
|
const gpu::TexturePointer& TextureCache::getBlackTexture() {
|
||||||
if (!_blackTexture) {
|
if (!_blackTexture) {
|
||||||
_blackTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA), 1, 1));
|
_blackTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1));
|
||||||
_blackTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_BLACK), OPAQUE_BLACK);
|
_blackTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_BLACK), OPAQUE_BLACK);
|
||||||
}
|
}
|
||||||
return _blackTexture;
|
return _blackTexture;
|
||||||
|
@ -151,11 +151,11 @@ NetworkTexturePointer TextureCache::getTexture(const QUrl& url, TextureType type
|
||||||
/// Returns a texture version of an image file
|
/// Returns a texture version of an image file
|
||||||
gpu::TexturePointer TextureCache::getImageTexture(const QString& path) {
|
gpu::TexturePointer TextureCache::getImageTexture(const QString& path) {
|
||||||
QImage image = QImage(path).mirrored(false, true);
|
QImage image = QImage(path).mirrored(false, true);
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, gpu::RGB);
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::UINT8, gpu::RGB);
|
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA);
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, gpu::BGRA);
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::BGRA);
|
||||||
}
|
}
|
||||||
gpu::TexturePointer texture = gpu::TexturePointer(
|
gpu::TexturePointer texture = gpu::TexturePointer(
|
||||||
gpu::Texture::create2D(formatGPU, image.width(), image.height(),
|
gpu::Texture::create2D(formatGPU, image.width(), image.height(),
|
||||||
|
|
|
@ -121,11 +121,11 @@ gpu::Texture* TextureUsage::create2DTextureFromImage(const QImage& srcImage, con
|
||||||
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
||||||
bool isLinearRGB = false; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
bool isLinearRGB = false; //(_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::NUINT8, (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::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,11 +156,11 @@ gpu::Texture* TextureUsage::createNormalTextureFromNormalImage(const QImage& src
|
||||||
|
|
||||||
bool isLinearRGB = true;
|
bool isLinearRGB = true;
|
||||||
|
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, (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::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
||||||
}
|
}
|
||||||
|
|
||||||
theTexture = (gpu::Texture::create2D(formatGPU, image.width(), image.height(), gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
theTexture = (gpu::Texture::create2D(formatGPU, image.width(), image.height(), gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
||||||
|
@ -246,11 +246,11 @@ gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcIm
|
||||||
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
||||||
bool isLinearRGB = true; //(_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::NUINT8, (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::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -368,11 +368,11 @@ gpu::Texture* TextureUsage::createCubeTextureFromImage(const QImage& srcImage, c
|
||||||
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
||||||
bool isLinearRGB = false; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
bool isLinearRGB = false; //(_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::NUINT8, (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::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -589,13 +589,13 @@ gpu::Texture* TextureUsage::createLightmapTextureFromImage(const QImage& srcImag
|
||||||
if ((image.width() > 0) && (image.height() > 0)) {
|
if ((image.width() > 0) && (image.height() > 0)) {
|
||||||
|
|
||||||
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
// bool isLinearRGB = true; //(_type == NORMAL_TEXTURE) || (_type == EMISSIVE_TEXTURE);
|
||||||
bool isLinearRGB = false; //(_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::NUINT8, (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::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ void main(void) {
|
||||||
vec3 coord = normalize(_normal);
|
vec3 coord = normalize(_normal);
|
||||||
vec3 texel = texture(cubeMap, coord).rgb;
|
vec3 texel = texture(cubeMap, coord).rgb;
|
||||||
vec3 color = texel * _skybox._color.rgb;
|
vec3 color = texel * _skybox._color.rgb;
|
||||||
vec3 pixel = pow(color, vec3(1.0/2.2)); // manual Gamma correction
|
// vec3 pixel = pow(color, vec3(1.0/2.2)); // manual Gamma correction
|
||||||
_fragColor = vec4(pixel, 0.0);
|
_fragColor = vec4(color, 0.0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 diffuse, vec3 s
|
||||||
}
|
}
|
||||||
|
|
||||||
_fragColor0 = vec4(diffuse.rgb, 0.5);
|
_fragColor0 = vec4(diffuse.rgb, 0.5);
|
||||||
_fragColor1 = vec4(bestFitNormal(normal), 1.0);
|
_fragColor1 = vec4(bestFitNormal(normal), 0.5);
|
||||||
_fragColor2 = vec4(emissive, shininess / 128.0);
|
_fragColor2 = vec4(emissive, shininess / 128.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -689,6 +689,7 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo
|
||||||
locations->deferredTransformBuffer = program->getBuffers().findLocation("deferredTransformBuffer");
|
locations->deferredTransformBuffer = program->getBuffers().findLocation("deferredTransformBuffer");
|
||||||
|
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
|
state->setColorWriteMask(true, true, true, false);
|
||||||
|
|
||||||
// Stencil test all the light passes for objects pixels only, not the background
|
// Stencil test all the light passes for objects pixels only, not the background
|
||||||
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
||||||
|
|
|
@ -53,7 +53,7 @@ void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
_deferredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_deferredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
_deferredFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_deferredFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
|
|
||||||
auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
auto colorFormat = gpu::Element::COLOR_RGBA_32;
|
||||||
auto width = _frameBufferSize.width();
|
auto width = _frameBufferSize.width();
|
||||||
auto height = _frameBufferSize.height();
|
auto height = _frameBufferSize.height();
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
||||||
_selfieFramebuffer->setRenderBuffer(0, tex);
|
_selfieFramebuffer->setRenderBuffer(0, tex);
|
||||||
|
|
||||||
_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), width, height, defaultSampler));
|
//_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, defaultSampler));
|
||||||
//_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::SRGBA), width, height, defaultSampler));
|
_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::R11G11B10), width, height, defaultSampler));
|
||||||
// _lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::HALF, gpu::RGBA), width, height, defaultSampler));
|
// _lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::HALF, gpu::RGBA), width, height, defaultSampler));
|
||||||
_lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
_lightingFramebuffer->setRenderBuffer(0, _lightingTexture);
|
_lightingFramebuffer->setRenderBuffer(0, _lightingTexture);
|
||||||
|
|
|
@ -108,5 +108,6 @@ void main (void)
|
||||||
|
|
||||||
vec3 finalColor = frontColor.rgb + fMiePhase * secondaryFrontColor.rgb;
|
vec3 finalColor = frontColor.rgb + fMiePhase * secondaryFrontColor.rgb;
|
||||||
outFragColor.a = finalColor.b;
|
outFragColor.a = finalColor.b;
|
||||||
outFragColor.rgb = pow(finalColor.rgb, vec3(1.0/2.2));
|
// outFragColor.rgb = pow(finalColor.rgb, vec3(1.0/2.2));
|
||||||
|
outFragColor.rgb = finalColor.rgb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,20 @@ void ToneMappingEffect::init() {
|
||||||
out vec4 outFragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
outFragColor = texture(colorMap, varTexCoord0);
|
vec4 fragColor = texture(colorMap, varTexCoord0);
|
||||||
// if (gl_FragCoord.x > 1000) {
|
// if (gl_FragCoord.x > 1000) {
|
||||||
// Manually gamma correct from Ligthing BUffer to color buffer
|
// Manually gamma correct from Ligthing BUffer to color buffer
|
||||||
outFragColor.xyz = pow( outFragColor.xyz , vec3(1.0 / 2.2) );
|
// outFragColor.xyz = pow( fragColor.xyz , vec3(1.0 / 2.2) );
|
||||||
|
|
||||||
|
fragColor *= 4.0; // Hardcoded Exposure Adjustment
|
||||||
|
vec3 x = max(vec3(0.0),fragColor.xyz-0.004);
|
||||||
|
vec3 retColor = (x*(6.2*x+.5))/(x*(6.2*x+1.7)+0.06);
|
||||||
|
|
||||||
|
// fragColor *= 8; // Hardcoded Exposure Adjustment
|
||||||
|
// fragColor = fragColor/(1.0+fragColor);
|
||||||
|
// vec3 retColor = pow(fragColor.xyz,vec3(1/2.2));
|
||||||
|
|
||||||
|
outFragColor = vec4(retColor, 1.0);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,11 +198,11 @@ void Font::read(QIODevice& in) {
|
||||||
|
|
||||||
image = image.convertToFormat(QImage::Format_RGBA8888);
|
image = image.convertToFormat(QImage::Format_RGBA8888);
|
||||||
|
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::UINT8, gpu::RGB);
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::UINT8, gpu::RGB);
|
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA);
|
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, gpu::BGRA);
|
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::BGRA);
|
||||||
}
|
}
|
||||||
_texture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, image.width(), image.height(),
|
_texture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, image.width(), image.height(),
|
||||||
gpu::Sampler(gpu::Sampler::FILTER_MIN_POINT_MAG_LINEAR)));
|
gpu::Sampler(gpu::Sampler::FILTER_MIN_POINT_MAG_LINEAR)));
|
||||||
|
|
|
@ -82,7 +82,7 @@ void avatarDataFromScriptValue(const QScriptValue &object, AvatarData* &out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(controller::InputController*)
|
Q_DECLARE_METATYPE(controller::InputController*)
|
||||||
static int inputControllerPointerId = qRegisterMetaType<controller::InputController*>();
|
//static int inputControllerPointerId = qRegisterMetaType<controller::InputController*>();
|
||||||
|
|
||||||
QScriptValue inputControllerToScriptValue(QScriptEngine *engine, controller::InputController* const &in) {
|
QScriptValue inputControllerToScriptValue(QScriptEngine *engine, controller::InputController* const &in) {
|
||||||
return engine->newQObject(in);
|
return engine->newQObject(in);
|
||||||
|
|
Loading…
Reference in a new issue