emscripten support
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#ifndef LLMR_GEOMETRY_LINEVERTEXBUFFER
|
||||
#define LLMR_GEOMETRY_LINEVERTEXBUFFER
|
||||
|
||||
#include "../platform/gl.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
@@ -18,7 +16,7 @@ public:
|
||||
void bind();
|
||||
private:
|
||||
std::vector<uint16_t> array;
|
||||
GLuint buffer;
|
||||
uint32_t buffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef LLMR_RENDERER_GL
|
||||
#define LLMR_RENDERER_GL
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef EMSCRIPTEN
|
||||
#include <GLES2/gl2.h>
|
||||
#elif __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
|
||||
@@ -8,8 +8,6 @@ class tile;
|
||||
class platform {
|
||||
public:
|
||||
platform(void *obj) : obj(obj) {}
|
||||
|
||||
const char *shaderSource(const char *name, const char *extension);
|
||||
void restart();
|
||||
void request(tile *tile);
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef LLMR_RENDERER_PAINTER
|
||||
#define LLMR_RENDERER_PAINTER
|
||||
|
||||
#include "../platform/gl.hpp"
|
||||
|
||||
#include "shader-fill.hpp"
|
||||
#include "shader-line.hpp"
|
||||
|
||||
@@ -19,7 +17,7 @@ public:
|
||||
void setup();
|
||||
void teardown();
|
||||
|
||||
void resize(GLuint new_width, GLuint new_height);
|
||||
void resize(uint32_t new_width, uint32_t new_height);
|
||||
void viewport();
|
||||
|
||||
|
||||
@@ -38,16 +36,16 @@ public:
|
||||
private:
|
||||
platform *platform;
|
||||
transform *transform;
|
||||
GLuint width, height;
|
||||
GLfloat matrix[16];
|
||||
uint32_t width, height;
|
||||
float matrix[16];
|
||||
|
||||
Shader *currentShader;
|
||||
FillShader *fillShader;
|
||||
LineShader *lineShader;
|
||||
|
||||
GLuint vertexArray;
|
||||
GLuint triangleVertexBuffer;
|
||||
GLuint fillVertexBuffer;
|
||||
uint32_t vertexArray;
|
||||
uint32_t triangleVertexBuffer;
|
||||
uint32_t fillVertexBuffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace llmr {
|
||||
|
||||
class FillShader : public Shader {
|
||||
public:
|
||||
FillShader(const GLchar *vertex, const GLchar *fragment);
|
||||
FillShader();
|
||||
|
||||
GLint a_pos;
|
||||
GLint u_matrix;
|
||||
GLint u_color;
|
||||
int32_t a_pos;
|
||||
int32_t u_matrix;
|
||||
int32_t u_color;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace llmr {
|
||||
|
||||
class LineShader : public Shader {
|
||||
public:
|
||||
LineShader(const GLchar *vertex, const GLchar *fragment);
|
||||
LineShader();
|
||||
|
||||
GLint a_pos;
|
||||
GLint u_matrix;
|
||||
GLint u_color;
|
||||
int32_t a_pos;
|
||||
int32_t u_matrix;
|
||||
int32_t u_color;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
#ifndef LLMR_RENDERER_SHADER
|
||||
#define LLMR_RENDERER_SHADER
|
||||
|
||||
#include "../platform/gl.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Shader {
|
||||
public:
|
||||
Shader(const GLchar *vertex, const GLchar *fragment);
|
||||
Shader(const char *vertex, const char *fragment);
|
||||
~Shader();
|
||||
bool valid;
|
||||
GLuint program;
|
||||
std::vector<GLuint> attributes;
|
||||
uint32_t program;
|
||||
std::vector<uint32_t> attributes;
|
||||
|
||||
private:
|
||||
bool compileShader(GLuint *shader, GLenum type, const GLchar *source);
|
||||
bool compileShader(uint32_t *shader, uint32_t type, const char *source);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
28
include/llmr/shader/shaders.h
Normal file
28
include/llmr/shader/shaders.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
|
||||
|
||||
#ifndef LLMR_SHADER_SHADERS
|
||||
#define LLMR_SHADER_SHADERS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct llmr_shader {
|
||||
const char *vertex;
|
||||
const char *fragment;
|
||||
};
|
||||
typedef struct llmr_shader llmr_shader_t;
|
||||
|
||||
enum {
|
||||
FILL_SHADER,
|
||||
LINE_SHADER,
|
||||
SHADER_COUNT
|
||||
};
|
||||
|
||||
extern const llmr_shader_t llmr_shaders[SHADER_COUNT];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user