Class: PerspectivePlaneGeometry

PerspectivePlaneGeometry

A PerspectivePlaneGeometry allows you to draw a 2d plane with perspective. Where ever you move the corners the texture will be projected to look like it is in 3d space. Great for mapping a 2D mesh into a 3D scene.

IMPORTANT: This is not a full 3D mesh, it is a 2D mesh with a perspective projection applied to it :)

const perspectivePlaneGeometry = new PerspectivePlaneGeometry({
 width: 100,
 height: 100,
 verticesX: 10,
 verticesY: 10,
});

new PerspectivePlaneGeometry (options) overrides

Name Type Description
options PerspectivePlaneGeometryOptions

Options to be applied to MeshPlane

options.width

The width of the plane

options.height

The height of the plane

options.verticesX

The amount of vertices on the x axis

options.verticesY

The amount of vertices on the y axis

See:

Extends

Members

corners [number, number, number, number, number, number, number, number]

The corner points of the quad you can modify these directly, if you do make sure to call updateProjection

Methods

setCorners (x0, y0, x1, y1, x2, y2, x3, y3)

Will set the corners of the quad to the given coordinates Calculating the perspective so it looks correct!

Name Type Description
x0 number

x coordinate of the first corner

y0 number

y coordinate of the first corner

x1 number

x coordinate of the second corner

y1 number

y coordinate of the second corner

x2 number

x coordinate of the third corner

y2 number

y coordinate of the third corner

x3 number

x coordinate of the fourth corner

y3 number

y coordinate of the fourth corner

updateProjection ()

Update the projection matrix based on the corners

Inherited Properties

From class PlaneGeometry

height number inherited

The height of plane

verticesX number inherited

The number of vertices on x-axis

verticesY number inherited

The number of vertices on y-axis

width number inherited

The width of plane

From class MeshGeometry

indices Uint32Array inherited

The indices of the mesh.

positions Float32Array inherited

The positions of the mesh.

uvs Float32Array inherited

The UVs of the mesh.

From class Geometry

attributes Record<string, Attribute> readonly inherited

A record of the attributes of the geometry.

bounds Bounds inherited

Returns the bounds of the geometry.

buffers Buffer[] readonly inherited

The buffers that the attributes use

indexBuffer Buffer inherited

The index buffer of the geometry

instanceCount number inherited

the instance count of the geometry to draw

Default Value:
  • 1

topology Topology inherited

The topology of the geometry.

uid number readonly inherited

The unique id of the geometry.

Inherited Methods

From class PlaneGeometry

build (options) void inherited

Refreshes plane coordinates

Name Type Description
options PlaneGeometryOptions

Options to be applied to plane geometry

From class Geometry

addAttribute (name, attributeOption) void inherited

Adds an attribute to the geometry.

Name Type Description
name string

The name of the attribute to add.

attributeOption AttributeOption

The attribute option to add.

addIndex (indexBuffer) void inherited

Adds an index buffer to the geometry.

Name Type Description
indexBuffer Buffer | TypedArray | number[]

The index buffer to add. Can be a Buffer, TypedArray, or an array of numbers.

destroy (destroyBuffers) void inherited

destroys the geometry.

Name Type Default Description
destroyBuffers boolean false

destroy the buffers associated with this geometry

getAttribute (id) Attribute inherited

Returns the requested attribute.

Name Type Description
id string

The name of the attribute required

Returns:
Type Description
Attribute
  • The attribute requested.

getBuffer (id) Buffer inherited

Returns the requested buffer.

Name Type Description
id string

The name of the buffer required.

Returns:
Type Description
Buffer
  • The buffer requested.

getIndex () Buffer inherited

Returns the index buffer

Returns:
Type Description
Buffer
  • The index buffer.

getSize () number inherited

Used to figure out how many vertices there are in this geometry

Returns:
Type Description
number the number of vertices in the geometry