@openhps/core
Version:
Open Hybrid Positioning System - Core component
68 lines (38 loc) • 1.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = exports.default = /* glsl */`
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
// Transforming Normal Vectors with the Inverse Transformation
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
vec3 reflectVec = vReflect;
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
vec4 envColor = vec4( 0.0 );
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
outgoingLight += envColor.xyz * specularStrength * reflectivity;
`;