Initial commit
This commit is contained in:
997
application/demos/example.opengl/engine/vector.c
Normal file
997
application/demos/example.opengl/engine/vector.c
Normal file
@@ -0,0 +1,997 @@
|
||||
/*
|
||||
* This file is automaticaly generated, Please dont edit this file!
|
||||
*/
|
||||
#include <engine/vector.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int vector_char_pointer_length( vector_char_pointer * this ) {
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char * vector_char_pointer_get( vector_char_pointer * this, int index ) {
|
||||
|
||||
return this->items[index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_char_pointer_set( vector_char_pointer * this, int index, char * item ) {
|
||||
|
||||
if ( index >= 0 && index < this->total ){
|
||||
|
||||
this->items[ index ] = item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_char_pointer_resize( vector_char_pointer * this, int capacity ) {
|
||||
|
||||
char * * items = realloc( this->items, sizeof( char * ) * capacity );
|
||||
|
||||
|
||||
this->items = items;
|
||||
|
||||
this->capacity = capacity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_char_pointer_add( vector_char_pointer * this, char * item ) {
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_char_pointer_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
this->items[ this->total++ ] = item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_char_pointer_delete( vector_char_pointer * this, int index ) {
|
||||
|
||||
|
||||
|
||||
for ( int i = index; i < this->total - 1; i++ ) {
|
||||
|
||||
this->items[i] = this->items[i + 1];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this->total--;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}int vector_char_pointer_array_push( vector_char_pointer * this, char * item ) {
|
||||
|
||||
vector_char_pointer_add( this, item );
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_char_pointer_unshift( vector_char_pointer * this, char * item ) {
|
||||
|
||||
int length = this->total;
|
||||
|
||||
this->total++;
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_char_pointer_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
for ( int i = length - 1; i >= 0; --i ) {
|
||||
|
||||
this->items[ i + 1 ] = this->items[ i ];
|
||||
|
||||
}
|
||||
|
||||
this->items[ 0 ] = item;
|
||||
|
||||
}int vector_quadMesh_length( vector_quadMesh * this ) {
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
quadMesh vector_quadMesh_get( vector_quadMesh * this, int index ) {
|
||||
|
||||
return this->items[index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_quadMesh_set( vector_quadMesh * this, int index, quadMesh item ) {
|
||||
|
||||
if ( index >= 0 && index < this->total ){
|
||||
|
||||
this->items[ index ] = item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_quadMesh_resize( vector_quadMesh * this, int capacity ) {
|
||||
|
||||
quadMesh * items = realloc( this->items, sizeof( quadMesh ) * capacity );
|
||||
|
||||
|
||||
this->items = items;
|
||||
|
||||
this->capacity = capacity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_quadMesh_add( vector_quadMesh * this, quadMesh item ) {
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_quadMesh_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
this->items[ this->total++ ] = item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_quadMesh_delete( vector_quadMesh * this, int index ) {
|
||||
|
||||
|
||||
|
||||
for ( int i = index; i < this->total - 1; i++ ) {
|
||||
|
||||
this->items[i] = this->items[i + 1];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this->total--;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}int vector_quadMesh_array_push( vector_quadMesh * this, quadMesh item ) {
|
||||
|
||||
vector_quadMesh_add( this, item );
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_quadMesh_unshift( vector_quadMesh * this, quadMesh item ) {
|
||||
|
||||
int length = this->total;
|
||||
|
||||
this->total++;
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_quadMesh_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
for ( int i = length - 1; i >= 0; --i ) {
|
||||
|
||||
this->items[ i + 1 ] = this->items[ i ];
|
||||
|
||||
}
|
||||
|
||||
this->items[ 0 ] = item;
|
||||
|
||||
}int vector_element_length( vector_element * this ) {
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
element vector_element_get( vector_element * this, int index ) {
|
||||
|
||||
return this->items[index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_element_set( vector_element * this, int index, element item ) {
|
||||
|
||||
if ( index >= 0 && index < this->total ){
|
||||
|
||||
this->items[ index ] = item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_element_resize( vector_element * this, int capacity ) {
|
||||
|
||||
element * items = realloc( this->items, sizeof( element ) * capacity );
|
||||
|
||||
|
||||
this->items = items;
|
||||
|
||||
this->capacity = capacity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_element_add( vector_element * this, element item ) {
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_element_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
this->items[ this->total++ ] = item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_element_delete( vector_element * this, int index ) {
|
||||
|
||||
|
||||
|
||||
for ( int i = index; i < this->total - 1; i++ ) {
|
||||
|
||||
this->items[i] = this->items[i + 1];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this->total--;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}int vector_element_array_push( vector_element * this, element item ) {
|
||||
|
||||
vector_element_add( this, item );
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_element_unshift( vector_element * this, element item ) {
|
||||
|
||||
int length = this->total;
|
||||
|
||||
this->total++;
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_element_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
for ( int i = length - 1; i >= 0; --i ) {
|
||||
|
||||
this->items[ i + 1 ] = this->items[ i ];
|
||||
|
||||
}
|
||||
|
||||
this->items[ 0 ] = item;
|
||||
|
||||
}int vector_int_length( vector_int * this ) {
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int vector_int_get( vector_int * this, int index ) {
|
||||
|
||||
return this->items[index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_int_set( vector_int * this, int index, int item ) {
|
||||
|
||||
if ( index >= 0 && index < this->total ){
|
||||
|
||||
this->items[ index ] = item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_int_resize( vector_int * this, int capacity ) {
|
||||
|
||||
int * items = realloc( this->items, sizeof( int ) * capacity );
|
||||
|
||||
|
||||
this->items = items;
|
||||
|
||||
this->capacity = capacity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_int_add( vector_int * this, int item ) {
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_int_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
this->items[ this->total++ ] = item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_int_delete( vector_int * this, int index ) {
|
||||
|
||||
|
||||
|
||||
for ( int i = index; i < this->total - 1; i++ ) {
|
||||
|
||||
this->items[i] = this->items[i + 1];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this->total--;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}int vector_int_array_push( vector_int * this, int item ) {
|
||||
|
||||
vector_int_add( this, item );
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_int_unshift( vector_int * this, int item ) {
|
||||
|
||||
int length = this->total;
|
||||
|
||||
this->total++;
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_int_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
for ( int i = length - 1; i >= 0; --i ) {
|
||||
|
||||
this->items[ i + 1 ] = this->items[ i ];
|
||||
|
||||
}
|
||||
|
||||
this->items[ 0 ] = item;
|
||||
|
||||
}int vector_vector2_length( vector_vector2 * this ) {
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
vector2 vector_vector2_get( vector_vector2 * this, int index ) {
|
||||
|
||||
return this->items[index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_vector2_set( vector_vector2 * this, int index, vector2 item ) {
|
||||
|
||||
if ( index >= 0 && index < this->total ){
|
||||
|
||||
this->items[ index ] = item;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_vector2_resize( vector_vector2 * this, int capacity ) {
|
||||
|
||||
vector2 * items = realloc( this->items, sizeof( vector2 ) * capacity );
|
||||
|
||||
|
||||
this->items = items;
|
||||
|
||||
this->capacity = capacity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_vector2_add( vector_vector2 * this, vector2 item ) {
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_vector2_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
this->items[ this->total++ ] = item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_vector2_delete( vector_vector2 * this, int index ) {
|
||||
|
||||
|
||||
|
||||
for ( int i = index; i < this->total - 1; i++ ) {
|
||||
|
||||
this->items[i] = this->items[i + 1];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this->total--;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}int vector_vector2_array_push( vector_vector2 * this, vector2 item ) {
|
||||
|
||||
vector_vector2_add( this, item );
|
||||
|
||||
return this->total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void vector_vector2_unshift( vector_vector2 * this, vector2 item ) {
|
||||
|
||||
int length = this->total;
|
||||
|
||||
this->total++;
|
||||
|
||||
if ( this->capacity == this->total ){
|
||||
|
||||
vector_vector2_resize( this, this->capacity * 2 );
|
||||
|
||||
}
|
||||
|
||||
for ( int i = length - 1; i >= 0; --i ) {
|
||||
|
||||
this->items[ i + 1 ] = this->items[ i ];
|
||||
|
||||
}
|
||||
|
||||
this->items[ 0 ] = item;
|
||||
|
||||
}
|
||||
|
||||
vector_char_pointer vector_char_pointer_new() {
|
||||
|
||||
vector_char_pointer instance;
|
||||
|
||||
instance.capacity = 10;
|
||||
|
||||
instance.total = 0;
|
||||
|
||||
instance.items = malloc( 10000000 );
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
vector_char_pointer * vector_char_pointer_newPointer() {
|
||||
|
||||
struct vector_char_pointer * pointer = malloc( sizeof ( struct vector_char_pointer ) );
|
||||
|
||||
pointer->capacity = 10;
|
||||
|
||||
pointer->total = 0;
|
||||
|
||||
pointer->items = malloc( 10000000 );
|
||||
|
||||
return pointer;
|
||||
|
||||
}
|
||||
|
||||
vector_quadMesh vector_quadMesh_new() {
|
||||
|
||||
vector_quadMesh instance;
|
||||
|
||||
instance.capacity = 10;
|
||||
|
||||
instance.total = 0;
|
||||
|
||||
instance.items = malloc( 10000000 );
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
vector_quadMesh * vector_quadMesh_newPointer() {
|
||||
|
||||
struct vector_quadMesh * pointer = malloc( sizeof ( struct vector_quadMesh ) );
|
||||
|
||||
pointer->capacity = 10;
|
||||
|
||||
pointer->total = 0;
|
||||
|
||||
pointer->items = malloc( 10000000 );
|
||||
|
||||
return pointer;
|
||||
|
||||
}
|
||||
|
||||
vector_element vector_element_new() {
|
||||
|
||||
vector_element instance;
|
||||
|
||||
instance.capacity = 10;
|
||||
|
||||
instance.total = 0;
|
||||
|
||||
instance.items = malloc( 10000000 );
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
vector_element * vector_element_newPointer() {
|
||||
|
||||
struct vector_element * pointer = malloc( sizeof ( struct vector_element ) );
|
||||
|
||||
pointer->capacity = 10;
|
||||
|
||||
pointer->total = 0;
|
||||
|
||||
pointer->items = malloc( 10000000 );
|
||||
|
||||
return pointer;
|
||||
|
||||
}
|
||||
|
||||
vector_int vector_int_new() {
|
||||
|
||||
vector_int instance;
|
||||
|
||||
instance.capacity = 10;
|
||||
|
||||
instance.total = 0;
|
||||
|
||||
instance.items = malloc( 10000000 );
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
vector_int * vector_int_newPointer() {
|
||||
|
||||
struct vector_int * pointer = malloc( sizeof ( struct vector_int ) );
|
||||
|
||||
pointer->capacity = 10;
|
||||
|
||||
pointer->total = 0;
|
||||
|
||||
pointer->items = malloc( 10000000 );
|
||||
|
||||
return pointer;
|
||||
|
||||
}
|
||||
|
||||
vector_vector2 vector_vector2_new() {
|
||||
|
||||
vector_vector2 instance;
|
||||
|
||||
instance.capacity = 10;
|
||||
|
||||
instance.total = 0;
|
||||
|
||||
instance.items = malloc( 10000000 );
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
vector_vector2 * vector_vector2_newPointer() {
|
||||
|
||||
struct vector_vector2 * pointer = malloc( sizeof ( struct vector_vector2 ) );
|
||||
|
||||
pointer->capacity = 10;
|
||||
|
||||
pointer->total = 0;
|
||||
|
||||
pointer->items = malloc( 10000000 );
|
||||
|
||||
return pointer;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user