mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 06:22:14 +02:00
cleaning compilation warnings and tuning the FBX material mapping pass
This commit is contained in:
parent
2c584f7690
commit
307243da8b
5 changed files with 31 additions and 15 deletions
|
@ -261,13 +261,19 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) {
|
|||
|
||||
if (materialMap.contains(material.name)) {
|
||||
QJsonObject materialOptions = materialMap.value(material.name).toObject();
|
||||
float scattering = materialOptions.contains("scattering") ? materialOptions.value("scattering").toDouble() : 1.0f;
|
||||
QByteArray scatteringMap = materialOptions.value("scatteringMap").toVariant().toByteArray();
|
||||
qDebug() << "Replacing material:" << material.name << "with skin scattering effect. scattering:" << scattering << "scatteringMap:" << scatteringMap;
|
||||
material._material->setScattering(scattering);
|
||||
material.scatteringTexture = FBXTexture();
|
||||
material.scatteringTexture.name = material.name + ".scatteringMap";
|
||||
material.scatteringTexture.filename = scatteringMap;
|
||||
qDebug() << "Mapping fbx material:" << material.name << " with HifiMaterial: " << materialOptions;
|
||||
|
||||
if (materialOptions.contains("scattering")) {
|
||||
float scattering = (float) materialOptions.value("scattering").toDouble();
|
||||
material._material->setScattering(scattering);
|
||||
}
|
||||
|
||||
if (materialOptions.contains("scatteringMap")) {
|
||||
QByteArray scatteringMap = materialOptions.value("scatteringMap").toVariant().toByteArray();
|
||||
material.scatteringTexture = FBXTexture();
|
||||
material.scatteringTexture.name = material.name + ".scatteringMap";
|
||||
material.scatteringTexture.filename = scatteringMap;
|
||||
}
|
||||
}
|
||||
|
||||
if (material.opacity <= 0.0f) {
|
||||
|
|
|
@ -43,13 +43,11 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) {
|
|||
}
|
||||
|
||||
void FramebufferCache::createPrimaryFramebuffer() {
|
||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
||||
auto linearFormat = gpu::Element::COLOR_RGBA_32;
|
||||
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
|
||||
auto width = _frameBufferSize.width();
|
||||
auto height = _frameBufferSize.height();
|
||||
|
||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
|
||||
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||
|
||||
_selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
||||
|
@ -74,7 +72,7 @@ void FramebufferCache::resizeAmbientOcclusionBuffers() {
|
|||
auto height = _frameBufferSize.height() >> _AOResolutionLevel;
|
||||
auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGB);
|
||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||
// auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||
|
||||
_occlusionTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler));
|
||||
_occlusionFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||
|
|
|
@ -122,7 +122,7 @@ void LightingModel::setShowLightContour(bool enable) {
|
|||
}
|
||||
}
|
||||
bool LightingModel::isShowLightContourEnabled() const {
|
||||
return (bool)(_parametersBuffer.get<Parameters>().showLightContour > 0.0);
|
||||
return (bool)(_parametersBuffer.get<Parameters>().showLightContour > 0.0f);
|
||||
}
|
||||
|
||||
MakeLightingModel::MakeLightingModel() {
|
||||
|
|
|
@ -217,6 +217,8 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont
|
|||
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
// Setup camera, projection and viewport for all items
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
batch.setStateScissorRect(args->_viewport);
|
||||
|
||||
|
@ -228,6 +230,9 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont
|
|||
batch.setProjectionTransform(projMat);
|
||||
batch.setViewTransform(viewMat);
|
||||
|
||||
// Setup lighting model for all items;
|
||||
batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
|
||||
|
||||
renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn);
|
||||
args->_batch = nullptr;
|
||||
});
|
||||
|
@ -248,6 +253,8 @@ void DrawStateSortDeferred::run(const SceneContextPointer& sceneContext, const R
|
|||
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
// Setup camera, projection and viewport for all items
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
batch.setStateScissorRect(args->_viewport);
|
||||
|
||||
|
@ -259,6 +266,9 @@ void DrawStateSortDeferred::run(const SceneContextPointer& sceneContext, const R
|
|||
batch.setProjectionTransform(projMat);
|
||||
batch.setViewTransform(viewMat);
|
||||
|
||||
// Setup lighting model for all items;
|
||||
batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
|
||||
|
||||
if (_stateSort) {
|
||||
renderStateSortShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn);
|
||||
} else {
|
||||
|
@ -315,6 +325,9 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon
|
|||
batch.setProjectionTransform(projMat);
|
||||
batch.setViewTransform(viewMat);
|
||||
|
||||
// Setup lighting model for all items;
|
||||
batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
|
||||
|
||||
renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn);
|
||||
args->_batch = nullptr;
|
||||
});
|
||||
|
@ -361,7 +374,8 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
|||
assert(renderContext->args->hasViewFrustum());
|
||||
|
||||
const auto& inItems = inputs.get0();
|
||||
const auto& lightingModel = inputs.get1();
|
||||
// Not used yet
|
||||
// const auto& lightingModel = inputs.get1();
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
|
|
|
@ -741,7 +741,6 @@ int TextTemplate::evalBlockGeneration(std::ostream& dst, const BlockPointer& blo
|
|||
std::vector< String > paramCache;
|
||||
paramCache.push_back("");
|
||||
String val;
|
||||
bool valIsVar = false;
|
||||
for (int i = 1; i < nbParams; i++) {
|
||||
val = block->command.arguments[i];
|
||||
if ((val[0] == Tag::VAR) && (val[val.length()-1] == Tag::VAR)) {
|
||||
|
@ -752,7 +751,6 @@ int TextTemplate::evalBlockGeneration(std::ostream& dst, const BlockPointer& blo
|
|||
} else {
|
||||
val = Tag::NULL_VAR;
|
||||
}
|
||||
valIsVar = true;
|
||||
}
|
||||
|
||||
Vars::iterator it = vars.find(funcBlock->command.arguments[i]);
|
||||
|
|
Loading…
Reference in a new issue