PointLightShadow class

This is used internally by PointLights for calculating shadows.

//Create a WebGLRenderer and turn on shadows in the renderer
final renderer = WebGLRenderer();
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = PCFSoftShadowMap; // default PCFShadowMap

//Create a PointLight and turn on shadows for the light
final light = PointLight( 0xffffff, 1, 100 );
light.position.setValues( 0, 10, 4 );
light.castShadow = true; // default false
scene.add( light );

//Set up shadow properties for the light
light.shadow.mapSize.width = 512; // default
light.shadow.mapSize.height = 512; // default
light.shadow.camera.near = 0.5; // default
light.shadow.camera.far = 500; // default

//Create a sphere that cast shadows (but does not receive them)
final sphereGeometry = SphereGeometry( 5, 32, 32 );
final sphereMaterial = MeshStandardMaterial( { MaterialProperty.color: 0xff0000 } );
final sphere = Mesh( sphereGeometry, sphereMaterial );
sphere.castShadow = true; //default is false
sphere.receiveShadow = false; //default
scene.add( sphere );

//Create a plane that receives shadows (but does not cast them)
final planeGeometry = PlaneGeometry( 20, 20, 32, 32 );
final planeMaterial = MeshStandardMaterial( { MaterialProperty.color: 0x00ff00 } );
final plane = Mesh( planeGeometry, planeMaterial );
plane.receiveShadow = true;
scene.add( plane );

//Create a helper for the shadow camera (optional)
final helper = CameraHelper( light.shadow.camera );
scene.add( helper );
Inheritance

Constructors

PointLightShadow()
Creates a new name. This is not intended to be called directly - it is called internally by PointLight.
PointLightShadow.fromJson(Map<String, dynamic> json, Map<String, dynamic> rootJson)

Properties

autoUpdate ↔ bool
getter/setter pairinherited
bias ↔ double
getter/setter pairinherited
blurSamples ↔ double
getter/setter pairinherited
camera ↔ Camera?
getter/setter pairinherited
focus ↔ double
getter/setter pairinherited
frameExtents → Vector2
finalinherited
frustum → Frustum
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
intensity ↔ double
getter/setter pairinherited
lightPositionWorld → Vector3
finalinherited
lookTarget → Vector3
finalinherited
map ↔ RenderTarget?
getter/setter pairinherited
mapPass ↔ RenderTarget?
getter/setter pairinherited
mapSize ↔ Vector2
getter/setter pairinherited
matrix ↔ Matrix4
getter/setter pairinherited
needsUpdate ↔ bool
getter/setter pairinherited
normalBias ↔ double
getter/setter pairinherited
projScreenMatrix → Matrix4
finalinherited
radius ↔ double
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
viewportCount ↔ int
getter/setter pairinherited
viewports → List<Vector4>
finalinherited

Methods

clone() → LightShadow
Creates a new LightShadow with the same properties as this one.
inherited
copy(LightShadow source) → LightShadow
Copies value of all the properties from the source to this Light.
inherited
dispose() → void
Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
inherited
getFrameExtents() → Vector2
Used internally by the renderer to extend the shadow map to contain all viewports
inherited
getFrustum() → Frustum
Gets the shadow cameras frustum. Used internally by the renderer to cull objects.
inherited
getProperty(String propertyName) → dynamic
inherited
getViewport(int viewportIndex) → Vector4
inherited
getViewportCount() → int
Used internally by the renderer to get the number of viewports that need to be rendered for this shadow.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setProperty(String propertyName, dynamic newValue) → LightShadow
inherited
toJson() → Map<String, dynamic>
Serialize this LightShadow.
inherited
toString() → String
A string representation of this object.
inherited
updateMatrices(Light light, {int viewportIndex = 0}) → void
Update the matrices for the camera and shadow, used internally by the renderer.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited
operator [](dynamic key) → dynamic
inherited
operator []=(String key, dynamic value) → void
inherited