#include "include.h"
#include "common.h"
#include "junzip.h"
#include "md5sum.h"
#include "stb_image.h"
#include <stdarg.h>
#include <math.h>
Macros | |
#define | STB_IMAGE_IMPLEMENTATION |
#define | DMESG_SIZE 2048 |
Functions | |
float | newtonSqrt (float x) |
void | md5sum (char *data, int size, char *hash) |
bool | aabb_visible (vec3 &min, vec3 &max, matrix4 &mvp) |
bool | RayTriangleMT (vec3 &origin, vec3 &dir, vec3 &a, vec3 &b, vec3 &c, float &t, float &u, float &v) |
bool | RaySphere (vec3 &origin, vec3 &dir, vec3 &sphere, float radius, float &t) |
bool | RayPlane (vec3 &origin, vec3 &dir, vec3 &normal, float d, vec3 &point) |
bool | RayBoxSlab (vec3 &origin, vec3 &dir, vec3 &min, vec3 &max, float &distance) |
void | quadratic_bezier_curve (vec3 &a, vec3 &b, vec3 &c, float time, vec3 &out) |
void | cubic_bezier_curve (vec3 &a, vec3 &b, vec3 &c, vec3 &d, float time, vec3 &out) |
void | bicubic_bezier_surface (vec3 *control, float time_x, float time_y, vec3 &out) |
void | quadratic_bezier_surface (vec3 *control, float time_x, float time_y, vec3 &out) |
void | tessellate_quadratic_bezier_surface (vec3 *control, vertex_t *&vertex, int *&index, int &num_vertex, int &num_index, float level) |
int | debugf (const char *format,...) |
char * | get_file (char *filename, int *size) |
int | write_file (char *filename, const char *bytes, int size) |
int | processFile (JZFile *zip, userdata_t *user) |
int | recordCallback (JZFile *zip, int idx, JZFileHeader *header, char *filename, void *user_data) |
int | listCallback (JZFile *zip, int idx, JZFileHeader *header, char *filename, void *filelist) |
int | get_zipfile (char *zipfile, char *file, unsigned char **data, int *size) |
int | list_zipfile (char *zipfile, char *filelist) |
void | newlinelist (char *filename, char **list, unsigned int &num, char **file) |
int | load_texture_pk3 (Graphics &gfx, char *file_name, char **pk3_list, int num_pk3, bool clamp, bool bgr, int anisotropic) |
int | load_texture (Graphics &gfx, char *file_name, bool clamp, bool bgr, int anisotropic) |
void | calc_hash (char *filename, char *hash) |
byte * | tga_24to32 (int width, int height, byte *pBits, bool bgr) |
void | navdata_to_graph (ref_t *&ref, graph_node_t *&node, vector< Entity * > &entity_list, int start) |
void | print_graph (graph_node_t *node, int num_node) |
void | print_path (int *path, int path_length, graph_node_t *node) |
float | rand_float (float fMin, float fAdd) |
unsigned int | crc32_byte (unsigned int r) |
void | crc32 (const void *data, unsigned int n_bytes, unsigned int *crc) |
int | spiral (float distance, vec3 &scale, float step, vec3 *point) |
int | gen_spiral (Graphics &gfx, unsigned int &ibo, unsigned int &vbo) |
int | lightning (float distance, vec3 &scale, float step, vec3 *point) |
int | gen_lightning (Graphics &gfx, unsigned int &ibo, unsigned int &vbo) |
int | trim (char *data, int length) |
void | delta_compress (char *output, char *input, char *delta, int size) |
void | delta_uncompress (char *output, char *input, char *delta, int size) |
void | runlength_encode (uint8_t *output, rletable_t *table, int *table_size, uint8_t *input, unsigned int *size) |
void | runlength_decode (uint8_t *output, rletable_t *table, uint8_t *input, unsigned int *size) |
float | GetLuminance (vec3 &v) |
vec3 | ColorToVector (const pixel_t &color) |
pixel_t | VectorToColor (vec3 &v) |
void | gen_normalmap (float scale, const pixel_t *pixel, pixel_t *pixelout, int width, int height) |
void | write_bitmap (char *filename, int width, int height, int *data) |
void | ping_time_start (int sequence) |
double | ping_time_end (int sequence) |
float | clamp (float value, float min, float max) |
int | clamp (int value, int min, int max) |
void | get_cpu_info (struct cpuinfo *info) |
void | show_hw_info () |
void | pid_controller (const vec3 &target, const float timestep, const vec3 &pos, vec3 &thrust, const float kd) |
void | init_pid (pid_state_t *pid) |
void | update_pid (pid_state_t *pid, const vec3 &target, const vec3 &position, vec3 &output) |
void | bezier_curve (float t, vec3 &p, const vec3 &p0, const vec3 &p1, const vec3 &p2, const vec3 &p3) |
void | polyline (vec3 *point, int num_point, float t, vec3 &p) |
float | random_float () |
int | auto_complete (const char *a, const char *b) |
int | getFarthestInDir (const vec3 *shape, const vec3 &v, const int num_vert) |
void | support (const vec3 *shape1, const vec3 *shape2, const vec3 &v, vec3 &point, const int num_vert_one, const int num_vert_two) |
void | pick_line (const vec3 &v, const vec3 *shape1, const vec3 *shape2, vec3 &a, vec3 &b, const int num_vert_one, const int num_vert_two) |
void | pick_triangle (vec3 &a, vec3 &b, vec3 &c, int &flag, const vec3 *shape1, const vec3 *shape2, const int iteration_allowed, const int num_vert_one, const int num_vert_two) |
void | pick_tetrahedron (vec3 &a, vec3 &b, vec3 &c, int &flag, const vec3 *shape1, const vec3 *shape2, const int iteration_allowed, const int num_vert_one, const int num_vert_two) |
int | gjk (const vec3 *shape1, const vec3 *shape2, const int iterations, const int num_vert_one, const int num_vert_two) |
void | GetInterval (const vec3 *object, const vec3 &axis, float &minv, float &maxv) |
bool | TestIntersection (const vec3 *object_a, const vec3 *object_b, const vec3 *normal_a, const vec3 *normal_b, const vec3 *edge_a, const vec3 *edge_b) |
int | separating_axis_theorem (const vec3 *box_a, const vec3 *box_b) |
void | CreateSphere (int sides, float radius, vertex_t *&vertex, unsigned int *&index, unsigned int &num_vertex, unsigned int &num_index, bool invert, vec3 &offset) |
void | ClipVelocity (vec3 &in, vec3 &normal) |
void | make_skybox (Graphics &gfx, unsigned int num_vertex, unsigned int &num_index, int &skybox_vertex, int &skybox_index, bool sphere) |
void | WriteObj (char *filename, vertex_t *vertex_array, unsigned int num_vertex, unsigned int *index_array, unsigned int num_index) |
Variables | |
char | dmesg [DMESG_SIZE][1024] |
int | dmesg_index |
ping_t | hist [64] |
int | hist_index = 0 |
static unsigned int | seed = 0x13371337 |
#define DMESG_SIZE 2048 |
#define STB_IMAGE_IMPLEMENTATION |
int auto_complete | ( | const char * | a, |
const char * | b | ||
) |
void bezier_curve | ( | float | t, |
vec3 & | p, | ||
const vec3 & | p0, | ||
const vec3 & | p1, | ||
const vec3 & | p2, | ||
const vec3 & | p3 | ||
) |
void calc_hash | ( | char * | filename, |
char * | hash | ||
) |
float clamp | ( | float | value, |
float | min, | ||
float | max | ||
) |
int clamp | ( | int | value, |
int | min, | ||
int | max | ||
) |
void crc32 | ( | const void * | data, |
unsigned int | n_bytes, | ||
unsigned int * | crc | ||
) |
unsigned int crc32_byte | ( | unsigned int | r | ) |
void CreateSphere | ( | int | sides, |
float | radius, | ||
vertex_t *& | vertex, | ||
unsigned int *& | index, | ||
unsigned int & | num_vertex, | ||
unsigned int & | num_index, | ||
bool | invert, | ||
vec3 & | offset | ||
) |
int debugf | ( | const char * | format, |
... | |||
) |
void delta_compress | ( | char * | output, |
char * | input, | ||
char * | delta, | ||
int | size | ||
) |
void delta_uncompress | ( | char * | output, |
char * | input, | ||
char * | delta, | ||
int | size | ||
) |
int gen_lightning | ( | Graphics & | gfx, |
unsigned int & | ibo, | ||
unsigned int & | vbo | ||
) |
void gen_normalmap | ( | float | scale, |
const pixel_t * | pixel, | ||
pixel_t * | pixelout, | ||
int | width, | ||
int | height | ||
) |
int gen_spiral | ( | Graphics & | gfx, |
unsigned int & | ibo, | ||
unsigned int & | vbo | ||
) |
void get_cpu_info | ( | struct cpuinfo * | info | ) |
char* get_file | ( | char * | filename, |
int * | size | ||
) |
int get_zipfile | ( | char * | zipfile, |
char * | file, | ||
unsigned char ** | data, | ||
int * | size | ||
) |
float GetLuminance | ( | vec3 & | v | ) |
int gjk | ( | const vec3 * | shape1, |
const vec3 * | shape2, | ||
const int | iterations, | ||
const int | num_vert_one, | ||
const int | num_vert_two | ||
) |
void init_pid | ( | pid_state_t * | pid | ) |
int list_zipfile | ( | char * | zipfile, |
char * | filelist | ||
) |
int listCallback | ( | JZFile * | zip, |
int | idx, | ||
JZFileHeader * | header, | ||
char * | filename, | ||
void * | filelist | ||
) |
int load_texture | ( | Graphics & | gfx, |
char * | file_name, | ||
bool | clamp, | ||
bool | bgr, | ||
int | anisotropic | ||
) |
int load_texture_pk3 | ( | Graphics & | gfx, |
char * | file_name, | ||
char ** | pk3_list, | ||
int | num_pk3, | ||
bool | clamp, | ||
bool | bgr, | ||
int | anisotropic | ||
) |
void make_skybox | ( | Graphics & | gfx, |
unsigned int | num_vertex, | ||
unsigned int & | num_index, | ||
int & | skybox_vertex, | ||
int & | skybox_index, | ||
bool | sphere | ||
) |
void md5sum | ( | char * | data, |
int | size, | ||
char * | hash | ||
) |
void navdata_to_graph | ( | ref_t *& | ref, |
graph_node_t *& | node, | ||
vector< Entity * > & | entity_list, | ||
int | start | ||
) |
void newlinelist | ( | char * | filename, |
char ** | list, | ||
unsigned int & | num, | ||
char ** | file | ||
) |
float newtonSqrt | ( | float | x | ) |
void pick_line | ( | const vec3 & | v, |
const vec3 * | shape1, | ||
const vec3 * | shape2, | ||
vec3 & | a, | ||
vec3 & | b, | ||
const int | num_vert_one, | ||
const int | num_vert_two | ||
) |
void pick_tetrahedron | ( | vec3 & | a, |
vec3 & | b, | ||
vec3 & | c, | ||
int & | flag, | ||
const vec3 * | shape1, | ||
const vec3 * | shape2, | ||
const int | iteration_allowed, | ||
const int | num_vert_one, | ||
const int | num_vert_two | ||
) |
void pick_triangle | ( | vec3 & | a, |
vec3 & | b, | ||
vec3 & | c, | ||
int & | flag, | ||
const vec3 * | shape1, | ||
const vec3 * | shape2, | ||
const int | iteration_allowed, | ||
const int | num_vert_one, | ||
const int | num_vert_two | ||
) |
void pid_controller | ( | const vec3 & | target, |
const float | timestep, | ||
const vec3 & | pos, | ||
vec3 & | thrust, | ||
const float | kd | ||
) |
double ping_time_end | ( | int | sequence | ) |
void ping_time_start | ( | int | sequence | ) |
void print_graph | ( | graph_node_t * | node, |
int | num_node | ||
) |
void print_path | ( | int * | path, |
int | path_length, | ||
graph_node_t * | node | ||
) |
int processFile | ( | JZFile * | zip, |
userdata_t * | user | ||
) |
float rand_float | ( | float | fMin, |
float | fAdd | ||
) |
float random_float | ( | ) |
bool RayTriangleMT | ( | vec3 & | origin, |
vec3 & | dir, | ||
vec3 & | a, | ||
vec3 & | b, | ||
vec3 & | c, | ||
float & | t, | ||
float & | u, | ||
float & | v | ||
) |
int recordCallback | ( | JZFile * | zip, |
int | idx, | ||
JZFileHeader * | header, | ||
char * | filename, | ||
void * | user_data | ||
) |
void runlength_decode | ( | uint8_t * | output, |
rletable_t * | table, | ||
uint8_t * | input, | ||
unsigned int * | size | ||
) |
void runlength_encode | ( | uint8_t * | output, |
rletable_t * | table, | ||
int * | table_size, | ||
uint8_t * | input, | ||
unsigned int * | size | ||
) |
void show_hw_info | ( | ) |
void support | ( | const vec3 * | shape1, |
const vec3 * | shape2, | ||
const vec3 & | v, | ||
vec3 & | point, | ||
const int | num_vert_one, | ||
const int | num_vert_two | ||
) |
void tessellate_quadratic_bezier_surface | ( | vec3 * | control, |
vertex_t *& | vertex, | ||
int *& | index, | ||
int & | num_vertex, | ||
int & | num_index, | ||
float | level | ||
) |
bool TestIntersection | ( | const vec3 * | object_a, |
const vec3 * | object_b, | ||
const vec3 * | normal_a, | ||
const vec3 * | normal_b, | ||
const vec3 * | edge_a, | ||
const vec3 * | edge_b | ||
) |
int trim | ( | char * | data, |
int | length | ||
) |
void update_pid | ( | pid_state_t * | pid, |
const vec3 & | target, | ||
const vec3 & | position, | ||
vec3 & | output | ||
) |
void write_bitmap | ( | char * | filename, |
int | width, | ||
int | height, | ||
int * | data | ||
) |
int write_file | ( | char * | filename, |
const char * | bytes, | ||
int | size | ||
) |
void WriteObj | ( | char * | filename, |
vertex_t * | vertex_array, | ||
unsigned int | num_vertex, | ||
unsigned int * | index_array, | ||
unsigned int | num_index | ||
) |
char dmesg[DMESG_SIZE][1024] |
int dmesg_index |
ping_t hist[64] |
int hist_index = 0 |
|
static |