1 /**
  2  * @author mikael emtinger / http://gomo.se/
  3  *
  4  */
  5 
  6 /**@namespace*/
  7 THREE.ShaderFlares = {
  8 
  9 	'lensFlareVertexTexture': {
 10 
 11 		vertexShader: [
 12 
 13 			"uniform vec3 screenPosition;",
 14 			"uniform vec2 scale;",
 15 			"uniform float rotation;",
 16 			"uniform int renderType;",
 17 
 18 			"uniform sampler2D occlusionMap;",
 19 
 20 			"attribute vec2 position;",
 21 			"attribute vec2 uv;",
 22 
 23 			"varying vec2 vUV;",
 24 			"varying float vVisibility;",
 25 
 26 			"void main() {",
 27 
 28 				"vUV = uv;",
 29 
 30 				"vec2 pos = position;",
 31 
 32 				"if( renderType == 2 ) {",
 33 
 34 					"vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +",
 35 									  "texture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +",
 36 									  "texture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +",
 37 									  "texture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +",
 38 									  "texture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +",
 39 									  "texture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +",
 40 									  "texture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +",
 41 									  "texture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +",
 42 									  "texture2D( occlusionMap, vec2( 0.5, 0.5 ) );",
 43 
 44 					"vVisibility = (       visibility.r / 9.0 ) *",
 45 								  "( 1.0 - visibility.g / 9.0 ) *",
 46 								  "(       visibility.b / 9.0 ) *",
 47 								  "( 1.0 - visibility.a / 9.0 );",
 48 
 49 					"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;",
 50 					"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;",
 51 
 52 				"}",
 53 
 54 				"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );",
 55 
 56 			"}"
 57 
 58 		].join( "\n" ),
 59 
 60 		fragmentShader: [
 61 
 62 			"precision mediump float;",
 63 
 64 			"uniform sampler2D map;",
 65 			"uniform float opacity;",
 66 			"uniform int renderType;",
 67 			"uniform vec3 color;",
 68 
 69 			"varying vec2 vUV;",
 70 			"varying float vVisibility;",
 71 
 72 			"void main() {",
 73 
 74 				// pink square
 75 
 76 				"if( renderType == 0 ) {",
 77 
 78 					"gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );",
 79 
 80 				// restore
 81 
 82 				"} else if( renderType == 1 ) {",
 83 
 84 					"gl_FragColor = texture2D( map, vUV );",
 85 
 86 				// flare
 87 
 88 				"} else {",
 89 
 90 					"vec4 texture = texture2D( map, vUV );",
 91 					"texture.a *= opacity * vVisibility;",
 92 					"gl_FragColor = texture;",
 93 					"gl_FragColor.rgb *= color;",
 94 
 95 				"}",
 96 
 97 			"}"
 98 		].join( "\n" )
 99 
100 	},
101 
102 
103 	'lensFlare': {
104 
105 		vertexShader: [
106 
107 			"uniform vec3 screenPosition;",
108 			"uniform vec2 scale;",
109 			"uniform float rotation;",
110 			"uniform int renderType;",
111 
112 			"attribute vec2 position;",
113 			"attribute vec2 uv;",
114 
115 			"varying vec2 vUV;",
116 
117 			"void main() {",
118 
119 				"vUV = uv;",
120 
121 				"vec2 pos = position;",
122 
123 				"if( renderType == 2 ) {",
124 
125 					"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;",
126 					"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;",
127 
128 				"}",
129 
130 				"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );",
131 
132 			"}"
133 
134 		].join( "\n" ),
135 
136 		fragmentShader: [
137 
138 			"precision mediump float;",
139 
140 			"uniform sampler2D map;",
141 			"uniform sampler2D occlusionMap;",
142 			"uniform float opacity;",
143 			"uniform int renderType;",
144 			"uniform vec3 color;",
145 
146 			"varying vec2 vUV;",
147 
148 			"void main() {",
149 
150 				// pink square
151 
152 				"if( renderType == 0 ) {",
153 
154 					"gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );",
155 
156 				// restore
157 
158 				"} else if( renderType == 1 ) {",
159 
160 					"gl_FragColor = texture2D( map, vUV );",
161 
162 				// flare
163 
164 				"} else {",
165 
166 					"float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +",
167 									   "texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +",
168 									   "texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +",
169 									   "texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;",
170 
171 					"visibility = ( 1.0 - visibility / 4.0 );",
172 
173 					"vec4 texture = texture2D( map, vUV );",
174 					"texture.a *= opacity * visibility;",
175 					"gl_FragColor = texture;",
176 					"gl_FragColor.rgb *= color;",
177 
178 				"}",
179 
180 			"}"
181 
182 		].join( "\n" )
183 
184 	}
185 
186 };
187 

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

mbt skor nike sverige louboutin skor hollister sverige polo ralph lauren skjorta woolrich jacka dam canada goose jacka woolrich jacka ray ban rea canada goose rea michael kors rea new balance skor ralph lauren skjorta new balance rea uggs sverige lacoste rea christian louboutin skor moncler jacka nike shox barbour jacka uggs rea