more methods for projection/culling projection matrices & frustum

This commit is contained in:
Nick Fisher
2023-11-09 11:41:40 +08:00
parent e1141098d0
commit 395de95d37
13 changed files with 267 additions and 144 deletions

View File

@@ -677,10 +677,8 @@ namespace polyvox
.texture(RenderTarget::AttachmentPoint::DEPTH, _rtDepth)
.build(*_engine);
// Make a specific viewport just for our render target
_view->setRenderTarget(_rt);
Log("Set render target for texture id %u to %u x %u", texture, width, height);
Log("Created render target for texture id %u (%u x %u)", texture, width, height);
}
void FilamentViewer::destroySwapChain()
@@ -1109,6 +1107,30 @@ namespace polyvox
cam.setModelMatrix(modelMatrix);
}
void FilamentViewer::setCameraProjectionMatrix(const double *const matrix, double near, double far)
{
Camera &cam = _view->getCamera();
mat4 projectionMatrix(
matrix[0],
matrix[1],
matrix[2],
matrix[3],
matrix[4],
matrix[5],
matrix[6],
matrix[7],
matrix[8],
matrix[9],
matrix[10],
matrix[11],
matrix[12],
matrix[13],
matrix[14],
matrix[15]);
cam.setCustomProjection(projectionMatrix, near, far);
}
const math::mat4 FilamentViewer::getCameraModelMatrix()
{
const auto &cam = _view->getCamera();
@@ -1127,6 +1149,12 @@ namespace polyvox
return cam.getProjectionMatrix();
}
const math::mat4 FilamentViewer::getCameraCullingProjectionMatrix()
{
const auto &cam = _view->getCamera();
return cam.getCullingProjectionMatrix();
}
const filament::Frustum FilamentViewer::getCameraFrustum()
{
const auto &cam = _view->getCamera();