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

📄 mgcbezierrectangle2g.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 MGCBEZIERRECTANGLE2G_H
#define MGCBEZIERRECTANGLE2G_H

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


class MgcBezierRectangle2G : public MgcBezierRectangleG
{
public:
    // Construction.  MgcBezierRectangle2G accepts responsibility for deleting
    // the input array.
    MgcBezierRectangle2G (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;

        // Xuu(0,0), Xuu(0,1), Xuu(1,0) = Xuu(0,0), Xuu(1,1) = Xuu(0,1)
        MgcVector3 m_akXuu[2];

        // Xvv(0,0), Xvv(1,0), Xvv(0,1) = Xvv(0,0), Xvv(1,1) = Xvv(1,0)
        MgcVector3 m_akXvv[2];

        // Xuuv(0,0), Xuuv(0,1), Xuuv(1,0) = Xuuv(0,0), Xuuv(1,1) = Xuuv(0,1)
        MgcVector3 m_akXuuv[2];

        // Xuvv(0,0), Xuvv(1,0), Xuvv(0,1) = Xuvv(0,0), Xuvv(1,1) = Xuvv(1,0)
        MgcVector3 m_akXuvv[2];
    };

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

#endif

⌨️ 快捷键说明

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