Engine puzzle completed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Core/Util/Logging.h"
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "ResourceManager.h"
|
||||
|
||||
class ConfigFile : public Resource
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_GamepadAxis_h__
|
||||
#define Events_GamepadAxis_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Gamepad
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_GamepadButton_h__
|
||||
#define Events_GamepadButton_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Gamepad
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_KeyDown_h__
|
||||
#define Events_KeyDown_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_KeyUp_h__
|
||||
#define Events_KeyUp_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_LockMouse_h__
|
||||
#define Events_LockMouse_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_MouseMove_h__
|
||||
#define Events_MouseMove_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_MousePress_h__
|
||||
#define Events_MousePress_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Events_MouseRelease_h__
|
||||
#define Events_MouseRelease_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
|
||||
#include <typeinfo>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <tuple>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "Event.h"
|
||||
|
||||
#define EVENT_SUBSCRIBE_MEMBER(relay, handler) \
|
||||
relay = decltype(relay)(std::bind(handler, this, std::placeholders::_1)); \
|
||||
EventBroker->Subscribe(relay);
|
||||
m_EventBroker->Subscribe(relay);
|
||||
|
||||
class EventBroker;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef InputController_h__
|
||||
#define InputController_h__
|
||||
|
||||
#include <memory>
|
||||
#include "../Common.h"
|
||||
|
||||
#include "EventBroker.h"
|
||||
#include "EMouseMove.h"
|
||||
#include "Input/EInputCommand.h"
|
||||
#include "../Input/EInputCommand.h"
|
||||
|
||||
template <typename EventContext>
|
||||
class InputController
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#define InputManager_h__
|
||||
|
||||
#include <array>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "../Common.h"
|
||||
#include "EventBroker.h"
|
||||
#include "EKeyDown.h"
|
||||
#include "EKeyUp.h"
|
||||
#include "EMousePress.h"
|
||||
@@ -16,9 +18,9 @@
|
||||
class InputManager
|
||||
{
|
||||
public:
|
||||
InputManager(GLFWwindow* window, std::shared_ptr<::EventBroker> eventBroker)
|
||||
InputManager(GLFWwindow* window, EventBroker* eventBroker)
|
||||
: m_GLFWWindow(window)
|
||||
, EventBroker(eventBroker)
|
||||
, m_EventBroker(eventBroker)
|
||||
, m_CurrentKeyState()
|
||||
, m_LastKeyState()
|
||||
, m_CurrentMouseState()
|
||||
@@ -37,7 +39,7 @@ public:
|
||||
|
||||
private:
|
||||
GLFWwindow* m_GLFWWindow;
|
||||
std::shared_ptr<::EventBroker> EventBroker;
|
||||
EventBroker* m_EventBroker;
|
||||
|
||||
EventRelay<InputManager, Events::LockMouse> m_ELockMouse;
|
||||
bool OnLockMouse(const Events::LockMouse &event);
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#ifndef ResourceManager_h__
|
||||
#define ResourceManager_h__
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "Util/UnorderedMapPair.h"
|
||||
#include "Util/FileWatcher.h"
|
||||
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
#ifndef BoostPathHash_h__
|
||||
#define BoostPathHash_h__
|
||||
|
||||
struct BoostPathHash
|
||||
namespace std
|
||||
{
|
||||
template <typename T>
|
||||
std::size_t operator()(const boost::filesystem::path& p) const
|
||||
template<> struct hash<boost::filesystem::path>
|
||||
{
|
||||
return boost::filesystem::hash_value(p);
|
||||
}
|
||||
};
|
||||
size_t operator()(const boost::filesystem::path& p) const
|
||||
{
|
||||
return boost::filesystem::hash_value(p);
|
||||
}
|
||||
};
|
||||
}
|
||||
//struct BoostPathHash
|
||||
//{
|
||||
//
|
||||
// template <typename T>
|
||||
// std::size_t operator()(const boost::filesystem::path& p) const
|
||||
// {
|
||||
// return boost::filesystem::hash_value(p);
|
||||
// }
|
||||
//};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,8 +58,8 @@ private:
|
||||
std::time_t Timestamp;
|
||||
};
|
||||
|
||||
std::unordered_map<boost::filesystem::path, FileEventCallback_t, BoostPathHash> m_FileCallbacks;
|
||||
std::unordered_map<boost::filesystem::path, FileInfo, BoostPathHash> m_FileInfo;
|
||||
std::unordered_map<boost::filesystem::path, FileEventCallback_t> m_FileCallbacks;
|
||||
std::unordered_map<boost::filesystem::path, FileInfo> m_FileInfo;
|
||||
boost::mutex m_Mutex;
|
||||
|
||||
FileInfo GetFileInfo(boost::filesystem::path path);
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#ifndef Rectangle_h__
|
||||
#define Rectangle_h__
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
struct Rectangle
|
||||
{
|
||||
Rectangle()
|
||||
: X(0), Y(0), Width(0), Height(0) { }
|
||||
|
||||
Rectangle(int width, int height)
|
||||
: X(0), Y(0), Width(width), Height(height) { }
|
||||
|
||||
Rectangle(int x, int y, int width, int height)
|
||||
: X(x), Y(y), Width(width), Height(height) { }
|
||||
|
||||
/*Rectangle(const Rectangle &rect)
|
||||
: X(rect.X), Y(rect.Y), Width(rect.Width), Height(rect.Height) { }*/
|
||||
|
||||
int X;
|
||||
int Y;
|
||||
int Width;
|
||||
int Height;
|
||||
|
||||
virtual int Left() const { return X; }
|
||||
virtual void SetLeft(int left)
|
||||
{
|
||||
//Width += X - left;
|
||||
X = left;
|
||||
}
|
||||
virtual int Right() const { return X + Width; }
|
||||
virtual void SetRight(int right)
|
||||
{
|
||||
Width = right - X;
|
||||
}
|
||||
virtual int Top() const { return Y; }
|
||||
virtual void SetTop(int top)
|
||||
{
|
||||
//Height += Y - top;
|
||||
Y = top;
|
||||
}
|
||||
virtual int Bottom() const { return Y + Height; }
|
||||
virtual void SetBottom(int bottom)
|
||||
{
|
||||
Height = bottom - Y;
|
||||
}
|
||||
|
||||
Rectangle& operator+=(const Rectangle &rhs)
|
||||
{
|
||||
SetLeft(std::min(Left(), rhs.Left()));
|
||||
SetRight(std::max(Right(), rhs.Right()));
|
||||
SetTop(std::min(Top(), rhs.Top()));
|
||||
SetBottom(std::max(Bottom(), rhs.Bottom()));
|
||||
}
|
||||
|
||||
static bool Intersects(const Rectangle &r1, const Rectangle &r2)
|
||||
{
|
||||
return !(r2.Left() > r1.Right() || r2.Right() < r1.Left() || r2.Top() > r1.Bottom() || r2.Bottom() < r1.Top());
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(const Rectangle &r1, const Rectangle &r2)
|
||||
{
|
||||
return (r1.X == r2.X) && (r1.Y == r2.Y) && (r1.Width == r2.Width) && (r1.Height == r2.Height);
|
||||
}
|
||||
|
||||
inline bool operator!=(const Rectangle &lhs, const Rectangle &rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator<(const Rectangle &lhs, const Rectangle &rhs)
|
||||
{
|
||||
return (lhs.Width < rhs.Width) && (lhs.Height < rhs.Height);
|
||||
}
|
||||
|
||||
inline bool operator>(const Rectangle &lhs, const Rectangle &rhs)
|
||||
{
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
inline bool operator<=(const Rectangle &lhs, const Rectangle &rhs)
|
||||
{
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
inline bool operator>=(const Rectangle &lhs, const Rectangle &rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
inline Rectangle operator+(Rectangle lhs, const Rectangle &rhs)
|
||||
{
|
||||
lhs += rhs;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
#endif // Util_Rectangle_h__
|
||||
@@ -0,0 +1,10 @@
|
||||
// GLM
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/common.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtx/rotate_vector.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
@@ -0,0 +1,165 @@
|
||||
#ifndef GUI_BUTTON_H__
|
||||
#define GUI_BUTTON_H__
|
||||
|
||||
#include "GUI/TextureFrame.h"
|
||||
#include "GUI/EButtonEnter.h"
|
||||
#include "GUI/EButtonLeave.h"
|
||||
#include "GUI/EButtonPress.h"
|
||||
#include "GUI/EButtonRelease.h"
|
||||
#include "Core/EMouseMove.h"
|
||||
#include "Core/EMousePress.h"
|
||||
#include "Core/EMouseRelease.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
|
||||
class Button : public TextureFrame
|
||||
{
|
||||
public:
|
||||
Button(Frame* parent, std::string name)
|
||||
: TextureFrame(parent, name)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseMove, &Button::OnMouseMove);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &Button::OnMousePress);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &Button::OnMouseRelease);
|
||||
}
|
||||
|
||||
void SetTextureHover(std::string resourceName)
|
||||
{
|
||||
m_TextureHover = resourceName;
|
||||
}
|
||||
void SetTextureReleased(std::string resourceName)
|
||||
{
|
||||
m_TextureReleased = resourceName;
|
||||
SetTexture(resourceName);
|
||||
}
|
||||
void SetTexturePressed(std::string resourceName)
|
||||
{
|
||||
m_TexturePressed = resourceName;
|
||||
}
|
||||
|
||||
void Draw(RenderQueueCollection& rq) override
|
||||
{
|
||||
if (m_Texture == nullptr && !m_TextureReleased.empty()) {
|
||||
SetTexture(m_TextureReleased);
|
||||
}
|
||||
|
||||
TextureFrame::Draw(rq);
|
||||
}
|
||||
|
||||
virtual void OnEnter() { }
|
||||
virtual void OnLeave() { }
|
||||
virtual void OnPress() { }
|
||||
virtual void OnRelease() { }
|
||||
|
||||
protected:
|
||||
bool m_MouseIsOver = false;
|
||||
bool m_IsDown = false;
|
||||
|
||||
virtual bool OnMouseMove(const Events::MouseMove& event)
|
||||
{
|
||||
if (Hidden()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isOver = Rectangle::Intersects(AbsoluteRectangle(), Rectangle(event.X, event.Y, 1, 1));
|
||||
if (isOver && !m_MouseIsOver) { // Enter
|
||||
if (!m_IsDown) {
|
||||
if (!m_TextureHover.empty()) {
|
||||
SetTexture(m_TextureHover);
|
||||
}
|
||||
}
|
||||
OnEnter();
|
||||
Events::ButtonEnter e;
|
||||
e.FrameName = m_Name;
|
||||
EventBroker->Publish(e);
|
||||
Events::PlaySound soundEvent;
|
||||
soundEvent.FilePath = "Sounds/GUI/hover-n.wav";
|
||||
EventBroker->Publish(soundEvent);
|
||||
|
||||
} else if (!isOver && m_MouseIsOver) { // Leave
|
||||
if (!m_IsDown) {
|
||||
if (!m_TextureReleased.empty()) {
|
||||
SetTexture(m_TextureReleased);
|
||||
}
|
||||
}
|
||||
OnLeave();
|
||||
Events::ButtonLeave e;
|
||||
e.FrameName = m_Name;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
m_MouseIsOver = isOver;
|
||||
|
||||
return true;
|
||||
}
|
||||
virtual bool OnMousePress(const Events::MousePress& event)
|
||||
{
|
||||
if (Hidden()) {
|
||||
//LOG_DEBUG("Pressed hidden button");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Rectangle::Intersects(AbsoluteRectangle(), Rectangle(event.X, event.Y, 1, 1))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_TexturePressed.empty()) {
|
||||
SetTexture(m_TexturePressed);
|
||||
}
|
||||
|
||||
m_IsDown = true;
|
||||
OnPress();
|
||||
Events::ButtonPress e;
|
||||
e.FrameName = m_Name;
|
||||
e.Button = this;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
virtual bool OnMouseRelease(const Events::MouseRelease& event)
|
||||
{
|
||||
if (Hidden()) {
|
||||
//LOG_DEBUG("Released hidden button");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isOver = Rectangle::Intersects(AbsoluteRectangle(), Rectangle(event.X, event.Y, 1, 1));
|
||||
if (!isOver && !m_IsDown) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_MouseIsOver) {
|
||||
if (!m_TextureHover.empty()) {
|
||||
SetTexture(m_TextureHover);
|
||||
}
|
||||
} else {
|
||||
if (!m_TextureReleased.empty()) {
|
||||
SetTexture(m_TextureReleased);
|
||||
}
|
||||
}
|
||||
|
||||
m_IsDown = false;
|
||||
OnRelease();
|
||||
Events::ButtonRelease e;
|
||||
e.FrameName = m_Name;
|
||||
e.Button = this;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
EventRelay<Frame, Events::MouseMove> m_EMouseMove;
|
||||
EventRelay<Frame, Events::MousePress> m_EMousePress;
|
||||
EventRelay<Frame, Events::MouseRelease> m_EMouseRelease;
|
||||
|
||||
std::string m_TextureHover;
|
||||
std::string m_TexturePressed;
|
||||
std::string m_TextureReleased;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef Events_ButtonEnter_h__
|
||||
#define Events_ButtonEnter_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button hover. */
|
||||
struct ButtonEnter : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef Events_ButtonLeave_h__
|
||||
#define Events_ButtonLeave_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button hover. */
|
||||
struct ButtonLeave : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef Events_ButtonPress_h__
|
||||
#define Events_ButtonPress_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace GUI { class Button; }
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button press. */
|
||||
struct ButtonPress : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
GUI::Button* Button;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef Events_ButtonRelease_h__
|
||||
#define Events_ButtonRelease_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace GUI { class Button; }
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button release. */
|
||||
struct ButtonRelease : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
GUI::Button* Button;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,261 @@
|
||||
#ifndef GUI_Frame_h__
|
||||
#define GUI_Frame_h__
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../Core/Util/Rectangle.h"
|
||||
#include "../Core/EventBroker.h"
|
||||
#include "../Core/EKeyDown.h"
|
||||
#include "../Core/EKeyUp.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "../Rendering/RenderQueue.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
#include "../Input/EInputCommand.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
|
||||
class Frame : public Rectangle
|
||||
{
|
||||
public:
|
||||
enum class Anchor
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom
|
||||
};
|
||||
|
||||
static const int BaseWidth = 1280;
|
||||
static const int BaseHeight = 720;
|
||||
|
||||
// Set up a base frame with an event broker
|
||||
Frame(EventBroker* eventBroker)
|
||||
: m_EventBroker(eventBroker)
|
||||
, BaseFrame(this)
|
||||
, m_Name("UIParent")
|
||||
, Rectangle() { }
|
||||
|
||||
// Create a frame as a child
|
||||
Frame(Frame* parent, std::string name)
|
||||
: m_Name(name)
|
||||
{
|
||||
SetParent(parent);
|
||||
Width = parent->Width;
|
||||
Height = parent->Height;
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Frame::OnKeyDown);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &Frame::OnKeyUp);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Frame::OnCommand);
|
||||
}
|
||||
|
||||
~Frame()
|
||||
{
|
||||
/*for (auto layer : m_Children)
|
||||
{
|
||||
for (auto child : layer.second)
|
||||
{
|
||||
delete child.second;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Parent)
|
||||
{
|
||||
m_Parent->RemoveChild(this);
|
||||
}*/
|
||||
}
|
||||
|
||||
Frame* Parent() const { return m_Parent; }
|
||||
|
||||
void SetParent(Frame* parent)
|
||||
{
|
||||
if (parent == nullptr) {
|
||||
LOG_ERROR("Failed to parent frame \"%s\": Invalid parent", m_Name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
m_Layer = parent->Layer() + 1;
|
||||
parent->AddChild(this);
|
||||
m_Parent = parent;
|
||||
m_EventBroker = parent->m_EventBroker;
|
||||
BaseFrame = parent->BaseFrame;
|
||||
}
|
||||
|
||||
void AddChild(Frame* child)
|
||||
{
|
||||
m_Children[child->m_Layer].insert(std::make_pair(child->Name(), child));
|
||||
if (m_Parent) {
|
||||
m_Parent->AddChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveChild(Frame* child)
|
||||
{
|
||||
auto it = m_Children.find(child->m_Layer);
|
||||
if (it != m_Children.end()) {
|
||||
m_Children.erase(it);
|
||||
}
|
||||
|
||||
if (m_Parent) {
|
||||
m_Parent->RemoveChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Name() const { return m_Name; }
|
||||
void SetName(std::string val) { m_Name = val; }
|
||||
|
||||
int Layer() const { return m_Layer; }
|
||||
|
||||
bool Hidden() const
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Hidden() || m_Hidden;
|
||||
else
|
||||
return m_Hidden;
|
||||
}
|
||||
bool Visible() const
|
||||
{
|
||||
return !Hidden();
|
||||
}
|
||||
|
||||
virtual void Hide() { m_Hidden = true; }
|
||||
virtual void Show() { m_Hidden = false; }
|
||||
|
||||
int Left() const override
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Left() + X;
|
||||
else
|
||||
return X;
|
||||
}
|
||||
void SetLeft(int absLeft) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
X = absLeft - m_Parent->Left();
|
||||
} else {
|
||||
X = absLeft;
|
||||
}
|
||||
}
|
||||
int Right() const override
|
||||
{
|
||||
return Left() + Width;
|
||||
}
|
||||
void SetRight(int absRight) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
X = absRight - Width - m_Parent->Left();
|
||||
} else {
|
||||
X = absRight - Width;
|
||||
}
|
||||
}
|
||||
int Top() const override
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Top() + Y;
|
||||
else
|
||||
return Y;
|
||||
}
|
||||
void SetTop(int absTop) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
Y = absTop - m_Parent->Top();
|
||||
} else {
|
||||
Y = absTop;
|
||||
}
|
||||
}
|
||||
int Bottom() const override
|
||||
{
|
||||
return Top() + Height;
|
||||
}
|
||||
void SetBottom(int absBottom) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
Y = absBottom - Height - m_Parent->Top();
|
||||
} else {
|
||||
Y = absBottom - Height;
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec2 Scale()
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Scale();
|
||||
else
|
||||
return glm::vec2(Width, Height) / glm::vec2(BaseWidth, BaseHeight);
|
||||
}
|
||||
|
||||
Rectangle AbsoluteRectangle()
|
||||
{
|
||||
int left = Left();
|
||||
if (m_Parent)
|
||||
left = std::max(left, m_Parent->Left());
|
||||
int top = Top();
|
||||
if (m_Parent)
|
||||
top = std::max(top, m_Parent->Top());
|
||||
int width = Right() - left;
|
||||
int height = Bottom() - top;
|
||||
return Rectangle(left, top, width, height);
|
||||
}
|
||||
|
||||
void UpdateLayered(double dt)
|
||||
{
|
||||
// Update ourselves
|
||||
this->Update(dt);
|
||||
|
||||
// Update children
|
||||
for (auto& pairLayer : m_Children) {
|
||||
auto children = pairLayer.second;
|
||||
for (auto& pairChild : children) {
|
||||
auto child = pairChild.second;
|
||||
child->Update(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Update(double dt) { }
|
||||
|
||||
void DrawLayered(RenderQueueCollection& rq)
|
||||
{
|
||||
if (this->Hidden())
|
||||
return;
|
||||
|
||||
// Draw ourselves
|
||||
this->Draw(rq);
|
||||
|
||||
// Draw children
|
||||
for (auto& pairLayer : m_Children) {
|
||||
auto children = pairLayer.second;
|
||||
for (auto& pairChild : children) {
|
||||
auto child = pairChild.second;
|
||||
if (child->Hidden())
|
||||
continue;
|
||||
child->Draw(rq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Draw(RenderQueueCollection& rq) { }
|
||||
|
||||
protected:
|
||||
::EventBroker* m_EventBroker;
|
||||
Frame* BaseFrame = nullptr;
|
||||
|
||||
std::string m_Name = "Unnamed";
|
||||
int m_Layer = 0;
|
||||
bool m_Hidden = false;
|
||||
|
||||
Frame* m_Parent = nullptr;
|
||||
typedef std::multimap<std::string, Frame*> Children_t; // name -> frame
|
||||
std::map<int, Children_t> m_Children; // layer -> Children_t
|
||||
|
||||
virtual bool OnKeyDown(const Events::KeyDown& event) { return false; }
|
||||
virtual bool OnKeyUp(const Events::KeyUp& event) { return false; }
|
||||
virtual bool OnCommand(const Events::InputCommand& event) { return false; }
|
||||
|
||||
private:
|
||||
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
|
||||
EventRelay<Frame, Events::KeyUp> m_EKeyUp;
|
||||
EventRelay<Frame, Events::InputCommand> m_EInputCommand;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
#ifndef GUI_TextureFrame_h__
|
||||
#define GUI_TextureFrame_h__
|
||||
|
||||
#include "Frame.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
|
||||
class TextureFrame : public Frame
|
||||
{
|
||||
public:
|
||||
TextureFrame(Frame* parent, std::string name)
|
||||
: Frame(parent, name) { }
|
||||
|
||||
void EnableScissor() { m_ScissorEnabled = true; }
|
||||
void DisableScissor() { m_ScissorEnabled = false; }
|
||||
|
||||
void Draw(RenderQueueCollection& rq) override
|
||||
{
|
||||
if (m_Texture == nullptr)
|
||||
return;
|
||||
|
||||
// Texture while fading
|
||||
if (m_FadeTexture && m_CurrentFade < 1) {
|
||||
FrameJob job;
|
||||
job.Scissor = (m_ScissorEnabled) ? m_Parent->AbsoluteRectangle() : Rectangle();
|
||||
job.Viewport = Rectangle(Left(), Top(), Width, Height);
|
||||
job.TextureID = m_FadeTexture->ResourceID;
|
||||
job.DiffuseTexture = m_FadeTexture;
|
||||
job.Color = glm::vec4(m_Color.r, m_Color.g, m_Color.b, m_Color.a);
|
||||
job.Name = Name();
|
||||
rq.GUI.Add(job);
|
||||
}
|
||||
|
||||
// Main texture
|
||||
{
|
||||
FrameJob job;
|
||||
job.Scissor = (m_ScissorEnabled) ? m_Parent->AbsoluteRectangle() : Rectangle();
|
||||
job.Viewport = Rectangle(Left(), Top(), Width, Height);
|
||||
job.TextureID = m_Texture->ResourceID;
|
||||
job.DiffuseTexture = m_Texture;
|
||||
job.Color = glm::vec4(m_Color.r, m_Color.g, m_Color.b, m_Color.a * m_CurrentFade);
|
||||
job.Name = Name();
|
||||
rq.GUI.Add(job);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Texture() const { return m_TextureName; }
|
||||
|
||||
void SetTexture(std::string resourceName)
|
||||
{
|
||||
if (resourceName.empty()) {
|
||||
m_Texture = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Texture = ResourceManager::Load<Texture>(resourceName);
|
||||
m_TextureName = resourceName;
|
||||
if (m_Texture == nullptr) {
|
||||
m_Texture = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
||||
}
|
||||
|
||||
SizeToTexture();
|
||||
}
|
||||
|
||||
void SizeToTexture()
|
||||
{
|
||||
if (m_Texture != nullptr) {
|
||||
this->Width = m_Texture->Width;
|
||||
this->Height = m_Texture->Height;
|
||||
}
|
||||
}
|
||||
|
||||
void FadeToTexture(std::string resourceName, double duration)
|
||||
{
|
||||
m_FadeTexture = m_Texture;
|
||||
SetTexture(resourceName);
|
||||
m_FadeDuration = duration;
|
||||
m_CurrentFade = 0.f;
|
||||
}
|
||||
|
||||
void Update(double dt) override
|
||||
{
|
||||
if (m_CurrentFade < 1) {
|
||||
m_CurrentFade += dt / m_FadeDuration;
|
||||
if (m_CurrentFade > 1) {
|
||||
m_FadeTexture = nullptr;
|
||||
m_CurrentFade = 1;
|
||||
m_FadeDuration = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec4 Color() const { return m_Color; }
|
||||
void SetColor(glm::vec4 val) { m_Color = val; }
|
||||
|
||||
protected:
|
||||
bool m_ScissorEnabled = true;
|
||||
Texture* m_Texture = nullptr;
|
||||
std::string m_TextureName;
|
||||
Texture* m_FadeTexture = nullptr;
|
||||
glm::vec4 m_Color = glm::vec4(1.f, 1.f, 1.f, 1.f);
|
||||
float m_FadeDuration = 0.f;
|
||||
float m_CurrentFade = 1.f;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
// OpenGL
|
||||
#include <GL/glew.h>
|
||||
#define GLFW_INCLUDE_GLU
|
||||
#define NOMINMAX
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glext.h>
|
||||
#include "Rendering/Util/GLError.h"
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
// OpenGL
|
||||
#include <GL/glew.h>
|
||||
#define GLFW_INCLUDE_GLU
|
||||
#define NOMINMAX
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glext.h>
|
||||
#include "Rendering/Util/GLError.h"
|
||||
|
||||
// GLM
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/common.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtx/rotate_vector.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "Core/Util/Logging.h"
|
||||
@@ -1,12 +1,7 @@
|
||||
#ifndef BaseTexture_h__
|
||||
#define BaseTexture_h__
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <cstdio>
|
||||
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Rendering/PNG.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
|
||||
class BaseTexture : public Resource
|
||||
{
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef Camera_h__
|
||||
#define Camera_h__
|
||||
|
||||
#include "../GLM.h"
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
/** Camera constructor.
|
||||
|
||||
@param aspectRatio Aspect ratio.
|
||||
@param yFOV Vertical FOV.
|
||||
@param nearClip Near clipping plane in meters.
|
||||
@param farClip Far clipping plane in meters.
|
||||
*/
|
||||
Camera(float aspectRatio, float yFOV, float nearClip, float farClip);
|
||||
|
||||
/** Forward vector of the camera */
|
||||
glm::vec3 Forward();
|
||||
/** Right vector of the camera */
|
||||
glm::vec3 Right();
|
||||
|
||||
glm::vec3 Position() const { return m_Position; }
|
||||
void SetPosition(glm::vec3 val);
|
||||
|
||||
glm::quat Orientation() const { return m_Orientation; }
|
||||
void SetOrientation(glm::quat val);
|
||||
|
||||
/*float Pitch() const { return m_Pitch; }
|
||||
void Pitch(float val);
|
||||
float Yaw() const { return m_Yaw; }
|
||||
void Yaw(float val);*/
|
||||
|
||||
glm::mat4 ProjectionMatrix() const { return m_ProjectionMatrix; }
|
||||
glm::mat4 ViewMatrix() const { return m_ViewMatrix; }
|
||||
|
||||
float AspectRatio() const { return m_AspectRatio; }
|
||||
void SetAspectRatio(float val);
|
||||
|
||||
float FOV() const { return m_FOV; }
|
||||
void SetFOV(float val);
|
||||
|
||||
float NearClip() const { return m_NearClip; }
|
||||
void SetNearClip(float val);
|
||||
|
||||
float FarClip() const { return m_FarClip; }
|
||||
void SetFarClip(float val);
|
||||
|
||||
float m_AspectRatio;
|
||||
float m_FOV;
|
||||
float m_NearClip;
|
||||
float m_FarClip;
|
||||
|
||||
private:
|
||||
void UpdateViewMatrix();
|
||||
void UpdateProjectionMatrix();
|
||||
|
||||
glm::vec3 m_Position;
|
||||
glm::quat m_Orientation;
|
||||
|
||||
glm::mat4 m_ProjectionMatrix;
|
||||
glm::mat4 m_ViewMatrix;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef DummyRenderer_h__
|
||||
#define DummyRenderer_h__
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "IRenderer.h"
|
||||
|
||||
class DummyRenderer : public IRenderer
|
||||
{
|
||||
public:
|
||||
virtual void Initialize() override;
|
||||
virtual void Draw(RenderQueueCollection& rq) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef IRenderer_h__
|
||||
#define IRenderer_h__
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../Core/Util/Rectangle.h"
|
||||
#include "Camera.h"
|
||||
#include "RenderQueue.h"
|
||||
|
||||
class IRenderer
|
||||
{
|
||||
public:
|
||||
GLFWwindow* Window() const { return m_Window; }
|
||||
Rectangle Resolution() const { return m_Resolution; }
|
||||
void SetResolution(const Rectangle& resolution) { m_Resolution = resolution; }
|
||||
bool Fullscreen() { return m_Fullscreen; }
|
||||
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
|
||||
bool VSYNC() const { return m_VSYNC; }
|
||||
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
|
||||
::Camera* Camera() const { return m_Camera; }
|
||||
void SetCamera(::Camera* camera)
|
||||
{
|
||||
if (camera == nullptr) {
|
||||
m_Camera = m_DefaultCamera;
|
||||
} else {
|
||||
m_Camera = camera;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
virtual void Draw(RenderQueueCollection& rq) = 0;
|
||||
|
||||
protected:
|
||||
Rectangle m_Resolution = Rectangle(1280, 720);
|
||||
bool m_Fullscreen = false;
|
||||
bool m_VSYNC = false;
|
||||
int m_GLVersion[2];
|
||||
std::string m_GLVendor;
|
||||
::Camera* m_DefaultCamera;
|
||||
::Camera* m_Camera = nullptr;
|
||||
GLFWwindow* m_Window = nullptr;
|
||||
};
|
||||
|
||||
#endif // Renderer_h__
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifndef Model_h__
|
||||
#define Model_h__
|
||||
|
||||
#include "Rendering/RawModel.h"
|
||||
#include "RawModel.h"
|
||||
#include "../OpenGL.h"
|
||||
|
||||
class Model : public RawModel
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <png.h>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "Image.h"
|
||||
|
||||
class PNG : public Image
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#ifndef RawModel_h__
|
||||
#define RawModel_h__
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <cstdlib>
|
||||
#include <stack>
|
||||
|
||||
@@ -15,9 +12,11 @@
|
||||
#include <assimp/postprocess.h>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Rendering/Texture.h"
|
||||
#include "Rendering/Skeleton.h"
|
||||
#include "../Common.h"
|
||||
#include "../GLM.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "Texture.h"
|
||||
#include "Skeleton.h"
|
||||
|
||||
class RawModel : public Resource
|
||||
{
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
#ifndef RenderQueue_h__
|
||||
#define RenderQueue_h__
|
||||
|
||||
#include <cstdint>
|
||||
#include <forward_list>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../GLM.h"
|
||||
#include "../Core/Util/Rectangle.h"
|
||||
|
||||
class Model;
|
||||
class Skeleton;
|
||||
class Texture;
|
||||
class RenderQueue;
|
||||
|
||||
struct RenderJob
|
||||
{
|
||||
friend class RenderQueue;
|
||||
|
||||
float Depth;
|
||||
|
||||
protected:
|
||||
uint64_t Hash;
|
||||
|
||||
virtual void CalculateHash() = 0;
|
||||
|
||||
bool operator<(const RenderJob& rhs)
|
||||
{
|
||||
return this->Hash < rhs.Hash;
|
||||
}
|
||||
};
|
||||
|
||||
struct ModelJob : RenderJob
|
||||
{
|
||||
unsigned int ShaderID = 0;
|
||||
unsigned int TextureID = 0;
|
||||
|
||||
glm::mat4 ModelMatrix;
|
||||
const Texture* DiffuseTexture;
|
||||
const Texture* NormalTexture;
|
||||
const Texture* SpecularTexture;
|
||||
float Shininess = 0.f;
|
||||
glm::vec4 Color;
|
||||
const Model* Model = nullptr;
|
||||
unsigned int StartIndex = 0;
|
||||
unsigned int EndIndex = 0;
|
||||
|
||||
// Animation
|
||||
Skeleton* Skeleton = nullptr;
|
||||
bool NoRootMotion = true;
|
||||
std::string AnimationName;
|
||||
double AnimationTime = 0;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = TextureID;
|
||||
}
|
||||
};
|
||||
|
||||
struct SpriteJob : RenderJob
|
||||
{
|
||||
unsigned int ShaderID = 0;
|
||||
unsigned int TextureID = 0;
|
||||
|
||||
glm::mat4 ModelMatrix;
|
||||
const Texture* DiffuseTexture = nullptr;
|
||||
const Texture* NormalTexture = nullptr;
|
||||
const Texture* SpecularTexture = nullptr;
|
||||
glm::vec4 Color;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = TextureID;
|
||||
}
|
||||
};
|
||||
|
||||
struct PointLightJob : RenderJob
|
||||
{
|
||||
glm::vec3 Position;
|
||||
glm::vec3 SpecularColor = glm::vec3(1, 1, 1);
|
||||
glm::vec3 DiffuseColor = glm::vec3(1, 1, 1);
|
||||
float Radius = 1.f;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct FrameJob : SpriteJob
|
||||
{
|
||||
Rectangle Scissor;
|
||||
Rectangle Viewport;
|
||||
std::string Name;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct WaterParticleJob : RenderJob
|
||||
{
|
||||
glm::vec3 Position;
|
||||
glm::vec4 Color;
|
||||
glm::mat4 ModelMatrix;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class RenderQueue
|
||||
{
|
||||
public:
|
||||
template <typename T>
|
||||
void Add(T &job)
|
||||
{
|
||||
job.CalculateHash();
|
||||
Jobs.push_back(std::shared_ptr<T>(new T(job)));
|
||||
m_Size++;
|
||||
}
|
||||
|
||||
void Sort()
|
||||
{
|
||||
Jobs.sort();
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Jobs.clear();
|
||||
m_Size = 0;
|
||||
}
|
||||
|
||||
int Size() const { return m_Size; }
|
||||
std::list<std::shared_ptr<RenderJob>>::const_iterator begin()
|
||||
{
|
||||
return Jobs.begin();
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<RenderJob>>::const_iterator end()
|
||||
{
|
||||
return Jobs.end();
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<RenderJob>> Jobs;
|
||||
|
||||
private:
|
||||
int m_Size = 0;
|
||||
};
|
||||
|
||||
struct RenderQueueCollection
|
||||
{
|
||||
RenderQueue Deferred;
|
||||
RenderQueue Forward;
|
||||
RenderQueue Lights;
|
||||
RenderQueue GUI;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Deferred.Clear();
|
||||
Forward.Clear();
|
||||
Lights.Clear();
|
||||
GUI.Clear();
|
||||
}
|
||||
|
||||
void Sort()
|
||||
{
|
||||
Deferred.Sort();
|
||||
Forward.Sort();
|
||||
Lights.Sort();
|
||||
GUI.Sort();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,8 @@
|
||||
#define Skeleton_h__
|
||||
|
||||
#include <sstream>
|
||||
#include "Common.h"
|
||||
#include "../GLM.h"
|
||||
|
||||
//struct Bone
|
||||
//{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef Texture_h__
|
||||
#define Texture_h__
|
||||
|
||||
#include "Rendering/BaseTexture.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "BaseTexture.h"
|
||||
#include "PNG.h"
|
||||
|
||||
class Texture : public BaseTexture
|
||||
{
|
||||
|
||||
@@ -1,26 +1,8 @@
|
||||
/*
|
||||
This file is part of Daydream Engine.
|
||||
Copyright 2014 Adam Byléhn, Tobias Dahl, Simon Holmberg, Viktor Ljung
|
||||
|
||||
Daydream Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Daydream Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Daydream Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GLError_h__
|
||||
#define GLError_h__
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include <iostream>
|
||||
#include "Common.h"
|
||||
|
||||
inline bool _GLERROR(const char* info, const char* file, const char* func, unsigned int line)
|
||||
{
|
||||
@@ -37,4 +19,4 @@ inline bool _GLERROR(const char* info, const char* file, const char* func, unsig
|
||||
#define GLERROR(function) \
|
||||
_GLERROR(function, __BASE_FILE__, __func__, __LINE__)
|
||||
|
||||
#endif // GLError_h__
|
||||
#endif
|
||||
Reference in New Issue
Block a user