File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -52,9 +52,23 @@ Shader.prototype = {
5252 init : function ( data ) {
5353 this . attributes = this . initVariables ( data , 'attribute' ) ;
5454 this . uniforms = this . initVariables ( data , 'uniform' ) ;
55+
56+ // THREE r154 require '#version' as standalone value in glslVersion
57+ var version = undefined ;
58+ for ( var name of [ 'vertexShader' , 'fragmentShader' ] ) {
59+ var Lines = this [ name ] . split ( "\n" ) ;
60+ var pos = Lines [ 0 ] . indexOf ( '#version' ) ;
61+
62+ if ( pos >= 0 ) {
63+ version = Lines . shift ( ) . substr ( pos + 9 ) ;
64+ this [ name ] = Lines . join ( "\n" ) ;
65+ }
66+ }
67+
5568 this . material = new ( this . raw ? THREE . RawShaderMaterial : THREE . ShaderMaterial ) ( {
5669 // attributes: this.attributes,
5770 uniforms : this . uniforms ,
71+ glslVersion : version ,
5872 vertexShader : this . vertexShader ,
5973 fragmentShader : this . fragmentShader
6074 } ) ;
You can’t perform that action at this time.
0 commit comments