Add Bullet C API and pybullet API to set projective texture matrices.

This commit is contained in:
yunfeibai
2018-03-18 18:45:54 -07:00
parent fd7aa8d0e1
commit 37696dd87e
12 changed files with 82 additions and 7 deletions

View File

@@ -3157,6 +3157,8 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
serverStatusOut.m_numDataStreamBytes = numRequestedPixels * totalBytesPerPixel;
float viewMat[16];
float projMat[16];
float projTextureViewMat[16];
float projTextureProjMat[16];
for (int i=0;i<16;i++)
{
viewMat[i] = clientCmd.m_requestPixelDataArguments.m_viewMatrix[i];
@@ -3186,7 +3188,7 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
projMat[i] = tmpCamResult.m_projectionMatrix[i];
}
}
}
}
bool handled = false;
if ((clientCmd.m_updateFlags & ER_BULLET_HARDWARE_OPENGL)!=0)
@@ -3195,6 +3197,23 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
{
useShadowMap = false;
useProjectiveTexture = true;
if ((clientCmd.m_updateFlags & REQUEST_PIXEL_ARGS_HAS_PROJECTIVE_TEXTURE_MATRICES)!=0)
{
for (int i=0;i<16;i++)
{
projTextureViewMat[i] = clientCmd.m_requestPixelDataArguments.m_projectiveTextureViewMatrix[i];
projTextureProjMat[i] = clientCmd.m_requestPixelDataArguments.m_projectiveTextureProjectionMatrix[i];
}
}
else // If no specified matrices for projective texture, then use the camera matrices.
{
for (int i=0;i<16;i++)
{
projTextureViewMat[i] = viewMat[i];
projTextureProjMat[i] = projMat[i];
}
}
this->m_data->m_guiHelper->setProjectiveTextureMatrices(projTextureViewMat, projTextureProjMat);
}
else
{