l'amelioration du frustum marche po enfaite

This commit is contained in:
StratiX0
2024-04-04 09:02:33 +02:00
parent 5f06a7391e
commit 46c1a03bed
3 changed files with 3 additions and 13 deletions

View File

@@ -727,7 +727,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z)
}
// Construct the frustum.
m_Frustum->ConstructFrustum(viewMatrix, projectionMatrix, SCREEN_DEPTH, m_screenWidth, m_screenHeight);
m_Frustum->ConstructFrustum(viewMatrix, projectionMatrix, SCREEN_DEPTH);
// Get the number of models that will be rendered.
modelCount = m_ModelList->GetModelCount();

View File

@@ -15,22 +15,12 @@ FrustumClass::~FrustumClass()
{
}
void FrustumClass::ConstructFrustum(XMMATRIX viewMatrix, XMMATRIX projectionMatrix, float screenDepth, float screenWidth, float screenHeight)
void FrustumClass::ConstructFrustum(XMMATRIX viewMatrix, XMMATRIX projectionMatrix, float screenDepth)
{
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);

View File

@@ -19,7 +19,7 @@ public:
FrustumClass(const FrustumClass&);
~FrustumClass();
void ConstructFrustum(XMMATRIX, XMMATRIX, float, float, float);
void ConstructFrustum(XMMATRIX, XMMATRIX, float);
bool CheckPoint(float, float, float);
bool CheckCube(float, float, float, float);