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

📄 mgcbezierrectangle3g.h

📁 《3D游戏引擎设计》的源码
💻 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 MGCBEZIERRECTANGLE3G_H
#define MGCBEZIERRECTANGLE3G_H

#include "MgcBezierRectangleG.h"
#include "MgcVector3.h"


class MgcBezierRectangle3G : public MgcBezierRectangleG
{
public:
    // Construction.  MgcBezierRectangle3G accepts responsibility for deleting
    // the input array.
    MgcBezierRectangle3G (MgcVector3* akCtrlPoint);

    // position and derivatives up to second order
    virtual MgcVector3 GetPosition (MgcReal fU, MgcReal fV) const;
    virtual MgcVector3 GetDerivativeU (MgcReal fU, MgcReal fV) const;
    virtual MgcVector3 GetDerivativeV (MgcReal fU, MgcReal fV) const;
    virtual MgcVector3 GetDerivativeUU (MgcReal fU, MgcReal fV) const;
    virtual MgcVector3 GetDerivativeUV (MgcReal fU, MgcReal fV) const;
    virtual MgcVector3 GetDerivativeVV (MgcReal fU, MgcReal fV) const;

    // tessellation by recursive subdivision
    virtual void Tessellate (unsigned int uiLevel, bool bWantNormals);

protected:
    // precomputation
    class BlockParameters
    {
    public:
        unsigned int m_uiI00, m_uiI01, m_uiI10, m_uiI11;

        // Xuuu(0,0), Xuuu(0,1), Xuuu(1,0) = Xuuu(0,0), Xuuu(1,1) = Xuuu(0,1)
        MgcVector3 m_akXuuu[2];

        // Xvvv(0,0), Xvvv(1,0), Xvvv(0,1) = Xvvv(0,0), Xvvv(1,1) = Xvvv(1,0)
        MgcVector3 m_akXvvv[2];

        // Xuuuvv(0,0), Xuuuvv(0,1), Xuuuvv(1,0) = Xuuuvv(0,0),
        //   Xuuuvv(1,1) = Xuuuvv(0,1)
        MgcVector3 m_akXuuuvv[2];

        // Xuuvvv(0,0), Xuuvvv(1,0), Xuuvvv(0,1) = Xuuvvv(0,0),
        //   Xuuvvv(1,1) = Xuuvvv(1,0)
        MgcVector3 m_akXuuvvv[2];

        MgcVector3 m_aakXuu[2][2], m_aakXvv[2][2], m_aakXuuvv[2][2],
            m_aakXuuv[2][2], m_aakXuvv[2][2];
    };

    // subdivide rectangle into four quadrants
    void Subdivide (unsigned int uiLevel, MgcReal fDSqr, MgcVector3* akX,
        MgcVector3* akXs, MgcVector3* akXt, BlockParameters& rkBP);
};

#endif

⌨️ 快捷键说明

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