big rendering overhaul (cleaning and api abstraction)
This commit is contained in:
@ -12,27 +12,35 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include <stb_truetype.h>
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#include <glad/glad.h>
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
extern Matrix4 camera_projection_matrix;
|
||||
extern Matrix4 camera_look_at_matrix;
|
||||
|
||||
extern double depth_range_low, depth_range_high;
|
||||
|
||||
#define QUAD_ELEMENT_BUFFER_LENGTH (65536 / 6)
|
||||
#define CIRCLE_VERTICES_MAX 2048
|
||||
|
||||
/* TODO: limit to only most necessary */
|
||||
enum {
|
||||
TWN_FLOAT,
|
||||
TWN_INT,
|
||||
TWN_SHORT,
|
||||
TWN_UNSIGNED_SHORT,
|
||||
TWN_UNSIGNED_INT,
|
||||
TWN_BYTE,
|
||||
TWN_UNSIGNED_BYTE,
|
||||
};
|
||||
|
||||
typedef GLuint VertexBuffer;
|
||||
|
||||
typedef uint32_t VertexBuffer;
|
||||
|
||||
typedef struct VertexBufferBuilder {
|
||||
size_t bytes_left;
|
||||
size_t size;
|
||||
void *mapping;
|
||||
void *base;
|
||||
} VertexBufferBuilder;
|
||||
|
||||
|
||||
@ -209,6 +217,8 @@ typedef struct ElementIndexedBillboard {
|
||||
} ElementIndexedBillboard;
|
||||
|
||||
|
||||
bool render_init(void);
|
||||
|
||||
/* renders the background, then the primitives in all render queues */
|
||||
void render(void);
|
||||
|
||||
@ -250,6 +260,8 @@ void text_cache_reset_arena(TextCache *cache);
|
||||
|
||||
VertexBuffer create_vertex_buffer(void);
|
||||
|
||||
void restart_scratch_vertex_arrays(void);
|
||||
|
||||
VertexBuffer get_scratch_vertex_array(void);
|
||||
|
||||
void delete_vertex_buffer(VertexBuffer buffer);
|
||||
@ -274,7 +286,6 @@ void finally_clear_draw_buffer(DeferredCommandClear command);
|
||||
void swap_buffers(void);
|
||||
|
||||
void set_depth_range(double low, double high);
|
||||
void finally_set_depth_range(DeferredCommandDepthRange command);
|
||||
|
||||
VertexBuffer get_quad_element_buffer(void);
|
||||
|
||||
@ -284,15 +295,6 @@ void render_circle(const CirclePrimitive *circle);
|
||||
|
||||
void render_rectangle(const RectPrimitive *rectangle);
|
||||
|
||||
void use_space_pipeline(void);
|
||||
void finally_use_space_pipeline(void);
|
||||
|
||||
void use_2d_pipeline(void);
|
||||
void finally_use_2d_pipeline(void);
|
||||
|
||||
void use_texture_mode(TextureMode mode);
|
||||
void finally_use_texture_mode(TextureMode mode);
|
||||
|
||||
void finally_render_quads(Primitive2D const primitives[],
|
||||
struct QuadBatch batch,
|
||||
VertexBuffer buffer);
|
||||
@ -325,11 +327,6 @@ void finally_draw_text(FontData const *font_data,
|
||||
void render_skybox(void);
|
||||
void finally_render_skybox(DeferredCommandDrawSkybox);
|
||||
|
||||
void apply_fog(void);
|
||||
void finally_apply_fog(DeferredCommandApplyFog);
|
||||
void pop_fog(void);
|
||||
void finally_pop_fog(void);
|
||||
|
||||
void start_render_frame(void);
|
||||
void end_render_frame(void);
|
||||
|
||||
|
Reference in New Issue
Block a user