diff options
author | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-18 23:10:11 +1000 |
---|---|---|
committer | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-18 23:10:11 +1000 |
commit | 01d598220b403f4ac4da3b7aa1f0ce398be3198f (patch) | |
tree | 1408b120506f29d3a2d6b3b29a0c91fc1b1371eb /src/new_render/render.c | |
parent | 544aac70015b6b075b172c42dd2d90dee3d029c0 (diff) |
skybox works
Diffstat (limited to 'src/new_render/render.c')
-rw-r--r-- | src/new_render/render.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/new_render/render.c b/src/new_render/render.c index a757c97..58041dd 100644 --- a/src/new_render/render.c +++ b/src/new_render/render.c @@ -142,7 +142,7 @@ TextureData TextureDataLoad(const char* path, bool invert_y) { stbi_set_flip_vertically_on_load(invert_y); #pragma GCC diagnostic ignored "-Wpointer-sign" - char* data = stbi_load(path, &width, &height, &num_channels, STBI_rgb_alpha); + char* data = stbi_load(path, &width, &height, &num_channels, STBI_rgb); if (data) { DEBUG("loaded texture: %s", path); } else { @@ -182,10 +182,12 @@ Mesh Mesh_Create(Geometry* geometry, bool free_on_upload) { GPU_BufferCreate(vert_bytes, BUFFER_VERTEX, BUFFER_FLAG_GPU, geometry->vertices->data); // Create and upload index buffer - size_t index_bytes = geometry->indices->len * sizeof(u32); - INFO("Creating index buffer with size %d (len: %d)", index_bytes, geometry->indices->len); - m.index_buffer = - GPU_BufferCreate(index_bytes, BUFFER_INDEX, BUFFER_FLAG_GPU, geometry->indices->data); + if (geometry->has_indices) { + size_t index_bytes = geometry->indices->len * sizeof(u32); + INFO("Creating index buffer with size %d (len: %d)", index_bytes, geometry->indices->len); + m.index_buffer = + GPU_BufferCreate(index_bytes, BUFFER_INDEX, BUFFER_FLAG_GPU, geometry->indices->data); + } m.is_uploaded = true; m.geometry = *geometry; // clone geometry data and store on Mesh struct |