maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
retroglu.h File Reference

Library of tools for working with RetroFlat and OpenGL. More...

Go to the source code of this file.

Data Structures

struct  RETROGLU_VERTEX
 
struct  RETROGLU_VTEXTURE
 
struct  RETROGLU_MATERIAL
 
struct  RETROGLU_FACE
 
struct  RETROGLU_OBJ
 
struct  RETROGLU_SPRITE_PARMS
 If draw lists are disabled, this struct holds a list of params for retroglu_set_sprite_clip() so that the sprite can be drawn without a list. More...
 
struct  RETROGLU_SPRITE
 
struct  RETROGLU_TILE
 
struct  RETROGLU_PROJ_ARGS
 
struct  RETROGLU_PARSER
 As retroglu_parse_obj_c() parses OBJ data, it populates this struct with object information. More...
 

Macros

#define MAUG_CONST   const
 
#define RETROGLU_PARSER_ERROR   -1
 
#define RETROGLU_PARSER_TOKEN_SZ_MAX   32
 
#define RETROGLU_TRACE_LVL   0
 
#define RETROGLU_SPRITE_TEX_FRAMES_SZ   10
 
#define glShininessf(side, light, f)
 
#define RETROGLU_PARSER_STATE_NONE   0
 
#define RETROGLU_PARSER_STATE_VERTEX_X   1
 
#define RETROGLU_PARSER_STATE_VERTEX_Y   2
 
#define RETROGLU_PARSER_STATE_VERTEX_Z   3
 
#define RETROGLU_PARSER_STATE_COMMENT   4
 
#define RETROGLU_PARSER_STATE_FACE_TOKEN   5
 
#define RETROGLU_PARSER_STATE_FACE_VERTEX   6
 
#define RETROGLU_PARSER_STATE_FACE_TEXTURE   7
 
#define RETROGLU_PARSER_STATE_FACE_NORMAL   8
 
#define RETROGLU_PARSER_STATE_FACE_MATERIAL   9
 
#define RETROGLU_PARSER_STATE_MATERIAL_NAME   10
 
#define RETROGLU_PARSER_STATE_MATERIAL_AMB   11
 
#define RETROGLU_PARSER_STATE_MATERIAL_DIF   12
 
#define RETROGLU_PARSER_STATE_MATERIAL_SPEC   13
 
#define RETROGLU_PARSER_STATE_MATERIAL_LIB   14
 
#define RETROGLU_PARSER_STATE_MTL_KD_R   15
 
#define RETROGLU_PARSER_STATE_MTL_KD_G   16
 
#define RETROGLU_PARSER_STATE_MTL_KD_B   17
 
#define RETROGLU_PARSER_STATE_VNORMAL_X   18
 
#define RETROGLU_PARSER_STATE_VNORMAL_Y   19
 
#define RETROGLU_PARSER_STATE_VNORMAL_Z   20
 
#define RETROGLU_PARSER_STATE_VTEXTURE_X   21
 
#define RETROGLU_PARSER_STATE_VTEXTURE_Y   22
 
#define RETROGLU_PARSER_STATE_VTEXTURE_Z   23
 
#define RETROGLU_PARSER_STATE_MTL_KA_R   24
 
#define RETROGLU_PARSER_STATE_MTL_KA_G   25
 
#define RETROGLU_PARSER_STATE_MTL_KA_B   26
 
#define RETROGLU_PARSER_STATE_MTL_KS_R   27
 
#define RETROGLU_PARSER_STATE_MTL_KS_G   28
 
#define RETROGLU_PARSER_STATE_MTL_KS_B   29
 
#define RETROGLU_PARSER_STATE_MTL_KE_R   30
 
#define RETROGLU_PARSER_STATE_MTL_KE_G   31
 
#define RETROGLU_PARSER_STATE_MTL_KE_B   32
 
#define RETROGLU_PARSER_STATE_MTL_NS   33
 
#define RETROGLU_FACE_VERTICES_SZ_MAX   3
 
#define RETROGLU_MATERIAL_NAME_SZ_MAX   32
 
#define RETROGLU_MATERIAL_LIB_SZ_MAX   32
 
#define RETROGLU_VERTICES_SZ_MAX   1024
 
#define RETROGLU_FACES_SZ_MAX   1024
 
#define RETROGLU_MATERIALS_SZ_MAX   1024
 
#define RETROGLU_SPRITE_X   0
 
#define RETROGLU_SPRITE_Y   1
 
#define RETROGLU_SPRITE_LIST_SZ_MAX   10
 
#define RETROGLU_PROJ_ORTHO   0
 
#define RETROGLU_PROJ_FRUSTUM   1
 
#define retroglu_enable_lightning()
 
#define retroglu_disable_lightning()
 
#define retroglu_push_overlay(x, y, x_f, y_f, aspect_f)
 Push current projection modelview and prepare useful parameters for drawing a textured overlay.
 
#define retroglu_whf(w, h, w_f, h_f, aspect_f)
 Convert width/height in pixels to proportional float values for OpenGL.
 
#define retroglu_pop_overlay()
 Restore projection modelview previously pushed using retroglu_push().
 
#define retroglu_tex_px_x_to_f(px, sprite)
 
#define retroglu_tex_px_y_to_f(px, sprite)
 
#define retroglu_scr_px_x_to_f(px)
 
#define retroglu_scr_px_y_to_f(py)
 
#define retroglu_set_sprite_tex(sprite, texture_id, bmp_w, bmp_h)
 
#define retroglu_set_sprite_color(sprite, color_in)
 
#define retroglu_parser_state(parser, new_state)
 Change the parser state.
 
#define RETROGLU_OBJ_TOKENS(f)
 Table of OBJ file tokens understood by the parser.
 
#define RETROFLAT_COLOR_TABLE_GL(idx, name_l, name_u, r, g, b, cgac, cgad)
 

Typedefs

typedef float RETROGLU_COLOR[4]
 
typedef int(* retroglu_mtl_cb) (const char *filename, struct RETROGLU_PARSER *parser, void *data)
 Callback to execute when its associate in RETROGLU_OBJ_TOKENS is found in an OBJ file.
 
typedef int(* retroglu_token_cb) (struct RETROGLU_PARSER *parser)
 

Functions

void retroglu_init_scene (uint8_t flags)
 
void retroglu_init_projection (struct RETROGLU_PROJ_ARGS *args)
 
MERROR_RETVAL retroglu_parse_obj_file (const char *filename, struct RETROGLU_PARSER *parser, struct RETROGLU_OBJ *obj)
 
void retroglu_draw_poly (struct RETROGLU_OBJ *obj)
 
void retroglu_set_tile_clip (struct RETROGLU_TILE *tile, uint32_t px, uint32_t py, uint32_t pw, uint32_t ph, uint8_t flags)
 
void retroglu_set_sprite_clip (struct RETROGLU_SPRITE *sprite, uint32_t front_px, uint32_t front_py, uint32_t back_px, uint32_t back_py, uint32_t pw, uint32_t ph, uint8_t flags)
 
void retroglu_init_sprite_vertices (struct RETROGLU_SPRITE *sprite)
 Setup the sprite vertices for the poly the sprite will be drawn on. This should be called once when the sprite is initialized, but calling it again later shouldn't hurt.
 
void retroglu_init_sprite_vertices_scale (struct RETROGLU_SPRITE *sprite, float scale)
 
void retroglu_set_sprite_pos (struct RETROGLU_SPRITE *sprite, uint32_t px, uint32_t py)
 
void retroglu_tsrot_sprite (struct RETROGLU_SPRITE *sprite)
 
void retroglu_draw_sprite (struct RETROGLU_SPRITE *sprite)
 Draw the given sprite. This function never uses a list, and can therefore be used to create a draw list.
 
void retroglu_prerender_sprite (struct RETROGLU_SPRITE *sprite, int list_idx, uint32_t front_px, uint32_t front_py, uint32_t back_px, uint32_t back_py, uint32_t pw, uint32_t ph, uint8_t flags)
 If lists are enabled, prerender the sprite to a list using the given params to retroglu_set_sprite_clip().
 
void retroglu_jitrender_sprite (struct RETROGLU_SPRITE *sprite, int list_idx)
 If lists are enabled, render the sprite list at list_idx. Otherwise, draw the sprite using retroglu_draw_sprite().
 
void retroglu_free_sprite (struct RETROGLU_SPRITE *sprite)
 
MERROR_RETVAL retroglu_init_glyph_tex ()
 
void retroglu_destroy_glyph_tex ()
 
void retroglu_string (float x, float y, float z, const RETROGLU_COLOR color, const char *str, size_t str_sz, const char *font_str, uint8_t flags)
 
MERROR_RETVAL retroglu_check_errors (const char *desc)
 
int retroglu_draw_release (struct RETROFLAT_BITMAP *bmp)
 
MERROR_RETVAL retroglu_blit_bitmap (struct RETROFLAT_BITMAP *target, struct RETROFLAT_BITMAP *src, size_t s_x, size_t s_y, size_t d_x, size_t d_y, size_t w, size_t h, int16_t instance)
 

Detailed Description

Library of tools for working with RetroFlat and OpenGL.