mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Address the procedural to populate all reflection versions with user uniforms bindings and make EnigneInspector works correctly
This commit is contained in:
parent
224e9590ec
commit
4a93b23d83
8 changed files with 30 additions and 29 deletions
|
@ -55,7 +55,6 @@ void PolyLineEntityRenderer::buildPipelines() {
|
||||||
|
|
||||||
state->setCullMode(gpu::State::CullMode::CULL_NONE);
|
state->setCullMode(gpu::State::CullMode::CULL_NONE);
|
||||||
state->setDepthTest(true, !key.second, gpu::LESS_EQUAL);
|
state->setDepthTest(true, !key.second, gpu::LESS_EQUAL);
|
||||||
// PrepareStencil::testMaskDrawShape(*state);
|
|
||||||
PrepareStencil::testMask(*state);
|
PrepareStencil::testMask(*state);
|
||||||
|
|
||||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||||
|
@ -67,12 +66,10 @@ void PolyLineEntityRenderer::buildPipelines() {
|
||||||
|
|
||||||
ItemKey PolyLineEntityRenderer::getKey() {
|
ItemKey PolyLineEntityRenderer::getKey() {
|
||||||
return ItemKey::Builder::transparentShape().withTypeMeta().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
|
return ItemKey::Builder::transparentShape().withTypeMeta().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
|
||||||
// return ItemKey::Builder::opaqueShape().withTypeMeta().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeKey PolyLineEntityRenderer::getShapeKey() {
|
ShapeKey PolyLineEntityRenderer::getShapeKey() {
|
||||||
auto builder = ShapeKey::Builder().withOwnPipeline().withTranslucent().withoutCullFace();
|
auto builder = ShapeKey::Builder().withOwnPipeline().withTranslucent().withoutCullFace();
|
||||||
//auto builder = ShapeKey::Builder().withOwnPipeline().withoutCullFace();
|
|
||||||
if (_primitiveMode == PrimitiveMode::LINES) {
|
if (_primitiveMode == PrimitiveMode::LINES) {
|
||||||
builder.withWireframe();
|
builder.withWireframe();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,21 +66,11 @@ Shader::Reflection Shader::getReflection(shader::Dialect dialect, shader::Varian
|
||||||
|
|
||||||
|
|
||||||
Shader::Reflection Shader::getReflection() const {
|
Shader::Reflection Shader::getReflection() const {
|
||||||
|
// For sake of convenience i would like to be able to use a "default" dialect that represents the reflection
|
||||||
// FOr sake of convenience i would like to be able to use a "default" dialect that represents the reflection
|
|
||||||
// of the source of the shader
|
// of the source of the shader
|
||||||
// What i really want, is a reflection that is designed for the gpu lib interface but we don;t have that yet (glsl45 is the closest to that)
|
// What i really want, is a reflection that is designed for the gpu lib interface but we don't have that yet (glsl45 is the closest to that)
|
||||||
// Until we have an implementation for this, we will return such default reflection from the one available and platform specific
|
// Until we have an implementation for this, we will return such default reflection from the one available and platform specific
|
||||||
|
return getReflection(shader::DEFAULT_DIALECT, shader::Variant::Mono);
|
||||||
#if defined(USE_GLES)
|
|
||||||
auto defaultDialect = shader::Dialect::glsl310es;
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
// Mac only supports 4.1
|
|
||||||
auto defaultDialect = shader::Dialect::glsl410;
|
|
||||||
#else
|
|
||||||
auto defaultDialect = shader::Dialect::glsl450;
|
|
||||||
#endif
|
|
||||||
return getReflection(defaultDialect, shader::Variant::Mono);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader::~Shader()
|
Shader::~Shader()
|
||||||
|
|
|
@ -264,12 +264,24 @@ void Procedural::prepare(gpu::Batch& batch,
|
||||||
fragmentSource.replacements[PROCEDURAL_VERSION] = "#define PROCEDURAL_V" + std::to_string(_data.version);
|
fragmentSource.replacements[PROCEDURAL_VERSION] = "#define PROCEDURAL_V" + std::to_string(_data.version);
|
||||||
fragmentSource.replacements[PROCEDURAL_BLOCK] = _shaderSource.toStdString();
|
fragmentSource.replacements[PROCEDURAL_BLOCK] = _shaderSource.toStdString();
|
||||||
|
|
||||||
// Set any userdata specified uniforms
|
// Set any userdata specified uniforms (if any)
|
||||||
int customSlot = procedural::slot::uniform::Custom;
|
if (!_data.uniforms.empty()) {
|
||||||
for (const auto& key : _data.uniforms.keys()) {
|
// First grab all the possible dialect/variant/Reflections
|
||||||
std::string uniformName = key.toLocal8Bit().data();
|
std::vector<shader::Reflection*> allReflections;
|
||||||
// fragmentSource.reflection.uniforms[uniformName] = customSlot;
|
for (auto dialectIt = fragmentSource.dialectSources.begin(); dialectIt != fragmentSource.dialectSources.end(); ++dialectIt) {
|
||||||
++customSlot;
|
for (auto variantIt = (*dialectIt).second.variantSources.begin(); variantIt != (*dialectIt).second.variantSources.end(); ++variantIt) {
|
||||||
|
allReflections.push_back(&(*variantIt).second.reflection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Then fill in every reflections the new custom bindings
|
||||||
|
int customSlot = procedural::slot::uniform::Custom;
|
||||||
|
for (const auto& key : _data.uniforms.keys()) {
|
||||||
|
std::string uniformName = key.toLocal8Bit().data();
|
||||||
|
for (auto reflection : allReflections) {
|
||||||
|
reflection->uniforms[uniformName] = customSlot;
|
||||||
|
}
|
||||||
|
++customSlot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leave this here for debugging
|
// Leave this here for debugging
|
||||||
|
|
|
@ -42,8 +42,8 @@ public:
|
||||||
|
|
||||||
class PreparePrimaryFramebufferMSAAConfig : public render::Job::Config {
|
class PreparePrimaryFramebufferMSAAConfig : public render::Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale)
|
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale NOTIFY dirty())
|
||||||
Q_PROPERTY(int numSamples WRITE setNumSamples READ getNumSamples)
|
Q_PROPERTY(int numSamples WRITE setNumSamples READ getNumSamples NOTIFY dirty())
|
||||||
public:
|
public:
|
||||||
float getResolutionScale() const { return resolutionScale; }
|
float getResolutionScale() const { return resolutionScale; }
|
||||||
void setResolutionScale(float scale);
|
void setResolutionScale(float scale);
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace shader {
|
||||||
|
|
||||||
#if defined(USE_GLES)
|
#if defined(USE_GLES)
|
||||||
|
|
||||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl310es;
|
const Dialect DEFAULT_DIALECT = Dialect::glsl310es;
|
||||||
|
|
||||||
const std::vector<Dialect>& allDialects() {
|
const std::vector<Dialect>& allDialects() {
|
||||||
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl310es } };
|
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl310es } };
|
||||||
|
@ -41,7 +41,7 @@ const std::vector<Dialect>& allDialects() {
|
||||||
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
|
|
||||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl410;
|
const Dialect DEFAULT_DIALECT = Dialect::glsl410;
|
||||||
|
|
||||||
const std::vector<Dialect>& allDialects() {
|
const std::vector<Dialect>& allDialects() {
|
||||||
static const std::vector<Dialect> ALL_DIALECTS{ Dialect::glsl410 };
|
static const std::vector<Dialect> ALL_DIALECTS{ Dialect::glsl410 };
|
||||||
|
@ -50,7 +50,7 @@ const std::vector<Dialect>& allDialects() {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl450;
|
const Dialect DEFAULT_DIALECT = Dialect::glsl450;
|
||||||
|
|
||||||
const std::vector<Dialect> & allDialects() {
|
const std::vector<Dialect> & allDialects() {
|
||||||
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl450, Dialect::glsl410 } };
|
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl450, Dialect::glsl410 } };
|
||||||
|
|
|
@ -42,6 +42,8 @@ enum class Dialect
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const Dialect DEFAULT_DIALECT;
|
||||||
|
|
||||||
const std::vector<Dialect>& allDialects();
|
const std::vector<Dialect>& allDialects();
|
||||||
const std::string& dialectPath(Dialect dialect);
|
const std::string& dialectPath(Dialect dialect);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ Prop.PropGroup {
|
||||||
// console.log(JSON.stringify(props));
|
// console.log(JSON.stringify(props));
|
||||||
if (showProps) {
|
if (showProps) {
|
||||||
for (var p in props) {
|
for (var p in props) {
|
||||||
propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] })
|
propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p]})
|
||||||
}
|
}
|
||||||
root.updatePropItems(root.propItemsPanel, propsModel);
|
root.updatePropItems(root.propItemsPanel, propsModel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ PropFolderPanel {
|
||||||
"min": (proItem["min"] !== undefined ? proItem.min : 0.0),
|
"min": (proItem["min"] !== undefined ? proItem.min : 0.0),
|
||||||
"max": (proItem["max"] !== undefined ? proItem.max : 1.0),
|
"max": (proItem["max"] !== undefined ? proItem.max : 1.0),
|
||||||
"integer": (proItem["integral"] !== undefined ? proItem.integral : false),
|
"integer": (proItem["integral"] !== undefined ? proItem.integral : false),
|
||||||
"readOnly": (proItem["readOnly"] !== undefined ? proItem["readOnly"] : false),
|
"readOnly": (proItem["readOnly"] !== undefined ? proItem["readOnly"] : true),
|
||||||
})
|
})
|
||||||
} break;
|
} break;
|
||||||
case 'PropEnum': {
|
case 'PropEnum': {
|
||||||
|
|
Loading…
Reference in a new issue