Commit 13cc941f authored by Administrator's avatar Administrator
Browse files

Re-structure code to multiple files.

Still have issue in breaking down code to Bindable/Drawable, while in Triangle it fails in link stage.
Only able to init3D and render single color in page.
parent d86a04d1
#pragma once
#include "Bindable.h"
ID3D11DeviceContext* Bindable::GetContext(Graphics& gfx) noexcept
{
return gfx.pContext.Get();
}
ID3D11Device* Bindable::GetDevice(Graphics& gfx) noexcept
{
return gfx.pDevice.Get();
}
\ No newline at end of file
#pragma once
#include "Graphics.h"
class Bindable
{
public:
virtual void Bind(Graphics& gfx) noexcept = 0;
virtual ~Bindable() = default;
protected:
static ID3D11DeviceContext* GetContext(Graphics& gfx) noexcept;
static ID3D11Device* GetDevice(Graphics& gfx) noexcept;
};
\ No newline at end of file
#pragma once
#include "Drawable.h"
#include <cassert>
#include <typeinfo>
/*void Drawable::Draw(Graphics& gfx) const noexcept()
{
for (auto& b : binds)
{
b->Bind(gfx);
}
gfx.DrawIndexed(pIndexBuffer->GetCount());
}*/
void Drawable::AddBind(std::unique_ptr<Bindable> bind) noexcept
{
binds.push_back(std::move(bind));
}
/*void Drawable::AddIndexBuffer(std::unique_ptr<IndexBuffer> ibuf) noexcept
{
assert("Attempting to add index buffer a second time" && pIndexBuffer == nullptr);
pIndexBuffer = ibuf.get();
binds.push_back(std::move(ibuf));
}*/
#pragma once
#include "Graphics.h"
#include <DirectXMath.h>
#include <memory>
#include <vector>
#include "Bindable.h"
class Bindable;
class Drawable
{
public:
Drawable() = default;
Drawable(const Drawable&) = delete;
//virtual DirectX::XMMATRIX GetTransformXM() const noexcept = 0;
//void Draw(Graphics& gfx) const noexcept();
//virtual void Update(float dt) noexcept = 0;
void AddBind(std::unique_ptr<Bindable> bind) noexcept;
//void AddIndexBuffer(std::unique_ptr<class IndexBuffer> ibuf) noexcept;
virtual ~Drawable() = default;
private:
//const IndexBuffer* pIndexBuffer = nullptr;
std::vector<std::unique_ptr<Bindable>> binds;
};
\ No newline at end of file
#pragma once
#include "Graphics.h"
#include <iostream>
/************************************
* 构造函数Graphics
************************************/
Graphics::Graphics(HWND hWnd)
{
// 初始化D3D
InitD3D(hWnd);
}
/************************************
* 1 初始化D3D
************************************/
void Graphics::InitD3D(HWND hWnd)
{
/************************************
* 1.1 CreateDeviceAndSwapChain
************************************/
// create a struct to hold information about the swap chain
DXGI_SWAP_CHAIN_DESC scd;
// clear out the struct for use
ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));
// fill the swap chain description struct
scd.BufferCount = 1; // one back buffer
scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // use 32-bit color
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how swap chain is to be used
scd.OutputWindow = hWnd; // the window to be used
scd.SampleDesc.Count = 1; // how many multisamples
scd.Windowed = TRUE; // windowed/full-screen mode
// create a device, device context and swap chain using the information in the scd struct
D3D11CreateDeviceAndSwapChain(
NULL, // IDXGIAdapter *pAdapter - Let DXGI take care of what adapter to use (default adapter)
D3D_DRIVER_TYPE_HARDWARE, // D3D_DRIVER_TYPE DriverType - hardware or software, or others
NULL, // HMODULE Software
NULL, // UINT Flags
NULL, // D3D_FEATURE_LEVEL *pFeatureLevels
NULL, // UINT FeatureLevels
D3D11_SDK_VERSION, // UINT SDKVersion
&scd, // DXGI_SWAP_CHAIN_DESC *pSwapChainDesc
&pSwapChain, // IDXGISwapChain **ppSwapChain
&pDevice, // ID3D11Device **ppDevice
NULL, // D3D_FEATURE_LEVEL *FeatureLevel
&pContext); // ID3D11DeviceContext **ppImmediateContext
/************************************
* 1.2 DefineRenderTargetView
************************************/
Microsoft::WRL::ComPtr<ID3D11Texture2D> pBackBuffer;
// 从SwapChain中取得back buffer
pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
// 根据back buffer,创建新的View Target
pDevice->CreateRenderTargetView(pBackBuffer.Get(), NULL, &pTarget);
/************************************
* 1.3 DefineDepthStencilView
************************************/
// Define depth stencil buffer
Microsoft::WRL::ComPtr<ID3D11DepthStencilState> pDepthStencilState;
// Define depth stencil texture
Microsoft::WRL::ComPtr<ID3D11Texture2D> depthStencilTexture;
// Create depth stencil state
D3D11_DEPTH_STENCIL_DESC depthStencilDesc = {};
depthStencilDesc.DepthEnable = TRUE;
depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
// Create depth stencil state
pDevice->CreateDepthStencilState(&depthStencilDesc, &pDepthStencilState);
// bind depth state
pContext->OMSetDepthStencilState(pDepthStencilState.Get(), 1u);
// Create the depth stencil texture
D3D11_TEXTURE2D_DESC depthStencilTextureDesc = {};
depthStencilTextureDesc.Width = 800;
depthStencilTextureDesc.Height = 600;
depthStencilTextureDesc.MipLevels = 1u;
depthStencilTextureDesc.ArraySize = 1u;
depthStencilTextureDesc.Format = DXGI_FORMAT_D32_FLOAT;
depthStencilTextureDesc.SampleDesc.Count = 1u;
depthStencilTextureDesc.SampleDesc.Quality = 0u;
depthStencilTextureDesc.Usage = D3D11_USAGE_DEFAULT;
depthStencilTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
// Create texture
pDevice->CreateTexture2D(&depthStencilTextureDesc, nullptr, &depthStencilTexture);
// Create the depth stencil view
D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc = {};
depthStencilViewDesc.Format = DXGI_FORMAT_D32_FLOAT;
depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
depthStencilViewDesc.Texture2D.MipSlice = 0u;
pDevice->CreateDepthStencilView(depthStencilTexture.Get(), &depthStencilViewDesc, &pDSView);
/************************************
* 1.4 DefineRenderTarget
************************************/
// 将渲染目标设置成我们新创建的View Target
pContext->OMSetRenderTargets(1u, pTarget.GetAddressOf(), pDSView.Get());
}
/************************************
* 2 渲染单帧
************************************/
void Graphics::RendorFrame(void)
{
/************************************
* 2.1 ClearRenderTargetView
************************************/
// clear the back buffer to a deep blue
const float color[] = { 0.0f, 0.2f, 0.4f, 1.0f };
pContext->ClearRenderTargetView(pTarget.Get(), color);
/************************************
* 2.2 ClearDepthStencilViews
************************************/
// clear the depth stencil view
pContext->ClearDepthStencilView(pDSView.Get(), D3D11_CLEAR_DEPTH, 1.0f, 0u);
/************************************
* 2.3 - 2.12 Repeat graphic objects
************************************/
// do 3D rendering on the back buffer here
//drawObjects();
/************************************
* 3 DrawPrimitive
************************************/
// switch the back buffer and the front buffer
// 切换显示,将back buffer的内容交换到front buffer
pSwapChain->Present(0, 0);
}
\ No newline at end of file
#pragma once
#include <d3d11.h>
#include <wrl.h>
namespace wrl = Microsoft::WRL;
class Graphics
{
friend class Bindable;
public:
// 构造函数
Graphics(HWND hWnd);
// 单例设计模式,禁止复制
Graphics(const Graphics&) = delete;
Graphics& operator=(const Graphics&) = delete;
~Graphics() = default;
// 初始化3大件,Device/SwapChain/deviceContext
void InitD3D(HWND hWnd);
void RendorFrame(void);
//void drawObjects();
private:
// 指向Device的指针
wrl::ComPtr<ID3D11Device> pDevice;
// 指向交换链的指针
wrl::ComPtr<IDXGISwapChain> pSwapChain;
// 指向Context的指针
wrl::ComPtr<ID3D11DeviceContext> pContext;
// 指向View的指针
wrl::ComPtr<ID3D11RenderTargetView> pTarget;
// 指向Depth Buffer View的指针
wrl::ComPtr<ID3D11DepthStencilView> pDSView;
};
\ No newline at end of file
#pragma once
#include "MyGraphics.h"
#include <iostream>
/************************************
* 构造函数Graphics
************************************/
MyGraphics::MyGraphics(HWND hWnd)
{
// 初始化D3D
InitD3D(hWnd);
}
/************************************
* 1 初始化D3D
************************************/
void MyGraphics::InitD3D(HWND hWnd)
{
/************************************
* 1.1 CreateDeviceAndSwapChain
************************************/
// create a struct to hold information about the swap chain
DXGI_SWAP_CHAIN_DESC scd;
// clear out the struct for use
ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));
// fill the swap chain description struct
scd.BufferCount = 1; // one back buffer
scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // use 32-bit color
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how swap chain is to be used
scd.OutputWindow = hWnd; // the window to be used
scd.SampleDesc.Count = 1; // how many multisamples
scd.Windowed = TRUE; // windowed/full-screen mode
// create a device, device context and swap chain using the information in the scd struct
D3D11CreateDeviceAndSwapChain(
NULL, // IDXGIAdapter *pAdapter - Let DXGI take care of what adapter to use (default adapter)
D3D_DRIVER_TYPE_HARDWARE, // D3D_DRIVER_TYPE DriverType - hardware or software, or others
NULL, // HMODULE Software
NULL, // UINT Flags
NULL, // D3D_FEATURE_LEVEL *pFeatureLevels
NULL, // UINT FeatureLevels
D3D11_SDK_VERSION, // UINT SDKVersion
&scd, // DXGI_SWAP_CHAIN_DESC *pSwapChainDesc
&pSwapChain, // IDXGISwapChain **ppSwapChain
&pDevice, // ID3D11Device **ppDevice
NULL, // D3D_FEATURE_LEVEL *FeatureLevel
&pContext); // ID3D11DeviceContext **ppImmediateContext
/************************************
* 1.2 DefineRenderTargetView
************************************/
Microsoft::WRL::ComPtr<ID3D11Texture2D> pBackBuffer;
// 从SwapChain中取得back buffer
pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
// 根据back buffer,创建新的View Target
pDevice->CreateRenderTargetView(pBackBuffer.Get(), NULL, &pTarget);
/************************************
* 1.3 DefineDepthStencilView
************************************/
// Define depth stencil buffer
Microsoft::WRL::ComPtr<ID3D11DepthStencilState> pDepthStencilState;
// Define depth stencil texture
Microsoft::WRL::ComPtr<ID3D11Texture2D> depthStencilTexture;
// Create depth stencil state
D3D11_DEPTH_STENCIL_DESC depthStencilDesc = {};
depthStencilDesc.DepthEnable = TRUE;
depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
// Create depth stencil state
pDevice->CreateDepthStencilState(&depthStencilDesc, &pDepthStencilState);
// bind depth state
pContext->OMSetDepthStencilState(pDepthStencilState.Get(), 1u);
// Create the depth stencil texture
D3D11_TEXTURE2D_DESC depthStencilTextureDesc = {};
depthStencilTextureDesc.Width = 800;
depthStencilTextureDesc.Height = 600;
depthStencilTextureDesc.MipLevels = 1u;
depthStencilTextureDesc.ArraySize = 1u;
depthStencilTextureDesc.Format = DXGI_FORMAT_D32_FLOAT;
depthStencilTextureDesc.SampleDesc.Count = 1u;
depthStencilTextureDesc.SampleDesc.Quality = 0u;
depthStencilTextureDesc.Usage = D3D11_USAGE_DEFAULT;
depthStencilTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
// Create texture
pDevice->CreateTexture2D(&depthStencilTextureDesc, nullptr, &depthStencilTexture);
// Create the depth stencil view
D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc = {};
depthStencilViewDesc.Format = DXGI_FORMAT_D32_FLOAT;
depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
depthStencilViewDesc.Texture2D.MipSlice = 0u;
pDevice->CreateDepthStencilView(depthStencilTexture.Get(), &depthStencilViewDesc, &pDSView);
/************************************
* 1.4 DefineRenderTarget
************************************/
// 将渲染目标设置成我们新创建的View Target
pContext->OMSetRenderTargets(1u, pTarget.GetAddressOf(), pDSView.Get());
}
/************************************
* 2 渲染单帧
************************************/
void MyGraphics::RendorFrame(void)
{
/************************************
* 2.1 ClearRenderTargetView
************************************/
// clear the back buffer to a deep blue
const float color[] = { 0.0f, 0.2f, 0.4f, 1.0f };
pContext->ClearRenderTargetView(pTarget.Get(), color);
/************************************
* 2.2 ClearDepthStencilViews
************************************/
// clear the depth stencil view
pContext->ClearDepthStencilView(pDSView.Get(), D3D11_CLEAR_DEPTH, 1.0f, 0u);
/************************************
* 2.3 - 2.12 Repeat graphic objects
************************************/
// do 3D rendering on the back buffer here
//drawObjects();
/************************************
* 3 DrawPrimitive
************************************/
// switch the back buffer and the front buffer
// 切换显示,将back buffer的内容交换到front buffer
pSwapChain->Present(0, 0);
}
\ No newline at end of file
#pragma once
#include <d3d11.h>
#include <wrl.h>
namespace wrl = Microsoft::WRL;
class MyGraphics
{
friend class Bindable;
public:
// 构造函数
MyGraphics(HWND hWnd);
// 单例设计模式,禁止复制
MyGraphics(const MyGraphics&) = delete;
MyGraphics& operator=(const MyGraphics&) = delete;
~MyGraphics() = default;
// 初始化3大件,Device/SwapChain/deviceContext
void InitD3D(HWND hWnd);
void RendorFrame(void);
//void drawObjects();
private:
// 指向Device的指针
wrl::ComPtr<ID3D11Device> pDevice;
// 指向交换链的指针
wrl::ComPtr<IDXGISwapChain> pSwapChain;
// 指向Context的指针
wrl::ComPtr<ID3D11DeviceContext> pContext;
// 指向View的指针
wrl::ComPtr<ID3D11RenderTargetView> pTarget;
// 指向Depth Buffer View的指针
wrl::ComPtr<ID3D11DepthStencilView> pDSView;
};
\ No newline at end of file
......@@ -127,7 +127,14 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Bindable.cpp" />
<ClCompile Include="Drawable.cpp" />
<ClCompile Include="Graphics.cpp" />
<ClCompile Include="Graphics.h" />
<ClCompile Include="MyGraphics.cpp" />
<ClCompile Include="Timer.cpp" />
<ClCompile Include="Triangle.cpp" />
<ClCompile Include="VertexBuffer.cpp" />
<ClCompile Include="WinMain.cpp" />
</ItemGroup>
<ItemGroup>
......@@ -151,7 +158,12 @@
</FxCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Bindable.h" />
<ClInclude Include="Drawable.h" />
<ClInclude Include="MyGraphics.h" />
<ClInclude Include="Timer.h" />
<ClInclude Include="Triangle.h" />
<ClInclude Include="VertexBuffer.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
......
......@@ -24,6 +24,27 @@
<ClCompile Include="Timer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Graphics.h">
<Filter>Header Files</Filter>
</ClCompile>
<ClCompile Include="Graphics.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Bindable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Triangle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="VertexBuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Drawable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyGraphics.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile Include="PixelShader.hlsl">
......@@ -37,5 +58,20 @@
<ClInclude Include="Timer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bindable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Triangle.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Drawable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VertexBuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyGraphics.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
#pragma once
#include "Triangle.h"
#include "Bindable.h"
#include "VertexBuffer.h"
Triangle::Triangle(Graphics& gfx, float** position, float r, float g, float b)
:
r(r),
g(g),
b(b),
position(position)
{
struct Vertex
{
struct
{
float x;
float y;
float z;
} pos;
};
const std::vector<Vertex> vertices =
{
{ position[0][0], position[0][1], position[0][2] },
{ position[1][0], position[1][1], position[1][2] },
{ position[2][0], position[2][1], position[2][2] }
};
//VertexBuffer vb(gfx, vertices);
//AddBind(std::make_unique<VertexBuffer>(gfx, vertices));
/*
auto pvs = std::make_unique<VertexShader>(gfx, L"VertexShader.cso");
auto pvsbc = pvs->GetBytecode();
AddBind(std::move(pvs));
AddBind(std::make_unique<PixelShader>(gfx, L"PixelShader.cso"));
const std::vector<unsigned short> indices =
{
0,2,1, 2,3,1,
1,3,5, 3,7,5,
2,6,3, 3,6,7,
4,5,7, 4,7,6,
0,4,2, 2,4,6,
0,1,4, 1,5,4
};
AddIndexBuffer(std::make_unique<IndexBuffer>(gfx, indices));
struct ConstantBuffer2
{
struct
{
float r;
float g;
float b;
float a;
} face_colors[6];
};
const ConstantBuffer2 cb2 =
{
{
{ 1.0f,0.0f,1.0f },
{ 1.0f,0.0f,0.0f },
{ 0.0f,1.0f,0.0f },
{ 0.0f,0.0f,1.0f },
{ 1.0f,1.0f,0.0f },
{ 0.0f,1.0f,1.0f },
}
};
AddBind(std::make_unique<PixelConstantBuffer<ConstantBuffer2>>(gfx, cb2));
const std::vector<D3D11_INPUT_ELEMENT_DESC> ied =
{
{ "Position",0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 },
};
AddBind(std::make_unique<InputLayout>(gfx, ied, pvsbc));
AddBind(std::make_unique<Topology>(gfx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST));
AddBind(std::make_unique<TransformCbuf>(gfx, *this));
*/
}
/*
void Box::Update(float dt) noexcept
{
roll += droll * dt;
pitch += dpitch * dt;
yaw += dyaw * dt;
theta += dtheta * dt;
phi += dphi * dt;
chi += dchi * dt;
}
DirectX::XMMATRIX Box::GetTransformXM() const noexcept
{
return DirectX::XMMatrixRotationRollPitchYaw(pitch, yaw, roll) *
DirectX::XMMatrixTranslation(r, 0.0f, 0.0f) *
DirectX::XMMatrixRotationRollPitchYaw(theta, phi, chi) *
DirectX::XMMatrixTranslation(0.0f, 0.0f, 20.0f);
}
*/
#pragma once
#include "Drawable.h"
class Triangle : public Drawable
{
public:
Triangle(Graphics& gfx, float** position, float r, float g, float b);
//DirectX::XMMATRIX GetTransformXM() const noexcept override;
private:
// positional
float** position;
// color
float r;
float g;
float b;
};
\ No newline at end of file
#pragma once
#include "VertexBuffer.h"
template<class V>
VertexBuffer::VertexBuffer(Graphics& gfx, const std::vector<V>& vertices)
:
stride(sizeof(V))
{
D3D11_BUFFER_DESC bd = {};
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.Usage = D3D11_USAGE_DEFAULT;
bd.CPUAccessFlags = 0u;
bd.MiscFlags = 0u;
bd.ByteWidth = UINT(sizeof(V) * vertices.size());
bd.StructureByteStride = sizeof(V);
D3D11_SUBRESOURCE_DATA sd = {};
sd.pSysMem = vertices.data();
GetDevice(gfx)->CreateBuffer(&bd, &sd, &pVertexBuffer);
}
void VertexBuffer::Bind(Graphics& gfx) noexcept
{
const UINT offset = 0u;
GetContext(gfx)->IASetVertexBuffers(0u, 1u, pVertexBuffer.GetAddressOf(), &stride, &offset);
}
#pragma once
#include "Bindable.h"
#include <wrl.h>
#include <d3d11.h>
#include <vector>
class VertexBuffer : public Bindable
{
public:
template<class V>
VertexBuffer(Graphics& gfx, const std::vector<V>& vertices);
void Bind(Graphics& gfx) noexcept override;
protected:
UINT stride;
Microsoft::WRL::ComPtr<ID3D11Buffer> pVertexBuffer;
};
......@@ -17,6 +17,10 @@ namespace dx = DirectX;
#include "Timer.h" // to use timer
Timer timer;
#include "Graphics.h"
#include "MyGraphics.h"
#include <memory>
/************************************
* 1.1 CreateDeviceAndSwapChain
************************************/
......@@ -649,24 +653,28 @@ int WINAPI WinMain(HINSTANCE hInstance,
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); // adjust the size
// create the window and use the result as the handle
hWnd = CreateWindowEx(NULL,
"WindowClass", // name of the window class
"Our First Windowed Program", // title of the window
hWnd = CreateWindowEx(
NULL,
"WindowClass", // name of the window class
"Oasis Demo", // title of the window
WS_OVERLAPPEDWINDOW, // window style
300, // x-position of the window
200, // y-position of the window
800, // width of the window
600, // height of the window
NULL, // we have no parent window, NULL
NULL, // we aren't using menus, NULL
hInstance, // application handle
NULL); // used with multiple windows, NULL
300, // x-position of the window
200, // y-position of the window
800, // width of the window
600, // height of the window
NULL, // we have no parent window, NULL
NULL, // we aren't using menus, NULL
hInstance, // application handle
NULL); // used with multiple windows, NULL
// display the window on the screen
ShowWindow(hWnd, nCmdShow);
// set up and initialize Direct3D
InitD3D(hWnd);
//InitD3D(hWnd);
//std::unique_ptr<Graphics> pGfx = std::make_unique<Graphics>(hWnd);
MyGraphics gfx(hWnd);
//Graphics gfx2(hWnd);
// enter the main loop:
......@@ -692,7 +700,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
}
else
{
RenderFrame();
//RenderFrame();
gfx.RendorFrame();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment