Deep dive into the shape key and filters and the PLumber construction

This commit is contained in:
sam 2017-02-24 00:05:54 -08:00
parent 8e122b3357
commit 67031850aa
3 changed files with 6 additions and 9 deletions

View file

@ -84,7 +84,7 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
auto unlitTranslucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucentUnlit);
auto opaqueMaterialProgram = gpu::Shader::createProgram(vertexModel, pixelMaterial);
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 8; i++) {
bool isCulled = (i & 1);
bool isBiased = (i & 2);
bool isOpaque = (i & 4);
@ -115,7 +115,7 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
auto simpleProgram = isOpaque ? opaqueProgram : translucentProgram;
auto unlitProgram = isOpaque ? unlitOpaqueProgram : unlitTranslucentProgram;
plumber.addPipeline(builder.withoutUnlit().withoutMaterial().build(), simpleProgram, state, &lightBatchSetter);
plumber.addPipeline(builder.withMaterial().withoutUnlit().build(), opaqueMaterialProgram, state, &lightBatchSetter);
plumber.addPipeline(builder.withoutUnlit().withMaterial().build(), opaqueMaterialProgram, state, &lightBatchSetter);
plumber.addPipeline(builder.withUnlit().withoutMaterial().build(), unlitProgram, state, &batchSetter);
}
}

View file

@ -39,6 +39,10 @@ void ShapePlumber::addPipelineHelper(const Filter& filter, ShapeKey key, int bit
}
} else {
// Add the brand new pipeline and cache its location in the lib
auto precedent = _pipelineMap.find(key);
if (precedent != _pipelineMap.end()) {
qCDebug(renderlogging) << "Key already assigned: " << key;
}
_pipelineMap.insert(PipelineMap::value_type(key, pipeline));
}
}

View file

@ -29,7 +29,6 @@ public:
SPECULAR,
UNLIT,
SKINNED,
STEREO,
DEPTH_ONLY,
DEPTH_BIAS,
WIREFRAME,
@ -61,7 +60,6 @@ public:
Builder& withSpecular() { _flags.set(SPECULAR); return (*this); }
Builder& withUnlit() { _flags.set(UNLIT); return (*this); }
Builder& withSkinned() { _flags.set(SKINNED); return (*this); }
Builder& withStereo() { _flags.set(STEREO); return (*this); }
Builder& withDepthOnly() { _flags.set(DEPTH_ONLY); return (*this); }
Builder& withDepthBias() { _flags.set(DEPTH_BIAS); return (*this); }
Builder& withWireframe() { _flags.set(WIREFRAME); return (*this); }
@ -112,9 +110,6 @@ public:
Builder& withSkinned() { _flags.set(SKINNED); _mask.set(SKINNED); return (*this); }
Builder& withoutSkinned() { _flags.reset(SKINNED); _mask.set(SKINNED); return (*this); }
Builder& withStereo() { _flags.set(STEREO); _mask.set(STEREO); return (*this); }
Builder& withoutStereo() { _flags.reset(STEREO); _mask.set(STEREO); return (*this); }
Builder& withDepthOnly() { _flags.set(DEPTH_ONLY); _mask.set(DEPTH_ONLY); return (*this); }
Builder& withoutDepthOnly() { _flags.reset(DEPTH_ONLY); _mask.set(DEPTH_ONLY); return (*this); }
@ -146,7 +141,6 @@ public:
bool isUnlit() const { return _flags[UNLIT]; }
bool isTranslucent() const { return _flags[TRANSLUCENT]; }
bool isSkinned() const { return _flags[SKINNED]; }
bool isStereo() const { return _flags[STEREO]; }
bool isDepthOnly() const { return _flags[DEPTH_ONLY]; }
bool isDepthBiased() const { return _flags[DEPTH_BIAS]; }
bool isWireFrame() const { return _flags[WIREFRAME]; }
@ -183,7 +177,6 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) {
<< "isUnlit:" << key.isUnlit()
<< "isTranslucent:" << key.isTranslucent()
<< "isSkinned:" << key.isSkinned()
<< "isStereo:" << key.isStereo()
<< "isDepthOnly:" << key.isDepthOnly()
<< "isDepthBiased:" << key.isDepthBiased()
<< "isWireFrame:" << key.isWireFrame()