Trying to clean up for pr

This commit is contained in:
samcake 2016-05-10 19:25:22 -07:00
parent 303cade547
commit e40a795a27
12 changed files with 18 additions and 44 deletions

View file

@ -104,7 +104,7 @@ void Image3DOverlay::render(RenderArgs* args) {
const render::ShapeKey Image3DOverlay::getShapeKey() { const render::ShapeKey Image3DOverlay::getShapeKey() {
auto builder = render::ShapeKey::Builder().withoutCullFace().withDepthBias(); auto builder = render::ShapeKey::Builder().withoutCullFace().withDepthBias();
if (_emissive) { if (_emissive) {
builder.withEmissive(); builder.withUnlit();
} }
if (getAlpha() != 1.0f) { if (getAlpha() != 1.0f) {
builder.withTranslucent(); builder.withTranslucent();

View file

@ -1132,7 +1132,6 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
ambientTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1)); ambientTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
} else if (type.contains("tex_ao_map")) { } else if (type.contains("tex_ao_map")) {
occlusionTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1)); occlusionTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
} else if (type == "lcl rotation") { } else if (type == "lcl rotation") {
localRotations.insert(getID(connection.properties, 2), getID(connection.properties, 1)); localRotations.insert(getID(connection.properties, 2), getID(connection.properties, 1));
} else if (type == "lcl translation") { } else if (type == "lcl translation") {

View file

@ -157,7 +157,7 @@ vec3 fetchLightmapMap(vec2 uv) {
} }
<@endfunc@> <@endfunc@>
<@func $discardTransparent(opacity)@> <@func discardTransparent(opacity)@>
{ {
if (<$opacity$> < 1.0) { if (<$opacity$> < 1.0) {
discard; discard;

View file

@ -104,13 +104,13 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
auto vertex = gpu::Shader::createVertex(std::string(overlay3D_vert)); auto vertex = gpu::Shader::createVertex(std::string(overlay3D_vert));
auto pixel = gpu::Shader::createPixel(std::string(overlay3D_frag)); auto pixel = gpu::Shader::createPixel(std::string(overlay3D_frag));
auto pixelTranslucent = gpu::Shader::createPixel(std::string(overlay3D_translucent_frag)); auto pixelTranslucent = gpu::Shader::createPixel(std::string(overlay3D_translucent_frag));
auto pixelEmissive = gpu::Shader::createPixel(std::string(overlay3D_unlit_frag)); auto pixelUnlit = gpu::Shader::createPixel(std::string(overlay3D_unlit_frag));
auto pixelTranslucentEmissive = gpu::Shader::createPixel(std::string(overlay3D_translucent_unlit_frag)); auto pixelTranslucentUnlit = gpu::Shader::createPixel(std::string(overlay3D_translucent_unlit_frag));
auto opaqueProgram = gpu::Shader::createProgram(vertex, pixel); auto opaqueProgram = gpu::Shader::createProgram(vertex, pixel);
auto translucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucent); auto translucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucent);
auto emissiveOpaqueProgram = gpu::Shader::createProgram(vertex, pixelEmissive); auto unlitOpaqueProgram = gpu::Shader::createProgram(vertex, pixelUnlit);
auto emissiveTranslucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucentEmissive); auto unlitTranslucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucentUnlit);
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
bool isCulled = (i & 1); bool isCulled = (i & 1);
@ -140,9 +140,9 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
isOpaque ? builder.withOpaque() : builder.withTranslucent(); isOpaque ? builder.withOpaque() : builder.withTranslucent();
auto simpleProgram = isOpaque ? opaqueProgram : translucentProgram; auto simpleProgram = isOpaque ? opaqueProgram : translucentProgram;
auto emissiveProgram = isOpaque ? emissiveOpaqueProgram : emissiveTranslucentProgram; auto unlitProgram = isOpaque ? unlitOpaqueProgram : unlitTranslucentProgram;
plumber.addPipeline(builder.withoutEmissive().build(), simpleProgram, state, &lightBatchSetter); plumber.addPipeline(builder.withoutUnlit().build(), simpleProgram, state, &lightBatchSetter);
plumber.addPipeline(builder.withEmissive().build(), emissiveProgram, state, &batchSetter); plumber.addPipeline(builder.withUnlit().build(), unlitProgram, state, &batchSetter);
} }
} }
@ -203,13 +203,11 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
// Pixel shaders // Pixel shaders
auto modelPixel = gpu::Shader::createPixel(std::string(model_frag)); auto modelPixel = gpu::Shader::createPixel(std::string(model_frag));
auto modelEmissivePixel = gpu::Shader::createPixel(std::string(model_emissive_frag));
auto modelUnlitPixel = gpu::Shader::createPixel(std::string(model_unlit_frag)); auto modelUnlitPixel = gpu::Shader::createPixel(std::string(model_unlit_frag));
auto modelNormalMapPixel = gpu::Shader::createPixel(std::string(model_normal_map_frag)); auto modelNormalMapPixel = gpu::Shader::createPixel(std::string(model_normal_map_frag));
auto modelSpecularMapPixel = gpu::Shader::createPixel(std::string(model_specular_map_frag)); auto modelSpecularMapPixel = gpu::Shader::createPixel(std::string(model_specular_map_frag));
auto modelNormalSpecularMapPixel = gpu::Shader::createPixel(std::string(model_normal_specular_map_frag)); auto modelNormalSpecularMapPixel = gpu::Shader::createPixel(std::string(model_normal_specular_map_frag));
auto modelTranslucentPixel = gpu::Shader::createPixel(std::string(model_translucent_frag)); auto modelTranslucentPixel = gpu::Shader::createPixel(std::string(model_translucent_frag));
auto modelTranslucentEmissivePixel = gpu::Shader::createPixel(std::string(model_translucent_emissive_frag));
auto modelTranslucentUnlitPixel = gpu::Shader::createPixel(std::string(model_translucent_unlit_frag)); auto modelTranslucentUnlitPixel = gpu::Shader::createPixel(std::string(model_translucent_unlit_frag));
auto modelShadowPixel = gpu::Shader::createPixel(std::string(model_shadow_frag)); auto modelShadowPixel = gpu::Shader::createPixel(std::string(model_shadow_frag));
auto modelLightmapPixel = gpu::Shader::createPixel(std::string(model_lightmap_frag)); auto modelLightmapPixel = gpu::Shader::createPixel(std::string(model_lightmap_frag));
@ -222,9 +220,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
addPipeline( addPipeline(
Key::Builder(), Key::Builder(),
modelVertex, modelPixel); modelVertex, modelPixel);
addPipeline(
Key::Builder().withEmissive(),
modelVertex, modelEmissivePixel);
addPipeline( addPipeline(
Key::Builder().withUnlit(), Key::Builder().withUnlit(),
modelVertex, modelUnlitPixel); modelVertex, modelUnlitPixel);
@ -241,12 +236,9 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
addPipeline( addPipeline(
Key::Builder().withTranslucent(), Key::Builder().withTranslucent(),
modelVertex, modelTranslucentPixel); modelVertex, modelTranslucentPixel);
addPipeline(
Key::Builder().withTranslucent().withEmissive(),
modelVertex, modelTranslucentEmissivePixel);
addPipeline( addPipeline(
Key::Builder().withTranslucent().withUnlit(), Key::Builder().withTranslucent().withUnlit(),
modelVertex, modelTranslucentEmissivePixel); modelVertex, modelTranslucentUnlitPixel);
addPipeline( addPipeline(
Key::Builder().withTranslucent().withTangents(), Key::Builder().withTranslucent().withTangents(),
modelNormalMapVertex, modelTranslucentPixel); modelNormalMapVertex, modelTranslucentPixel);

View file

@ -30,7 +30,7 @@ void main(void) {
<$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex, occlusionTex)$> <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex, occlusionTex)$>
float opacity = 1.0; float opacity = 1.0;
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
<$discardTransparent(opacity)$>; <$discardTransparent(opacity)$>;
vec3 albedo = getMaterialAlbedo(mat); vec3 albedo = getMaterialAlbedo(mat);

View file

@ -31,7 +31,7 @@ void main(void) {
<$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex, occlusionTex)$> <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex, occlusionTex)$>
float opacity = 1.0; float opacity = 1.0;
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
<$discardTransparent(opacity)$>; <$discardTransparent(opacity)$>;
vec3 albedo = getMaterialAlbedo(mat); vec3 albedo = getMaterialAlbedo(mat);

View file

@ -31,7 +31,7 @@ void main(void) {
<$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex, occlusionTex)$> <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex, occlusionTex)$>
float opacity = 1.0; float opacity = 1.0;
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
<$discardTransparent(opacity)$>; <$discardTransparent(opacity)$>;
vec3 albedo = getMaterialAlbedo(mat); vec3 albedo = getMaterialAlbedo(mat);

View file

@ -38,8 +38,7 @@ void main(void) {
<$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex, occlusionTex)$> <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex, occlusionTex)$>
float opacity = getMaterialOpacity(mat) * _alpha; float opacity = getMaterialOpacity(mat) * _alpha;
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
<$discardTransparent(opacity)$>;
vec3 albedo = getMaterialAlbedo(mat); vec3 albedo = getMaterialAlbedo(mat);
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;

View file

@ -29,18 +29,11 @@ void main(void) {
<$fetchMaterialTextures(matKey, _texCoord0, albedoTex, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL)$> <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL)$>
float opacity = getMaterialOpacity(mat) * _alpha; float opacity = getMaterialOpacity(mat) * _alpha;
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
<$discardTransparent(opacity)$>;
vec3 albedo = getMaterialAlbedo(mat); vec3 albedo = getMaterialAlbedo(mat);
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
albedo *= _color; albedo *= _color;
vec4 albedo = texture(albedoMap, _texCoord0); _fragColor = vec4(albedo, opacity);
Material mat = getMaterial();
vec3 fragColor = getMaterialAlbedo(mat) * albedo.rgb * _color;
float fragOpacity = getMaterialOpacity(mat) * albedo.a * _alpha;
_fragColor = vec4(fragColor, fragOpacity);
} }

View file

@ -30,7 +30,7 @@ void main(void) {
<$fetchMaterialTextures(matKey, _texCoord0, albedoTex, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL)$> <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL)$>
float opacity = 1.0; float opacity = 1.0;
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
<$discardTransparent(opacity)$>; <$discardTransparent(opacity)$>;
vec3 albedo = getMaterialAlbedo(mat); vec3 albedo = getMaterialAlbedo(mat);

View file

@ -71,9 +71,7 @@ void main(void) {
fragRoughness, fragRoughness,
fragOpacity); fragOpacity);
if (gl_FragCoord.x > 1000) {
color = vec4(fragAlbedo, color.w);
}
// Apply standard tone mapping // Apply standard tone mapping
_fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w);
} }

View file

@ -26,7 +26,6 @@ public:
LIGHTMAP, LIGHTMAP,
TANGENTS, TANGENTS,
SPECULAR, SPECULAR,
EMISSIVE,
UNLIT, UNLIT,
SKINNED, SKINNED,
STEREO, STEREO,
@ -58,7 +57,6 @@ public:
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); }
Builder& withSpecular() { _flags.set(SPECULAR); return (*this); } Builder& withSpecular() { _flags.set(SPECULAR); return (*this); }
Builder& withEmissive() { _flags.set(EMISSIVE); return (*this); }
Builder& withUnlit() { _flags.set(UNLIT); return (*this); } Builder& withUnlit() { _flags.set(UNLIT); return (*this); }
Builder& withSkinned() { _flags.set(SKINNED); return (*this); } Builder& withSkinned() { _flags.set(SKINNED); return (*this); }
Builder& withStereo() { _flags.set(STEREO); return (*this); } Builder& withStereo() { _flags.set(STEREO); return (*this); }
@ -103,9 +101,6 @@ public:
Builder& withSpecular() { _flags.set(SPECULAR); _mask.set(SPECULAR); return (*this); } Builder& withSpecular() { _flags.set(SPECULAR); _mask.set(SPECULAR); return (*this); }
Builder& withoutSpecular() { _flags.reset(SPECULAR); _mask.set(SPECULAR); return (*this); } Builder& withoutSpecular() { _flags.reset(SPECULAR); _mask.set(SPECULAR); return (*this); }
Builder& withEmissive() { _flags.set(EMISSIVE); _mask.set(EMISSIVE); return (*this); }
Builder& withoutEmissive() { _flags.reset(EMISSIVE); _mask.set(EMISSIVE); return (*this); }
Builder& withUnlit() { _flags.set(UNLIT); _mask.set(UNLIT); return (*this); } Builder& withUnlit() { _flags.set(UNLIT); _mask.set(UNLIT); return (*this); }
Builder& withoutUnlit() { _flags.reset(UNLIT); _mask.set(UNLIT); return (*this); } Builder& withoutUnlit() { _flags.reset(UNLIT); _mask.set(UNLIT); return (*this); }
@ -142,7 +137,6 @@ public:
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]; }
bool hasEmissive() const { return _flags[EMISSIVE]; }
bool isUnlit() const { return _flags[UNLIT]; } bool isUnlit() const { return _flags[UNLIT]; }
bool isTranslucent() const { return _flags[TRANSLUCENT]; } bool isTranslucent() const { return _flags[TRANSLUCENT]; }
bool isSkinned() const { return _flags[SKINNED]; } bool isSkinned() const { return _flags[SKINNED]; }
@ -179,7 +173,6 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) {
<< "hasLightmap:" << key.hasLightmap() << "hasLightmap:" << key.hasLightmap()
<< "hasTangents:" << key.hasTangents() << "hasTangents:" << key.hasTangents()
<< "hasSpecular:" << key.hasSpecular() << "hasSpecular:" << key.hasSpecular()
<< "hasEmissive:" << key.hasEmissive()
<< "isUnlit:" << key.isUnlit() << "isUnlit:" << key.isUnlit()
<< "isTranslucent:" << key.isTranslucent() << "isTranslucent:" << key.isTranslucent()
<< "isSkinned:" << key.isSkinned() << "isSkinned:" << key.isSkinned()