VideoMaterial

constructor(blendingMode: BlendingMode, videoDimensionMode: VideoDimensionMode, cullingMode: MaterialCullingMode, defaultColor: Color4 = Color4.BLACK, onHardwareBufferRelease: HardwareBufferReleaseCallback? = null)

Creates a VideoMaterial with the specified BlendingMode, VideoDimensionMode, and MaterialCullingMode.

Parameters

blendingMode
videoDimensionMode

The VideoDimensionMode to use.

cullingMode
defaultColor

The default color of the VideoMaterial. The default value is Color4.BLACK. If set to Color4.TRANSPARENT, ensure blendingMode is set to BlendingMode.TRANSPARENT.

onHardwareBufferRelease

Optional callback triggered when the associated HardwareBuffer is released by the rendering system. This callback is automatically unregistered when the material is closed. Use this callback only when rendering video with com.pico.spatial.core.ecs.VideoComponent. For com.pico.spatial.core.ecs.VideoPlayerComponent usage, keep this parameter null.

Example usage for VideoComponent:

val entity = Entity()
val mesh = MeshResource.createPlane(1.0f, 0.8f)
val videoMaterial = VideoMaterial(
blendingMode = BlendingMode.OPAQUE,
videoDimensionMode = VideoDimensionMode.MONO,
cullingMode = MaterialCullingMode.BACK,
defaultColor = Color4.BLACK,
onHardwareBufferRelease = HardwareBufferRelease(entityId)
)
val videoComponent = VideoComponent(mesh, videoMaterial)
entity.components.set(videoComponent)

Example usage for VideoPlayerComponent:

val entity = Entity()
val mesh = MeshResource.createPlane(1.0f, 0.8f)
val videoMaterial = VideoMaterial(
blendingMode = BlendingMode.TRANSPARENT,
videoDimensionMode = VideoDimensionMode.MONO,
cullingMode = MaterialCullingMode.BACK,
defaultColor = Color4.TRANSPARENT
)
val videoPlayerComponent = VideoPlayerComponent(mesh, videoMaterial)
entity.components.set(videoPlayerComponent)

constructor(blendingMode: BlendingMode, videoDimensionMode: VideoDimensionMode, cullingMode: MaterialCullingMode, defaultColor: Color4 = Color4.BLACK)

Creates a VideoMaterial with the specified BlendingMode, VideoDimensionMode, and MaterialCullingMode.

Parameters

blendingMode
videoDimensionMode

The VideoDimensionMode to use.

cullingMode
defaultColor

The default color of the VideoMaterial. The default value is Color4.BLACK. If set to Color4.TRANSPARENT, ensure blendingMode is set to BlendingMode.TRANSPARENT.

See also