浏览代码

new NoiseNode

SUNAG 9 年之前
父节点
当前提交
4df9f3aa2c
共有 1 个文件被更改,包括 22 次插入0 次删除
  1. 22 0
      examples/js/nodes/utils/NoiseNode.js

+ 22 - 0
examples/js/nodes/utils/NoiseNode.js

@@ -0,0 +1,22 @@
+/**
+ * @author sunag / http://www.sunag.com.br/
+ */
+
+THREE.NoiseNode = function( coord ) {
+
+	THREE.TempNode.call( this, 'fv1' );
+
+	this.coord = coord;
+
+};
+
+THREE.NoiseNode.prototype = Object.create( THREE.TempNode.prototype );
+THREE.NoiseNode.prototype.constructor = THREE.NoiseNode;
+
+THREE.NoiseNode.prototype.generate = function( builder, output ) {
+
+	builder.include( 'snoise' );
+
+	return builder.format( 'snoise(' + this.coord.build( builder, 'v2' ) + ')', this.getType( builder ), output );
+
+};