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

📄 mgcgeometry.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
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf

#ifndef MGCGEOMETRY_H
#define MGCGEOMETRY_H

#include "MgcSpatial.h"
#include "MgcColor.h"
#include "MgcVector2.h"


class MgcGeometry : public MgcSpatial
{
    MgcDeclareRTTI;
    MgcDeclareStream;

public:
    virtual ~MgcGeometry ();

    // vertex access
    unsigned int GetVertexQuantity () const;
    MgcVector3& Vertex (unsigned int uiV);
    const MgcVector3& Vertex (unsigned int uiV) const;
    MgcVector3* Vertices ();
    const MgcVector3* Vertices () const;

    // normal vector access
    MgcVector3& Normal (unsigned int uiV);
    const MgcVector3& Normal (unsigned int uiV) const;
    MgcVector3* Normals ();
    const MgcVector3* Normals () const;

    // color access
    MgcColor& Color (unsigned int uiV);
    const MgcColor& Color (unsigned int uiV) const;
    MgcColor* Colors ();
    const MgcColor* Colors () const;

    // texture coordinate access
    MgcVector2& Texture (unsigned int uiV);
    const MgcVector2& Texture (unsigned int uiV) const;
    MgcVector2* Textures ();
    const MgcVector2* Textures () const;

    // bounding sphere access
    MgcBound& ModelBound ();
    const MgcBound& ModelBound () const;

    // geometric updates
    virtual void UpdateModelBound ();
    virtual void UpdateWorldBound ();
    virtual void UpdateModelNormals ();

protected:
    // Construction and destruction.  MgcGeometry accepts responsibility for
    // deleting the input arrays.
    MgcGeometry (unsigned int uiVertexQuantity, MgcVector3* akVertex,
        MgcVector3* akNormal, MgcColor* akColor, MgcVector2* akTexture);

    MgcGeometry ();

    void Reconstruct (unsigned int uiVertexQuantity);

    // The reconstruction allows you to change only individual arrays.  You
    // do this by passing in the current array pointers for any arrays you
    // want to preserve.
    void Reconstruct (unsigned int uiVertexQuantity, MgcVector3* akVertex,
        MgcVector3* akNormal, MgcColor* akColor, MgcVector2* akTexture);

    // render state update
    virtual void UpdateRenderState (MgcRenderState* apkState[]);

    // drawing
    virtual void Draw (MgcRenderer& rkRenderer);

    // vertices and attributes
    unsigned int m_uiVertexQuantity;
    MgcVector3* m_akVertex;
    MgcVector3* m_akNormal;
    MgcColor* m_akColor;
    MgcVector2* m_akTexture;

    // model bound
    MgcBound m_kBound;

    // render state
    MgcRenderStatePtr m_aspkState[MgcRenderState::RS_MAX_STATE];
};

MgcSmartPointer(MgcGeometry);
MgcRegisterStream(MgcGeometry);
#include "MgcGeometry.inl"

#endif

⌨️ 快捷键说明

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