frustum.h

来自「3D游戏引擎 Programming Role-Playing Games wi」· C头文件 代码 · 共 36 行

H
36
字号
#ifndef _FRUSTUM_H_
#define _FRUSTUM_H_

class cFrustum
{
  private:
    D3DXPLANE m_Planes[6]; // The frustum planes

  public:
    // Construct the six planes from current view and
    // projection. Can override the default depth value.
    BOOL Construct(cGraphics *Graphics, float ZDistance = 0.0f);

    // The following functions check a single point, cube,
    // rectangle, and sphere if contained in the frustum.
    // A return value of TRUE means visible, FALSE not visible.
    // When checking cubes or rectangles, you can
    // supply a BOOL variable that determines if all the
    // points are in the frustum.
    BOOL CheckPoint(float XPos, float YPos, float ZPos);

    BOOL CheckCube(float XCenter, float YCenter,               \
                   float ZCenter, float Size,                  \
                   BOOL *CompletelyContained = NULL);
    
    BOOL CheckRectangle(float XCenter, float YCenter,          \
                        float ZCenter, float XSize,            \
                        float YSize, float ZSize,              \
                        BOOL *CompletelyContained = NULL);
    
    BOOL CheckSphere(float XCenter, float YCenter,             \
                     float ZCenter, float Radius);
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?