Skip to content

Kuesa::Qt3D::ShadowCastingLight

Module: Kuesa Qt 3D API

Encapsulate a light object that is able to cast shadows in a Qt 3D scene. More...

#include <Kuesa/Qt3D/api/lights/shadowcastinglight.h>

Inherits from Qt3DRender::QAbstractLight

Inherited by Kuesa::Qt3D::DirectionalLight, Kuesa::Qt3D::PointLight, Kuesa::Qt3D::SpotLight

Public Slots

Name
void setCastsShadows(bool castsShadows)
void setLightViewProjectionMatrix(const QMatrix4x4 & matrix)
void setTextureSize(const QSize & textureSize)
void setShadowMapBias(float bias)
void setNearPlane(float nearPlane)
void setSoftShadows(bool softShadows)
void setLightIndex(int index)
void setNearFarPlanes(float near, float far)

Public Signals

Name
void castsShadowsChanged(bool castsShadows)
void textureSizeChanged(const QSize & textureSize)
void depthTextureChanged(Qt3DRender::QAbstractTexture * depthTexture)
void biasChanged(float bias)
void nearPlaneChanged(float nearPlane)
void softShadowsChanged(bool softShadows)

Public Functions

Name
~ShadowCastingLight()
bool castsShadows() const
QSize textureSize() const
float shadowMapBias() const
float nearPlane() const
bool softShadows() const

Protected Functions

Name
ShadowCastingLight(ShadowCastingLightPrivate & dd, Qt3DCore::QNode * parent =nullptr)

Public Properties

Name
bool castsShadows
Encapsulate a light object that is able to cast shadows in a Qt 3D scene.
bool softShadows
QSize textureSize
float shadowMapBias
float nearPlane

Detailed Description

1
class Kuesa::Qt3D::ShadowCastingLight;

Encapsulate a light object that is able to cast shadows in a Qt 3D scene.

Since: Kuesa 2.0

Shadow are currently only supported with Qt3D running with the OpenGL backend which supports geometry shaders when running on devices supporting OpenGL 3.2 or OpenGL ES 3.2. When Qt3D is using the Qt RHI (rendering abstraction interface) backend. shadows are not supported due to the lack of geometry shader support in RHI.

Public Slots Documentation

slot setCastsShadows

1
2
3
void setCastsShadows(
    bool castsShadows
)

slot setLightViewProjectionMatrix

1
2
3
void setLightViewProjectionMatrix(
    const QMatrix4x4 & matrix
)

slot setTextureSize

1
2
3
void setTextureSize(
    const QSize & textureSize
)

slot setShadowMapBias

1
2
3
void setShadowMapBias(
    float bias
)

slot setNearPlane

1
2
3
void setNearPlane(
    float nearPlane
)

slot setSoftShadows

1
2
3
void setSoftShadows(
    bool softShadows
)

slot setLightIndex

1
2
3
void setLightIndex(
    int index
)

slot setNearFarPlanes

1
2
3
4
void setNearFarPlanes(
    float near,
    float far
)

Public Signals Documentation

signal castsShadowsChanged

1
2
3
void castsShadowsChanged(
    bool castsShadows
)

signal textureSizeChanged

1
2
3
void textureSizeChanged(
    const QSize & textureSize
)

signal depthTextureChanged

1
2
3
void depthTextureChanged(
    Qt3DRender::QAbstractTexture * depthTexture
)

signal biasChanged

1
2
3
void biasChanged(
    float bias
)

signal nearPlaneChanged

1
2
3
void nearPlaneChanged(
    float nearPlane
)

signal softShadowsChanged

1
2
3
void softShadowsChanged(
    bool softShadows
)

Public Functions Documentation

function ~ShadowCastingLight

1
~ShadowCastingLight()

function castsShadows

1
bool castsShadows() const

function textureSize

1
QSize textureSize() const

function shadowMapBias

1
float shadowMapBias() const

function nearPlane

1
float nearPlane() const

function softShadows

1
bool softShadows() const

Protected Functions Documentation

function ShadowCastingLight

1
2
3
4
explicit ShadowCastingLight(
    ShadowCastingLightPrivate & dd,
    Qt3DCore::QNode * parent =nullptr
)

Public Property Documentation

property castsShadows

1
bool castsShadows;

Encapsulate a light object that is able to cast shadows in a Qt 3D scene.

Since: Kuesa 2.0

Shadow are currently only supported with Qt3D running with the OpenGL backend which supports geometry shaders when running on devices supporting OpenGL 3.2 or OpenGL ES 3.2. When Qt3D is using the Qt RHI (rendering abstraction interface) backend. shadows are not supported due to the lack of geometry shader support in RHI.

Specifies whether or not the light casts shadows.

property softShadows

1
bool softShadows;

Determines whether shadow edges are soft or hard. Soft shadows look more realistic but can impact rendering performance

property textureSize

1
QSize textureSize;

Specifies the size of the texture to use for the shadowmap. Larger textures result in higher quality shadows

property shadowMapBias

1
float shadowMapBias;

Holds the amount to offset the shadow map perpendicular to the surface when checking whether a surface is in shadow. This helps eliminate self-shadowing and "shadow-acne". Larger values reduce these effects but if the value is too large, objects can appear to float above their shadows.

property nearPlane

1
float nearPlane;

Holds the distance from the light at which it should begin casting shadows. Setting this as large as possible while still including all shadow-casting objects will increase the precision of the shadowMap depth texture, reducing self-shadowing and "shadow-acne"


Updated on 2022-10-18 at 11:12:52 +0200