Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/nodes/utils/RTTNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,19 @@ class RTTNode extends TextureNode {
* @param {Node} node - The node to render a texture with.
* @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized.
* @param {?number} [height=null] - The height of the internal render target.
* @param {Object} [options={type:HalfFloatType}] - The options for the internal render target.
* @param {Object} [options={}] - The options for the internal render target.
* @param {number} [options.type=HalfFloatType] - The texture type.
* @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not.
* @param {number} [options.resolutionScale=1] - The resolution scale.
*/
constructor( node, width = null, height = null, options = { type: HalfFloatType } ) {
constructor( node, width = null, height = null, options = {} ) {

const renderTarget = new RenderTarget( width, height, options );
const {
autoUpdate = true,
resolutionScale = 1
} = options;

const renderTarget = new RenderTarget( width, height, { type: HalfFloatType, ...options } );

super( renderTarget.texture, uv() );

Expand Down Expand Up @@ -96,7 +104,7 @@ class RTTNode extends TextureNode {
* @type {boolean}
* @default true
*/
this.autoUpdate = true;
this.autoUpdate = autoUpdate;

/**
* The resolution scale
Expand All @@ -105,7 +113,7 @@ class RTTNode extends TextureNode {
* @type {number}
* @default 1
*/
this._resolutionScale = 1;
this._resolutionScale = resolutionScale;

/**
* The internal quad mesh for RTT.
Expand Down Expand Up @@ -270,7 +278,10 @@ export default RTTNode;
* @param {Node} node - The node to render a texture with.
* @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized.
* @param {?number} [height=null] - The height of the internal render target.
* @param {Object} [options={type:HalfFloatType}] - The options for the internal render target.
* @param {Object} [options={}] - The options for the internal render target.
* @param {number} [options.type=HalfFloatType] - The texture type.
* @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not.
* @param {number} [options.resolutionScale=1] - The resolution scale.
* @returns {RTTNode}
*/
export const rtt = ( node, ...params ) => new RTTNode( nodeObject( node ), ...params );
Expand All @@ -283,7 +294,10 @@ export const rtt = ( node, ...params ) => new RTTNode( nodeObject( node ), ...pa
* @param {Node} node - The node to render a texture with.
* @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized.
* @param {?number} [height=null] - The height of the internal render target.
* @param {Object} [options={type:HalfFloatType}] - The options for the internal render target.
* @param {Object} [options={}] - The options for the internal render target.
* @param {number} [options.type=HalfFloatType] - The texture type.
* @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not.
* @param {number} [options.resolutionScale=1] - The resolution scale.
* @returns {RTTNode}
*/
export const convertToTexture = ( node, ...params ) => {
Expand Down