1 /**
2 * @author mikael emtinger / http://gomo.se/
3 * @author alteredq / http://alteredqualia.com/
4 *
5 */
6
7 /**@namespace*/
8 THREE.ShaderSprite = {
9
10 'sprite': {
11
12 vertexShader: [
13
14 "uniform int useScreenCoordinates;",
15 "uniform int affectedByDistance;",
16 "uniform vec3 screenPosition;",
17 "uniform mat4 modelViewMatrix;",
18 "uniform mat4 projectionMatrix;",
19 "uniform float rotation;",
20 "uniform vec2 scale;",
21 "uniform vec2 alignment;",
22 "uniform vec2 uvOffset;",
23 "uniform vec2 uvScale;",
24
25 "attribute vec2 position;",
26 "attribute vec2 uv;",
27
28 "varying vec2 vUV;",
29
30 "void main() {",
31
32 "vUV = uvOffset + uv * uvScale;",
33
34 "vec2 alignedPosition = position + alignment;",
35
36 "vec2 rotatedPosition;",
37 "rotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;",
38 "rotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;",
39
40 "vec4 finalPosition;",
41
42 "if( useScreenCoordinates != 0 ) {",
43
44 "finalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );",
45
46 "} else {",
47
48 "finalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );",
49 "finalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );",
50
51 "}",
52
53 "gl_Position = finalPosition;",
54
55 "}"
56
57 ].join( "\n" ),
58
59 fragmentShader: [
60
61 "precision mediump float;",
62
63 "uniform vec3 color;",
64 "uniform sampler2D map;",
65 "uniform float opacity;",
66
67 "uniform int fogType;",
68 "uniform vec3 fogColor;",
69 "uniform float fogDensity;",
70 "uniform float fogNear;",
71 "uniform float fogFar;",
72
73 "varying vec2 vUV;",
74
75 "void main() {",
76
77 "vec4 texture = texture2D( map, vUV );",
78 "gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );",
79
80 "if ( fogType > 0 ) {",
81
82 "float depth = gl_FragCoord.z / gl_FragCoord.w;",
83 "float fogFactor = 0.0;",
84
85 "if ( fogType == 1 ) {",
86
87 "fogFactor = smoothstep( fogNear, fogFar, depth );",
88
89 "} else {",
90
91 "const float LOG2 = 1.442695;",
92 "float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );",
93 "fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );",
94
95 "}",
96
97 "gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );",
98
99 "}",
100
101 "}"
102
103 ].join( "\n" )
104
105 }
106
107 };
108
nike free rn
new balance hombre baratas
cinturones gucci
ugg rebajas
cinturon gucci
ray ban baratas
nike cortez
peuterey mujer
christian louboutin madrid
mbt zapatos
gafas ray ban baratas
mbt ofertas
air max blancas
mbt barcelona
nike air max 90
woolrich barcelona
nike mujer
botas ugg
gafas de sol carrera aratas
air max 2016 baratas
oakley baratas
nike air max 2016