Added resetView.

This commit is contained in:
Branimir Karadžić 2015-10-27 15:14:48 -07:00
parent 0e93c43578
commit 72774fd8e1
3 changed files with 33 additions and 10 deletions

View file

@ -1688,6 +1688,14 @@ namespace bgfx
///
void setViewRemap(uint8_t _id = 0, uint8_t _num = UINT8_MAX, const void* _remap = NULL);
/// Reset all view settings to default.
///
/// @param[in] _id View id.
///
/// @attention C99 equivalent is `bgfx_reset_view`.
///
void resetView(uint8_t _id);
/// Sets debug marker.
///
/// @attention C99 equivalent is `bgfx_set_marker`.

View file

@ -1096,17 +1096,9 @@ namespace bgfx
m_viewRemap[ii] = uint8_t(ii);
}
memset(m_fb, 0xff, sizeof(m_fb) );
memset(m_clear, 0, sizeof(m_clear) );
memset(m_rect, 0, sizeof(m_rect) );
memset(m_scissor, 0, sizeof(m_scissor) );
memset(m_seq, 0, sizeof(m_seq) );
memset(m_seqMask, 0, sizeof(m_seqMask) );
for (uint32_t ii = 0; ii < BX_COUNTOF(m_rect); ++ii)
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
m_rect[ii].m_width = 1;
m_rect[ii].m_height = 1;
resetView(uint8_t(ii) );
}
for (uint32_t ii = 0; ii < BX_COUNTOF(m_clearColor); ++ii)
@ -3125,6 +3117,13 @@ again:
s_ctx->setViewRemap(_id, _num, _remap);
}
void resetView(uint8_t _id)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(checkView(_id), "Invalid view id: %d", _id);
s_ctx->resetView(_id);
}
void setMarker(const char* _marker)
{
BGFX_CHECK_MAIN_THREAD();
@ -3997,6 +3996,11 @@ BGFX_C_API void bgfx_set_view_remap(uint8_t _id, uint8_t _num, const void* _rema
bgfx::setViewRemap(_id, _num, _remap);
}
BGFX_C_API void bgfx_reset_view(uint8_t _id)
{
bgfx::resetView(_id);
}
BGFX_C_API void bgfx_set_marker(const char* _marker)
{
bgfx::setMarker(_marker);

View file

@ -3397,6 +3397,17 @@ namespace bgfx
}
}
BGFX_API_FUNC(void resetView(uint8_t _id) )
{
setViewRect(_id, 0, 0, 1, 1);
setViewScissor(_id, 0, 0, 0, 0);
setViewClear(_id, BGFX_CLEAR_NONE, 0, 0.0f, 0);
setViewSeq(_id, false);
bgfx::FrameBufferHandle invalid = BGFX_INVALID_HANDLE;
setViewFrameBuffer(_id, invalid);
setViewTransform(_id, NULL, NULL, BGFX_VIEW_NONE, NULL);
}
BGFX_API_FUNC(void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap) )
{
const uint32_t num = bx::uint32_min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id;