Class: PanelMesh
Defined in: src/ui/core/PanelMesh.ts:14
A specialized THREE.Mesh
designed for rendering UI panel
backgrounds. It utilizes a custom shader to draw rounded rectangles
(squircles) and provides methods to dynamically update its appearance,
such as aspect ratio and size. This class is a core building block for
Panel
components.
Extends
Constructors
Constructor
new PanelMesh(
shader
,backgroundColor?
,panelScale?
):PanelMesh
Defined in: src/ui/core/PanelMesh.ts:33
Creates an instance of PanelMesh.
Parameters
shader
Shader for the panel mesh.
backgroundColor?
string
The background color as a CSS string.
panelScale?
number
= 1.0
The initial scale of the plane
Returns
PanelMesh
Overrides
THREE.Mesh<THREE.PlaneGeometry, THREE.ShaderMaterial>.constructor
Properties
name
name:
string
='PanelMesh'
Defined in: src/ui/core/PanelMesh.ts:17
Text description of the PanelMesh
Overrides
THREE.Mesh.name
Accessors
uniforms
Get Signature
get uniforms():
object
Defined in: src/ui/core/PanelMesh.ts:23
Provides convenient access to the material's shader uniforms.
Returns
object
The uniforms object of the shader material.
Methods
setAspectRatio()
setAspectRatio(
aspectRatio
):void
Defined in: src/ui/core/PanelMesh.ts:71
Adjusts the mesh's scale to match a given aspect ratio, preventing the panel from appearing stretched.
Parameters
aspectRatio
number
The desired width-to-height ratio.
Returns
void
setWidthHeight()
setWidthHeight(
width
,height
):void
Defined in: src/ui/core/PanelMesh.ts:62
Sets the panel's absolute dimensions (width and height) in the shader. This is used by the shader to correctly calculate properties like rounded corner radii.
Parameters
width
number
The width of the panel.
height
number
The height of the panel.
Returns
void