Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Sep 22, 2015
1 parent 4b57b9d commit f3dde50
Show file tree
Hide file tree
Showing 37 changed files with 2,074 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Makefile
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
31 changes: 31 additions & 0 deletions include/glisy/camera/perspective.h
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
68 changes: 68 additions & 0 deletions include/glisy/context.h
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
36 changes: 36 additions & 0 deletions include/glisy/events.h
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
11 changes: 11 additions & 0 deletions include/glisy/gl.h
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
56 changes: 56 additions & 0 deletions include/glisy/glisy.h
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 added include/glisy/math/euler.h
Empty file.
Loading

0 comments on commit f3dde50

Please sign in to comment.