Minor - Refactor name - V10.5.0
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
class CelshadeClass
|
||||
{
|
||||
|
||||
private :
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct CameraBufferType
|
||||
{
|
||||
XMFLOAT3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct SunLightBufferType
|
||||
{
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT4 ambientColor;
|
||||
XMFLOAT3 sunDirection;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
|
||||
public :
|
||||
CelshadeClass();
|
||||
CelshadeClass(const CelshadeClass&);
|
||||
~CelshadeClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext* deviceContex, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection,float intensity);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 ambientColor, XMFLOAT4 diffuseColor, XMFLOAT3 lightDirection, float sunIntensity);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11Buffer* m_cameraBuffer;
|
||||
ID3D11Buffer* m_sunlightBuffer;
|
||||
ID3D11Buffer* m_sunlightColorBuffer;
|
||||
ID3D11Buffer* m_sunlightPositionBuffer;
|
||||
};
|
||||
@@ -1,59 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: multitextureshaderclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _MULTITEXTURESHADERCLASS_H_
|
||||
#define _MULTITEXTURESHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: MultiTextureShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class MultiTextureShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
MultiTextureShaderClass();
|
||||
MultiTextureShaderClass(const MultiTextureShaderClass&);
|
||||
~MultiTextureShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
55
enginecustom/src/inc/shader/alpha_map_shader_class.h
Normal file
55
enginecustom/src/inc/shader/alpha_map_shader_class.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef _ALPHAMAPSHADERCLASS_H_
|
||||
#define _ALPHAMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: alpha_map_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class alpha_map_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
alpha_map_shader_class();
|
||||
alpha_map_shader_class(const alpha_map_shader_class&);
|
||||
~alpha_map_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
#ifndef _ALPHAMAPSHADERCLASS_H_
|
||||
#define _ALPHAMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: AlphaMapShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class AlphaMapShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
AlphaMapShaderClass();
|
||||
AlphaMapShaderClass(const AlphaMapShaderClass&);
|
||||
~AlphaMapShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
};
|
||||
|
||||
#endif
|
||||
85
enginecustom/src/inc/shader/celshade_class.h
Normal file
85
enginecustom/src/inc/shader/celshade_class.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
class celshade_class
|
||||
{
|
||||
|
||||
private :
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct camera_buffer_type
|
||||
{
|
||||
XMFLOAT3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct sun_light_buffer_type
|
||||
{
|
||||
XMFLOAT4 diffuse_color;
|
||||
XMFLOAT4 ambient_color;
|
||||
XMFLOAT3 sun_direction;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
|
||||
public :
|
||||
celshade_class();
|
||||
celshade_class(const celshade_class&);
|
||||
~celshade_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(
|
||||
ID3D11DeviceContext* device_context,
|
||||
int index_count,
|
||||
XMMATRIX world_matrix,
|
||||
XMMATRIX view_matrix, XMMATRIX
|
||||
projection_matrix,
|
||||
ID3D11ShaderResourceView* texture,
|
||||
XMFLOAT4 diffuse_color,
|
||||
XMFLOAT4 ambient_color,
|
||||
XMFLOAT3 sun_direction,
|
||||
float intensity
|
||||
);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(
|
||||
ID3D11DeviceContext* device_context,
|
||||
XMMATRIX world_matrix,
|
||||
XMMATRIX view_matrix,
|
||||
XMMATRIX projection_matrix,
|
||||
ID3D11ShaderResourceView* texture,
|
||||
XMFLOAT4 ambient_color,
|
||||
XMFLOAT4 diffuse_color,
|
||||
XMFLOAT3 light_direction,
|
||||
float sun_intensity
|
||||
);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11Buffer* camera_buffer_;
|
||||
ID3D11Buffer* sunlight_buffer_;
|
||||
ID3D11Buffer* sunlight_color_buffer_;
|
||||
ID3D11Buffer* sunlight_position_buffer_;
|
||||
};
|
||||
@@ -18,12 +18,12 @@ using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: ColorShaderClass
|
||||
// Class name: color_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class ColorShaderClass
|
||||
class color_shader_class
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
@@ -31,27 +31,27 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
ColorShaderClass();
|
||||
ColorShaderClass(const ColorShaderClass&);
|
||||
~ColorShaderClass();
|
||||
color_shader_class();
|
||||
color_shader_class(const color_shader_class&);
|
||||
~color_shader_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX);
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
};
|
||||
|
||||
#endif
|
||||
62
enginecustom/src/inc/shader/font_shader_class.h
Normal file
62
enginecustom/src/inc/shader/font_shader_class.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef _FONTSHADERCLASS_H_
|
||||
#define _FONTSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: font_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class font_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct pixel_buffer_type
|
||||
{
|
||||
XMFLOAT4 pixelColor;
|
||||
};
|
||||
|
||||
public:
|
||||
font_shader_class();
|
||||
font_shader_class(const font_shader_class&);
|
||||
~font_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* pixel_buffer_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef _FONTSHADERCLASS_H_
|
||||
#define _FONTSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: FontShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class FontShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct PixelBufferType
|
||||
{
|
||||
XMFLOAT4 pixelColor;
|
||||
};
|
||||
|
||||
public:
|
||||
FontShaderClass();
|
||||
FontShaderClass(const FontShaderClass&);
|
||||
~FontShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_pixelBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
57
enginecustom/src/inc/shader/light_map_shader_class.h
Normal file
57
enginecustom/src/inc/shader/light_map_shader_class.h
Normal file
@@ -0,0 +1,57 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _LIGHTMAPSHADERCLASS_H_
|
||||
#define _LIGHTMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: light_map_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class light_map_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
light_map_shader_class();
|
||||
light_map_shader_class(const light_map_shader_class&);
|
||||
~light_map_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
92
enginecustom/src/inc/shader/light_shader_class.h
Normal file
92
enginecustom/src/inc/shader/light_shader_class.h
Normal file
@@ -0,0 +1,92 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: lightshaderclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _LIGHTSHADERCLASS_H_
|
||||
#define _LIGHTSHADERCLASS_H_
|
||||
#pragma once
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
constexpr int num_lights = 4;
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: light_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class light_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct camera_buffer_type
|
||||
{
|
||||
XMFLOAT3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct light_buffer_type
|
||||
{
|
||||
XMFLOAT4 ambientColor;
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT3 lightDirection;
|
||||
float padding; // Added extra padding so structure is a multiple of 16 for CreateBuffer function requirements.
|
||||
float specularPower;
|
||||
XMFLOAT4 specularColor;
|
||||
};
|
||||
|
||||
struct light_color_buffer_type
|
||||
{
|
||||
XMFLOAT4 diffuseColor[num_lights];
|
||||
};
|
||||
|
||||
struct light_position_buffer_type
|
||||
{
|
||||
XMFLOAT4 lightPosition[num_lights];
|
||||
};
|
||||
|
||||
public:
|
||||
light_shader_class();
|
||||
light_shader_class(const light_shader_class&);
|
||||
~light_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11Buffer* camera_buffer_;
|
||||
ID3D11Buffer* light_buffer_;
|
||||
ID3D11Buffer* light_color_buffer_;
|
||||
ID3D11Buffer* light_position_buffer_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,57 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _LIGHTMAPSHADERCLASS_H_
|
||||
#define _LIGHTMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: LightMapShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class LightMapShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
LightMapShaderClass();
|
||||
LightMapShaderClass(const LightMapShaderClass&);
|
||||
~LightMapShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,92 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: lightshaderclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _LIGHTSHADERCLASS_H_
|
||||
#define _LIGHTSHADERCLASS_H_
|
||||
#pragma once
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
const int NUM_LIGHTS = 4;
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: LightShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class LightShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct CameraBufferType
|
||||
{
|
||||
XMFLOAT3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct LightBufferType
|
||||
{
|
||||
XMFLOAT4 ambientColor;
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT3 lightDirection;
|
||||
float padding; // Added extra padding so structure is a multiple of 16 for CreateBuffer function requirements.
|
||||
float specularPower;
|
||||
XMFLOAT4 specularColor;
|
||||
};
|
||||
|
||||
struct LightColorBufferType
|
||||
{
|
||||
XMFLOAT4 diffuseColor[NUM_LIGHTS];
|
||||
};
|
||||
|
||||
struct LightPositionBufferType
|
||||
{
|
||||
XMFLOAT4 lightPosition[NUM_LIGHTS];
|
||||
};
|
||||
|
||||
public:
|
||||
LightShaderClass();
|
||||
LightShaderClass(const LightShaderClass&);
|
||||
~LightShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11Buffer* m_cameraBuffer;
|
||||
ID3D11Buffer* m_lightBuffer;
|
||||
ID3D11Buffer* m_lightColorBuffer;
|
||||
ID3D11Buffer* m_lightPositionBuffer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
#pragma once
|
||||
59
enginecustom/src/inc/shader/multi_texture_shader_class.h
Normal file
59
enginecustom/src/inc/shader/multi_texture_shader_class.h
Normal file
@@ -0,0 +1,59 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: multitextureshaderclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _MULTITEXTURESHADERCLASS_H_
|
||||
#define _MULTITEXTURESHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: multi_texture_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class multi_texture_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
multi_texture_shader_class();
|
||||
multi_texture_shader_class(const multi_texture_shader_class&);
|
||||
~multi_texture_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
64
enginecustom/src/inc/shader/normal_map_shader_class.h
Normal file
64
enginecustom/src/inc/shader/normal_map_shader_class.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef _NORMALMAPSHADERCLASS_H_
|
||||
#define _NORMALMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: normal_map_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class normal_map_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct light_buffer_type
|
||||
{
|
||||
XMFLOAT4 diffuse_color;
|
||||
XMFLOAT3 light_direction;
|
||||
float padding;
|
||||
};
|
||||
|
||||
public:
|
||||
normal_map_shader_class();
|
||||
normal_map_shader_class(const normal_map_shader_class&);
|
||||
~normal_map_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* light_buffer_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef _NORMALMAPSHADERCLASS_H_
|
||||
#define _NORMALMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: NormalMapShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class NormalMapShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct LightBufferType
|
||||
{
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT3 lightDirection;
|
||||
float padding;
|
||||
};
|
||||
|
||||
public:
|
||||
NormalMapShaderClass();
|
||||
NormalMapShaderClass(const NormalMapShaderClass&);
|
||||
~NormalMapShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_lightBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
65
enginecustom/src/inc/shader/reflection_shader_class.h
Normal file
65
enginecustom/src/inc/shader/reflection_shader_class.h
Normal file
@@ -0,0 +1,65 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: reflectionshaderclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _REFLECTIONSHADERCLASS_H_
|
||||
#define _REFLECTIONSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: reflection_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class reflection_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct reflection_buffer_type
|
||||
{
|
||||
XMMATRIX reflection_matrix;
|
||||
};
|
||||
|
||||
public:
|
||||
reflection_shader_class();
|
||||
reflection_shader_class(const reflection_shader_class&);
|
||||
~reflection_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* reflection_buffer_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: reflectionshaderclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _REFLECTIONSHADERCLASS_H_
|
||||
#define _REFLECTIONSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: ReflectionShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class ReflectionShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct ReflectionBufferType
|
||||
{
|
||||
XMMATRIX reflectionMatrix;
|
||||
};
|
||||
|
||||
public:
|
||||
ReflectionShaderClass();
|
||||
ReflectionShaderClass(const ReflectionShaderClass&);
|
||||
~ReflectionShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_reflectionBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
72
enginecustom/src/inc/shader/refraction_shader_class.h
Normal file
72
enginecustom/src/inc/shader/refraction_shader_class.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef _REFRACTIONSHADERCLASS_H_
|
||||
#define _REFRACTIONSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: refraction_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class refraction_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct light_buffer_type
|
||||
{
|
||||
XMFLOAT4 ambient_color;
|
||||
XMFLOAT4 diffuse_color;
|
||||
XMFLOAT4 light_position;
|
||||
XMFLOAT3 light_direction;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct clip_plane_buffer_type
|
||||
{
|
||||
XMFLOAT4 clip_plane;
|
||||
};
|
||||
|
||||
public:
|
||||
refraction_shader_class();
|
||||
refraction_shader_class(const refraction_shader_class&);
|
||||
~refraction_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11Buffer* light_buffer_;
|
||||
ID3D11Buffer* clip_plane_buffer_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef _REFRACTIONSHADERCLASS_H_
|
||||
#define _REFRACTIONSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: RefractionShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class RefractionShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct LightBufferType
|
||||
{
|
||||
XMFLOAT4 ambientColor;
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT4 lightPosition;
|
||||
XMFLOAT3 lightDirection;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct ClipPlaneBufferType
|
||||
{
|
||||
XMFLOAT4 clipPlane;
|
||||
};
|
||||
|
||||
public:
|
||||
RefractionShaderClass();
|
||||
RefractionShaderClass(const RefractionShaderClass&);
|
||||
~RefractionShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11Buffer* m_lightBuffer;
|
||||
ID3D11Buffer* m_clipPlaneBuffer;
|
||||
};
|
||||
|
||||
#endif
|
||||
67
enginecustom/src/inc/shader/shader_manager_class.h
Normal file
67
enginecustom/src/inc/shader/shader_manager_class.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef _SHADERMANAGERCLASS_H_
|
||||
#define _SHADERMANAGERCLASS_H_
|
||||
|
||||
// Inclure les en-têtes nécessaires
|
||||
#include <d3d11.h>
|
||||
#include <DirectXMath.h>
|
||||
#include <vector>
|
||||
#include "texture_shader_class.h"
|
||||
#include "normal_map_shader_class.h"
|
||||
#include "multi_texture_shader_class.h"
|
||||
#include "translate_shader_class.h"
|
||||
#include "alpha_map_shader_class.h"
|
||||
#include "spec_map_shader_class.h"
|
||||
#include "transparent_shader_class.h"
|
||||
#include "light_shader_class.h"
|
||||
#include "light_map_shader_class.h"
|
||||
#include "refraction_shader_class.h"
|
||||
#include "water_shader_class.h"
|
||||
#include "celshade_class.h"
|
||||
#include "skybox_shader_class.h"
|
||||
#include "sunlight_shader_class.h"
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
class shader_manager_class
|
||||
{
|
||||
public:
|
||||
shader_manager_class();
|
||||
shader_manager_class(const shader_manager_class&);
|
||||
~shader_manager_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
|
||||
bool render_texture_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
bool render_normal_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||
bool render_multitexture_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
bool render_translate_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
bool render_alpha_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
bool render_spec_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
bool render_transparent_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
bool renderlight_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
|
||||
bool renderlight_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
bool render_refraction_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
|
||||
bool render_water_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
|
||||
bool render_cel_shading_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
bool render_sunlight_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
bool render_skybox_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
|
||||
private:
|
||||
texture_shader_class* texture_shader_;
|
||||
normal_map_shader_class* normal_map_shader_;
|
||||
multi_texture_shader_class* multitexture_shader_;
|
||||
translate_shader_class* translate_shader_;
|
||||
alpha_map_shader_class* alpha_map_shader_;
|
||||
spec_map_shader_class* spec_map_shader_;
|
||||
transparent_shader_class* transparent_shader_;
|
||||
light_shader_class* light_shader_;
|
||||
light_map_shader_class* light_map_shader_;
|
||||
refraction_shader_class* refraction_shader_;
|
||||
water_shader_class* water_shader_;
|
||||
celshade_class* cel_shading_shader_;
|
||||
sunlight_shader_class* sunlight_shader_;
|
||||
skybox_shader_class* skybox_shader_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,67 +0,0 @@
|
||||
#ifndef _SHADERMANAGERCLASS_H_
|
||||
#define _SHADERMANAGERCLASS_H_
|
||||
|
||||
// Inclure les en-têtes nécessaires
|
||||
#include <d3d11.h>
|
||||
#include <DirectXMath.h>
|
||||
#include <vector>
|
||||
#include "textureshaderclass.h"
|
||||
#include "normalmapshaderclass.h"
|
||||
#include "multitextureshaderclass.h"
|
||||
#include "translateshaderclass.h"
|
||||
#include "alphamapshaderclass.h"
|
||||
#include "specmapshaderclass.h"
|
||||
#include "transparentshaderclass.h"
|
||||
#include "lightshaderclass.h"
|
||||
#include "lightmapshaderclass.h"
|
||||
#include "refractionshaderclass.h"
|
||||
#include "watershaderclass.h"
|
||||
#include "celshadingshader.h"
|
||||
#include "SkyboxShaderClass.h"
|
||||
#include "sunlightshaderclass.h"
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
class ShaderManagerClass
|
||||
{
|
||||
public:
|
||||
ShaderManagerClass();
|
||||
ShaderManagerClass(const ShaderManagerClass&);
|
||||
~ShaderManagerClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
|
||||
bool RenderTextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
bool RenderNormalMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||
bool RenderMultitextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
bool RenderTranslateShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
bool RenderAlphaMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
bool RenderSpecMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
bool RenderTransparentShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
bool RenderlightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
|
||||
bool RenderlightMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
bool RenderRefractionShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
|
||||
bool RenderWaterShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
|
||||
bool RenderCelShadingShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
bool RenderSunlightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
bool RenderSkyboxShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
|
||||
private:
|
||||
TextureShaderClass* m_TextureShader;
|
||||
NormalMapShaderClass* m_NormalMapShader;
|
||||
MultiTextureShaderClass* m_MultitextureShader;
|
||||
TranslateShaderClass* m_TranslateShader;
|
||||
AlphaMapShaderClass* m_AlphaMapShader;
|
||||
SpecMapShaderClass* m_SpecMapShader;
|
||||
TransparentShaderClass* m_TransparentShader;
|
||||
LightShaderClass* m_LightShader;
|
||||
LightMapShaderClass* m_LightMapShader;
|
||||
RefractionShaderClass* m_RefractionShader;
|
||||
WaterShaderClass* m_WaterShader;
|
||||
CelshadeClass* m_CelShadingShader;
|
||||
SunlightShaderClass* m_SunlightShader;
|
||||
SkyboxShaderClass* m_SkyboxShader;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
class SkyboxShaderClass
|
||||
class skybox_shader_class
|
||||
{
|
||||
|
||||
private :
|
||||
@@ -39,9 +39,9 @@ class SkyboxShaderClass
|
||||
};
|
||||
|
||||
public :
|
||||
SkyboxShaderClass();
|
||||
SkyboxShaderClass(const SkyboxShaderClass&);
|
||||
~SkyboxShaderClass();
|
||||
skybox_shader_class();
|
||||
skybox_shader_class(const skybox_shader_class&);
|
||||
~skybox_shader_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
72
enginecustom/src/inc/shader/spec_map_shader_class.h
Normal file
72
enginecustom/src/inc/shader/spec_map_shader_class.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef _SPECMAPSHADERCLASS_H_
|
||||
#define _SPECMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: spec_map_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class spec_map_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct light_buffer_type
|
||||
{
|
||||
XMFLOAT4 diffuse_color;
|
||||
XMFLOAT4 specular_color;
|
||||
float specular_power;
|
||||
XMFLOAT3 light_direction;
|
||||
};
|
||||
|
||||
struct camera_buffer_type
|
||||
{
|
||||
XMFLOAT3 camera_position;
|
||||
float padding;
|
||||
};
|
||||
|
||||
public:
|
||||
spec_map_shader_class();
|
||||
spec_map_shader_class(const spec_map_shader_class&);
|
||||
~spec_map_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* light_buffer_;
|
||||
ID3D11Buffer* camera_buffer_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef _SPECMAPSHADERCLASS_H_
|
||||
#define _SPECMAPSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: SpecMapShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class SpecMapShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct LightBufferType
|
||||
{
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT4 specularColor;
|
||||
float specularPower;
|
||||
XMFLOAT3 lightDirection;
|
||||
};
|
||||
|
||||
struct CameraBufferType
|
||||
{
|
||||
XMFLOAT3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
public:
|
||||
SpecMapShaderClass();
|
||||
SpecMapShaderClass(const SpecMapShaderClass&);
|
||||
~SpecMapShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_lightBuffer;
|
||||
ID3D11Buffer* m_cameraBuffer;
|
||||
};
|
||||
|
||||
#endif
|
||||
68
enginecustom/src/inc/shader/sunlight_shader_class.h
Normal file
68
enginecustom/src/inc/shader/sunlight_shader_class.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
class sunlight_shader_class
|
||||
{
|
||||
|
||||
private :
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct camera_buffer_type
|
||||
{
|
||||
XMFLOAT3 camera_position;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct sun_light_buffer_type
|
||||
{
|
||||
XMFLOAT4 diffuse_color;
|
||||
XMFLOAT4 ambient_color;
|
||||
XMFLOAT3 sun_direction;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
struct sun_light_color_buffer_type
|
||||
{
|
||||
XMFLOAT4 sun_color;
|
||||
};
|
||||
|
||||
public :
|
||||
sunlight_shader_class();
|
||||
sunlight_shader_class(const sunlight_shader_class&);
|
||||
~sunlight_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3,float);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11Buffer* camera_buffer_;
|
||||
ID3D11Buffer* sunlight_buffer_;
|
||||
ID3D11Buffer* sunlight_color_buffer_;
|
||||
ID3D11Buffer* sunlight_position_buffer_;
|
||||
};
|
||||
@@ -1,68 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
class SunlightShaderClass
|
||||
{
|
||||
|
||||
private :
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct CameraBufferType
|
||||
{
|
||||
XMFLOAT3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct SunLightBufferType
|
||||
{
|
||||
XMFLOAT4 diffuseColor;
|
||||
XMFLOAT4 ambientColor;
|
||||
XMFLOAT3 sunDirection;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
struct SunLightColorBufferType
|
||||
{
|
||||
XMFLOAT4 sunColor;
|
||||
};
|
||||
|
||||
public :
|
||||
SunlightShaderClass();
|
||||
SunlightShaderClass(const SunlightShaderClass&);
|
||||
~SunlightShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3,float);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11Buffer* m_cameraBuffer;
|
||||
ID3D11Buffer* m_sunlightBuffer;
|
||||
ID3D11Buffer* m_sunlightColorBuffer;
|
||||
ID3D11Buffer* m_sunlightPositionBuffer;
|
||||
};
|
||||
56
enginecustom/src/inc/shader/texture_shader_class.h
Normal file
56
enginecustom/src/inc/shader/texture_shader_class.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef _TEXTURESHADERCLASS_H_
|
||||
#define _TEXTURESHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: texture_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class texture_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
texture_shader_class();
|
||||
texture_shader_class(const texture_shader_class&);
|
||||
~texture_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
#ifndef _TEXTURESHADERCLASS_H_
|
||||
#define _TEXTURESHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TextureShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class TextureShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
public:
|
||||
TextureShaderClass();
|
||||
TextureShaderClass(const TextureShaderClass&);
|
||||
~TextureShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
63
enginecustom/src/inc/shader/translate_shader_class.h
Normal file
63
enginecustom/src/inc/shader/translate_shader_class.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef _TRANSLATESHADERCLASS_H_
|
||||
#define _TRANSLATESHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: translate_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class translate_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct translate_buffer_type
|
||||
{
|
||||
float translation;
|
||||
XMFLOAT3 padding;
|
||||
};
|
||||
|
||||
public:
|
||||
translate_shader_class();
|
||||
translate_shader_class(const translate_shader_class&);
|
||||
~translate_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* translate_buffer_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifndef _TRANSLATESHADERCLASS_H_
|
||||
#define _TRANSLATESHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TranslateShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class TranslateShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct TranslateBufferType
|
||||
{
|
||||
float translation;
|
||||
XMFLOAT3 padding;
|
||||
};
|
||||
|
||||
public:
|
||||
TranslateShaderClass();
|
||||
TranslateShaderClass(const TranslateShaderClass&);
|
||||
~TranslateShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_translateBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
63
enginecustom/src/inc/shader/transparent_shader_class.h
Normal file
63
enginecustom/src/inc/shader/transparent_shader_class.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef _TRANSPARENTSHADERCLASS_H_
|
||||
#define _TRANSPARENTSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: transparent_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class transparent_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct transparent_buffer_type
|
||||
{
|
||||
float blend_amount;
|
||||
XMFLOAT3 padding;
|
||||
};
|
||||
|
||||
public:
|
||||
transparent_shader_class();
|
||||
transparent_shader_class(const transparent_shader_class&);
|
||||
~transparent_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* transparent_buffer_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifndef _TRANSPARENTSHADERCLASS_H_
|
||||
#define _TRANSPARENTSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TransparentShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class TransparentShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct TransparentBufferType
|
||||
{
|
||||
float blendAmount;
|
||||
XMFLOAT3 padding;
|
||||
};
|
||||
|
||||
public:
|
||||
TransparentShaderClass();
|
||||
TransparentShaderClass(const TransparentShaderClass&);
|
||||
~TransparentShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_transparentBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
70
enginecustom/src/inc/shader/water_shader_class.h
Normal file
70
enginecustom/src/inc/shader/water_shader_class.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef _WATERSHADERCLASS_H_
|
||||
#define _WATERSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: water_shader_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class water_shader_class
|
||||
{
|
||||
private:
|
||||
struct matrix_buffer_type
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct reflection_buffer_type
|
||||
{
|
||||
XMMATRIX reflection;
|
||||
};
|
||||
|
||||
struct water_buffer_type
|
||||
{
|
||||
float water_translation;
|
||||
float reflect_refract_scale;
|
||||
XMFLOAT2 padding;
|
||||
};
|
||||
|
||||
public:
|
||||
water_shader_class();
|
||||
water_shader_class(const water_shader_class&);
|
||||
~water_shader_class();
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* vertex_shader_;
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
ID3D11Buffer* reflection_buffer_;
|
||||
ID3D11Buffer* water_buffer_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
#ifndef _WATERSHADERCLASS_H_
|
||||
#define _WATERSHADERCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: WaterShaderClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class WaterShaderClass
|
||||
{
|
||||
private:
|
||||
struct MatrixBufferType
|
||||
{
|
||||
XMMATRIX world;
|
||||
XMMATRIX view;
|
||||
XMMATRIX projection;
|
||||
};
|
||||
|
||||
struct ReflectionBufferType
|
||||
{
|
||||
XMMATRIX reflection;
|
||||
};
|
||||
|
||||
struct WaterBufferType
|
||||
{
|
||||
float waterTranslation;
|
||||
float reflectRefractScale;
|
||||
XMFLOAT2 padding;
|
||||
};
|
||||
|
||||
public:
|
||||
WaterShaderClass();
|
||||
WaterShaderClass(const WaterShaderClass&);
|
||||
~WaterShaderClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, HWND);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
|
||||
|
||||
private:
|
||||
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void ShutdownShader();
|
||||
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
|
||||
ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
|
||||
void RenderShader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
ID3D11VertexShader* m_vertexShader;
|
||||
ID3D11PixelShader* m_pixelShader;
|
||||
ID3D11InputLayout* m_layout;
|
||||
ID3D11Buffer* m_matrixBuffer;
|
||||
ID3D11SamplerState* m_sampleState;
|
||||
ID3D11Buffer* m_reflectionBuffer;
|
||||
ID3D11Buffer* m_waterBuffer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: cameraclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _CAMERACLASS_H_
|
||||
#define _CAMERACLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: CameraClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class CameraClass
|
||||
{
|
||||
public:
|
||||
CameraClass();
|
||||
CameraClass(const CameraClass&);
|
||||
~CameraClass();
|
||||
|
||||
void SetPosition(float, float, float);
|
||||
void SetRotation(float, float, float);
|
||||
|
||||
XMFLOAT3 GetPosition();
|
||||
XMFLOAT3 GetRotation();
|
||||
|
||||
|
||||
void Render();
|
||||
XMMATRIX GetViewMatrix(XMMATRIX& viewMatrix) const;
|
||||
|
||||
void RenderReflection(float);
|
||||
void GetReflectionViewMatrix(XMMATRIX&) const;
|
||||
|
||||
private:
|
||||
float m_positionX, m_positionY, m_positionZ;
|
||||
float m_rotationX, m_rotationY, m_rotationZ;
|
||||
XMMATRIX m_viewMatrix;
|
||||
XMMATRIX m_reflectionViewMatrix;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -67,12 +67,12 @@ public:
|
||||
case LogLevel::Info: return LogLevelInfo{ "Info", 0, ImVec4(0.0f, 1.0f, 0.0f, 1.0f) };
|
||||
case LogLevel::Warning: return LogLevelInfo{ "Warning", 1, ImVec4(1.0f, 1.0f, 0.0f, 1.0f) };
|
||||
case LogLevel::Error: return LogLevelInfo{ "Error", 2, ImVec4(1.0f, 0.0f, 0.0f, 1.0f) };
|
||||
case LogLevel::Shutdown: return LogLevelInfo{ "Shutdown", 3, ImVec4(0.5f, 0.0f, 0.0f, 1.0f) };
|
||||
case LogLevel::Initialize: return LogLevelInfo{ "Initialize", 4, ImVec4(0.0f, 1.0f, 1.0f, 1.0f) };
|
||||
case LogLevel::Shutdown: return LogLevelInfo{ "shutdown", 3, ImVec4(0.5f, 0.0f, 0.0f, 1.0f) };
|
||||
case LogLevel::Initialize: return LogLevelInfo{ "initialize", 4, ImVec4(0.0f, 1.0f, 1.0f, 1.0f) };
|
||||
case LogLevel::Update: return LogLevelInfo{ "Update", 5, ImVec4(1.0f, 0.0f, 1.0f, 1.0f) };
|
||||
case LogLevel::Render: return LogLevelInfo{ "Render", 6, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
|
||||
case LogLevel::Render: return LogLevelInfo{ "render", 6, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
|
||||
case LogLevel::Input: return LogLevelInfo{ "Input", 7, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
|
||||
case LogLevel::Physics: return LogLevelInfo{ "Physics", 8, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
|
||||
case LogLevel::Physics: return LogLevelInfo{ "physics", 8, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
|
||||
case LogLevel::Audio: return LogLevelInfo{ "Audio", 9, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
|
||||
case LogLevel::Network: return LogLevelInfo{ "Network", 10, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
|
||||
case LogLevel::Scripting: return LogLevelInfo{ "Scripting", 11, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "d3dclass.h"
|
||||
#include "d_3d_class.h"
|
||||
#include "object.h"
|
||||
|
||||
class Skybox
|
||||
@@ -11,9 +11,9 @@ public:
|
||||
Skybox();
|
||||
~Skybox();
|
||||
|
||||
void Initialize(D3DClass* d3dClassRef); // Get all the required references
|
||||
void Initialize(d_3d_class* d3dClassRef); // Get all the required references
|
||||
|
||||
Object* ConstructSkybox();
|
||||
object* ConstructSkybox();
|
||||
|
||||
|
||||
// Variables
|
||||
@@ -23,8 +23,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
D3DClass* m_d3dClassRef; // Reference to the D3DClass instance
|
||||
Object* m_Skybox;
|
||||
d_3d_class* m_d3dClassRef; // Reference to the d_3d_class instance
|
||||
object* m_Skybox;
|
||||
|
||||
|
||||
};
|
||||
|
||||
325
enginecustom/src/inc/system/application_class.h
Normal file
325
enginecustom/src/inc/system/application_class.h
Normal file
@@ -0,0 +1,325 @@
|
||||
#ifndef _APPLICATIONCLASS_H_
|
||||
#define _APPLICATIONCLASS_H_
|
||||
|
||||
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "d_3d_class.h"
|
||||
#include "camera_class.h"
|
||||
#include "object.h"
|
||||
#include "light_class.h"
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include "bitmap_class.h"
|
||||
#include "sprite_class.h"
|
||||
#include "timer_class.h"
|
||||
#include "font_shader_class.h"
|
||||
#include "font_class.h"
|
||||
#include "text_class.h"
|
||||
#include "fps_class.h"
|
||||
#include "input_class.h"
|
||||
#include "shader_manager_class.h"
|
||||
#include "modellistclass.h"
|
||||
#include "position_class.h"
|
||||
#include "frustumclass.h"
|
||||
#include "render_texture_class.h"
|
||||
#include "display_plane_class.h"
|
||||
#include "translate_shader_class.h"
|
||||
#include "reflection_shader_class.h"
|
||||
#include "physics.h"
|
||||
#include "frustum.h"
|
||||
#include "skybox.h"
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <WICTextureLoader.h>
|
||||
#include <comdef.h> // Pour _com_error
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <DirectXMath.h>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
constexpr bool full_screen = false;
|
||||
constexpr float screen_depth = 1000.0f;
|
||||
constexpr float screen_near = 0.3f;
|
||||
|
||||
struct input
|
||||
{
|
||||
bool key_left = false;
|
||||
bool key_right = false;
|
||||
bool key_up = false;
|
||||
bool key_down = false;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: application_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class application_class
|
||||
{
|
||||
public:
|
||||
application_class();
|
||||
~application_class();
|
||||
d_3d_class* get_direct_3d();
|
||||
|
||||
render_texture_class* get_scene_texture() const { return scene_texture_; };
|
||||
render_texture_class* get_render_texture() const { return render_texture_; };
|
||||
render_texture_class* get_refraction_texture() const { return refraction_texture_; };
|
||||
render_texture_class* get_reflection_texture() const { return reflection_texture_; };
|
||||
|
||||
int get_total_vertex_count() const;
|
||||
int get_total_triangle_count() const;
|
||||
int get_visible_triangle_count() const;
|
||||
|
||||
void create_big_cube(int side_count);
|
||||
void process_terrain_generation();
|
||||
bool initialize(int, int, HWND, bool is_vulkan);
|
||||
void shutdown();
|
||||
bool frame(input_class*);
|
||||
void physics_thread_function();
|
||||
int get_physics_tick_rate() const { return physics_tick_rate_; };
|
||||
void set_physics_tick_rate(int physics_tick_rate) { physics_tick_rate_ = physics_tick_rate; };
|
||||
|
||||
int get_screen_width() const;
|
||||
void set_screen_width(int screen_width);
|
||||
int get_screen_height() const;
|
||||
void set_screen_height(int screen_height);
|
||||
|
||||
float get_speed() const { return speed_; };
|
||||
void set_speed(const float speed) { this->speed_ = speed; };
|
||||
|
||||
void add_cube();
|
||||
void delete_kobject(int index);
|
||||
size_t get_cube_count() const { return cubes_.size(); };
|
||||
size_t get_terrain_cube_count() const { return terrain_chunk_.size(); };
|
||||
std::vector<object*> get_cubes() const { return cubes_; };
|
||||
std::vector<object*> get_terrain_cubes() const { return terrain_chunk_; };
|
||||
std::vector<object*> get_kobjects() const { return object_; };
|
||||
void add_kobject(std::wstring& filepath);
|
||||
void set_path(WCHAR* path) { path_ = path; };
|
||||
void set_w_folder(const std::filesystem::path& w_folder) { w_folder_ = w_folder; };
|
||||
|
||||
void generate_terrain();
|
||||
void delete_terrain();
|
||||
|
||||
XMVECTOR get_light_position(int index);
|
||||
XMVECTOR get_light_color(int index);
|
||||
void set_light_position(int index, XMVECTOR position);
|
||||
void set_light_color(int index, XMVECTOR color);
|
||||
std::vector<light_class*> get_lights() const { return lights_; };
|
||||
light_class* get_sun_light() const { return sun_light_; };
|
||||
|
||||
bool get_should_quit() const { return should_quit_; };
|
||||
void set_should_quit(const bool should_quit) { should_quit_ = should_quit; };
|
||||
|
||||
void set_cel_shading(const bool enable) { enable_cel_shading_ = enable; };
|
||||
|
||||
void set_vsync(bool vsync);
|
||||
bool get_vsync() const { return vsync_enabled_; };
|
||||
|
||||
HWND get_hwnd() const;
|
||||
void set_hwnd(HWND hwnd);
|
||||
|
||||
bool is_windowed() const;
|
||||
void set_windowed(bool windowed);
|
||||
|
||||
void set_window_size(const ImVec2 size) { window_size_ = size; };
|
||||
ImVec2 get_window_size() const { return window_size_; };
|
||||
float get_aspect_ratio() const { return static_cast<float>(screen_width_) / static_cast<float>(screen_height_); };
|
||||
|
||||
physics* get_physics() const { return physics_; };
|
||||
|
||||
// ------------------------------------- //
|
||||
// --------------- Stats --------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
int get_current_fps() const;
|
||||
int get_min_fps() const;
|
||||
int get_max_fps() const;
|
||||
float get_frame_time() const;
|
||||
int get_draw_calls() const;
|
||||
void reset_fps_stats();
|
||||
void increment_draw_call_count();
|
||||
void reset_draw_call_count();
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- Culling ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
frustum get_frustum() const { return frustum_culling_; };
|
||||
void set_frustum(const frustum& frustum) { frustum_culling_ = frustum; };
|
||||
|
||||
void construct_frustum();
|
||||
int get_render_count() const { return render_count_; };
|
||||
void set_render_count(const int render_count) { render_count_ = render_count; };
|
||||
float get_frustum_tolerance() const { return frustum_culling_tolerance_; };
|
||||
void set_frustum_tolerance(const float frustum_tolerance) { frustum_culling_tolerance_ = frustum_tolerance; };
|
||||
|
||||
bool get_can_fixed_update() const { return can_fixed_update_; };
|
||||
void set_can_fixed_update(bool can_fixed_update) { can_fixed_update_ = can_fixed_update; };
|
||||
|
||||
ID3D11ShaderResourceView* get_back_buffer_srv() const {return back_buffer_srv_;};
|
||||
|
||||
// Save and load scene
|
||||
void save_scene();
|
||||
bool load_scene();
|
||||
|
||||
void set_scene_path(const std::string& path) { scene_path_ = path; };
|
||||
std::wstring get_scene_path();
|
||||
|
||||
std::string convert_w_string_to_string(const std::wstring& w_str);
|
||||
|
||||
private:
|
||||
bool render(float, float, float, float, float);
|
||||
bool render_physics(bool key_left, bool key_right, bool key_up, bool key_down, float delta_time);
|
||||
bool update_mouse_strings(int, int, bool);
|
||||
bool update_fps();
|
||||
bool update_render_count_string(int);
|
||||
bool render_scene_to_texture(float);
|
||||
bool render_refraction_to_texture();
|
||||
bool render_reflection_to_texture();
|
||||
bool render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
|
||||
|
||||
void update_skybox_position();
|
||||
|
||||
public :
|
||||
std::vector<ID3D11ShaderResourceView*> textures;
|
||||
|
||||
private :
|
||||
|
||||
// Thread de culling
|
||||
std::thread culling_thread_;
|
||||
std::atomic<bool> culling_active_;
|
||||
std::mutex objects_mutex_;
|
||||
void culling_thread_function();
|
||||
|
||||
|
||||
std::mutex terrain_mutex_;
|
||||
std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
|
||||
bool terrain_generation_ready_;
|
||||
int next_terrain_object_id_;
|
||||
|
||||
// ------------------------------------- //
|
||||
// ------------- DIRECT3D -------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
d_3d_class* direct_3d_;
|
||||
IDXGISwapChain* swap_chain_;
|
||||
model_class* model_,* ground_model_, * wall_model_, * bath_model_, * water_model_;
|
||||
ModelListClass* model_list_;
|
||||
bool vsync_enabled_ = true;
|
||||
|
||||
HWND hwnd_;
|
||||
bool windowed_;
|
||||
|
||||
std::string scene_path_;
|
||||
|
||||
// ------------------------------------- //
|
||||
// ------------- RENDERING ------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
XMMATRIX base_view_matrix_;
|
||||
render_texture_class* render_texture_, * refraction_texture_, * reflection_texture_;
|
||||
render_texture_class* scene_texture_;
|
||||
display_plane_class* display_plane_;
|
||||
int screen_width_, screen_height_;
|
||||
camera_class* camera_;
|
||||
position_class* position_;
|
||||
int drawcalls_;
|
||||
|
||||
// ------------------------------------ //
|
||||
// ------------- OBJECTS -------------- //
|
||||
// ------------------------------------ //
|
||||
|
||||
object* selected_object_;
|
||||
std::vector<object*> cubes_;
|
||||
std::vector<object*> terrain_chunk_;
|
||||
float speed_ = 0.1f; // speed for the demo spinning object
|
||||
std::vector<object*> object_;
|
||||
std::vector<object*> imported_object_;
|
||||
int object_id_ = 0;
|
||||
std::vector<std::reference_wrapper<std::vector<object*>>> render_queues_;
|
||||
std::vector<object*> skybox_;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- LIGHTS -------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
light_class* m_light_;
|
||||
std::vector<light_class*> lights_;
|
||||
int num_lights_;
|
||||
light_class* sun_light_;
|
||||
|
||||
XMFLOAT3 true_light_position_;
|
||||
model_class* light_model_;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- SHADERS ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
shader_manager_class* shader_manager_;
|
||||
font_shader_class* font_shader_;
|
||||
bitmap_class* bitmap_;
|
||||
sprite_class* sprite_;
|
||||
|
||||
bool enable_cel_shading_;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------ VARIABLES ------------ //
|
||||
// ----------------------------------- //
|
||||
|
||||
float water_height_, water_translation_;
|
||||
wchar_t* path_;
|
||||
std::filesystem::path w_folder_;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------- FPS AND INFO ON SCREEN ------------ //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
timer_class* timer_;
|
||||
text_class* mouse_strings_;
|
||||
text_class* render_count_string_;
|
||||
font_class* font_;
|
||||
fps_class* fps_;
|
||||
text_class* fps_string_;
|
||||
int previous_fps_;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- OTHER ----------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
bool should_quit_;
|
||||
physics* physics_;
|
||||
float gravity_;
|
||||
XMVECTOR previous_position_;
|
||||
ImVec2 window_size_;
|
||||
int physics_tick_rate_ = 50;
|
||||
bool can_fixed_update_ = false;
|
||||
std::thread physics_thread_;
|
||||
|
||||
ID3D11Texture2D* back_buffer_texture_;
|
||||
ID3D11ShaderResourceView* back_buffer_srv_;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- Culling --------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
frustum frustum_culling_;
|
||||
int render_count_;
|
||||
float frustum_culling_tolerance_ = 5.f;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// -------------------- Input ---------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
input inputs_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,327 +0,0 @@
|
||||
#ifndef _APPLICATIONCLASS_H_
|
||||
#define _APPLICATIONCLASS_H_
|
||||
|
||||
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "d3dclass.h"
|
||||
#include "cameraclass.h"
|
||||
#include "object.h"
|
||||
#include "lightclass.h"
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include "bitmapclass.h"
|
||||
#include "spriteclass.h"
|
||||
#include "timerclass.h"
|
||||
#include "fontshaderclass.h"
|
||||
#include "fontclass.h"
|
||||
#include "textclass.h"
|
||||
#include "fpsclass.h"
|
||||
#include "inputclass.h"
|
||||
#include "shadermanagerclass.h"
|
||||
#include "modellistclass.h"
|
||||
#include "positionclass.h"
|
||||
#include "frustumclass.h"
|
||||
#include "rendertextureclass.h"
|
||||
#include "displayplaneclass.h"
|
||||
#include "translateshaderclass.h"
|
||||
#include "reflectionshaderclass.h"
|
||||
#include "physics.h"
|
||||
#include "frustum.h"
|
||||
#include "skybox.h"
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <WICTextureLoader.h>
|
||||
#include <comdef.h> // Pour _com_error
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <DirectXMath.h>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
const bool FULL_SCREEN = false;
|
||||
const float SCREEN_DEPTH = 1000.0f;
|
||||
const float SCREEN_NEAR = 0.3f;
|
||||
|
||||
struct Input
|
||||
{
|
||||
bool m_KeyLeft = false;
|
||||
bool m_KeyRight = false;
|
||||
bool m_KeyUp = false;
|
||||
bool m_KeyDown = false;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: ApplicationClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class ApplicationClass
|
||||
{
|
||||
public:
|
||||
ApplicationClass();
|
||||
~ApplicationClass();
|
||||
D3DClass* GetDirect3D();
|
||||
|
||||
RenderTextureClass* GetSceneTexture() const { return m_SceneTexture; };
|
||||
RenderTextureClass* GetRenderTexture() const { return m_RenderTexture; };
|
||||
RenderTextureClass* GetRefractionTexture() const { return m_RefractionTexture; };
|
||||
RenderTextureClass* GetReflectionTexture() const { return m_ReflectionTexture; };
|
||||
|
||||
int GetTotalVertexCount() const;
|
||||
int GetTotalTriangleCount() const;
|
||||
int GetVisibleTriangleCount() const;
|
||||
|
||||
void CreateBigCube(int sideCount);
|
||||
void ProcessTerrainGeneration();
|
||||
bool Initialize(int, int, HWND, bool IsVulkan);
|
||||
void Shutdown();
|
||||
bool Frame(InputClass*);
|
||||
void PhysicsThreadFunction();
|
||||
int GetPhysicsTickRate() const { return m_PhysicsTickRate; };
|
||||
void SetPhysicsTickRate(int physicsTickRate) { m_PhysicsTickRate = physicsTickRate; };
|
||||
|
||||
int GetScreenWidth() const;
|
||||
void SetScreenWidth(int screenWidth);
|
||||
int GetScreenHeight() const;
|
||||
void SetScreenHeight(int screenHeight);
|
||||
|
||||
float GetSpeed() const { return m_speed; };
|
||||
void SetSpeed(float speed) { this->m_speed = speed; };
|
||||
|
||||
void AddCube();
|
||||
void DeleteKobject(int index);
|
||||
size_t GetCubeCount() const { return m_cubes.size(); };
|
||||
size_t GetTerrainCubeCount() const { return m_terrainChunk.size(); };
|
||||
std::vector<Object*> GetCubes() const { return m_cubes; };
|
||||
std::vector<Object*> GetTerrainCubes() const { return m_terrainChunk; };
|
||||
std::vector<Object*> GetKobjects() const { return m_object; };
|
||||
void AddKobject(std::wstring& filepath);
|
||||
void SetPath(WCHAR* path) { m_path = path; };
|
||||
void SetWFolder(std::filesystem::path WFolder) { m_WFolder = WFolder; };
|
||||
|
||||
void GenerateTerrain();
|
||||
void DeleteTerrain();
|
||||
|
||||
XMVECTOR GetLightPosition(int index);
|
||||
XMVECTOR GetLightColor(int index);
|
||||
void SetLightPosition(int index, XMVECTOR color);
|
||||
void SetLightColor(int index, XMVECTOR color);
|
||||
void DeleteLight(int index);
|
||||
void AddLight();
|
||||
std::vector<LightClass*> GetLights() const { return m_Lights; };
|
||||
LightClass* GetSunLight() const { return m_SunLight; };
|
||||
|
||||
bool GetShouldQuit() const { return m_ShouldQuit; };
|
||||
void SetShouldQuit(bool shouldQuit) { m_ShouldQuit = shouldQuit; };
|
||||
|
||||
void SetCelShading(bool enable) { m_enableCelShading = enable; };
|
||||
|
||||
void SetVsync(bool vsync);
|
||||
bool GetVsync() const { return VSYNC_ENABLED; };
|
||||
|
||||
HWND GetHwnd() const;
|
||||
void SetHwnd(HWND hwnd);
|
||||
|
||||
bool IsWindowed() const;
|
||||
void SetWindowed(bool windowed);
|
||||
|
||||
void SetWindowSize(ImVec2 size) { windowSize = size; };
|
||||
ImVec2 GetWindowSize() const { return windowSize; };
|
||||
float GetAspectRatio() const { return (float)m_screenWidth / (float)m_screenHeight; };
|
||||
|
||||
Physics* GetPhysics() const { return m_Physics; };
|
||||
|
||||
// ------------------------------------- //
|
||||
// --------------- Stats --------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
int GetCurrentFps() const;
|
||||
int GetMinFps() const;
|
||||
int GetMaxFps() const;
|
||||
float GetFrameTime() const;
|
||||
int GetDrawCalls() const;
|
||||
void ResetFpsStats();
|
||||
void IncrementDrawCallCount();
|
||||
void ResetDrawCallCount();
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- Culling ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
Frustum GetFrustum() const { return m_FrustumCulling; };
|
||||
void SetFrustum(Frustum frustum) { m_FrustumCulling = frustum; };
|
||||
|
||||
void ConstructFrustum();
|
||||
int GetRenderCount() const { return m_renderCount; };
|
||||
void SetRenderCount(int renderCount) { m_renderCount = renderCount; };
|
||||
float GetFrustumTolerance() const { return m_FrustumCullingTolerance; };
|
||||
void SetFrustumTolerance(float frustumTolerance) { m_FrustumCullingTolerance = frustumTolerance; };
|
||||
|
||||
bool GetCanFixedUpdate() const { return CanFixedUpdate; };
|
||||
void SetCanFixedUpdate(bool canFixedUpdate) { CanFixedUpdate = canFixedUpdate; };
|
||||
|
||||
ID3D11ShaderResourceView* GetBackBufferSRV() const {return m_BackBufferSRV;};
|
||||
|
||||
// Save and load scene
|
||||
void SaveScene();
|
||||
bool LoadScene();
|
||||
|
||||
void SetScenePath(std::string path) { m_scenePath = path; };
|
||||
std::wstring GetScenePath();
|
||||
|
||||
std::string ConvertWStringToString(const std::wstring& wstr);
|
||||
|
||||
private:
|
||||
bool Render(float, float, float, float, float);
|
||||
bool RenderPhysics(bool keyLeft, bool keyRight, bool keyUp, bool keyDown, float deltaTime);
|
||||
bool UpdateMouseStrings(int, int, bool);
|
||||
bool UpdateFps();
|
||||
bool UpdateRenderCountString(int);
|
||||
bool RenderSceneToTexture(float);
|
||||
bool RenderRefractionToTexture();
|
||||
bool RenderReflectionToTexture();
|
||||
bool RenderPass(const std::vector<std::reference_wrapper<std::vector<Object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
|
||||
|
||||
void UpdateSkyboxPosition();
|
||||
|
||||
public :
|
||||
std::vector<ID3D11ShaderResourceView*> textures;
|
||||
|
||||
private :
|
||||
|
||||
// Thread de culling
|
||||
std::thread m_CullingThread;
|
||||
std::atomic<bool> m_CullingActive;
|
||||
std::mutex m_ObjectsMutex;
|
||||
void CullingThreadFunction();
|
||||
|
||||
|
||||
std::mutex m_TerrainMutex;
|
||||
std::vector<std::tuple<float, float, float, std::string, int>> m_TerrainGenerationData;
|
||||
bool m_TerrainGenerationReady;
|
||||
int m_NextTerrainObjectId;
|
||||
|
||||
// ------------------------------------- //
|
||||
// ------------- DIRECT3D -------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
D3DClass* m_Direct3D;
|
||||
IDXGISwapChain* m_swapChain;
|
||||
ModelClass* m_Model,* m_GroundModel, * m_WallModel, * m_BathModel, * m_WaterModel;
|
||||
ModelListClass* m_ModelList;
|
||||
bool VSYNC_ENABLED = true;
|
||||
|
||||
HWND m_hwnd;
|
||||
bool m_windowed;
|
||||
|
||||
std::string m_scenePath;
|
||||
|
||||
// ------------------------------------- //
|
||||
// ------------- RENDERING ------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
XMMATRIX m_baseViewMatrix;
|
||||
RenderTextureClass* m_RenderTexture, * m_RefractionTexture, * m_ReflectionTexture;
|
||||
RenderTextureClass* m_SceneTexture;
|
||||
DisplayPlaneClass* m_DisplayPlane;
|
||||
int m_screenWidth, m_screenHeight;
|
||||
CameraClass* m_Camera;
|
||||
PositionClass* m_Position;
|
||||
int m_drawcalls;
|
||||
|
||||
// ------------------------------------ //
|
||||
// ------------- OBJECTS -------------- //
|
||||
// ------------------------------------ //
|
||||
|
||||
Object* m_SelectedObject;
|
||||
std::vector<Object*> m_cubes;
|
||||
std::vector<Object*> m_terrainChunk;
|
||||
float m_speed = 0.1f; // speed for the demo spinning object
|
||||
std::vector<Object*> m_object;
|
||||
std::vector<Object*> m_ImportedObject;
|
||||
int m_ObjectId = 0;
|
||||
std::vector<std::reference_wrapper<std::vector<Object*>>> m_RenderQueues;
|
||||
std::vector<Object*> m_Skybox;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- LIGHTS -------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
LightClass* m_Light;
|
||||
std::vector<LightClass*> m_Lights;
|
||||
int m_numLights;
|
||||
LightClass* m_SunLight;
|
||||
|
||||
XMFLOAT3 TrueLightPosition;
|
||||
ModelClass* m_LightModel;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- SHADERS ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
ShaderManagerClass* m_ShaderManager;
|
||||
FontShaderClass* m_FontShader;
|
||||
BitmapClass* m_Bitmap;
|
||||
SpriteClass* m_Sprite;
|
||||
|
||||
bool m_enableCelShading;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------ VARIABLES ------------ //
|
||||
// ----------------------------------- //
|
||||
|
||||
float m_waterHeight, m_waterTranslation;
|
||||
wchar_t* m_path;
|
||||
std::filesystem::path m_WFolder;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------- FPS AND INFO ON SCREEN ------------ //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
TimerClass* m_Timer;
|
||||
TextClass* m_MouseStrings;
|
||||
TextClass* m_RenderCountString;
|
||||
FontClass* m_Font;
|
||||
FpsClass* m_Fps;
|
||||
TextClass* m_FpsString;
|
||||
int m_previousFps;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- OTHER ----------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
bool m_ShouldQuit;
|
||||
Physics* m_Physics;
|
||||
float m_gravity;
|
||||
XMVECTOR m_previousPosition;
|
||||
ImVec2 windowSize;
|
||||
int m_PhysicsTickRate = 50;
|
||||
bool CanFixedUpdate = false;
|
||||
std::thread m_PhysicsThread;
|
||||
|
||||
ID3D11Texture2D* m_BackBufferTexture;
|
||||
ID3D11ShaderResourceView* m_BackBufferSRV;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- Culling --------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
Frustum m_FrustumCulling;
|
||||
int m_renderCount;
|
||||
float m_FrustumCullingTolerance = 5.f;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// -------------------- Input ---------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
Input m_Inputs;
|
||||
};
|
||||
|
||||
#endif
|
||||
59
enginecustom/src/inc/system/bitmap_class.h
Normal file
59
enginecustom/src/inc/system/bitmap_class.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef _BITMAPCLASS_H_
|
||||
#define _BITMAPCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "texture_class.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: bitmap_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class bitmap_class
|
||||
{
|
||||
private:
|
||||
struct vertex_type
|
||||
{
|
||||
XMFLOAT3 position;
|
||||
XMFLOAT2 texture;
|
||||
};
|
||||
|
||||
public:
|
||||
bitmap_class();
|
||||
bitmap_class(const bitmap_class&);
|
||||
~bitmap_class();
|
||||
|
||||
bool initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*);
|
||||
|
||||
int get_index_count();
|
||||
ID3D11ShaderResourceView* get_texture();
|
||||
|
||||
void set_render_location(int, int);
|
||||
|
||||
private:
|
||||
bool initialize_buffers(ID3D11Device*);
|
||||
void shutdown_buffers();
|
||||
bool update_buffers(ID3D11DeviceContext*);
|
||||
void render_buffers(ID3D11DeviceContext*);
|
||||
|
||||
bool load_texture(ID3D11Device*, ID3D11DeviceContext*, char*);
|
||||
void release_texture();
|
||||
private:
|
||||
ID3D11Buffer* vertex_buffer_, * index_buffer_;
|
||||
int vertex_count_, index_count_, screen_width_, screen_height_, bitmap_width_, bitmap_height_, render_x_, render_y_, prev_pos_x_, prev_pos_y_;
|
||||
texture_class* texture_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
#ifndef _BITMAPCLASS_H_
|
||||
#define _BITMAPCLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "textureclass.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: BitmapClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class BitmapClass
|
||||
{
|
||||
private:
|
||||
struct VertexType
|
||||
{
|
||||
XMFLOAT3 position;
|
||||
XMFLOAT2 texture;
|
||||
};
|
||||
|
||||
public:
|
||||
BitmapClass();
|
||||
BitmapClass(const BitmapClass&);
|
||||
~BitmapClass();
|
||||
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
|
||||
void Shutdown();
|
||||
bool Render(ID3D11DeviceContext*);
|
||||
|
||||
int GetIndexCount();
|
||||
ID3D11ShaderResourceView* GetTexture();
|
||||
|
||||
void SetRenderLocation(int, int);
|
||||
|
||||
private:
|
||||
bool InitializeBuffers(ID3D11Device*);
|
||||
void ShutdownBuffers();
|
||||
bool UpdateBuffers(ID3D11DeviceContext*);
|
||||
void RenderBuffers(ID3D11DeviceContext*);
|
||||
|
||||
bool LoadTexture(ID3D11Device*, ID3D11DeviceContext*, char*);
|
||||
void ReleaseTexture();
|
||||
private:
|
||||
ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
|
||||
int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY;
|
||||
TextureClass* m_Texture;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
46
enginecustom/src/inc/system/camera_class.h
Normal file
46
enginecustom/src/inc/system/camera_class.h
Normal file
@@ -0,0 +1,46 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: cameraclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _CAMERACLASS_H_
|
||||
#define _CAMERACLASS_H_
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: camera_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class camera_class
|
||||
{
|
||||
public:
|
||||
camera_class();
|
||||
camera_class(const camera_class&);
|
||||
~camera_class();
|
||||
|
||||
void set_position(float, float, float);
|
||||
void set_rotation(float, float, float);
|
||||
|
||||
XMFLOAT3 get_position();
|
||||
XMFLOAT3 get_rotation();
|
||||
|
||||
|
||||
void render();
|
||||
XMMATRIX get_view_matrix(XMMATRIX& view_matrix) const;
|
||||
|
||||
void render_reflection(float);
|
||||
void get_reflection_view_matrix(XMMATRIX&) const;
|
||||
|
||||
private:
|
||||
float position_x_, position_y_, position_z_;
|
||||
float rotation_x_, rotation_y_, rotation_z_;
|
||||
XMMATRIX view_matrix_;
|
||||
XMMATRIX reflection_view_matrix_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,90 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: d3dclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _D3DCLASS_H_
|
||||
#define _D3DCLASS_H_
|
||||
|
||||
|
||||
/////////////
|
||||
// LINKING //
|
||||
/////////////
|
||||
#pragma comment(lib, "d3d11.lib")
|
||||
#pragma comment(lib, "dxgi.lib")
|
||||
#pragma comment(lib, "d3dcompiler.lib")
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "imguiManager.h"
|
||||
#include "d3d11.h"
|
||||
#include "fontshaderclass.h"
|
||||
#include "fontclass.h"
|
||||
#include "textclass.h"
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: D3DClass
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class D3DClass
|
||||
{
|
||||
public:
|
||||
D3DClass();
|
||||
D3DClass(const D3DClass&);
|
||||
~D3DClass();
|
||||
|
||||
bool Initialize(int, int, bool, HWND, bool, float, float);
|
||||
void Shutdown();
|
||||
|
||||
void BeginScene(float, float, float, float);
|
||||
void EndScene();
|
||||
|
||||
ID3D11Device* GetDevice();
|
||||
ID3D11DeviceContext* GetDeviceContext();
|
||||
//XMMATRIX GetProjectionMatrix(XMMATRIX& projectionMatrix);
|
||||
IDXGISwapChain* m_swapChain;
|
||||
IDXGISwapChain* GetSwapChain();
|
||||
void ResizeSwapChain(int, int);
|
||||
void SetVsync(bool vsync);
|
||||
|
||||
|
||||
XMMATRIX GetProjectionMatrix() const { return m_projectionMatrix; };
|
||||
XMMATRIX GetWorldMatrix() const { return m_worldMatrix;};
|
||||
XMMATRIX GetOrthoMatrix() const { return m_orthoMatrix; };
|
||||
|
||||
void GetVideoCardInfo(char*, int&);
|
||||
|
||||
void SetBackBufferRenderTarget();
|
||||
void ResetViewport();
|
||||
|
||||
void ReleaseResources();
|
||||
void ResetResources(int newWidth, int newHeight);
|
||||
|
||||
void TurnZBufferOn();
|
||||
void TurnZBufferOff();
|
||||
|
||||
void EnableAlphaBlending();
|
||||
void DisableAlphaBlending();
|
||||
|
||||
private:
|
||||
bool m_vsync_enabled;
|
||||
int m_videoCardMemory;
|
||||
char m_videoCardDescription[128];
|
||||
ID3D11Device* m_device;
|
||||
ID3D11DeviceContext* m_deviceContext;
|
||||
ID3D11RenderTargetView* m_renderTargetView;
|
||||
ID3D11Texture2D* m_depthStencilBuffer;
|
||||
ID3D11DepthStencilState* m_depthStencilState;
|
||||
ID3D11DepthStencilView* m_depthStencilView;
|
||||
ID3D11RasterizerState* m_rasterState;
|
||||
XMMATRIX m_projectionMatrix;
|
||||
XMMATRIX m_worldMatrix;
|
||||
XMMATRIX m_orthoMatrix;
|
||||
D3D11_VIEWPORT m_viewport;
|
||||
ID3D11DepthStencilState* m_depthDisabledStencilState;
|
||||
ID3D11BlendState* m_alphaEnableBlendingState;
|
||||
ID3D11BlendState* m_alphaDisableBlendingState;
|
||||
};
|
||||
|
||||
#endif
|
||||
90
enginecustom/src/inc/system/d_3d_class.h
Normal file
90
enginecustom/src/inc/system/d_3d_class.h
Normal file
@@ -0,0 +1,90 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: d3dclass.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _D3DCLASS_H_
|
||||
#define _D3DCLASS_H_
|
||||
|
||||
|
||||
/////////////
|
||||
// LINKING //
|
||||
/////////////
|
||||
#pragma comment(lib, "d3d11.lib")
|
||||
#pragma comment(lib, "dxgi.lib")
|
||||
#pragma comment(lib, "d3dcompiler.lib")
|
||||
|
||||
|
||||
//////////////
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "imguiManager.h"
|
||||
#include "d3d11.h"
|
||||
#include "font_shader_class.h"
|
||||
#include "font_class.h"
|
||||
#include "text_class.h"
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: d_3d_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class d_3d_class
|
||||
{
|
||||
public:
|
||||
d_3d_class();
|
||||
d_3d_class(const d_3d_class&);
|
||||
~d_3d_class();
|
||||
|
||||
bool initialize(int, int, bool, HWND, bool, float, float);
|
||||
void shutdown();
|
||||
|
||||
void begin_scene(float, float, float, float);
|
||||
void end_scene();
|
||||
|
||||
ID3D11Device* get_device();
|
||||
ID3D11DeviceContext* get_device_context();
|
||||
//XMMATRIX get_projection_matrix(XMMATRIX& projectionMatrix);
|
||||
IDXGISwapChain* swap_chain;
|
||||
IDXGISwapChain* get_swap_chain();
|
||||
void resize_swap_chain(int, int);
|
||||
void set_vsync(bool vsync);
|
||||
|
||||
|
||||
XMMATRIX get_projection_matrix() const { return projection_matrix_; };
|
||||
XMMATRIX get_world_matrix() const { return world_matrix_;};
|
||||
XMMATRIX get_ortho_matrix() const { return ortho_matrix_; };
|
||||
|
||||
void get_video_card_info(char*, int&);
|
||||
|
||||
void set_back_buffer_render_target();
|
||||
void reset_viewport();
|
||||
|
||||
void release_resources();
|
||||
void reset_resources(int newWidth, int newHeight);
|
||||
|
||||
void turn_z_buffer_on();
|
||||
void turn_z_buffer_off();
|
||||
|
||||
void enable_alpha_blending();
|
||||
void disable_alpha_blending();
|
||||
|
||||
private:
|
||||
bool vsync_enabled_;
|
||||
int video_card_memory_;
|
||||
char video_card_description_[128];
|
||||
ID3D11Device* device_;
|
||||
ID3D11DeviceContext* device_context_;
|
||||
ID3D11RenderTargetView* render_target_view_;
|
||||
ID3D11Texture2D* depth_stencil_buffer_;
|
||||
ID3D11DepthStencilState* depth_stencil_state_;
|
||||
ID3D11DepthStencilView* depth_stencil_view_;
|
||||
ID3D11RasterizerState* raster_state_;
|
||||
XMMATRIX projection_matrix_;
|
||||
XMMATRIX world_matrix_;
|
||||
XMMATRIX ortho_matrix_;
|
||||
D3D11_VIEWPORT viewport_;
|
||||
ID3D11DepthStencilState* depth_disabled_stencil_state_;
|
||||
ID3D11BlendState* alpha_enable_blending_state_;
|
||||
ID3D11BlendState* alpha_disable_blending_state_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,13 +5,13 @@
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "d3dclass.h"
|
||||
#include "d_3d_class.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: DisplayPlaneClass
|
||||
// Class name: display_plane_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class DisplayPlaneClass
|
||||
class display_plane_class
|
||||
{
|
||||
private:
|
||||
struct VertexType
|
||||
@@ -21,9 +21,9 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
DisplayPlaneClass();
|
||||
DisplayPlaneClass(const DisplayPlaneClass&);
|
||||
~DisplayPlaneClass();
|
||||
display_plane_class();
|
||||
display_plane_class(const display_plane_class&);
|
||||
~display_plane_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, float, float);
|
||||
void Shutdown();
|
||||
@@ -13,13 +13,13 @@ using namespace DirectX;
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "textureclass.h"
|
||||
#include "texture_class.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: FontClass
|
||||
// Class name: font_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class FontClass
|
||||
class font_class
|
||||
{
|
||||
private:
|
||||
struct FontType
|
||||
@@ -35,9 +35,9 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
FontClass();
|
||||
FontClass(const FontClass&);
|
||||
~FontClass();
|
||||
font_class();
|
||||
font_class(const font_class&);
|
||||
~font_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int);
|
||||
void Shutdown();
|
||||
@@ -56,7 +56,7 @@ private:
|
||||
|
||||
private:
|
||||
FontType* m_Font;
|
||||
TextureClass* m_Texture;
|
||||
texture_class* m_Texture;
|
||||
float m_fontHeight;
|
||||
int m_spaceSize;
|
||||
};
|
||||
@@ -15,14 +15,14 @@
|
||||
#include <mmsystem.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: FpsClass
|
||||
// Class name: fps_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class FpsClass
|
||||
class fps_class
|
||||
{
|
||||
public:
|
||||
FpsClass();
|
||||
FpsClass(const FpsClass&);
|
||||
~FpsClass();
|
||||
fps_class();
|
||||
fps_class(const fps_class&);
|
||||
~fps_class();
|
||||
|
||||
void Initialize();
|
||||
void Frame();
|
||||
22
enginecustom/src/inc/system/fps_limiter.h
Normal file
22
enginecustom/src/inc/system/fps_limiter.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
class fps_limiter {
|
||||
public:
|
||||
explicit fps_limiter(const float target_fps = 60.0f)
|
||||
: min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}
|
||||
|
||||
// Retourne true si la fonction peut etre executee
|
||||
bool should_run() {
|
||||
const auto now = std::chrono::high_resolution_clock::now();
|
||||
if (const float elapsed = std::chrono::duration<float>(now - last_time_).count(); elapsed >= min_delta_) {
|
||||
last_time_ = now;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
float min_delta_;
|
||||
std::chrono::high_resolution_clock::time_point last_time_;
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <DirectXMath.h>
|
||||
using namespace DirectX;
|
||||
|
||||
class Frustum
|
||||
class frustum
|
||||
{
|
||||
public:
|
||||
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);
|
||||
|
||||
@@ -4,15 +4,24 @@
|
||||
|
||||
#include "Logger.h"
|
||||
#include "sceneManager.h"
|
||||
#include "fps_limiter.h"
|
||||
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_dx11.h>
|
||||
#include <imgui_impl_win32.h>
|
||||
#include <windows.h>
|
||||
#include <deque>
|
||||
#include "rendertextureclass.h"
|
||||
#include <functional>
|
||||
|
||||
class ApplicationClass;
|
||||
#include "render_texture_class.h"
|
||||
|
||||
class application_class;
|
||||
|
||||
struct widget_entry
|
||||
{
|
||||
bool* show;
|
||||
std::function<void()> func;
|
||||
};
|
||||
|
||||
class imguiManager
|
||||
{
|
||||
@@ -22,29 +31,32 @@ public:
|
||||
|
||||
bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
|
||||
void Shutdown();
|
||||
void Render(ApplicationClass* app);
|
||||
void Render();
|
||||
void NewFrame();
|
||||
void SetupDockspace(ApplicationClass* app);
|
||||
void SetupDockspace();
|
||||
|
||||
// Widgets
|
||||
void WidgetSpeedSlider(float* speed);
|
||||
void WidgetButton();
|
||||
void WidgetFPS();
|
||||
void WidgetAddObject(ApplicationClass* app);
|
||||
void WidgetAddObject();
|
||||
|
||||
void WidgetObjectWindow(ApplicationClass* app);
|
||||
void WidgetTerrainWindow(ApplicationClass* app);
|
||||
void WidgetLightWindow(ApplicationClass* app);
|
||||
void WidgetEngineSettingsWindow(ApplicationClass* app);
|
||||
void WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSize);
|
||||
void WidgetLogWindow(ApplicationClass* app);
|
||||
void WidgetRenderStats(ApplicationClass* app);
|
||||
void WidgetObjectWindow();
|
||||
void WidgetTerrainWindow();
|
||||
void WidgetLightWindow();
|
||||
void WidgetEngineSettingsWindow();
|
||||
void WidgetRenderWindow(ImVec2 availableSize);
|
||||
void WidgetLogWindow();
|
||||
void WidgetRenderStats();
|
||||
|
||||
bool ImGuiWidgetRenderer(ApplicationClass* app);
|
||||
bool ImGuiWidgetRenderer();
|
||||
|
||||
void SetWindowSize(ImVec2 size) { windowSize = size; }
|
||||
ImVec2 GetWindowSize() const { return windowSize; }
|
||||
|
||||
// Getters
|
||||
void SetApp(application_class* app) { app_ = app; }
|
||||
|
||||
// Shader toggles
|
||||
|
||||
bool m_EnableCelShading;
|
||||
@@ -59,6 +71,9 @@ private:
|
||||
// ----------------- Variables ----------------- //
|
||||
// --------------------------------------------- //
|
||||
|
||||
std::vector<widget_entry> widgets_;
|
||||
|
||||
application_class* app_;
|
||||
|
||||
bool showObjectWindow;
|
||||
bool showTerrainWindow;
|
||||
@@ -83,9 +98,12 @@ private:
|
||||
ID3D11DeviceContext* m_deviceContext;
|
||||
ImVec2 windowSize;
|
||||
|
||||
RenderTextureClass* m_renderTexture;
|
||||
render_texture_class* m_renderTexture;
|
||||
|
||||
const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
|
||||
|
||||
int current_fps_, min_fps_, max_fps_, draw_calls_, total_vertex_count_, total_triangle_count_, visible_triangle_count_;
|
||||
float current_frame_time_, min_frame_time_, max_frame_time_ ;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -19,14 +19,14 @@
|
||||
#include <dinput.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: InputClass
|
||||
// Class name: input_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class InputClass
|
||||
class input_class
|
||||
{
|
||||
public:
|
||||
InputClass();
|
||||
InputClass(const InputClass&);
|
||||
~InputClass();
|
||||
input_class();
|
||||
input_class(const input_class&);
|
||||
~input_class();
|
||||
|
||||
bool Initialize(HINSTANCE, HWND, int, int);
|
||||
void Shutdown();
|
||||
@@ -14,14 +14,14 @@ using namespace DirectX;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: LightClass
|
||||
// Class name: light_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class LightClass
|
||||
class light_class
|
||||
{
|
||||
public:
|
||||
LightClass();
|
||||
LightClass(const LightClass&);
|
||||
~LightClass();
|
||||
light_class();
|
||||
light_class(const light_class&);
|
||||
~light_class();
|
||||
|
||||
void SetAmbientColor(float, float, float, float);
|
||||
void SetDiffuseColor(float, float, float, float);
|
||||
@@ -20,7 +20,7 @@ using namespace std;
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "textureclass.h"
|
||||
#include "texture_class.h"
|
||||
|
||||
enum class TextureType
|
||||
{
|
||||
@@ -46,7 +46,7 @@ struct TextureContainer
|
||||
std::vector<std::wstring> alphaPaths;
|
||||
|
||||
|
||||
// Get the vector of textures based on the type
|
||||
// Get the vector of textures_ based on the type
|
||||
std::vector<ID3D11ShaderResourceView*>& Get(TextureType type) const {
|
||||
switch (type) {
|
||||
case TextureType::Diffuse: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
|
||||
@@ -57,7 +57,7 @@ struct TextureContainer
|
||||
}
|
||||
}
|
||||
|
||||
// Get the vector of textures paths based on the type
|
||||
// Get the vector of textures_ paths based on the type
|
||||
std::vector<std::wstring> GetPaths(TextureType type) const {
|
||||
switch (type)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ struct TextureContainer
|
||||
return L"";
|
||||
}
|
||||
|
||||
// Release all textures and textures paths
|
||||
// Release all textures_ and textures_ paths
|
||||
|
||||
void ReleaseAll() {
|
||||
ReleaseVector(diffuse);
|
||||
@@ -145,9 +145,9 @@ private:
|
||||
}
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: ModelClass
|
||||
// Class name: model_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class ModelClass
|
||||
class model_class
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -200,15 +200,15 @@ protected:
|
||||
};
|
||||
|
||||
public:
|
||||
ModelClass();
|
||||
ModelClass(const ModelClass&) = delete;
|
||||
ModelClass& operator=(const ModelClass&) = delete;
|
||||
~ModelClass();
|
||||
model_class();
|
||||
model_class(const model_class&) = delete;
|
||||
model_class& operator=(const model_class&) = delete;
|
||||
~model_class();
|
||||
|
||||
//bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>);
|
||||
//bool initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>);
|
||||
// Nouvelle surcharge avec TextureContainer
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, const TextureContainer&);
|
||||
// Nouvelle méthode - initialisation sans textures
|
||||
// Nouvelle méthode - initialisation sans textures_
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*);
|
||||
void Shutdown();
|
||||
void Render(ID3D11DeviceContext*);
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
|
||||
// TEXTURE //
|
||||
|
||||
//ID3D11ShaderResourceView* GetTexture(int index) const;
|
||||
//ID3D11ShaderResourceView* get_texture(int index) const;
|
||||
ID3D11ShaderResourceView* GetTexture(TextureType type, int index) const;
|
||||
|
||||
//bool ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, int index);
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#include "modelclass.h"
|
||||
#include "model_class.h"
|
||||
#include <WICTextureLoader.h>
|
||||
#include <SimpleMath.h>
|
||||
|
||||
#include "d3dclass.h"
|
||||
#include "d_3d_class.h"
|
||||
|
||||
enum class ObjectType
|
||||
{
|
||||
@@ -26,14 +26,14 @@ enum class ShaderType
|
||||
ALPHA_MAPPING
|
||||
};
|
||||
|
||||
class Object : public ModelClass
|
||||
class object : public model_class
|
||||
{
|
||||
public:
|
||||
Object();
|
||||
~Object();
|
||||
object();
|
||||
~object();
|
||||
|
||||
Object(const Object&) = delete;
|
||||
Object& operator=(const Object&) = delete;
|
||||
object(const object&) = delete;
|
||||
object& operator=(const object&) = delete;
|
||||
|
||||
void SetScaleMatrix(XMMATRIX scaleMatrix);
|
||||
void SetRotateMatrix(XMMATRIX rotateMatrix);
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
void LaunchObject();
|
||||
bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,
|
||||
D3DClass* m_Direct3D);
|
||||
d_3d_class* m_Direct3D);
|
||||
bool SetupInstancing(ID3D11Device* device, const std::vector<XMMATRIX>& instanceTransforms);
|
||||
void EnableInstancing(bool enabled);
|
||||
void SetInstanceCount(int count);
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
#include "object.h"
|
||||
#include "math.h"
|
||||
|
||||
class Physics : public Object
|
||||
class physics : public object
|
||||
{
|
||||
public:
|
||||
Physics();
|
||||
explicit Physics(const Physics&); // Use explicit to avoid implicit conversion
|
||||
~Physics();
|
||||
physics();
|
||||
explicit physics(const physics&); // Use explicit to avoid implicit conversion
|
||||
~physics();
|
||||
|
||||
XMVECTOR GetGravity() const; // Get the gravity value
|
||||
void SetGravity(XMVECTOR gravity); // Define the gravity value
|
||||
void ApplyGravity(Object*, float); // Apply gravity to an object
|
||||
void AddForce(Object*, XMVECTOR);
|
||||
bool IsColliding(Object*, Object*);
|
||||
bool CubesOverlap(Object*, Object*);
|
||||
bool SpheresOverlap(Object*, Object*);
|
||||
bool SphereCubeOverlap(Object*, Object*);
|
||||
void ApplyGravity(object*, float); // Apply gravity to an object
|
||||
void AddForce(object*, XMVECTOR);
|
||||
bool IsColliding(object*, object*);
|
||||
bool CubesOverlap(object*, object*);
|
||||
bool SpheresOverlap(object*, object*);
|
||||
bool SphereCubeOverlap(object*, object*);
|
||||
|
||||
private:
|
||||
XMVECTOR m_gravity;
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: PositionClass
|
||||
// Class name: position_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class PositionClass
|
||||
class position_class
|
||||
{
|
||||
public:
|
||||
PositionClass();
|
||||
PositionClass(const PositionClass&);
|
||||
~PositionClass();
|
||||
position_class();
|
||||
position_class(const position_class&);
|
||||
~position_class();
|
||||
|
||||
void SetFrameTime(float);
|
||||
void GetRotation(float&, float&) const;
|
||||
@@ -15,14 +15,14 @@ using namespace DirectX;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: RenderTextureClass
|
||||
// Class name: render_texture_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class RenderTextureClass
|
||||
class render_texture_class
|
||||
{
|
||||
public:
|
||||
RenderTextureClass();
|
||||
RenderTextureClass(const RenderTextureClass&);
|
||||
~RenderTextureClass();
|
||||
render_texture_class();
|
||||
render_texture_class(const render_texture_class&);
|
||||
~render_texture_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, int, int, float, float, int);
|
||||
void Shutdown();
|
||||
@@ -13,13 +13,13 @@ using namespace DirectX;
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "textureclass.h"
|
||||
#include "texture_class.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: SpriteClass
|
||||
// Class name: sprite_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class SpriteClass
|
||||
class sprite_class
|
||||
{
|
||||
private:
|
||||
struct VertexType
|
||||
@@ -29,9 +29,9 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
SpriteClass();
|
||||
SpriteClass(const SpriteClass&);
|
||||
~SpriteClass();
|
||||
sprite_class();
|
||||
sprite_class(const sprite_class&);
|
||||
~sprite_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
|
||||
void Shutdown();
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
private:
|
||||
ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
|
||||
int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY;
|
||||
TextureClass* m_Textures;
|
||||
texture_class* m_Textures;
|
||||
float m_frameTime, m_cycleTime;
|
||||
int m_currentTexture, m_textureCount;
|
||||
};
|
||||
72
enginecustom/src/inc/system/system_class.h
Normal file
72
enginecustom/src/inc/system/system_class.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef _SYSTEMCLASS_H_
|
||||
#define _SYSTEMCLASS_H_
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
static bool DEBUG_MODE = true;
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
#include "input_class.h"
|
||||
#include "application_class.h"
|
||||
#include "imguiManager.h"
|
||||
#include <mutex>
|
||||
#include <filesystem>
|
||||
#include <commdlg.h>
|
||||
|
||||
#include "../resources.h"
|
||||
#include <chrono>
|
||||
|
||||
class system_class
|
||||
{
|
||||
public:
|
||||
system_class();
|
||||
system_class(const system_class&);
|
||||
~system_class();
|
||||
|
||||
bool initialize();
|
||||
void shutdown();
|
||||
void run();
|
||||
|
||||
LRESULT CALLBACK message_handler(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
void send_path(wchar_t* path, std::filesystem::path w_folder);
|
||||
|
||||
protected:
|
||||
bool frame();
|
||||
void initialize_windows(int&, int&);
|
||||
void shutdown_windows();
|
||||
|
||||
private:
|
||||
LPCWSTR application_name_;
|
||||
HINSTANCE hinstance_;
|
||||
HWND hwnd_;
|
||||
|
||||
input_class* input_;
|
||||
application_class* application_;
|
||||
imguiManager* imgui_manager_;
|
||||
|
||||
int initial_window_width_;
|
||||
int initial_window_height_;
|
||||
bool is_direct_3d_initialized_;
|
||||
bool is_resizing_ = false;
|
||||
bool is_debug_key_pressed_ = false;
|
||||
|
||||
std::mutex render_mutex_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////
|
||||
// FUNCTION PROTOTYPES //
|
||||
/////////////////////////
|
||||
static LRESULT CALLBACK wnd_proc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
static system_class* application_handle = 0;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
#ifndef _SYSTEMCLASS_H_
|
||||
#define _SYSTEMCLASS_H_
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
static bool DEBUG_MODE = true;
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
#include "inputclass.h"
|
||||
#include "applicationclass.h"
|
||||
#include "imguiManager.h"
|
||||
#include <mutex>
|
||||
#include <filesystem>
|
||||
#include <commdlg.h>
|
||||
|
||||
#include "../resources.h"
|
||||
#include <chrono>
|
||||
|
||||
class SystemClass
|
||||
{
|
||||
public:
|
||||
SystemClass();
|
||||
SystemClass(const SystemClass&);
|
||||
~SystemClass();
|
||||
|
||||
bool Initialize();
|
||||
void Shutdown();
|
||||
void Run();
|
||||
|
||||
LRESULT CALLBACK MessageHandler(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
void SendPath(wchar_t* path, std::filesystem::path WFolder);
|
||||
|
||||
void GetScenePath();
|
||||
|
||||
protected:
|
||||
bool Frame();
|
||||
void InitializeWindows(int&, int&);
|
||||
void ShutdownWindows();
|
||||
|
||||
private:
|
||||
LPCWSTR m_applicationName;
|
||||
HINSTANCE m_hinstance;
|
||||
HWND m_hwnd;
|
||||
|
||||
InputClass* m_Input;
|
||||
ApplicationClass* m_Application;
|
||||
imguiManager* m_imguiManager;
|
||||
|
||||
int m_initialWindowWidth;
|
||||
int m_initialWindowHeight;
|
||||
bool m_isDirect3DInitialized;
|
||||
bool m_isResizing = false;
|
||||
bool m_IsDebugKeyPressed = false;
|
||||
|
||||
std::mutex renderMutex;
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////
|
||||
// FUNCTION PROTOTYPES //
|
||||
/////////////////////////
|
||||
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
static SystemClass* ApplicationHandle = 0;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -5,11 +5,11 @@
|
||||
///////////////////////
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "fontclass.h"
|
||||
#include "font_class.h"
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TextClass
|
||||
// Class name: text_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class TextClass
|
||||
class text_class
|
||||
{
|
||||
private:
|
||||
struct VertexType
|
||||
@@ -19,21 +19,21 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
TextClass();
|
||||
TextClass(const TextClass&);
|
||||
~TextClass();
|
||||
text_class();
|
||||
text_class(const text_class&);
|
||||
~text_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, int, FontClass*, char*, int, int, float, float, float);
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, int, font_class*, char*, int, int, float, float, float);
|
||||
void Shutdown();
|
||||
void Render(ID3D11DeviceContext*);
|
||||
|
||||
int GetIndexCount();
|
||||
|
||||
bool UpdateText(ID3D11DeviceContext*, FontClass*, char*, int, int, float, float, float);
|
||||
bool UpdateText(ID3D11DeviceContext*, font_class*, char*, int, int, float, float, float);
|
||||
XMFLOAT4 GetPixelColor();
|
||||
|
||||
private:
|
||||
bool InitializeBuffers(ID3D11Device*, ID3D11DeviceContext*, FontClass*, char*, int, int, float, float, float);
|
||||
bool InitializeBuffers(ID3D11Device*, ID3D11DeviceContext*, font_class*, char*, int, int, float, float, float);
|
||||
void ShutdownBuffers();
|
||||
void RenderBuffers(ID3D11DeviceContext*);
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TextureClass
|
||||
// Class name: texture_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class TextureClass
|
||||
class texture_class
|
||||
{
|
||||
private:
|
||||
struct TargaHeader
|
||||
@@ -26,9 +26,9 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
TextureClass();
|
||||
TextureClass(const TextureClass&);
|
||||
~TextureClass();
|
||||
texture_class();
|
||||
texture_class(const texture_class&);
|
||||
~texture_class();
|
||||
|
||||
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, std::string);
|
||||
void Shutdown();
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: TimerClass
|
||||
// Class name: timer_class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class TimerClass
|
||||
class timer_class
|
||||
{
|
||||
public:
|
||||
TimerClass();
|
||||
TimerClass(const TimerClass&);
|
||||
~TimerClass();
|
||||
timer_class();
|
||||
timer_class(const timer_class&);
|
||||
~timer_class();
|
||||
|
||||
bool Initialize();
|
||||
void Frame();
|
||||
Reference in New Issue
Block a user