#pragma once #include #include "usage.h" #include /*! \file indexbuffer.h \brief Provides functions for setting up and using index-buffers. */ #ifdef __cplusplus extern "C" { #endif typedef enum kinc_g4_index_buffer_format { KINC_G4_INDEX_BUFFER_FORMAT_32BIT, KINC_G4_INDEX_BUFFER_FORMAT_16BIT } kinc_g4_index_buffer_format_t; typedef struct kinc_g4_index_buffer { kinc_g4_index_buffer_impl_t impl; } kinc_g4_index_buffer_t; /// /// Initializes an index-buffer. /// /// The buffer to initialize /// The number of indices to allocate for the buffer /// The integer-format of the buffer /// A hint for how the buffer will be used KINC_FUNC void kinc_g4_index_buffer_init(kinc_g4_index_buffer_t *buffer, int count, kinc_g4_index_buffer_format_t format, kinc_g4_usage_t usage); /// /// Destroys an index-buffer. /// /// The buffer to destroy KINC_FUNC void kinc_g4_index_buffer_destroy(kinc_g4_index_buffer_t *buffer); /// /// Locks an index-buffer so its contents can be modified. /// /// The buffer to lock /// The contents of the index-buffer in uint32s or uint16s depending on the format provided when initializing KINC_FUNC void *kinc_g4_index_buffer_lock_all(kinc_g4_index_buffer_t *buffer); /// /// Locks part of a vertex-buffer to modify its contents. /// /// The buffer to lock /// The index of the first index to lock /// The number of indices to lock /// The contents of the index-buffer, starting at start, in uint32s or uint16s depending on the format provided when initializing KINC_FUNC void *kinc_g4_index_buffer_lock(kinc_g4_index_buffer_t *buffer, int start, int count); /// /// Unlocks an index-buffer after locking it so the changed buffer-contents can be used. /// /// The buffer to unlock KINC_FUNC void kinc_g4_index_buffer_unlock_all(kinc_g4_index_buffer_t *buffer); /// /// Unlocks part of an index-buffer after locking so the changed buffer-contents can be used. /// /// The buffer to unlock /// The number of indices to unlock, starting from the start-index from the previous lock-call KINC_FUNC void kinc_g4_index_buffer_unlock(kinc_g4_index_buffer_t *buffer, int count); /// /// Returns the number of indices in the buffer. /// /// The buffer to query for its number of indices /// The number of indices KINC_FUNC int kinc_g4_index_buffer_count(kinc_g4_index_buffer_t *buffer); void kinc_internal_g4_index_buffer_set(kinc_g4_index_buffer_t *buffer); /// /// Sets an index-buffer to be used for the next draw-command. /// /// The buffer to use KINC_FUNC void kinc_g4_set_index_buffer(kinc_g4_index_buffer_t *buffer); #ifdef __cplusplus } #endif