![]() |
libgpac
Documentation of the core library of GPAC
|
import"evg.idl";
Public Member Functions | |
Canvas3D (unsigned long width, unsigned long height, DOMString pixfmt) | |
Canvas3D (unsigned long width, unsigned long height, DOMString pixfmt, ArrayBuffer data, optional unsigned long stride=0, optional unsigned long stride_uv=0) | |
void | clear (IRect rc, unsigned long r, unsigned long g, unsigned long b, unsigned long a) |
void | clear (IRect rc, DOMString color) |
void | clear (IRect rc, DOMString color) |
void | clearf (IRect rc, double r, double g, double b, double a) |
void | clearf (IRect rc, DOMString color) |
void | reassign (ArrayBuffer data) |
Object | toRGB (optional bool as_array=false, Float y, Float u, Float v, optional Float a=1.0) |
Object | toRGB (optional bool as_array=false, Vec4f color) |
Object | toYUV (optional bool as_array=false, Float r, Float g, Float b, optional Float a=1.0) |
Object | toYUV (optional bool as_array=false, Vec4f color) |
void | projection (Float32Buffer projection_matrix) |
void | modelview (Float32Buffer modelview_matrix) |
void | draw_array (Int32Buffer indices, Float32Buffer vertices, optional GF_EVGPrimitiveType primitive_type=GF_EVG_TRIANGLES, optional long nb_components=3) |
void | draw_path (Path path, optional float z=0) |
void | draw_path (Text text, optional float z=0) |
void | clear_depth (float depth) |
void | viewport (long x, long y, long width, long height) |
void | viewport () |
Shader | new_shader (ShaderType shader_type) |
Data Fields | |
writeonly IRect | clipper |
Shader | fragment |
Shader | vertex |
writeonly boolean | ccw |
writeonly boolean | backcull |
writeonly boolean | antialias |
writeonly float | min_depth |
writeonly float | max_depth |
writeonly float | point_size |
writeonly boolean | point_smooth |
writeonly float | line_size |
writeonly boolean | clip_zero |
writeonly GF_EVGDepthTest | depth_test |
writeonly boolean | write_depth |
Float32Buffer | depth_buffer |
The Canvas3D object is used to draw vectorial 3D meshes and 2D paths.
The 3D rasterizer can however be useful when drawing simple 3D objects over an existing video, as it avoids GPU transfers of the frame data.
The rasterizer supports:
The rasterizer does not claim compliancy to any GPU specification, and will likely produce different results than WebGL.
Canvas3D::Canvas3D | ( | unsigned long | width, |
unsigned long | height, | ||
DOMString | pixfmt | ||
) |
Canvas3D constructor. The canvas memory is owned by the canvas object
width | the width in pixels of the canvas |
height | the height in pixels of the canvas |
pixfmt | the pixel fomat of the canvas |
Canvas3D::Canvas3D | ( | unsigned long | width, |
unsigned long | height, | ||
DOMString | pixfmt, | ||
ArrayBuffer | data, | ||
optional unsigned long | stride = 0 , |
||
optional unsigned long | stride_uv = 0 |
||
) |
Canvas constructor
width | the width in pixels of the canvas |
height | the height in pixels of the canvas |
pixfmt | the pixel fomat of the canvas |
data | the data buffer on which to write. The size shall be greater than the size required for the given size and pixel format. |
stride | horizontal stride in pixel of the data |
stride_uv | horizontal stride in pixel of the data for the U and V planes |
void Canvas3D::clear | ( | IRect | rc, |
unsigned long | r, | ||
unsigned long | g, | ||
unsigned long | b, | ||
unsigned long | a | ||
) |
clears the canvas with the given color - see gf_evg_surface_clear
rc | the rectangle to clear, in pixel coordinates |
r | red value, between 0 and 255 |
g | green value, between 0 and 255 |
b | blue value, between 0 and 255 |
a | alpha value, between 0 and 255 |
void Canvas3D::clear | ( | IRect | rc, |
DOMString | color | ||
) |
clears the canvas with the given color. See gf_evg_surface_clear
rc | the rectangle to clear, in pixel coordinates |
color | an HTML/SVG color name or an HTML color value formated as $RRGGBB, #RRGGBB or 0xRRGGBB |
void Canvas3D::clear | ( | IRect | rc, |
DOMString | color | ||
) |
clears the canvas with the given color. See gf_evg_surface_clear
rc | the rectangle to clear, in pixel coordinates |
color | an HTML/SVG color name or an HTML color value formated as $RRGGBB, #RRGGBB or 0xRRGGBB |
void Canvas3D::clearf | ( | IRect | rc, |
double | r, | ||
double | g, | ||
double | b, | ||
double | a | ||
) |
clears the canvas with the given color
rc | the rectangle to clear, in pixel coordinates |
r | red value, between 0.0 and 1.0 |
g | green value, between 0.0 and 1.0 |
b | blue value, between 0.0 and 1.0 |
a | alpha value, between 0.0 and 1.0 |
void Canvas3D::clearf | ( | IRect | rc, |
DOMString | color | ||
) |
clears the canvas with the given color. See gf_evg_surface_clear
rc | the rectangle to clear, in pixel coordinates |
color | an HTML/SVG color name or an HTML color value formated as $RRGGBB, #RRGGBB or 0xRRGGBB |
void Canvas3D::reassign | ( | ArrayBuffer | data | ) |
reassign internal data (typically at each new packet)
data | the buffer to use |
Object Canvas3D::toRGB | ( | optional bool | as_array = false , |
Float | y, | ||
Float | u, | ||
Float | v, | ||
optional Float | a = 1.0 |
||
) |
converts YUV color to RGB
as_array | if true, the return object is an array of 4 components, otherwise it is a Vec4f object |
y | Y component value |
u | Cb/U component value |
v | Cr/V component value |
a | alpha value, not modified |
Object Canvas3D::toRGB | ( | optional bool | as_array = false , |
Vec4f | color | ||
) |
converts YUV color to RGB
as_array | if true, the return object is an array of 4 components, otherwise it is a Vec4f object |
color | the YUV value to convert |
Object Canvas3D::toYUV | ( | optional bool | as_array = false , |
Float | r, | ||
Float | g, | ||
Float | b, | ||
optional Float | a = 1.0 |
||
) |
converts RGB color to YUV
as_array | if true, the return object is an array of 4 components, otherwise it is Vec4f object |
r | red component value |
g | green component value |
b | blue component value |
a | alpha value, not modified |
Object Canvas3D::toYUV | ( | optional bool | as_array = false , |
Vec4f | color | ||
) |
converts RGB color to YUV
as_array | if true, the return object is an array of 4 components, otherwise it is a Vec4f object |
color | the RGB value to convert |
void Canvas3D::projection | ( | Float32Buffer | projection_matrix | ) |
void Canvas3D::modelview | ( | Float32Buffer | modelview_matrix | ) |
void Canvas3D::draw_array | ( | Int32Buffer | indices, |
Float32Buffer | vertices, | ||
optional GF_EVGPrimitiveType | primitive_type = GF_EVG_TRIANGLES , |
||
optional long | nb_components = 3 |
||
) |
draws a set of primitives (see gf_evg_surface_draw_array)
indices | array of indices in the vertex buffer for the primitives to draw |
vertices | the vertices to use |
primitive_type | the type of primitive to draw |
nb_components | the number of components per vertex (eg, 2, 3) |
void Canvas3D::draw_path | ( | Path | path, |
optional float | z = 0 |
||
) |
draws a path (see gf_evg_surface_draw_path)
path | the path to draw |
z | the z value to assign to points in the path |
void Canvas3D::draw_path | ( | Text | text, |
optional float | z = 0 |
||
) |
draws a text (see gf_evg_surface_draw_path)
text | the text to draw |
z | the z value to assign to points in the text's path |
void Canvas3D::clear_depth | ( | float | depth | ) |
clears the depth buffer (see gf_evg_surface_clear_depth)
depth | the depth value to set |
void Canvas3D::viewport | ( | long | x, |
long | y, | ||
long | width, | ||
long | height | ||
) |
sets the viewport (see gf_evg_surface_viewport)
x | the horizontal coordinate of the top-left corner of the viewport |
y | the vertical coordinate of the top-left corner of the viewport |
width | the width of the viewport |
height | the height of the viewport |
void Canvas3D::viewport | ( | ) |
sets the viewport to full canvas {0,0,width,height} (see gf_evg_surface_viewport)
Shader Canvas3D::new_shader | ( | ShaderType | shader_type | ) |
creats a new shader
shader_type | the desired shader type |
writeonly IRect Canvas3D::clipper |
clipper in pixel coordinates - see gf_evg_surface_set_clipper
Shader Canvas3D::fragment |
fragment shader to use, set to NULL to disable pixel writing.
Shader Canvas3D::vertex |
vertex shader to use, set to NULL to disable vertex shading, in which case the currently defined projection and modelview matrices will be used
writeonly boolean Canvas3D::ccw |
set face orientation to counter-clockwise or clockwise (see gf_evg_surface_set_ccw)
writeonly boolean Canvas3D::backcull |
backface culling enabled (see gf_evg_surface_set_backcull), default is true
writeonly boolean Canvas3D::antialias |
antialiased enabled (see gf_evg_surface_set_antialias), default is true
writeonly float Canvas3D::min_depth |
min depth (see gf_evg_surface_set_min_depth), default is 0
writeonly float Canvas3D::max_depth |
max depth (see gf_evg_surface_set_max_depth), default is 1.0
writeonly float Canvas3D::point_size |
point size (see gf_evg_surface_set_point_size), default is 1.0
writeonly boolean Canvas3D::point_smooth |
point smoothing enabled (see gf_evg_surface_set_point_smooth), default is false
writeonly float Canvas3D::line_size |
line size (see gf_evg_surface_set_line_size), default is 1.0
writeonly boolean Canvas3D::clip_zero |
clip zero enabled (see gf_evg_surface_set_clip_zero), default is false
writeonly GF_EVGDepthTest Canvas3D::depth_test |
depth test mode (see gf_evg_set_depth_test), default is GF_EVGDEPTH_LESS
writeonly boolean Canvas3D::write_depth |
write depth buffer enabled (see gf_evg_surface_write_depth), default is true
Float32Buffer Canvas3D::depth_buffer |
depth buffer (see gf_evg_surface_set_depth_buffer).