Skip to content

Commit

Permalink
Make it actually 3-dimensional
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasie1 committed Jan 5, 2017
1 parent b27f649 commit db83884
Show file tree
Hide file tree
Showing 75 changed files with 292 additions and 2,688 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -12,6 +12,7 @@ It is a fork of [glowy2d](https://github.com/Rasie1/glowy2d/) engine previously
- cpptoml
- OpenGL, GLEW, glfw3
- zlib, libpng
- tinyobjloader

## How to build

Expand Down
10 changes: 5 additions & 5 deletions include/graphics/Camera.h
Expand Up @@ -10,10 +10,10 @@ class Camera
Camera();

//Returns Projection and View product matrix
const mat2& getMatrix();
const mat3& getMatrix();

void setPosition(const glm::vec2& position);
void addPosition(const glm::vec2& offset);
void setPosition(const glm::vec3& position);
void addPosition(const glm::vec3& offset);

void addZoom(const float offset);
void setDefaultZoom();
Expand All @@ -23,10 +23,10 @@ class Camera
void enableTransform();

private:
mat2 matrix;
mat3 matrix;

bool noTransform;
mat2 noTransformMatrix;
mat3 noTransformMatrix;
};

}
88 changes: 0 additions & 88 deletions include/graphics/Layer.h

This file was deleted.

18 changes: 0 additions & 18 deletions include/graphics/LineLayer.h

This file was deleted.

24 changes: 0 additions & 24 deletions include/graphics/Material.h

This file was deleted.

64 changes: 0 additions & 64 deletions include/graphics/Sprite.h

This file was deleted.

3 changes: 1 addition & 2 deletions include/math/vertex.h
Expand Up @@ -7,8 +7,7 @@ namespace glowy3d
struct vertex
{
//Data
vec2 position;
float zOrder;
vec3 position;
vec2 texture;

vertex() {}
Expand Down
4 changes: 2 additions & 2 deletions res/shaders/Texture.fsh
Expand Up @@ -3,5 +3,5 @@ uniform sampler2D mytexture;

void main(void)
{
gl_FragColor = texture2D(mytexture, f_texcoord);
}
gl_FragColor = texture2D(mytexture, f_texcoord);
}
26 changes: 0 additions & 26 deletions src/base/System.cpp
Expand Up @@ -3,8 +3,6 @@
#include "base/Config.h"
#include "base/Scheduler.h"
#include "graphics/Camera.h"
#include "graphics/Sprite.h"
#include "graphics/Layer.h"
#include "graphics/FramerateCounter.h"
#include "platforms/Renderer.h"
#include "platforms/ShaderProgram.h"
Expand All @@ -28,7 +26,6 @@ Renderer * System::renderer;
Camera * System::camera;
Scheduler * System::scheduler;
FramerateCounter * System::framerateCounter;
IndexBuffer * System::indexBuffer;
unsigned short System::layersNum;
double System::currentTime;
double System::lastTime;
Expand All @@ -52,26 +49,6 @@ bool System::init()
scheduler->add(framerateCounter, 1.0);

deltaTime = 0;
layersNum = 0;

const uint maxSpritesPerLayer = 800 * 800;
const uint iboSize = maxSpritesPerLayer * 6;
uint * iboList = new uint[iboSize];

for (int iVertex = 0, i = 0; i < iboSize; iVertex += 4, i += 6)
{
iboList[i] = iVertex;
iboList[i + 1] = iVertex + 1;
iboList[i + 2] = iVertex + 2;
iboList[i + 3] = iVertex + 3;
iboList[i + 4] = iVertex + 2;
iboList[i + 5] = iVertex + 1;
}

indexBuffer = new IndexBuffer(iboList, iboSize * sizeof(uint));
indexBuffer->bind();

delete[] iboList;

Input::setUpDefaultControls();

Expand All @@ -96,7 +73,6 @@ double System::getTime()
void System::frameStart()
{
Input::process();
renderer->setMatrix(mat2(1.f, 0.f, 0.f, 1.f), camera->getMatrix());
renderer->frameStart();

//Timing stuff
Expand All @@ -118,10 +94,8 @@ void System::frameEnded()
void System::exit()
{
Input::deinit();
delete indexBuffer;
delete framerateCounter;
delete scheduler;
delete camera;
delete renderer;
delete window;
std::exit(EXIT_SUCCESS);
Expand Down

0 comments on commit db83884

Please sign in to comment.