diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index f4a39f47..17cc45d9 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -1530,9 +1530,19 @@ namespace bgfx /// void destroyUniform(UniformHandle _handle); + /// Create occlusion query. + /// + /// @returns Handle to occlusion query object. + /// + /// @attention C99 equivalent is `bgfx_create_occlusion_query`. /// OcclusionQueryHandle createOcclusionQuery(); + /// Destroy occlusion query. + /// + /// @param[in] _handle Handle to occlusion query object. + /// + /// @attention C99 equivalent is `bgfx_destroy_occlusion_query`. /// void destroyOcclusionQuery(OcclusionQueryHandle _handle); @@ -1969,7 +1979,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit`. /// uint32_t submit(uint8_t _id, ProgramHandle _program, int32_t _depth = 0); - + /// Submit primitive with occlusion query for rendering. /// /// @param[in] _id View id. diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index f0bd4413..08c14eb9 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -639,6 +639,12 @@ BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uni /**/ BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle); +/**/ +BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(); + +/**/ +BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle); + /**/ BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]); diff --git a/src/bgfx.cpp b/src/bgfx.cpp index a159b3f7..f7b88db4 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -3984,6 +3984,19 @@ BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle) bgfx::destroyUniform(handle.cpp); } +BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query() +{ + union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle; + handle.cpp = bgfx::createOcclusionQuery(); + return handle.c; +} + +BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle) +{ + union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle }; + bgfx::destroyOcclusionQuery(handle.cpp); +} + BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]) { bgfx::setPaletteColor(_index, _rgba);