Showing the changes to libraries/render-utils/src/TextureCache.cpp (1 of 11 files). Show all
Unified · Split
| @@ -259,9 +259,11 @@ void TextureCache::createPrimaryFramebuffer() { · 258 unmodified lines | ||
| 259 | 259 | auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA); |
| 260 | 260 | auto width = _frameBufferSize.width(); |
| 261 | 261 | auto height = _frameBufferSize.height(); |
| 262 | − _primaryColorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height)); | |
| 263 | − _primaryNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height)); | |
| 264 | − _primarySpecularTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height)); | |
| 262 | + | |
| 263 | + auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT); | |
| 264 | + _primaryColorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler)); | |
| 265 | + _primaryNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler)); | |
| 266 | + _primarySpecularTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler)); | |
| 265 | 267 | |
| 266 | 268 | _primaryOpaqueFramebuffer->setRenderBuffer(0, _primaryColorTexture); |
| 267 | 269 | _primaryOpaqueFramebuffer->setRenderBuffer(1, _primaryNormalTexture); |
| @@ -270,7 +272,7 @@ void TextureCache::createPrimaryFramebuffer() { · 2 unmodified lines | ||
| 270 | 272 | _primaryTransparentFramebuffer->setRenderBuffer(0, _primaryColorTexture); |
| 271 | 273 | |
| 272 | 274 | auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); |
| 273 | − _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height)); | |
| 275 | + _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler)); | |
| 274 | 276 | |
| 275 | 277 | _primaryOpaqueFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 276 | 278 | |
| @@ -380,25 +382,6 @@ gpu::FramebufferPointer TextureCache::getShadowFramebuffer() { · 103 unmodified lines | ||
| 380 | 382 | _shadowFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::createShadowmap(SHADOW_MAP_SIZE)); |
| 381 | 383 | |
| 382 | 384 | _shadowTexture = _shadowFramebuffer->getDepthStencilBuffer(); |
| 383 | − /* | |
| 384 | − glGenTextures(1, &_shadowDepthTextureID); | |
| 385 | − glBindTexture(GL_TEXTURE_2D, _shadowDepthTextureID); | |
| 386 | − glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, | |
| 387 | − 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); | |
| 388 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
| 389 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
| 390 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); | |
| 391 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); | |
| 392 | − const float DISTANT_BORDER[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | |
| 393 | − glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, DISTANT_BORDER); | |
| 394 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); | |
| 395 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); | |
| 396 | − glBindTexture(GL_TEXTURE_2D, 0); | |
| 397 | − | |
| 398 | − _shadowFramebufferObject->bind(); | |
| 399 | − glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _shadowDepthTextureID, 0); | |
| 400 | − _shadowFramebufferObject->release(); | |
| 401 | − */ | |
| 402 | 385 | } |
| 403 | 386 | return _shadowFramebuffer; |
| 404 | 387 | } |
| @@ -675,7 +658,7 @@ void NetworkTexture::setImage(const QImage& image, bool translucent, const QColo · 270 unmodified lines | ||
| 675 | 658 | formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA)); |
| 676 | 659 | formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA)); |
| 677 | 660 | } |
| 678 | − _gpuTexture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, image.width(), image.height())); | |
| 661 | + _gpuTexture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, image.width(), image.height(), gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR))); | |
| 679 | 662 | _gpuTexture->assignStoredMip(0, formatMip, image.byteCount(), image.constBits()); |
| 680 | 663 | _gpuTexture->autoGenerateMips(-1); |
| 681 | 664 | } |
| @@ -714,7 +697,7 @@ QSharedPointer<Texture> DilatableNetworkTexture::getDilatedTexture(float dilatio · 32 unmodified lines | ||
| 714 | 697 | formatGPU = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA)); |
| 715 | 698 | formatMip = gpu::Element(gpu::VEC4, gpu::UINT8, (isLinearRGB ? gpu::BGRA : gpu::BGRA)); |
| 716 | 699 | } |
| 717 | − texture->_gpuTexture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, dilatedImage.width(), dilatedImage.height())); | |
| 700 | + texture->_gpuTexture = gpu::TexturePointer(gpu::Texture::create2D(formatGPU, dilatedImage.width(), dilatedImage.height(), gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR))); | |
| 718 | 701 | texture->_gpuTexture->assignStoredMip(0, formatMip, dilatedImage.byteCount(), dilatedImage.constBits()); |
| 719 | 702 | texture->_gpuTexture->autoGenerateMips(-1); |
| 720 | 703 | |