Merge branch 'main' of https://git.poto.cafe/wanp/townengine
This commit is contained in:
@ -87,6 +87,9 @@ typedef enum {
|
||||
static Pipeline pipeline_last_used = PIPELINE_NO;
|
||||
|
||||
|
||||
#define CIRCLE_VERTICES_MAX 2048
|
||||
|
||||
|
||||
void use_space_pipeline(void) {
|
||||
if (pipeline_last_used == PIPELINE_SPACE)
|
||||
return;
|
||||
@ -166,16 +169,16 @@ void use_2d_pipeline(void) {
|
||||
|
||||
|
||||
void render_circle(const CirclePrimitive *circle) {
|
||||
SDL_Vertex *vertices = NULL;
|
||||
int *indices = NULL;
|
||||
int num_vertices = (int)circle->radius;
|
||||
static SDL_Vertex vertices[CIRCLE_VERTICES_MAX];
|
||||
static int indices[CIRCLE_VERTICES_MAX * 3];
|
||||
int num_vertices = MIN((int)circle->radius, CIRCLE_VERTICES_MAX-1);
|
||||
|
||||
create_circle_geometry(circle->position,
|
||||
circle->color,
|
||||
circle->radius,
|
||||
num_vertices,
|
||||
&vertices,
|
||||
&indices);
|
||||
vertices,
|
||||
indices);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2,
|
||||
@ -196,9 +199,6 @@ void render_circle(const CirclePrimitive *circle) {
|
||||
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
SDL_free(vertices);
|
||||
SDL_free(indices);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user