mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge branch 'hdr' into amc
This commit is contained in:
commit
7af4a52587
15 changed files with 1635 additions and 19 deletions
|
@ -33,7 +33,7 @@
|
|||
#include <NodeType.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <PathUtils.h>
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
|
||||
#include "AssetServerLogging.h"
|
||||
#include "BakeAssetTask.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <QtCore/QFile>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
#include <ktx/KTX.h>
|
||||
#include <NetworkAccessManager.h>
|
||||
#include <SharedUtil.h>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <QDir>
|
||||
#include <QImageReader>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
|
||||
#include "Baker.h"
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <QtCore/QFileInfo>
|
||||
#include <QHash>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
|
||||
class TextureFileNamer {
|
||||
public:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "GraphicsScriptingUtil.h"
|
||||
#include "ScriptableMesh.h"
|
||||
#include "graphics/Material.h"
|
||||
#include "image/Image.h"
|
||||
#include "image/TextureProcessing.h"
|
||||
|
||||
// #define SCRIPTABLE_MESH_DEBUG 1
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "OpenEXRReader.h"
|
||||
|
||||
#include "Image.h"
|
||||
#include "TextureProcessing.h"
|
||||
#include "ImageLogging.h"
|
||||
|
||||
#include <QIODevice>
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
QImage image::readOpenEXR(QIODevice& content, const std::string& filename) {
|
||||
image::Image image::readOpenEXR(QIODevice& content, const std::string& filename) {
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
QIODeviceImfStream device(content, filename);
|
||||
|
||||
|
@ -74,12 +74,12 @@ QImage image::readOpenEXR(QIODevice& content, const std::string& filename) {
|
|||
file.setFrameBuffer(&pixels[0][0] - viewport.min.x - viewport.min.y * width, 1, width);
|
||||
file.readPixels(viewport.min.y, viewport.max.y);
|
||||
|
||||
QImage image{ width, height, QIMAGE_HDRFORMAT };
|
||||
Image image{ width, height, Image::Format_PACKED_FLOAT };
|
||||
auto packHDRPixel = getHDRPackingFunction();
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
const auto srcScanline = pixels[y];
|
||||
gpu::uint32* dstScanline = (gpu::uint32*) image.scanLine(y);
|
||||
gpu::uint32* dstScanline = (gpu::uint32*) image.editScanLine(y);
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
const auto& srcPixel = srcScanline[x];
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
#ifndef hifi_image_OpenEXRReader_h
|
||||
#define hifi_image_OpenEXRReader_h
|
||||
|
||||
#include <QImage>
|
||||
#include "Image.h"
|
||||
|
||||
namespace image {
|
||||
|
||||
// TODO Move this into a plugin that QImageReader can use
|
||||
QImage readOpenEXR(QIODevice& contents, const std::string& filename);
|
||||
Image readOpenEXR(QIODevice& contents, const std::string& filename);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <QIODevice>
|
||||
#include <QDebug>
|
||||
|
||||
QImage image::readTGA(QIODevice& content) {
|
||||
image::Image image::readTGA(QIODevice& content) {
|
||||
enum class TGAImageType : uint8_t {
|
||||
NoImageData = 0,
|
||||
UncompressedColorMapped = 1,
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
#ifndef hifi_image_TGAReader_h
|
||||
#define hifi_image_TGAReader_h
|
||||
|
||||
#include <QImage>
|
||||
#include "Image.h"
|
||||
|
||||
namespace image {
|
||||
|
||||
// TODO Move this into a plugin that QImageReader can use
|
||||
QImage readTGA(QIODevice& contents);
|
||||
Image readTGA(QIODevice& contents);
|
||||
|
||||
}
|
||||
|
||||
|
|
1525
libraries/image/src/image/TextureProcessing.cpp
Normal file
1525
libraries/image/src/image/TextureProcessing.cpp
Normal file
File diff suppressed because it is too large
Load diff
92
libraries/image/src/image/TextureProcessing.h
Normal file
92
libraries/image/src/image/TextureProcessing.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// TextureProcessing.h
|
||||
// image/src/TextureProcessing
|
||||
//
|
||||
// Created by Clement Brisset on 4/5/2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_image_TextureProcessing_h
|
||||
#define hifi_image_TextureProcessing_h
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#include <gpu/Texture.h>
|
||||
|
||||
#include "Image.h"
|
||||
|
||||
namespace image {
|
||||
|
||||
std::function<gpu::uint32(const glm::vec3&)> getHDRPackingFunction();
|
||||
std::function<glm::vec3(gpu::uint32)> getHDRUnpackingFunction();
|
||||
|
||||
namespace TextureUsage {
|
||||
|
||||
enum Type {
|
||||
DEFAULT_TEXTURE,
|
||||
STRICT_TEXTURE,
|
||||
ALBEDO_TEXTURE,
|
||||
NORMAL_TEXTURE,
|
||||
BUMP_TEXTURE,
|
||||
SPECULAR_TEXTURE,
|
||||
METALLIC_TEXTURE = SPECULAR_TEXTURE, // for now spec and metallic texture are the same, converted to grey
|
||||
ROUGHNESS_TEXTURE,
|
||||
GLOSS_TEXTURE,
|
||||
EMISSIVE_TEXTURE,
|
||||
CUBE_TEXTURE,
|
||||
OCCLUSION_TEXTURE,
|
||||
SCATTERING_TEXTURE = OCCLUSION_TEXTURE,
|
||||
LIGHTMAP_TEXTURE,
|
||||
UNUSED_TEXTURE
|
||||
};
|
||||
|
||||
using TextureLoader = std::function<gpu::TexturePointer(Image&&, const std::string&, bool, gpu::BackendTarget, const std::atomic<bool>&)>;
|
||||
TextureLoader getTextureLoaderForType(Type type, const QVariantMap& options = QVariantMap());
|
||||
|
||||
gpu::TexturePointer create2DTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createStrict2DTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createAlbedoTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createEmissiveTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createNormalTextureFromNormalImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createNormalTextureFromBumpImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createRoughnessTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createRoughnessTextureFromGlossImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createMetallicTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createCubeTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createCubeTextureFromImageWithoutIrradiance(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer createLightmapTextureFromImage(Image&& image, const std::string& srcImageName,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer process2DTextureColorFromImage(Image&& srcImage, const std::string& srcImageName, bool compress,
|
||||
gpu::BackendTarget target, bool isStrict, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer process2DTextureNormalMapFromImage(Image&& srcImage, const std::string& srcImageName, bool compress,
|
||||
gpu::BackendTarget target, bool isBumpMap, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer process2DTextureGrayscaleFromImage(Image&& srcImage, const std::string& srcImageName, bool compress,
|
||||
gpu::BackendTarget target, bool isInvertedPixels, const std::atomic<bool>& abortProcessing);
|
||||
gpu::TexturePointer processCubeTextureColorFromImage(Image&& srcImage, const std::string& srcImageName, bool compress,
|
||||
gpu::BackendTarget target, bool generateIrradiance, const std::atomic<bool>& abortProcessing);
|
||||
|
||||
} // namespace TextureUsage
|
||||
|
||||
const QStringList getSupportedFormats();
|
||||
|
||||
gpu::TexturePointer processImage(std::shared_ptr<QIODevice> content, const std::string& url, ColorChannel sourceChannel,
|
||||
int maxNumPixels, TextureUsage::Type textureType,
|
||||
bool compress, gpu::BackendTarget target, const std::atomic<bool>& abortProcessing = false);
|
||||
|
||||
} // namespace image
|
||||
|
||||
#endif // hifi_image_TextureProcessing_h
|
|
@ -34,7 +34,7 @@
|
|||
#include <gl/GLHelpers.h>
|
||||
#include <gpu/Batch.h>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
#include <shared/NsightHelpers.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <ResourceCache.h>
|
||||
#include <graphics/TextureMap.h>
|
||||
#include <image/ColorChannel.h>
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
#include <ktx/KTX.h>
|
||||
#include <TextureMeta.h>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <StatTracker.h>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <QtCore/QCommandLineParser>
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
#include <TextureBaker.h>
|
||||
|
||||
#include "BakerCLI.h"
|
||||
|
|
Loading…
Reference in a new issue