things
This commit is contained in:
parent
748d52c9c9
commit
112a8f568b
19 changed files with 222 additions and 14 deletions
|
|
@ -8,9 +8,17 @@ namespace fishbone {
|
|||
};
|
||||
|
||||
#include <fishbone/log.h>
|
||||
#include <fishbone/file.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Base : public fishbone::Logger {
|
||||
fishbone::StringArrayMap mountpoints;
|
||||
|
||||
public:
|
||||
Base(fishbone::StringArrayMap param);
|
||||
|
||||
void mount(std::string name, std::string path);
|
||||
fishbone::File* open(std::string path, std::string mode);
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace fishbone {
|
|||
namespace fishbone {
|
||||
class Client : public fishbone::Base {
|
||||
public:
|
||||
Client(std::unordered_map<std::string, std::vector<std::string>> param);
|
||||
Client(fishbone::StringArrayMap param);
|
||||
~Client();
|
||||
|
||||
bool step();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace fishbone {
|
|||
#include <fishbone/window.h>
|
||||
#include <fishbone/meshldr.h>
|
||||
#include <fishbone/textureldr.h>
|
||||
#include <fishbone/math.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Texture {
|
||||
|
|
@ -64,6 +65,18 @@ namespace fishbone {
|
|||
~Renderer();
|
||||
|
||||
void prepare();
|
||||
void quad(std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals) {
|
||||
std::vector<struct fishbone::Vector3> v;
|
||||
std::vector<struct fishbone::Vector2> t;
|
||||
std::vector<struct fishbone::Vector3> n;
|
||||
|
||||
v = fishbone::quadToTriangle<struct fishbone::Vector3>(vertices);
|
||||
t = fishbone::quadToTriangle<struct fishbone::Vector2>(texcoords);
|
||||
n = fishbone::quadToTriangle<struct fishbone::Vector3>(normals);
|
||||
|
||||
this->triangle(v, t, n);
|
||||
}
|
||||
void triangle(std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals);
|
||||
};
|
||||
|
||||
static float maxDistance = 64;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace fishbone {
|
|||
class File {
|
||||
std::ifstream ifs;
|
||||
std::ofstream ofs;
|
||||
bool opened;
|
||||
|
||||
public:
|
||||
File();
|
||||
|
|
|
|||
16
engine/include/fishbone/filesystem.h
Normal file
16
engine/include/fishbone/filesystem.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef __FISHBONE_FILESYSTEM_H__
|
||||
#define __FISHBONE_FILESYSTEM_H__
|
||||
|
||||
#include <fishbone/pre.h>
|
||||
|
||||
namespace fishbone {
|
||||
bool exists(std::string path);
|
||||
};
|
||||
|
||||
/* no includes */
|
||||
|
||||
namespace fishbone {
|
||||
bool exists(std::string path);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -15,5 +15,6 @@
|
|||
#include <fishbone/log.h>
|
||||
#include <fishbone/math.h>
|
||||
#include <fishbone/textureldr.h>
|
||||
#include <fishbone/filesystem.h>
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,12 +5,35 @@
|
|||
|
||||
namespace fishbone {
|
||||
float cot(float x);
|
||||
};
|
||||
template <typename T>
|
||||
std::vector<T> quadToTriangle(std::vector<T> v);
|
||||
}; // namespace fishbone
|
||||
|
||||
/* no includes */
|
||||
|
||||
namespace fishbone {
|
||||
float cot(float x);
|
||||
template <typename T>
|
||||
std::vector<T> quadToTriangle(std::vector<T> v) {
|
||||
std::vector<T> r;
|
||||
|
||||
/**
|
||||
* 1-4
|
||||
* |\|
|
||||
* 2-3
|
||||
*/
|
||||
for(int i = 0; i < v.size(); i += 4) {
|
||||
r.push_back(v[i + 0]);
|
||||
r.push_back(v[i + 1]);
|
||||
r.push_back(v[i + 2]);
|
||||
|
||||
r.push_back(v[i + 2]);
|
||||
r.push_back(v[i + 3]);
|
||||
r.push_back(v[i + 0]);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static double pi = 3.14159265358979323846;
|
||||
}; // namespace fishbone
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ namespace fishbone {
|
|||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
using StringArrayMap = std::unordered_map<std::string, std::vector<std::string>>;
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue