mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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->setDepthTest(true, !key.second, gpu::LESS_EQUAL);
|
||||
// PrepareStencil::testMaskDrawShape(*state);
|
||||
PrepareStencil::testMask(*state);
|
||||
|
||||
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() {
|
||||
return ItemKey::Builder::transparentShape().withTypeMeta().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
|
||||
// return ItemKey::Builder::opaqueShape().withTypeMeta().withTagBits(getTagMask()).withLayer(getHifiRenderLayer());
|
||||
}
|
||||
|
||||
ShapeKey PolyLineEntityRenderer::getShapeKey() {
|
||||
auto builder = ShapeKey::Builder().withOwnPipeline().withTranslucent().withoutCullFace();
|
||||
//auto builder = ShapeKey::Builder().withOwnPipeline().withoutCullFace();
|
||||
if (_primitiveMode == PrimitiveMode::LINES) {
|
||||
builder.withWireframe();
|
||||
}
|
||||
|
|
|
@ -66,21 +66,11 @@ Shader::Reflection Shader::getReflection(shader::Dialect dialect, shader::Varian
|
|||
|
||||
|
||||
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
|
||||
// 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
|
||||
|
||||
#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);
|
||||
return getReflection(shader::DEFAULT_DIALECT, shader::Variant::Mono);
|
||||
}
|
||||
|
||||
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_BLOCK] = _shaderSource.toStdString();
|
||||
|
||||
// Set any userdata specified uniforms
|
||||
int customSlot = procedural::slot::uniform::Custom;
|
||||
for (const auto& key : _data.uniforms.keys()) {
|
||||
std::string uniformName = key.toLocal8Bit().data();
|
||||
// fragmentSource.reflection.uniforms[uniformName] = customSlot;
|
||||
++customSlot;
|
||||
// Set any userdata specified uniforms (if any)
|
||||
if (!_data.uniforms.empty()) {
|
||||
// First grab all the possible dialect/variant/Reflections
|
||||
std::vector<shader::Reflection*> allReflections;
|
||||
for (auto dialectIt = fragmentSource.dialectSources.begin(); dialectIt != fragmentSource.dialectSources.end(); ++dialectIt) {
|
||||
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
|
||||
|
|
|
@ -42,8 +42,8 @@ public:
|
|||
|
||||
class PreparePrimaryFramebufferMSAAConfig : public render::Job::Config {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale)
|
||||
Q_PROPERTY(int numSamples WRITE setNumSamples READ getNumSamples)
|
||||
Q_PROPERTY(float resolutionScale WRITE setResolutionScale READ getResolutionScale NOTIFY dirty())
|
||||
Q_PROPERTY(int numSamples WRITE setNumSamples READ getNumSamples NOTIFY dirty())
|
||||
public:
|
||||
float getResolutionScale() const { return resolutionScale; }
|
||||
void setResolutionScale(float scale);
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace shader {
|
|||
|
||||
#if defined(USE_GLES)
|
||||
|
||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl310es;
|
||||
const Dialect DEFAULT_DIALECT = Dialect::glsl310es;
|
||||
|
||||
const std::vector<Dialect>& allDialects() {
|
||||
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl310es } };
|
||||
|
@ -41,7 +41,7 @@ const std::vector<Dialect>& allDialects() {
|
|||
|
||||
#elif defined(Q_OS_MAC)
|
||||
|
||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl410;
|
||||
const Dialect DEFAULT_DIALECT = Dialect::glsl410;
|
||||
|
||||
const std::vector<Dialect>& allDialects() {
|
||||
static const std::vector<Dialect> ALL_DIALECTS{ Dialect::glsl410 };
|
||||
|
@ -50,7 +50,7 @@ const std::vector<Dialect>& allDialects() {
|
|||
|
||||
#else
|
||||
|
||||
static const Dialect DEFAULT_DIALECT = Dialect::glsl450;
|
||||
const Dialect DEFAULT_DIALECT = Dialect::glsl450;
|
||||
|
||||
const std::vector<Dialect> & allDialects() {
|
||||
static const std::vector<Dialect> ALL_DIALECTS{ { Dialect::glsl450, Dialect::glsl410 } };
|
||||
|
|
|
@ -42,6 +42,8 @@ enum class Dialect
|
|||
#endif
|
||||
};
|
||||
|
||||
extern const Dialect DEFAULT_DIALECT;
|
||||
|
||||
const std::vector<Dialect>& allDialects();
|
||||
const std::string& dialectPath(Dialect dialect);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ Prop.PropGroup {
|
|||
// console.log(JSON.stringify(props));
|
||||
if (showProps) {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ PropFolderPanel {
|
|||
"min": (proItem["min"] !== undefined ? proItem.min : 0.0),
|
||||
"max": (proItem["max"] !== undefined ? proItem.max : 1.0),
|
||||
"integer": (proItem["integral"] !== undefined ? proItem.integral : false),
|
||||
"readOnly": (proItem["readOnly"] !== undefined ? proItem["readOnly"] : false),
|
||||
"readOnly": (proItem["readOnly"] !== undefined ? proItem["readOnly"] : true),
|
||||
})
|
||||
} break;
|
||||
case 'PropEnum': {
|
||||
|
|
Loading…
Reference in a new issue