oa::render

render module in the OA Ui public surface.

MdRust public API

Public Types

Public Functions

pub fn blit(texture: &Texture) -> Result<Texture>
pub fn clear(texture: &Texture, color: Color) -> Result<Texture>
pub fn compile_scene(scene: &Scene) -> Result<MeshData>
pub fn compile_scene_packets( scene: &Scene, ) -> Result<(MeshData, Vec<SceneDrawPacket>)>
pub fn compute_bounds(mesh: &mut MeshData)
pub fn create_cube(size: f32) -> Result<MeshData>
pub fn create_fullscreen_quad() -> MeshData
pub fn create_quad(width: f32, height: f32) -> Result<MeshData>
pub fn flip_uvs_y(mesh: &mut MeshData)
pub fn save_texture_file( texture: &Texture, path: impl AsRef<Path>, quality: u32, ) -> Result<()>
pub fn scale(mesh: &mut MeshData, s: Vec3) -> Result<()>
pub fn texture_from_image(image: &Image) -> Result<Texture>
pub fn texture_from_rgba8( engine: &Engine, rgba: &[u8], width: usize, height: usize, ) -> Result<Texture>
pub fn transform(mesh: &mut MeshData, matrix: Mat4) -> Result<()>
pub fn translate(mesh: &mut MeshData, offset: Vec3)
pub fn validate_scene(scene: &Scene) -> Result<()>

Function Documentation

pub fn blit( texture: &Texture ) -> Result<Texture>
Deep-copy a packed Texture into independent device storage. This is the currently admitted whole-surface FnTexture::blit equivalent. Rectangle and scaled blits remain unavailable because the C++ donor also rejects them rather than silently selecting different sampling semantics. Errors Returns an error when the device copy cannot be recorded.
pub fn clear( texture: &Texture, color: Color ) -> Result<Texture>
Return an independent packed Texture filled with one RGBA8 clear color. The result has the source extent but does not alias source storage. This is Rust’s immutable-value spelling of the C++ donor’s in-place clear. Errors Returns an error for non-finite or out-of-range color components, exhausted texture identity, or failed device allocation/upload.
pub fn compile_scene( scene: &Scene ) -> Result<MeshData>
Compile visible scene instances into one deterministic indexed mesh snapshot.
pub fn compile_scene_packets( scene: &Scene, ) -> Result<( MeshData, Vec<SceneDrawPacket> )>
Compile visible scene nodes into a merged MeshData and one SceneDrawPacket per visible node that contributes geometry. The returned mesh has world-space positions and normals; each packet records the index range within the merged buffer that belongs to that node. Draw order is deterministic (depth-first scene-node order).
pub fn compute_bounds( mesh: &mut MeshData )
Recompute and store the tight axis-aligned bounding box for mesh. Clears bounds_dirty. Empty meshes produce an all-zero Aabb. Donor: oa::FnMesh::computeBounds.
pub fn create_cube( size: f32 ) -> Result<MeshData>
Create a 3D axis-aligned cube (12 triangles, 24 vertices, size × size × size). Each face has its own four vertices with an outward normal and per-face UVs. size must be finite and positive. Donor: oa::FnMesh::createCube. Errors Returns an error for non-finite or non-positive size.
pub fn create_fullscreen_quad() -> MeshData
Create a fullscreen NDC quad (2 triangles, 4 vertices) in [-1, 1] XY with top-origin image UVs. Used for post-processing passes. Donor: oa::FnMesh::createFullscreenQuad.
pub fn create_quad( width: f32, height: f32 ) -> Result<MeshData>
Create a centered quad (2 triangles, 4 vertices) with top-origin image UVs. UV V=0 is the source-image top and world +Y is the quad top. For image/video viewing, pass the pixel dimensions (e.g. 1920, 1080). width and height must be finite and positive. Donor: oa::FnMesh::createQuad. Errors Returns an error for non-finite or non-positive dimensions.
pub fn flip_uvs_y( mesh: &mut MeshData )
Flip all vertex UVs vertically (V ← 1 − V). Used to convert explicitly bottom-origin source content to top-origin. Never fails. Donor: oa::FnMesh::flipUvsY.
pub fn save_texture_file( texture: &Texture, path: impl AsRef<Path>, quality: u32, ) -> Result<()>
Read and save one packed RGBA8 Texture using its path extension. Supported extensions are .jpg, .jpeg, .png, .webp, .bmp, and .tga. This is an explicit blocking readback and filesystem boundary. Errors Returns an error for unsupported paths, failed device observation, codec failure, or filesystem failure.
pub fn scale(mesh: &mut MeshData, s: Vec3) -> Result<()>
Scale all vertex positions and normals. Zero or non-finite scale components fail without modifying the mesh. Donor: oa::FnMesh::scale. Errors Returns an error when any scale component is zero or non-finite.
pub fn texture_from_image( image: &Image ) -> Result<Texture>
Convert one packed RGBA8 HWC image into an independent Texture value. The operation retains the texture/image semantic distinction and performs a device-side deep copy. Other image layouts, channel orders, and scalar representations require an explicit image conversion before this boundary. Errors Returns an error unless image is an unbatched U8 HWC RGBA image or its device copy cannot be recorded.
pub fn texture_from_rgba8( engine: &Engine, rgba: &[u8], width: usize, height: usize ) -> Result<Texture>
Upload one exact packed row-major RGBA8 host image as a Texture. Errors Returns an error for zero or overflowing dimensions, a mismatched byte count, exhausted semantic identity, or device allocation/upload failure.
pub fn transform(mesh: &mut MeshData, matrix: Mat4) -> Result<()>
Apply an affine matrix to all vertex positions and normals. The mesh is left unchanged when matrix is non-finite, singular, or produces non-finite vertex positions. On success, bounds_dirty is set. Donor: oa::FnMesh::transform. Errors Returns an error when matrix is non-finite, singular (no normal matrix), or produces non-finite vertex positions.
pub fn translate( mesh: &mut MeshData, offset: Vec3 )
Translate all vertex positions in-place. Always succeeds; bounds are marked dirty. Donor: oa::FnMesh::translate.
pub fn validate_scene(scene: &Scene) -> Result<()>
Validate one scene without retaining or uploading it.