瀏覽代碼

TSL: Add `.load()` function to `texture()` (#31510)

sunag 5 月之前
父節點
當前提交
297579cde5
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      src/nodes/accessors/TextureNode.js

+ 12 - 0
src/nodes/accessors/TextureNode.js

@@ -554,6 +554,18 @@ class TextureNode extends UniformNode {
 
 	}
 
+	/**
+	 * TSL function for creating a texture node that fetches/loads texels without interpolation.
+	 *
+	 * @param {Node<uvec2>} uvNode - The uv node.
+	 * @returns {TextureNode} A texture node representing the texture load.
+	 */
+	load( uvNode ) {
+
+		return this.sample( uvNode ).setSampler( false );
+
+	}
+
 	/**
 	 * Samples a blurred version of the texture by defining an internal bias.
 	 *

粤ICP备19079148号