mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sokol: update to floooh/sokol@c602d83 (#9607)
This commit is contained in:
@ -54,9 +54,9 @@ fn create_texture(w int, h int, buf &byte) C.sg_image {
|
||||
d3d11_texture: 0
|
||||
}
|
||||
// commen if .dynamic is enabled
|
||||
img_desc.content.subimage[0][0] = C.sg_subimage_content{
|
||||
img_desc.data.subimage[0][0] = C.sg_range{
|
||||
ptr: buf
|
||||
size: sz
|
||||
size: size_t(sz)
|
||||
}
|
||||
|
||||
sg_img := C.sg_make_image(&img_desc)
|
||||
@ -70,10 +70,10 @@ fn destroy_texture(sg_img C.sg_image) {
|
||||
// Use only if usage: .dynamic is enabled
|
||||
fn update_text_texture(sg_img C.sg_image, w int, h int, buf &byte) {
|
||||
sz := w * h * 4
|
||||
mut tmp_sbc := C.sg_image_content{}
|
||||
tmp_sbc.subimage[0][0] = C.sg_subimage_content{
|
||||
mut tmp_sbc := C.sg_image_data{}
|
||||
tmp_sbc.subimage[0][0] = C.sg_range{
|
||||
ptr: buf
|
||||
size: sz
|
||||
size: size_t(sz)
|
||||
}
|
||||
C.sg_update_image(sg_img, &tmp_sbc)
|
||||
}
|
||||
@ -323,16 +323,21 @@ fn my_init(mut app App) {
|
||||
// 3d pipeline
|
||||
mut pipdesc := C.sg_pipeline_desc{}
|
||||
unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) }
|
||||
pipdesc.blend.enabled = true
|
||||
pipdesc.blend.src_factor_rgb = gfx.BlendFactor(C.SG_BLENDFACTOR_SRC_ALPHA)
|
||||
pipdesc.blend.dst_factor_rgb = gfx.BlendFactor(C.SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA)
|
||||
pipdesc.depth_stencil = C.sg_depth_stencil_state{
|
||||
depth_write_enabled: true
|
||||
depth_compare_func: gfx.CompareFunc(C.SG_COMPAREFUNC_LESS_EQUAL)
|
||||
|
||||
color_state := C.sg_color_state{
|
||||
blend: C.sg_blend_state{
|
||||
enabled: true
|
||||
src_factor_rgb: gfx.BlendFactor(C.SG_BLENDFACTOR_SRC_ALPHA)
|
||||
dst_factor_rgb: gfx.BlendFactor(C.SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA)
|
||||
}
|
||||
}
|
||||
pipdesc.rasterizer = C.sg_rasterizer_state{
|
||||
cull_mode: .back
|
||||
pipdesc.colors[0] = color_state
|
||||
|
||||
pipdesc.depth = C.sg_depth_state{
|
||||
write_enabled: true
|
||||
compare: gfx.CompareFunc(C.SG_COMPAREFUNC_LESS_EQUAL)
|
||||
}
|
||||
pipdesc.cull_mode = .back
|
||||
app.pip_3d = sgl.make_pipeline(&pipdesc)
|
||||
|
||||
// create chessboard texture 256*256 RGBA
|
||||
|
Reference in New Issue
Block a user