VideoMaterial
Creates a VideoMaterial with the specified BlendingMode, VideoDimensionMode, and MaterialCullingMode.
Parameters
The BlendingMode to use. BlendingMode.ADD, BlendingMode.FADE, and BlendingMode.MASKED are not supported.
The VideoDimensionMode to use.
The MaterialCullingMode to use.
The default color of the VideoMaterial. The default value is Color4.BLACK. If set to Color4.TRANSPARENT, ensure blendingMode is set to BlendingMode.TRANSPARENT.
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)Creates a VideoMaterial with the specified BlendingMode, VideoDimensionMode, and MaterialCullingMode.
Parameters
The BlendingMode to use. BlendingMode.ADD, BlendingMode.FADE, and BlendingMode.MASKED are not supported.
The VideoDimensionMode to use.
The MaterialCullingMode to use.
The default color of the VideoMaterial. The default value is Color4.BLACK. If set to Color4.TRANSPARENT, ensure blendingMode is set to BlendingMode.TRANSPARENT.