Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.js:1375 THREE.WebGLProgram: shader error: 0 35715 false gl.getProgramInfoLog No compiled fragment shader when at least one graphics shader is attached.
- THREE.WebGLShader: gl.getShaderInfoLog() vertex
- ERROR: 0:50: 'precision' : unexpected token after conditional expression
- ERROR: 0:50: 'ifdef' : unexpected end of file found in conditional block
- 1: precision highp float;
- 2: precision highp int;
- 3: #define HIGH_PRECISION
- 4: #define SHADER_NAME ShaderMaterial
- 5: #define VERTEX_TEXTURES
- 6: #define GAMMA_FACTOR 2
- 7: #define MAX_BONES 0
- 8: #define BONE_TEXTURE
- 9: uniform mat4 modelMatrix;
- 10: uniform mat4 modelViewMatrix;
- 11: uniform mat4 projectionMatrix;
- 12: uniform mat4 viewMatrix;
- 13: uniform mat3 normalMatrix;
- 14: uniform vec3 cameraPosition;
- 15: uniform bool isOrthographic;
- 16: #ifdef USE_INSTANCING
- 17: attribute mat4 instanceMatrix;
- 18: #endif
- 19: attribute vec3 position;
- 20: attribute vec3 normal;
- 21: attribute vec2 uv;
- 22: #ifdef USE_TANGENT
- 23: attribute vec4 tangent;
- 24: #endif
- 25: #ifdef USE_COLOR
- 26: attribute vec3 color;
- 27: #endif
- 28: #ifdef USE_MORPHTARGETS
- 29: attribute vec3 morphTarget0;
- 30: attribute vec3 morphTarget1;
- 31: attribute vec3 morphTarget2;
- 32: attribute vec3 morphTarget3;
- 33: #ifdef USE_MORPHNORMALS
- 34: attribute vec3 morphNormal0;
- 35: attribute vec3 morphNormal1;
- 36: attribute vec3 morphNormal2;
- 37: attribute vec3 morphNormal3;
- 38: #else
- 39: attribute vec3 morphTarget4;
- 40: attribute vec3 morphTarget5;
- 41: attribute vec3 morphTarget6;
- 42: attribute vec3 morphTarget7;
- 43: #endif
- 44: #endif
- 45: #ifdef USE_SKINNING
- 46: attribute vec4 skinIndex;
- 47: attribute vec4 skinWeight;
- 48: #endif
- 49:
- 50: #ifdef GL_ES precision highp float; #endif
- 51: varying vec2 texcoord; void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); texcoord = uv;} THREE.WebGLShader: gl.getShaderInfoLog() fragment
- ERROR: 0:106: 'precision' : unexpected token after conditional expression
- ERROR: 0:106: 'ifdef' : unexpected end of file found in conditional block
- ERROR: 0:185: '' : syntax error
- 1: precision highp float;
- 2: precision highp int;
- 3: #define HIGH_PRECISION
- 4: #define SHADER_NAME ShaderMaterial
- 5: #define GAMMA_FACTOR 2
- 6: uniform mat4 viewMatrix;
- 7: uniform vec3 cameraPosition;
- 8: uniform bool isOrthographic;
- 9: #define TONE_MAPPING
- 10: #ifndef saturate
- 11: #define saturate(a) clamp( a, 0.0, 1.0 )
- 12: #endif
- 13: uniform float toneMappingExposure;
- 14: uniform float toneMappingWhitePoint;
- 15: vec3 LinearToneMapping( vec3 color ) {
- 16: return toneMappingExposure * color;
- 17: }
- 18: vec3 ReinhardToneMapping( vec3 color ) {
- 19: color *= toneMappingExposure;
- 20: return saturate( color / ( vec3( 1.0 ) + color ) );
- 21: }
- 22: #define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
- 23: vec3 Uncharted2ToneMapping( vec3 color ) {
- 24: color *= toneMappingExposure;
- 25: return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
- 26: }
- 27: vec3 OptimizedCineonToneMapping( vec3 color ) {
- 28: color *= toneMappingExposure;
- 29: color = max( vec3( 0.0 ), color - 0.004 );
- 30: return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
- 31: }
- 32: vec3 ACESFilmicToneMapping( vec3 color ) {
- 33: color *= toneMappingExposure;
- 34: return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );
- 35: }
- 36: vec3 toneMapping( vec3 color ) { return LinearToneMapping( color ); }
- 37:
- 38: vec4 LinearToLinear( in vec4 value ) {
- 39: return value;
- 40: }
- 41: vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
- 42: return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
- 43: }
- 44: vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
- 45: return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
- 46: }
- 47: vec4 sRGBToLinear( in vec4 value ) {
- 48: return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
- 49: }
- 50: vec4 LinearTosRGB( in vec4 value ) {
- 51: return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
- 52: }
- 53: vec4 RGBEToLinear( in vec4 value ) {
- 54: return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
- 55: }
- 56: vec4 LinearToRGBE( in vec4 value ) {
- 57: float maxComponent = max( max( value.r, value.g ), value.b );
- 58: float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
- 59: return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
- 60: }
- 61: vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
- 62: return vec4( value.rgb * value.a * maxRange, 1.0 );
- 63: }
- 64: vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
- 65: float maxRGB = max( value.r, max( value.g, value.b ) );
- 66: float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
- 67: M = ceil( M * 255.0 ) / 255.0;
- 68: return vec4( value.rgb / ( M * maxRange ), M );
- 69: }
- 70: vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
- 71: return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
- 72: }
- 73: vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
- 74: float maxRGB = max( value.r, max( value.g, value.b ) );
- 75: float D = max( maxRange / maxRGB, 1.0 );
- 76: D = min( floor( D ) / 255.0, 1.0 );
- 77: return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
- 78: }
- 79: const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
- 80: vec4 LinearToLogLuv( in vec4 value ) {
- 81: vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
- 82: Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
- 83: vec4 vResult;
- 84: vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
- 85: float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
- 86: vResult.w = fract( Le );
- 87: vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
- 88: return vResult;
- 89: }
- 90: const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
- 91: vec4 LogLuvToLinear( in vec4 value ) {
- 92: float Le = value.z * 255.0 + value.w;
- 93: vec3 Xp_Y_XYZp;
- 94: Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
- 95: Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
- 96: Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
- 97: vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
- 98: return vec4( max( vRGB, 0.0 ), 1.0 );
- 99: }
- 100: vec4 mapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
- 101: vec4 matcapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
- 102: vec4 envMapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
- 103: vec4 emissiveMapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
- 104: vec4 linearToOutputTexel( vec4 value ) { return LinearToLinear( value ); }
- 105:
- 106: #ifdef GL_ES precision highp float; #endif
- 107: #define PI 3.14159265359
- 108: #define PI2 6.28318530718
- 109: #define PI_HALF 1.5707963267949
- 110: #define RECIPROCAL_PI 0.31830988618
- 111: #define RECIPROCAL_PI2 0.15915494
- 112: #define LOG2 1.442695
- 113: #define EPSILON 1e-6
- 114: #ifndef saturate
- 115: #define saturate(a) clamp( a, 0.0, 1.0 )
- 116: #endif
- 117: #define whiteComplement(a) ( 1.0 - saturate( a ) )
- 118: float pow2( const in float x ) { return x*x; }
- 119: float pow3( const in float x ) { return x*x*x; }
- 120: float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
- 121: float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
- 122: highp float rand( const in vec2 uv ) {
- 123: const highp float a = 12.9898, b = 78.233, c = 43758.5453;
- 124: highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
- 125: return fract(sin(sn) * c);
- 126: }
- 127: #ifdef HIGH_PRECISION
- 128: float precisionSafeLength( vec3 v ) { return length( v ); }
- 129: #else
- 130: float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
- 131: float precisionSafeLength( vec3 v ) {
- 132: float maxComponent = max3( abs( v ) );
- 133: return length( v / maxComponent ) * maxComponent;
- 134: }
- 135: #endif
- 136: struct IncidentLight {
- 137: vec3 color;
- 138: vec3 direction;
- 139: bool visible;
- 140: };
- 141: struct ReflectedLight {
- 142: vec3 directDiffuse;
- 143: vec3 directSpecular;
- 144: vec3 indirectDiffuse;
- 145: vec3 indirectSpecular;
- 146: };
- 147: struct GeometricContext {
- 148: vec3 position;
- 149: vec3 normal;
- 150: vec3 viewDir;
- 151: #ifdef CLEARCOAT
- 152: vec3 clearcoatNormal;
- 153: #endif
- 154: };
- 155: vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- 156: return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- 157: }
- 158: vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
- 159: return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
- 160: }
- 161: vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
- 162: float distance = dot( planeNormal, point - pointOnPlane );
- 163: return - distance * planeNormal + point;
- 164: }
- 165: float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
- 166: return sign( dot( point - pointOnPlane, planeNormal ) );
- 167: }
- 168: vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
- 169: return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
- 170: }
- 171: mat3 transposeMat3( const in mat3 m ) {
- 172: mat3 tmp;
- 173: tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
- 174: tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
- 175: tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
- 176: return tmp;
- 177: }
- 178: float linearToRelativeLuminance( const in vec3 color ) {
- 179: vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
- 180: return dot( weights, color.rgb );
- 181: }
- 182: bool isPerspectiveMatrix( mat4 m ) {
- 183: return m[ 2 ][ 3 ] == - 1.0;
- 184: }
- 185: varying vec2 texcoord; uniform sampler2D text; uniform vec2 positions[16]; uniform float data[16]; const int num = 16; float colormap_red(float x) { if (x < 0.7) { return 4.0 * x - 1.5; } else { return -4.0 * x + 4.5; } } float colormap_green(float x) { if (x < 0.5) { return 4.0 * x - 0.5; } else { return -4.0 * x + 3.5; } } float colormap_blue(float x) { if (x < 0.3) { return 4.0 * x + 0.5; } else { return -4.0 * x + 2.5; } } vec4 colormap(float x) { float r = clamp(colormap_red(x), 0.0, 1.0); float g = clamp(colormap_green(x), 0.0, 1.0); float b = clamp(colormap_blue(x), 0.0, 1.0); return vec4(r, g, b, 1.0); } void main( void ) { float val = texture2D(text, texcoord).r; float finalcol = 0.; for(int i = 0; i < num; i++) { finalcol += data[i]*exp(-1.*pow((distance(positions[i], texcoord) / 0.05), 2.)); } gl_FragColor = colormap(clamp(finalcol * val, 0., 1.));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement