-
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.
Merge pull request #17 from stacompsoc/frontend/opengl-rewrite
OpenGL Frontend optimized drawing shapes
- Loading branch information
Showing
11 changed files
with
271 additions
and
179 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 |
---|---|---|
|
@@ -4,4 +4,5 @@ planetarium | |
*.jpg | ||
*.png | ||
*.log | ||
*.trace | ||
textures/sam.tga |
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
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
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
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 |
---|---|---|
@@ -1,22 +1,26 @@ | ||
#pragma once | ||
|
||
#include "Shape.hpp" | ||
#include "Triangle.hpp" | ||
|
||
template <int N> | ||
class Ring : public Shape { | ||
protected: | ||
const int DIM = 60; | ||
void AddTriangle( | ||
const glm::vec3 &a, | ||
const glm::vec3 &b, | ||
const glm::vec3 &c, | ||
size_t index, | ||
bool is_textured = false | ||
); | ||
GLuint vao = 0; | ||
GLuint vert_vbo = 0; | ||
GLuint tex_vbo = 0; | ||
GLfloat | ||
*vertices = NULL, | ||
*txcoords = NULL; | ||
static const size_t DIM; | ||
static const size_t SIZE; | ||
void SetTexcoords(int index); | ||
void SetVertices(const glm::vec3 &a, const glm::vec3 &b, const glm::vec3 &c, size_t index); | ||
public: | ||
Ring(); | ||
~Ring(); | ||
void Init(); | ||
using Shape::Draw; | ||
using Shape::Clear; | ||
void InitBuffers(); | ||
void Draw(); | ||
void Clear(); | ||
}; |
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 |
---|---|---|
@@ -1,20 +1,8 @@ | ||
#include "Shape.hpp" | ||
#include "Log.hpp" | ||
|
||
Shape::Shape(): | ||
triangles(0) | ||
Shape::Shape() | ||
{} | ||
|
||
Shape::~Shape() | ||
{} | ||
|
||
void Shape::Draw() { | ||
for(auto &t : triangles) | ||
t.Draw(); | ||
} | ||
|
||
void Shape::Clear() { | ||
for(auto &t : triangles) | ||
t.Clear(); | ||
triangles.clear(); | ||
} |
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 |
---|---|---|
@@ -1,21 +1,10 @@ | ||
#pragma once | ||
|
||
#include "Triangle.hpp" | ||
|
||
class Shape { | ||
protected: | ||
std::vector <Triangle> triangles; | ||
virtual void AddTriangle( | ||
const glm::vec3 &a, | ||
const glm::vec3 &b, | ||
const glm::vec3 &c, | ||
size_t index, | ||
bool is_textured = false | ||
) = 0; | ||
public: | ||
Shape(); | ||
virtual ~Shape(); | ||
virtual void Init() = 0; | ||
virtual void Draw(); | ||
virtual void Clear(); | ||
virtual void Draw() = 0; | ||
virtual void Clear() = 0; | ||
}; |
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
Oops, something went wrong.