You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import ViewportTextureNode from './ViewportTextureNode.js';
|
|
import { addNodeClass } from '../core/Node.js';
|
|
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
import { viewportTopLeft } from './ViewportNode.js';
|
|
import { DepthTexture, LinearMipmapLinearFilter, DepthFormat, UnsignedIntType } from 'three';
|
|
|
|
let sharedDepthbuffer = null;
|
|
|
|
class ViewportDepthTextureNode extends ViewportTextureNode {
|
|
|
|
constructor( uvNode = viewportTopLeft, levelNode = null ) {
|
|
|
|
if ( sharedDepthbuffer === null ) {
|
|
|
|
sharedDepthbuffer = new DepthTexture();
|
|
sharedDepthbuffer.minFilter = LinearMipmapLinearFilter;
|
|
sharedDepthbuffer.type = UnsignedIntType;
|
|
sharedDepthbuffer.format = DepthFormat;
|
|
|
|
}
|
|
|
|
super( uvNode, levelNode, sharedDepthbuffer );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default ViewportDepthTextureNode;
|
|
|
|
export const viewportDepthTexture = nodeProxy( ViewportDepthTextureNode );
|
|
|
|
addNodeElement( 'viewportDepthTexture', viewportDepthTexture );
|
|
|
|
addNodeClass( 'ViewportDepthTextureNode', ViewportDepthTextureNode );
|