view Engine/Graphics/RenderD3D11.h @ 2496:5abd8fc8f1c6

for ITEM_ARTIFACT_LADYS_ESCORT
author Ritor1
date Thu, 18 Sep 2014 17:38:54 +0600
parents
children 68cdef6879a0
line wrap: on
line source

#pragma once

#include <cstdint>
#include <cstdio>

#include "lib\legacy_dx\d3d.h"
#include <d3d11.h>

#include "OSWindow.h"
#include "RenderStruct.h"

#include "VectorTypes.h"

#include "IRender.h"

struct RenderD3D11: public IRender
{
  RenderD3D11();
  virtual ~RenderD3D11();

  static RenderD3D11 *Create() {return new RenderD3D11;}

  virtual bool Initialize(OSWindow *window);

  virtual void ClearBlack();
  virtual void PresentBlackScreen();

  virtual void SaveWinnersCertificate(const char *a1);
  virtual void ClearTarget(unsigned int uColor);
  virtual void Present();

  virtual void _49FD3A_fullscreen();
  virtual bool InitializeFullscreen();

  virtual void CreateZBuffer();
  virtual void Release();

  virtual bool SwitchToWindow();
  virtual void RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor);
  virtual void ClearZBuffer(int a2, int a3);
  virtual void SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
  virtual bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags);
  virtual void GetTargetPixelFormat(DDPIXELFORMAT *pOut);
  virtual void LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow);
  virtual void UnlockBackBuffer();
  virtual void LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow);
  virtual void UnlockFrontBuffer();
  virtual void RestoreFrontBuffer();
  virtual void RestoreBackBuffer();
  virtual void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags);
  virtual void BltBackToFontFast(int a2, int a3, RECT *pSrcRect);
  virtual void BeginSceneD3D();

  virtual unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6);

  virtual void DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture);
  virtual void DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders);
  virtual void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8);

  virtual void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
  virtual void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);

  virtual void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
  virtual void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level);
  virtual void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse);
  virtual void TransformBillboardsAndSetPalettesODM();
  virtual void DrawBillboardList_BLV();

  virtual void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9);
  virtual bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture);
  virtual bool MoveSpriteToDevice(Sprite *pSprite);

  virtual void BeginScene();
  virtual void EndScene();
  virtual void ScreenFade(unsigned int color, float t);

  virtual void SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
  virtual void ResetTextureClipRect();
  virtual void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
  virtual void CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture);
  virtual void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4);

  virtual void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
  virtual void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
  virtual void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture);
  virtual void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
  virtual void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);

  virtual void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4);
  virtual void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture);
  virtual void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices);

  virtual void DrawMasked(signed int a2, signed int a3, struct Texture *pTexture, unsigned __int16 mask);
  virtual void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height);

  virtual void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
  virtual void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor);

  virtual void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16);
  virtual void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7);
  virtual void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture *a4);

  virtual void DrawBuildingsD3D();

  virtual void DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID);
  virtual void DrawOutdoorSkyD3D();
  virtual void DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);
  virtual void DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);

  virtual void PrepareDecorationsRenderList_ODM();
  virtual void DrawSpriteObjects_ODM();

  virtual void RenderTerrainD3D();

  virtual void ChangeBetweenWinFullscreenModes();
  virtual bool AreRenderSurfacesOk();
  virtual bool IsGammaSupported();

  virtual void SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height);
  virtual void PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size);
  virtual void SavePCXScreenshot();

  virtual int _46À6ÀÑ_GetActorsInViewport(int pDepth);

  virtual void BeginLightmaps();
  virtual void EndLightmaps();  
  virtual void BeginLightmaps2();
  virtual void EndLightmaps2();
  virtual bool DrawLightmap(struct Lightmap *pLightmap, struct Vec3_float_ *pColorMult, float z_bias);

  virtual void BeginDecals();
  virtual void EndDecals();
  virtual void DrawDecal(struct Decal *pDecal, float z_bias);
  
  virtual void do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff);
  virtual void DrawLines(const RenderVertexD3D3 *vertices, unsigned int num_vertices);

  virtual void DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture);

  virtual void am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
  virtual void am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode);

  public:

    virtual void WritePixel16(int x, int y, unsigned __int16 color)
    {
__debugbreak();
    }

    virtual unsigned __int16 ReadPixel16(int x, int y)
    {
__debugbreak(); return 0;
    }

    virtual void ToggleTint()          {}
    virtual void ToggleColoredLights() {}

    virtual unsigned int GetRenderWidth() {return window->GetWidth();}
    virtual unsigned int GetRenderHeight() {return window->GetHeight();}

    virtual void Sub01();


  protected:
    OSWindow *window;

    IDXGISwapChain          *pSwapChain;
    ID3D11Device            *d3dd;
    ID3D11DeviceContext     *d3dc;
    ID3D11RenderTargetView  *primary_srv;
    ID3D11DepthStencilView  *depth_srv;
};