start with Instanced

This commit is contained in:
lanariel 2014-02-21 11:49:24 +01:00
parent 67d150fce1
commit bd0daf363d
6 changed files with 37 additions and 1 deletions

View File

@ -90,7 +90,7 @@ bool GameState::Init( SharedStateContent &shared )
this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f );
Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
gfxOp.AmbientValue = 0.5f;
gfxOp.GlobalGlowTint = Math::Float3(2,1,1);
gfxOp.GlobalGlowTint = Math::Float3(1,1,1);
gfxOp.GlobalTint = Math::Float3(1,1,1);
Graphics::API::SetOptions(gfxOp);

View File

@ -90,6 +90,13 @@ namespace Oyster
Math::Float3 GlowTint;
Math::Float PAD2;
};
struct RenderInstanceData
{
Math::Matrix WV;
Math::Matrix WVP;
TintData td;
};
}
}
}

View File

@ -19,6 +19,7 @@ namespace Oyster
Math::Float4x4 Projection;
std::vector<Definitions::Pointlight> Lights;
float deltaTime;
int MostModel;
#ifdef _DEBUG
Model::Model* cube;
Model::Model* sphere;
@ -133,6 +134,16 @@ namespace Oyster
return API::Sucsess;
}
void API::BeginLoadingModels()
{
}
void API::EndLoadingModels()
{
//TODO finalize instance buffers and create rendering map;
}
//returns null for invalid filenames
Model::Model* API::CreateModel(std::wstring filename)
{
@ -144,6 +155,8 @@ namespace Oyster
m->GlowTint = Math::Float3(1);
m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN);
Core::loader
Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
if(!mi || mi->Vertices->GetBufferPointer() == NULL)
{

View File

@ -42,6 +42,10 @@ namespace Oyster
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Option options);
static void BeginLoadingModels();
static void EndLoadingModels();
static State ReloadShaders();
//should be called after rendered normal models, before GUI or Text rendering

View File

@ -63,6 +63,8 @@ namespace Oyster
ID3D11ShaderResourceView* Resources::Gui::Text::Font = NULL;
ID3D11DepthStencilView* Resources::Gui::depth = NULL;
std::map<Model::ModelInfo*, Resources::ModelDataWrapper*> Resources::RenderData = std::map<Model::ModelInfo*, Resources::ModelDataWrapper*>();
#pragma endregion

View File

@ -1,6 +1,8 @@
#pragma once
#include "../Core/Core.h"
#include "../Model/ModelInfo.h"
#include "../Definitions/GraphicalDefinition.h"
namespace Oyster
{
@ -11,6 +13,14 @@ namespace Oyster
class Resources
{
public:
struct ModelDataWrapper
{
Definitions::RenderInstanceData* rid;
int Models;
};
static std::map<Model::ModelInfo*, ModelDataWrapper*> RenderData;
static const int GBufferSize = 3;
static const int LBufferSize = 3;