mirror of
https://github.com/SamEyeBam/animate.git
synced 2026-11-19 02:22:24 +00:00
larry babby and threejs for glsl
This commit is contained in:
1 parent
87d5dc634d
commit
907ebae4c0
6474 files changed
+1279596
-8
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
import { SpotLight } from 'three';
|
||||
|
||||
class IESSpotLight extends SpotLight {
|
||||
|
||||
constructor( color, intensity, distance, angle, penumbra, decay ) {
|
||||
|
||||
super( color, intensity, distance, angle, penumbra, decay );
|
||||
|
||||
this.iesMap = null;
|
||||
|
||||
}
|
||||
|
||||
copy( source, recursive ) {
|
||||
|
||||
super.copy( source, recursive );
|
||||
|
||||
this.iesMap = source.iesMap;
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default IESSpotLight;
|
||||
Generated
Vendored
+286
@@ -0,0 +1,286 @@
|
||||
import {
|
||||
Color,
|
||||
LightProbe,
|
||||
LinearSRGBColorSpace,
|
||||
SphericalHarmonics3,
|
||||
Vector3,
|
||||
SRGBColorSpace,
|
||||
NoColorSpace,
|
||||
HalfFloatType,
|
||||
DataUtils
|
||||
} from 'three';
|
||||
|
||||
class LightProbeGenerator {
|
||||
|
||||
// https://www.ppsloan.org/publications/StupidSH36.pdf
|
||||
static fromCubeTexture( cubeTexture ) {
|
||||
|
||||
let totalWeight = 0;
|
||||
|
||||
const coord = new Vector3();
|
||||
|
||||
const dir = new Vector3();
|
||||
|
||||
const color = new Color();
|
||||
|
||||
const shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
|
||||
|
||||
const sh = new SphericalHarmonics3();
|
||||
const shCoefficients = sh.coefficients;
|
||||
|
||||
for ( let faceIndex = 0; faceIndex < 6; faceIndex ++ ) {
|
||||
|
||||
const image = cubeTexture.image[ faceIndex ];
|
||||
|
||||
const width = image.width;
|
||||
const height = image.height;
|
||||
|
||||
const canvas = document.createElement( 'canvas' );
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
const context = canvas.getContext( '2d' );
|
||||
|
||||
context.drawImage( image, 0, 0, width, height );
|
||||
|
||||
const imageData = context.getImageData( 0, 0, width, height );
|
||||
|
||||
const data = imageData.data;
|
||||
|
||||
const imageWidth = imageData.width; // assumed to be square
|
||||
|
||||
const pixelSize = 2 / imageWidth;
|
||||
|
||||
for ( let i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed
|
||||
|
||||
// pixel color
|
||||
color.setRGB( data[ i ] / 255, data[ i + 1 ] / 255, data[ i + 2 ] / 255 );
|
||||
|
||||
// convert to linear color space
|
||||
convertColorToLinear( color, cubeTexture.colorSpace );
|
||||
|
||||
// pixel coordinate on unit cube
|
||||
|
||||
const pixelIndex = i / 4;
|
||||
|
||||
const col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize;
|
||||
|
||||
const row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize;
|
||||
|
||||
switch ( faceIndex ) {
|
||||
|
||||
case 0: coord.set( - 1, row, - col ); break;
|
||||
|
||||
case 1: coord.set( 1, row, col ); break;
|
||||
|
||||
case 2: coord.set( - col, 1, - row ); break;
|
||||
|
||||
case 3: coord.set( - col, - 1, row ); break;
|
||||
|
||||
case 4: coord.set( - col, row, 1 ); break;
|
||||
|
||||
case 5: coord.set( col, row, - 1 ); break;
|
||||
|
||||
}
|
||||
|
||||
// weight assigned to this pixel
|
||||
|
||||
const lengthSq = coord.lengthSq();
|
||||
|
||||
const weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq );
|
||||
|
||||
totalWeight += weight;
|
||||
|
||||
// direction vector to this pixel
|
||||
dir.copy( coord ).normalize();
|
||||
|
||||
// evaluate SH basis functions in direction dir
|
||||
SphericalHarmonics3.getBasisAt( dir, shBasis );
|
||||
|
||||
// accummuulate
|
||||
for ( let j = 0; j < 9; j ++ ) {
|
||||
|
||||
shCoefficients[ j ].x += shBasis[ j ] * color.r * weight;
|
||||
shCoefficients[ j ].y += shBasis[ j ] * color.g * weight;
|
||||
shCoefficients[ j ].z += shBasis[ j ] * color.b * weight;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// normalize
|
||||
const norm = ( 4 * Math.PI ) / totalWeight;
|
||||
|
||||
for ( let j = 0; j < 9; j ++ ) {
|
||||
|
||||
shCoefficients[ j ].x *= norm;
|
||||
shCoefficients[ j ].y *= norm;
|
||||
shCoefficients[ j ].z *= norm;
|
||||
|
||||
}
|
||||
|
||||
return new LightProbe( sh );
|
||||
|
||||
}
|
||||
|
||||
static fromCubeRenderTarget( renderer, cubeRenderTarget ) {
|
||||
|
||||
// The renderTarget must be set to RGBA in order to make readRenderTargetPixels works
|
||||
let totalWeight = 0;
|
||||
|
||||
const coord = new Vector3();
|
||||
|
||||
const dir = new Vector3();
|
||||
|
||||
const color = new Color();
|
||||
|
||||
const shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
|
||||
|
||||
const sh = new SphericalHarmonics3();
|
||||
const shCoefficients = sh.coefficients;
|
||||
|
||||
const dataType = cubeRenderTarget.texture.type;
|
||||
|
||||
for ( let faceIndex = 0; faceIndex < 6; faceIndex ++ ) {
|
||||
|
||||
const imageWidth = cubeRenderTarget.width; // assumed to be square
|
||||
|
||||
let data;
|
||||
|
||||
if ( dataType === HalfFloatType ) {
|
||||
|
||||
data = new Uint16Array( imageWidth * imageWidth * 4 );
|
||||
|
||||
} else {
|
||||
|
||||
// assuming UnsignedByteType
|
||||
|
||||
data = new Uint8Array( imageWidth * imageWidth * 4 );
|
||||
|
||||
}
|
||||
|
||||
renderer.readRenderTargetPixels( cubeRenderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex );
|
||||
|
||||
const pixelSize = 2 / imageWidth;
|
||||
|
||||
for ( let i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed
|
||||
|
||||
let r, g, b;
|
||||
|
||||
if ( dataType === HalfFloatType ) {
|
||||
|
||||
r = DataUtils.fromHalfFloat( data[ i ] );
|
||||
g = DataUtils.fromHalfFloat( data[ i + 1 ] );
|
||||
b = DataUtils.fromHalfFloat( data[ i + 2 ] );
|
||||
|
||||
} else {
|
||||
|
||||
r = data[ i ] / 255;
|
||||
g = data[ i + 1 ] / 255;
|
||||
b = data[ i + 2 ] / 255;
|
||||
|
||||
}
|
||||
|
||||
// pixel color
|
||||
color.setRGB( r, g, b );
|
||||
|
||||
// convert to linear color space
|
||||
convertColorToLinear( color, cubeRenderTarget.texture.colorSpace );
|
||||
|
||||
// pixel coordinate on unit cube
|
||||
|
||||
const pixelIndex = i / 4;
|
||||
|
||||
const col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize;
|
||||
|
||||
const row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize;
|
||||
|
||||
switch ( faceIndex ) {
|
||||
|
||||
case 0: coord.set( 1, row, - col ); break;
|
||||
|
||||
case 1: coord.set( - 1, row, col ); break;
|
||||
|
||||
case 2: coord.set( col, 1, - row ); break;
|
||||
|
||||
case 3: coord.set( col, - 1, row ); break;
|
||||
|
||||
case 4: coord.set( col, row, 1 ); break;
|
||||
|
||||
case 5: coord.set( - col, row, - 1 ); break;
|
||||
|
||||
}
|
||||
|
||||
// weight assigned to this pixel
|
||||
|
||||
const lengthSq = coord.lengthSq();
|
||||
|
||||
const weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq );
|
||||
|
||||
totalWeight += weight;
|
||||
|
||||
// direction vector to this pixel
|
||||
dir.copy( coord ).normalize();
|
||||
|
||||
// evaluate SH basis functions in direction dir
|
||||
SphericalHarmonics3.getBasisAt( dir, shBasis );
|
||||
|
||||
// accummuulate
|
||||
for ( let j = 0; j < 9; j ++ ) {
|
||||
|
||||
shCoefficients[ j ].x += shBasis[ j ] * color.r * weight;
|
||||
shCoefficients[ j ].y += shBasis[ j ] * color.g * weight;
|
||||
shCoefficients[ j ].z += shBasis[ j ] * color.b * weight;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// normalize
|
||||
const norm = ( 4 * Math.PI ) / totalWeight;
|
||||
|
||||
for ( let j = 0; j < 9; j ++ ) {
|
||||
|
||||
shCoefficients[ j ].x *= norm;
|
||||
shCoefficients[ j ].y *= norm;
|
||||
shCoefficients[ j ].z *= norm;
|
||||
|
||||
}
|
||||
|
||||
return new LightProbe( sh );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function convertColorToLinear( color, colorSpace ) {
|
||||
|
||||
switch ( colorSpace ) {
|
||||
|
||||
case SRGBColorSpace:
|
||||
|
||||
color.convertSRGBToLinear();
|
||||
break;
|
||||
|
||||
case LinearSRGBColorSpace:
|
||||
case NoColorSpace:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
console.warn( 'WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.' );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
export { LightProbeGenerator };
|
||||
Generated
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
import {
|
||||
ClampToEdgeWrapping,
|
||||
DataTexture,
|
||||
DataUtils,
|
||||
FloatType,
|
||||
HalfFloatType,
|
||||
LinearFilter,
|
||||
NearestFilter,
|
||||
RGBAFormat,
|
||||
UVMapping,
|
||||
UniformsLib
|
||||
} from 'three';
|
||||
|
||||
/**
|
||||
* Uniforms library for RectAreaLight shared webgl shaders
|
||||
*
|
||||
* NOTE: This is a temporary location for the BRDF approximation texture data
|
||||
* based off of Eric Heitz's work (see citation below). BRDF data for
|
||||
* RectAreaLight is currently approximated using a precomputed texture
|
||||
* of roughly 80kb in size. The hope is to find a better way to include
|
||||
* the large texture data before including the full RectAreaLight implementation
|
||||
* in the main build files.
|
||||
*
|
||||
* TODO: figure out a way to compress the LTC BRDF data
|
||||
*/
|
||||
|
||||
// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines
|
||||
// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
|
||||
// code: https://github.com/selfshadow/ltc_code/
|
||||
|
||||
class RectAreaLightUniformsLib {
|
||||
|
||||
static init() {
|
||||
|
||||
// source: https://github.com/selfshadow/ltc_code/tree/master/fit/results/ltc.js
|
||||
|
||||
const LTC_MAT_1 = [ 1, 0, 0, 2e-05, 1, 0, 0, 0.000503905, 1, 0, 0, 0.00201562, 1, 0, 0, 0.00453516, 1, 0, 0, 0.00806253, 1, 0, 0, 0.0125978, 1, 0, 0, 0.018141, 1, 0, 0, 0.0246924, 1, 0, 0, 0.0322525, 1, 0, 0, 0.0408213, 1, 0, 0, 0.0503999, 1, 0, 0, 0.0609894, 1, 0, 0, 0.0725906, 1, 0, 0, 0.0852058, 1, 0, 0, 0.0988363, 1, 0, 0, 0.113484, 1, 0, 0, 0.129153, 1, 0, 0, 0.145839, 1, 0, 0, 0.163548, 1, 0, 0, 0.182266, 1, 0, 0, 0.201942, 1, 0, 0, 0.222314, 1, 0, 0, 0.241906, 1, 0, 0, 0.262314, 1, 0, 0, 0.285754, 1, 0, 0, 0.310159, 1, 0, 0, 0.335426, 1, 0, 0, 0.361341, 1, 0, 0, 0.387445, 1, 0, 0, 0.412784, 1, 0, 0, 0.438197, 1, 0, 0, 0.466966, 1, 0, 0, 0.49559, 1, 0, 0, 0.523448, 1, 0, 0, 0.549938, 1, 0, 0, 0.57979, 1, 0, 0, 0.608746, 1, 0, 0, 0.636185, 1, 0, 0, 0.664748, 1, 0, 0, 0.69313, 1, 0, 0, 0.71966, 1, 0, 0, 0.747662, 1, 0, 0, 0.774023, 1, 0, 0, 0.799775, 1, 0, 0, 0.825274, 1, 0, 0, 0.849156, 1, 0, 0, 0.873248, 1, 0, 0, 0.89532, 1, 0, 0, 0.917565, 1, 0, 0, 0.937863, 1, 0, 0, 0.958139, 1, 0, 0, 0.976563, 1, 0, 0, 0.994658, 1, 0, 0, 1.0112, 1, 0, 0, 1.02712, 1, 0, 0, 1.04189, 1, 0, 0, 1.05568, 1, 0, 0, 1.06877, 1, 0, 0, 1.08058, 1, 0, 0, 1.09194, 1, 0, 0, 1.10191, 1, 0, 0, 1.11161, 1, 0, 0, 1.1199, 1, 0, 0, 1.12813, 0.999547, - 4.48815e-07, 0.0224417, 1.99902e-05, 0.999495, - 1.13079e-05, 0.0224406, 0.000503651, 0.999496, - 4.52317e-05, 0.0224406, 0.00201461, 0.999496, - 0.000101772, 0.0224406, 0.00453287, 0.999495, - 0.000180928, 0.0224406, 0.00805845, 0.999497, - 0.000282702, 0.0224406, 0.0125914, 0.999496, - 0.000407096, 0.0224406, 0.0181319, 0.999498, - 0.000554114, 0.0224406, 0.02468, 0.999499, - 0.000723768, 0.0224406, 0.0322363, 0.999495, - 0.000916058, 0.0224405, 0.0408009, 0.999499, - 0.00113101, 0.0224408, 0.050375, 0.999494, - 0.00136863, 0.0224405, 0.0609586, 0.999489, - 0.00162896, 0.0224401, 0.0725537, 0.999489, - 0.00191201, 0.0224414, 0.0851619, 0.999498, - 0.00221787, 0.0224413, 0.0987867, 0.999492, - 0.00254642, 0.0224409, 0.113426, 0.999507, - 0.00289779, 0.0224417, 0.129088, 0.999494, - 0.0032716, 0.0224386, 0.145767, 0.999546, - 0.0036673, 0.0224424, 0.163472, 0.999543, - 0.00408166, 0.0224387, 0.182182, 0.999499, - 0.00450056, 0.0224338, 0.201843, 0.999503, - 0.00483661, 0.0224203, 0.222198, 0.999546, - 0.00452928, 0.022315, 0.241714, 0.999508, - 0.00587403, 0.0224329, 0.262184, 0.999509, - 0.00638806, 0.0224271, 0.285609, 0.999501, - 0.00691028, 0.0224166, 0.309998, 0.999539, - 0.00741979, 0.0223989, 0.335262, 0.999454, - 0.00786282, 0.0223675, 0.361154, 0.999529, - 0.00811928, 0.0222828, 0.387224, 0.999503, - 0.00799941, 0.0221063, 0.41252, 0.999561, - 0.00952753, 0.0223057, 0.438006, 0.999557, - 0.0099134, 0.0222065, 0.466735, 0.999541, - 0.0100935, 0.0220402, 0.495332, 0.999562, - 0.00996821, 0.0218067, 0.523197, 0.999556, - 0.0105031, 0.0217096, 0.550223, 0.999561, - 0.0114191, 0.0217215, 0.579498, 0.999588, - 0.0111818, 0.0213357, 0.608416, 0.999633, - 0.0107725, 0.0208689, 0.635965, 0.999527, - 0.0121671, 0.0210149, 0.664476, 0.999508, - 0.0116005, 0.020431, 0.692786, 0.999568, - 0.0115604, 0.0199791, 0.719709, 0.999671, - 0.0121117, 0.0197415, 0.74737, 0.999688, - 0.0110769, 0.0188846, 0.773692, 0.99962, - 0.0122368, 0.0188452, 0.799534, 0.999823, - 0.0110325, 0.0178001, 0.825046, 0.999599, - 0.0114923, 0.0174221, 0.849075, 0.999619, - 0.0105923, 0.0164345, 0.872999, 0.999613, - 0.0105988, 0.0158227, 0.895371, 0.99964, - 0.00979861, 0.0148131, 0.917364, 0.99977, - 0.00967238, 0.0140721, 0.938002, 0.999726, - 0.00869175, 0.0129543, 0.957917, 0.99973, - 0.00866872, 0.0122329, 0.976557, 0.999773, - 0.00731956, 0.0108958, 0.994459, 0.999811, - 0.00756027, 0.0102715, 1.01118, 0.999862, - 0.00583732, 0.00878781, 1.02701, 0.999835, - 0.00631438, 0.00827529, 1.04186, 0.999871, - 0.00450785, 0.00674583, 1.05569, 0.999867, - 0.00486079, 0.00621041, 1.06861, 0.999939, - 0.00322072, 0.00478301, 1.08064, 0.999918, - 0.00318199, 0.00406395, 1.09181, 1.00003, - 0.00193348, 0.00280682, 1.10207, 0.999928, - 0.00153729, 0.00198741, 1.11152, 0.999933, - 0.000623666, 0.000917714, 1.12009, 1, - 1.02387e-06, 9.07581e-07, 1.12813, 0.997866, - 8.96716e-07, 0.0448334, 1.99584e-05, 0.997987, - 2.25945e-05, 0.0448389, 0.000502891, 0.997987, - 9.03781e-05, 0.0448388, 0.00201156, 0.997985, - 0.000203351, 0.0448388, 0.00452602, 0.997986, - 0.000361514, 0.0448388, 0.00804629, 0.997987, - 0.00056487, 0.0448389, 0.0125724, 0.997988, - 0.000813423, 0.0448389, 0.0181045, 0.997984, - 0.00110718, 0.0448387, 0.0246427, 0.997985, - 0.00144616, 0.0448388, 0.0321875, 0.997987, - 0.00183038, 0.044839, 0.0407392, 0.997983, - 0.00225987, 0.0448387, 0.0502986, 0.997991, - 0.00273467, 0.0448389, 0.0608667, 0.997984, - 0.00325481, 0.0448384, 0.0724444, 0.998002, - 0.00382043, 0.044839, 0.0850348, 0.997997, - 0.00443145, 0.0448396, 0.0986372, 0.998007, - 0.00508796, 0.0448397, 0.113255, 0.998008, - 0.00578985, 0.04484, 0.128891, 0.998003, - 0.00653683, 0.0448384, 0.145548, 0.997983, - 0.00732713, 0.0448358, 0.163221, 0.99798Line truncated
|
||||
|
||||
const LTC_MAT_2 = [ 1, 0, 0, 0, 1, 7.91421e-31, 0, 0, 1, 1.04392e-24, 0, 0, 1, 3.49405e-21, 0, 0, 1, 1.09923e-18, 0, 0, 1, 9.47414e-17, 0, 0, 1, 3.59627e-15, 0, 0, 1, 7.72053e-14, 0, 0, 1, 1.08799e-12, 0, 0, 1, 1.10655e-11, 0, 0, 1, 8.65818e-11, 0, 0, 0.999998, 5.45037e-10, 0, 0, 0.999994, 2.85095e-09, 0, 0, 0.999989, 1.26931e-08, 0, 0, 0.999973, 4.89938e-08, 0, 0, 0.999947, 1.66347e-07, 0, 0, 0.999894, 5.02694e-07, 0, 0, 0.999798, 1.36532e-06, 0, 0, 0.999617, 3.35898e-06, 0, 0, 0.999234, 7.52126e-06, 0, 0, 0.998258, 1.52586e-05, 0, 0, 0.99504, 2.66207e-05, 0, 0, 0.980816, 2.36802e-05, 0, 0, 0.967553, 2.07684e-06, 0, 0, 0.966877, 4.03733e-06, 0, 0, 0.965752, 7.41174e-06, 0, 0, 0.96382, 1.27746e-05, 0, 0, 0.960306, 2.02792e-05, 0, 0, 0.953619, 2.80232e-05, 0, 0, 0.941103, 2.78816e-05, 0, 0, 0.926619, 1.60221e-05, 0, 0, 0.920983, 2.35164e-05, 0, 0, 0.912293, 3.11924e-05, 0, 0.0158731, 0.899277, 3.48118e-05, 0, 0.0476191, 0.880884, 2.6041e-05, 0, 0.0793651, 0.870399, 3.38726e-05, 0, 0.111111, 0.856138, 3.92906e-05, 0, 0.142857, 0.837436, 3.72874e-05, 0, 0.174603, 0.820973, 3.92558e-05, 0, 0.206349, 0.803583, 4.34658e-05, 0, 0.238095, 0.782168, 4.0256e-05, 0, 0.269841, 0.764107, 4.48159e-05, 0, 0.301587, 0.743092, 4.57627e-05, 0, 0.333333, 0.721626, 4.55314e-05, 0, 0.365079, 0.700375, 4.77335e-05, 0, 0.396825, 0.677334, 4.61072e-05, 0, 0.428571, 0.655702, 4.84393e-05, 0, 0.460317, 0.632059, 4.64583e-05, 0, 0.492064, 0.610125, 4.83923e-05, 0, 0.52381, 0.58653, 4.64342e-05, 0, 0.555556, 0.564508, 4.77033e-05, 0, 0.587302, 0.541405, 4.59263e-05, 0, 0.619048, 0.519556, 4.6412e-05, 0, 0.650794, 0.497292, 4.48913e-05, 0, 0.68254, 0.475898, 4.45789e-05, 0, 0.714286, 0.454722, 4.33496e-05, 0, 0.746032, 0.434042, 4.23054e-05, 0, 0.777778, 0.414126, 4.13737e-05, 0, 0.809524, 0.394387, 3.97265e-05, 0, 0.84127, 0.375841, 3.90709e-05, 0, 0.873016, 0.357219, 3.69938e-05, 0, 0.904762, 0.340084, 3.65618e-05, 0, 0.936508, 0.322714, 3.42533e-05, 0, 0.968254, 0.306974, 3.39596e-05, 0, 1, 1, 1.01524e-18, 0, 0, 1, 1.0292e-18, 0, 0, 1, 1.30908e-18, 0, 0, 1, 4.73331e-18, 0, 0, 1, 6.25319e-17, 0, 0, 1, 1.07932e-15, 0, 0, 1, 1.63779e-14, 0, 0, 1, 2.03198e-13, 0, 0, 1, 2.04717e-12, 0, 0, 0.999999, 1.68995e-11, 0, 0, 0.999998, 1.15855e-10, 0, 0, 0.999996, 6.6947e-10, 0, 0, 0.999991, 3.30863e-09, 0, 0, 0.999983, 1.41737e-08, 0, 0, 0.999968, 5.32626e-08, 0, 0, 0.99994, 1.77431e-07, 0, 0, 0.999891, 5.28835e-07, 0, 0, 0.999797, 1.42169e-06, 0, 0, 0.999617, 3.47057e-06, 0, 0, 0.999227, 7.7231e-06, 0, 0, 0.998239, 1.55753e-05, 0, 0, 0.994937, 2.68495e-05, 0, 0, 0.980225, 2.13742e-05, 0, 0, 0.967549, 2.1631e-06, 0, 0, 0.966865, 4.17989e-06, 0, 0, 0.965739, 7.63341e-06, 0, 0, 0.963794, 1.30892e-05, 0, 0, 0.960244, 2.06456e-05, 0, 0, 0.953495, 2.82016e-05, 0, 0.000148105, 0.940876, 2.71581e-05, 0, 0.002454, 0.926569, 1.64159e-05, 0, 0.00867491, 0.920905, 2.39521e-05, 0, 0.01956, 0.912169, 3.15127e-05, 0, 0.035433, 0.899095, 3.46626e-05, 0, 0.056294, 0.882209, 2.90223e-05, 0, 0.0818191, 0.870272, 3.42992e-05, 0, 0.111259, 0.855977, 3.94164e-05, 0, 0.142857, 0.837431, 3.72343e-05, 0, 0.174603, 0.820826, 3.96691e-05, 0, 0.206349, 0.803408, 4.35395e-05, 0, 0.238095, 0.782838, 4.19579e-05, 0, 0.269841, 0.763941, 4.50953e-05, 0, 0.301587, 0.742904, 4.55847e-05, 0, 0.333333, 0.721463, 4.58833e-05, 0, 0.365079, 0.700197, 4.77159e-05, 0, 0.396825, 0.677501, 4.70641e-05, 0, 0.428571, 0.655527, 4.84732e-05, 0, 0.460317, 0.6324, 4.76834e-05, 0, 0.492064, 0.609964, 4.84213e-05, 0, 0.52381, 0.586839, 4.75541e-05, 0, 0.555556, 0.564353, 4.76951e-05, 0, 0.587302, 0.541589, 4.67611e-05, 0, 0.619048, 0.519413, 4.63493e-05, 0, 0.650794, 0.497337, 4.53994e-05, 0, 0.68254, 0.475797, 4.45308e-05, 0, 0.714286, 0.454659, 4.35787e-05, 0, 0.746032, 0.434065, 4.24839e-05, 0, 0.777778, 0.414018, 4.1436e-05, 0, 0.809524, 0.39455, 4.01902e-05, 0, 0.84127, 0.375742, 3.90813e-05, 0, 0.873016, 0.357501, 3.77116e-05, 0, 0.904762, 0.339996, 3.6535e-05, 0, 0.936508, 0.323069, 3.51265e-05, 0, 0.968254, 0.306897, 3.39112e-05, 0, 1, 1, 1.0396e-15, 0, 0, 1, 1.04326e-15, 0, 0, 1, 1.10153e-15, 0, 0, 1, 1.44668e-15, 0, 0, 1, 3.4528e-15, 0, 0, 1, 1.75958e-14, 0, 0, 1, 1.2627e-13, 0, 0, 1, 9.36074e-13, 0, 0, 1, 6.45742e-12, 0, 0, 0.999998, 4.01228e-11, 0, 0, 0.999997, 2.22338e-10, 0, 0, 0.999995, 1.0967e-09, 0, 0, 0.999991, 4.82132e-09, 0, 0, 0.999981, 1.89434e-08, 0, 0, 0.999967, 6.67716e-08, 0, 0, 0.999938, 2.12066e-07, 0, 0, 0.999886, 6.0977e-07, 0, 0, 0.999792, 1.59504e-06, 0, 0, 0.999608, 3.81191e-06, 0, 0, 0.999209, 8.33727e-06, 0, 0, 0.998179, 1.65288e-05, 0, 0, 0.994605, 2.74387e-05, 0, 0, 0.979468, 1.67316e-05, 0, 0, 0.967529, 2.42877e-06, 0, 0, 0.966836, 4.61696e-06, 0, 0, 0.96569, 8.30977e-06, 0, 0, 0.963706, 1.40427e-05, 0, 2.44659e-06, 0.960063, 2.17353e-05, 0, 0.000760774, 0.953113, 2.86606e-05, 0, 0.00367261, 0.940192, 2.47691e-05, 0, 0.00940263, 0.927731, 1.95814e-05, 0, 0.018333, 0.920669, 2.52531e-05, 0, 0.0306825, 0.911799, 3.24277e-05, 0, 0.0465556, 0.89857, 3.40982e-Line truncated
|
||||
|
||||
// data textures
|
||||
|
||||
const ltc_float_1 = new Float32Array( LTC_MAT_1 );
|
||||
const ltc_float_2 = new Float32Array( LTC_MAT_2 );
|
||||
|
||||
UniformsLib.LTC_FLOAT_1 = new DataTexture( ltc_float_1, 64, 64, RGBAFormat, FloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 );
|
||||
UniformsLib.LTC_FLOAT_2 = new DataTexture( ltc_float_2, 64, 64, RGBAFormat, FloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 );
|
||||
|
||||
UniformsLib.LTC_FLOAT_1.needsUpdate = true;
|
||||
UniformsLib.LTC_FLOAT_2.needsUpdate = true;
|
||||
|
||||
const ltc_half_1 = new Uint16Array( LTC_MAT_1.length );
|
||||
|
||||
LTC_MAT_1.forEach( function ( x, index ) {
|
||||
|
||||
ltc_half_1[ index ] = DataUtils.toHalfFloat( x );
|
||||
|
||||
} );
|
||||
|
||||
const ltc_half_2 = new Uint16Array( LTC_MAT_2.length );
|
||||
|
||||
LTC_MAT_2.forEach( function ( x, index ) {
|
||||
|
||||
ltc_half_2[ index ] = DataUtils.toHalfFloat( x );
|
||||
|
||||
} );
|
||||
|
||||
UniformsLib.LTC_HALF_1 = new DataTexture( ltc_half_1, 64, 64, RGBAFormat, HalfFloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 );
|
||||
UniformsLib.LTC_HALF_2 = new DataTexture( ltc_half_2, 64, 64, RGBAFormat, HalfFloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 );
|
||||
|
||||
UniformsLib.LTC_HALF_1.needsUpdate = true;
|
||||
UniformsLib.LTC_HALF_2.needsUpdate = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { RectAreaLightUniformsLib };
|
||||
Reference in new issue
Block a user