mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:17:02 +02:00
Remove duplicate DeferredBufferWrite.slh
This commit is contained in:
parent
a820682816
commit
e284cbe355
2 changed files with 1 additions and 79 deletions
|
@ -1,6 +1,6 @@
|
||||||
set(TARGET_NAME entities-renderer)
|
set(TARGET_NAME entities-renderer)
|
||||||
|
|
||||||
AUTOSCRIBE_SHADER_LIB(gpu model render)
|
AUTOSCRIBE_SHADER_LIB(gpu model render render-utils)
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Widgets Network Script)
|
setup_hifi_library(Widgets Network Script)
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
<!
|
|
||||||
// DeferredBufferWrite.slh
|
|
||||||
// libraries/render-utils/src
|
|
||||||
//
|
|
||||||
// Created by Sam Gateau on 1/12/15.
|
|
||||||
// Copyright 2013 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
!>
|
|
||||||
<@if not DEFERRED_BUFFER_WRITE_SLH@>
|
|
||||||
<@def DEFERRED_BUFFER_WRITE_SLH@>
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 _fragColor0;
|
|
||||||
layout(location = 1) out vec4 _fragColor1;
|
|
||||||
layout(location = 2) out vec4 _fragColor2;
|
|
||||||
|
|
||||||
// the glow intensity
|
|
||||||
uniform float glowIntensity;
|
|
||||||
|
|
||||||
// the alpha threshold
|
|
||||||
uniform float alphaThreshold;
|
|
||||||
|
|
||||||
uniform sampler2D normalFittingMap;
|
|
||||||
|
|
||||||
vec3 bestFitNormal(vec3 normal) {
|
|
||||||
vec3 absNorm = abs(normal);
|
|
||||||
float maxNAbs = max(absNorm.z, max(absNorm.x, absNorm.y));
|
|
||||||
|
|
||||||
vec2 texcoord = (absNorm.z < maxNAbs ?
|
|
||||||
(absNorm.y < maxNAbs ? absNorm.yz : absNorm.xz) :
|
|
||||||
absNorm.xy);
|
|
||||||
texcoord = (texcoord.x < texcoord.y ? texcoord.yx : texcoord.xy);
|
|
||||||
texcoord.y /= texcoord.x;
|
|
||||||
vec3 cN = normal / maxNAbs;
|
|
||||||
float fittingScale = texture(normalFittingMap, texcoord).a;
|
|
||||||
cN *= fittingScale;
|
|
||||||
return (cN * 0.5 + 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
float evalOpaqueFinalAlpha(float alpha, float mapAlpha) {
|
|
||||||
return mix(alpha * glowIntensity, 1.0 - alpha * glowIntensity, step(mapAlpha, alphaThreshold));
|
|
||||||
}
|
|
||||||
|
|
||||||
const vec3 DEFAULT_SPECULAR = vec3(0.1);
|
|
||||||
const float DEFAULT_SHININESS = 10;
|
|
||||||
|
|
||||||
void packDeferredFragment(vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess) {
|
|
||||||
if (alpha != glowIntensity) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
_fragColor0 = vec4(diffuse.rgb, alpha);
|
|
||||||
_fragColor1 = vec4(bestFitNormal(normal), 1.0);
|
|
||||||
_fragColor2 = vec4(specular, shininess / 128.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess, vec3 emissive) {
|
|
||||||
if (alpha != glowIntensity) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
|
|
||||||
_fragColor0 = vec4(diffuse.rgb, alpha);
|
|
||||||
//_fragColor1 = vec4(normal, 0.0) * 0.5 + vec4(0.5, 0.5, 0.5, 1.0);
|
|
||||||
_fragColor1 = vec4(bestFitNormal(normal), 0.5);
|
|
||||||
_fragColor2 = vec4(emissive, shininess / 128.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess) {
|
|
||||||
if (alpha <= alphaThreshold) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
|
|
||||||
_fragColor0 = vec4(diffuse.rgb, alpha);
|
|
||||||
// _fragColor1 = vec4(normal, 0.0) * 0.5 + vec4(0.5, 0.5, 0.5, 1.0);
|
|
||||||
// _fragColor2 = vec4(specular, shininess / 128.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
<@endif@>
|
|
Loading…
Reference in a new issue