瀏覽代碼

Nodes: fix atan2 (#24464)

Peter Hanula 3 年之前
父節點
當前提交
38273fb9b2
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js

+ 11 - 0
examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js

@@ -6,6 +6,7 @@ import WebGLPhysicalContextNode from './WebGLPhysicalContextNode.js';
 
 
 import { PerspectiveCamera, ShaderChunk, ShaderLib, UniformsUtils, UniformsLib,
 import { PerspectiveCamera, ShaderChunk, ShaderLib, UniformsUtils, UniformsLib,
 	LinearEncoding, RGBAFormat, UnsignedByteType, sRGBEncoding } from 'three';
 	LinearEncoding, RGBAFormat, UnsignedByteType, sRGBEncoding } from 'three';
+import MathNode from '../../../nodes/math/MathNode.js';
 
 
 const nodeFrame = new NodeFrame();
 const nodeFrame = new NodeFrame();
 nodeFrame.camera = new PerspectiveCamera();
 nodeFrame.camera = new PerspectiveCamera();
@@ -18,6 +19,10 @@ const nodeShaderLib = {
 	MeshPhysicalMaterial: ShaderLib.physical
 	MeshPhysicalMaterial: ShaderLib.physical
 };
 };
 
 
+const glslMethods = {
+	[ MathNode.ATAN2 ]: 'atan'
+};
+
 function getIncludeSnippet( name ) {
 function getIncludeSnippet( name ) {
 
 
 	return `#include <${name}>`;
 	return `#include <${name}>`;
@@ -43,6 +48,12 @@ class WebGLNodeBuilder extends NodeBuilder {
 
 
 	}
 	}
 
 
+	getMethod( method ) {
+
+		return glslMethods[ method ] || method;
+
+	}
+
 	addSlot( shaderStage, slotNode ) {
 	addSlot( shaderStage, slotNode ) {
 
 
 		this.slots[ shaderStage ].push( slotNode );
 		this.slots[ shaderStage ].push( slotNode );