Restructure files
This commit is contained in:
parent
573b7f3f85
commit
d90d6f4bd1
@ -15,8 +15,8 @@ CFLAGS += -O0 -g3
|
||||
endif
|
||||
|
||||
TARGET = drow-engine
|
||||
HEADERS = err.h parser.h types.h print.h filereader.h gl_draw.h vec_math.h
|
||||
OBJECTS = main.o parser.o print.o filereader.o gl_draw.o vec_math.c
|
||||
HEADERS = err.h parser.h common.h print.h filereader.h gl_draw.h vector.h half_edge.h
|
||||
OBJECTS = main.o parser.o print.o filereader.o gl_draw.o vector.o
|
||||
INCS = -I.
|
||||
|
||||
CFLAGS += $(shell $(PKG_CONFIG) --cflags gl glu glib-2.0)
|
||||
|
39
src/common.h
Normal file
39
src/common.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2011-2014 hasufell
|
||||
*
|
||||
* This file is part of a hasufell project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation version 2 of the License only.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common.h
|
||||
* Header for common types, macros and constants
|
||||
* shared amongst the codebase. Error macros go in err.h.
|
||||
* @brief common.h common types, macros, constants
|
||||
*/
|
||||
|
||||
#ifndef _DROW_ENGINE_TYPES_H
|
||||
#define _DROW_ENGINE_TYPES_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* Standard file buffer
|
||||
*/
|
||||
#define STD_FILE_BUF 4096
|
||||
|
||||
|
||||
#endif /* _DROW_ENGINE_TYPES_H */
|
@ -19,7 +19,7 @@
|
||||
#include "err.h"
|
||||
#include "filereader.h"
|
||||
#include "parser.h"
|
||||
#include "types.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define _DROW_ENGINE_FILEREADER_H
|
||||
|
||||
|
||||
#include "types.h"
|
||||
#include "half_edge.h"
|
||||
|
||||
|
||||
HE_obj *read_obj_file(char const * const filename);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "err.h"
|
||||
#include "filereader.h"
|
||||
#include "types.h"
|
||||
#include "half_edge.h"
|
||||
|
||||
#include <GL/glut.h>
|
||||
#include <GL/gl.h>
|
||||
@ -363,6 +363,17 @@ void init(char const * const filename)
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
/* vector *array = malloc(sizeof(vector) * obj->vc); */
|
||||
/* vector vec; */
|
||||
|
||||
/* vec.x = obj->vertices->x; */
|
||||
/* vec.y = obj->vertices->y; */
|
||||
/* vec.z = obj->vertices->z; */
|
||||
|
||||
/* for (uint32_t i = 0; i < obj->vc; i++) { */
|
||||
|
||||
/* } */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,8 +20,6 @@
|
||||
#define _DROW_ENGINE_DRAW_H
|
||||
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <GL/glut.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
@ -16,34 +16,18 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DROW_ENGINE_TYPES_H
|
||||
#define _DROW_ENGINE_TYPES_H
|
||||
#ifndef _DROW_ENGINE_HE_OPERATIONS_H
|
||||
#define _DROW_ENGINE_HE_OPERATIONS_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* Standard file buffer
|
||||
*/
|
||||
#define STD_FILE_BUF 4096
|
||||
|
||||
typedef uint32_t** FACE;
|
||||
|
||||
typedef struct vector vector;
|
||||
typedef struct HE_edge HE_edge;
|
||||
typedef struct HE_vert HE_vert;
|
||||
typedef struct HE_face HE_face;
|
||||
typedef struct HE_obj HE_obj;
|
||||
|
||||
/**
|
||||
* Represents a 3-dimensional vector.
|
||||
*/
|
||||
struct vector {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a half-edge.
|
||||
@ -125,4 +109,7 @@ struct HE_obj {
|
||||
};
|
||||
|
||||
|
||||
#endif /* _DROW_ENGINE_TYPES_H */
|
||||
HE_edge **get_all_emanating_edges(HE_vert *vertice);
|
||||
|
||||
|
||||
#endif /* _DROW_ENGINE_HE_OPERATIONS_H */
|
@ -17,8 +17,9 @@
|
||||
*/
|
||||
|
||||
#include "gl_draw.h"
|
||||
#include "half_edge.h"
|
||||
#include "print.h"
|
||||
#include "types.h"
|
||||
#include "vector.h"
|
||||
|
||||
#include <GL/glut.h>
|
||||
#include <GL/gl.h>
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "err.h"
|
||||
#include "filereader.h"
|
||||
#include "types.h"
|
||||
#include "parser.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
@ -19,10 +19,17 @@
|
||||
#ifndef _DROW_ENGINE_PARSER_H
|
||||
#define _DROW_ENGINE_PARSER_H
|
||||
|
||||
#include "half_edge.h"
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* Typedef for the plain faces
|
||||
* that are not yet converted to real HE_face.
|
||||
*/
|
||||
typedef uint32_t** FACE;
|
||||
|
||||
HE_obj *parse_obj(char const * const filename);
|
||||
|
||||
|
||||
|
@ -16,7 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "types.h"
|
||||
#include "half_edge.h"
|
||||
#include "parser.h"
|
||||
#include "vector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -20,7 +20,9 @@
|
||||
#define _DROW_ENGINE_PRINT_H
|
||||
|
||||
|
||||
#include "types.h"
|
||||
#include "half_edge.h"
|
||||
#include "parser.h"
|
||||
#include "vector.h"
|
||||
|
||||
|
||||
void print_edges(HE_obj *obj);
|
||||
|
@ -17,8 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "err.h"
|
||||
#include "types.h"
|
||||
#include "vec_math.h"
|
||||
#include "vector.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fenv.h>
|
@ -20,11 +20,22 @@
|
||||
#define _DROW_ENGINE_VEC_MATH_H
|
||||
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
typedef struct vector vector;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a 3-dimensional vector.
|
||||
*/
|
||||
struct vector {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
|
||||
bool vector_product(vector *a, vector *b, vector *c);
|
||||
bool normalize_vector(vector *a, vector *b);
|
||||
bool copy_vector(vector *a, vector *b);
|
Loading…
Reference in New Issue
Block a user