Capítulo 590 de 859

Chapter 590: Refractor

Core Idea

Can be used to create a flat, refractive surface like for special windows or water effects.

Note that this class can only be used with WebGLRenderer. When using WebGPURenderer, use viewportSharedTexture.

Key Concepts

  • camera : PerspectiveCamera: The reflector's virtual camera.
  • isRefractor : boolean (readonly): This flag can be used for type testing.

Code Examples

const geometry = new THREE.PlaneGeometry( 100, 100 );
const refractor = new Refractor( refractorGeometry, {
	color: 0xcbcbcb,
	textureWidth: 1024,
	textureHeight: 1024
} );
scene.add( refractor );
  • What it demonstrates: Typical usage of Refractor.

Reference Tables

Constructor

Signature
new Refractor( geometry : BufferGeometry, options : Refractor~Options )

Properties

PropertyDescription
.camera : PerspectiveCameraThe reflector's virtual camera.
.isRefractor : boolean (readonly)This flag can be used for type testing.

Methods

MethodDescription
.dispose()Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
.getRenderTarget() : WebGLRenderTargetReturns the reflector's internal render target.

Key Takeaways

  1. Refractor extends: EventDispatcher → Object3D → Mesh
  2. Most relevant properties: camera, isRefractor.
  3. Key methods: dispose, getRenderTarget.

Connects To