2013-11-26 13:44:58 +01:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
2013-12-18 20:28:06 +01:00
|
|
|
#include "../Definitions/GraphicalDefinition.h"
|
2013-11-26 13:44:58 +01:00
|
|
|
#include "..\Model\Model.h"
|
|
|
|
#include "OysterMath.h"
|
|
|
|
#include <Windows.h>
|
2014-01-16 09:30:01 +01:00
|
|
|
//#include <vld.h>
|
2013-11-26 13:44:58 +01:00
|
|
|
|
2013-12-04 09:36:43 +01:00
|
|
|
#ifdef GFX_DLL_EXPORT
|
2013-11-26 15:33:05 +01:00
|
|
|
#define GFX_DLL_USAGE __declspec(dllexport)
|
|
|
|
#else
|
2013-12-04 09:36:43 +01:00
|
|
|
#define GFX_DLL_USAGE
|
2013-11-26 15:33:05 +01:00
|
|
|
#endif
|
|
|
|
|
2013-11-26 13:44:58 +01:00
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Graphics
|
|
|
|
{
|
2013-11-26 15:33:05 +01:00
|
|
|
class GFX_DLL_USAGE API
|
2013-11-26 13:44:58 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum State
|
|
|
|
{
|
|
|
|
Sucsess,
|
|
|
|
Fail
|
|
|
|
};
|
|
|
|
struct Option
|
|
|
|
{
|
2014-01-31 16:29:50 +01:00
|
|
|
std::wstring modelPath, texturePath;
|
2014-02-05 16:54:57 +01:00
|
|
|
int BytesUsed;
|
2013-11-26 13:44:58 +01:00
|
|
|
};
|
2014-02-07 11:52:51 +01:00
|
|
|
typedef void* Texture;
|
2013-11-26 13:44:58 +01:00
|
|
|
|
2013-11-26 15:33:05 +01:00
|
|
|
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion);
|
2014-01-08 07:01:59 +01:00
|
|
|
#ifdef _DEBUG
|
|
|
|
static State ReloadShaders();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//! @todo Memory Leaks
|
|
|
|
|
|
|
|
//! @brief Clean Resources and release all memory
|
2013-11-29 10:25:27 +01:00
|
|
|
static void Clean();
|
2013-12-05 14:56:34 +01:00
|
|
|
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief Sets the view matrix to use next frame
|
2014-02-10 16:22:23 +01:00
|
|
|
static void SetView(const Oyster::Math::Float4x4& View);
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief Sets the projection matrix to use next frame
|
2014-02-10 16:22:23 +01:00
|
|
|
static void SetProjection(const Oyster::Math::Float4x4& Projection);
|
2013-12-05 14:56:34 +01:00
|
|
|
|
|
|
|
//! @brief will internally use last values from SetView and SetProjection
|
|
|
|
static void NewFrame();
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief Renders a list of models
|
2013-12-05 14:56:34 +01:00
|
|
|
static void RenderScene(Oyster::Graphics::Model::Model models[], int count);
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief Renders a single model
|
2014-02-10 13:59:45 +01:00
|
|
|
static void RenderModel(Oyster::Graphics::Model::Model* model);
|
2014-02-07 11:52:51 +01:00
|
|
|
|
|
|
|
//! @brief Configures Renderer to process 2D graphics, data will be passed in to EndFrame()
|
|
|
|
static void StartGuiRender();
|
|
|
|
|
2014-02-10 11:53:44 +01:00
|
|
|
//! @brief Renders a single GUI element using the texture provided and the Pos in the center, %based system
|
2014-02-12 09:24:37 +01:00
|
|
|
static void RenderGuiElement(Texture, Math::Float2 Pos, Math::Float2 Size, Math::Float3 Color = Math::Float3(1,1,1));
|
2014-02-07 11:52:51 +01:00
|
|
|
|
2014-02-11 13:29:19 +01:00
|
|
|
//! @brief Configures Renderer to process 2D Text, data will be passed in to EndFrame()
|
|
|
|
static void StartTextRender();
|
|
|
|
|
|
|
|
//! @brief Renders a single GUI string using the texture provided and the Pos in the center, %based system
|
2014-02-12 09:24:37 +01:00
|
|
|
static void RenderText(std::wstring, Math::Float2 Pos, Math::Float2 Size, Math::Float3 Color = Math::Float3(1,1,1));
|
2014-02-11 13:29:19 +01:00
|
|
|
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief Performs light calculations, post effects and presents the scene
|
2013-11-26 13:44:58 +01:00
|
|
|
static void EndFrame();
|
|
|
|
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief Creates a model from the supplied file, note: do not include .obj
|
2013-11-26 13:44:58 +01:00
|
|
|
static Oyster::Graphics::Model::Model* CreateModel(std::wstring filename);
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief deletes a model and relases the models resources
|
2013-11-26 13:44:58 +01:00
|
|
|
static void DeleteModel(Oyster::Graphics::Model::Model* model);
|
|
|
|
|
2014-02-07 11:52:51 +01:00
|
|
|
static Texture CreateTexture(std::wstring filename);
|
2014-02-07 13:15:38 +01:00
|
|
|
static void DeleteTexture(Texture);
|
2014-02-07 11:52:51 +01:00
|
|
|
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief adds a light to the scene
|
2014-02-10 16:22:23 +01:00
|
|
|
static void AddLight(const Definitions::Pointlight light);
|
2014-01-08 07:01:59 +01:00
|
|
|
//! @brief removes all lights from the scene
|
2013-12-18 20:28:06 +01:00
|
|
|
static void ClearLights();
|
|
|
|
|
2014-02-05 16:54:57 +01:00
|
|
|
//! @brief Sets Options to the graphics
|
2013-11-26 13:44:58 +01:00
|
|
|
static State SetOptions(Option);
|
2014-02-05 16:54:57 +01:00
|
|
|
|
2014-02-10 11:53:44 +01:00
|
|
|
//! @brief Gets Options from the graphics
|
2014-02-05 16:54:57 +01:00
|
|
|
static Option GetOption();
|
2014-02-10 11:53:44 +01:00
|
|
|
|
|
|
|
//! @brief Starts an animation and returns the time of the animation
|
|
|
|
static float PlayAnimation(Model::Model* model, std::wstring name, bool looping = false);
|
|
|
|
|
|
|
|
//! @brief Moves all animating models forward the specified time;
|
|
|
|
static void Update(float deltaTime);
|
2013-11-26 13:44:58 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|