maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroGLU OBJ Parser
Collaboration diagram for RetroGLU OBJ Parser:

Topics

 RetroGLU OBJ Parser States
 

Data Structures

struct  RETROGLU_PARSER
 As retroglu_parse_obj_c() parses OBJ data, it populates this struct with object information. More...
 

Macros

#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.
 

Typedefs

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_parse_init (struct RETROGLU_PARSER *parser, struct RETROGLU_OBJ *obj, retroglu_mtl_cb load_mtl, void *load_mtl_data)
 Initialize a RETROGLU_PARSER.
 
MERROR_RETVAL retroglu_parse_obj_c (struct RETROGLU_PARSER *parser, unsigned char c)
 Parse OBJ data into a parser, one character at a time.
 

Detailed Description

Macro Definition Documentation

◆ RETROGLU_OBJ_TOKENS

#define RETROGLU_OBJ_TOKENS ( f)
Value:
f( "v", retroglu_token_vertice ) \
f( "vn", retroglu_token_vnormal ) \
f( "f", retroglu_token_face ) \
f( "usemtl", retroglu_token_usemtl ) \
f( "newmtl", retroglu_token_newmtl ) \
f( "mtllib", retroglu_token_mtllib ) \
f( "Kd", retroglu_token_kd ) \
f( "Ka", retroglu_token_ka ) \
f( "Ks", retroglu_token_ks ) \
f( "Ke", retroglu_token_ks ) \
f( "Ns", retroglu_token_ns )

Table of OBJ file tokens understood by the parser.

◆ retroglu_parser_state

#define retroglu_parser_state ( parser,
new_state )
Value:
debug_printf( \
RETROGLU_TRACE_LVL, "changing parser to state: %d", new_state ); \
(parser)->state = new_state;

Change the parser state.

Parameters
Pointerto the RETROGLU_PARSER to modify.
new_stateRetroGLU OBJ Parser States to set the parser to.

Function Documentation

◆ retroglu_parse_init()

void retroglu_parse_init ( struct RETROGLU_PARSER * parser,
struct RETROGLU_OBJ * obj,
retroglu_mtl_cb load_mtl,
void * load_mtl_data )
related

Initialize a RETROGLU_PARSER.

Warning
This should be run before retroglu_parse_obj_c() is called on the parser!

◆ retroglu_parse_obj_c()

MERROR_RETVAL retroglu_parse_obj_c ( struct RETROGLU_PARSER * parser,
unsigned char c )
related

Parse OBJ data into a parser, one character at a time.

Generally, this should loop over a character array loaded from an OBJ file.