render from json
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
glm
|
glm
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
curl
|
curl
|
||||||
|
|
||||||
|
stb
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace Archimedes {
|
|||||||
public:
|
public:
|
||||||
Body(RenderTarget rt, glm::mat4 t = glm::mat4(1.0f)) : Object(t), mesh(rt) {};
|
Body(RenderTarget rt, glm::mat4 t = glm::mat4(1.0f)) : Object(t), mesh(rt) {};
|
||||||
|
|
||||||
Body(VertexBuffer vb, IndexArray ia, VertexLayout vl, Shader s, glm::mat4 t = glm::mat4(1.0f))
|
Body(VertexBuffer vb, IndexArray ia, VertexLayout vl, Shader s, RenderMode rm = RenderMode::Triangles, glm::mat4 t = glm::mat4(1.0f))
|
||||||
: Object(t), mesh(vb, ia, vl, s) {}
|
: Object(t), mesh(vb, ia, vl, s, rm) {}
|
||||||
|
|
||||||
Body() : Object(glm::mat4(1.0f)) {}
|
Body() : Object(glm::mat4(1.0f)) {}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ namespace Archimedes {
|
|||||||
|
|
||||||
~Camera() {};
|
~Camera() {};
|
||||||
|
|
||||||
|
const glm::mat4& getPerspective() { return perspective; }
|
||||||
|
void setPerspective(const glm::mat4 m) { perspective = m; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
glm::mat4 perspective = glm::mat4(1.0f);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ namespace Archimedes {
|
|||||||
float& getScale() { return scale; }
|
float& getScale() { return scale; }
|
||||||
|
|
||||||
const glm::mat4& getTransform() { return worldTransform; }
|
const glm::mat4& getTransform() { return worldTransform; }
|
||||||
|
void setTransform(const glm::mat4 m) { worldTransform = m; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,16 @@
|
|||||||
|
|
||||||
namespace Archimedes {
|
namespace Archimedes {
|
||||||
|
|
||||||
|
enum class RenderMode {
|
||||||
|
Points,
|
||||||
|
Lines,
|
||||||
|
ConnectedLines,
|
||||||
|
ConnectedLinesLooped,
|
||||||
|
Triangles,
|
||||||
|
Quads,
|
||||||
|
Polygon
|
||||||
|
};
|
||||||
|
|
||||||
class LayoutElement {
|
class LayoutElement {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -154,19 +164,21 @@ namespace Archimedes {
|
|||||||
class RenderTarget {
|
class RenderTarget {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderTarget(const std::vector<float> data, const std::vector<unsigned int> indices, VertexLayout layout, const std::string& vs, const std::string& fs)
|
RenderTarget(const std::vector<float> data, const std::vector<unsigned int> indices, VertexLayout layout, const std::string& vs, const std::string& fs, RenderMode rm = RenderMode::Triangles)
|
||||||
: vertexBuffer(data),
|
: vertexBuffer(data),
|
||||||
indexArray(indices),
|
indexArray(indices),
|
||||||
layout(layout),
|
layout(layout),
|
||||||
shader(vs, fs, Shader::LoadType::FromFileSource) {
|
shader(vs, fs, Shader::LoadType::FromFileSource),
|
||||||
|
renderMode(rm) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget(VertexBuffer vb, IndexArray ia, VertexLayout vl, Shader s)
|
RenderTarget(VertexBuffer vb, IndexArray ia, VertexLayout vl, Shader s, RenderMode rm = RenderMode::Triangles)
|
||||||
: vertexBuffer(vb),
|
: vertexBuffer(vb),
|
||||||
indexArray(ia),
|
indexArray(ia),
|
||||||
layout(vl),
|
layout(vl),
|
||||||
shader(s) {
|
shader(s),
|
||||||
|
renderMode(rm) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +186,9 @@ namespace Archimedes {
|
|||||||
|
|
||||||
~RenderTarget() {}
|
~RenderTarget() {}
|
||||||
|
|
||||||
|
void setActive(bool b) { active = b; }
|
||||||
|
const bool getActive() const { return active; }
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
|
|
||||||
VertexBuffer vertexBuffer;
|
VertexBuffer vertexBuffer;
|
||||||
@@ -186,6 +201,10 @@ namespace Archimedes {
|
|||||||
|
|
||||||
Shader shader;
|
Shader shader;
|
||||||
|
|
||||||
|
RenderMode renderMode;
|
||||||
|
|
||||||
|
bool active = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,6 @@ namespace Archimedes {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum class RenderMode {
|
|
||||||
Triangles,
|
|
||||||
Lines,
|
|
||||||
ConnectedLines,
|
|
||||||
ConnectedLinesLooped,
|
|
||||||
Points
|
|
||||||
};
|
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
@@ -35,7 +28,7 @@ namespace Archimedes {
|
|||||||
|
|
||||||
virtual Shader createShader(const std::string& vs, const std::string& fs, const Shader::LoadType& lt) = 0;
|
virtual Shader createShader(const std::string& vs, const std::string& fs, const Shader::LoadType& lt) = 0;
|
||||||
|
|
||||||
virtual void useShader(Shader& shader) = 0;
|
virtual void setupShader(Shader& shader) = 0;
|
||||||
|
|
||||||
virtual RenderTarget createRenderTarget(
|
virtual RenderTarget createRenderTarget(
|
||||||
VertexBuffer vb,
|
VertexBuffer vb,
|
||||||
@@ -55,8 +48,7 @@ namespace Archimedes {
|
|||||||
const glm::mat4 world = glm::mat4(1.0f),
|
const glm::mat4 world = glm::mat4(1.0f),
|
||||||
const glm::mat4 view = glm::mat4(1.0f),
|
const glm::mat4 view = glm::mat4(1.0f),
|
||||||
const glm::mat4 proj = glm::mat4(1.0f),
|
const glm::mat4 proj = glm::mat4(1.0f),
|
||||||
glm::vec4 color = { 1.0f, 0.0f, 1.0f, 1.0f },
|
const glm::vec4 color = { 1.0f, 0.0f, 1.0f, 1.0f }
|
||||||
RenderMode mode = RenderMode::Triangles
|
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
virtual Renderer* getRendererImpl() = 0;
|
virtual Renderer* getRendererImpl() = 0;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Archimedes {
|
|||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void useShader(Shader& shader) override {
|
void setupShader(Shader& shader) override {
|
||||||
|
|
||||||
std::string vss = shader.getVSource();
|
std::string vss = shader.getVSource();
|
||||||
std::string fss = shader.getFSource();
|
std::string fss = shader.getFSource();
|
||||||
@@ -145,30 +145,7 @@ namespace Archimedes {
|
|||||||
|
|
||||||
auto rt = RenderTarget(vb, ia, layout, s);
|
auto rt = RenderTarget(vb, ia, layout, s);
|
||||||
|
|
||||||
glGenVertexArrays(1, &rt.vertexArray.id);
|
setupRenderTarget(rt);
|
||||||
|
|
||||||
glGenBuffers(1, &rt.vertexBuffer.id);
|
|
||||||
|
|
||||||
glBindVertexArray(rt.vertexArray.id);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, rt.vertexBuffer.id);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, vb.getSize(), vb.getData(), GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
|
|
||||||
glGenBuffers(1, &rt.indexArray.id);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, rt.indexArray.id);
|
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, rt.indexArray.getCount() * sizeof(unsigned int), rt.indexArray.getIndicies(), GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
|
|
||||||
glUseProgram(s.id);
|
|
||||||
|
|
||||||
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
|
|
||||||
glEnableVertexAttribArray(0);
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
};
|
};
|
||||||
@@ -216,8 +193,7 @@ namespace Archimedes {
|
|||||||
const glm::mat4 world = glm::mat4(1.0f),
|
const glm::mat4 world = glm::mat4(1.0f),
|
||||||
const glm::mat4 view = glm::mat4(1.0f),
|
const glm::mat4 view = glm::mat4(1.0f),
|
||||||
const glm::mat4 proj = glm::mat4(1.0f),
|
const glm::mat4 proj = glm::mat4(1.0f),
|
||||||
glm::vec4 color = { 1.0f, 0.0f, 1.0f, 1.0f },
|
const glm::vec4 color = { 1.0f, 0.0f, 1.0f, 1.0f }
|
||||||
RenderMode mode = RenderMode::Triangles
|
|
||||||
) override {
|
) override {
|
||||||
|
|
||||||
glUseProgram(rt.shader.id);
|
glUseProgram(rt.shader.id);
|
||||||
@@ -236,7 +212,7 @@ namespace Archimedes {
|
|||||||
|
|
||||||
glBindVertexArray(rt.vertexArray.id);
|
glBindVertexArray(rt.vertexArray.id);
|
||||||
|
|
||||||
switch(mode) {
|
switch(rt.renderMode) {
|
||||||
case RenderMode::Triangles:
|
case RenderMode::Triangles:
|
||||||
glDrawElements(GL_TRIANGLES, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
glDrawElements(GL_TRIANGLES, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
||||||
break;
|
break;
|
||||||
@@ -249,6 +225,12 @@ namespace Archimedes {
|
|||||||
case RenderMode::ConnectedLinesLooped:
|
case RenderMode::ConnectedLinesLooped:
|
||||||
glDrawElements(GL_LINE_LOOP, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
glDrawElements(GL_LINE_LOOP, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
||||||
break;
|
break;
|
||||||
|
case RenderMode::Quads:
|
||||||
|
glDrawElements(GL_QUADS, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
||||||
|
break;
|
||||||
|
case RenderMode::Polygon:
|
||||||
|
glDrawElements(GL_POLYGON, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
||||||
|
break;
|
||||||
case RenderMode::Points:
|
case RenderMode::Points:
|
||||||
glDrawElements(GL_POINTS, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
glDrawElements(GL_POINTS, rt.indexArray.getCount(), GL_UNSIGNED_INT, nullptr);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,89 +1,135 @@
|
|||||||
|
|
||||||
#include "pch.hpp"
|
#include "pch.hpp"
|
||||||
|
|
||||||
#include "utils/Objects/Body.h"
|
#include "utils/Objects/Body.h"
|
||||||
|
|
||||||
|
#define STB_TRUETYPE_IMPLIMENTATION
|
||||||
|
#include <stb/stb_truetype.h>
|
||||||
|
|
||||||
|
#include <GL/glew.h>
|
||||||
|
|
||||||
namespace Archimedes {
|
namespace Archimedes {
|
||||||
|
|
||||||
Body readOBJ(std::string path, Shader shader) {
|
class Text {
|
||||||
|
|
||||||
std::ifstream file(path);
|
GLuint tex;
|
||||||
|
|
||||||
if(!file.is_open()) return Body();
|
std::vector<unsigned char> ttf;
|
||||||
|
stbtt_bakedchar cdata[96];
|
||||||
|
|
||||||
std::string s;
|
std::string path;
|
||||||
|
|
||||||
std::vector<float> verticies;
|
public:
|
||||||
std::vector<unsigned int> indicies;
|
|
||||||
|
|
||||||
unsigned int i = 0;
|
Text(std::string p) : path(p) {}
|
||||||
unsigned int j = 0;
|
~Text() {}
|
||||||
|
|
||||||
float point;
|
void textInit() {
|
||||||
unsigned int idx;
|
|
||||||
|
|
||||||
while(!file.eof()) {
|
|
||||||
getline(file, s, ' ');
|
|
||||||
|
|
||||||
//std::cout << "\nline start: " << s << std::endl;
|
|
||||||
|
|
||||||
if(s == "v") {
|
|
||||||
file >> point;
|
|
||||||
verticies.push_back(point);
|
|
||||||
//std::cout << "point1: " << point << std::endl;
|
|
||||||
|
|
||||||
file >> point;
|
|
||||||
verticies.push_back(point);
|
|
||||||
//std::cout << "point2: " << point << std::endl;
|
|
||||||
|
|
||||||
file >> point;
|
|
||||||
verticies.push_back(point);
|
|
||||||
//std::cout << "point3: " << point << std::endl;
|
|
||||||
|
|
||||||
//std::cout << "index: " << j << std::endl;
|
|
||||||
|
|
||||||
getline(file, s);
|
ttf.reserve(1<<20);
|
||||||
//file.ignore();
|
|
||||||
} else if(s == "f") {
|
unsigned char temp_bitmap[1024*1024];
|
||||||
|
|
||||||
file >> idx;
|
std::ifstream file(path, std::ios::binary);
|
||||||
indicies.push_back(--idx);
|
|
||||||
file.ignore(5, ' ');
|
|
||||||
|
|
||||||
file >> idx;
|
|
||||||
indicies.push_back(--idx);
|
|
||||||
file.ignore(5, ' ');
|
|
||||||
|
|
||||||
file >> idx;
|
if(!file.is_open()) {
|
||||||
indicies.push_back(--idx);
|
std::cout << "ttf won't open!\n";
|
||||||
getline(file, s);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
getline(file, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(!file.eof()) {
|
||||||
|
|
||||||
|
ttf.push_back(file.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
stbtt_BakeFontBitmap(ttf.data(),0, 64.0, temp_bitmap,1024,1024, 32,96, cdata);
|
||||||
|
glGenTextures(1, &tex);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 1024,1024,0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_bitmap);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
Body* genText(float x, float y, std::string text) {
|
||||||
|
// assume orthographic projection with units = screen pixels, origin at top left
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
|
|
||||||
return Body(
|
std::vector<float> v;
|
||||||
VertexBuffer(verticies),
|
std::vector<unsigned int> i;
|
||||||
IndexArray(indicies),
|
|
||||||
VertexLayout(),
|
for(unsigned int j = 0; j < text.length(); j++) {
|
||||||
shader
|
if (text[j] >= 32) {
|
||||||
);
|
stbtt_aligned_quad q;
|
||||||
}
|
stbtt_GetBakedQuad(cdata, 512,512, text[j]-32, &x,&y,&q,1);//1=opengl & d3d10+,0=d3d9
|
||||||
|
|
||||||
|
v.push_back(q.x0);
|
||||||
|
v.push_back(q.y0);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
v.push_back(q.s0);
|
||||||
|
v.push_back(q.t0);
|
||||||
|
|
||||||
|
i.push_back(j * 4);
|
||||||
|
|
||||||
|
|
||||||
|
v.push_back(q.x1);
|
||||||
|
v.push_back(q.y0);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
v.push_back(q.s1);
|
||||||
|
v.push_back(q.t0);
|
||||||
|
|
||||||
|
i.push_back(j * 4 + 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
v.push_back(q.x1);
|
||||||
|
v.push_back(q.y1);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
v.push_back(q.s1);
|
||||||
|
v.push_back(q.t1);
|
||||||
|
|
||||||
|
i.push_back(j * 4 + 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
v.push_back(q.x0);
|
||||||
|
v.push_back(q.y1);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
v.push_back(q.s0);
|
||||||
|
v.push_back(q.t1);
|
||||||
|
|
||||||
|
i.push_back(j * 4 + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Body(
|
||||||
|
VertexBuffer(v),
|
||||||
|
IndexArray(i),
|
||||||
|
VertexLayout(),
|
||||||
|
Shader()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
class JObject {
|
class JObject {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
JObject() {}
|
JObject() = default;
|
||||||
|
|
||||||
void load(std::string path) {
|
void load(std::string path) {
|
||||||
std::ifstream file(path);
|
std::ifstream file(path);
|
||||||
if (!file.is_open()) goodJSON = false;
|
if (!file.is_open()) goodJSON = false;
|
||||||
document = json::parse(file);
|
document = json::parse(file);
|
||||||
file.close();
|
file.close();
|
||||||
|
goodJSON = true;
|
||||||
templates = document["Templates"];
|
templates = document["Templates"];
|
||||||
objects = document["Objects"];
|
objects = document["Objects"];
|
||||||
setup = document["Set Up"];
|
setup = document["Set Up"];
|
||||||
@@ -94,19 +140,141 @@ namespace Archimedes {
|
|||||||
|
|
||||||
bool isValid() const { return goodJSON; }
|
bool isValid() const { return goodJSON; }
|
||||||
|
|
||||||
Body createCircle(json& element, std::string name) {
|
Body* createCircle(json& element, std::string name) {
|
||||||
std::vector<float> v;
|
std::vector<float> v;
|
||||||
std::vector<unsigned int> i;
|
std::vector<unsigned int> i;
|
||||||
|
|
||||||
|
float d = element["diameter"];
|
||||||
|
|
||||||
for(int it = 0; it < resolution; it++) {
|
for(int it = 0; it < resolution; it++) {
|
||||||
v.push_back(glm::cos(2.0f * glm::pi<float>() / resolution));
|
v.push_back(d / 2.0f * glm::cos(it * 2.0f * glm::pi<float>() / resolution));
|
||||||
v.push_back(glm::sin(2.0f * glm::pi<float>() / resolution));
|
v.push_back(d / 2.0f * glm::sin(it * 2.0f * glm::pi<float>() / resolution));
|
||||||
v.push_back(0.0f);
|
v.push_back(0.0f);
|
||||||
|
|
||||||
i.push_back(it);
|
i.push_back(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Body(
|
return new Body(
|
||||||
|
VertexBuffer(v),
|
||||||
|
IndexArray(i),
|
||||||
|
VertexLayout(),
|
||||||
|
shader,
|
||||||
|
RenderMode::ConnectedLinesLooped
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Body* createSquare(json& element, std::string name) {
|
||||||
|
std::vector<float> v;
|
||||||
|
std::vector<unsigned int> i;
|
||||||
|
|
||||||
|
float width = element["width"];
|
||||||
|
|
||||||
|
v.push_back(width / 2.0f);
|
||||||
|
v.push_back(width / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(0);
|
||||||
|
|
||||||
|
v.push_back(-width / 2.0f);
|
||||||
|
v.push_back(width / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(1);
|
||||||
|
|
||||||
|
v.push_back(-width / 2.0f);
|
||||||
|
v.push_back(-width / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(2);
|
||||||
|
|
||||||
|
v.push_back(width / 2.0f);
|
||||||
|
v.push_back(-width / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(3);
|
||||||
|
|
||||||
|
return new Body(
|
||||||
|
VertexBuffer(v),
|
||||||
|
IndexArray(i),
|
||||||
|
VertexLayout(),
|
||||||
|
shader,
|
||||||
|
RenderMode::ConnectedLinesLooped
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Body* createRect(json& element, std::string name) {
|
||||||
|
std::vector<float> v;
|
||||||
|
std::vector<unsigned int> i;
|
||||||
|
|
||||||
|
float width = element["width"];
|
||||||
|
float height = element["height"];
|
||||||
|
|
||||||
|
v.push_back(width / 2.0f);
|
||||||
|
v.push_back(height / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(0);
|
||||||
|
|
||||||
|
v.push_back(-width / 2.0f);
|
||||||
|
v.push_back(height / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(1);
|
||||||
|
|
||||||
|
v.push_back(-width / 2.0f);
|
||||||
|
v.push_back(-height / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(2);
|
||||||
|
|
||||||
|
v.push_back(width / 2.0f);
|
||||||
|
v.push_back(-height / 2.0f);
|
||||||
|
v.push_back(0.0f);
|
||||||
|
|
||||||
|
i.push_back(3);
|
||||||
|
|
||||||
|
return new Body(
|
||||||
|
VertexBuffer(v),
|
||||||
|
IndexArray(i),
|
||||||
|
VertexLayout(),
|
||||||
|
shader,
|
||||||
|
RenderMode::ConnectedLinesLooped
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Body* createPoly(json& element, std::string name) {
|
||||||
|
std::vector<float> v;
|
||||||
|
std::vector<unsigned int> i;
|
||||||
|
|
||||||
|
json coords = element["coords"];
|
||||||
|
|
||||||
|
unsigned int j = 0;
|
||||||
|
for(json::const_iterator it = coords.cbegin(); it != coords.cend(); it++) {
|
||||||
|
json c = *it;
|
||||||
|
v.push_back(c["x"]);
|
||||||
|
v.push_back(c["y"]);
|
||||||
|
v.push_back(c["z"]);
|
||||||
|
|
||||||
|
i.push_back(j++);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Body(
|
||||||
|
VertexBuffer(v),
|
||||||
|
IndexArray(i),
|
||||||
|
VertexLayout(),
|
||||||
|
shader,
|
||||||
|
RenderMode::ConnectedLinesLooped
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Body* createText(json& element, std::string name) {
|
||||||
|
std::vector<float> v;
|
||||||
|
std::vector<unsigned int> i;
|
||||||
|
|
||||||
|
//do something
|
||||||
|
|
||||||
|
return new Body(
|
||||||
VertexBuffer(v),
|
VertexBuffer(v),
|
||||||
IndexArray(i),
|
IndexArray(i),
|
||||||
VertexLayout(),
|
VertexLayout(),
|
||||||
@@ -114,24 +282,10 @@ namespace Archimedes {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Body createRect(json& element, std::string name) {
|
void buildObjects() {
|
||||||
return Body();
|
|
||||||
}
|
|
||||||
|
|
||||||
Body createPoly(json& element, std::string name) {
|
|
||||||
return Body();
|
|
||||||
}
|
|
||||||
|
|
||||||
Body createText(json& element, std::string name) {
|
|
||||||
return Body();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Body> buildObjects() {
|
|
||||||
|
|
||||||
std::vector<Body> v;
|
|
||||||
|
|
||||||
|
|
||||||
for (json::const_iterator it = templates.cbegin(); it != templates.cend(); it++)
|
for (json::const_iterator it = objects.cbegin(); it != objects.cend(); it++)
|
||||||
{
|
{
|
||||||
json element = *it;
|
json element = *it;
|
||||||
std::string name = element["name"];
|
std::string name = element["name"];
|
||||||
@@ -139,27 +293,79 @@ namespace Archimedes {
|
|||||||
if (type == "CIRCLE") {
|
if (type == "CIRCLE") {
|
||||||
objectMap[name] = createCircle(element, name);
|
objectMap[name] = createCircle(element, name);
|
||||||
}
|
}
|
||||||
if (type == "SQUARE") {}
|
if (type == "SQUARE") {
|
||||||
if (type == "RECTANGLE") {}
|
objectMap[name] = createSquare(element, name);
|
||||||
if (type == "POLYGON") {}
|
}
|
||||||
if (type == "TEXT") {}
|
if (type == "RECTANGLE") {
|
||||||
|
objectMap[name] = createRect(element, name);
|
||||||
|
}
|
||||||
|
if (type == "POLYGON") {
|
||||||
|
objectMap[name] = createPoly(element, name);
|
||||||
|
}
|
||||||
|
if (type == "TEXT") {
|
||||||
|
objectMap[name] = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
}
|
||||||
|
|
||||||
|
void objectActions()
|
||||||
|
{
|
||||||
|
for (json::const_iterator it = setup.cbegin(); it != setup.cend(); it++)
|
||||||
|
{
|
||||||
|
json element = *it;
|
||||||
|
std::string name = element["name"];
|
||||||
|
Body* o = objectMap[name];
|
||||||
|
if (o == nullptr) continue;
|
||||||
|
if (element.contains("moveto"))
|
||||||
|
{
|
||||||
|
json moveTo = element["moveto"];
|
||||||
|
float x = moveTo["x"];
|
||||||
|
float y = moveTo["y"];
|
||||||
|
float z = moveTo["z"];
|
||||||
|
o->moveTo(glm::vec3(x, y, z));
|
||||||
|
}
|
||||||
|
if (element.contains("moveby"))
|
||||||
|
{
|
||||||
|
json moveBy = element["moveby"];
|
||||||
|
float x = moveBy["x"];
|
||||||
|
float y = moveBy["y"];
|
||||||
|
float z = moveBy["z"];
|
||||||
|
o->moveRel(glm::vec3(x, y, z));
|
||||||
|
}
|
||||||
|
if (element.contains("rotateto"))
|
||||||
|
{
|
||||||
|
json rotateTo = element["rotateto"];
|
||||||
|
float p = rotateTo["pitch"];
|
||||||
|
float y = rotateTo["yaw"];
|
||||||
|
float r = rotateTo["roll"];
|
||||||
|
o->rotateTo(glm::vec3(p, y, r));
|
||||||
|
}
|
||||||
|
if (element.contains("rotateby"))
|
||||||
|
{
|
||||||
|
json rotateBy = element["rotateby"];
|
||||||
|
float p = rotateBy["pitch"];
|
||||||
|
float y = rotateBy["yaw"];
|
||||||
|
float r = rotateBy["roll"];
|
||||||
|
o->rotateRel(glm::vec3(p, y, r));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::unordered_map<std::string, Body*> objectMap;
|
||||||
|
Shader shader;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::unordered_map<std::string, Body> objectMap;
|
|
||||||
|
|
||||||
std::unordered_map<std::string, Body> templateMap;
|
std::unordered_map<std::string, Body> templateMap;
|
||||||
|
|
||||||
bool goodJSON = true;
|
bool goodJSON = false;
|
||||||
|
|
||||||
Shader shader;
|
|
||||||
|
|
||||||
unsigned int resolution = 50;
|
unsigned int resolution = 50;
|
||||||
|
|
||||||
json document, templates, objects, setup, cameras, lights, actions;
|
json document, templates, objects, setup, cameras, lights, actions;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Sandbox.h"
|
#include "Sandbox.h"
|
||||||
#include "JObject.h"
|
|
||||||
|
|
||||||
|
|
||||||
Sandbox::Sandbox(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
|
Sandbox::Sandbox(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
|
||||||
@@ -54,7 +53,7 @@ void Sandbox::onLoad() {
|
|||||||
|
|
||||||
cubeShader = Archimedes::Shader(cubeVS, cubeFS, Archimedes::Shader::LoadType::FromSource);
|
cubeShader = Archimedes::Shader(cubeVS, cubeFS, Archimedes::Shader::LoadType::FromSource);
|
||||||
|
|
||||||
window->getRenderer()->useShader(cubeShader);
|
window->getRenderer()->setupShader(cubeShader);
|
||||||
|
|
||||||
cube = Archimedes::Body(
|
cube = Archimedes::Body(
|
||||||
Archimedes::VertexBuffer(vertices),
|
Archimedes::VertexBuffer(vertices),
|
||||||
@@ -79,12 +78,22 @@ void Sandbox::onLoad() {
|
|||||||
window->getSize(w, h);
|
window->getSize(w, h);
|
||||||
app->emitEvent(new Archimedes::ResizeWindowEvent(w, h));
|
app->emitEvent(new Archimedes::ResizeWindowEvent(w, h));
|
||||||
|
|
||||||
hexagon = Archimedes::readOBJ("/home/nathan/Projects/tests/buildzone/hexagon_pad.obj", cubeShader);
|
hexagon = readOBJ("/home/nathan/Projects/tests/buildzone/hexagon_pad.obj", cubeShader);
|
||||||
|
|
||||||
window->getRenderer()->setupRenderTarget(hexagon.getMesh());
|
window->getRenderer()->setupRenderTarget(hexagon.getMesh());
|
||||||
|
|
||||||
|
|
||||||
hexagon.scaleTo(0.01f);
|
hexagon.scaleTo(0.01f);
|
||||||
|
|
||||||
|
|
||||||
|
camera.setTransform(glm::lookAt(
|
||||||
|
glm::vec3(0.0f, 0.0f, 3.0f),
|
||||||
|
glm::vec3(0.0f, 0.0f, 0.0f),
|
||||||
|
glm::vec3(0.0f, 1.0f, 0.0f)
|
||||||
|
));
|
||||||
|
|
||||||
|
camera.setPerspective(glm::perspective(glm::radians(45.0f), (float)w/(float)h, 0.1f, 100.0f));
|
||||||
|
//camera.setPerspective(glm::ortho(-(float)w / 2.0f, (float)w / 2.0f, -(float)h / 2.0f, (float)h / 2.0f, 0.1f, 100.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sandbox::run() {
|
void Sandbox::run() {
|
||||||
@@ -94,37 +103,35 @@ void Sandbox::run() {
|
|||||||
static glm::vec3 pos(0), rot(0);
|
static glm::vec3 pos(0), rot(0);
|
||||||
static glm::vec3 posPrev(0), rotPrev(0);
|
static glm::vec3 posPrev(0), rotPrev(0);
|
||||||
|
|
||||||
static glm::vec4 color = { 0.4f, 0.0f, 0.3f, 1.0f };
|
|
||||||
|
|
||||||
static glm::vec3 camPos(0.0f, 0.0f, 3.0f), camRot(0.0f, glm::pi<float>(), 0.0f);
|
static glm::vec3 camPos(0.0f, 0.0f, 3.0f), camRot(0.0f, glm::pi<float>(), 0.0f);
|
||||||
|
static glm::vec3 camPosPrev(0.0f, 0.0f, 3.0f), camRotPrev(0.0f, glm::pi<float>(), 0.0f);
|
||||||
static glm::mat4 orthoMat, perspMat, cameraTransform;
|
|
||||||
|
|
||||||
cameraTransform = glm::lookAt(
|
|
||||||
camPos,
|
|
||||||
camPos + glm::normalize(glm::vec3(glm::sin(camRot.y) * glm::cos(camRot.x), glm::sin(camRot.x), glm::cos(camRot.y) * glm::cos(camRot.x))),
|
|
||||||
glm::vec3(0.0f, 1.0f, 0.0f)
|
|
||||||
);
|
|
||||||
|
|
||||||
int w, h;
|
|
||||||
window->getSize(w, h);
|
|
||||||
|
|
||||||
orthoMat = glm::ortho(-(float)w / 2.0f, (float)w / 2.0f, -(float)h / 2.0f, (float)h / 2.0f, 0.1f, 100.0f);
|
|
||||||
|
|
||||||
perspMat = glm::perspective(glm::radians(45.0f), (float)w/(float)h, 0.1f, 100.0f);
|
static glm::vec4 color = { 0.4f, 0.0f, 0.3f, 1.0f };
|
||||||
|
|
||||||
|
static int w, h;
|
||||||
|
window->getSize(w, h);
|
||||||
|
//camPos = camera.moveRel(camPos - camPosPrev);
|
||||||
|
//camRot = camera.rotateRel(camRot - camRotPrev);
|
||||||
|
|
||||||
pos = cube.moveRel(pos - posPrev);
|
camera.setTransform(glm::lookAt(
|
||||||
rot = cube.rotateRel(rot - rotPrev);
|
camPos,
|
||||||
scale = cube.scaleRel(scale / scalePrev);
|
glm::normalize(glm::vec3(glm::cos(camRot.x) * glm::sin(camRot.y), glm::sin(camRot.x), glm::cos(camRot.x) * glm::cos(camRot.y))),
|
||||||
|
glm::vec3(0.0f, 1.0f, 0.0f)
|
||||||
|
));
|
||||||
|
|
||||||
posPrev = pos;
|
camPosPrev = camPos;
|
||||||
rotPrev = rot;
|
camRotPrev = camRot;
|
||||||
scalePrev = scale;
|
|
||||||
|
|
||||||
//window->getRenderer()->draw(grid.getMesh(), grid.getTransform(), cameraTransform, perspMat, glm::vec4(0.7f));
|
/*
|
||||||
//window->getRenderer()->draw(cube.getMesh(), cube.getTransform(), cameraTransform, perspMat, color, Archimedes::Renderer::RenderMode::Triangles);
|
window->getRenderer()->draw(
|
||||||
window->getRenderer()->draw(hexagon.getMesh(), hexagon.getTransform(), cameraTransform, perspMat, color);
|
hexagon.getMesh(),
|
||||||
|
hexagon.getTransform(),
|
||||||
|
camera.getTransform(),
|
||||||
|
camera.getPerspective(),
|
||||||
|
color
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
@@ -139,22 +146,89 @@ void Sandbox::run() {
|
|||||||
ImGui::SliderFloat("clear b", &clearColor.b, 0.0f, 1.0f);
|
ImGui::SliderFloat("clear b", &clearColor.b, 0.0f, 1.0f);
|
||||||
ImGui::SliderFloat("clear a", &clearColor.a, 0.0f, 1.0f);
|
ImGui::SliderFloat("clear a", &clearColor.a, 0.0f, 1.0f);
|
||||||
|
|
||||||
ImGui::Text("Properties");
|
if(jObject.isValid()) {
|
||||||
|
ImGui::Text("Object Properties");
|
||||||
|
|
||||||
ImGui::SliderFloat("pitch", &rot.x, -glm::pi<float>(), glm::pi<float>());
|
static std::string object = jObject.objectMap.begin()->first;
|
||||||
ImGui::SliderFloat("yaw", &rot.y, -glm::pi<float>(), glm::pi<float>());
|
|
||||||
ImGui::SliderFloat("roll", &rot.z, -glm::pi<float>(), glm::pi<float>());
|
|
||||||
|
|
||||||
ImGui::SliderFloat("scale", &scale, 0.1f, 10.0f);
|
|
||||||
|
|
||||||
ImGui::SliderFloat("x", &pos.x, -10.0f, 10.0f);
|
if(ImGui::BeginCombo("Object", object.c_str())) {
|
||||||
ImGui::SliderFloat("y", &pos.y, -10.0f, 10.0f);
|
for (auto it : jObject.objectMap)
|
||||||
ImGui::SliderFloat("z", &pos.z, -10.0f, 10.0f);
|
{
|
||||||
|
|
||||||
ImGui::SliderFloat("r", &color.r, 0.0f, 1.0f);
|
const bool is_selected = (object == it.first);
|
||||||
ImGui::SliderFloat("g", &color.g, 0.0f, 1.0f);
|
if (ImGui::Selectable(it.first.c_str(), is_selected)) {
|
||||||
ImGui::SliderFloat("b", &color.b, 0.0f, 1.0f);
|
object = it.first;
|
||||||
ImGui::SliderFloat("a", &color.a, 0.0f, 1.0f);
|
}
|
||||||
|
|
||||||
|
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||||
|
if (is_selected)
|
||||||
|
ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it : jObject.objectMap) {
|
||||||
|
if(it.second != nullptr) {
|
||||||
|
window->getRenderer()->draw(
|
||||||
|
it.second->getMesh(),
|
||||||
|
it.second->getTransform(),
|
||||||
|
camera.getTransform(),
|
||||||
|
camera.getPerspective(),
|
||||||
|
color
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ImGui::SliderFloat("pitch", &rot.x, -glm::pi<float>(), glm::pi<float>());
|
||||||
|
ImGui::SliderFloat("yaw", &rot.y, -glm::pi<float>(), glm::pi<float>());
|
||||||
|
ImGui::SliderFloat("roll", &rot.z, -glm::pi<float>(), glm::pi<float>());
|
||||||
|
|
||||||
|
ImGui::SliderFloat("scale", &scale, 0.001f, 10.0f);
|
||||||
|
|
||||||
|
ImGui::SliderFloat("x", &pos.x, -10.0f, 10.0f);
|
||||||
|
ImGui::SliderFloat("y", &pos.y, -10.0f, 10.0f);
|
||||||
|
ImGui::SliderFloat("z", &pos.z, -10.0f, 10.0f);
|
||||||
|
|
||||||
|
ImGui::SliderFloat("r", &color.r, 0.0f, 1.0f);
|
||||||
|
ImGui::SliderFloat("g", &color.g, 0.0f, 1.0f);
|
||||||
|
ImGui::SliderFloat("b", &color.b, 0.0f, 1.0f);
|
||||||
|
ImGui::SliderFloat("a", &color.a, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
if(ImGui::Button("Apply") && jObject.objectMap[object] != nullptr) {
|
||||||
|
pos = jObject.objectMap[object]->moveRel(pos - posPrev);
|
||||||
|
rot = jObject.objectMap[object]->rotateRel(rot - rotPrev);
|
||||||
|
//scale = jObject.objectMap[object]->scaleRel(scale / scalePrev);
|
||||||
|
jObject.objectMap[object]->scaleTo(scale / (float)h);
|
||||||
|
|
||||||
|
|
||||||
|
posPrev = pos;
|
||||||
|
rotPrev = rot;
|
||||||
|
//scalePrev = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
static std::string path = "/home/nathan/Projects/tests/buildzone/test.json";
|
||||||
|
ImGui::InputText("JSON Path", &path);
|
||||||
|
if(ImGui::Button("load")) {
|
||||||
|
|
||||||
|
jObject.shader = cubeShader;
|
||||||
|
|
||||||
|
jObject.load(path);
|
||||||
|
|
||||||
|
jObject.buildObjects();
|
||||||
|
|
||||||
|
for(auto o : jObject.objectMap) {
|
||||||
|
if(o.second != nullptr) {
|
||||||
|
o.second->scaleTo(1.0f / (float)h);
|
||||||
|
window->getRenderer()->setupRenderTarget(o.second->getMesh());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jObject.objectActions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Camera Properties");
|
ImGui::Text("Camera Properties");
|
||||||
|
|
||||||
@@ -212,4 +286,7 @@ bool Sandbox::onEvent(const Archimedes::Event& e) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// This only works with opengl!!!!
|
// This only works with opengl!!!!
|
||||||
|
|
||||||
|
#ifndef JOBJECT_H
|
||||||
|
#define JOBJECT_H
|
||||||
|
|
||||||
#include "Archimedes.h"
|
#include "Archimedes.h"
|
||||||
|
|
||||||
@@ -9,6 +11,8 @@
|
|||||||
#include "utils/Objects/Body.h"
|
#include "utils/Objects/Body.h"
|
||||||
#include "utils/Objects/Camera.h"
|
#include "utils/Objects/Camera.h"
|
||||||
|
|
||||||
|
#include "JObject.h"
|
||||||
|
|
||||||
class Sandbox : public Archimedes::Module {
|
class Sandbox : public Archimedes::Module {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -50,10 +54,13 @@ class Sandbox : public Archimedes::Module {
|
|||||||
" FragColor = color;\n"
|
" FragColor = color;\n"
|
||||||
"}\n\0";
|
"}\n\0";
|
||||||
|
|
||||||
|
Archimedes::JObject jObject;
|
||||||
|
|
||||||
Archimedes::Shader cubeShader, gridShader;
|
Archimedes::Shader cubeShader, gridShader;
|
||||||
Archimedes::Body cube, grid, hexagon;
|
Archimedes::Body cube, grid, hexagon;
|
||||||
|
|
||||||
|
Archimedes::Camera camera;
|
||||||
|
|
||||||
std::vector<float> gridVertices = {
|
std::vector<float> gridVertices = {
|
||||||
-1.0f, 0.0f, 1.0f,
|
-1.0f, 0.0f, 1.0f,
|
||||||
1.0f, 0.0f, 1.0f,
|
1.0f, 0.0f, 1.0f,
|
||||||
@@ -133,6 +140,77 @@ class Sandbox : public Archimedes::Module {
|
|||||||
1,
|
1,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Archimedes::Body readOBJ(std::string path, Archimedes::Shader shader) {
|
||||||
|
|
||||||
|
std::ifstream file(path);
|
||||||
|
|
||||||
|
if(!file.is_open()) return Archimedes::Body();
|
||||||
|
|
||||||
|
std::string s;
|
||||||
|
|
||||||
|
std::vector<float> verticies;
|
||||||
|
std::vector<unsigned int> indicies;
|
||||||
|
|
||||||
|
verticies.reserve(3 * 100);
|
||||||
|
indicies.reserve(100);
|
||||||
|
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int j = 0;
|
||||||
|
|
||||||
|
float point;
|
||||||
|
unsigned int idx;
|
||||||
|
|
||||||
|
while(!file.eof()) {
|
||||||
|
getline(file, s, ' ');
|
||||||
|
|
||||||
|
//std::cout << "\nline start: " << s << std::endl;
|
||||||
|
|
||||||
|
if(s == "v") {
|
||||||
|
file >> point;
|
||||||
|
verticies.push_back(point);
|
||||||
|
//std::cout << "point1: " << point << std::endl;
|
||||||
|
|
||||||
|
file >> point;
|
||||||
|
verticies.push_back(point);
|
||||||
|
//std::cout << "point2: " << point << std::endl;
|
||||||
|
|
||||||
|
file >> point;
|
||||||
|
verticies.push_back(point);
|
||||||
|
//std::cout << "point3: " << point << std::endl;
|
||||||
|
|
||||||
|
//std::cout << "index: " << j << std::endl;
|
||||||
|
|
||||||
|
getline(file, s);
|
||||||
|
//file.ignore();
|
||||||
|
} else if(s == "f") {
|
||||||
|
|
||||||
|
file >> idx;
|
||||||
|
indicies.push_back(--idx);
|
||||||
|
file.ignore(5, ' ');
|
||||||
|
|
||||||
|
file >> idx;
|
||||||
|
indicies.push_back(--idx);
|
||||||
|
file.ignore(5, ' ');
|
||||||
|
|
||||||
|
file >> idx;
|
||||||
|
indicies.push_back(--idx);
|
||||||
|
getline(file, s);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
getline(file, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
return Archimedes::Body(
|
||||||
|
Archimedes::VertexBuffer(verticies),
|
||||||
|
Archimedes::IndexArray(indicies),
|
||||||
|
Archimedes::VertexLayout(),
|
||||||
|
shader
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -140,3 +218,5 @@ class Sandbox : public Archimedes::Module {
|
|||||||
typedef Sandbox mtype;
|
typedef Sandbox mtype;
|
||||||
#include "endModule.h"
|
#include "endModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
glm
|
glm
|
||||||
curl
|
curl
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
|
|
||||||
|
stb
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user