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

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

#ifndef MGCOGLRENDERER_H
#define MGCOGLRENDERER_H

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "MgcOglCamera.h"
#include "MgcRenderer.h"
class MgcPolyline;
class MgcTriMesh;


class MgcOglRenderer : public MgcRenderer
{
    MgcDeclareRTTI;
    MgcDeclareStream;

public:
    // construction and destruction
    MgcOglRenderer (HWND hWnd, int iWidth, int iHeight);
    virtual ~MgcOglRenderer ();

    void GetDriverInformation ();

    virtual void SetBackgroundColor (const MgcColor& rkColor);
    virtual void ClearBackBuffer ();
    virtual void DisplayBackBuffer ();
    virtual void ClearZBuffer ();
    virtual void ClearBuffers ();

    virtual void Draw (const MgcTriMesh& rkMesh);
    virtual void Draw (const MgcPolyline& rkLine);

    // for use in deferred renderer creation when loading renderer from stream
    MgcOglRenderer ();
    void CreateRenderer (HWND hWnd);

protected:
    // state management
    virtual void InitializeState ();
    virtual void SetAlphaState (MgcAlphaState* pkState);
    virtual void SetDitherState (MgcDitherState* pkState);
    virtual void SetFogState (MgcFogState* pkState);
    virtual void SetLightState (MgcLightState* pkState);
    virtual void SetMaterialState (MgcMaterialState* pkState);
    virtual void SetShadeState (MgcShadeState* pkState);
    virtual void SetTextureState (MgcTextureState* pkState);
    virtual void SetVertexColorState (MgcVertexColorState* pkState);
    virtual void SetWireframeState (MgcWireframeState* pkState);
    virtual void SetZBufferState (MgcZBufferState* pkState);

    // window parameters
    HWND m_hWnd;
    HDC m_hWindowDC;
    HGLRC m_hWindowRC;

    // maps from Magic enums to OpenGL enums
    static GLenum ms_aeAlphaSrcBlend[MgcAlphaState::SBF_QUANTITY];
    static GLenum ms_aeAlphaDstBlend[MgcAlphaState::DBF_QUANTITY];
    static GLenum ms_aeAlphaTest[MgcAlphaState::TF_QUANTITY];
    static GLenum ms_aeFogDensity[MgcFogState::DF_QUANTITY];
    static GLenum ms_aeFogApply[MgcFogState::AF_QUANTITY];
    static GLenum ms_aeShade[MgcShadeState::SM_QUANTITY];
    static GLenum ms_aeTextureCorrection[MgcTexture::CM_QUANTITY];
    static GLenum ms_aeTextureApply[MgcTexture::AM_QUANTITY];
    static GLenum ms_aeTextureFilter[MgcTexture::FM_QUANTITY];
    static GLenum ms_aeTextureMipmap[MgcTexture::MM_QUANTITY];
    static GLenum ms_aeImageComponents[MgcImage::IT_QUANTITY];
    static GLenum ms_aeImageFormats[MgcImage::IT_QUANTITY];
    static GLenum ms_aeZBufferCompare[MgcZBufferState::CF_QUANTITY];

    // for debugging
    bool OperationOkay ();
};

MgcSmartPointer(MgcOglRenderer);
MgcRegisterStream(MgcOglRenderer);

#endif

⌨️ 快捷键说明

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