naev 0.10.4
Data Structures | Macros | Functions | Variables
object.c File Reference

Object Loader. http://www.paulbourke.net/dataformats/obj/. More...

#include "object.h"
#include "array.h"
#include "camera.h"
#include "gui.h"
#include "log.h"
#include "ndata.h"

Go to the source code of this file.

Data Structures

struct  Material
 
struct  Mesh
 
struct  Object
 
struct  Vertex
 Reference to a spob or jump point. More...
 

Macros

#define DELIM   " \t\n"
 
#define NAEV_ORTHO_SCALE   10.
 
#define NAEV_ORTHO_DIST   9.*M_SQRT2
 

Functions

static void mesh_create (Mesh **meshes, const char *name, Vertex *corners, int material)
 
static int readGLfloat (GLfloat *dest, int how_many, char **saveptr)
 
static int readGLmaterial (GLfloat col[3], char **saveptr)
 
static void materials_readFromFile (const char *filename, Material **materials)
 
Objectobject_loadFromFile (const char *filename)
 Loads object. More...
 
void object_free (Object *object)
 Frees memory reserved for the object. More...
 
static void object_renderMesh (const Object *object, int part, GLfloat alpha)
 
void object_renderSolidPart (const Object *object, const Solid *solid, const char *part_name, GLfloat alpha, double scale)
 

Variables

static glTexturezeroTexture = NULL
 
static glTextureoneTexture = NULL
 
static unsigned int emptyTextureRefs = 0
 

Detailed Description

Object Loader. http://www.paulbourke.net/dataformats/obj/.

Definition in file object.c.

Macro Definition Documentation

◆ DELIM

#define DELIM   " \t\n"

Definition at line 32 of file object.c.

◆ NAEV_ORTHO_DIST

#define NAEV_ORTHO_DIST   9.*M_SQRT2

Distance from camera to origin in the Blender script

Definition at line 34 of file object.c.

◆ NAEV_ORTHO_SCALE

#define NAEV_ORTHO_SCALE   10.

The cam.ortho_scale defined in the Blender script

Definition at line 33 of file object.c.

Function Documentation

◆ materials_readFromFile()

static void materials_readFromFile ( const char *  filename,
Material **  materials 
)
static

Definition at line 112 of file object.c.

◆ mesh_create()

static void mesh_create ( Mesh **  meshes,
const char *  name,
Vertex corners,
int  material 
)
static

Definition at line 66 of file object.c.

◆ object_free()

void object_free ( Object object)

Frees memory reserved for the object.

Definition at line 358 of file object.c.

◆ object_loadFromFile()

Object * object_loadFromFile ( const char *  filename)

Loads object.

Object file format is described here http://local.wasp.uwa.edu.au/~pbourke/dataformats/obj/

Parameters
filenamebase file name
Returns
and Object containing the 3d model

< vertex coordinates

< texture coordinates

< normal coordinates

< corners of the triangle faces

Definition at line 225 of file object.c.

◆ object_renderMesh()

static void object_renderMesh ( const Object object,
int  part,
GLfloat  alpha 
)
static

Definition at line 390 of file object.c.

◆ object_renderSolidPart()

void object_renderSolidPart ( const Object object,
const Solid solid,
const char *  part_name,
GLfloat  alpha,
double  scale 
)

Definition at line 439 of file object.c.

◆ readGLfloat()

static int readGLfloat ( GLfloat *  dest,
int  how_many,
char **  saveptr 
)
static

Definition at line 84 of file object.c.

◆ readGLmaterial()

static int readGLmaterial ( GLfloat  col[3],
char **  saveptr 
)
static

Definition at line 100 of file object.c.

Variable Documentation

◆ emptyTextureRefs

unsigned int emptyTextureRefs = 0
static

Definition at line 64 of file object.c.

◆ oneTexture

glTexture* oneTexture = NULL
static

Definition at line 63 of file object.c.

◆ zeroTexture

glTexture* zeroTexture = NULL
static

Definition at line 62 of file object.c.