mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-13 21:30:09 +00:00
fix for vertically flipped depth buffer in TinyRendererVisualShapeConverter::render
This commit is contained in:
parent
e918e5a44e
commit
2466dc155d
@ -624,6 +624,19 @@ void TinyRendererVisualShapeConverter::render(const float viewMat[16], const flo
|
|||||||
// printf("flipped!\n");
|
// printf("flipped!\n");
|
||||||
m_data->m_rgbColorBuffer.flip_vertically();
|
m_data->m_rgbColorBuffer.flip_vertically();
|
||||||
|
|
||||||
|
//flip z-buffer
|
||||||
|
{
|
||||||
|
int half = m_data->m_swHeight>>1;
|
||||||
|
for (int j=0; j<half; j++)
|
||||||
|
{
|
||||||
|
unsigned long l1 = j*m_data->m_swWidth;
|
||||||
|
unsigned long l2 = (m_data->m_swHeight-1-j)*m_data->m_swWidth;
|
||||||
|
for (int i=0;i<m_data->m_swWidth;i++)
|
||||||
|
{
|
||||||
|
btSwap(m_data->m_depthBuffer[l1+i],m_data->m_depthBuffer[l2+i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::getWidthAndHeight(int& width, int& height)
|
void TinyRendererVisualShapeConverter::getWidthAndHeight(int& width, int& height)
|
||||||
|
Loading…
Reference in New Issue
Block a user