l'amelioration du frustum marche po enfaite
This commit is contained in:
parent
5f06a7391e
commit
46c1a03bed
@ -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();
|
||||
|
@ -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'écran
|
||||
float fov = XM_PI / 4.0f; // Champ de vision, généralement pi/4
|
||||
float aspect = screenWidth / screenHeight; // Rapport d'aspect, généralement largeur/hauteur
|
||||
float znear = screenDepth / 2.0f; // Plan proche, généralement la moitié de la profondeur de l'écran
|
||||
float zfar = screenDepth * 2.0f; // Plan éloigné, généralement deux fois la profondeur de l'écran
|
||||
|
||||
// Cré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);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user