graphics

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1f002760dfacbf27a20b56a4535416289864e87a
parent 73c37a4cb0a9314ab198c773a0e370d67fc418b5
Author: Brian Swetland <swetland@frotz.net>
Date:   Sun,  1 Sep 2013 23:56:09 -0700

more tidying up

- move basic types and macros into types.h
- adjust core.h and util.h
- provide delete_wavefront_obj()

Diffstat:
Mcommon/core.h | 2+-
Mcommon/loadobj.cc | 7++++++-
Acommon/types.h | 19+++++++++++++++++++
Mcommon/util.h | 9++-------
4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/common/core.h b/common/core.h @@ -31,7 +31,7 @@ #include <math.h> -#define RGBA(r,g,b,a) ((r&0xFF)|((g&0xFF)<<8)|((b&0xFF)<<16)|((a&0xFF)<<24)) +#include "types.h" enum { SRC_INT8, diff --git a/common/loadobj.cc b/common/loadobj.cc @@ -178,5 +178,10 @@ struct model *load_wavefront_obj(const char *fn) { m = obj_to_model(o); delete o; return m; -} +} +void delete_wavefront_obj(struct model *m) { + free(m->vdata); + free(m->idx); + free(m); +} diff --git a/common/types.h b/common/types.h @@ -0,0 +1,19 @@ +#ifndef _TYPES_H_ +#define _TYPES_H_ + +/* basic datatypes */ +typedef unsigned int u32; +typedef int s32; +typedef unsigned short u16; +typedef short s16; +typedef unsigned char u8; +typedef signed char s8; + +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) + +#define RGBA(r,g,b,a) ((r&0xFF)|((g&0xFF)<<8)|((b&0xFF)<<16)|((a&0xFF)<<24)) + +#endif + diff --git a/common/util.h b/common/util.h @@ -16,13 +16,7 @@ #ifndef _UTIL_H_ #define _UTIL_H_ -/* basic datatypes */ -typedef unsigned int u32; -typedef int s32; -typedef unsigned short u16; -typedef short s16; -typedef unsigned char u8; -typedef signed char s8; +#include "types.h" /* file io helpers */ #define OPT_PNG_INVERTY 0x0001 @@ -49,6 +43,7 @@ struct model { }; struct model *load_wavefront_obj(const char *fn); +void delete_wavefront_obj(struct model *m); /* simplex noise */ float snoise(float x);