draw: increase far Z, separate path for space quads, fix billboard batching

This commit is contained in:
veclavtalica
2025-02-26 13:27:09 +03:00
parent 5f3920fdba
commit a36459397e
10 changed files with 190 additions and 59 deletions

View File

@ -62,15 +62,15 @@ IndexBuffer get_quad_element_buffer(void) {
/* TODO: use builder interface, not direct calls (glMapBuffer isn't portable) */
if (buffer == 0) {
buffer = create_index_buffer();
IndexBufferBuilder builder = build_index_buffer(buffer, sizeof (GLshort) * QUAD_ELEMENT_BUFFER_LENGTH * 6 );
IndexBufferBuilder builder = build_index_buffer(buffer, sizeof (GLuint) * QUAD_ELEMENT_BUFFER_LENGTH * 6 );
for (size_t i = 0; i < QUAD_ELEMENT_BUFFER_LENGTH; ++i) {
((GLshort *)builder.base)[i * 6 + 0] = (GLshort)(i * 4 + 0);
((GLshort *)builder.base)[i * 6 + 1] = (GLshort)(i * 4 + 1);
((GLshort *)builder.base)[i * 6 + 2] = (GLshort)(i * 4 + 2);
((GLshort *)builder.base)[i * 6 + 3] = (GLshort)(i * 4 + 2);
((GLshort *)builder.base)[i * 6 + 4] = (GLshort)(i * 4 + 3);
((GLshort *)builder.base)[i * 6 + 5] = (GLshort)(i * 4 + 0);
((GLuint *)builder.base)[i * 6 + 0] = (GLuint)(i * 4 + 0);
((GLuint *)builder.base)[i * 6 + 1] = (GLuint)(i * 4 + 1);
((GLuint *)builder.base)[i * 6 + 2] = (GLuint)(i * 4 + 2);
((GLuint *)builder.base)[i * 6 + 3] = (GLuint)(i * 4 + 2);
((GLuint *)builder.base)[i * 6 + 4] = (GLuint)(i * 4 + 3);
((GLuint *)builder.base)[i * 6 + 5] = (GLuint)(i * 4 + 0);
}
finish_index_builder(&builder);