-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
2,074 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## Source files | ||
SRC += $(wildcard src/*.c) | ||
SRC += $(wildcard src/math/*.c) | ||
|
||
## Source objects | ||
OBJS := $(SRC:.c=.o) | ||
|
||
## Compiler flags | ||
CFLAGS += -Iinclude | ||
CFLAGS += -Wall | ||
|
||
## Target static library | ||
TARGET_STATIC := libglisy.a | ||
|
||
## Builds everything | ||
.PHONY: all | ||
all: $(TARGET_STATIC) | ||
|
||
## Builds static library | ||
$(TARGET_STATIC): $(OBJS) | ||
$(AR) crus $@ $^ | ||
|
||
## Compiles object files | ||
.c.o: | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
## Cleans project directory | ||
.PHONY: clean | ||
clean: test/clean | ||
clean: | ||
$(RM) $(OBJS) | ||
$(RM) $(TARGET_STATIC) | ||
|
||
## Compiles and runs all test | ||
.PHONY: test | ||
test: | ||
@$(MAKE) -C $@ | ||
|
||
.PHONY: test/clean | ||
test/clean: | ||
$(MAKE) clean -C test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef GLISY_CAMERA_PERSPECTIVE_H | ||
#define GLISY_CAMERA_PERSPECTIVE_H | ||
|
||
typedef struct glisy_camera_perspective glisy_camera_perspective; | ||
struct glisy_camera_perspective { | ||
|
||
/** | ||
* Vertical camera field of view in degrees. | ||
*/ | ||
|
||
double fov; | ||
|
||
/** | ||
* Aspect ratio to determine horizontal field of view. | ||
*/ | ||
|
||
double aspect; | ||
|
||
/** | ||
* Distance from near clipping plane. | ||
*/ | ||
|
||
double near; | ||
|
||
/** | ||
* Distance from far clipping plane. | ||
*/ | ||
|
||
double far; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#ifndef GLISY_CONTEXT_H | ||
#define GLISY_CONTEXT_H | ||
|
||
#include <glisy/window.h> | ||
#include <glisy/events.h> | ||
#include <glisy/program.h> | ||
|
||
/** | ||
* glisy context structure. | ||
*/ | ||
|
||
typedef struct glisy_context glisy_context; | ||
struct glisy_context { | ||
|
||
/** | ||
* glisy program interface. | ||
*/ | ||
|
||
glisy_program program; | ||
|
||
/** | ||
* glisy window interface. | ||
*/ | ||
|
||
glisy_window window; | ||
|
||
/** | ||
* glisy event manager. | ||
*/ | ||
|
||
glisy_events events; | ||
|
||
/** | ||
* Optional program name. | ||
*/ | ||
|
||
const char *name; | ||
|
||
/** | ||
* User data. | ||
*/ | ||
|
||
void *data; | ||
}; | ||
|
||
/** | ||
* Initializes a glisy context. | ||
*/ | ||
|
||
void | ||
glisy_context_init (glisy_context *); | ||
|
||
/** | ||
* Sets user data pointer. | ||
*/ | ||
|
||
void | ||
glisy_context_use (glisy_context *, const void *); | ||
|
||
/** | ||
* Predicate to determine if context should update. | ||
* Returns 1 if true, otherwise 0. | ||
*/ | ||
|
||
int | ||
glisy_context_should_update (const glisy_context); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef GLISY_EVENTS_H | ||
#define GLISY_EVENTS_H | ||
#include <glisy/gl.h> | ||
|
||
/** | ||
* Event delegation handler. | ||
*/ | ||
|
||
typedef struct glisy_events glisy_events; | ||
struct glisy_events { | ||
|
||
/** | ||
* Event callbacks. | ||
*/ | ||
|
||
struct { | ||
|
||
/** | ||
* GLFW key press handler. | ||
*/ | ||
|
||
void (*key) (GLFWwindow *window, | ||
int key, | ||
int scancode, | ||
int action, | ||
int mods); | ||
|
||
/** | ||
* GLFW error handler. | ||
*/ | ||
|
||
void (*error) (int error, | ||
const char *message); | ||
} on; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef GLISY_GL_H | ||
#define GLISY_GL_H | ||
|
||
#ifdef __APPLE__ | ||
#include <GLUT/glut.h> | ||
#else | ||
#include <GL/glut.h> | ||
#endif | ||
|
||
#include <GLFW/glfw3.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef GLISY_H | ||
#define GLISY_H | ||
|
||
/** | ||
* math. | ||
*/ | ||
|
||
#include <glisy/math/vec2.h> | ||
#include <glisy/math/vec3.h> | ||
#include <glisy/math/vec4.h> | ||
#include <glisy/math/mat2.h> | ||
#include <glisy/math/mat3.h> | ||
#include <glisy/math/mat4.h> | ||
#include <glisy/math/quat.h> | ||
|
||
/** | ||
* core. | ||
*/ | ||
|
||
#include <glisy/gl.h> | ||
#include <glisy/events.h> | ||
#include <glisy/window.h> | ||
#include <glisy/program.h> | ||
#include <glisy/context.h> | ||
#include <glisy/renderer.h> | ||
|
||
/** | ||
* cameras. | ||
*/ | ||
|
||
#include <glisy/camera/perspective.h> | ||
|
||
/** | ||
* Initializes glisy. Returns 1 on success, | ||
* otherwise 0 on failure. | ||
*/ | ||
|
||
int | ||
glisy_init (void); | ||
|
||
/** | ||
* Terminate glisy. | ||
*/ | ||
|
||
void | ||
glisy_terminate (void); | ||
|
||
/** | ||
* Renders scene with camera. | ||
*/ | ||
|
||
void | ||
glisy_render (const glisy_renderer, | ||
const glisy_scene, | ||
const glisy_camera_perspective); | ||
#endif |
Empty file.
Oops, something went wrong.