Engine tweaks + DefferedVertexDefinition
This commit is contained in:
parent
abed0157ec
commit
973aadac2d
|
@ -1,19 +1,18 @@
|
||||||
#include "Buffer.h"
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
|
||||||
using namespace Oyster::Graphics;
|
using namespace Oyster::Graphics;
|
||||||
|
|
||||||
Buffer::Buffer()
|
Core::Buffer::Buffer()
|
||||||
{
|
{
|
||||||
mBuffer = NULL;
|
mBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::~Buffer()
|
Core::Buffer::~Buffer()
|
||||||
{
|
{
|
||||||
SAFE_RELEASE(mBuffer);
|
SAFE_RELEASE(mBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Buffer::Apply(UINT32 misc) const
|
HRESULT Core::Buffer::Apply(UINT32 misc) const
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ HRESULT Buffer::Apply(UINT32 misc) const
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Buffer::Init(const BUFFER_INIT_DESC& initDesc)
|
HRESULT Core::Buffer::Init(const BUFFER_INIT_DESC& initDesc)
|
||||||
{
|
{
|
||||||
D3D11_BUFFER_DESC bufferDesc;
|
D3D11_BUFFER_DESC bufferDesc;
|
||||||
|
|
||||||
|
@ -154,13 +153,13 @@ HRESULT Buffer::Init(const BUFFER_INIT_DESC& initDesc)
|
||||||
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"Unable to create buffer.", L"Slenda Error", MB_ICONERROR | MB_OK);
|
//MessageBox(NULL, L"Unable to create buffer.", L"Slenda Error", MB_ICONERROR | MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Buffer::Map()
|
void* Core::Buffer::Map()
|
||||||
{
|
{
|
||||||
void* ret = NULL;
|
void* ret = NULL;
|
||||||
if(mUsage == BUFFER_CPU_WRITE || mUsage == BUFFER_CPU_READ || mUsage == BUFFER_CPU_WRITE_DISCARD)
|
if(mUsage == BUFFER_CPU_WRITE || mUsage == BUFFER_CPU_READ || mUsage == BUFFER_CPU_WRITE_DISCARD)
|
||||||
|
@ -192,17 +191,17 @@ void* Buffer::Map()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::Unmap()
|
void Core::Buffer::Unmap()
|
||||||
{
|
{
|
||||||
Core::deviceContext->Unmap( mBuffer, 0 );
|
Core::deviceContext->Unmap( mBuffer, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::operator ID3D11Buffer *()
|
Core::Buffer::operator ID3D11Buffer *()
|
||||||
{
|
{
|
||||||
return this->mBuffer;
|
return this->mBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::operator const ID3D11Buffer *() const
|
Core::Buffer::operator const ID3D11Buffer *() const
|
||||||
{
|
{
|
||||||
return this->mBuffer;
|
return this->mBuffer;
|
||||||
}
|
}
|
|
@ -1,79 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#ifndef CoreBuffer
|
|
||||||
#define CoreBuffer
|
|
||||||
|
|
||||||
#include "CoreIncludes.h"
|
|
||||||
|
|
||||||
namespace Oyster
|
|
||||||
{
|
|
||||||
namespace Graphics
|
|
||||||
{
|
|
||||||
class Buffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum BUFFER_TYPE
|
|
||||||
{
|
|
||||||
VERTEX_BUFFER,
|
|
||||||
INDEX_BUFFER,
|
|
||||||
CONSTANT_BUFFER_VS,
|
|
||||||
CONSTANT_BUFFER_GS,
|
|
||||||
CONSTANT_BUFFER_PS,
|
|
||||||
CONSTANT_BUFFER_CS,
|
|
||||||
STRUCTURED_BUFFER,
|
|
||||||
BUFFER_TYPE_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
enum BUFFER_USAGE
|
|
||||||
{
|
|
||||||
BUFFER_DEFAULT,
|
|
||||||
BUFFER_STREAM_OUT_TARGET,
|
|
||||||
BUFFER_CPU_WRITE,
|
|
||||||
BUFFER_CPU_WRITE_DISCARD,
|
|
||||||
BUFFER_CPU_READ,
|
|
||||||
BUFFER_USAGE_COUNT,
|
|
||||||
BUFFER_USAGE_IMMUTABLE
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BUFFER_INIT_DESC
|
|
||||||
{
|
|
||||||
BUFFER_TYPE Type;
|
|
||||||
UINT32 NumElements;
|
|
||||||
UINT32 ElementSize;
|
|
||||||
BUFFER_USAGE Usage;
|
|
||||||
void* InitData;
|
|
||||||
|
|
||||||
BUFFER_INIT_DESC()
|
|
||||||
{
|
|
||||||
InitData = NULL;
|
|
||||||
Usage = BUFFER_DEFAULT;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
protected:
|
|
||||||
ID3D11Buffer* mBuffer;
|
|
||||||
BUFFER_TYPE mType;
|
|
||||||
BUFFER_USAGE mUsage;
|
|
||||||
|
|
||||||
UINT32 mElementSize;
|
|
||||||
UINT32 mElementCount;
|
|
||||||
public:
|
|
||||||
Buffer();
|
|
||||||
virtual ~Buffer();
|
|
||||||
|
|
||||||
HRESULT Init(const BUFFER_INIT_DESC& initDesc);
|
|
||||||
|
|
||||||
void* Map();
|
|
||||||
void Unmap();
|
|
||||||
|
|
||||||
operator ID3D11Buffer*();
|
|
||||||
operator const ID3D11Buffer*() const;
|
|
||||||
|
|
||||||
HRESULT Apply(UINT32 misc = 0) const;
|
|
||||||
|
|
||||||
ID3D11Buffer* GetBufferPointer();
|
|
||||||
UINT32 GetVertexSize();
|
|
||||||
UINT32 GetElementCount();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "CoreIncludes.h"
|
#include "CoreIncludes.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "Buffer.h"
|
|
||||||
#include "OysterMath.h"
|
#include "OysterMath.h"
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
|
@ -36,6 +35,72 @@ namespace Oyster
|
||||||
|
|
||||||
static Oyster::Math::Float2 resolution;
|
static Oyster::Math::Float2 resolution;
|
||||||
|
|
||||||
|
class Buffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum BUFFER_TYPE
|
||||||
|
{
|
||||||
|
VERTEX_BUFFER,
|
||||||
|
INDEX_BUFFER,
|
||||||
|
CONSTANT_BUFFER_VS,
|
||||||
|
CONSTANT_BUFFER_GS,
|
||||||
|
CONSTANT_BUFFER_PS,
|
||||||
|
CONSTANT_BUFFER_CS,
|
||||||
|
STRUCTURED_BUFFER,
|
||||||
|
BUFFER_TYPE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BUFFER_USAGE
|
||||||
|
{
|
||||||
|
BUFFER_DEFAULT,
|
||||||
|
BUFFER_STREAM_OUT_TARGET,
|
||||||
|
BUFFER_CPU_WRITE,
|
||||||
|
BUFFER_CPU_WRITE_DISCARD,
|
||||||
|
BUFFER_CPU_READ,
|
||||||
|
BUFFER_USAGE_COUNT,
|
||||||
|
BUFFER_USAGE_IMMUTABLE
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BUFFER_INIT_DESC
|
||||||
|
{
|
||||||
|
BUFFER_TYPE Type;
|
||||||
|
UINT32 NumElements;
|
||||||
|
UINT32 ElementSize;
|
||||||
|
BUFFER_USAGE Usage;
|
||||||
|
void* InitData;
|
||||||
|
|
||||||
|
BUFFER_INIT_DESC()
|
||||||
|
{
|
||||||
|
InitData = NULL;
|
||||||
|
Usage = BUFFER_DEFAULT;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
protected:
|
||||||
|
ID3D11Buffer* mBuffer;
|
||||||
|
BUFFER_TYPE mType;
|
||||||
|
BUFFER_USAGE mUsage;
|
||||||
|
|
||||||
|
UINT32 mElementSize;
|
||||||
|
UINT32 mElementCount;
|
||||||
|
public:
|
||||||
|
Buffer();
|
||||||
|
virtual ~Buffer();
|
||||||
|
|
||||||
|
HRESULT Init(const BUFFER_INIT_DESC& initDesc);
|
||||||
|
|
||||||
|
void* Map();
|
||||||
|
void Unmap();
|
||||||
|
|
||||||
|
operator ID3D11Buffer*();
|
||||||
|
operator const ID3D11Buffer*() const;
|
||||||
|
|
||||||
|
HRESULT Apply(UINT32 misc = 0) const;
|
||||||
|
|
||||||
|
ID3D11Buffer* GetBufferPointer();
|
||||||
|
UINT32 GetVertexSize();
|
||||||
|
UINT32 GetElementCount();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class ShaderManager
|
class ShaderManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,18 @@ namespace Oyster
|
||||||
Oyster::Math::Matrix V;
|
Oyster::Math::Matrix V;
|
||||||
Oyster::Math::Matrix P;
|
Oyster::Math::Matrix P;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FinalVertex
|
||||||
|
{
|
||||||
|
Oyster::Math::Float3 pos;
|
||||||
|
Oyster::Math::Float2 uv;
|
||||||
|
Oyster::Math::Float3 normal;
|
||||||
|
Oyster::Math::Float3 tangent;
|
||||||
|
Oyster::Math::Float3 biTangent;
|
||||||
|
Oyster::Math::Float4 boneIndex;
|
||||||
|
Oyster::Math::Float4 boneWeights;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,11 +19,11 @@ public:
|
||||||
State Init(HWND Window, bool MSAA_Quality, bool Fullscreen);
|
State Init(HWND Window, bool MSAA_Quality, bool Fullscreen);
|
||||||
//! @brief from Oyster::Math Float4x4, expects corect methods
|
//! @brief from Oyster::Math Float4x4, expects corect methods
|
||||||
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
|
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
|
||||||
static void RenderScene(Oyster::Graphics::Render::Model* models, int count);
|
static void RenderScene(Oyster::Graphics::Model::Model* models, int count);
|
||||||
static void EndFrame();
|
static void EndFrame();
|
||||||
|
|
||||||
static Oyster::Graphics::Render::Model* CreateModel(std::wstring filename);
|
static Oyster::Graphics::Model::Model* CreateModel(std::wstring filename);
|
||||||
|
static void DeleteModel(Oyster::Graphics::Model::Model* model);
|
||||||
|
|
||||||
static State SetOptions(Option);
|
static State SetOptions(Option);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "OBJReader.h"
|
#include "OBJReader.h"
|
||||||
#include "..\Definitions\GraphicalDefinition.h"
|
#include "..\Definitions\GraphicalDefinition.h"
|
||||||
#include "..\Core\Buffer.h"
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
@ -96,17 +95,17 @@ void OBJReader::readOBJFile( std::wstring fileName )
|
||||||
inStream.close();
|
inStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Oyster::Graphics::Render::ModelInfo* OBJReader::toModel()
|
Oyster::Graphics::Model::ModelInfo* OBJReader::toModel()
|
||||||
{
|
{
|
||||||
Oyster::Graphics::Buffer* b = new Oyster::Graphics::Buffer();
|
Oyster::Graphics::Core::Buffer* b = new Oyster::Graphics::Core::Buffer();
|
||||||
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
|
Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC desc;
|
||||||
Oyster::Graphics::Render::ModelInfo* modelInfo = new Oyster::Graphics::Render::ModelInfo();
|
Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo();
|
||||||
|
|
||||||
desc.ElementSize = 32;
|
desc.ElementSize = 32;
|
||||||
desc.InitData = &this->_myOBJ[0];
|
desc.InitData = &this->_myOBJ[0];
|
||||||
desc.NumElements = this->_myOBJ.size();
|
desc.NumElements = this->_myOBJ.size();
|
||||||
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
|
desc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
|
||||||
desc.Usage = Oyster::Graphics::Buffer::BUFFER_DEFAULT;
|
desc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_DEFAULT;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
hr = b->Init(desc);
|
hr = b->Init(desc);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class OBJReader
|
||||||
~OBJReader();
|
~OBJReader();
|
||||||
|
|
||||||
void readOBJFile( std::wstring fileName);
|
void readOBJFile( std::wstring fileName);
|
||||||
Oyster::Graphics::Render::ModelInfo* toModel();
|
Oyster::Graphics::Model::ModelInfo* toModel();
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -2,22 +2,16 @@
|
||||||
#ifndef Mesh_h
|
#ifndef Mesh_h
|
||||||
#define Mesh_h
|
#define Mesh_h
|
||||||
|
|
||||||
#include "ModelInfo.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
namespace Render
|
namespace Model
|
||||||
{
|
{
|
||||||
struct Model
|
struct Model
|
||||||
{
|
{
|
||||||
|
void* info;
|
||||||
void* const info;
|
Oyster::Math::Float4x4 WorldMatrix;
|
||||||
//ModelInfo* info;
|
|
||||||
void* data;
|
|
||||||
int size;
|
|
||||||
bool Visible;
|
bool Visible;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,18 @@
|
||||||
#define MODELINFO_h
|
#define MODELINFO_h
|
||||||
|
|
||||||
|
|
||||||
#include "..\Core\CoreIncludes.h"
|
#include "..\Core\Core.h"
|
||||||
#include "..\Core\Buffer.h"
|
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
namespace Graphics
|
namespace Graphics
|
||||||
{
|
{
|
||||||
namespace Render
|
namespace Model
|
||||||
{
|
{
|
||||||
struct ModelInfo
|
struct ModelInfo
|
||||||
{
|
{
|
||||||
std::vector<ID3D11ShaderResourceView*> Material;
|
std::vector<ID3D11ShaderResourceView*> Material;
|
||||||
Buffer *Vertices,*Indecies;
|
Core::Buffer *Vertices,*Indecies;
|
||||||
bool Indexed;
|
bool Indexed;
|
||||||
int VertexCount;
|
int VertexCount;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Render.h"
|
#include "Render.h"
|
||||||
#include "../Resources/Resources.h"
|
#include "../Resources/Resources.h"
|
||||||
#include "../../Definitions/GraphicalDefinition.h"
|
#include "../../Definitions/GraphicalDefinition.h"
|
||||||
|
#include "../../Model/ModelInfo.h"
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
|
@ -28,27 +29,30 @@ namespace Oyster
|
||||||
Resources::VPData.Apply();
|
Resources::VPData.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Basic::RenderScene(Model* models, int count)
|
void Basic::RenderScene(Model::Model* models, int count)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < count; ++i)
|
for(int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if(models[i].Visible)
|
if(models[i].Visible)
|
||||||
{
|
{
|
||||||
void* data = Resources::ModelData.Map();
|
void* data = Resources::ModelData.Map();
|
||||||
memcpy(data,&(models[i].data),64);
|
memcpy(data,&(models[i].WorldMatrix),64);
|
||||||
Resources::ModelData.Unmap();
|
Resources::ModelData.Unmap();
|
||||||
|
|
||||||
//Set Materials :: NONE
|
//Set Materials :: NONE
|
||||||
|
|
||||||
models[i].info->Vertices->Apply();
|
Model
|
||||||
if(models[i].info->Indexed)
|
::ModelInfo* info = (Model::ModelInfo*)models[i].info;
|
||||||
|
|
||||||
|
info->Vertices->Apply();
|
||||||
|
if(info->Indexed)
|
||||||
{
|
{
|
||||||
models[i].info->Indecies->Apply();
|
info->Indecies->Apply();
|
||||||
Oyster::Graphics::Core::deviceContext->DrawIndexed(models[i].info->VertexCount,0,0);
|
Oyster::Graphics::Core::deviceContext->DrawIndexed(info->VertexCount,0,0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Oyster::Graphics::Core::deviceContext->Draw(models[i].info->VertexCount,0);
|
Oyster::Graphics::Core::deviceContext->Draw(info->VertexCount,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Oyster
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
|
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
|
||||||
static void RenderScene(Model* models, int count);
|
static void RenderScene(Model::Model* models, int count);
|
||||||
static void EndFrame();
|
static void EndFrame();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ const std::wstring PixelRed = L"DebugPixel";
|
||||||
typedef Oyster::Graphics::Core::ShaderManager::ShaderType ShaderType;
|
typedef Oyster::Graphics::Core::ShaderManager::ShaderType ShaderType;
|
||||||
typedef Oyster::Graphics::Core::ShaderManager::Get GetShader;
|
typedef Oyster::Graphics::Core::ShaderManager::Get GetShader;
|
||||||
typedef Oyster::Graphics::Core::ShaderManager Shader;
|
typedef Oyster::Graphics::Core::ShaderManager Shader;
|
||||||
|
typedef Oyster::Graphics::Core::Buffer Buffer;
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
|
@ -99,7 +100,6 @@ namespace Oyster
|
||||||
obj.RenderStates.Rasterizer = rs;
|
obj.RenderStates.Rasterizer = rs;
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
return Core::Init::Sucsess;
|
return Core::Init::Sucsess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Core::ShaderManager::ShaderEffect obj;
|
static Core::ShaderManager::ShaderEffect obj;
|
||||||
static Buffer ModelData;
|
static Core::Buffer ModelData;
|
||||||
static Buffer VPData;
|
static Core::Buffer VPData;
|
||||||
|
|
||||||
static Core::Init::State Init();
|
static Core::Init::State Init();
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
struct VertexOut
|
||||||
|
{
|
||||||
|
float4 pos : SV_POSITION;
|
||||||
|
float4 ViewPos: POSITION;
|
||||||
|
float2 UV : TEXCOORD;
|
||||||
|
float4 normal : NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PixelOut
|
||||||
|
{
|
||||||
|
float4 Diffuse3Glow1 : SV_TARGET0;
|
||||||
|
float4 Normal3Specular1 : SV_TARGET1;
|
||||||
|
float4 VPos : SV_TARGET2;
|
||||||
|
};
|
||||||
|
|
||||||
|
Texture2D Diffuse;
|
||||||
|
Texture2D Specular;
|
||||||
|
|
||||||
|
PixelOut main(VertexOut input)
|
||||||
|
{
|
||||||
|
PixelOut output;
|
||||||
|
output.Diffuse3Glow1 = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
output.Normal3Specular1 = float4(input.normal, 1.0f);
|
||||||
|
return output;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
cbuffer PerFrame : register(b0)
|
||||||
|
{
|
||||||
|
matrix View;
|
||||||
|
float4x4 Projection;
|
||||||
|
matrix VP;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbuffer PerModel : register(b1)
|
||||||
|
{
|
||||||
|
matrix World;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct VertexIn
|
||||||
|
{
|
||||||
|
float3 pos : POSITION;
|
||||||
|
float2 UV : TEXCOORD;
|
||||||
|
float3 normal : NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VertexOut
|
||||||
|
{
|
||||||
|
float4 pos : SV_POSITION;
|
||||||
|
float4 ViewPos: POSITION;
|
||||||
|
float2 UV : TEXCOORD;
|
||||||
|
float4 normal : NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
VertexOut main( VertexIn input )
|
||||||
|
{
|
||||||
|
VertexOut output;
|
||||||
|
matrix WV = mul(View, World);
|
||||||
|
output.ViewPos = mul(WV, float4(input.pos,1));
|
||||||
|
output.pos = mul(Projection, output.ViewPos);
|
||||||
|
output.UV = input.UV;
|
||||||
|
output.normal = float4(input.normal, 0);
|
||||||
|
return output;
|
||||||
|
}
|
|
@ -19,7 +19,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
HINSTANCE g_hInst = NULL;
|
HINSTANCE g_hInst = NULL;
|
||||||
HWND g_hWnd = NULL;
|
HWND g_hWnd = NULL;
|
||||||
Oyster::Graphics::Render::Model* m = new Oyster::Graphics::Render::Model();
|
Oyster::Graphics::Model::Model* m = new Oyster::Graphics::Model::Model();
|
||||||
Oyster::Math::Float4x4 V;
|
Oyster::Math::Float4x4 V;
|
||||||
Oyster::Math::Float4x4 P;
|
Oyster::Math::Float4x4 P;
|
||||||
|
|
||||||
|
@ -178,7 +178,8 @@ HRESULT InitDirect3D()
|
||||||
#pragma region Obj
|
#pragma region Obj
|
||||||
OBJReader or;
|
OBJReader or;
|
||||||
or.readOBJFile(L"bth.obj");
|
or.readOBJFile(L"bth.obj");
|
||||||
m->info = or.toModel();
|
m->info = (void*)or.toModel();
|
||||||
|
m->Visible=true;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
//*((Oyster::Math::Matrix)m->data) = Oyster::Math::Matrix::identity;
|
//*((Oyster::Math::Matrix)m->data) = Oyster::Math::Matrix::identity;
|
||||||
|
|
Loading…
Reference in New Issue