⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgcfrustum.h

📁 3D Game Engine Design Source Code非常棒
💻 H
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// FREE SOURCE CODE
// http://www.magic-software.com/License/free.pdf

#ifndef MGCFRUSTUM_H
#define MGCFRUSTUM_H

#include "MgcRTLib.h"
#include "MgcVector3.h"


class MgcFrustum
{
public:
    // Orthogonal frustum.  Let E be the origin, L be the left vector, U be
    // the up vector, and D be the direction vector.  Let l > 0 and u > 0 be
    // the extents in the L and U directions, respectively.  Let n and f be
    // the extents in the D direction with 0 < n < f.  The four corners of the
    // frustum in the near plane are E + s0*l*L + s1*u*U + n*D where |s0| =
    // |s1| = 1 (four choices).  The four corners of the frustum in the far
    // plane are E + (f/n)*(s0*l*L + s1*u*U) where |s0| = |s1| = 1 (four
    // choices).

    MgcFrustum ();

    MgcVector3& Origin ();
    const MgcVector3& Origin () const;

    MgcVector3& LVector ();
    const MgcVector3& LVector () const;
    MgcVector3& UVector ();
    const MgcVector3& UVector () const;
    MgcVector3& DVector ();
    const MgcVector3& DVector () const;

    MgcReal& LBound ();
    const MgcReal& LBound () const;
    MgcReal& UBound ();
    const MgcReal& UBound () const;
    MgcReal& DMin ();
    const MgcReal& DMin () const;
    MgcReal& DMax ();
    const MgcReal& DMax () const;

    void Update ();
    MgcReal GetDRatio () const;
    MgcReal GetMTwoLF () const;
    MgcReal GetMTwoUF () const;

    void ComputeVertices (MgcVector3 akVertex[8]) const;

protected:
    MgcVector3 m_kOrigin, m_kLVector, m_kUVector, m_kDVector;
    MgcReal m_fLBound, m_fUBound, m_fDMin, m_fDMax;

    // derived quantities
    MgcReal m_fDRatio;
    MgcReal m_fMTwoLF, m_fMTwoUF;
};

#include "MgcFrustum.inl"

#endif

⌨️ 快捷键说明

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