Added Gui Transparancy,
Get Options provides Resolution.xy
This commit is contained in:
parent
52301021f6
commit
197067687e
Code
Game/GameClient/GameClientState
OysterGraphics
DllInterfaces
Render
Shader/Passes/2D
|
@ -21,21 +21,37 @@ namespace DanBias
|
|||
ButtonRectangle()
|
||||
: EventButtonGUI(), width(0), height(0)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize)
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButtonGUI(textureName, buttonText,
|
||||
textColor, backColor, hoverColor, pressedColor,
|
||||
owner, pos, size, resize)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize)
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
EventFunc func, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButtonGUI(textureName, buttonText,
|
||||
textColor, backColor, hoverColor, pressedColor,
|
||||
func, pos, size, resize)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize)
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButtonGUI(textureName, buttonText,
|
||||
textColor, backColor, hoverColor, pressedColor,
|
||||
func, owner, pos, size, resize)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize)
|
||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButtonGUI(textureName, buttonText,
|
||||
textColor, backColor, hoverColor, pressedColor,
|
||||
func, owner, userData, pos, size, resize)
|
||||
{}
|
||||
virtual ~ButtonRectangle()
|
||||
{}
|
||||
|
|
|
@ -30,32 +30,40 @@ namespace DanBias
|
|||
class EventButtonGUI : public Oyster::Event::EventButton<Owner>
|
||||
{
|
||||
public:
|
||||
EventButtonGUI()
|
||||
: EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(1, 1, 1, 1)
|
||||
{}
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||
}
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
EventFunc func, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||
}
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||
}
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||
: EventButton(func, owner, userData), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor)
|
||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||
EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||
: EventButton(func, owner, userData), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||
|
@ -77,23 +85,23 @@ namespace DanBias
|
|||
if(EventButton<Owner>::Enabled())
|
||||
{
|
||||
// let the using dev decide what is rendered
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
//Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
//Render att xPos and yPos
|
||||
//With width and height
|
||||
|
||||
//if(EventButton<Owner>::GetState() == ButtonState_None)
|
||||
//{
|
||||
// Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f));
|
||||
//}
|
||||
//else if(EventButton<Owner>::GetState() == ButtonState_Hover)
|
||||
//{
|
||||
// Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(0.0f, 1.0f, 0.0f));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 0.0f, 0.0f));
|
||||
//}
|
||||
if(EventButton<Owner>::GetState() == ButtonState_None)
|
||||
{
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, backColor);
|
||||
}
|
||||
else if(EventButton<Owner>::GetState() == ButtonState_Hover)
|
||||
{
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, hoverColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, pressedColor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +110,7 @@ namespace DanBias
|
|||
{
|
||||
if(buttonText.size() > 0)
|
||||
{
|
||||
Oyster::Graphics::API::RenderText(buttonText, pos - Float3(size.x * 0.5f, size.y * 0.25f, 0.0f), size*2.0f, size.y * 0.5f, textColor);
|
||||
Oyster::Graphics::API::RenderText(buttonText, pos - Float3(size.x * 0.5f, size.y * 0.25f, -0.001f), size, size.y * 0.5f, textColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,6 +134,10 @@ namespace DanBias
|
|||
|
||||
std::wstring buttonText;
|
||||
Oyster::Math::Float4 textColor;
|
||||
|
||||
Oyster::Math::Float4 backColor;
|
||||
Oyster::Math::Float4 hoverColor;
|
||||
Oyster::Math::Float4 pressedColor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace DanBias { namespace Client
|
|||
{
|
||||
public:
|
||||
TextField();
|
||||
TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height );
|
||||
TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, ::Oyster::Math::Float4 backColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height );
|
||||
virtual ~TextField();
|
||||
|
||||
virtual void RenderText();
|
||||
|
@ -62,8 +62,8 @@ namespace DanBias { namespace Client
|
|||
}
|
||||
|
||||
template<typename Owner>
|
||||
TextField<Owner>::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize )
|
||||
: ButtonRectangle( backgroundTexture, L"", textColor, owner, pos, size, resize )
|
||||
TextField<Owner>::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, ::Oyster::Math::Float4 backColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize )
|
||||
: ButtonRectangle( backgroundTexture, L"", textColor, backColor, backColor, backColor, owner, pos, size, resize )
|
||||
{
|
||||
this->fontHeight = 0.025f;
|
||||
this->lineSpacing = 0.001f;
|
||||
|
|
|
@ -55,10 +55,10 @@ bool LanMenuState::Init( SharedStateContent &shared )
|
|||
this->privData->nwClient = shared.network;
|
||||
this->privData->input = shared.input;
|
||||
|
||||
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
|
||||
this->privData->background = Graphics::API::CreateTexture( L"color_white.png" );
|
||||
|
||||
// create guiElements
|
||||
this->privData->connectIP = new TextField<LanMenuState*>( L"earth_md.png", Float4(1.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None );
|
||||
this->privData->connectIP = new TextField<LanMenuState*>( L"color_white.png", Float4(1.0f), Float4(0.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None );
|
||||
this->privData->connectIP->ReserveLines( 1 );
|
||||
this->privData->connectIP->AppendText( L"127.0.0.1" );
|
||||
this->privData->connectIP->SetFontHeight( 0.08f );
|
||||
|
@ -68,10 +68,10 @@ bool LanMenuState::Init( SharedStateContent &shared )
|
|||
this->privData->guiElements.AddButton( this->privData->connectIP );
|
||||
|
||||
ButtonRectangle<LanMenuState*> *guiElements;
|
||||
guiElements = new ButtonRectangle<LanMenuState*>( L"earth_md.png", L"Connect", Float4(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None );
|
||||
guiElements = new ButtonRectangle<LanMenuState*>( L"color_white.png", L"Connect", Float4(1.0f),Float4(0.0f),Float4(0.0f),Float4(0.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None );
|
||||
this->privData->guiElements.AddButton( guiElements );
|
||||
|
||||
guiElements = new ButtonRectangle<LanMenuState*>( L"earth_md.png", L"Exit", Float4(1.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None );
|
||||
guiElements = new ButtonRectangle<LanMenuState*>( L"color_white.png", L"Exit", Float4(1.0f),Float4(0.0f),Float4(0.0f),Float4(0.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None );
|
||||
this->privData->guiElements.AddButton( guiElements );
|
||||
|
||||
// bind guiElements collection to the singleton eventhandler
|
||||
|
|
|
@ -50,7 +50,7 @@ bool LobbyAdminState::Init( SharedStateContent &shared )
|
|||
// create buttons
|
||||
ButtonRectangle<LobbyAdminState*> *button;
|
||||
|
||||
button = new ButtonRectangle<LobbyAdminState*>( L"earth_md.png", L"Ready", Float4(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
button = new ButtonRectangle<LobbyAdminState*>( L"earth_md.png", L"Ready", Float4(1.0f),Float4(0.0f),Float4(0.0f),Float4(0.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
this->privData->guiElements.AddButton( button );
|
||||
|
||||
// bind button collection to the singleton eventhandler
|
||||
|
|
|
@ -50,7 +50,7 @@ bool LobbyState::Init( SharedStateContent &shared )
|
|||
// create buttons
|
||||
ButtonRectangle<LobbyState*> *button;
|
||||
|
||||
button = new ButtonRectangle<LobbyState*>( L"earth_md.png", L"Ready", Float4(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
button = new ButtonRectangle<LobbyState*>( L"earth_md.png", L"Ready", Float4(1.0f), Float4(0.0f), Float4(0.0f), Float4(0.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
this->privData->guiElements.AddButton( button );
|
||||
|
||||
// bind button collection to the singleton eventhandler
|
||||
|
|
|
@ -49,18 +49,22 @@ bool MainState::Init( SharedStateContent &shared )
|
|||
this->privData->nwClient = shared.network;
|
||||
this->privData->input = shared.input;
|
||||
|
||||
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
|
||||
this->privData->background = Graphics::API::CreateTexture( L"color_white.png" );
|
||||
|
||||
// create buttons
|
||||
ButtonRectangle<MainState*> *button;
|
||||
Float4 TextCol = Float4(1.0f,0.0f,1.0f,1.0f);
|
||||
Float4 BackCol = Float4(1.0f,1.0f,1.0f,0.5f);
|
||||
Float4 HoverCol = Float4(0.0f,1.0f,0.0f,1.0f);
|
||||
Float4 PressCol = Float4(0.0f,0.0f,1.0f,1.0f);
|
||||
|
||||
button = new ButtonRectangle<MainState*>( L"earth_md.png", L"Create", Float4(1.0f), OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
button = new ButtonRectangle<MainState*>( L"color_white.png", L"Create",TextCol, BackCol, HoverCol, PressCol, OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f));
|
||||
this->privData->guiElements.AddButton( button );
|
||||
|
||||
button = new ButtonRectangle<MainState*>( L"skysphere_md.png", L"Join", Float4(1.0f), OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
button = new ButtonRectangle<MainState*>( L"color_white.png", L"Join", TextCol, BackCol, HoverCol, PressCol, OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f));
|
||||
this->privData->guiElements.AddButton( button );
|
||||
|
||||
button = new ButtonRectangle<MainState*>( L"plane_texture_md.png", L"Quit", Float4(1.0f), OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
|
||||
button = new ButtonRectangle<MainState*>( L"color_white.png", L"Quit", TextCol, BackCol, HoverCol, PressCol, OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f));
|
||||
this->privData->guiElements.AddButton( button );
|
||||
|
||||
// bind button collection to the singleton eventhandler
|
||||
|
@ -73,6 +77,11 @@ GameClientState::ClientState MainState::Update( float deltaTime )
|
|||
{
|
||||
MouseInput mouseState;
|
||||
{
|
||||
bool test = this->privData->input->IsMousePressed();
|
||||
if(test)
|
||||
{
|
||||
int i = 0;
|
||||
};
|
||||
this->privData->input->GetMousePos( mouseState.x, mouseState.y );
|
||||
mouseState.mouseButtonPressed = this->privData->input->IsMousePressed();
|
||||
}
|
||||
|
@ -87,7 +96,7 @@ bool MainState::Render()
|
|||
Graphics::API::NewFrame();
|
||||
Graphics::API::StartGuiRender();
|
||||
|
||||
Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) );
|
||||
Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 0.9f), Float2(1.0f), Float4(63.0f/255.0f,73.0f/255.0f,127.0f/255.0f,0.6f) );
|
||||
this->privData->guiElements.RenderTexture();
|
||||
|
||||
Graphics::API::StartTextRender();
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace Oyster
|
|||
Math::Float4x4 Projection;
|
||||
std::vector<Definitions::Pointlight> Lights;
|
||||
float deltaTime;
|
||||
#ifdef _DEBUG
|
||||
Model::Model* cube;
|
||||
Model::Model* sphere;
|
||||
#endif
|
||||
}
|
||||
|
||||
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion)
|
||||
|
@ -33,6 +37,12 @@ namespace Oyster
|
|||
Render::Resources::Init();
|
||||
|
||||
Render::Preparations::Basic::SetViewPort();
|
||||
#ifdef _DEBUG
|
||||
//fix load model
|
||||
cube = CreateModel(L"debug_cube.dan");
|
||||
sphere = CreateModel(L"debug_sphere.dan");
|
||||
|
||||
#endif
|
||||
return API::Sucsess;
|
||||
}
|
||||
|
||||
|
@ -145,6 +155,10 @@ namespace Oyster
|
|||
Render::Resources::InitShaders();
|
||||
return State::Sucsess;
|
||||
}
|
||||
|
||||
void API::StartRenderWireFrame()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
API::Option API::GetOption()
|
||||
|
@ -153,6 +167,7 @@ namespace Oyster
|
|||
o.BytesUsed = Core::UsedMem;
|
||||
o.modelPath = Core::modelPath;
|
||||
o.texturePath = Core::texturePath;
|
||||
o.Resolution = Core::resolution;
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@ namespace Oyster
|
|||
struct Option
|
||||
{
|
||||
std::wstring modelPath, texturePath;
|
||||
//between 0-1
|
||||
float AmbientValue;
|
||||
|
||||
Math::Float2 Resolution;
|
||||
|
||||
//Bytes on the GPU
|
||||
int BytesUsed;
|
||||
};
|
||||
typedef void* Texture;
|
||||
|
@ -34,6 +40,17 @@ namespace Oyster
|
|||
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion);
|
||||
#ifdef _DEBUG
|
||||
static State ReloadShaders();
|
||||
|
||||
//should be called after rendered normal models, before GUI or Text rendering
|
||||
static void StartRenderWireFrame();
|
||||
|
||||
//Render a unit cube with the presented WorldMatrix
|
||||
static void RenderDebugCube(Math::Matrix world);
|
||||
|
||||
//Render a unit Sphere with the presented WorldMatrix
|
||||
static void RenderDebugSphere(Math::Matrix world);
|
||||
|
||||
static void StartRenderFullModel();
|
||||
#endif
|
||||
|
||||
//! @todo Memory Leaks
|
||||
|
|
|
@ -16,7 +16,8 @@ namespace Oyster
|
|||
|
||||
void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights)
|
||||
{
|
||||
Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,0,0,1));
|
||||
Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,0,0));
|
||||
Preparations::Basic::ClearDepthStencil(Resources::Gui::depth);
|
||||
Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,0));
|
||||
Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Gather::Pass);
|
||||
Lights[1];
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Oyster
|
|||
namespace Render
|
||||
{
|
||||
const int TEXT_NR_LETTERS=95;
|
||||
const float TEXT_SPACING=1.8f;
|
||||
const float TEXT_SPACING=2.0f;
|
||||
|
||||
void Gui::Begin2DRender()
|
||||
{
|
||||
|
@ -20,8 +20,8 @@ namespace Oyster
|
|||
{
|
||||
Core::deviceContext->PSSetShaderResources(0,1,&tex);
|
||||
|
||||
pos *= 2;
|
||||
pos -= 1;
|
||||
pos.xy *= 2;
|
||||
pos.xy -= 1;
|
||||
pos.y *= -1;
|
||||
|
||||
Definitions::GuiData gd;
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Oyster
|
|||
ID3D11BlendState* Resources::RenderStates::bs = NULL;
|
||||
|
||||
ID3D11ShaderResourceView* Resources::Gui::Text::Font = NULL;
|
||||
ID3D11DepthStencilView* Resources::Gui::depth = NULL;
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
@ -304,6 +305,7 @@ namespace Oyster
|
|||
ID3D11Texture1D *pTexture1;
|
||||
|
||||
Core::device->CreateTexture1D( &T1desc, &sphere, &pTexture1 );
|
||||
Core::UsedMem += T1desc.Width * 16;
|
||||
Core::device->CreateShaderResourceView( pTexture1, 0, &Light::SSAOKernel );
|
||||
pTexture1->Release();
|
||||
|
||||
|
@ -323,8 +325,33 @@ namespace Oyster
|
|||
ID3D11Texture2D *pTexture2;
|
||||
|
||||
Core::device->CreateTexture2D( &T2desc, &rnd, &pTexture2 );
|
||||
Core::UsedMem += T2desc.Height * T2desc.Width * 16;
|
||||
Core::device->CreateShaderResourceView( (pTexture2), 0, &Light::SSAORandom );
|
||||
pTexture2->Release();
|
||||
|
||||
//create Depth Buffer
|
||||
D3D11_TEXTURE2D_DESC dTDesc;
|
||||
dTDesc.MipLevels=1;
|
||||
dTDesc.ArraySize=1;
|
||||
dTDesc.Format = DXGI_FORMAT_D32_FLOAT;
|
||||
dTDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
dTDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||
dTDesc.CPUAccessFlags=0;
|
||||
dTDesc.MiscFlags=0;
|
||||
dTDesc.Height = Core::resolution.y;
|
||||
dTDesc.Width = Core::resolution.x;
|
||||
dTDesc.SampleDesc.Count=1;
|
||||
dTDesc.SampleDesc.Quality=0;
|
||||
|
||||
ID3D11Texture2D* depthstencil;
|
||||
Core::device->CreateTexture2D(&dTDesc,0,&depthstencil);
|
||||
Core::UsedMem += dTDesc.Height * dTDesc.Width * 4;
|
||||
Core::device->CreateDepthStencilView(depthstencil,NULL,&Gui::depth);
|
||||
depthstencil->Release();
|
||||
|
||||
|
||||
D3D11_DEPTH_STENCIL_DESC dDesc;
|
||||
|
||||
return Core::Init::Success;
|
||||
}
|
||||
|
||||
|
@ -390,10 +417,13 @@ namespace Oyster
|
|||
Gui::Pass.Shaders.Vertex = GetShader::Vertex(L"2D");
|
||||
Gui::Pass.Shaders.Pixel = GetShader::Pixel(L"2D");
|
||||
Gui::Pass.Shaders.Geometry = GetShader::Geometry(L"2D");
|
||||
|
||||
Gui::Pass.RTV.push_back(GBufferRTV[2]);
|
||||
Gui::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
||||
Gui::Pass.CBuffers.Pixel.push_back(Color);
|
||||
|
||||
Gui::Pass.depth = Gui::depth;
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC indesc2D[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
|
@ -405,6 +435,7 @@ namespace Oyster
|
|||
Gui::Pass.RenderStates.SampleCount = 1;
|
||||
Gui::Pass.RenderStates.SampleState = RenderStates::ss;
|
||||
Gui::Pass.RenderStates.BlendState = RenderStates::bs;
|
||||
Gui::Pass.RenderStates.DepthStencil = RenderStates::dsState;
|
||||
|
||||
////---------------- Blur Pass Setup ----------------------------
|
||||
Blur::HorPass.Shaders.Compute = GetShader::Compute(L"BlurHor");
|
||||
|
@ -442,9 +473,13 @@ namespace Oyster
|
|||
Gui::Text::Pass.CBuffers.Pixel.push_back(Color);
|
||||
Gui::Text::Pass.SRV.Pixel.push_back(Gui::Text::Font);
|
||||
Gui::Text::Pass.RTV.push_back(GBufferRTV[2]);
|
||||
|
||||
Gui::Text::Pass.depth = Gui::depth;
|
||||
|
||||
Gui::Text::Pass.RenderStates.SampleCount = 1;
|
||||
Gui::Text::Pass.RenderStates.SampleState = RenderStates::ss;
|
||||
Gui::Text::Pass.RenderStates.BlendState = RenderStates::bs;
|
||||
Gui::Text::Pass.RenderStates.DepthStencil = RenderStates::dsState;
|
||||
|
||||
return Core::Init::Success;
|
||||
}
|
||||
|
@ -510,6 +545,8 @@ namespace Oyster
|
|||
SAFE_RELEASE(Gui::Text::Pass.RenderStates.BlendState);
|
||||
|
||||
SAFE_RELEASE(Gui::Text::Pass.IAStage.Layout);
|
||||
|
||||
SAFE_RELEASE(Gui::depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace Oyster
|
|||
{
|
||||
static Core::PipelineManager::RenderPass Pass;
|
||||
static Core::Buffer Data;
|
||||
static ID3D11DepthStencilView* depth;
|
||||
struct Text
|
||||
{
|
||||
static Core::PipelineManager::RenderPass Pass;
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
void main(point Vertex2DIn input[1],inout TriangleStream<Pixel2DIn> Quads)
|
||||
{
|
||||
Pixel2DIn output;
|
||||
output.Pos = mul(float4(-1,-1,1,1) ,Translation);
|
||||
output.Pos = mul(float4(-1,-1,0,1) ,Translation);
|
||||
output.Uv = float2(0,1);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(-1,1,1,1), Translation);
|
||||
output.Pos = mul(float4(-1,1,0,1), Translation);
|
||||
output.Uv = float2(0,0);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(1,-1,1,1), Translation);
|
||||
output.Pos = mul(float4(1,-1,0,1), Translation);
|
||||
output.Uv = float2(1,1);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(1,1,1,1), Translation);
|
||||
output.Pos = mul(float4(1,1,0,1), Translation);
|
||||
output.Uv = float2(1,0);
|
||||
Quads.Append(output);
|
||||
}
|
|
@ -7,22 +7,22 @@ void main(point Text2DIn input[1],inout TriangleStream<Pixel2DIn> Quads)
|
|||
float endoff=startoff+input[0].coff;
|
||||
Pixel2DIn output;
|
||||
|
||||
output.Pos = mul(float4(-1,-1,1,1), Translation);
|
||||
output.Pos = mul(float4(-1,-1,0,1), Translation);
|
||||
output.Pos.x += input[0].Pos;
|
||||
output.Uv = float2(startoff,1);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(-1,1,1,1), Translation);
|
||||
output.Pos = mul(float4(-1,1,0,1), Translation);
|
||||
output.Pos.x += input[0].Pos;
|
||||
output.Uv = float2(startoff,0);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(1,-1,1,1), Translation);
|
||||
output.Pos = mul(float4(1,-1,0,1), Translation);
|
||||
output.Pos.x += input[0].Pos;
|
||||
output.Uv = float2(endoff,1);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(1,1,1,1), Translation);
|
||||
output.Pos = mul(float4(1,1,0,1), Translation);
|
||||
output.Pos.x += input[0].Pos;
|
||||
output.Uv = float2(endoff,0);
|
||||
Quads.Append(output);
|
||||
|
|
Loading…
Reference in New Issue