Successful DirectX context through GLFW, praise Gaben!
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef Model_h__
|
||||
#define Model_h__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <d3d11.h>
|
||||
#include "Rendering/RawModel.h"
|
||||
#include "Rendering/Renderer.h"
|
||||
#include "Core/StaticSystem.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
class Model : public RawModel
|
||||
{
|
||||
friend class ResourceManager;
|
||||
|
||||
private:
|
||||
Model(std::string fileName);
|
||||
|
||||
public:
|
||||
~Model();
|
||||
|
||||
ID3D11Buffer* VertexBuffer;
|
||||
unsigned int NumVertices;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // Model_h__
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
This file is part of Daydream Engine.
|
||||
Copyright 2014 Adam Byléhn, Tobias Dahl, Simon Holmberg, Viktor Ljung
|
||||
|
||||
Daydream Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Daydream Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Daydream Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DD_RENDERER_H__
|
||||
#define DD_RENDERER_H__
|
||||
|
||||
#include <d3d11.h>
|
||||
#pragma comment (lib, "d3d11.lib")
|
||||
#include <DirectXTK/SimpleMath.h>
|
||||
using namespace DirectX::SimpleMath;
|
||||
//#pragma comment (lib, "DirectXTK.lib")
|
||||
|
||||
#include "Rendering/BaseRenderer.h"
|
||||
#include "Core/StaticSystem.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
class Model;
|
||||
class ShaderProgram;
|
||||
|
||||
class Renderer : public BaseRenderer
|
||||
{
|
||||
public:
|
||||
~Renderer();
|
||||
|
||||
void Initialize() override;
|
||||
void Draw(RenderQueueCollection& rq) override;
|
||||
|
||||
IDXGISwapChain* m_SwapChain = nullptr;
|
||||
ID3D11Device* m_Device = nullptr;
|
||||
ID3D11DeviceContext* m_DeviceContext = nullptr;
|
||||
ID3D11RenderTargetView* m_BackBuffer = nullptr;
|
||||
ID3D11DepthStencilView* m_DepthBuffer = nullptr;
|
||||
|
||||
private:
|
||||
struct ConstantBufferStruct
|
||||
{
|
||||
Matrix MVP;
|
||||
Matrix ModelMatrix;
|
||||
Matrix ViewMatrix;
|
||||
Matrix ProjectionMatrix;
|
||||
Matrix InverseTransposeViewModel;
|
||||
Vector3 LightPosition;
|
||||
} constantBufferStruct;
|
||||
|
||||
ShaderProgram* shaderProgram = nullptr;
|
||||
const Model* testModel = nullptr;
|
||||
ID3D11Buffer* constantBuffer = nullptr;
|
||||
|
||||
DirectX::SimpleMath::Matrix GLMtoDX(glm::mat4 m);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // Renderer_h__
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef ShaderProgram_h__
|
||||
#define ShaderProgram_h__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#pragma comment (lib, "D3DCompiler.lib")
|
||||
#include "Core/StaticSystem.h"
|
||||
#include "Rendering/Renderer.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
class ShaderProgram
|
||||
{
|
||||
public:
|
||||
ShaderProgram();
|
||||
~ShaderProgram();
|
||||
|
||||
void CompileVertexShader(std::wstring filename);
|
||||
void CompilePixelShader(std::wstring filename);
|
||||
|
||||
HRESULT CreateInputLayout(D3D11_INPUT_ELEMENT_DESC* ied, UINT numElements);
|
||||
ID3D11InputLayout* GetInputLayout() const { return m_InputLayout; }
|
||||
|
||||
void Bind();
|
||||
void Unbind();
|
||||
|
||||
private:
|
||||
ID3D10Blob* m_VertexShaderBlob;
|
||||
ID3D11VertexShader* m_VertexShader;
|
||||
ID3D10Blob* m_PixelShaderBlob;
|
||||
ID3D11PixelShader* m_PixelShader;
|
||||
|
||||
ID3D11InputLayout* m_InputLayout;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // ShaderProgram_h__
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
This file is part of Daydream Engine.
|
||||
Copyright 2014 Adam Byléhn, Tobias Dahl, Simon Holmberg, Viktor Ljung
|
||||
|
||||
Daydream Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Daydream Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Daydream Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef Texture_h__
|
||||
#define Texture_h__
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <cstdio>
|
||||
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Rendering/PNG.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
class Texture : public Resource
|
||||
{
|
||||
friend class ResourceManager;
|
||||
|
||||
private:
|
||||
Texture(std::string path);
|
||||
|
||||
public:
|
||||
~Texture();
|
||||
|
||||
unsigned int Width = 0;
|
||||
unsigned int Height = 0;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // Texture_h__
|
||||
@@ -96,4 +96,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // Model_h__
|
||||
#endif
|
||||
@@ -29,6 +29,8 @@
|
||||
namespace dd
|
||||
{
|
||||
|
||||
class Model;
|
||||
class Texture;
|
||||
class RenderQueue;
|
||||
|
||||
struct RenderJob
|
||||
|
||||
Reference in New Issue
Block a user