Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Apr 4, 2016
1 parent ec277fe commit 67daa07
Show file tree
Hide file tree
Showing 47 changed files with 561 additions and 655 deletions.
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
PROJECT_NAME ?= glisy

## Source files
SRC += $(wildcard src/*.c)
SRC := $(wildcard src/*.c)

## Dependency source files
SRC += $(wildcard deps/*/*.c)
SRC += $(wildcard deps/glisy/*/*.c)
SRC += $(wildcard deps/rgba/*.c)
SRC += $(wildcard deps/sop/*.c)

## Source objects
OBJS := $(SRC:.c=.o)
Expand All @@ -31,6 +33,18 @@ $(TARGET_STATIC): $(OBJS)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@

## Installs library into system
.PHONY: install
install: $(TARGET_STATIC)
$(CP) -r include/* $(PREFIX)/include/
$(CP) $(TARGET_STATIC) $(PREFIX)/lib

## Uninstalls library from system
.PHONY: uninstall
uninstall:
$(RM) -r $(PREFIX)/include/$(PROJECT_NAME)
$(RM) $(PREFIX)/lib/$(TARGET_STATIC)

## Cleans project directory
.PHONY: clean
clean: test/clean
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions include/glisy/buffer.h → deps/glisy/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <stdio.h>
#include <glisy/gl.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* Glisy Buffer struct type.
*/
Expand Down Expand Up @@ -92,4 +96,7 @@ glisyBufferUpdate(GlisyBuffer *buffer, GLuint usage);
void
glisyBufferSource(GlisyBuffer *buffer, GLsizei size, GLvoid *data);

#ifdef __cplusplus
}
#endif
#endif
4 changes: 2 additions & 2 deletions src/color.c → deps/glisy/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ glisyColorInit(GlisyColor *color, const char *name, uint32_t value) {

const char *
glisyColorToName(const GlisyColor color) {
if (strlen(color.name)) return strdup(color.name);
if (strlen(color.string)) return strdup(color.string);
if (color.name && strlen(color.name)) return strdup(color.name);
if (color.string && strlen(color.string)) return strdup(color.string);
rgba_t rgba = (rgba_t) { color.r, color.g, color.b, color.a };
rgba_to_string(rgba, (char *) color.name, BUFSIZ);
rgba_to_string(rgba, (char *) color.string, BUFSIZ);
Expand Down
8 changes: 8 additions & 0 deletions include/glisy/color.h → deps/glisy/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct GlisyColor GlisyColor;
struct GlisyColor {
char *name;
Expand All @@ -19,4 +23,8 @@ glisyColorToString(const GlisyColor color);

const char *
glisyColorToName(const GlisyColor color);

#ifdef __cplusplus
}
#endif
#endif
10 changes: 9 additions & 1 deletion include/glisy/math/euler.h → deps/glisy/euler.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef GLISY_EULER_H
#define GLISY_EULER_H

#include "vec3.h"
#include <glisy/vec3.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* euler type
Expand All @@ -21,4 +25,8 @@ typedef vec3 euler;
*/

#define euler_clone(e) ((euler) {e.x, e.y, e.z})

#ifdef __cplusplus
}
#endif
#endif
1 change: 1 addition & 0 deletions src/geometry.c → deps/glisy/geometry.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <string.h>
#include <glisy/program.h>
#include <glisy/geometry.h>

Expand Down
8 changes: 8 additions & 0 deletions include/glisy/geometry.h → deps/glisy/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <glisy/buffer.h>
#include <glisy/program.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* Glisy Geometry struct type.
*/
Expand Down Expand Up @@ -134,4 +138,8 @@ glisyGeometryDraw(GlisyGeometry *geometry,
GLuint mode,
GLuint start,
GLuint stop);

#ifdef __cplusplus
}
#endif
#endif
File renamed without changes.
7 changes: 7 additions & 0 deletions include/glisy/math/mat2.h → deps/glisy/mat2.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef GLISY_MAT2_H
#define GLISY_MAT2_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* mat2 struct type.
*/
Expand Down Expand Up @@ -189,4 +193,7 @@ struct mat2 {
(strdup(str)); \
})

#ifdef __cplusplus
}
#endif
#endif
7 changes: 7 additions & 0 deletions include/glisy/math/mat3.h → deps/glisy/mat3.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef GLISY_MAT3_H
#define GLISY_MAT3_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* mat3 struct type.
*/
Expand Down Expand Up @@ -295,4 +299,7 @@ struct mat3 {
(strdup(str)); \
})

#ifdef __cplusplus
}
#endif
#endif
14 changes: 7 additions & 7 deletions include/glisy/math/mat4.h → deps/glisy/mat4.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef GLISY_MAT4_H
#define GLISY_MAT4_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* mat4 struct type.
*/
Expand All @@ -13,13 +17,6 @@ struct mat4 {
float m41; float m42; float m43; float m44;
};

/*struct mat4 {
float m11; float m21; float m31; float m41;
float m12; float m22; float m32; float m42;
float m13; float m23; float m33; float m43;
float m14; float m24; float m34; float m44;
};*/

/**
* mat4 initializers.
*/
Expand Down Expand Up @@ -579,4 +576,7 @@ struct mat4 {
(strdup(str)); \
})

#ifdef __cplusplus
}
#endif
#endif
7 changes: 3 additions & 4 deletions include/glisy/math.h → deps/glisy/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

#define glisy_radians(degrees) degrees * GLISY_PI_OVER_180

#include <glisy/math/quat.h>
#include <glisy/math/euler.h>
#include <glisy/math/vector.h>
#include <glisy/math/matrix.h>
#include <glisy/matrix.h>
#include <glisy/vector.h>
#include <glisy/euler.h>

#endif
9 changes: 9 additions & 0 deletions deps/glisy/matrix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef GLISY_MATRIX_H
#define GLISY_MATRIX_H

#include <glisy/mat2.h>
#include <glisy/mat3.h>
#include <glisy/mat4.h>
#include <glisy/quat.h>

#endif
10 changes: 10 additions & 0 deletions deps/glisy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "glisy",
"version": "0.0.1",
"repo": "glisy/gl",
"description": "#include headers for OpenGL without the suck",
"keywords": ["open", "gl", "header"],
"src": [
"include/glisy/gl.h"
]
}
File renamed without changes.
9 changes: 9 additions & 0 deletions include/glisy/program.h → deps/glisy/program.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <glisy/gl.h>
#include <glisy/shader.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* Glisy Program struct type.
*/
Expand Down Expand Up @@ -51,6 +55,7 @@ GLboolean
glisyProgramLink(GlisyProgram *program);

/**
* Bind program and use program. This function calls glUseProgram internally.
*/

GLboolean
Expand All @@ -67,4 +72,8 @@ glisyProgramBind(GlisyProgram *program);
GLboolean
glisyProgramDelete(GlisyProgram *program);

#ifdef __cplusplus
}
#endif

#endif
7 changes: 7 additions & 0 deletions include/glisy/math/quat.h → deps/glisy/quat.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef GLISY_QUAT_H
#define GLISY_QUAT_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* quat struct type.
*/
Expand All @@ -15,4 +19,7 @@ struct quat { float x; float y; float z; float w; };
#define quat_create() quat(0, 0, 0, 1)
#define quat(x, y, z, w) (quat) {x, y, z, w}

#ifdef __cplusplus
}
#endif
#endif
File renamed without changes.
8 changes: 8 additions & 0 deletions include/glisy/shader.h → deps/glisy/shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <stdio.h>
#include <glisy/gl.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* Glisy Shader structure type.
*/
Expand Down Expand Up @@ -38,4 +42,8 @@ struct GlisyShader {
GLboolean
glisyShaderInit(GlisyShader *shader, GLuint type, const char *source);

#ifdef __cplusplus
}
#endif

#endif
File renamed without changes.
7 changes: 7 additions & 0 deletions include/glisy/uniform.h → deps/glisy/uniform.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <glisy/gl.h>
#include <glisy/program.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
GLISY_UNIFORM_VECTOR = 1,
GLISY_UNIFORM_MATRIX,
Expand Down Expand Up @@ -36,4 +40,7 @@ glisyUniformBind(GlisyUniform *uniform, GlisyProgram *program);
void
glisyUniformSet(GlisyUniform *uniform, GLvoid *data, GLsizei size);

#ifdef __cplusplus
}
#endif
#endif
5 changes: 3 additions & 2 deletions src/vao.c → deps/glisy/vao.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glisy/gl.h>
#include <glisy/vao.h>
#include <glisy/buffer.h>
Expand Down Expand Up @@ -54,9 +55,9 @@ glisyVAOUpdate(GlisyVAO *vao, GlisyBuffer *elements) {
// bind elements if given
if (elements) {
glisyBufferBind(elements);
vao->useElements= GL_TRUE;
vao->useElements = GL_TRUE;
} else {
vao->useElements= GL_FALSE;
vao->useElements = GL_FALSE;
}

// bind vao attributes
Expand Down
8 changes: 7 additions & 1 deletion include/glisy/vao.h → deps/glisy/vao.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
#define GLISY_VAO_H

#include <glisy/gl.h>
#include <glisy/math.h>
#include <glisy/buffer.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef GLISY_MAX_VAO_ATTRIBS
#define GLISY_MAX_VAO_ATTRIBS 0xff
#endif
Expand Down Expand Up @@ -171,4 +174,7 @@ glisyVAORemove(GlisyVAO *vao, GLuint location);
void
glisyVAOAttributeBind(GlisyVAOAttribute *attribute);

#ifdef __cplusplus
}
#endif
#endif
11 changes: 9 additions & 2 deletions include/glisy/math/vec2.h → deps/glisy/vec2.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#ifndef GLISY_VEC2_H
#define GLISY_VEC2_H

#ifdef __cplusplus
extern "C" {
#endif

#include <time.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <glisy/math/vec3.h>
#include <glisy/math/mat2.h>
#include <glisy/vec3.h>
#include <glisy/mat2.h>

/**
* vec2 struct type.
Expand Down Expand Up @@ -228,4 +232,7 @@ struct vec2 { float x; float y; };
(strdup(str)); \
})

#ifdef __cplusplus
}
#endif
#endif
Loading

0 comments on commit 67daa07

Please sign in to comment.