Program Listing for File rendering.h

Return to documentation for file (blam\components\rendering\rendering.h)

#pragma once

#include <Windows.h>
#include <d3d11_1.h>
#include <d2d1_1.h>
#include <dwrite.h>
#include <string>

#include "components/3rdparty/imgui/imgui.h"

#ifndef BLAM
#define BLAM
#endif

namespace BlamRendering
{
    namespace DirectX
    {
        namespace D2D
        {
            BLAM ID2D1DeviceContext*  GetD2DRenderTarget();

            BLAM ID2D1Factory*        GetD2DFactory();

            BLAM IDWriteFactory*      GetDWriteFactory();

            BLAM HRESULT              LoadFontFromFile(std::string id, std::string file_path);
        }

        namespace WIC
        {
            BLAM IWICImagingFactory*  GetWICFactory();

            BLAM HRESULT              CreateD2DBitmapFromResource(int res_id, const char* res_type, ID2D1Bitmap **bitmap_pointer);

            BLAM HRESULT              CreateD2DBitmapFromFile(std::wstring path, ID2D1Bitmap **bitmap_pointer);

            BLAM HRESULT              CreateWICBitmapFromFile(std::wstring path, IWICBitmap** bitmap_pointer);

            BLAM HRESULT              CreateWICBitmapFromMemory(void* data, int size, IWICBitmap** bitmap_pointer);

            BLAM HRESULT              ConvertWICBitmapToD2D(IWICBitmap* wic_bitmap, ID2D1Bitmap** d2d_bitmap);

            BLAM HRESULT              ConvertWICBitmapToD2D(IWICBitmap* wic_bitmap, ID2D1Bitmap** d2d_bitmap, ID2D1RenderTarget* render_target);

            BLAM HRESULT              ConvertWICBitmapTo32bppPBGRA(IWICBitmap* source, IWICBitmap** destination);

            BLAM HRESULT              Initialize();

            BLAM void                 Shutdown();
        }

        BLAM ID3D11Device*            GetD3DDevice();

        BLAM ID3D11DeviceContext*     GetD3DContext();

        BLAM IDXGISwapChain*          GetDXGISwapChain();

        BLAM ID3D11RenderTargetView*  GetD3DRenderTargetView();

        BLAM DXGI_SWAP_CHAIN_DESC     GetSwapChainDesc();

        BLAM HRESULT                  Initialize(HWND hWnd);

        BLAM void                     Cleanup();

        BLAM HRESULT                  HandleWindowResize(LPARAM lParam);

        BLAM bool*                    RenderTargetClearing();

        BLAM void                     RenderLoop(bool debug);

        BLAM void                     ShutdownRenderThread();

        BLAM void                     RenderThread(bool debug);

        BLAM bool                     HasRenderThreadStopped();

        BLAM void                     SetClearColor(ImVec4 color);

        BLAM ImVec4*                  GetClearColor();

        BLAM HRESULT                  UpdateResolution(int x, int y);

        BLAM ID3D11Texture2D**        GetLastFrameTexture();

        BLAM HRESULT                  GetLastFrameTextureAlt(ID3D11Texture2D* texture);

        BLAM void                     ScreenshotDone();

        BLAM HRESULT                  GetLastFrameHResult();

        BLAM void                     ShowCrashScreen(std::string message, const char *str, const char *file, int line);
    }

    namespace OpenGL
    {
        //TBA
    }

    // Abstract/Shared Functions, these will usually interface with the active graphics API themselves //

    BLAM void                         SetClearColor(ImVec4 color);

    BLAM void                         ShowCrashScreen(const char* exc, const char* file, int line, std::string message);

    BLAM HRESULT                      SetDisplayRes(int x, int y); //Sets screen resolution
}

namespace Blam
{
    BLAM void                         TakeScreenshot();
}