aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-05-18 19:56:58 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-05-18 19:56:58 +0100
commit41d0c68c9fadea552002613f0f62433c3858d0a2 (patch)
tree32fe3c8615c0226e38ae3faea52412a7ada8d0b8
parent5c4c0ca30911b5129b32142b430bb6be1baf0e47 (diff)
downloadYAGE-41d0c68c9fadea552002613f0f62433c3858d0a2.tar.gz
YAGE-41d0c68c9fadea552002613f0f62433c3858d0a2.zip
Deleting and cleaning up repository
-rw-r--r--yage/experimental/camera3d.h15
-rw-r--r--yage/experimental/loader.cpp59
-rw-r--r--yage/experimental/loader.h19
-rw-r--r--yage/render/batch.h44
-rw-r--r--yage/render/drawable.h25
-rw-r--r--yage/render/ellipse.h12
-rw-r--r--yage/render/rectangle.cpp46
-rw-r--r--yage/render/rectangle.h31
-rw-r--r--yage/render/shape.h25
-rw-r--r--yage/render/sprite.cpp95
-rw-r--r--yage/render/sprite.h49
-rw-r--r--yage/render/spritebatch.h1
-rw-r--r--yage/yage.h16
13 files changed, 6 insertions, 431 deletions
diff --git a/yage/experimental/camera3d.h b/yage/experimental/camera3d.h
deleted file mode 100644
index 6a712a17..00000000
--- a/yage/experimental/camera3d.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef YAGE_EXPERIMENTAL_CAMERA3D_H
-#define YAGE_EXPERIMENTAL_CAMERA3D_H
-
-#include <glm/glm.hpp>
-
-class Camera3D
-{
-public:
- Camera3D() = default;
-
-private:
- glm::mat4
-};
-
-#endif
diff --git a/yage/experimental/loader.cpp b/yage/experimental/loader.cpp
deleted file mode 100644
index 1c815d41..00000000
--- a/yage/experimental/loader.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "loader.h"
-
-#include "../core/exception.h"
-
-#include <algorithm>
-#include <fstream>
-#include <regex>
-#include <sstream>
-
-namespace yage
-{
-
-const std::vector<std::regex> ele_regs({"^(\\d+)$", "^(\\d+)\\/(\\d+)$",
- "^(\\d+)\\/\\/(\\d+)$",
- "^(\\d+)\\/(\\d+)\\/(\\d+)$"});
-
-void load_obj(std::string filename, std::vector<glm::vec4> &vertices,
- std::vector<glm::vec3> &normals, std::vector<GLushort> &elements)
-{
- std::ifstream in(filename, std::ios::in);
-
- if (!in.is_open()) {
- throw FileLoadException("Could not load obj file '" + filename + "'");
- }
-
- std::string line;
-
- while (getline(in, line)) {
- if (line.substr(0, 2) == "v ") {
- std::istringstream s(line.substr(2));
- glm::vec4 v;
- s >> v.x >> v.y >> v.z;
- v.w = 1.f;
- vertices.push_back(v);
- } else if (line.substr(0, 2) == "f ") {
- std::istringstream s(line.substr(2));
- GLushort a, b, c;
- s >> a >> b >> c;
- a--, b--, c--;
- elements.push_back(a);
- elements.push_back(b);
- elements.push_back(c);
- } else if (line.substr(0, 2) == "vn ") {
- std::for_each(ele_regs.begin(), ele_regs.end(), [](std::regex re) {
-
- });
- std::istringstream s(line.substr(2));
- glm::vec3 v;
- s >> v.x >> v.y >> v.z;
- normals.push_back(v);
- } else {
- // do nothing otherwise
- }
- }
-
- in.close();
-}
-
-} // namespace yage
diff --git a/yage/experimental/loader.h b/yage/experimental/loader.h
deleted file mode 100644
index 9f076bb1..00000000
--- a/yage/experimental/loader.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef YAGE_EXPERIMENTAL_LOADER_H
-#define YAGE_EXPERIMENTAL_LOADER_H
-
-#include <string>
-#include <vector>
-
-#include <glad/glad.h>
-#include <glm/glm.hpp>
-
-namespace yage
-{
-
-extern void load_obj(std::string filename, std::vector<glm::vec4> &vertices,
- std::vector<glm::vec3> &normals,
- std::vector<GLushort> &elements);
-
-} // namespace yage
-
-#endif
diff --git a/yage/render/batch.h b/yage/render/batch.h
deleted file mode 100644
index 45bf4b31..00000000
--- a/yage/render/batch.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: batch.h
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#ifndef YAGE_CORE_BATCH_H
-#define YAGE_CORE_BATCH_H
-
-namespace yage
-{
-
-/** The Batch class will be the base class for all the different batching
- * processes that might use different shaders and attributes. This is necessary
- * because when we use a different shader, we have to bind a specific number
- * of attributes, and we might not always want to have a texture, colours and
- * coordinates, for example, when only using simple shapes.
- *
- * Batching
- * ========
- * The purpose of batching is to combine all sprites that use the same textures
- * so that the textures does not have to be switched out on the gpu very often.
- * This produces a much more efficient rendering process. An implementation of
- * this can be seen in the SpriteBatch class, as it sorts and renders the
- * objects you give it.
- *
- * The reason this base class exists, is because it makes it easier to also
- * render objects that may not need a texture, or may require multiple textures
- * or different attributes.
- */
-class Batch
-{
-public:
- virtual bool init();
- virtual void begin();
- virtual void end();
- virtual void render();
-};
-
-} // namespace yage
-
-#endif
diff --git a/yage/render/drawable.h b/yage/render/drawable.h
deleted file mode 100644
index 774aa451..00000000
--- a/yage/render/drawable.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: drawable.h
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#ifndef YAGE_CORE_DRAWABLE_H
-#define YAGE_CORE_DRAWABLE_H
-
-#include "spritebatch.h"
-
-namespace yage
-{
-
-class Drawable
-{
-public:
- virtual void draw(SpriteBatch &sp) = 0;
-};
-
-} // namespace yage
-
-#endif
diff --git a/yage/render/ellipse.h b/yage/render/ellipse.h
deleted file mode 100644
index 2a7552ba..00000000
--- a/yage/render/ellipse.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: ellipse.h
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#ifndef YAGE_RENDER_ELLIPSE_H
-#define YAGE_RENDER_ELLIPSE_H
-
-#endif
diff --git a/yage/render/rectangle.cpp b/yage/render/rectangle.cpp
deleted file mode 100644
index f48f79db..00000000
--- a/yage/render/rectangle.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: rectangle.cpp
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#include "rectangle.h"
-
-#include "../data/vertex.h"
-
-#include <glad/glad.h>
-
-#include <cstddef>
-
-namespace yage
-{
-
-Rectangle::Rectangle(glm::vec4 position) : position_(position) {}
-
-void Rectangle::render() const
-{
- // create vertex array
- GLuint rect_vao, rect_vbo;
-
- // bind vertex array object
- glGenVertexArrays(1, &rect_vao);
- glBindVertexArray(rect_vao);
-
- // bind vertex buffer object
- glGenBuffers(1, &rect_vbo);
- glBindBuffer(GL_ARRAY_BUFFER, rect_vbo);
-
- // enable vertex attribute arrays
- glEnableVertexAttribArray(0);
- glEnableVertexAttribArray(1);
-
- // set the vertex attribute pointers
- glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex),
- (void *)offsetof(Vertex, position));
-
- glBindVertexArray(0);
-}
-
-} // namepsace yage
diff --git a/yage/render/rectangle.h b/yage/render/rectangle.h
deleted file mode 100644
index bf87731b..00000000
--- a/yage/render/rectangle.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: rectangle.h
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#ifndef YAGE_RENDER_RECTANGLE_H
-#define YAGE_RENDER_RECTANGLE_H
-
-#include "shape.h"
-
-#include <glm/glm.hpp>
-
-namespace yage
-{
-
-class Rectangle : public Shape
-{
-public:
- Rectangle(glm::vec4 position);
- virtual void render() const;
-
-private:
- glm::vec4 position_;
-};
-
-} // namespace yage
-
-#endif
diff --git a/yage/render/shape.h b/yage/render/shape.h
deleted file mode 100644
index 0ac72ba8..00000000
--- a/yage/render/shape.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: shape.h
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#ifndef YAGE_RENDER_SHAPE_H
-#define YAGE_RENDER_SHAPE_H
-
-#include "drawable.h"
-
-namespace yage
-{
-
-class Shape : public Drawable
-{
-public:
- virtual void render() const;
-};
-
-} // namespace yage
-
-#endif
diff --git a/yage/render/sprite.cpp b/yage/render/sprite.cpp
deleted file mode 100644
index 98853c94..00000000
--- a/yage/render/sprite.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: sprite.cpp
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#include "sprite.h"
-#include "../core/resourcemanager.h"
-#include "../data/vertex.h"
-
-#include <cstddef>
-
-namespace yage
-{
-
-Sprite::~Sprite()
-{
- if (vbo_id_ != 0) {
- glDeleteBuffers(1, &vbo_id_);
- }
-}
-
-void Sprite::init(float x, float y, float width, float height,
- const std::string &texture_path)
-{
- x_ = x;
- y_ = y;
- width_ = width;
- height_ = height;
- texture_ = ResourceManager::getTexture(texture_path);
-
- if (vbo_id_ == 0) {
- glGenBuffers(1, &vbo_id_);
- }
-
- Vertex vertex_data[6];
-
- vertex_data[0].setPosition(x + width, y + height);
- vertex_data[0].setUv(1.f, 1.f);
-
- vertex_data[1].setPosition(x, y + height);
- vertex_data[1].setUv(0.f, 1.f);
-
- vertex_data[2].setPosition(x, y);
- vertex_data[2].setUv(0.f, 0.f);
-
- vertex_data[3].setPosition(x, y);
- vertex_data[3].setUv(0.f, 0.f);
-
- vertex_data[4].setPosition(x + width, y + height);
- vertex_data[4].setUv(1.f, 1.f);
-
- vertex_data[5].setPosition(x + width, y);
- vertex_data[5].setUv(1.f, 0.f);
-
- for (auto &i : vertex_data) {
- i.setColour(255, 0, 255, 255);
- }
-
- vertex_data[1].setColour(0, 255, 255, 255);
- vertex_data[4].setColour(255, 0, 0, 255);
-
- glBindBuffer(GL_ARRAY_BUFFER, vbo_id_);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data,
- GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
-
-void Sprite::draw()
-{
- glBindTexture(GL_TEXTURE_2D, texture_.id);
- glBindBuffer(GL_ARRAY_BUFFER, vbo_id_);
-
- glEnableVertexAttribArray(0);
- glEnableVertexAttribArray(1);
- glEnableVertexAttribArray(2);
-
- glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex),
- (void *)offsetof(Vertex, position));
- glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex),
- (void *)offsetof(Vertex, colour));
- glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex),
- (void *)offsetof(Vertex, uv));
- glDrawArrays(GL_TRIANGLES, 0, 6);
-
- glDisableVertexAttribArray(2);
- glDisableVertexAttribArray(1);
- glDisableVertexAttribArray(0);
-
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
-
-} // namespace yage
diff --git a/yage/render/sprite.h b/yage/render/sprite.h
deleted file mode 100644
index 51821be5..00000000
--- a/yage/render/sprite.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: sprite.h
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#ifndef SPRITE_H
-#define SPRITE_H
-
-#include "../data/texture.h"
-
-#include <glad/glad.h>
-
-#include <string>
-
-namespace yage
-{
-
-/** @deprecated Use SpriteBatch instead
- */
-class Sprite
-{
-private:
- float x_;
- float y_;
- float width_;
- float height_;
- GLuint vbo_id_ = 0;
- Texture texture_;
-
-public:
- Sprite() = default;
- Sprite(const Sprite &) = delete;
- Sprite(Sprite &&) = delete;
- ~Sprite();
-
- Sprite &operator=(const Sprite &) = delete;
- Sprite &operator=(Sprite &&) = delete;
-
- void init(float x, float y, float width, float height,
- const std::string &texture_path);
- void draw();
-};
-
-} // namespace yage
-
-#endif
diff --git a/yage/render/spritebatch.h b/yage/render/spritebatch.h
index fb9f6337..022a51c8 100644
--- a/yage/render/spritebatch.h
+++ b/yage/render/spritebatch.h
@@ -10,7 +10,6 @@
#define YAGE_SPRITE_BATCH_H
#include "../data/vertex.h"
-#include "batch.h"
#include <glad/glad.h>
#include <glm/glm.hpp>
diff --git a/yage/yage.h b/yage/yage.h
index 465ecfde..1a9db400 100644
--- a/yage/yage.h
+++ b/yage/yage.h
@@ -6,8 +6,7 @@
* ----------------------------------------------------------------------------
*/
-#ifndef YAGE_YAGE_H
-#define YAGE_YAGE_H
+#pragma once
/**
* Core includes
@@ -32,17 +31,16 @@
#include "math/matrix.h"
/**
- * Physics implementation however, Box2D
+ * Physics implementation however
*/
-#include "physics/body.h"
-#include "physics/particlebody.h"
-#include "physics/rectanglecollider.h"
-#include "physics/rigidbody.h"
+// #include "physics/body.h"
+// #include "physics/particlebody.h"
+// #include "physics/rectanglecollider.h"
+// #include "physics/rigidbody.h"
/**
* Rendering implementations for spritebatching and default shapes.
*/
-#include "render/drawable.h"
#include "render/shader.h"
#include "render/spritebatch.h"
@@ -51,5 +49,3 @@
* it more flexible and efficient.
*/
#include "entity/engine.h"
-
-#endif