summaryrefslogtreecommitdiffhomepage
path: root/src/rodeo_internal_types.h
blob: 2719b07548da3012a8f197451248101e7097932f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

// -- internal --
// public
#include "rodeo_config.h"
#include "rodeo_types.h"

// -- external --
#if __EMSCRIPTEN__
	#include <emscripten/emscripten.h>
#endif
#include "SDL2/SDL.h"
#include "SDL2/SDL_syswm.h"
#include "bgfx/c99/bgfx.h"
#include "stc/crandom.h"

typedef uint16_t index_type_t;

typedef struct
{
	SDL_Window* window;
	SDL_Surface* screen_surface;
	SDL_SysWMinfo wmi;
	uint16_t screen_width;
	uint16_t screen_height;
	SDL_Event sdl_event;
	bool quit;

	bgfx_vertex_layout_t vertex_layout;
	bgfx_dynamic_vertex_buffer_handle_t vertex_buffer_handle;
	bgfx_dynamic_index_buffer_handle_t index_buffer_handle;
	rodeo_vertex_t batched_vertices[mrodeo_vertex_size_max];
	index_type_t vertex_size;
	index_type_t index_count;
	index_type_t index_size;
	index_type_t batched_indices[(mrodeo_vertex_size_max / 4) * 6];
	rodeo_texture_2d_t default_texture;
	bgfx_texture_handle_t *active_texture_p;
	bgfx_shader_handle_t vertex_shader;
	bgfx_shader_handle_t fragment_shader;
	bgfx_program_handle_t program_shader;
	bgfx_uniform_handle_t texture_uniforms[2];

	stc64_t random_seed;

	uint64_t frame_count;
	uint64_t start_frame;
	uint64_t end_frame;
	float frame_time;
	uint32_t frame_limit;
}
irodeo_state_t;

struct
irodeo_texture_internal_t
{
	bgfx_texture_handle_t texture_bgfx;
	//bgfx_uniform_handle_t sampler_bgfx;
};