mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 16:32:38 +02:00
Merge remote-tracking branch 'hifi/master' into android_places_goto
This commit is contained in:
commit
c33f1fbbb1
70 changed files with 225 additions and 304 deletions
|
@ -376,6 +376,11 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU
|
|||
return;
|
||||
}
|
||||
|
||||
if (streamToAdd.getType() == PositionalAudioStream::Injector) {
|
||||
// apply per-avatar gain to positional audio injectors, which wouldn't otherwise be affected by PAL sliders
|
||||
hrtf.setGainAdjustment(listenerNodeData.hrtfForStream(sourceNodeID, QUuid()).getGainAdjustment());
|
||||
}
|
||||
|
||||
hrtf.render(_bufferSamples, _mixSamples, HRTF_DATASET_INDEX, azimuth, distance, gain,
|
||||
AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL);
|
||||
|
||||
|
|
|
@ -2690,6 +2690,12 @@ void Application::initializeUi() {
|
|||
// Now that the menu is instantiated, ensure the display plugin menu is properly updated
|
||||
updateDisplayMode();
|
||||
flushMenuUpdates();
|
||||
|
||||
// The display plugins are created before the menu now, so we need to do this here to hide the menu bar
|
||||
// now that it exists
|
||||
if (_window && _window->isFullScreen()) {
|
||||
setFullscreen(nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ protected:
|
|||
// Backend dependant compilation of the shader
|
||||
virtual GLShader* compileBackendProgram(const Shader& program, const Shader::CompilationHandler& handler);
|
||||
virtual GLShader* compileBackendShader(const Shader& shader, const Shader::CompilationHandler& handler);
|
||||
virtual std::string getBackendShaderHeader() const;
|
||||
virtual std::string getBackendShaderHeader() const = 0;
|
||||
virtual void makeProgramBindings(ShaderObject& shaderObject);
|
||||
class ElementResource {
|
||||
public:
|
||||
|
|
|
@ -12,27 +12,6 @@
|
|||
using namespace gpu;
|
||||
using namespace gpu::gl;
|
||||
|
||||
// GLSL version
|
||||
std::string GLBackend::getBackendShaderHeader() const {
|
||||
|
||||
#if defined(USE_GLES)
|
||||
static const std::string header(
|
||||
R"SHADER(#version 310 es
|
||||
#extension GL_EXT_texture_buffer : enable
|
||||
precision lowp float; // check precision 2
|
||||
precision lowp samplerBuffer;
|
||||
precision lowp sampler2DShadow;
|
||||
)SHADER");
|
||||
#else
|
||||
static const std::string header(
|
||||
R"SHADER(#version 410 core
|
||||
)SHADER");
|
||||
#endif
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
|
||||
// Shader domain
|
||||
static const size_t NUM_SHADER_DOMAINS = 3;
|
||||
static_assert(Shader::Type::NUM_DOMAINS == NUM_SHADER_DOMAINS, "GL shader domains must equal defined GPU shader domains");
|
||||
|
|
|
@ -14,7 +14,13 @@ using namespace gpu::gl41;
|
|||
|
||||
// GLSL version
|
||||
std::string GL41Backend::getBackendShaderHeader() const {
|
||||
return std::string("#version 410 core\n#define GPU_GL410 1");
|
||||
static const std::string header(
|
||||
R"SHADER(#version 410 core
|
||||
#define GPU_GL410
|
||||
#define PRECISIONQ
|
||||
#define BITFIELD int
|
||||
)SHADER");
|
||||
return header;
|
||||
}
|
||||
|
||||
int GL41Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {
|
||||
|
|
|
@ -15,15 +15,17 @@ using namespace gpu::gl45;
|
|||
|
||||
// GLSL version
|
||||
std::string GL45Backend::getBackendShaderHeader() const {
|
||||
const char header[] =
|
||||
R"GLSL(#version 450 core
|
||||
#define GPU_GL450
|
||||
)GLSL"
|
||||
static const std::string header(
|
||||
R"SHADER(#version 450 core
|
||||
#define GPU_GL450
|
||||
#define PRECISIONQ
|
||||
#define BITFIELD int
|
||||
)SHADER"
|
||||
#ifdef GPU_SSBO_TRANSFORM_OBJECT
|
||||
R"GLSL(#define GPU_SSBO_TRANSFORM_OBJECT 1)GLSL"
|
||||
R"SHADER(#define GPU_SSBO_TRANSFORM_OBJECT)SHADER"
|
||||
#endif
|
||||
;
|
||||
return std::string(header);
|
||||
);
|
||||
return header;
|
||||
}
|
||||
|
||||
int GL45Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {
|
||||
|
|
|
@ -14,7 +14,16 @@ using namespace gpu::gles;
|
|||
|
||||
// GLSL version
|
||||
std::string GLESBackend::getBackendShaderHeader() const {
|
||||
return Parent::getBackendShaderHeader();
|
||||
static const std::string header(
|
||||
R"SHADER(#version 310 es
|
||||
#extension GL_EXT_texture_buffer : enable
|
||||
precision lowp float; // check precision 2
|
||||
precision lowp samplerBuffer;
|
||||
precision lowp sampler2DShadow;
|
||||
#define PRECISIONQ highp
|
||||
#define BITFIELD highp int
|
||||
)SHADER");
|
||||
return header;
|
||||
}
|
||||
|
||||
int GLESBackend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {
|
||||
|
|
|
@ -29,16 +29,9 @@ vec3 getLightColor(Light l) { return lightIrradiance_getColor(l.irradiance); }
|
|||
float getLightIntensity(Light l) { return lightIrradiance_getIntensity(l.irradiance); }
|
||||
vec3 getLightIrradiance(Light l) { return lightIrradiance_getIrradiance(l.irradiance); }
|
||||
|
||||
// AMbient lighting needs extra info provided from a different Buffer
|
||||
// Ambient lighting needs extra info provided from a different Buffer
|
||||
<@include graphics/SphericalHarmonics.shared.slh@>
|
||||
// Light Ambient
|
||||
#ifndef PRECISIONQ
|
||||
#ifdef GL_ES
|
||||
#define PRECISIONQ highp
|
||||
#else
|
||||
#define PRECISIONQ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct LightAmbient {
|
||||
PRECISIONQ vec4 _ambient;
|
||||
|
|
|
@ -12,13 +12,7 @@
|
|||
|
||||
|
||||
#define LightIrradianceConstRef LightIrradiance
|
||||
#ifndef PRECISIONQ
|
||||
#ifdef GL_ES
|
||||
#define PRECISIONQ highp
|
||||
#else
|
||||
#define PRECISIONQ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct LightIrradiance {
|
||||
PRECISIONQ vec4 colorIntensity;
|
||||
// falloffRadius, cutoffRadius, falloffSpot, spare
|
||||
|
|
|
@ -15,14 +15,6 @@
|
|||
|
||||
#define LightVolumeConstRef LightVolume
|
||||
|
||||
#ifndef PRECISIONQ
|
||||
#ifdef GL_ES
|
||||
#define PRECISIONQ highp
|
||||
#else
|
||||
#define PRECISIONQ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct LightVolume {
|
||||
PRECISIONQ vec4 positionRadius;
|
||||
PRECISIONQ vec4 directionSpotCos;
|
||||
|
|
|
@ -13,14 +13,7 @@
|
|||
|
||||
// The material values (at least the material key) must be precisely bitwise accurate
|
||||
// to what is provided by the uniform buffer, or the material key has the wrong bits
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#define BITFIELD highp int
|
||||
#define PRECISIONQ highp
|
||||
#else
|
||||
#define BITFIELD int
|
||||
#define PRECISIONQ
|
||||
#endif
|
||||
|
||||
struct Material {
|
||||
PRECISIONQ vec4 _emissiveOpacity;
|
||||
PRECISIONQ vec4 _albedoRoughness;
|
||||
|
|
|
@ -15,14 +15,6 @@
|
|||
|
||||
#define SphericalHarmonicsConstRef SphericalHarmonics
|
||||
|
||||
#ifndef PRECISIONQ
|
||||
#ifdef GL_ES
|
||||
#define PRECISIONQ highp
|
||||
#else
|
||||
#define PRECISIONQ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct SphericalHarmonics {
|
||||
PRECISIONQ vec4 L00;
|
||||
PRECISIONQ vec4 L1m1;
|
||||
|
|
|
@ -13,14 +13,6 @@
|
|||
|
||||
<@func declareLightingModel()@>
|
||||
|
||||
#ifndef PRECISIONQ
|
||||
#ifdef GL_ES
|
||||
#define PRECISIONQ highp
|
||||
#else
|
||||
#define PRECISIONQ
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct LightingModel {
|
||||
PRECISIONQ vec4 _UnlitEmissiveLightmapBackground;
|
||||
PRECISIONQ vec4 _ScatteringDiffuseSpecularAlbedo;
|
||||
|
|
|
@ -36,8 +36,8 @@ void main(void) {
|
|||
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
discard;
|
||||
} else {
|
||||
vec4 midNormalCurvature;
|
||||
vec4 lowNormalCurvature;
|
||||
vec4 midNormalCurvature = vec4(0);
|
||||
vec4 lowNormalCurvature = vec4(0);
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ void main(void) {
|
|||
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
discard;
|
||||
} else {
|
||||
vec4 midNormalCurvature;
|
||||
vec4 lowNormalCurvature;
|
||||
vec4 midNormalCurvature = vec4(0);
|
||||
vec4 lowNormalCurvature = vec4(0);
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ void main(void) {
|
|||
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
discard;
|
||||
} else {
|
||||
vec4 midNormalCurvature;
|
||||
vec4 lowNormalCurvature;
|
||||
vec4 midNormalCurvature = vec4(0);
|
||||
vec4 lowNormalCurvature = vec4(0);
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ void main(void) {
|
|||
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
|
||||
discard;
|
||||
} else {
|
||||
vec4 midNormalCurvature;
|
||||
vec4 lowNormalCurvature;
|
||||
vec4 midNormalCurvature = vec4(0);
|
||||
vec4 lowNormalCurvature = vec4(0);
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||
|
||||
in vec4 _position;
|
||||
in vec4 _positionES;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
@ -54,8 +54,8 @@ void main(void) {
|
|||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||
vec3 fresnel = getFresnelF0(metallic, albedo);
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
vec3 fragNormal = normalize(_normal);
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
vec3 fragNormal = normalize(_normalWS);
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec4 _positionES;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
|
@ -56,8 +56,8 @@ void main(void) {
|
|||
vec3 emissive = getMaterialEmissive(mat);
|
||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
vec3 fragNormal = normalize(_normal);
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
vec3 fragNormal = normalize(_normalWS);
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
<$declareMaterialTextures(ALBEDO)$>
|
||||
|
||||
in vec2 _texCoord0;
|
||||
in vec3 _normal;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
|
|
|
@ -17,12 +17,9 @@
|
|||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _modelNormal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
in vec4 _eyePosition;
|
||||
in vec4 _positionES;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
|
@ -33,7 +30,7 @@ layout(location = 0) out vec4 _fragColor0;
|
|||
|
||||
#line 2030
|
||||
void main(void) {
|
||||
vec3 normal = normalize(_normal.xyz);
|
||||
vec3 normal = normalize(_normalWS.xyz);
|
||||
vec3 diffuse = _color.rgb;
|
||||
vec3 specular = DEFAULT_SPECULAR;
|
||||
float shininess = DEFAULT_SHININESS;
|
||||
|
@ -53,7 +50,7 @@ void main(void) {
|
|||
#endif
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragPosition = _eyePosition.xyz;
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
|
||||
if (emissiveAmount > 0.0) {
|
||||
_fragColor0 = vec4(evalSkyboxGlobalColor(
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _eyePosition;
|
||||
in vec4 _positionES;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
|
@ -35,14 +35,14 @@ void main(void) {
|
|||
float colorAlpha = _color.a * texel.a;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragPosition = _eyePosition.xyz;
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
|
||||
_fragColor0 = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
DEFAULT_OCCLUSION,
|
||||
fragPosition,
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_FRESNEL,
|
||||
DEFAULT_METALLIC,
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _eyePosition;
|
||||
in vec4 _positionES;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
|
@ -35,14 +35,14 @@ void main(void) {
|
|||
float colorAlpha = _color.a * texel.a;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragPosition = _eyePosition.xyz;
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
|
||||
_fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
DEFAULT_OCCLUSION,
|
||||
fragPosition,
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_FRESNEL,
|
||||
DEFAULT_METALLIC,
|
||||
|
|
|
@ -17,11 +17,9 @@
|
|||
<$declareEvalGlobalLightingAlphaBlended()$>
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _modelNormal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _eyePosition;
|
||||
in vec4 _positionES;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
|
@ -32,7 +30,7 @@ layout(location = 0) out vec4 _fragColor0;
|
|||
|
||||
#line 2030
|
||||
void main(void) {
|
||||
vec3 normal = normalize(_normal.xyz);
|
||||
vec3 normal = normalize(_normalWS.xyz);
|
||||
vec3 diffuse = _color.rgb;
|
||||
vec3 specular = DEFAULT_SPECULAR;
|
||||
float shininess = DEFAULT_SHININESS;
|
||||
|
@ -52,7 +50,7 @@ void main(void) {
|
|||
#endif
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragPosition = _eyePosition.xyz;
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
|
||||
if (emissiveAmount > 0.0) {
|
||||
_fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||
|
|
|
@ -62,6 +62,7 @@ void main(void) {
|
|||
// Frag to eye vec
|
||||
vec4 fragEyeVector = invViewMat * vec4(-frag.position.xyz, 0.0);
|
||||
vec3 fragEyeDir = normalize(fragEyeVector.xyz);
|
||||
_fragColor = vec4(0, 0, 0, 1);
|
||||
|
||||
int numLightTouching = 0;
|
||||
int lightClusterOffset = cluster.z;
|
||||
|
|
|
@ -45,8 +45,8 @@ void main(void) {
|
|||
discard;
|
||||
}
|
||||
|
||||
vec4 midNormalCurvature;
|
||||
vec4 lowNormalCurvature;
|
||||
vec4 midNormalCurvature = vec4(0);
|
||||
vec4 lowNormalCurvature = vec4(0);
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
unpackMidLowNormalCurvature(texCoord, midNormalCurvature, lowNormalCurvature);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$>
|
||||
|
||||
in vec4 _position;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
|
||||
|
||||
|
@ -53,7 +52,7 @@ void main(void) {
|
|||
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||
|
||||
packDeferredFragment(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
opacity,
|
||||
albedo,
|
||||
roughness,
|
||||
|
|
|
@ -23,8 +23,8 @@ out vec3 _color;
|
|||
out float _alpha;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec4 _position;
|
||||
out vec3 _normal;
|
||||
out vec4 _positionES;
|
||||
out vec3 _normalWS;
|
||||
|
||||
void main(void) {
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
|
@ -37,6 +37,6 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<@include Fade.slh@>
|
||||
<$declareFadeFragment()$>
|
||||
|
||||
in vec4 _positionES;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normalWS;
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$>
|
||||
<$declareMaterialLightmap()$>
|
||||
|
||||
in vec4 _position;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
|
||||
void main(void) {
|
||||
|
@ -33,7 +32,7 @@ void main(void) {
|
|||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
||||
|
||||
packDeferredFragmentLightmap(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
||||
getMaterialAlbedo(mat) * albedo.rgb * _color,
|
||||
getMaterialRoughness(mat) * roughness,
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTexMapArrayBuffer()$>
|
||||
|
||||
out vec4 _position;
|
||||
out vec4 _positionES;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec3 _normal;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _color;
|
||||
|
||||
void main(void) {
|
||||
|
@ -38,7 +38,6 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
}
|
||||
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
}
|
|
@ -23,19 +23,18 @@
|
|||
<@include Fade.slh@>
|
||||
<$declareFadeFragment()$>
|
||||
|
||||
in vec4 _position;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
vec3 fadeEmissive;
|
||||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParams(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
Material mat = getMaterial();
|
||||
BITFIELD matKey = getMaterialKey(mat);
|
||||
|
@ -43,7 +42,7 @@ void main(void) {
|
|||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
||||
|
||||
packDeferredFragmentLightmap(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
||||
getMaterialAlbedo(mat) * albedo.rgb * _color,
|
||||
getMaterialRoughness(mat) * roughness,
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTexMapArrayBuffer()$>
|
||||
|
||||
out vec4 _position;
|
||||
out vec4 _positionES;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec3 _normal;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _color;
|
||||
out vec4 _worldPosition;
|
||||
out vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
// pass along the color in linear space
|
||||
|
@ -39,8 +39,8 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _positionWS)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$>
|
||||
<$declareMaterialLightmap()$>
|
||||
|
||||
in vec4 _position;
|
||||
in vec4 _positionES;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normal;
|
||||
in vec3 _tangent;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _tangentWS;
|
||||
in vec3 _color;
|
||||
|
||||
void main(void) {
|
||||
|
@ -34,7 +34,7 @@ void main(void) {
|
|||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
||||
|
||||
vec3 fragNormal;
|
||||
<$evalMaterialNormalLOD(_position, normalTexel, _normal, _tangent, fragNormal)$>
|
||||
<$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$>
|
||||
|
||||
packDeferredFragmentLightmap(
|
||||
normalize(fragNormal.xyz),
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTexMapArrayBuffer()$>
|
||||
|
||||
out vec4 _position;
|
||||
out vec4 _positionES;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec3 _normal;
|
||||
out vec3 _tangent;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _tangentWS;
|
||||
out vec3 _color;
|
||||
|
||||
void main(void) {
|
||||
|
@ -38,7 +38,7 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangent)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
<$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$>
|
||||
}
|
||||
|
|
|
@ -23,20 +23,20 @@
|
|||
<@include Fade.slh@>
|
||||
<$declareFadeFragment()$>
|
||||
|
||||
in vec4 _position;
|
||||
in vec4 _positionES;
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec3 _normal;
|
||||
in vec3 _tangent;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _tangentWS;
|
||||
in vec3 _color;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
vec3 fadeEmissive;
|
||||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParams(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
Material mat = getMaterial();
|
||||
BITFIELD matKey = getMaterialKey(mat);
|
||||
|
@ -44,7 +44,7 @@ void main(void) {
|
|||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
||||
|
||||
vec3 fragNormal;
|
||||
<$evalMaterialNormalLOD(_position, normalTexel, _normal, _tangent, fragNormal)$>
|
||||
<$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$>
|
||||
|
||||
packDeferredFragmentLightmap(
|
||||
normalize(fragNormal.xyz),
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTexMapArrayBuffer()$>
|
||||
|
||||
out vec4 _position;
|
||||
out vec4 _positionES;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec3 _normal;
|
||||
out vec3 _tangent;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _tangentWS;
|
||||
out vec3 _color;
|
||||
out vec4 _worldPosition;
|
||||
out vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
// pass along the color in linear space
|
||||
|
@ -39,8 +39,8 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangent)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _positionWS)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
<$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$>
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
layout(location = 0) out vec4 _fragColor;
|
||||
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParams(fadeParams)$>
|
||||
applyFadeClip(fadeParams, _worldPosition.xyz);
|
||||
applyFadeClip(fadeParams, _positionWS.xyz);
|
||||
|
||||
// pass-through to set z-buffer
|
||||
_fragColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
out vec4 _worldPosition;
|
||||
out vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _positionWS)$>
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<$declareMaterialTextures(ALBEDO)$>
|
||||
|
||||
in vec2 _texCoord0;
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
|
@ -39,7 +39,7 @@ void main(void) {
|
|||
albedo *= _color;
|
||||
|
||||
packDeferredFragmentUnlit(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
opacity,
|
||||
albedo * isUnlitEnabled());
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
|
|||
LightAmbient ambient = getLightAmbient();
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, normal, fragNormal)$>
|
||||
vec3 fragEyeVectorView = normalize(-position);
|
||||
vec3 fragEyeDir;
|
||||
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
|
||||
|
@ -57,8 +55,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec4 _positionES;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
|
@ -67,8 +65,8 @@ out vec4 _fragColor;
|
|||
void main(void) {
|
||||
vec4 albedo = texture(originalTexture, _texCoord0);
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
vec3 fragNormal = normalize(_normal);
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
vec3 fragNormal = normalize(_normalWS);
|
||||
vec3 fragAlbedo = albedo.rgb * _color;
|
||||
float fragMetallic = 0.0;
|
||||
vec3 fragSpecular = vec3(0.1);
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
out vec3 _color;
|
||||
out float _alpha;
|
||||
out vec2 _texCoord0;
|
||||
out vec4 _position;
|
||||
out vec3 _normal;
|
||||
out vec4 _positionES;
|
||||
out vec3 _normalWS;
|
||||
|
||||
void main(void) {
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
|
@ -31,6 +31,6 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec4 _positionES;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
|
@ -55,19 +55,16 @@ void main(void) {
|
|||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
//vec3 fragNormal = normalize(_normal);
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>;
|
||||
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
occlusionTex,
|
||||
fragPosition,
|
||||
fragNormal,
|
||||
normalize(_normalWS),
|
||||
albedo,
|
||||
fresnel,
|
||||
metallic,
|
||||
|
|
|
@ -23,10 +23,9 @@
|
|||
|
||||
in vec2 _texCoord0;
|
||||
in vec2 _texCoord1;
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec4 _positionES;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
|
@ -52,19 +51,15 @@ void main(void) {
|
|||
vec3 emissive = getMaterialEmissive(mat);
|
||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
||||
|
||||
vec4 color = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
occlusionTex,
|
||||
fragPosition,
|
||||
fragNormal,
|
||||
normalize(_normalWS),
|
||||
albedo,
|
||||
fresnel,
|
||||
metallic,
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
<$declareMaterialTextures(ALBEDO)$>
|
||||
|
||||
in vec2 _texCoord0;
|
||||
in vec3 _normal;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
<$declareMaterialTextures(ALBEDO)$>
|
||||
|
||||
in vec2 _texCoord0;
|
||||
in vec3 _normal;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
|
|||
LightAmbient ambient = getLightAmbient();
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, normal, fragNormal)$>
|
||||
vec3 fragEyeVectorView = normalize(-position);
|
||||
vec3 fragEyeDir;
|
||||
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
|
||||
|
@ -57,8 +55,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec4 _positionES;
|
||||
in vec3 _normalWS;
|
||||
in vec3 _color;
|
||||
in float _alpha;
|
||||
|
||||
|
@ -67,8 +65,8 @@ out vec4 _fragColor;
|
|||
void main(void) {
|
||||
vec4 albedo = texture(originalTexture, _texCoord0);
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
vec3 fragNormal = normalize(_normal);
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
vec3 fragNormal = normalize(_normalWS);
|
||||
vec3 fragAlbedo = albedo.rgb * _color;
|
||||
float fragMetallic = 0.0;
|
||||
vec3 fragSpecular = vec3(0.1);
|
||||
|
|
|
@ -17,7 +17,7 @@ uniform bool Outline;
|
|||
uniform vec4 Color;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
const float gamma = 2.2;
|
||||
|
@ -47,7 +47,7 @@ void main() {
|
|||
}
|
||||
|
||||
packDeferredFragment(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
a * Color.a,
|
||||
Color.rgb,
|
||||
DEFAULT_ROUGHNESS,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<$declareStandardTransform()$>
|
||||
|
||||
// the interpolated normal
|
||||
out vec3 _normal;
|
||||
out vec3 _normalWS;
|
||||
out vec2 _texCoord0;
|
||||
|
||||
void main() {
|
||||
|
@ -28,5 +28,5 @@ void main() {
|
|||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
||||
const vec3 normal = vec3(0, 0, 1);
|
||||
<$transformModelToWorldDir(cam, obj, normal, _normal)$>
|
||||
<$transformModelToWorldDir(cam, obj, normal, _normalWS)$>
|
||||
}
|
|
@ -17,7 +17,7 @@ uniform bool Outline;
|
|||
uniform vec4 Color;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
const float gamma = 2.2;
|
||||
|
@ -47,7 +47,7 @@ void main() {
|
|||
}
|
||||
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
a * Color.a,
|
||||
Color.rgb,
|
||||
DEFAULT_FRESNEL,
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
<@include DeferredBufferWrite.slh@>
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _modelNormal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
|
||||
//PROCEDURAL_COMMON_BLOCK
|
||||
|
||||
|
@ -28,7 +25,7 @@ in vec4 _position;
|
|||
|
||||
#line 2030
|
||||
void main(void) {
|
||||
vec3 normal = normalize(_normal.xyz);
|
||||
vec3 normal = normalize(_normalWS.xyz);
|
||||
vec3 diffuse = _color.rgb;
|
||||
vec3 specular = DEFAULT_SPECULAR;
|
||||
float shininess = DEFAULT_SHININESS;
|
||||
|
|
|
@ -18,22 +18,22 @@
|
|||
<$declareStandardTransform()$>
|
||||
|
||||
// the interpolated normal
|
||||
out vec3 _normal;
|
||||
out vec3 _modelNormal;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _normalMS;
|
||||
out vec4 _color;
|
||||
out vec2 _texCoord0;
|
||||
out vec4 _position;
|
||||
out vec4 _eyePosition;
|
||||
out vec4 _positionMS;
|
||||
out vec4 _positionES;
|
||||
|
||||
void main(void) {
|
||||
_color = color_sRGBAToLinear(inColor);
|
||||
_texCoord0 = inTexCoord0.st;
|
||||
_position = inPosition;
|
||||
_modelNormal = inNormal.xyz;
|
||||
_positionMS = inPosition;
|
||||
_normalMS = inNormal.xyz;
|
||||
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _eyePosition, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
}
|
|
@ -18,12 +18,9 @@
|
|||
<$declareFadeFragmentInstanced()$>
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _modelNormal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
//PROCEDURAL_COMMON_BLOCK
|
||||
|
||||
|
@ -36,9 +33,9 @@ void main(void) {
|
|||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParamsInstanced(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
vec3 normal = normalize(_normal.xyz);
|
||||
vec3 normal = normalize(_normalWS.xyz);
|
||||
vec3 diffuse = _color.rgb;
|
||||
vec3 specular = DEFAULT_SPECULAR;
|
||||
float shininess = DEFAULT_SHININESS;
|
||||
|
|
|
@ -21,25 +21,25 @@
|
|||
<$declareFadeVertexInstanced()$>
|
||||
|
||||
// the interpolated normal
|
||||
out vec3 _normal;
|
||||
out vec3 _modelNormal;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _normalMS;
|
||||
out vec4 _color;
|
||||
out vec2 _texCoord0;
|
||||
out vec4 _position;
|
||||
out vec4 _eyePosition;
|
||||
out vec4 _worldPosition;
|
||||
out vec4 _positionMS;
|
||||
out vec4 _positionES;
|
||||
out vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
_color = color_sRGBAToLinear(inColor);
|
||||
_texCoord0 = inTexCoord0.st;
|
||||
_position = inPosition;
|
||||
_modelNormal = inNormal.xyz;
|
||||
_positionMS = inPosition;
|
||||
_normalMS = inNormal.xyz;
|
||||
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _eyePosition, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, inPosition, _positionWS)$>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
<$passThroughFadeObjectParams()$>
|
||||
}
|
|
@ -19,12 +19,12 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
void main(void) {
|
||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
packDeferredFragmentUnlit(normalize(_normal), 1.0, _color.rgb * texel.rgb);
|
||||
packDeferredFragmentUnlit(normalize(_normalWS), 1.0, _color.rgb * texel.rgb);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
|
@ -26,7 +26,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0);
|
||||
|
||||
packDeferredFragment(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
1.0,
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_ROUGHNESS,
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
// Declare after all samplers to prevent sampler location mix up with originalTexture
|
||||
<$declareFadeFragmentInstanced()$>
|
||||
|
@ -34,7 +34,7 @@ void main(void) {
|
|||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParamsInstanced(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
vec4 texel = texture(originalTexture, _texCoord0);
|
||||
float colorAlpha = _color.a;
|
||||
|
@ -46,14 +46,14 @@ void main(void) {
|
|||
const float ALPHA_THRESHOLD = 0.999;
|
||||
if (colorAlpha * texel.a < ALPHA_THRESHOLD) {
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
colorAlpha * texel.a,
|
||||
_color.rgb * texel.rgb + fadeEmissive,
|
||||
DEFAULT_FRESNEL,
|
||||
DEFAULT_ROUGHNESS);
|
||||
} else {
|
||||
packDeferredFragment(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
1.0,
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_ROUGHNESS,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
|
@ -34,14 +34,14 @@ void main(void) {
|
|||
const float ALPHA_THRESHOLD = 0.999;
|
||||
if (colorAlpha * texel.a < ALPHA_THRESHOLD) {
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
colorAlpha * texel.a,
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_FRESNEL,
|
||||
DEFAULT_ROUGHNESS);
|
||||
} else {
|
||||
packDeferredFragmentUnlit(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
1.0,
|
||||
_color.rgb * texel.rgb);
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
// Declare after all samplers to prevent sampler location mix up with originalTexture
|
||||
<$declareFadeFragmentInstanced()$>
|
||||
|
@ -34,7 +34,7 @@ void main(void) {
|
|||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParamsInstanced(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float colorAlpha = _color.a;
|
||||
|
@ -46,14 +46,14 @@ void main(void) {
|
|||
const float ALPHA_THRESHOLD = 0.999;
|
||||
if (colorAlpha * texel.a < ALPHA_THRESHOLD) {
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
colorAlpha * texel.a,
|
||||
_color.rgb * texel.rgb+fadeEmissive,
|
||||
DEFAULT_FRESNEL,
|
||||
DEFAULT_ROUGHNESS);
|
||||
} else {
|
||||
packDeferredFragmentUnlit(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
1.0,
|
||||
_color.rgb * texel.rgb+fadeEmissive);
|
||||
}
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
<@include DeferredBufferWrite.slh@>
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _modelNormal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _position;
|
||||
|
||||
//PROCEDURAL_COMMON_BLOCK
|
||||
|
||||
|
@ -28,7 +25,7 @@ in vec4 _position;
|
|||
|
||||
#line 2030
|
||||
void main(void) {
|
||||
vec3 normal = normalize(_normal.xyz);
|
||||
vec3 normal = normalize(_normalWS.xyz);
|
||||
vec3 diffuse = _color.rgb;
|
||||
vec3 specular = DEFAULT_SPECULAR;
|
||||
float shininess = DEFAULT_SHININESS;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
|
@ -27,7 +27,7 @@ void main(void) {
|
|||
float colorAlpha = _color.a * texel.a;
|
||||
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
colorAlpha,
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_FRESNEL,
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
// the albedo texture
|
||||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec4 _position;
|
||||
in vec3 _normal;
|
||||
in vec4 _positionES;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
// Declare after all samplers to prevent sampler location mix up with originalTexture
|
||||
<$declareFadeFragmentInstanced()$>
|
||||
|
@ -41,7 +40,7 @@ void main(void) {
|
|||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParamsInstanced(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float opacity = _color.a;
|
||||
|
@ -52,8 +51,8 @@ void main(void) {
|
|||
opacity *= texel.a;
|
||||
vec3 albedo = _color.rgb * texel.rgb;
|
||||
|
||||
vec3 fragPosition = _position.xyz;
|
||||
vec3 fragNormal = normalize(_normal);
|
||||
vec3 fragPosition = _positionES.xyz;
|
||||
vec3 fragNormal = normalize(_normalWS);
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
|
|
|
@ -17,12 +17,9 @@
|
|||
// the albedo texture
|
||||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
void main(void) {
|
||||
|
|
|
@ -19,11 +19,9 @@
|
|||
// the albedo texture
|
||||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor0;
|
||||
|
||||
|
@ -35,7 +33,7 @@ void main(void) {
|
|||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParamsInstanced(fadeParams)$>
|
||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||
|
||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float colorAlpha = _color.a;
|
||||
|
@ -43,5 +41,5 @@ void main(void) {
|
|||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
_fragColor0 = vec4(_color.rgb * texel.rgb+fadeEmissive, colorAlpha * texel.a);
|
||||
_fragColor0 = vec4(_color.rgb * texel.rgb + fadeEmissive, colorAlpha * texel.a);
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
uniform sampler2D originalTexture;
|
||||
|
||||
// the interpolated normal
|
||||
in vec3 _normal;
|
||||
in vec3 _normalWS;
|
||||
in vec4 _color;
|
||||
in vec2 _texCoord0;
|
||||
|
||||
|
@ -27,7 +27,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
normalize(_normalWS),
|
||||
_color.a,
|
||||
_color.rgb * texel.rgb,
|
||||
DEFAULT_FRESNEL,
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTexMapArrayBuffer()$>
|
||||
|
||||
out vec4 _position;
|
||||
out vec4 _positionES;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec3 _normal;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _color;
|
||||
out float _alpha;
|
||||
|
||||
|
@ -47,6 +47,6 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normal.xyz)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$>
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTexMapArrayBuffer()$>
|
||||
|
||||
out vec4 _position;
|
||||
out vec4 _positionES;
|
||||
out vec2 _texCoord0;
|
||||
out vec2 _texCoord1;
|
||||
out vec3 _normal;
|
||||
out vec3 _normalWS;
|
||||
out vec3 _color;
|
||||
out float _alpha;
|
||||
|
||||
|
@ -47,6 +47,6 @@ void main(void) {
|
|||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normal.xyz)$>
|
||||
<$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$>
|
||||
<$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$>
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<@include Fade.slh@>
|
||||
<$declareFadeFragment()$>
|
||||
|
||||
in vec4 _worldPosition;
|
||||
in vec4 _positionWS;
|
||||
|
||||
layout(location = 0) out vec4 _fragColor;
|
||||
|
||||
|
@ -23,7 +23,7 @@ void main(void) {
|
|||
FadeObjectParams fadeParams;
|
||||
|
||||
<$fetchFadeObjectParams(fadeParams)$>
|
||||
applyFadeClip(fadeParams, _worldPosition.xyz);
|
||||
applyFadeClip(fadeParams, _positionWS.xyz);
|
||||
|
||||
// pass-through to set z-buffer
|
||||
_fragColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<@include Skinning.slh@>
|
||||
<$declareUseDualQuaternionSkinning()$>
|
||||
|
||||
out vec4 _worldPosition;
|
||||
out vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
|
@ -29,5 +29,5 @@ void main(void) {
|
|||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, position, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, position, _worldPosition)$>
|
||||
<$transformModelToWorldPos(obj, position, _positionWS)$>
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<@include Skinning.slh@>
|
||||
<$declareUseDualQuaternionSkinning(1)$>
|
||||
|
||||
out vec4 _worldPosition;
|
||||
out vec4 _positionWS;
|
||||
|
||||
void main(void) {
|
||||
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
|
@ -29,5 +29,5 @@ void main(void) {
|
|||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, position, gl_Position)$>
|
||||
<$transformModelToWorldPos(obj, position, _worldPosition)$>
|
||||
<$transformModelToWorldPos(obj, position, _positionWS)$>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue