Skip to content

Conversation

@greggman
Copy link
Contributor

@greggman greggman commented Jan 3, 2019

@mrdoob
Copy link
Owner

mrdoob commented Jan 7, 2019

I was not aware you were talking about the examples folder. With this change a bunch of examples will stop working in oldish browsers.

@mrdoob mrdoob added this to the r101 milestone Jan 7, 2019
import { NodeLib } from './NodeLib.js';

var declarationRegexp = /^([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,
var declarationRegexp = /^(?:(?:\s*\/\/.*?\n)*)\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind explaining this regexp change? Is it to handle tabs and comments?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind explaining this regexp change? Is it to handle tabs and comments?

This ignores line comments before function declaration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this,

new FunctionNode( /* glsl */`
	// https://stackoverflow.com/questions/36174431/how-to-make-a-wave-warp-effect-in-shader
	vec2 sineWave(vec2 uv, vec2 phase) {
		// wave distortion
		float x = sin( 25.0*uv.y + 30.0*uv.x + 6.28*phase.x) * 0.01;
		float y = sin( 25.0*uv.y + 30.0*uv.x + 6.28*phase.y) * 0.03;
		return vec2(uv.x+x, uv.y+y);
	}
`);

would be broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants