2017-07-29 00:26:35 -07:00
|
|
|
#ifndef KRHELPERS_H
|
|
|
|
|
#define KRHELPERS_H
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
#include <GL/glew.h>
|
2017-10-04 17:14:29 -07:00
|
|
|
#elif defined(__linux__) || defined(__unix__) || defined(__posix__)
|
|
|
|
|
#include <GL/gl.h>
|
|
|
|
|
#include <GL/glu.h>
|
|
|
|
|
#include <GL/glext.h>
|
2017-10-04 21:21:29 -07:00
|
|
|
#elif defined(__APPLE__)
|
|
|
|
|
#include <OpenGL/gl3.h>
|
|
|
|
|
#include <OpenGL/gl3ext.h>
|
2017-07-29 00:26:35 -07:00
|
|
|
#endif
|
2017-10-04 17:14:29 -07:00
|
|
|
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
2017-07-29 00:26:35 -07:00
|
|
|
|
|
|
|
|
#define KRMIN(x,y) ((x) < (y) ? (x) : (y))
|
|
|
|
|
#define KRMAX(x,y) ((x) > (y) ? (x) : (y))
|
|
|
|
|
#define KRCLAMP(x, min, max) (KRMAX(KRMIN(x, max), min))
|
|
|
|
|
#define KRALIGN(x) ((x + 3) & ~0x03)
|
|
|
|
|
|
|
|
|
|
float const PI = 3.141592653589793f;
|
|
|
|
|
float const D2R = PI * 2 / 360;
|
|
|
|
|
|
|
|
|
|
namespace kraken {
|
2017-07-29 01:20:07 -07:00
|
|
|
void SetUniform(GLint location, const Vector2 &v);
|
2017-07-29 01:24:49 -07:00
|
|
|
void SetUniform(GLint location, const Vector3 &v);
|
2017-07-29 01:29:30 -07:00
|
|
|
void SetUniform(GLint location, const Vector4 &v);
|
2017-07-29 17:54:27 -07:00
|
|
|
void SetUniform(GLint location, const Matrix4 &v);
|
2017-07-29 00:26:35 -07:00
|
|
|
|
2017-07-29 01:24:49 -07:00
|
|
|
void setXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &value, const Vector3 &default_value);
|
|
|
|
|
const Vector3 getXMLAttribute(const std::string &base_name, ::tinyxml2::XMLElement *e, const Vector3 &default_value);
|
2017-07-29 00:26:35 -07:00
|
|
|
} // namespace kraken
|
|
|
|
|
|
2017-10-04 17:14:29 -07:00
|
|
|
#endif
|