Get the latest Blender, older versions, or experimental builds.
Stay up-to-date with the new features in the latest Blender releases.
Access production assets and knowledge from the open movies.
Documentation on the usage and features in Blender.
Latest development updates, by Blender developers.
Guidelines, release notes and development docs.
A platform to collect and share results of the Blender Benchmark.
The yearly event that brings the community together.
Support core development with a monthly contribution.
Perform a single donation with more payment options available.
// Gawain element list (AKA index buffer)
//
// This code is part of the Gawain library, with modifications
// specific to integration with Blender.
// Copyright 2016 Mike Erwin
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
// the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
#pragma once
#include "common.h"
#define TRACK_INDEX_RANGE 1
typedef struct {
unsigned index_ct;
#if TRACK_INDEX_RANGE
GLenum index_type;
unsigned min_index;
unsigned max_index;
unsigned base_index;
#endif
void* data; // NULL indicates data in VRAM (unmapped) or not yet allocated
GLuint vbo_id; // 0 indicates not yet sent to VRAM
} ElementList;
void ElementList_use(ElementList*);
unsigned ElementList_size(const ElementList*);
unsigned max_allowed_index;
unsigned max_index_ct;
GLenum prim_type;
unsigned* data;
} ElementListBuilder;
// supported primitives:
// GL_POINTS
// GL_LINES
// GL_TRIANGLES
void ElementListBuilder_init(ElementListBuilder*, GLenum prim_type, unsigned prim_ct, unsigned vertex_ct);
//void ElementListBuilder_init_custom(ElementListBuilder*, GLenum prim_type, unsigned index_ct, unsigned vertex_ct);
void add_generic_vertex(ElementListBuilder*, unsigned v);
void add_point_vertex(ElementListBuilder*, unsigned v);
void add_line_vertices(ElementListBuilder*, unsigned v1, unsigned v2);
void add_triangle_vertices(ElementListBuilder*, unsigned v1, unsigned v2, unsigned v3);
ElementList* ElementList_build(ElementListBuilder*);
void ElementList_build_in_place(ElementListBuilder*, ElementList*);
void ElementList_discard(ElementList*);