113 lines
2.4 KiB
C++
113 lines
2.4 KiB
C++
// Copyright (C) 2022 RozK
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program 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 Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#ifndef _RK_ENGINE_RENDER_OPENGLES_H
|
|
#define _RK_ENGINE_RENDER_OPENGLES_H
|
|
|
|
#include "../types.hpp"
|
|
#include <GLES3/gl32.h>
|
|
#include <GLES3/gl3ext.h>
|
|
#include <GLES3/gl3platform.h>
|
|
|
|
struct rk_shader {
|
|
GLuint vertex;
|
|
GLuint fragment;
|
|
GLuint program;
|
|
};
|
|
|
|
struct rk_texture {
|
|
unsigned nlevels;
|
|
GLuint texture;
|
|
};
|
|
|
|
struct rk_triangles {
|
|
unsigned size;
|
|
GLuint array;
|
|
GLuint vertices;
|
|
};
|
|
|
|
struct rk_vertices {
|
|
unsigned nvertices;
|
|
unsigned nindices;
|
|
rk_vertex_format * format;
|
|
rk_ubyte * vertices;
|
|
rk_ushort * indices;
|
|
};
|
|
|
|
struct rk_command {
|
|
GLuint nvertices;
|
|
GLuint ninstances;
|
|
GLuint base_index;
|
|
GLint base_vertex;
|
|
GLuint base_instance;
|
|
};
|
|
|
|
struct rk_vec3_float {
|
|
float x;
|
|
float y;
|
|
float z;
|
|
};
|
|
|
|
struct rk_vec3_short {
|
|
rk_short x;
|
|
rk_short y;
|
|
rk_short z;
|
|
rk_short pad;
|
|
};
|
|
|
|
typedef rk_int rk_vec3_int10;
|
|
typedef rk_uint rk_vec3_uint10;
|
|
|
|
struct rk_mat3_float {
|
|
rk_vec3_float x;
|
|
rk_vec3_float y;
|
|
rk_vec3_float z;
|
|
};
|
|
|
|
struct rk_mat3_int10 {
|
|
rk_vec3_int10 x;
|
|
rk_vec3_int10 y;
|
|
rk_vec3_int10 z;
|
|
};
|
|
|
|
typedef void (*rk_packer)(
|
|
unsigned const, // count
|
|
rk_ushort const * const, // indices
|
|
rk_ubyte *, // dst
|
|
rk_ubyte const * const); // src
|
|
|
|
struct rk_parameter {
|
|
unsigned binding;
|
|
unsigned offset;
|
|
unsigned size;
|
|
rk_packer packer;
|
|
};
|
|
|
|
struct rk_batch {
|
|
unsigned max_size;
|
|
unsigned max_meshes;
|
|
unsigned nparams;
|
|
rk_ushort * indices;
|
|
rk_command * commands;
|
|
rk_parameter * params;
|
|
GLuint vertex_array;
|
|
GLuint vertices_buffer;
|
|
GLuint indices_buffer;
|
|
GLuint commands_buffer;
|
|
GLuint params_buffer;
|
|
};
|
|
|
|
#endif // _RK_ENGINE_RENDER_OPENGLES_H
|