Compare commits

..

1 Commits

  1. 28
      Makefile
  2. 2
      examples/Makefile
  3. 5
      include/GLDebug.h
  4. 1
      include/asset.h
  5. 1
      include/camera.h
  6. 1
      include/shader.h
  7. 12
      include/tangerine.h
  8. 1
      include/types.h
  9. 1
      src/asset.cpp
  10. 1
      src/camera.cpp
  11. 1
      src/entity.cpp
  12. 6
      src/shader.cpp
  13. 3
      src/tangerine.cpp

28
Makefile

@ -1,24 +1,20 @@
SHELL := /bin/sh
CXX := g++
# NOTE: have to set -O or -O1 here to get warnings for uninitialized variables
CXXFLAGS := -std=c++11 -g -ggdb3 -Wall -O -Wall -Wuninitialized \
SHELL = /bin/sh
CXX = g++
CXXFLAGS = -std=c++11 -g -ggdb3 -Wall \
-Iinclude \
-I/usr/include/SDL2 \
-Iext/stb_libs \
-Iext/tinygltf
EXAMPLEDIR := examples
OBJDIR := build
SRCDIR := src
LIBNAME := libTangerine.a
# NOTE: optional library settings
CXXFLAGS += -DTANGERINE_GL_DEBUG_QUIET
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
OBJECTS := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SOURCES))
NDBG_SOURCES := $(wildcard $(SRCDIR)/*.cc)
NDBG_OBJS := $(patsubst $(SRCDIR)/%.cc, $(OBJDIR)/%.o, $(NDBG_SOURCES))
EXAMPLEDIR = examples
OBJDIR = build
SRCDIR = src
LIBNAME = libTangerine.a
SOURCES = $(wildcard $(SRCDIR)/*.cpp)
OBJECTS = $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SOURCES))
NDBG_SOURCES = $(wildcard $(SRCDIR)/*.cc)
NDBG_OBJS = $(patsubst $(SRCDIR)/%.cc, $(OBJDIR)/%.o, $(NDBG_SOURCES))
all: mkdirs $(LIBNAME)

2
examples/Makefile

@ -34,7 +34,7 @@ BINDIR = bin
#.PHONY: clean
all: mkdirs
$(CXX) $(CXXFLAGS) main.cpp -o $(BINDIR)/testing $(LIB) $(LDFLAGS)
$(CXX) $(CXXFLAGS) main.cpp -o $(BINDIR)/testing $(LDFLAGS) $(LIB)
mkdirs:
@mkdir -p $(BINDIR) $(OBJDIR)

5
include/GLDebug.h

@ -92,11 +92,6 @@ openglDebugCallback(GLenum source,
if (id == 131185)
return;
#ifdef TANGERINE_GL_DEBUG_QUIET
if (type != GL_DEBUG_TYPE_ERROR)
return;
#endif
std::cout << "message id: " << id << ", "
<< ((type == GL_DEBUG_TYPE_ERROR) ? "Error" : "Debug")
<< (type == GL_DEBUG_TYPE_ERROR ? "** GL Error **" : "")

1
include/asset.h

@ -2,7 +2,6 @@
#pragma once
#include <GL/glew.h>
#define GLM_FORCE_XYZW_ONLY
#include <glm/glm.hpp>
#include "types.h"

1
include/camera.h

@ -1,7 +1,6 @@
#pragma once
#define GLM_FORCE_XYZW_ONLY
#include <glm/glm.hpp>
#include "types.h"

1
include/shader.h

@ -3,7 +3,6 @@
#include <SDL2/SDL.h>
#include <GL/glew.h>
#define GLM_FORCE_XYZW_ONLY
#include <glm/glm.hpp>
#include "asset.h"

12
include/tangerine.h

@ -75,17 +75,11 @@
#include <SDL2/SDL.h>
// NOTE: optional compile-time defines:
// TANGERINE_GL_DEBUG_QUIET disable extra debug messages from openGL
#include "asset.h"
#include "camera.h"
#include "entity.h"
#include "dumbLog.h"
#include "GLDebug.h"
#include "input.h"
#include "shader.h"
#include "types.h"
#include "util.h"
@ -99,6 +93,9 @@ struct SDLHandles
u32 SDL_flags;
};
// TODO: node/tree structure for entities
struct Node;
struct RenderGroup
{
ShaderProgram* shader;
@ -108,10 +105,7 @@ struct RenderGroup
char* name;
};
// TODO: node/tree structure for entities
#if 0
struct Node;
struct Scene
{
MemoryArena* rg_arena;

1
include/types.h

@ -2,7 +2,6 @@
#pragma once
#include <cstdint>
#define GLM_FORCE_XYZW_ONLY
#include <glm/glm.hpp>

1
src/asset.cpp

@ -2,7 +2,6 @@
#include <cassert>
#include <cstring>
#define GLM_FORCE_XYZW_ONLY
#include <glm/ext/matrix_transform.hpp>
#include "tiny_gltf.h"

1
src/camera.cpp

@ -2,7 +2,6 @@
#include <cassert>
#include <GL/glew.h>
#define GLM_FORCE_XYZW_ONLY
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

1
src/entity.cpp

@ -1,5 +1,4 @@
#define GLM_FORCE_XYZW_ONLY
#include <glm/gtc/matrix_transform.hpp>
#include "dumbLog.h"

6
src/shader.cpp

@ -6,12 +6,12 @@
#include <cstring>
#include <fstream>
#define GLM_FORCE_XYZW_ONLY
#include <glm/gtc/matrix_transform.hpp>
#include "asset.h"
#include "dumbLog.h"
#include "dummy_shader.h"
#define GL_DEBUG_IMPLEMENTATION
#include "GLDebug.h"
#include "shader.h"
#include "util.h"
@ -135,7 +135,7 @@ getFreeShader(GLContext* gl_ctx)
ShaderProgram*
getShaderByHash(GLContext* gl_ctx, u64 hash)
{
for (u32 i = 0; i < gl_ctx->num_shaders; i++) {
for (u32 i; i < gl_ctx->num_shaders; i++) {
if (gl_ctx->shaders[i].hash == hash)
return &gl_ctx->shaders[i];
}
@ -303,7 +303,7 @@ initGLMesh(MemoryArena* arena,
GLMesh glm = {0};
glm.num_indices = m.num_indices;
glm.num_vertex_attrib_buffers = num_mappings;
glm.vertex_attrib_buffers = ARENA_ALLOC(arena, GLBuffer, num_mappings);
glm .vertex_attrib_buffers = ARENA_ALLOC(arena, GLBuffer, num_mappings);
glm.element_buf = ARENA_ALLOC(arena, GLBuffer, 1);
glm.node_xform = ARENA_ALLOC(arena, mat4, 1);
*glm.node_xform = mat4(1);

3
src/tangerine.cpp

@ -1,14 +1,11 @@
#include <cassert>
#define GLM_FORCE_XYZW_ONLY
#include <glm/gtc/matrix_transform.hpp>
#include "tangerine.h"
#define UTIL_IMPLEMENTATION
#include "util.h"
#define GL_DEBUG_IMPLEMENTATION
#include "GLDebug.h"
// forward declarations

Loading…
Cancel
Save