NormalDisplacementShader.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /*
  2. * @author alteredq / http://alteredqualia.com/
  3. *
  4. * Normal map shader
  5. * - Blinn-Phong
  6. * - normal + diffuse + specular + AO + displacement + reflection + shadow maps
  7. * - point and directional lights (use with "lights: true" material option)
  8. */
  9. THREE.NormalDisplacementShader = {
  10. uniforms: THREE.UniformsUtils.merge( [
  11. THREE.UniformsLib[ "fog" ],
  12. THREE.UniformsLib[ "lights" ],
  13. THREE.UniformsLib[ "shadowmap" ],
  14. {
  15. "enableAO" : { type: "i", value: 0 },
  16. "enableDiffuse" : { type: "i", value: 0 },
  17. "enableSpecular" : { type: "i", value: 0 },
  18. "enableReflection" : { type: "i", value: 0 },
  19. "enableDisplacement": { type: "i", value: 0 },
  20. "tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture
  21. "tDiffuse" : { type: "t", value: null },
  22. "tCube" : { type: "t", value: null },
  23. "tNormal" : { type: "t", value: null },
  24. "tSpecular" : { type: "t", value: null },
  25. "tAO" : { type: "t", value: null },
  26. "uNormalScale": { type: "v2", value: new THREE.Vector2( 1, 1 ) },
  27. "uDisplacementBias": { type: "f", value: 0.0 },
  28. "uDisplacementScale": { type: "f", value: 1.0 },
  29. "diffuse": { type: "c", value: new THREE.Color( 0xffffff ) },
  30. "specular": { type: "c", value: new THREE.Color( 0x111111 ) },
  31. "ambient": { type: "c", value: new THREE.Color( 0xffffff ) },
  32. "shininess": { type: "f", value: 30 },
  33. "opacity": { type: "f", value: 1 },
  34. "refractionRatio": { type: "f", value: 0.98 },
  35. "reflectivity": { type: "f", value: 0.5 },
  36. "uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) },
  37. "uRepeat" : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
  38. "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
  39. }
  40. ] ),
  41. fragmentShader: [
  42. "uniform vec3 ambient;",
  43. "uniform vec3 diffuse;",
  44. "uniform vec3 specular;",
  45. "uniform float shininess;",
  46. "uniform float opacity;",
  47. "uniform bool enableDiffuse;",
  48. "uniform bool enableSpecular;",
  49. "uniform bool enableAO;",
  50. "uniform bool enableReflection;",
  51. "uniform sampler2D tDiffuse;",
  52. "uniform sampler2D tNormal;",
  53. "uniform sampler2D tSpecular;",
  54. "uniform sampler2D tAO;",
  55. "uniform samplerCube tCube;",
  56. "uniform vec2 uNormalScale;",
  57. "uniform float refractionRatio;",
  58. "uniform float reflectivity;",
  59. "varying vec3 vTangent;",
  60. "varying vec3 vBinormal;",
  61. "varying vec3 vNormal;",
  62. "varying vec2 vUv;",
  63. "uniform vec3 ambientLightColor;",
  64. "#if MAX_DIR_LIGHTS > 0",
  65. " uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];",
  66. " uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];",
  67. "#endif",
  68. "#if MAX_HEMI_LIGHTS > 0",
  69. " uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];",
  70. " uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];",
  71. " uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];",
  72. "#endif",
  73. "#if MAX_POINT_LIGHTS > 0",
  74. " uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];",
  75. " uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];",
  76. " uniform float pointLightDistance[ MAX_POINT_LIGHTS ];",
  77. "#endif",
  78. "#if MAX_SPOT_LIGHTS > 0",
  79. " uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];",
  80. " uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];",
  81. " uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];",
  82. " uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];",
  83. " uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];",
  84. " uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];",
  85. "#endif",
  86. "#ifdef WRAP_AROUND",
  87. " uniform vec3 wrapRGB;",
  88. "#endif",
  89. "varying vec3 vWorldPosition;",
  90. "varying vec3 vViewPosition;",
  91. THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
  92. THREE.ShaderChunk[ "fog_pars_fragment" ],
  93. THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ],
  94. "void main() {",
  95. THREE.ShaderChunk[ "logdepthbuf_fragment" ],
  96. " gl_FragColor = vec4( vec3( 1.0 ), opacity );",
  97. " vec3 specularTex = vec3( 1.0 );",
  98. " vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;",
  99. " normalTex.xy *= uNormalScale;",
  100. " normalTex = normalize( normalTex );",
  101. " if( enableDiffuse ) {",
  102. " #ifdef GAMMA_INPUT",
  103. " vec4 texelColor = texture2D( tDiffuse, vUv );",
  104. " texelColor.xyz *= texelColor.xyz;",
  105. " gl_FragColor = gl_FragColor * texelColor;",
  106. " #else",
  107. " gl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );",
  108. " #endif",
  109. " }",
  110. " if( enableAO ) {",
  111. " #ifdef GAMMA_INPUT",
  112. " vec4 aoColor = texture2D( tAO, vUv );",
  113. " aoColor.xyz *= aoColor.xyz;",
  114. " gl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;",
  115. " #else",
  116. " gl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;",
  117. " #endif",
  118. " }",
  119. THREE.ShaderChunk[ "alphatest_fragment" ],
  120. " if( enableSpecular )",
  121. " specularTex = texture2D( tSpecular, vUv ).xyz;",
  122. " mat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );",
  123. " vec3 finalNormal = tsb * normalTex;",
  124. " #ifdef FLIP_SIDED",
  125. " finalNormal = -finalNormal;",
  126. " #endif",
  127. " vec3 normal = normalize( finalNormal );",
  128. " vec3 viewPosition = normalize( vViewPosition );",
  129. // point lights
  130. " #if MAX_POINT_LIGHTS > 0",
  131. " vec3 pointDiffuse = vec3( 0.0 );",
  132. " vec3 pointSpecular = vec3( 0.0 );",
  133. " for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
  134. " vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
  135. " vec3 pointVector = lPosition.xyz + vViewPosition.xyz;",
  136. " float pointDistance = 1.0;",
  137. " if ( pointLightDistance[ i ] > 0.0 )",
  138. " pointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );",
  139. " pointVector = normalize( pointVector );",
  140. // diffuse
  141. " #ifdef WRAP_AROUND",
  142. " float pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );",
  143. " float pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );",
  144. " vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );",
  145. " #else",
  146. " float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );",
  147. " #endif",
  148. " pointDiffuse += pointDistance * pointLightColor[ i ] * diffuse * pointDiffuseWeight;",
  149. // specular
  150. " vec3 pointHalfVector = normalize( pointVector + viewPosition );",
  151. " float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
  152. " float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
  153. " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
  154. " vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( pointVector, pointHalfVector ), 0.0 ), 5.0 );",
  155. " pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;",
  156. " }",
  157. " #endif",
  158. // spot lights
  159. " #if MAX_SPOT_LIGHTS > 0",
  160. " vec3 spotDiffuse = vec3( 0.0 );",
  161. " vec3 spotSpecular = vec3( 0.0 );",
  162. " for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {",
  163. " vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );",
  164. " vec3 spotVector = lPosition.xyz + vViewPosition.xyz;",
  165. " float spotDistance = 1.0;",
  166. " if ( spotLightDistance[ i ] > 0.0 )",
  167. " spotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );",
  168. " spotVector = normalize( spotVector );",
  169. " float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );",
  170. " if ( spotEffect > spotLightAngleCos[ i ] ) {",
  171. " spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );",
  172. // diffuse
  173. " #ifdef WRAP_AROUND",
  174. " float spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );",
  175. " float spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );",
  176. " vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );",
  177. " #else",
  178. " float spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );",
  179. " #endif",
  180. " spotDiffuse += spotDistance * spotLightColor[ i ] * diffuse * spotDiffuseWeight * spotEffect;",
  181. // specular
  182. " vec3 spotHalfVector = normalize( spotVector + viewPosition );",
  183. " float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );",
  184. " float spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );",
  185. " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
  186. " vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( spotVector, spotHalfVector ), 0.0 ), 5.0 );",
  187. " spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;",
  188. " }",
  189. " }",
  190. " #endif",
  191. // directional lights
  192. " #if MAX_DIR_LIGHTS > 0",
  193. " vec3 dirDiffuse = vec3( 0.0 );",
  194. " vec3 dirSpecular = vec3( 0.0 );",
  195. " for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {",
  196. " vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );",
  197. " vec3 dirVector = normalize( lDirection.xyz );",
  198. // diffuse
  199. " #ifdef WRAP_AROUND",
  200. " float directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );",
  201. " float directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );",
  202. " vec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );",
  203. " #else",
  204. " float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
  205. " #endif",
  206. " dirDiffuse += directionalLightColor[ i ] * diffuse * dirDiffuseWeight;",
  207. // specular
  208. " vec3 dirHalfVector = normalize( dirVector + viewPosition );",
  209. " float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
  210. " float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
  211. " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
  212. " vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );",
  213. " dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
  214. " }",
  215. " #endif",
  216. // hemisphere lights
  217. " #if MAX_HEMI_LIGHTS > 0",
  218. " vec3 hemiDiffuse = vec3( 0.0 );",
  219. " vec3 hemiSpecular = vec3( 0.0 );" ,
  220. " for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
  221. " vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );",
  222. " vec3 lVector = normalize( lDirection.xyz );",
  223. // diffuse
  224. " float dotProduct = dot( normal, lVector );",
  225. " float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
  226. " vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );",
  227. " hemiDiffuse += diffuse * hemiColor;",
  228. // specular (sky light)
  229. " vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
  230. " float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
  231. " float hemiSpecularWeightSky = specularTex.r * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );",
  232. // specular (ground light)
  233. " vec3 lVectorGround = -lVector;",
  234. " vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );",
  235. " float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;",
  236. " float hemiSpecularWeightGround = specularTex.r * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );",
  237. " float dotProductGround = dot( normal, lVectorGround );",
  238. " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
  239. " vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );",
  240. " vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );",
  241. " hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );",
  242. " }",
  243. " #endif",
  244. // all lights contribution summation
  245. " vec3 totalDiffuse = vec3( 0.0 );",
  246. " vec3 totalSpecular = vec3( 0.0 );",
  247. " #if MAX_DIR_LIGHTS > 0",
  248. " totalDiffuse += dirDiffuse;",
  249. " totalSpecular += dirSpecular;",
  250. " #endif",
  251. " #if MAX_HEMI_LIGHTS > 0",
  252. " totalDiffuse += hemiDiffuse;",
  253. " totalSpecular += hemiSpecular;",
  254. " #endif",
  255. " #if MAX_POINT_LIGHTS > 0",
  256. " totalDiffuse += pointDiffuse;",
  257. " totalSpecular += pointSpecular;",
  258. " #endif",
  259. " #if MAX_SPOT_LIGHTS > 0",
  260. " totalDiffuse += spotDiffuse;",
  261. " totalSpecular += spotSpecular;",
  262. " #endif",
  263. " #ifdef METAL",
  264. " gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );",
  265. " #else",
  266. " gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
  267. " #endif",
  268. " if ( enableReflection ) {",
  269. " vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );",
  270. " #ifdef ENVMAP_MODE_REFLECTION",
  271. " vec3 vReflect = reflect( cameraToVertex, normal );",
  272. " #else",
  273. " vec3 vReflect = refract( cameraToVertex, normal, refractionRatio );",
  274. " #endif",
  275. " vec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
  276. " #ifdef GAMMA_INPUT",
  277. " cubeColor.xyz *= cubeColor.xyz;",
  278. " #endif",
  279. " gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * reflectivity );",
  280. " }",
  281. THREE.ShaderChunk[ "shadowmap_fragment" ],
  282. THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
  283. THREE.ShaderChunk[ "fog_fragment" ],
  284. "}"
  285. ].join("\n"),
  286. vertexShader: [
  287. "attribute vec4 tangent;",
  288. "uniform vec2 uOffset;",
  289. "uniform vec2 uRepeat;",
  290. "uniform bool enableDisplacement;",
  291. "#ifdef VERTEX_TEXTURES",
  292. " uniform sampler2D tDisplacement;",
  293. " uniform float uDisplacementScale;",
  294. " uniform float uDisplacementBias;",
  295. "#endif",
  296. "varying vec3 vTangent;",
  297. "varying vec3 vBinormal;",
  298. "varying vec3 vNormal;",
  299. "varying vec2 vUv;",
  300. "varying vec3 vWorldPosition;",
  301. "varying vec3 vViewPosition;",
  302. THREE.ShaderChunk[ "skinning_pars_vertex" ],
  303. THREE.ShaderChunk[ "shadowmap_pars_vertex" ],
  304. THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ],
  305. "void main() {",
  306. THREE.ShaderChunk[ "skinbase_vertex" ],
  307. THREE.ShaderChunk[ "skinnormal_vertex" ],
  308. // normal, tangent and binormal vectors
  309. " #ifdef USE_SKINNING",
  310. " vNormal = normalize( normalMatrix * skinnedNormal.xyz );",
  311. " vec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );",
  312. " vTangent = normalize( normalMatrix * skinnedTangent.xyz );",
  313. " #else",
  314. " vNormal = normalize( normalMatrix * normal );",
  315. " vTangent = normalize( normalMatrix * tangent.xyz );",
  316. " #endif",
  317. " vBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );",
  318. " vUv = uv * uRepeat + uOffset;",
  319. // displacement mapping
  320. " vec3 displacedPosition;",
  321. " #ifdef VERTEX_TEXTURES",
  322. " if ( enableDisplacement ) {",
  323. " vec3 dv = texture2D( tDisplacement, uv ).xyz;",
  324. " float df = uDisplacementScale * dv.x + uDisplacementBias;",
  325. " displacedPosition = position + normalize( normal ) * df;",
  326. " } else {",
  327. " #ifdef USE_SKINNING",
  328. " vec4 skinVertex = bindMatrix * vec4( position, 1.0 );",
  329. " vec4 skinned = vec4( 0.0 );",
  330. " skinned += boneMatX * skinVertex * skinWeight.x;",
  331. " skinned += boneMatY * skinVertex * skinWeight.y;",
  332. " skinned += boneMatZ * skinVertex * skinWeight.z;",
  333. " skinned += boneMatW * skinVertex * skinWeight.w;",
  334. " skinned = bindMatrixInverse * skinned;",
  335. " displacedPosition = skinned.xyz;",
  336. " #else",
  337. " displacedPosition = position;",
  338. " #endif",
  339. " }",
  340. " #else",
  341. " #ifdef USE_SKINNING",
  342. " vec4 skinVertex = bindMatrix * vec4( position, 1.0 );",
  343. " vec4 skinned = vec4( 0.0 );",
  344. " skinned += boneMatX * skinVertex * skinWeight.x;",
  345. " skinned += boneMatY * skinVertex * skinWeight.y;",
  346. " skinned += boneMatZ * skinVertex * skinWeight.z;",
  347. " skinned += boneMatW * skinVertex * skinWeight.w;",
  348. " skinned = bindMatrixInverse * skinned;",
  349. " displacedPosition = skinned.xyz;",
  350. " #else",
  351. " displacedPosition = position;",
  352. " #endif",
  353. " #endif",
  354. //
  355. " vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );",
  356. " vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );",
  357. " gl_Position = projectionMatrix * mvPosition;",
  358. THREE.ShaderChunk[ "logdepthbuf_vertex" ],
  359. //
  360. " vWorldPosition = worldPosition.xyz;",
  361. " vViewPosition = -mvPosition.xyz;",
  362. // shadows
  363. " #ifdef USE_SHADOWMAP",
  364. " for( int i = 0; i < MAX_SHADOWS; i ++ ) {",
  365. " vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;",
  366. " }",
  367. " #endif",
  368. "}"
  369. ].join("\n")
  370. };