Skip to content

triangleRasterizeColor

ptcloudfunctionOpenCV 5.0.0
import { triangleRasterizeColor } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSvertices, indices, colors, colorBuf
FUNCTIONtriangleRasterizeColor
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Overloaded version of triangleRasterize() with color-only rendering

triangleRasterizeColor(vertices: Mat, indices: Mat, colors: Mat, colorBuf: Mat, world2cam: Mat, fovY: number, zNear: number, zFar: number, settings: TriangleRasterizeSettings): void;
2 available overloads
triangleRasterizeColor(vertices: Mat, indices: Mat, colors: Mat, colorBuf: Mat, world2cam: Mat, fovY: number, zNear: number, zFar: number): void;
triangleRasterizeColor(vertices: Mat, indices: Mat, colors: Mat, colorBuf: Mat, world2cam: Mat, fovY: number, zNear: number, zFar: number, settings: TriangleRasterizeSettings): void;
vertices

vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)

indices

triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array. Should contain CV_32SC3 values or compatible

colors

per-vertex colors of CV_32FC3 type or compatible. Can be empty or the same size as vertices array. If the values are out of [0; 1] range, the result correctness is not guaranteed

colorBuf

Input/output value, modified by the native operation. an array representing the final rendered image. Should containt CV_32FC3 values and be the same size as depthBuf. Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene.

world2cam

a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose

fovY

field of view in vertical direction, given in radians

zNear

minimum Z value to render, everything closer is clipped

zFar

maximum Z value to render, everything farther is clipped

settings

see TriangleRasterizeSettings. By default the smooth shading is on, with CW culling and with disabled GL compatibility

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.