Merge remote-tracking branch 'hifi/master' into android_places_goto

This commit is contained in:
Cristian Luis Duarte 2018-04-23 15:12:56 -03:00
commit c33f1fbbb1
70 changed files with 225 additions and 304 deletions

View file

@ -376,6 +376,11 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU
return; 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, hrtf.render(_bufferSamples, _mixSamples, HRTF_DATASET_INDEX, azimuth, distance, gain,
AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL); AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL);

View file

@ -2690,6 +2690,12 @@ void Application::initializeUi() {
// Now that the menu is instantiated, ensure the display plugin menu is properly updated // Now that the menu is instantiated, ensure the display plugin menu is properly updated
updateDisplayMode(); updateDisplayMode();
flushMenuUpdates(); 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);
}
} }

View file

@ -452,7 +452,7 @@ protected:
// Backend dependant compilation of the shader // Backend dependant compilation of the shader
virtual GLShader* compileBackendProgram(const Shader& program, const Shader::CompilationHandler& handler); virtual GLShader* compileBackendProgram(const Shader& program, const Shader::CompilationHandler& handler);
virtual GLShader* compileBackendShader(const Shader& shader, 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); virtual void makeProgramBindings(ShaderObject& shaderObject);
class ElementResource { class ElementResource {
public: public:

View file

@ -12,27 +12,6 @@
using namespace gpu; using namespace gpu;
using namespace gpu::gl; 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 // Shader domain
static const size_t NUM_SHADER_DOMAINS = 3; 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"); static_assert(Shader::Type::NUM_DOMAINS == NUM_SHADER_DOMAINS, "GL shader domains must equal defined GPU shader domains");

View file

@ -14,7 +14,13 @@ using namespace gpu::gl41;
// GLSL version // GLSL version
std::string GL41Backend::getBackendShaderHeader() const { 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) { int GL41Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {

View file

@ -15,15 +15,17 @@ using namespace gpu::gl45;
// GLSL version // GLSL version
std::string GL45Backend::getBackendShaderHeader() const { std::string GL45Backend::getBackendShaderHeader() const {
const char header[] = static const std::string header(
R"GLSL(#version 450 core R"SHADER(#version 450 core
#define GPU_GL450 #define GPU_GL450
)GLSL" #define PRECISIONQ
#define BITFIELD int
)SHADER"
#ifdef GPU_SSBO_TRANSFORM_OBJECT #ifdef GPU_SSBO_TRANSFORM_OBJECT
R"GLSL(#define GPU_SSBO_TRANSFORM_OBJECT 1)GLSL" R"SHADER(#define GPU_SSBO_TRANSFORM_OBJECT)SHADER"
#endif #endif
; );
return std::string(header); return header;
} }
int GL45Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) { int GL45Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {

View file

@ -14,7 +14,16 @@ using namespace gpu::gles;
// GLSL version // GLSL version
std::string GLESBackend::getBackendShaderHeader() const { 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) { int GLESBackend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {

View file

@ -29,16 +29,9 @@ vec3 getLightColor(Light l) { return lightIrradiance_getColor(l.irradiance); }
float getLightIntensity(Light l) { return lightIrradiance_getIntensity(l.irradiance); } float getLightIntensity(Light l) { return lightIrradiance_getIntensity(l.irradiance); }
vec3 getLightIrradiance(Light l) { return lightIrradiance_getIrradiance(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@> <@include graphics/SphericalHarmonics.shared.slh@>
// Light Ambient // Light Ambient
#ifndef PRECISIONQ
#ifdef GL_ES
#define PRECISIONQ highp
#else
#define PRECISIONQ
#endif
#endif
struct LightAmbient { struct LightAmbient {
PRECISIONQ vec4 _ambient; PRECISIONQ vec4 _ambient;

View file

@ -12,13 +12,7 @@
#define LightIrradianceConstRef LightIrradiance #define LightIrradianceConstRef LightIrradiance
#ifndef PRECISIONQ
#ifdef GL_ES
#define PRECISIONQ highp
#else
#define PRECISIONQ
#endif
#endif
struct LightIrradiance { struct LightIrradiance {
PRECISIONQ vec4 colorIntensity; PRECISIONQ vec4 colorIntensity;
// falloffRadius, cutoffRadius, falloffSpot, spare // falloffRadius, cutoffRadius, falloffSpot, spare

View file

@ -15,14 +15,6 @@
#define LightVolumeConstRef LightVolume #define LightVolumeConstRef LightVolume
#ifndef PRECISIONQ
#ifdef GL_ES
#define PRECISIONQ highp
#else
#define PRECISIONQ
#endif
#endif
struct LightVolume { struct LightVolume {
PRECISIONQ vec4 positionRadius; PRECISIONQ vec4 positionRadius;
PRECISIONQ vec4 directionSpotCos; PRECISIONQ vec4 directionSpotCos;

View file

@ -13,14 +13,7 @@
// The material values (at least the material key) must be precisely bitwise accurate // 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 // 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 { struct Material {
PRECISIONQ vec4 _emissiveOpacity; PRECISIONQ vec4 _emissiveOpacity;
PRECISIONQ vec4 _albedoRoughness; PRECISIONQ vec4 _albedoRoughness;

View file

@ -15,14 +15,6 @@
#define SphericalHarmonicsConstRef SphericalHarmonics #define SphericalHarmonicsConstRef SphericalHarmonics
#ifndef PRECISIONQ
#ifdef GL_ES
#define PRECISIONQ highp
#else
#define PRECISIONQ
#endif
#endif
struct SphericalHarmonics { struct SphericalHarmonics {
PRECISIONQ vec4 L00; PRECISIONQ vec4 L00;
PRECISIONQ vec4 L1m1; PRECISIONQ vec4 L1m1;

View file

@ -13,14 +13,6 @@
<@func declareLightingModel()@> <@func declareLightingModel()@>
#ifndef PRECISIONQ
#ifdef GL_ES
#define PRECISIONQ highp
#else
#define PRECISIONQ
#endif
#endif
struct LightingModel { struct LightingModel {
PRECISIONQ vec4 _UnlitEmissiveLightmapBackground; PRECISIONQ vec4 _UnlitEmissiveLightmapBackground;
PRECISIONQ vec4 _ScatteringDiffuseSpecularAlbedo; PRECISIONQ vec4 _ScatteringDiffuseSpecularAlbedo;

View file

@ -36,8 +36,8 @@ void main(void) {
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
discard; discard;
} else { } else {
vec4 midNormalCurvature; vec4 midNormalCurvature = vec4(0);
vec4 lowNormalCurvature; vec4 lowNormalCurvature = vec4(0);
if (frag.mode == FRAG_MODE_SCATTERING) { if (frag.mode == FRAG_MODE_SCATTERING) {
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
} }

View file

@ -37,8 +37,8 @@ void main(void) {
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
discard; discard;
} else { } else {
vec4 midNormalCurvature; vec4 midNormalCurvature = vec4(0);
vec4 lowNormalCurvature; vec4 lowNormalCurvature = vec4(0);
if (frag.mode == FRAG_MODE_SCATTERING) { if (frag.mode == FRAG_MODE_SCATTERING) {
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
} }

View file

@ -33,8 +33,8 @@ void main(void) {
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
discard; discard;
} else { } else {
vec4 midNormalCurvature; vec4 midNormalCurvature = vec4(0);
vec4 lowNormalCurvature; vec4 lowNormalCurvature = vec4(0);
if (frag.mode == FRAG_MODE_SCATTERING) { if (frag.mode == FRAG_MODE_SCATTERING) {
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
} }

View file

@ -38,8 +38,8 @@ void main(void) {
} else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) {
discard; discard;
} else { } else {
vec4 midNormalCurvature; vec4 midNormalCurvature = vec4(0);
vec4 lowNormalCurvature; vec4 lowNormalCurvature = vec4(0);
if (frag.mode == FRAG_MODE_SCATTERING) { if (frag.mode == FRAG_MODE_SCATTERING) {
unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature);
} }

View file

@ -22,10 +22,10 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
in vec4 _position; in vec4 _positionES;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
@ -54,8 +54,8 @@ void main(void) {
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
vec3 fresnel = getFresnelF0(metallic, albedo); vec3 fresnel = getFresnelF0(metallic, albedo);
vec3 fragPosition = _position.xyz; vec3 fragPosition = _positionES.xyz;
vec3 fragNormal = normalize(_normal); vec3 fragNormal = normalize(_normalWS);
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();

View file

@ -26,8 +26,8 @@
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec4 _position; in vec4 _positionES;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in float _alpha; in float _alpha;
@ -56,8 +56,8 @@ void main(void) {
vec3 emissive = getMaterialEmissive(mat); vec3 emissive = getMaterialEmissive(mat);
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
vec3 fragPosition = _position.xyz; vec3 fragPosition = _positionES.xyz;
vec3 fragNormal = normalize(_normal); vec3 fragNormal = normalize(_normalWS);
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();

View file

@ -19,9 +19,7 @@
<$declareMaterialTextures(ALBEDO)$> <$declareMaterialTextures(ALBEDO)$>
in vec2 _texCoord0; in vec2 _texCoord0;
in vec3 _normal;
in vec3 _color; in vec3 _color;
in float _alpha;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;

View file

@ -17,12 +17,9 @@
<$declareEvalSkyboxGlobalColor()$> <$declareEvalSkyboxGlobalColor()$>
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec3 _modelNormal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec4 _positionES;
in vec4 _position;
in vec4 _eyePosition;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
@ -33,7 +30,7 @@ layout(location = 0) out vec4 _fragColor0;
#line 2030 #line 2030
void main(void) { void main(void) {
vec3 normal = normalize(_normal.xyz); vec3 normal = normalize(_normalWS.xyz);
vec3 diffuse = _color.rgb; vec3 diffuse = _color.rgb;
vec3 specular = DEFAULT_SPECULAR; vec3 specular = DEFAULT_SPECULAR;
float shininess = DEFAULT_SHININESS; float shininess = DEFAULT_SHININESS;
@ -53,7 +50,7 @@ void main(void) {
#endif #endif
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragPosition = _eyePosition.xyz; vec3 fragPosition = _positionES.xyz;
if (emissiveAmount > 0.0) { if (emissiveAmount > 0.0) {
_fragColor0 = vec4(evalSkyboxGlobalColor( _fragColor0 = vec4(evalSkyboxGlobalColor(

View file

@ -23,10 +23,10 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _eyePosition; in vec4 _positionES;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
@ -35,14 +35,14 @@ void main(void) {
float colorAlpha = _color.a * texel.a; float colorAlpha = _color.a * texel.a;
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragPosition = _eyePosition.xyz; vec3 fragPosition = _positionES.xyz;
_fragColor0 = vec4(evalSkyboxGlobalColor( _fragColor0 = vec4(evalSkyboxGlobalColor(
cam._viewInverse, cam._viewInverse,
1.0, 1.0,
DEFAULT_OCCLUSION, DEFAULT_OCCLUSION,
fragPosition, fragPosition,
normalize(_normal), normalize(_normalWS),
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,
DEFAULT_METALLIC, DEFAULT_METALLIC,

View file

@ -23,10 +23,10 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _eyePosition; in vec4 _positionES;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
@ -35,14 +35,14 @@ void main(void) {
float colorAlpha = _color.a * texel.a; float colorAlpha = _color.a * texel.a;
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragPosition = _eyePosition.xyz; vec3 fragPosition = _positionES.xyz;
_fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze( _fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze(
cam._viewInverse, cam._viewInverse,
1.0, 1.0,
DEFAULT_OCCLUSION, DEFAULT_OCCLUSION,
fragPosition, fragPosition,
normalize(_normal), normalize(_normalWS),
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,
DEFAULT_METALLIC, DEFAULT_METALLIC,

View file

@ -17,11 +17,9 @@
<$declareEvalGlobalLightingAlphaBlended()$> <$declareEvalGlobalLightingAlphaBlended()$>
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec3 _modelNormal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec4 _positionES;
in vec4 _eyePosition;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
@ -32,7 +30,7 @@ layout(location = 0) out vec4 _fragColor0;
#line 2030 #line 2030
void main(void) { void main(void) {
vec3 normal = normalize(_normal.xyz); vec3 normal = normalize(_normalWS.xyz);
vec3 diffuse = _color.rgb; vec3 diffuse = _color.rgb;
vec3 specular = DEFAULT_SPECULAR; vec3 specular = DEFAULT_SPECULAR;
float shininess = DEFAULT_SHININESS; float shininess = DEFAULT_SHININESS;
@ -52,7 +50,7 @@ void main(void) {
#endif #endif
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragPosition = _eyePosition.xyz; vec3 fragPosition = _positionES.xyz;
if (emissiveAmount > 0.0) { if (emissiveAmount > 0.0) {
_fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze( _fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze(

View file

@ -62,6 +62,7 @@ void main(void) {
// Frag to eye vec // Frag to eye vec
vec4 fragEyeVector = invViewMat * vec4(-frag.position.xyz, 0.0); vec4 fragEyeVector = invViewMat * vec4(-frag.position.xyz, 0.0);
vec3 fragEyeDir = normalize(fragEyeVector.xyz); vec3 fragEyeDir = normalize(fragEyeVector.xyz);
_fragColor = vec4(0, 0, 0, 1);
int numLightTouching = 0; int numLightTouching = 0;
int lightClusterOffset = cluster.z; int lightClusterOffset = cluster.z;

View file

@ -45,8 +45,8 @@ void main(void) {
discard; discard;
} }
vec4 midNormalCurvature; vec4 midNormalCurvature = vec4(0);
vec4 lowNormalCurvature; vec4 lowNormalCurvature = vec4(0);
if (frag.mode == FRAG_MODE_SCATTERING) { if (frag.mode == FRAG_MODE_SCATTERING) {
unpackMidLowNormalCurvature(texCoord, midNormalCurvature, lowNormalCurvature); unpackMidLowNormalCurvature(texCoord, midNormalCurvature, lowNormalCurvature);
} }

View file

@ -19,10 +19,9 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$>
in vec4 _position;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
@ -53,7 +52,7 @@ void main(void) {
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
packDeferredFragment( packDeferredFragment(
normalize(_normal), normalize(_normalWS),
opacity, opacity,
albedo, albedo,
roughness, roughness,

View file

@ -23,8 +23,8 @@ out vec3 _color;
out float _alpha; out float _alpha;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec4 _position; out vec4 _positionES;
out vec3 _normal; out vec3 _normalWS;
void main(void) { void main(void) {
_color = color_sRGBToLinear(inColor.xyz); _color = color_sRGBToLinear(inColor.xyz);
@ -37,6 +37,6 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
} }

View file

@ -22,7 +22,6 @@
<@include Fade.slh@> <@include Fade.slh@>
<$declareFadeFragment()$> <$declareFadeFragment()$>
in vec4 _positionES;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normalWS; in vec3 _normalWS;

View file

@ -20,10 +20,9 @@
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$>
<$declareMaterialLightmap()$> <$declareMaterialLightmap()$>
in vec4 _position;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
void main(void) { void main(void) {
@ -33,7 +32,7 @@ void main(void) {
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
packDeferredFragmentLightmap( packDeferredFragmentLightmap(
normalize(_normal), normalize(_normalWS),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialAlbedo(mat) * albedo.rgb * _color,
getMaterialRoughness(mat) * roughness, getMaterialRoughness(mat) * roughness,

View file

@ -20,10 +20,10 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
out vec4 _position; out vec4 _positionES;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec3 _normal; out vec3 _normalWS;
out vec3 _color; out vec3 _color;
void main(void) { void main(void) {
@ -38,7 +38,6 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
} }

View file

@ -23,19 +23,18 @@
<@include Fade.slh@> <@include Fade.slh@>
<$declareFadeFragment()$> <$declareFadeFragment()$>
in vec4 _position;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in vec4 _worldPosition; in vec4 _positionWS;
void main(void) { void main(void) {
vec3 fadeEmissive; vec3 fadeEmissive;
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParams(fadeParams)$> <$fetchFadeObjectParams(fadeParams)$>
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
Material mat = getMaterial(); Material mat = getMaterial();
BITFIELD matKey = getMaterialKey(mat); BITFIELD matKey = getMaterialKey(mat);
@ -43,7 +42,7 @@ void main(void) {
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
packDeferredFragmentLightmap( packDeferredFragmentLightmap(
normalize(_normal), normalize(_normalWS),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialAlbedo(mat) * albedo.rgb * _color,
getMaterialRoughness(mat) * roughness, getMaterialRoughness(mat) * roughness,

View file

@ -20,12 +20,12 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
out vec4 _position; out vec4 _positionES;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec3 _normal; out vec3 _normalWS;
out vec3 _color; out vec3 _color;
out vec4 _worldPosition; out vec4 _positionWS;
void main(void) { void main(void) {
// pass along the color in linear space // pass along the color in linear space
@ -39,8 +39,8 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$> <$transformModelToWorldPos(obj, inPosition, _positionWS)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
} }

View file

@ -20,11 +20,11 @@
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$>
<$declareMaterialLightmap()$> <$declareMaterialLightmap()$>
in vec4 _position; in vec4 _positionES;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normal; in vec3 _normalWS;
in vec3 _tangent; in vec3 _tangentWS;
in vec3 _color; in vec3 _color;
void main(void) { void main(void) {
@ -34,7 +34,7 @@ void main(void) {
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
vec3 fragNormal; vec3 fragNormal;
<$evalMaterialNormalLOD(_position, normalTexel, _normal, _tangent, fragNormal)$> <$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$>
packDeferredFragmentLightmap( packDeferredFragmentLightmap(
normalize(fragNormal.xyz), normalize(fragNormal.xyz),

View file

@ -20,11 +20,11 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
out vec4 _position; out vec4 _positionES;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec3 _normal; out vec3 _normalWS;
out vec3 _tangent; out vec3 _tangentWS;
out vec3 _color; out vec3 _color;
void main(void) { void main(void) {
@ -38,7 +38,7 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
<$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangent)$> <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$>
} }

View file

@ -23,20 +23,20 @@
<@include Fade.slh@> <@include Fade.slh@>
<$declareFadeFragment()$> <$declareFadeFragment()$>
in vec4 _position; in vec4 _positionES;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec3 _normal; in vec3 _normalWS;
in vec3 _tangent; in vec3 _tangentWS;
in vec3 _color; in vec3 _color;
in vec4 _worldPosition; in vec4 _positionWS;
void main(void) { void main(void) {
vec3 fadeEmissive; vec3 fadeEmissive;
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParams(fadeParams)$> <$fetchFadeObjectParams(fadeParams)$>
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
Material mat = getMaterial(); Material mat = getMaterial();
BITFIELD matKey = getMaterialKey(mat); BITFIELD matKey = getMaterialKey(mat);
@ -44,7 +44,7 @@ void main(void) {
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
vec3 fragNormal; vec3 fragNormal;
<$evalMaterialNormalLOD(_position, normalTexel, _normal, _tangent, fragNormal)$> <$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$>
packDeferredFragmentLightmap( packDeferredFragmentLightmap(
normalize(fragNormal.xyz), normalize(fragNormal.xyz),

View file

@ -20,13 +20,13 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
out vec4 _position; out vec4 _positionES;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec3 _normal; out vec3 _normalWS;
out vec3 _tangent; out vec3 _tangentWS;
out vec3 _color; out vec3 _color;
out vec4 _worldPosition; out vec4 _positionWS;
void main(void) { void main(void) {
// pass along the color in linear space // pass along the color in linear space
@ -39,8 +39,8 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$> <$transformModelToWorldPos(obj, inPosition, _positionWS)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
<$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangent)$> <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$>
} }

View file

@ -17,13 +17,13 @@
layout(location = 0) out vec4 _fragColor; layout(location = 0) out vec4 _fragColor;
in vec4 _worldPosition; in vec4 _positionWS;
void main(void) { void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParams(fadeParams)$> <$fetchFadeObjectParams(fadeParams)$>
applyFadeClip(fadeParams, _worldPosition.xyz); applyFadeClip(fadeParams, _positionWS.xyz);
// pass-through to set z-buffer // pass-through to set z-buffer
_fragColor = vec4(1.0, 1.0, 1.0, 0.0); _fragColor = vec4(1.0, 1.0, 1.0, 0.0);

View file

@ -18,12 +18,12 @@
<$declareStandardTransform()$> <$declareStandardTransform()$>
out vec4 _worldPosition; out vec4 _positionWS;
void main(void) { void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$> <$transformModelToWorldPos(obj, inPosition, _positionWS)$>
} }

View file

@ -20,7 +20,7 @@
<$declareMaterialTextures(ALBEDO)$> <$declareMaterialTextures(ALBEDO)$>
in vec2 _texCoord0; in vec2 _texCoord0;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in float _alpha; in float _alpha;
@ -39,7 +39,7 @@ void main(void) {
albedo *= _color; albedo *= _color;
packDeferredFragmentUnlit( packDeferredFragmentUnlit(
normalize(_normal), normalize(_normalWS),
opacity, opacity,
albedo * isUnlitEnabled()); albedo * isUnlitEnabled());
} }

View file

@ -34,8 +34,6 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
LightAmbient ambient = getLightAmbient(); LightAmbient ambient = getLightAmbient();
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragNormal;
<$transformEyeToWorldDir(cam, normal, fragNormal)$>
vec3 fragEyeVectorView = normalize(-position); vec3 fragEyeVectorView = normalize(-position);
vec3 fragEyeDir; vec3 fragEyeDir;
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$> <$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
@ -57,8 +55,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _position; in vec4 _positionES;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in float _alpha; in float _alpha;
@ -67,8 +65,8 @@ out vec4 _fragColor;
void main(void) { void main(void) {
vec4 albedo = texture(originalTexture, _texCoord0); vec4 albedo = texture(originalTexture, _texCoord0);
vec3 fragPosition = _position.xyz; vec3 fragPosition = _positionES.xyz;
vec3 fragNormal = normalize(_normal); vec3 fragNormal = normalize(_normalWS);
vec3 fragAlbedo = albedo.rgb * _color; vec3 fragAlbedo = albedo.rgb * _color;
float fragMetallic = 0.0; float fragMetallic = 0.0;
vec3 fragSpecular = vec3(0.1); vec3 fragSpecular = vec3(0.1);

View file

@ -19,8 +19,8 @@
out vec3 _color; out vec3 _color;
out float _alpha; out float _alpha;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec4 _position; out vec4 _positionES;
out vec3 _normal; out vec3 _normalWS;
void main(void) { void main(void) {
_color = color_sRGBToLinear(inColor.xyz); _color = color_sRGBToLinear(inColor.xyz);
@ -31,6 +31,6 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
} }

View file

@ -24,8 +24,8 @@
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec4 _position; in vec4 _positionES;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in float _alpha; in float _alpha;
@ -55,19 +55,16 @@ void main(void) {
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
vec3 fragPosition = _position.xyz; vec3 fragPosition = _positionES.xyz;
//vec3 fragNormal = normalize(_normal);
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragNormal;
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>;
vec4 color = vec4(evalSkyboxGlobalColor( vec4 color = vec4(evalSkyboxGlobalColor(
cam._viewInverse, cam._viewInverse,
1.0, 1.0,
occlusionTex, occlusionTex,
fragPosition, fragPosition,
fragNormal, normalize(_normalWS),
albedo, albedo,
fresnel, fresnel,
metallic, metallic,

View file

@ -23,10 +23,9 @@
in vec2 _texCoord0; in vec2 _texCoord0;
in vec2 _texCoord1; in vec2 _texCoord1;
in vec4 _position; in vec4 _positionES;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in float _alpha;
out vec4 _fragColor; out vec4 _fragColor;
@ -52,19 +51,15 @@ void main(void) {
vec3 emissive = getMaterialEmissive(mat); vec3 emissive = getMaterialEmissive(mat);
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
vec3 fragPosition = _positionES.xyz;
vec3 fragPosition = _position.xyz;
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragNormal;
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
vec4 color = vec4(evalGlobalLightingAlphaBlendedWithHaze( vec4 color = vec4(evalGlobalLightingAlphaBlendedWithHaze(
cam._viewInverse, cam._viewInverse,
1.0, 1.0,
occlusionTex, occlusionTex,
fragPosition, fragPosition,
fragNormal, normalize(_normalWS),
albedo, albedo,
fresnel, fresnel,
metallic, metallic,

View file

@ -18,9 +18,7 @@
<$declareMaterialTextures(ALBEDO)$> <$declareMaterialTextures(ALBEDO)$>
in vec2 _texCoord0; in vec2 _texCoord0;
in vec3 _normal;
in vec3 _color; in vec3 _color;
in float _alpha;
out vec4 _fragColor; out vec4 _fragColor;

View file

@ -18,9 +18,7 @@
<$declareMaterialTextures(ALBEDO)$> <$declareMaterialTextures(ALBEDO)$>
in vec2 _texCoord0; in vec2 _texCoord0;
in vec3 _normal;
in vec3 _color; in vec3 _color;
in float _alpha;
out vec4 _fragColor; out vec4 _fragColor;

View file

@ -34,8 +34,6 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
LightAmbient ambient = getLightAmbient(); LightAmbient ambient = getLightAmbient();
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
vec3 fragNormal;
<$transformEyeToWorldDir(cam, normal, fragNormal)$>
vec3 fragEyeVectorView = normalize(-position); vec3 fragEyeVectorView = normalize(-position);
vec3 fragEyeDir; vec3 fragEyeDir;
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$> <$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
@ -57,8 +55,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _position; in vec4 _positionES;
in vec3 _normal; in vec3 _normalWS;
in vec3 _color; in vec3 _color;
in float _alpha; in float _alpha;
@ -67,8 +65,8 @@ out vec4 _fragColor;
void main(void) { void main(void) {
vec4 albedo = texture(originalTexture, _texCoord0); vec4 albedo = texture(originalTexture, _texCoord0);
vec3 fragPosition = _position.xyz; vec3 fragPosition = _positionES.xyz;
vec3 fragNormal = normalize(_normal); vec3 fragNormal = normalize(_normalWS);
vec3 fragAlbedo = albedo.rgb * _color; vec3 fragAlbedo = albedo.rgb * _color;
float fragMetallic = 0.0; float fragMetallic = 0.0;
vec3 fragSpecular = vec3(0.1); vec3 fragSpecular = vec3(0.1);

View file

@ -17,7 +17,7 @@ uniform bool Outline;
uniform vec4 Color; uniform vec4 Color;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec2 _texCoord0; in vec2 _texCoord0;
const float gamma = 2.2; const float gamma = 2.2;
@ -47,7 +47,7 @@ void main() {
} }
packDeferredFragment( packDeferredFragment(
normalize(_normal), normalize(_normalWS),
a * Color.a, a * Color.a,
Color.rgb, Color.rgb,
DEFAULT_ROUGHNESS, DEFAULT_ROUGHNESS,

View file

@ -17,7 +17,7 @@
<$declareStandardTransform()$> <$declareStandardTransform()$>
// the interpolated normal // the interpolated normal
out vec3 _normal; out vec3 _normalWS;
out vec2 _texCoord0; out vec2 _texCoord0;
void main() { void main() {
@ -28,5 +28,5 @@ void main() {
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
const vec3 normal = vec3(0, 0, 1); const vec3 normal = vec3(0, 0, 1);
<$transformModelToWorldDir(cam, obj, normal, _normal)$> <$transformModelToWorldDir(cam, obj, normal, _normalWS)$>
} }

View file

@ -17,7 +17,7 @@ uniform bool Outline;
uniform vec4 Color; uniform vec4 Color;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec2 _texCoord0; in vec2 _texCoord0;
const float gamma = 2.2; const float gamma = 2.2;
@ -47,7 +47,7 @@ void main() {
} }
packDeferredFragmentTranslucent( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normalWS),
a * Color.a, a * Color.a,
Color.rgb, Color.rgb,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,

View file

@ -15,11 +15,8 @@
<@include DeferredBufferWrite.slh@> <@include DeferredBufferWrite.slh@>
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec3 _modelNormal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0;
in vec4 _position;
//PROCEDURAL_COMMON_BLOCK //PROCEDURAL_COMMON_BLOCK
@ -28,7 +25,7 @@ in vec4 _position;
#line 2030 #line 2030
void main(void) { void main(void) {
vec3 normal = normalize(_normal.xyz); vec3 normal = normalize(_normalWS.xyz);
vec3 diffuse = _color.rgb; vec3 diffuse = _color.rgb;
vec3 specular = DEFAULT_SPECULAR; vec3 specular = DEFAULT_SPECULAR;
float shininess = DEFAULT_SHININESS; float shininess = DEFAULT_SHININESS;

View file

@ -18,22 +18,22 @@
<$declareStandardTransform()$> <$declareStandardTransform()$>
// the interpolated normal // the interpolated normal
out vec3 _normal; out vec3 _normalWS;
out vec3 _modelNormal; out vec3 _normalMS;
out vec4 _color; out vec4 _color;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec4 _position; out vec4 _positionMS;
out vec4 _eyePosition; out vec4 _positionES;
void main(void) { void main(void) {
_color = color_sRGBAToLinear(inColor); _color = color_sRGBAToLinear(inColor);
_texCoord0 = inTexCoord0.st; _texCoord0 = inTexCoord0.st;
_position = inPosition; _positionMS = inPosition;
_modelNormal = inNormal.xyz; _normalMS = inNormal.xyz;
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _eyePosition, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
} }

View file

@ -18,12 +18,9 @@
<$declareFadeFragmentInstanced()$> <$declareFadeFragmentInstanced()$>
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec3 _modelNormal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec4 _positionWS;
in vec4 _position;
in vec4 _worldPosition;
//PROCEDURAL_COMMON_BLOCK //PROCEDURAL_COMMON_BLOCK
@ -36,9 +33,9 @@ void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParamsInstanced(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 diffuse = _color.rgb;
vec3 specular = DEFAULT_SPECULAR; vec3 specular = DEFAULT_SPECULAR;
float shininess = DEFAULT_SHININESS; float shininess = DEFAULT_SHININESS;

View file

@ -21,25 +21,25 @@
<$declareFadeVertexInstanced()$> <$declareFadeVertexInstanced()$>
// the interpolated normal // the interpolated normal
out vec3 _normal; out vec3 _normalWS;
out vec3 _modelNormal; out vec3 _normalMS;
out vec4 _color; out vec4 _color;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec4 _position; out vec4 _positionMS;
out vec4 _eyePosition; out vec4 _positionES;
out vec4 _worldPosition; out vec4 _positionWS;
void main(void) { void main(void) {
_color = color_sRGBAToLinear(inColor); _color = color_sRGBAToLinear(inColor);
_texCoord0 = inTexCoord0.st; _texCoord0 = inTexCoord0.st;
_position = inPosition; _positionMS = inPosition;
_modelNormal = inNormal.xyz; _normalMS = inNormal.xyz;
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, inPosition, _eyePosition, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$>
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$> <$transformModelToWorldPos(obj, inPosition, _positionWS)$>
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
<$passThroughFadeObjectParams()$> <$passThroughFadeObjectParams()$>
} }

View file

@ -19,12 +19,12 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
void main(void) { void main(void) {
vec4 texel = texture(originalTexture, _texCoord0.st); vec4 texel = texture(originalTexture, _texCoord0.st);
texel = color_sRGBAToLinear(texel); texel = color_sRGBAToLinear(texel);
packDeferredFragmentUnlit(normalize(_normal), 1.0, _color.rgb * texel.rgb); packDeferredFragmentUnlit(normalize(_normalWS), 1.0, _color.rgb * texel.rgb);
} }

View file

@ -18,7 +18,7 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
@ -26,7 +26,7 @@ void main(void) {
vec4 texel = texture(originalTexture, _texCoord0); vec4 texel = texture(originalTexture, _texCoord0);
packDeferredFragment( packDeferredFragment(
normalize(_normal), normalize(_normalWS),
1.0, 1.0,
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_ROUGHNESS, DEFAULT_ROUGHNESS,

View file

@ -21,10 +21,10 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _worldPosition; in vec4 _positionWS;
// Declare after all samplers to prevent sampler location mix up with originalTexture // Declare after all samplers to prevent sampler location mix up with originalTexture
<$declareFadeFragmentInstanced()$> <$declareFadeFragmentInstanced()$>
@ -34,7 +34,7 @@ void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParamsInstanced(fadeParams)$> <$fetchFadeObjectParamsInstanced(fadeParams)$>
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
vec4 texel = texture(originalTexture, _texCoord0); vec4 texel = texture(originalTexture, _texCoord0);
float colorAlpha = _color.a; float colorAlpha = _color.a;
@ -46,14 +46,14 @@ void main(void) {
const float ALPHA_THRESHOLD = 0.999; const float ALPHA_THRESHOLD = 0.999;
if (colorAlpha * texel.a < ALPHA_THRESHOLD) { if (colorAlpha * texel.a < ALPHA_THRESHOLD) {
packDeferredFragmentTranslucent( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normalWS),
colorAlpha * texel.a, colorAlpha * texel.a,
_color.rgb * texel.rgb + fadeEmissive, _color.rgb * texel.rgb + fadeEmissive,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,
DEFAULT_ROUGHNESS); DEFAULT_ROUGHNESS);
} else { } else {
packDeferredFragment( packDeferredFragment(
normalize(_normal), normalize(_normalWS),
1.0, 1.0,
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_ROUGHNESS, DEFAULT_ROUGHNESS,

View file

@ -19,7 +19,7 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
@ -34,14 +34,14 @@ void main(void) {
const float ALPHA_THRESHOLD = 0.999; const float ALPHA_THRESHOLD = 0.999;
if (colorAlpha * texel.a < ALPHA_THRESHOLD) { if (colorAlpha * texel.a < ALPHA_THRESHOLD) {
packDeferredFragmentTranslucent( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normalWS),
colorAlpha * texel.a, colorAlpha * texel.a,
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,
DEFAULT_ROUGHNESS); DEFAULT_ROUGHNESS);
} else { } else {
packDeferredFragmentUnlit( packDeferredFragmentUnlit(
normalize(_normal), normalize(_normalWS),
1.0, 1.0,
_color.rgb * texel.rgb); _color.rgb * texel.rgb);
} }

View file

@ -21,10 +21,10 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _worldPosition; in vec4 _positionWS;
// Declare after all samplers to prevent sampler location mix up with originalTexture // Declare after all samplers to prevent sampler location mix up with originalTexture
<$declareFadeFragmentInstanced()$> <$declareFadeFragmentInstanced()$>
@ -34,7 +34,7 @@ void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParamsInstanced(fadeParams)$> <$fetchFadeObjectParamsInstanced(fadeParams)$>
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
vec4 texel = texture(originalTexture, _texCoord0.st); vec4 texel = texture(originalTexture, _texCoord0.st);
float colorAlpha = _color.a; float colorAlpha = _color.a;
@ -46,14 +46,14 @@ void main(void) {
const float ALPHA_THRESHOLD = 0.999; const float ALPHA_THRESHOLD = 0.999;
if (colorAlpha * texel.a < ALPHA_THRESHOLD) { if (colorAlpha * texel.a < ALPHA_THRESHOLD) {
packDeferredFragmentTranslucent( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normalWS),
colorAlpha * texel.a, colorAlpha * texel.a,
_color.rgb * texel.rgb+fadeEmissive, _color.rgb * texel.rgb+fadeEmissive,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,
DEFAULT_ROUGHNESS); DEFAULT_ROUGHNESS);
} else { } else {
packDeferredFragmentUnlit( packDeferredFragmentUnlit(
normalize(_normal), normalize(_normalWS),
1.0, 1.0,
_color.rgb * texel.rgb+fadeEmissive); _color.rgb * texel.rgb+fadeEmissive);
} }

View file

@ -15,11 +15,8 @@
<@include DeferredBufferWrite.slh@> <@include DeferredBufferWrite.slh@>
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec3 _modelNormal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0;
in vec4 _position;
//PROCEDURAL_COMMON_BLOCK //PROCEDURAL_COMMON_BLOCK
@ -28,7 +25,7 @@ in vec4 _position;
#line 2030 #line 2030
void main(void) { void main(void) {
vec3 normal = normalize(_normal.xyz); vec3 normal = normalize(_normalWS.xyz);
vec3 diffuse = _color.rgb; vec3 diffuse = _color.rgb;
vec3 specular = DEFAULT_SPECULAR; vec3 specular = DEFAULT_SPECULAR;
float shininess = DEFAULT_SHININESS; float shininess = DEFAULT_SHININESS;

View file

@ -18,7 +18,7 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
@ -27,7 +27,7 @@ void main(void) {
float colorAlpha = _color.a * texel.a; float colorAlpha = _color.a * texel.a;
packDeferredFragmentTranslucent( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normalWS),
colorAlpha, colorAlpha,
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,

View file

@ -26,12 +26,11 @@
// the albedo texture // the albedo texture
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal in vec4 _positionES;
in vec4 _position; in vec3 _normalWS;
in vec3 _normal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _worldPosition; in vec4 _positionWS;
// Declare after all samplers to prevent sampler location mix up with originalTexture // Declare after all samplers to prevent sampler location mix up with originalTexture
<$declareFadeFragmentInstanced()$> <$declareFadeFragmentInstanced()$>
@ -41,7 +40,7 @@ void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParamsInstanced(fadeParams)$> <$fetchFadeObjectParamsInstanced(fadeParams)$>
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
vec4 texel = texture(originalTexture, _texCoord0.st); vec4 texel = texture(originalTexture, _texCoord0.st);
float opacity = _color.a; float opacity = _color.a;
@ -52,8 +51,8 @@ void main(void) {
opacity *= texel.a; opacity *= texel.a;
vec3 albedo = _color.rgb * texel.rgb; vec3 albedo = _color.rgb * texel.rgb;
vec3 fragPosition = _position.xyz; vec3 fragPosition = _positionES.xyz;
vec3 fragNormal = normalize(_normal); vec3 fragNormal = normalize(_normalWS);
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();

View file

@ -17,12 +17,9 @@
// the albedo texture // the albedo texture
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal
in vec3 _normal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
void main(void) { void main(void) {

View file

@ -19,11 +19,9 @@
// the albedo texture // the albedo texture
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal
in vec3 _normal;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
in vec4 _worldPosition; in vec4 _positionWS;
layout(location = 0) out vec4 _fragColor0; layout(location = 0) out vec4 _fragColor0;
@ -35,7 +33,7 @@ void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParamsInstanced(fadeParams)$> <$fetchFadeObjectParamsInstanced(fadeParams)$>
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
vec4 texel = texture(originalTexture, _texCoord0.st); vec4 texel = texture(originalTexture, _texCoord0.st);
float colorAlpha = _color.a; float colorAlpha = _color.a;

View file

@ -19,7 +19,7 @@
uniform sampler2D originalTexture; uniform sampler2D originalTexture;
// the interpolated normal // the interpolated normal
in vec3 _normal; in vec3 _normalWS;
in vec4 _color; in vec4 _color;
in vec2 _texCoord0; in vec2 _texCoord0;
@ -27,7 +27,7 @@ void main(void) {
vec4 texel = texture(originalTexture, _texCoord0.st); vec4 texel = texture(originalTexture, _texCoord0.st);
texel = color_sRGBAToLinear(texel); texel = color_sRGBAToLinear(texel);
packDeferredFragmentTranslucent( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normalWS),
_color.a, _color.a,
_color.rgb * texel.rgb, _color.rgb * texel.rgb,
DEFAULT_FRESNEL, DEFAULT_FRESNEL,

View file

@ -23,10 +23,10 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
out vec4 _position; out vec4 _positionES;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec3 _normal; out vec3 _normalWS;
out vec3 _color; out vec3 _color;
out float _alpha; out float _alpha;
@ -47,6 +47,6 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normal.xyz)$> <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$>
} }

View file

@ -23,10 +23,10 @@
<@include MaterialTextures.slh@> <@include MaterialTextures.slh@>
<$declareMaterialTexMapArrayBuffer()$> <$declareMaterialTexMapArrayBuffer()$>
out vec4 _position; out vec4 _positionES;
out vec2 _texCoord0; out vec2 _texCoord0;
out vec2 _texCoord1; out vec2 _texCoord1;
out vec3 _normal; out vec3 _normalWS;
out vec3 _color; out vec3 _color;
out float _alpha; out float _alpha;
@ -47,6 +47,6 @@ void main(void) {
// standard transform // standard transform
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$> <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$>
<$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normal.xyz)$> <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$>
} }

View file

@ -15,7 +15,7 @@
<@include Fade.slh@> <@include Fade.slh@>
<$declareFadeFragment()$> <$declareFadeFragment()$>
in vec4 _worldPosition; in vec4 _positionWS;
layout(location = 0) out vec4 _fragColor; layout(location = 0) out vec4 _fragColor;
@ -23,7 +23,7 @@ void main(void) {
FadeObjectParams fadeParams; FadeObjectParams fadeParams;
<$fetchFadeObjectParams(fadeParams)$> <$fetchFadeObjectParams(fadeParams)$>
applyFadeClip(fadeParams, _worldPosition.xyz); applyFadeClip(fadeParams, _positionWS.xyz);
// pass-through to set z-buffer // pass-through to set z-buffer
_fragColor = vec4(1.0, 1.0, 1.0, 0.0); _fragColor = vec4(1.0, 1.0, 1.0, 0.0);

View file

@ -19,7 +19,7 @@
<@include Skinning.slh@> <@include Skinning.slh@>
<$declareUseDualQuaternionSkinning()$> <$declareUseDualQuaternionSkinning()$>
out vec4 _worldPosition; out vec4 _positionWS;
void main(void) { void main(void) {
vec4 position = vec4(0.0, 0.0, 0.0, 0.0); vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
@ -29,5 +29,5 @@ void main(void) {
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, position, gl_Position)$> <$transformModelToClipPos(cam, obj, position, gl_Position)$>
<$transformModelToWorldPos(obj, position, _worldPosition)$> <$transformModelToWorldPos(obj, position, _positionWS)$>
} }

View file

@ -19,7 +19,7 @@
<@include Skinning.slh@> <@include Skinning.slh@>
<$declareUseDualQuaternionSkinning(1)$> <$declareUseDualQuaternionSkinning(1)$>
out vec4 _worldPosition; out vec4 _positionWS;
void main(void) { void main(void) {
vec4 position = vec4(0.0, 0.0, 0.0, 0.0); vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
@ -29,5 +29,5 @@ void main(void) {
TransformCamera cam = getTransformCamera(); TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject(); TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, position, gl_Position)$> <$transformModelToClipPos(cam, obj, position, gl_Position)$>
<$transformModelToWorldPos(obj, position, _worldPosition)$> <$transformModelToWorldPos(obj, position, _positionWS)$>
} }