mirror of https://github.com/bkaradzic/bgfx
Added points primitive type.
This commit is contained in:
parent
82335a6be1
commit
4b8f63607c
|
@ -64,8 +64,12 @@ namespace bgfx
|
|||
#define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x000000ff00000000)
|
||||
|
||||
#define BGFX_STATE_PT_LINES UINT64_C(0x0000010000000000)
|
||||
#define BGFX_STATE_PT_POINTS UINT64_C(0x0000020000000000)
|
||||
#define BGFX_STATE_PT_SHIFT 40
|
||||
#define BGFX_STATE_PT_MASK UINT64_C(0x0000010000000000)
|
||||
#define BGFX_STATE_PT_MASK UINT64_C(0x0000030000000000)
|
||||
|
||||
#define BGFX_STATE_POINT_SIZE_SHIFT 44
|
||||
#define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x000ff00000000000)
|
||||
|
||||
#define BGFX_STATE_NONE UINT64_C(0x0000000000000000)
|
||||
#define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff)
|
||||
|
|
|
@ -14,12 +14,14 @@ namespace bgfx
|
|||
{
|
||||
D3DPT_TRIANGLELIST,
|
||||
D3DPT_LINELIST,
|
||||
D3DPT_POINTLIST,
|
||||
};
|
||||
|
||||
static const uint32_t s_primNumVerts[] =
|
||||
{
|
||||
3,
|
||||
2,
|
||||
1,
|
||||
};
|
||||
|
||||
static const D3DMULTISAMPLE_TYPE s_msaa[] =
|
||||
|
@ -1534,7 +1536,8 @@ namespace bgfx
|
|||
|
||||
if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK
|
||||
|BGFX_STATE_ALPHA_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE
|
||||
|BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK) & changedFlags)
|
||||
|BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK
|
||||
|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
|
||||
{
|
||||
if (BGFX_STATE_CULL_MASK & changedFlags)
|
||||
{
|
||||
|
@ -1566,6 +1569,12 @@ namespace bgfx
|
|||
DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHATESTENABLE, !!(BGFX_STATE_ALPHA_TEST & newFlags) ) );
|
||||
}
|
||||
|
||||
if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
|
||||
{
|
||||
float pointSize = (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT);
|
||||
DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_POINTSIZE, *( (DWORD*)&pointSize) ) );
|
||||
}
|
||||
|
||||
if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags)
|
||||
{
|
||||
uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0;
|
||||
|
|
|
@ -227,12 +227,14 @@ namespace bgfx
|
|||
{
|
||||
GL_TRIANGLES,
|
||||
GL_LINES,
|
||||
GL_POINTS,
|
||||
};
|
||||
|
||||
static const uint32_t s_primNumVerts[] =
|
||||
{
|
||||
3,
|
||||
2,
|
||||
1,
|
||||
};
|
||||
|
||||
static const char* s_attribName[Attrib::Count] =
|
||||
|
@ -1411,8 +1413,9 @@ namespace bgfx
|
|||
}
|
||||
|
||||
if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK
|
||||
|BGFX_STATE_ALPHA_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE
|
||||
|BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK) & changedFlags)
|
||||
|BGFX_STATE_ALPHA_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE
|
||||
|BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK
|
||||
|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
|
||||
{
|
||||
if (BGFX_STATE_CULL_MASK & changedFlags)
|
||||
{
|
||||
|
@ -1466,6 +1469,12 @@ namespace bgfx
|
|||
{
|
||||
GL_CHECK(glDisable(GL_ALPHA_TEST) );
|
||||
}
|
||||
|
||||
if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
|
||||
{
|
||||
float pointSize = (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT);
|
||||
GL_CHECK(glPointSize(pointSize) );
|
||||
}
|
||||
#endif // BGFX_CONFIG_RENDERER_OPENGLES
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue