mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:12:53 +02:00
Adding differenciation for the Material shapeKey bit
This commit is contained in:
parent
a00216cb4f
commit
c7b164d8f2
3 changed files with 46 additions and 33 deletions
|
@ -97,6 +97,8 @@ ShapeKey MeshPartPayload::getShapeKey() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeKey::Builder builder;
|
ShapeKey::Builder builder;
|
||||||
|
builder.withMaterial();
|
||||||
|
|
||||||
if (drawMaterialKey.isTranslucent()) {
|
if (drawMaterialKey.isTranslucent()) {
|
||||||
builder.withTranslucent();
|
builder.withTranslucent();
|
||||||
}
|
}
|
||||||
|
@ -478,6 +480,8 @@ ShapeKey ModelMeshPartPayload::getShapeKey() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeKey::Builder builder;
|
ShapeKey::Builder builder;
|
||||||
|
builder.withMaterial();
|
||||||
|
|
||||||
if (isTranslucent || _fadeState != FADE_COMPLETE) {
|
if (isTranslucent || _fadeState != FADE_COMPLETE) {
|
||||||
builder.withTranslucent();
|
builder.withTranslucent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeKey::Filter::Builder builder;
|
ShapeKey::Filter::Builder builder;
|
||||||
|
|
||||||
isCulled ? builder.withCullFace() : builder.withoutCullFace();
|
isCulled ? builder.withCullFace() : builder.withoutCullFace();
|
||||||
isBiased ? builder.withDepthBias() : builder.withoutDepthBias();
|
isBiased ? builder.withDepthBias() : builder.withoutDepthBias();
|
||||||
isOpaque ? builder.withOpaque() : builder.withTranslucent();
|
isOpaque ? builder.withOpaque() : builder.withTranslucent();
|
||||||
|
@ -113,6 +114,7 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
|
||||||
auto simpleProgram = isOpaque ? opaqueProgram : translucentProgram;
|
auto simpleProgram = isOpaque ? opaqueProgram : translucentProgram;
|
||||||
auto unlitProgram = isOpaque ? unlitOpaqueProgram : unlitTranslucentProgram;
|
auto unlitProgram = isOpaque ? unlitOpaqueProgram : unlitTranslucentProgram;
|
||||||
plumber.addPipeline(builder.withoutUnlit().build(), simpleProgram, state, &lightBatchSetter);
|
plumber.addPipeline(builder.withoutUnlit().build(), simpleProgram, state, &lightBatchSetter);
|
||||||
|
plumber.addPipeline(builder.withMaterial().build(), opaqueMaterialProgram, state, &lightBatchSetter);
|
||||||
plumber.addPipeline(builder.withUnlit().build(), unlitProgram, state, &batchSetter);
|
plumber.addPipeline(builder.withUnlit().build(), unlitProgram, state, &batchSetter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,78 +149,78 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
// TODO: Refactor this to use a filter
|
// TODO: Refactor this to use a filter
|
||||||
// Opaques
|
// Opaques
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder(),
|
Key::Builder().withMaterial(),
|
||||||
modelVertex, modelPixel);
|
modelVertex, modelPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withUnlit(),
|
Key::Builder().withMaterial().withUnlit(),
|
||||||
modelVertex, modelUnlitPixel);
|
modelVertex, modelUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTangents(),
|
Key::Builder().withMaterial().withTangents(),
|
||||||
modelNormalMapVertex, modelNormalMapPixel);
|
modelNormalMapVertex, modelNormalMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSpecular(),
|
Key::Builder().withMaterial().withSpecular(),
|
||||||
modelVertex, modelSpecularMapPixel);
|
modelVertex, modelSpecularMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withTangents().withSpecular(),
|
||||||
modelNormalMapVertex, modelNormalSpecularMapPixel);
|
modelNormalMapVertex, modelNormalSpecularMapPixel);
|
||||||
// Translucents
|
// Translucents
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent(),
|
Key::Builder().withMaterial().withTranslucent(),
|
||||||
modelVertex, modelTranslucentPixel);
|
modelVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent().withUnlit(),
|
Key::Builder().withMaterial().withTranslucent().withUnlit(),
|
||||||
modelVertex, modelTranslucentUnlitPixel);
|
modelVertex, modelTranslucentUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent().withTangents(),
|
Key::Builder().withMaterial().withTranslucent().withTangents(),
|
||||||
modelNormalMapVertex, modelTranslucentPixel);
|
modelNormalMapVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent().withSpecular(),
|
Key::Builder().withMaterial().withTranslucent().withSpecular(),
|
||||||
modelVertex, modelTranslucentPixel);
|
modelVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withTranslucent().withTangents().withSpecular(),
|
||||||
modelNormalMapVertex, modelTranslucentPixel);
|
modelNormalMapVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
// FIXME: Ignore lightmap for translucents meshpart
|
// FIXME: Ignore lightmap for translucents meshpart
|
||||||
Key::Builder().withTranslucent().withLightmap(),
|
Key::Builder().withMaterial().withTranslucent().withLightmap(),
|
||||||
modelVertex, modelTranslucentPixel);
|
modelVertex, modelTranslucentPixel);
|
||||||
// Lightmapped
|
// Lightmapped
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withLightmap(),
|
Key::Builder().withMaterial().withLightmap(),
|
||||||
modelLightmapVertex, modelLightmapPixel);
|
modelLightmapVertex, modelLightmapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withLightmap().withTangents(),
|
Key::Builder().withMaterial().withLightmap().withTangents(),
|
||||||
modelLightmapNormalMapVertex, modelLightmapNormalMapPixel);
|
modelLightmapNormalMapVertex, modelLightmapNormalMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withLightmap().withSpecular(),
|
Key::Builder().withMaterial().withLightmap().withSpecular(),
|
||||||
modelLightmapVertex, modelLightmapSpecularMapPixel);
|
modelLightmapVertex, modelLightmapSpecularMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withLightmap().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withLightmap().withTangents().withSpecular(),
|
||||||
modelLightmapNormalMapVertex, modelLightmapNormalSpecularMapPixel);
|
modelLightmapNormalMapVertex, modelLightmapNormalSpecularMapPixel);
|
||||||
// Skinned
|
// Skinned
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned(),
|
Key::Builder().withMaterial().withSkinned(),
|
||||||
skinModelVertex, modelPixel);
|
skinModelVertex, modelPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTangents(),
|
Key::Builder().withMaterial().withSkinned().withTangents(),
|
||||||
skinModelNormalMapVertex, modelNormalMapPixel);
|
skinModelNormalMapVertex, modelNormalMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withSpecular(),
|
Key::Builder().withMaterial().withSkinned().withSpecular(),
|
||||||
skinModelVertex, modelSpecularMapPixel);
|
skinModelVertex, modelSpecularMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withSkinned().withTangents().withSpecular(),
|
||||||
skinModelNormalMapVertex, modelNormalSpecularMapPixel);
|
skinModelNormalMapVertex, modelNormalSpecularMapPixel);
|
||||||
// Skinned and Translucent
|
// Skinned and Translucent
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTranslucent(),
|
Key::Builder().withMaterial().withSkinned().withTranslucent(),
|
||||||
skinModelVertex, modelTranslucentPixel);
|
skinModelVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTranslucent().withTangents(),
|
Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(),
|
||||||
skinModelNormalMapVertex, modelTranslucentPixel);
|
skinModelNormalMapVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTranslucent().withSpecular(),
|
Key::Builder().withMaterial().withSkinned().withTranslucent().withSpecular(),
|
||||||
skinModelVertex, modelTranslucentPixel);
|
skinModelVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTranslucent().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withSpecular(),
|
||||||
skinModelNormalMapVertex, modelTranslucentPixel);
|
skinModelNormalMapVertex, modelTranslucentPixel);
|
||||||
// Depth-only
|
// Depth-only
|
||||||
addPipeline(
|
addPipeline(
|
||||||
|
@ -247,32 +249,32 @@ void initForwardPipelines(render::ShapePlumber& plumber) {
|
||||||
auto addPipeline = std::bind(&addPlumberPipeline, std::ref(plumber), _1, _2, _3);
|
auto addPipeline = std::bind(&addPlumberPipeline, std::ref(plumber), _1, _2, _3);
|
||||||
// Opaques
|
// Opaques
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder(),
|
Key::Builder().withMaterial(),
|
||||||
modelVertex, modelPixel);
|
modelVertex, modelPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withUnlit(),
|
Key::Builder().withMaterial().withUnlit(),
|
||||||
modelVertex, modelUnlitPixel);
|
modelVertex, modelUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTangents(),
|
Key::Builder().withMaterial().withTangents(),
|
||||||
modelNormalMapVertex, modelNormalMapPixel);
|
modelNormalMapVertex, modelNormalMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSpecular(),
|
Key::Builder().withMaterial().withSpecular(),
|
||||||
modelVertex, modelSpecularMapPixel);
|
modelVertex, modelSpecularMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withTangents().withSpecular(),
|
||||||
modelNormalMapVertex, modelNormalSpecularMapPixel);
|
modelNormalMapVertex, modelNormalSpecularMapPixel);
|
||||||
// Skinned
|
// Skinned
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned(),
|
Key::Builder().withMaterial().withSkinned(),
|
||||||
skinModelVertex, modelPixel);
|
skinModelVertex, modelPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTangents(),
|
Key::Builder().withMaterial().withSkinned().withTangents(),
|
||||||
skinModelNormalMapVertex, modelNormalMapPixel);
|
skinModelNormalMapVertex, modelNormalMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withSpecular(),
|
Key::Builder().withMaterial().withSkinned().withSpecular(),
|
||||||
skinModelVertex, modelSpecularMapPixel);
|
skinModelVertex, modelSpecularMapPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withTangents().withSpecular(),
|
Key::Builder().withMaterial().withSkinned().withTangents().withSpecular(),
|
||||||
skinModelNormalMapVertex, modelNormalSpecularMapPixel);
|
skinModelNormalMapVertex, modelNormalSpecularMapPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ namespace render {
|
||||||
class ShapeKey {
|
class ShapeKey {
|
||||||
public:
|
public:
|
||||||
enum FlagBit {
|
enum FlagBit {
|
||||||
TRANSLUCENT = 0,
|
MATERIAL = 0,
|
||||||
|
TRANSLUCENT,
|
||||||
LIGHTMAP,
|
LIGHTMAP,
|
||||||
TANGENTS,
|
TANGENTS,
|
||||||
SPECULAR,
|
SPECULAR,
|
||||||
|
@ -53,6 +54,7 @@ public:
|
||||||
|
|
||||||
ShapeKey build() const { return ShapeKey{_flags}; }
|
ShapeKey build() const { return ShapeKey{_flags}; }
|
||||||
|
|
||||||
|
Builder& withMaterial() { _flags.set(MATERIAL); return (*this); }
|
||||||
Builder& withTranslucent() { _flags.set(TRANSLUCENT); return (*this); }
|
Builder& withTranslucent() { _flags.set(TRANSLUCENT); return (*this); }
|
||||||
Builder& withLightmap() { _flags.set(LIGHTMAP); return (*this); }
|
Builder& withLightmap() { _flags.set(LIGHTMAP); return (*this); }
|
||||||
Builder& withTangents() { _flags.set(TANGENTS); return (*this); }
|
Builder& withTangents() { _flags.set(TANGENTS); return (*this); }
|
||||||
|
@ -89,6 +91,9 @@ public:
|
||||||
|
|
||||||
Filter build() const { return Filter(_flags, _mask); }
|
Filter build() const { return Filter(_flags, _mask); }
|
||||||
|
|
||||||
|
Builder& withMaterial() { _flags.set(MATERIAL); _mask.set(MATERIAL); return (*this); }
|
||||||
|
Builder& withoutMaterial() { _flags.reset(MATERIAL); _mask.set(MATERIAL); return (*this); }
|
||||||
|
|
||||||
Builder& withTranslucent() { _flags.set(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); }
|
Builder& withTranslucent() { _flags.set(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); }
|
||||||
Builder& withOpaque() { _flags.reset(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); }
|
Builder& withOpaque() { _flags.reset(TRANSLUCENT); _mask.set(TRANSLUCENT); return (*this); }
|
||||||
|
|
||||||
|
@ -134,6 +139,7 @@ public:
|
||||||
Flags _mask{0};
|
Flags _mask{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool useMaterial() const { return _flags[MATERIAL]; }
|
||||||
bool hasLightmap() const { return _flags[LIGHTMAP]; }
|
bool hasLightmap() const { return _flags[LIGHTMAP]; }
|
||||||
bool hasTangents() const { return _flags[TANGENTS]; }
|
bool hasTangents() const { return _flags[TANGENTS]; }
|
||||||
bool hasSpecular() const { return _flags[SPECULAR]; }
|
bool hasSpecular() const { return _flags[SPECULAR]; }
|
||||||
|
@ -170,6 +176,7 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) {
|
||||||
debug << "[ShapeKey: OWN_PIPELINE]";
|
debug << "[ShapeKey: OWN_PIPELINE]";
|
||||||
} else {
|
} else {
|
||||||
debug << "[ShapeKey:"
|
debug << "[ShapeKey:"
|
||||||
|
<< "useMaterial:" << key.useMaterial()
|
||||||
<< "hasLightmap:" << key.hasLightmap()
|
<< "hasLightmap:" << key.hasLightmap()
|
||||||
<< "hasTangents:" << key.hasTangents()
|
<< "hasTangents:" << key.hasTangents()
|
||||||
<< "hasSpecular:" << key.hasSpecular()
|
<< "hasSpecular:" << key.hasSpecular()
|
||||||
|
|
Loading…
Reference in a new issue