amelioration du frustum
This commit is contained in:
@@ -15,12 +15,21 @@ FrustumClass::~FrustumClass()
|
||||
{
|
||||
}
|
||||
|
||||
void FrustumClass::ConstructFrustum(XMMATRIX viewMatrix, XMMATRIX projectionMatrix, float screenDepth)
|
||||
void FrustumClass::ConstructFrustum(XMMATRIX viewMatrix, XMMATRIX projectionMatrix, float screenDepth, float screenWidth, float screenHeight)
|
||||
{
|
||||
XMMATRIX finalMatrix;
|
||||
XMFLOAT4X4 projMatrix, matrix;
|
||||
float zMinimum, r, t;
|
||||
|
||||
// Augmenter la taille de la zone de frustum en fonction de la taille de l'<27>cran
|
||||
float fov = XM_PI / 4.0f; // Champ de vision, g<>n<EFBFBD>ralement pi/4
|
||||
float aspect = screenWidth / screenHeight; // Rapport d'aspect, g<>n<EFBFBD>ralement largeur/hauteur
|
||||
float znear = screenDepth / 2.0f; // Plan proche, g<>n<EFBFBD>ralement la moiti<74> de la profondeur de l'<27>cran
|
||||
float zfar = screenDepth * 2.0f; // Plan <20>loign<67>, g<>n<EFBFBD>ralement deux fois la profondeur de l'<27>cran
|
||||
|
||||
// Cr<43>er une nouvelle matrice de projection avec les nouvelles valeurs
|
||||
XMMATRIX newProjectionMatrix = XMMatrixPerspectiveFovLH(fov, aspect, znear, zfar);
|
||||
|
||||
|
||||
// Load the projection matrix into a XMFLOAT4X4 structure.
|
||||
XMStoreFloat4x4(&projMatrix, projectionMatrix);
|
||||
|
||||
Reference in New Issue
Block a user