mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 13:42:38 +02:00
a bunch of changes to debug why...
This commit is contained in:
parent
3e8a91e3ec
commit
133a8b7d5e
7 changed files with 43 additions and 5 deletions
|
@ -287,6 +287,7 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
|
|||
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
||||
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
||||
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
||||
format.setColorSpace(QSurfaceFormat::ColorSpace::sRGBColorSpace);
|
||||
auto glversion = ::gl::getTargetVersion();
|
||||
format.setMajorVersion(GL_GET_MAJOR_VERSION(glversion));
|
||||
format.setMinorVersion(GL_GET_MINOR_VERSION(glversion));
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace scriptable {
|
|||
* @property {Mat4|string} texCoordTransform1
|
||||
* @property {string} lightmapParams
|
||||
* @property {string} materialParams
|
||||
* @property {string} opacityMode
|
||||
* @property {boolean} defaultFallthrough
|
||||
*/
|
||||
class ScriptableMaterial {
|
||||
|
@ -94,7 +95,7 @@ namespace scriptable {
|
|||
QString lightMap;
|
||||
QString scatteringMap;
|
||||
std::array<glm::mat4, graphics::Material::NUM_TEXCOORD_TRANSFORMS> texCoordTransforms;
|
||||
|
||||
QString opacityMode;
|
||||
bool defaultFallthrough;
|
||||
std::unordered_map<uint, bool> propertyFallthroughs; // not actually exposed to script
|
||||
|
||||
|
|
|
@ -420,6 +420,18 @@ namespace scriptable {
|
|||
obj.setProperty("opacityMap", material.opacityMap);
|
||||
}
|
||||
|
||||
|
||||
obj.setProperty("keys.isOpaque", material.key.isOpaque());
|
||||
obj.setProperty("keys.isOpacityMaskMap", material.key.isOpacityMaskMap());
|
||||
obj.setProperty("keys.isTexelOpaque", material.key.isTexelOpaque());
|
||||
obj.setProperty("keys.isSurfaceOpaque", material.key.isSurfaceOpaque());
|
||||
|
||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::OPACITY_MASK_MAP_BIT)) {
|
||||
obj.setProperty("opacityMapMode", FALLTHROUGH);
|
||||
} else if (material.key.isGlossy()) {
|
||||
obj.setProperty("opacityMapMode", material.opacityMode);
|
||||
}
|
||||
|
||||
if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::OCCLUSION_MAP_BIT)) {
|
||||
obj.setProperty("occlusionMap", FALLTHROUGH);
|
||||
} else if (!material.occlusionMap.isEmpty()) {
|
||||
|
|
|
@ -41,6 +41,8 @@ scriptable::ScriptableMaterial& scriptable::ScriptableMaterial::operator=(const
|
|||
occlusionMap = material.occlusionMap;
|
||||
lightMap = material.lightMap;
|
||||
scatteringMap = material.scatteringMap;
|
||||
opacityMode = material.opacityMode;
|
||||
|
||||
|
||||
defaultFallthrough = material.defaultFallthrough;
|
||||
propertyFallthroughs = material.propertyFallthroughs;
|
||||
|
@ -55,6 +57,9 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
|
|||
name = material->getName().c_str();
|
||||
model = material->getModel().c_str();
|
||||
opacity = material->getOpacity();
|
||||
|
||||
opacityMode = (opacity < 1.0f ? "opacityVarAlpha" : "opaque");
|
||||
|
||||
roughness = material->getRoughness();
|
||||
metallic = material->getMetallic();
|
||||
scattering = material->getScattering();
|
||||
|
@ -75,6 +80,8 @@ scriptable::ScriptableMaterial::ScriptableMaterial(const graphics::MaterialPoint
|
|||
albedoMap = map->getTextureSource()->getUrl().toString();
|
||||
if (map->useAlphaChannel()) {
|
||||
opacityMap = albedoMap;
|
||||
//opacityMode = (material->getKey().isOpacityMaskMap() ? "opacityMapAlphaMask" : "opacityMapAlphaBlend");
|
||||
opacityMode = (material->getKey().isOpacityMaskMap() ? "opacityMapAlphaMask" : "opacityMapAlphaBlend");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ function fromQml(message) {
|
|||
|
||||
var SELECT_LIST = "luci_materialInspector_SelectionList";
|
||||
Selection.enableListHighlight(SELECT_LIST, {
|
||||
outlineUnoccludedColor: { red: 255, green: 255, blue: 255 }
|
||||
outlineUnoccludedColor: { red: 125, green: 255, blue: 225 }
|
||||
});
|
||||
function setSelectedObject(id, type) {
|
||||
Selection.clearSelectedItemsList(SELECT_LIST);
|
||||
|
|
|
@ -51,6 +51,12 @@ void RenderThread::initialize(QWindow* window) {
|
|||
_backend = _gpuContext->getBackend();
|
||||
_context.doneCurrent();
|
||||
_context.moveToThread(_thread);
|
||||
|
||||
if (!_presentPipeline) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::gpu::program::DrawTexture);
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
_presentPipeline = gpu::Pipeline::create(program, state);
|
||||
}
|
||||
#else
|
||||
auto size = window->size();
|
||||
_extent = vk::Extent2D{ (uint32_t)size.width(), (uint32_t)size.height() };
|
||||
|
@ -169,15 +175,26 @@ void RenderThread::renderFrame(gpu::FramePointer& frame) {
|
|||
}
|
||||
|
||||
#ifdef USE_GL
|
||||
static gpu::BatchPointer batch = nullptr;
|
||||
if (!batch) {
|
||||
batch = std::make_shared<gpu::Batch>();
|
||||
batch->setPipeline(_presentPipeline);
|
||||
batch->setFramebuffer(nullptr);
|
||||
batch->setResourceTexture(0, frame->framebuffer->getRenderBuffer(0));
|
||||
batch->setViewportTransform(ivec4(uvec2(0), ivec2(0.5 * fboSize.x, 0.5*fboSize.y)));
|
||||
batch->draw(gpu::TRIANGLE_STRIP, 4);
|
||||
}
|
||||
_gpuContext->executeBatch(*batch);
|
||||
|
||||
//glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
//glClear(GL_COLOR_BUFFER_BIT);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
|
||||
/* glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glBlitFramebuffer(
|
||||
0, 0, fboSize.x, fboSize.y,
|
||||
0, 0, windowSize.width(), windowSize.height(),
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
*/
|
||||
(void)CHECK_GL_ERROR();
|
||||
_context.swapBuffers();
|
||||
_context.doneCurrent();
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
uint32_t _externalTexture{ 0 };
|
||||
void move(const glm::vec3& v);
|
||||
glm::mat4 _correction;
|
||||
|
||||
gpu::PipelinePointer _presentPipeline;
|
||||
|
||||
void resize(const QSize& newSize);
|
||||
void setup() override;
|
||||
|
|
Loading…
Reference in a new issue