naev 0.11.5
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_SQRT
 

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.
 
void object_free (Object *object)
 Frees memory reserved for the object.
 
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

Macro Definition Documentation

◆ DELIM

#define DELIM   " \t\n"

Definition at line 28 of file object.c.

◆ NAEV_ORTHO_DIST

#define NAEV_ORTHO_DIST   9.*M_SQRT

Distance from camera to origin in the Blender script

Definition at line 30 of file object.c.

◆ NAEV_ORTHO_SCALE

#define NAEV_ORTHO_SCALE   10.

The cam.ortho_scale defined in the Blender script

Definition at line 29 of file object.c.

Function Documentation

◆ materials_readFromFile()

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

Definition at line 108 of file object.c.

◆ mesh_create()

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

Definition at line 62 of file object.c.

◆ object_free()

void object_free ( Object * object)

Frees memory reserved for the object.

Definition at line 354 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 221 of file object.c.

◆ object_renderMesh()

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

Definition at line 386 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 435 of file object.c.

◆ readGLfloat()

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

Definition at line 80 of file object.c.

◆ readGLmaterial()

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

Definition at line 96 of file object.c.

Variable Documentation

◆ emptyTextureRefs

unsigned int emptyTextureRefs = 0
static

Definition at line 60 of file object.c.

◆ oneTexture

glTexture* oneTexture = NULL
static

Definition at line 59 of file object.c.

◆ zeroTexture

glTexture* zeroTexture = NULL
static

Definition at line 58 of file object.c.