Commit for 2021.06.29 02-19-12.7z
This commit is contained in:
parent
9b2c6220c4
commit
5cd6a2e155
2
Makefile
2
Makefile
@ -146,7 +146,7 @@ ifneq (,$(findstring bullet,$(REQ_DEPS)))
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(findstring simd,$(REQ_DEPS)))
|
||||
FLAGS += -DUF_USE_SIMD #-march=native
|
||||
FLAGS += -DUF_USE_SIMD -DUF_MATRIX_ALIGNED #-DUF_VECTOR_ALIGNED #-march=native
|
||||
|
||||
endif
|
||||
ifneq (,$(findstring meshoptimizer,$(REQ_DEPS)))
|
||||
|
||||
@ -175,14 +175,16 @@
|
||||
"streams by default": true
|
||||
},
|
||||
"memory pool": {
|
||||
"globalOverride": false,
|
||||
"subPools": true,
|
||||
"alignment": 64,
|
||||
"size": "1024 MiB",
|
||||
"STL allocator": true,
|
||||
"pools": {
|
||||
"entity": "256 MiB",
|
||||
"userdata": "256 MiB",
|
||||
"component": "256 MiB"
|
||||
}
|
||||
},
|
||||
"globalOverride": false
|
||||
},
|
||||
"hook" : {
|
||||
"mode" : "Readable"
|
||||
|
||||
@ -45,11 +45,11 @@
|
||||
},
|
||||
"metadata": {
|
||||
"overlay": {
|
||||
// "position": [ 0, 0, -3 ],
|
||||
// "scale": [ -1.77778, -1, 1 ],
|
||||
"position": [ 0, 0, -3 ],
|
||||
"scale": [ 1.77778, -1, 1 ],
|
||||
"orientation": [ 0, 0, 0, 1 ],
|
||||
"transform": {
|
||||
"position": [ 0, 0, -3 ],
|
||||
"scale": [ 1.77778, -1, 1 ],
|
||||
"orientation": [ 0, 0, 0, 1 ]
|
||||
},
|
||||
"floating": false,
|
||||
"enabled": true,
|
||||
"alpha": 1.0,
|
||||
|
||||
@ -146,10 +146,14 @@ void client::tick() {
|
||||
}
|
||||
#endif
|
||||
uf::hooks.call("window:Mouse.Moved", pod::payloads::windowMouseMoved{
|
||||
"window:Mouse.Moved",
|
||||
"client",
|
||||
{
|
||||
pod::Vector2ui{ size.x, size.y },
|
||||
{
|
||||
"window:Mouse.Moved",
|
||||
"client",
|
||||
},
|
||||
{
|
||||
pod::Vector2ui{ size.x, size.y },
|
||||
},
|
||||
},
|
||||
{
|
||||
current,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <uf/utils/io/iostream.h>
|
||||
#include <uf/utils/time/time.h>
|
||||
|
||||
#include <uf/utils/mempool/mempool.h>
|
||||
#include <uf/utils/memory/pool.h>
|
||||
|
||||
#if UF_NO_EXCEPTIONS
|
||||
#define HANDLE_EXCEPTIONS 0
|
||||
|
||||
@ -106,4 +106,5 @@
|
||||
#endif
|
||||
|
||||
#include "macros.h"
|
||||
#include "simd.h"
|
||||
#include "simd.h"
|
||||
#include "helpers.inl"
|
||||
@ -4,7 +4,7 @@
|
||||
#include <uf/engine/entity/entity.h>
|
||||
#include <uf/utils/string/ext.h>
|
||||
#include <uf/utils/hook/hook.h>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
#include <functional>
|
||||
|
||||
namespace uf {
|
||||
@ -15,17 +15,17 @@ namespace uf {
|
||||
// URL or file path
|
||||
void processQueue();
|
||||
|
||||
void cache( const std::string&, const std::string&, const std::string&, const std::string& );
|
||||
void load( const std::string&, const std::string&, const std::string&, const std::string& );
|
||||
void cache( const uf::stl::string&, const uf::stl::string&, const uf::stl::string&, const uf::stl::string& );
|
||||
void load( const uf::stl::string&, const uf::stl::string&, const uf::stl::string&, const uf::stl::string& );
|
||||
|
||||
std::string cache( const std::string&, const std::string& = "", const std::string& = "" );
|
||||
std::string load( const std::string&, const std::string& = "", const std::string& = "" );
|
||||
uf::stl::string cache( const uf::stl::string&, const uf::stl::string& = "", const uf::stl::string& = "" );
|
||||
uf::stl::string load( const uf::stl::string&, const uf::stl::string& = "", const uf::stl::string& = "" );
|
||||
|
||||
std::string getOriginal( const std::string& );
|
||||
uf::stl::string getOriginal( const uf::stl::string& );
|
||||
|
||||
template<typename T>
|
||||
std::vector<T>& getContainer() {
|
||||
return this->getComponent<std::vector<T>>();
|
||||
uf::stl::vector<T>& getContainer() {
|
||||
return this->getComponent<uf::stl::vector<T>>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -34,10 +34,10 @@ namespace uf {
|
||||
return container.size() > i;
|
||||
}
|
||||
template<typename T>
|
||||
bool has( const std::string& url ) {
|
||||
bool has( const uf::stl::string& url ) {
|
||||
auto& container = this->getContainer<T>();
|
||||
if ( container.empty() ) return false;
|
||||
std::string extension = uf::io::extension( url );
|
||||
uf::stl::string extension = uf::io::extension( url );
|
||||
uf::Serializer& map = this->getComponent<uf::Serializer>();
|
||||
if ( ext::json::isNull( map[extension] ) ) return false;
|
||||
if ( ext::json::isNull( map[extension][url] ) ) return false;
|
||||
@ -50,16 +50,16 @@ namespace uf {
|
||||
return container.at(i);
|
||||
}
|
||||
template<typename T>
|
||||
T& get( const std::string& url ) {
|
||||
std::string extension = uf::io::extension( url );
|
||||
T& get( const uf::stl::string& url ) {
|
||||
uf::stl::string extension = uf::io::extension( url );
|
||||
uf::Serializer& map = this->getComponent<uf::Serializer>();
|
||||
size_t index = map[extension][url]["index"].as<size_t>(0);
|
||||
return this->get<T>(index);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& add( const std::string& url, const T& copy ) {
|
||||
std::string extension = uf::io::extension( url );
|
||||
T& add( const uf::stl::string& url, const T& copy ) {
|
||||
uf::stl::string extension = uf::io::extension( url );
|
||||
uf::Serializer& map = this->getComponent<uf::Serializer>();
|
||||
auto& container = this->getContainer<T>();
|
||||
if ( !ext::json::isNull( map[extension][url]["index"] ) ) return this->get<T>(url);
|
||||
@ -68,8 +68,8 @@ namespace uf {
|
||||
return container.back();
|
||||
}
|
||||
template<typename T>
|
||||
T& add( const std::string& url, T&& move ) {
|
||||
std::string extension = uf::io::extension( url );
|
||||
T& add( const uf::stl::string& url, T&& move ) {
|
||||
uf::stl::string extension = uf::io::extension( url );
|
||||
uf::Serializer& map = this->getComponent<uf::Serializer>();
|
||||
auto& container = this->getContainer<T>();
|
||||
|
||||
@ -80,19 +80,19 @@ namespace uf {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void remove( const std::string& url ) {
|
||||
void remove( const uf::stl::string& url ) {
|
||||
if ( !this->has<T>( url ) ) return;
|
||||
auto& container = this->getContainer<T>();
|
||||
|
||||
std::string extension = uf::io::extension( url );
|
||||
uf::stl::string extension = uf::io::extension( url );
|
||||
uf::Serializer& map = this->getComponent<uf::Serializer>();
|
||||
std::size_t index = map[extension][url]["index"].as<size_t>();
|
||||
// container.erase( container.begin() + index );
|
||||
// map[extension][url] = ext::json::null();
|
||||
// map[extension][url]["erased"] = true;
|
||||
|
||||
std::string key = "";
|
||||
ext::json::forEach( map[extension], [&]( const std::string& k, ext::json::Value& v ) {
|
||||
uf::stl::string key = "";
|
||||
ext::json::forEach( map[extension], [&]( const uf::stl::string& k, ext::json::Value& v ) {
|
||||
std::size_t i = v["index"].as<size_t>();
|
||||
if ( index == i && key != url ) key = k;
|
||||
});
|
||||
|
||||
@ -5,17 +5,17 @@
|
||||
namespace uf {
|
||||
class UF_API MasterData {
|
||||
protected:
|
||||
std::string m_table;
|
||||
std::string m_key;
|
||||
uf::stl::string m_table;
|
||||
uf::stl::string m_key;
|
||||
uf::Serializer m_data;
|
||||
|
||||
static uf::Asset assetLoader;
|
||||
static std::string root;
|
||||
static uf::stl::string root;
|
||||
public:
|
||||
uf::Serializer load( const std::string&, size_t );
|
||||
uf::Serializer load( const std::string&, const std::string& = "" );
|
||||
uf::Serializer get( const std::string& k = "" ) const;
|
||||
const std::string& tableName() const;
|
||||
const std::string& keyName() const;
|
||||
uf::Serializer load( const uf::stl::string&, size_t );
|
||||
uf::Serializer load( const uf::stl::string&, const uf::stl::string& = "" );
|
||||
uf::Serializer get( const uf::stl::string& k = "" ) const;
|
||||
const uf::stl::string& tableName() const;
|
||||
const uf::stl::string& keyName() const;
|
||||
};
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
#include <uf/utils/component/component.h>
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <typeindex>
|
||||
|
||||
namespace uf {
|
||||
@ -14,7 +14,7 @@ namespace uf {
|
||||
namespace pod {
|
||||
struct UF_API Behavior {
|
||||
// typedef std::type_index type_t;
|
||||
typedef std::string type_t;
|
||||
typedef uf::stl::string type_t;
|
||||
typedef std::function<void(uf::Object&)> function_t;
|
||||
|
||||
type_t type = ""; //std::type_index(typeid(pod::Behavior));
|
||||
@ -28,7 +28,7 @@ namespace pod {
|
||||
namespace uf {
|
||||
class UF_API Behaviors : public uf::Component {
|
||||
protected:
|
||||
typedef std::vector<pod::Behavior> container_t;
|
||||
typedef uf::stl::vector<pod::Behavior> container_t;
|
||||
container_t m_behaviors;
|
||||
public:
|
||||
void initialize();
|
||||
|
||||
@ -3,17 +3,17 @@
|
||||
#include <uf/config.h>
|
||||
#include <uf/engine/behavior/behavior.h>
|
||||
#include <uf/utils/serialize/serializer.h>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <functional>
|
||||
|
||||
#include <uf/utils/mempool/mempool.h>
|
||||
#include <uf/utils/memory/pool.h>
|
||||
|
||||
namespace uf {
|
||||
class UF_API Object;
|
||||
class UF_API Entity : public uf::Behaviors {
|
||||
//friend class EntityBehavior;
|
||||
public:
|
||||
typedef std::vector<uf::Entity*> container_t;
|
||||
typedef uf::stl::vector<uf::Entity*> container_t;
|
||||
static uf::Entity null;
|
||||
static bool deleteChildrenOnDestroy;
|
||||
static bool deleteComponentsOnDestroy;
|
||||
@ -24,7 +24,7 @@ namespace uf {
|
||||
uf::Entity::container_t m_children;
|
||||
|
||||
std::size_t m_uid = 0;
|
||||
std::string m_name = "Entity";
|
||||
uf::stl::string m_name = "Entity";
|
||||
|
||||
public:
|
||||
static uf::MemoryPool memoryPool;
|
||||
@ -32,9 +32,9 @@ namespace uf {
|
||||
~Entity();
|
||||
// identifiers
|
||||
bool isValid() const;
|
||||
const std::string& getName() const;
|
||||
const uf::stl::string& getName() const;
|
||||
std::size_t getUid() const;
|
||||
void setName( const std::string& );
|
||||
void setName( const uf::stl::string& );
|
||||
// cast to other Entity classes, avoid nasty shit like *((uf::Object*) &entity)
|
||||
template<typename T=uf::Object> T& as();
|
||||
template<typename T=uf::Object> const T& as() const;
|
||||
@ -58,19 +58,19 @@ namespace uf {
|
||||
uf::Entity::container_t& getChildren();
|
||||
const uf::Entity::container_t& getChildren() const;
|
||||
// use instantiate to allocate
|
||||
void* operator new(size_t, const std::string& = "");
|
||||
void* operator new(size_t, const uf::stl::string& = "");
|
||||
void operator delete(void*);
|
||||
// search
|
||||
uf::Entity* findByName( const std::string& name );
|
||||
uf::Entity* findByName( const uf::stl::string& name );
|
||||
uf::Entity* findByUid( std::size_t id );
|
||||
const uf::Entity* findByName( const std::string& name ) const;
|
||||
const uf::Entity* findByName( const uf::stl::string& name ) const;
|
||||
const uf::Entity* findByUid( std::size_t id ) const;
|
||||
// filters
|
||||
void process( std::function<void(uf::Entity*)> );
|
||||
void process( std::function<void(uf::Entity*, int)>, int depth = 0 );
|
||||
// globals
|
||||
static uf::Entity* globalFindByUid( size_t id );
|
||||
static uf::Entity* globalFindByName( const std::string& name );
|
||||
static uf::Entity* globalFindByName( const uf::stl::string& name );
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -23,12 +23,12 @@ namespace pod {
|
||||
|
||||
/*alignas(16)*/ pod::Vector4f lerp = {0, 0, 1, 1};
|
||||
} storage;
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uf::renderer::Texture2D texture;
|
||||
bool bind = false;
|
||||
};
|
||||
struct UF_API Node {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
|
||||
int32_t index = -1;
|
||||
int32_t skin = -1;
|
||||
@ -36,7 +36,7 @@ namespace pod {
|
||||
int32_t mesh = -1;
|
||||
|
||||
pod::Transform<> transform;
|
||||
std::vector<int32_t> children;
|
||||
uf::stl::vector<int32_t> children;
|
||||
|
||||
uf::Object* entity = NULL;
|
||||
struct {
|
||||
@ -50,7 +50,7 @@ namespace pod {
|
||||
|
||||
// Node* node = NULL;
|
||||
pod::Node root;
|
||||
std::vector<pod::Node> nodes;
|
||||
uf::stl::vector<pod::Node> nodes;
|
||||
|
||||
uf::Object* entity = NULL;
|
||||
|
||||
@ -58,23 +58,23 @@ namespace pod {
|
||||
int32_t instance = -1;
|
||||
} buffers;
|
||||
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uf::graph::load_mode_t mode;
|
||||
uf::Serializer metadata;
|
||||
|
||||
uf::Atlas atlas;
|
||||
std::vector<uf::Image> images;
|
||||
std::vector<uf::renderer::Sampler> samplers;
|
||||
std::vector<pod::Texture> textures;
|
||||
std::vector<pod::Material> materials;
|
||||
std::vector<pod::Light> lights;
|
||||
std::vector<pod::DrawCall> drawCalls;
|
||||
uf::stl::vector<uf::Image> images;
|
||||
uf::stl::vector<uf::renderer::Sampler> samplers;
|
||||
uf::stl::vector<pod::Texture> textures;
|
||||
uf::stl::vector<pod::Material> materials;
|
||||
uf::stl::vector<pod::Light> lights;
|
||||
uf::stl::vector<pod::DrawCall> drawCalls;
|
||||
|
||||
std::vector<Skin> skins;
|
||||
std::vector<Mesh> meshes;
|
||||
std::unordered_map<std::string, Animation> animations;
|
||||
uf::stl::vector<Skin> skins;
|
||||
uf::stl::vector<Mesh> meshes;
|
||||
uf::stl::unordered_map<uf::stl::string, Animation> animations;
|
||||
|
||||
std::queue<std::string> sequence;
|
||||
std::queue<uf::stl::string> sequence;
|
||||
struct {
|
||||
struct {
|
||||
bool loop = true;
|
||||
@ -82,7 +82,7 @@ namespace pod {
|
||||
struct {
|
||||
float a = -std::numeric_limits<float>::max();
|
||||
float speed = 1 / 0.125f;
|
||||
std::unordered_map<int32_t, std::pair<pod::Transform<>, pod::Transform<>>> map;
|
||||
uf::stl::unordered_map<int32_t, std::pair<pod::Transform<>, pod::Transform<>>> map;
|
||||
} override;
|
||||
} animations;
|
||||
} settings;
|
||||
@ -93,17 +93,17 @@ namespace uf {
|
||||
namespace graph {
|
||||
/*
|
||||
namespace {
|
||||
extern UF_API std::vector<pod::Material::Storage> storage;
|
||||
extern UF_API std::vector<std::string> indices;
|
||||
extern UF_API uf::stl::vector<pod::Material::Storage> storage;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> indices;
|
||||
} materials;
|
||||
namespace {
|
||||
extern UF_API std::vector<pod::Texture::Storage> storage;
|
||||
extern UF_API std::vector<std::string> indices;
|
||||
extern UF_API uf::stl::vector<pod::Texture::Storage> storage;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> indices;
|
||||
} textures;
|
||||
*/
|
||||
|
||||
pod::Node* UF_API find( pod::Graph& graph, int32_t index );
|
||||
pod::Node* UF_API find( pod::Graph& graph, const std::string& name );
|
||||
pod::Node* UF_API find( pod::Graph& graph, const uf::stl::string& name );
|
||||
|
||||
pod::Matrix4f UF_API local( pod::Graph&, int32_t );
|
||||
pod::Matrix4f UF_API matrix( pod::Graph&, int32_t );
|
||||
@ -115,17 +115,17 @@ namespace uf {
|
||||
void UF_API initialize( pod::Graph& graph );
|
||||
|
||||
void UF_API override( pod::Graph& );
|
||||
void UF_API animate( pod::Graph&, const std::string&, float = 1, bool = true );
|
||||
void UF_API animate( pod::Graph&, const uf::stl::string&, float = 1, bool = true );
|
||||
void UF_API update( pod::Graph& );
|
||||
void UF_API update( pod::Graph&, float );
|
||||
void UF_API update( pod::Graph&, pod::Node& );
|
||||
|
||||
void UF_API destroy( pod::Graph& );
|
||||
|
||||
pod::Graph UF_API load( const std::string&, uf::graph::load_mode_t = 0, const uf::Serializer& = ext::json::null() );
|
||||
void UF_API save( const pod::Graph&, const std::string& );
|
||||
pod::Graph UF_API load( const uf::stl::string&, uf::graph::load_mode_t = 0, const uf::Serializer& = ext::json::null() );
|
||||
void UF_API save( const pod::Graph&, const uf::stl::string& );
|
||||
|
||||
std::string UF_API print( const pod::Graph& graph );
|
||||
uf::stl::string UF_API print( const pod::Graph& graph );
|
||||
uf::Serializer UF_API stats( const pod::Graph& graph );
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@ namespace uf {
|
||||
/*alignas(16)*/ pod::Vector3f tangent;
|
||||
/*alignas(8)*/ pod::Vector2ui id;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct Skinned {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
@ -32,7 +32,7 @@ namespace uf {
|
||||
/*alignas(16)*/ pod::Vector4ui joints;
|
||||
/*alignas(16)*/ pod::Vector4f weights;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
}
|
||||
typedef uf::BaseMesh<uf::graph::mesh::Skinned> mesh_t;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/math/vector.h>
|
||||
#include <uf/utils/math/transform.h>
|
||||
|
||||
@ -10,11 +10,11 @@ namespace pod {
|
||||
uf::renderer::Texture3D noise;
|
||||
uf::renderer::TextureCube skybox;
|
||||
struct {
|
||||
std::vector<uf::renderer::Texture3D> id;
|
||||
std::vector<uf::renderer::Texture3D> uv;
|
||||
std::vector<uf::renderer::Texture3D> normal;
|
||||
std::vector<uf::renderer::Texture3D> radiance;
|
||||
std::vector<uf::renderer::Texture3D> depth;
|
||||
uf::stl::vector<uf::renderer::Texture3D> id;
|
||||
uf::stl::vector<uf::renderer::Texture3D> uv;
|
||||
uf::stl::vector<uf::renderer::Texture3D> normal;
|
||||
uf::stl::vector<uf::renderer::Texture3D> radiance;
|
||||
uf::stl::vector<uf::renderer::Texture3D> depth;
|
||||
} voxels;
|
||||
};
|
||||
|
||||
@ -25,7 +25,7 @@ namespace pod {
|
||||
/*alignas(4)*/ uint32_t textureSlot = 0;
|
||||
/*alignas(4)*/ uint32_t padding = 0;
|
||||
} storage;
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
size_t verticesIndex = 0;
|
||||
size_t vertices = 0;
|
||||
size_t indicesIndex = 0;
|
||||
@ -44,7 +44,7 @@ namespace pod {
|
||||
/*alignas(16)*/ pod::Matrix4f view;
|
||||
/*alignas(16)*/ pod::Matrix4f projection;
|
||||
};
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
pod::Vector3f color = { 1, 1, 1 };
|
||||
float intensity = 1.0f;
|
||||
float range = 0.0f;
|
||||
@ -69,29 +69,29 @@ namespace pod {
|
||||
/*alignas(4)*/ int32_t indexLightmap = -1;
|
||||
/*alignas(4)*/ int32_t modeAlpha = -1;
|
||||
} storage;
|
||||
std::string name = "";
|
||||
std::string alphaMode = "";
|
||||
uf::stl::string name = "";
|
||||
uf::stl::string alphaMode = "";
|
||||
};
|
||||
struct UF_API Skin {
|
||||
std::string name = "";
|
||||
std::vector<int32_t> joints;
|
||||
std::vector<pod::Matrix4f> inverseBindMatrices;
|
||||
uf::stl::string name = "";
|
||||
uf::stl::vector<int32_t> joints;
|
||||
uf::stl::vector<pod::Matrix4f> inverseBindMatrices;
|
||||
};
|
||||
struct UF_API Animation {
|
||||
struct Sampler {
|
||||
std::string interpolator;
|
||||
std::vector<float> inputs;
|
||||
std::vector<pod::Vector4f> outputs;
|
||||
uf::stl::string interpolator;
|
||||
uf::stl::vector<float> inputs;
|
||||
uf::stl::vector<pod::Vector4f> outputs;
|
||||
};
|
||||
struct Channel {
|
||||
std::string path;
|
||||
uf::stl::string path;
|
||||
int32_t node;
|
||||
uint32_t sampler;
|
||||
};
|
||||
|
||||
std::string name = "";
|
||||
std::vector<Sampler> samplers;
|
||||
std::vector<Channel> channels;
|
||||
uf::stl::string name = "";
|
||||
uf::stl::vector<Sampler> samplers;
|
||||
uf::stl::vector<Channel> channels;
|
||||
float start = std::numeric_limits<float>::max();
|
||||
float end = std::numeric_limits<float>::min();
|
||||
float cur = 0;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <uf/engine/entity/entity.h>
|
||||
#include <uf/utils/singletons/pre_main.h>
|
||||
#include <uf/utils/string/ext.h>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
#include <typeindex>
|
||||
#include <functional>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
namespace pod {
|
||||
struct UF_API Instantiator {
|
||||
typedef std::function<uf::Entity*()> function_t;
|
||||
typedef std::vector<std::string> behaviors_t;
|
||||
typedef uf::stl::vector<uf::stl::string> behaviors_t;
|
||||
function_t function;
|
||||
behaviors_t behaviors;
|
||||
};
|
||||
@ -21,24 +21,24 @@ namespace pod {
|
||||
template<typename C>
|
||||
struct UF_API NamedTypes {
|
||||
typedef std::type_index type_t;
|
||||
typedef std::unordered_map<type_t, std::string> container_t;
|
||||
typedef std::unordered_map<std::string, C> map_t;
|
||||
typedef uf::stl::unordered_map<type_t, uf::stl::string> container_t;
|
||||
typedef uf::stl::unordered_map<uf::stl::string, C> map_t;
|
||||
container_t names;
|
||||
map_t map;
|
||||
|
||||
type_t getType( const std::string& name );
|
||||
type_t getType( const uf::stl::string& name );
|
||||
template<typename T> type_t getType();
|
||||
template<typename T> std::string getName();
|
||||
template<typename T> uf::stl::string getName();
|
||||
|
||||
bool has( const std::string& name, bool = true );
|
||||
bool has( const uf::stl::string& name, bool = true );
|
||||
template<typename T> bool has( bool = true );
|
||||
|
||||
template<typename T> void add( const std::string& name, const C& c );
|
||||
template<typename T> void add( const uf::stl::string& name, const C& c );
|
||||
|
||||
C& get( const std::string& name );
|
||||
C& get( const uf::stl::string& name );
|
||||
template<typename T> C& get();
|
||||
|
||||
C& operator[]( const std::string& name );
|
||||
C& operator[]( const uf::stl::string& name );
|
||||
};
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ namespace uf {
|
||||
namespace instantiator {
|
||||
extern UF_API pod::NamedTypes<pod::Instantiator>* objects;
|
||||
// extern UF_API pod::NamedTypes<pod::Behavior>* behaviors;
|
||||
extern UF_API std::unordered_map<std::string, pod::Behavior>* behaviors;
|
||||
extern UF_API uf::stl::unordered_map<uf::stl::string, pod::Behavior>* behaviors;
|
||||
|
||||
uf::Entity* UF_API alloc( size_t );
|
||||
template<typename T> T* alloc();
|
||||
@ -56,20 +56,20 @@ namespace uf {
|
||||
uf::Entity* UF_API reuse( size_t );
|
||||
size_t UF_API collect( uint8_t = 0 );
|
||||
|
||||
template<typename T> void registerObject( const std::string& name );
|
||||
// template<typename T> void registerBehavior( const std::string& name );
|
||||
template<typename T> void registerBinding( const std::string& name );
|
||||
void UF_API registerBehavior( const std::string& name, const pod::Behavior& );
|
||||
void UF_API registerBinding( const std::string& object, const std::string& behavior );
|
||||
template<typename T> void registerObject( const uf::stl::string& name );
|
||||
// template<typename T> void registerBehavior( const uf::stl::string& name );
|
||||
template<typename T> void registerBinding( const uf::stl::string& name );
|
||||
void UF_API registerBehavior( const uf::stl::string& name, const pod::Behavior& );
|
||||
void UF_API registerBinding( const uf::stl::string& object, const uf::stl::string& behavior );
|
||||
|
||||
uf::Entity& UF_API instantiate( const std::string& );
|
||||
uf::Entity& UF_API instantiate( const uf::stl::string& );
|
||||
template<typename T> T& instantiate();
|
||||
template<typename T> T* _instantiate();
|
||||
|
||||
void UF_API bind( const std::string&, uf::Entity& );
|
||||
void UF_API bind( const uf::stl::string&, uf::Entity& );
|
||||
template<typename T> void bind( uf::Entity& );
|
||||
|
||||
void UF_API unbind( const std::string&, uf::Entity& );
|
||||
void UF_API unbind( const uf::stl::string&, uf::Entity& );
|
||||
template<typename T> void unbind( uf::Entity& );
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include <uf/utils/type/type.h>
|
||||
|
||||
template<typename C>
|
||||
typename pod::NamedTypes<C>::type_t pod::NamedTypes<C>::getType( const std::string& name ) {
|
||||
typename pod::NamedTypes<C>::type_t pod::NamedTypes<C>::getType( const uf::stl::string& name ) {
|
||||
for ( auto pair : names ) if ( pair.second == name ) return pair.first;
|
||||
return getType<void>();
|
||||
}
|
||||
@ -10,23 +10,23 @@ template<typename T> typename pod::NamedTypes<C>::type_t pod::NamedTypes<C>::get
|
||||
return std::type_index(typeid(T));
|
||||
}
|
||||
template<typename C>
|
||||
template<typename T> std::string pod::NamedTypes<C>::getName() {
|
||||
template<typename T> uf::stl::string pod::NamedTypes<C>::getName() {
|
||||
return names[getType<T>()];
|
||||
}
|
||||
template<typename C>
|
||||
bool pod::NamedTypes<C>::has( const std::string& name, bool useNames ) {
|
||||
bool pod::NamedTypes<C>::has( const uf::stl::string& name, bool useNames ) {
|
||||
return useNames ? names.count(getType(name)) > 0 : map.count(name) > 0;
|
||||
}template<typename C>
|
||||
template<typename T> bool pod::NamedTypes<C>::has( bool useNames ) {
|
||||
return useNames ? names.count(getType<T>()) > 0 : map.count(getName<T>()) > 0;
|
||||
}
|
||||
template<typename C>
|
||||
template<typename T> void pod::NamedTypes<C>::add( const std::string& name, const C& c ) {
|
||||
template<typename T> void pod::NamedTypes<C>::add( const uf::stl::string& name, const C& c ) {
|
||||
names[getType<T>()] = name;
|
||||
map[name] = c;
|
||||
}
|
||||
template<typename C>
|
||||
C& pod::NamedTypes<C>::get( const std::string& name ) {
|
||||
C& pod::NamedTypes<C>::get( const uf::stl::string& name ) {
|
||||
return map[name];
|
||||
}
|
||||
template<typename C>
|
||||
@ -35,7 +35,7 @@ C& pod::NamedTypes<C>::get() {
|
||||
return map[getName<T>()];
|
||||
}
|
||||
template<typename C>
|
||||
C& pod::NamedTypes<C>::operator[]( const std::string& name ) {
|
||||
C& pod::NamedTypes<C>::operator[]( const uf::stl::string& name ) {
|
||||
return get(name);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ T* uf::instantiator::alloc() {
|
||||
return (T*) alloc( sizeof(T) );
|
||||
}
|
||||
|
||||
template<typename T> void uf::instantiator::registerObject( const std::string& name ) {
|
||||
template<typename T> void uf::instantiator::registerObject( const uf::stl::string& name ) {
|
||||
if ( !objects ) objects = new pod::NamedTypes<pod::Instantiator>;
|
||||
auto& container = *uf::instantiator::objects;
|
||||
container.add<T>(name, {
|
||||
@ -57,7 +57,7 @@ template<typename T> void uf::instantiator::registerObject( const std::string& n
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
template<typename T> void uf::instantiator::registerBehavior( const std::string& name ) {
|
||||
template<typename T> void uf::instantiator::registerBehavior( const uf::stl::string& name ) {
|
||||
if ( !behaviors ) behaviors = new pod::NamedTypes<pod::Behavior>;
|
||||
auto& container = *uf::instantiator::behaviors;
|
||||
container.add<T>(name, pod::Behavior{
|
||||
@ -73,7 +73,7 @@ template<typename T> void uf::instantiator::registerBehavior( const std::string&
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
template<typename T> void uf::instantiator::registerBinding( const std::string& name ) {
|
||||
template<typename T> void uf::instantiator::registerBinding( const uf::stl::string& name ) {
|
||||
if ( !objects ) objects = new pod::NamedTypes<pod::Instantiator>;
|
||||
auto& container = *uf::instantiator::objects;
|
||||
auto& instantiator = container.get<T>();
|
||||
|
||||
@ -31,7 +31,7 @@ namespace {\
|
||||
#define UF_OBJECT_REGISTER_BEGIN( OBJ )\
|
||||
namespace {\
|
||||
static uf::StaticInitialization TOKEN_PASTE(STATIC_INITIALIZATION_, __LINE__)( []{\
|
||||
std::string name = UF_NS_GET_LAST(OBJ);\
|
||||
uf::stl::string name = UF_NS_GET_LAST(OBJ);\
|
||||
uf::instantiator::registerObject<OBJ>( name );
|
||||
|
||||
#define UF_OBJECT_BIND_BEHAVIOR( BEHAVIOR )\
|
||||
@ -39,7 +39,7 @@ namespace {\
|
||||
|
||||
// uf::instantiator::registerBehavior<BEHAVIOR>( UF_NS_GET_LAST(BEHAVIOR) );
|
||||
#define UF_OBJECT_REGISTER_BEHAVIOR( BEHAVIOR )\
|
||||
if ( !uf::instantiator::behaviors ) uf::instantiator::behaviors = new std::unordered_map<std::string, pod::Behavior>;\
|
||||
if ( !uf::instantiator::behaviors ) uf::instantiator::behaviors = new uf::stl::unordered_map<uf::stl::string, pod::Behavior>;\
|
||||
uf::instantiator::registerBehavior(UF_NS_GET_LAST(BEHAVIOR), pod::Behavior{\
|
||||
.type = BEHAVIOR::type,\
|
||||
.initialize = BEHAVIOR::initialize,\
|
||||
@ -88,7 +88,7 @@ namespace {\
|
||||
#define UF_OBJECT_REGISTER_BEGIN( OBJ )\
|
||||
namespace {\
|
||||
static uf::StaticInitialization REGISTER_EXT_ ## OBJ( []{\
|
||||
std::string name = #OBJ;\
|
||||
uf::stl::string name = #OBJ;\
|
||||
uf::instantiator::registerObject<uf::OBJ>( name );
|
||||
|
||||
#define UF_OBJECT_BIND_BEHAVIOR( BEHAVIOR )\
|
||||
@ -105,7 +105,7 @@ namespace {\
|
||||
#define EXT_OBJECT_REGISTER_BEGIN( OBJ )\
|
||||
namespace {\
|
||||
static uf::StaticInitialization REGISTER_EXT_ ## OBJ( []{\
|
||||
std::string name = #OBJ;\
|
||||
uf::stl::string name = #OBJ;\
|
||||
uf::instantiator::registerObject<ext::OBJ>( name );
|
||||
|
||||
#define EXT_OBJECT_BIND_BEHAVIOR( BEHAVIOR )\
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
#include <uf/utils/math/transform.h>
|
||||
#include <uf/engine/behavior/behavior.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
|
||||
namespace uf {
|
||||
namespace ObjectBehavior {
|
||||
@ -19,18 +19,18 @@ namespace uf {
|
||||
void UF_API destroy( uf::Object& );
|
||||
struct Metadata {
|
||||
struct Queued {
|
||||
std::string name;
|
||||
uf::stl::string name;
|
||||
ext::json::Value payload;
|
||||
double timeout;
|
||||
};
|
||||
struct {
|
||||
size_t mtime = 0;
|
||||
bool enabled = false;
|
||||
std::string source = "";
|
||||
uf::stl::string source = "";
|
||||
} hotReload;
|
||||
struct {
|
||||
std::unordered_map<std::string, std::vector<size_t>> bound;
|
||||
std::vector<Queued> queue;
|
||||
uf::stl::unordered_map<uf::stl::string, uf::stl::vector<size_t>> bound;
|
||||
uf::stl::vector<Queued> queue;
|
||||
} hooks;
|
||||
struct {
|
||||
bool ignoreGraph = false;
|
||||
|
||||
@ -16,40 +16,40 @@ namespace uf {
|
||||
Object();
|
||||
|
||||
bool reload( bool = false );
|
||||
bool load( const std::string&, bool = false );
|
||||
bool load( const uf::stl::string&, bool = false );
|
||||
bool load( const uf::Serializer& );
|
||||
|
||||
uf::Object& loadChild( const uf::Serializer&, bool = true );
|
||||
uf::Object* loadChildPointer( const uf::Serializer&, bool = true );
|
||||
std::size_t loadChildUid( const uf::Serializer&, bool = true );
|
||||
|
||||
uf::Object& loadChild( const std::string&, bool = true );
|
||||
uf::Object* loadChildPointer( const std::string&, bool = true );
|
||||
std::size_t loadChildUid( const std::string&, bool = true );
|
||||
uf::Object& loadChild( const uf::stl::string&, bool = true );
|
||||
uf::Object* loadChildPointer( const uf::stl::string&, bool = true );
|
||||
std::size_t loadChildUid( const uf::stl::string&, bool = true );
|
||||
|
||||
template<typename T>
|
||||
T loadChild( const uf::Serializer&, bool = true );
|
||||
template<typename T>
|
||||
T loadChild( const std::string&, bool = true );
|
||||
T loadChild( const uf::stl::string&, bool = true );
|
||||
|
||||
std::string formatHookName( const std::string& name );
|
||||
static std::string formatHookName( const std::string& name, size_t uid, bool fetch = true );
|
||||
uf::stl::string formatHookName( const uf::stl::string& name );
|
||||
static uf::stl::string formatHookName( const uf::stl::string& name, size_t uid, bool fetch = true );
|
||||
|
||||
void queueHook( const std::string&, const ext::json::Value& = ext::json::null(), double = 0 );
|
||||
uf::Hooks::return_t callHook( const std::string& );
|
||||
uf::Hooks::return_t callHook( const std::string&, const ext::json::Value& );
|
||||
uf::Hooks::return_t callHook( const std::string&, const uf::Serializer& );
|
||||
void queueHook( const uf::stl::string&, const ext::json::Value& = ext::json::null(), double = 0 );
|
||||
uf::Hooks::return_t callHook( const uf::stl::string& );
|
||||
uf::Hooks::return_t callHook( const uf::stl::string&, const ext::json::Value& );
|
||||
uf::Hooks::return_t callHook( const uf::stl::string&, const uf::Serializer& );
|
||||
|
||||
template<typename T> size_t addHook( const std::string& name, T function );
|
||||
template<typename T> uf::Hooks::return_t callHook( const std::string& name, const T& payload );
|
||||
template<typename T> size_t addHook( const uf::stl::string& name, T function );
|
||||
template<typename T> uf::Hooks::return_t callHook( const uf::stl::string& name, const T& payload );
|
||||
|
||||
std::string grabURI( const std::string& filename, const std::string& root = "" );
|
||||
uf::stl::string grabURI( const uf::stl::string& filename, const uf::stl::string& root = "" );
|
||||
};
|
||||
}
|
||||
|
||||
namespace uf {
|
||||
namespace string {
|
||||
std::string UF_API toString( const uf::Object& object );
|
||||
uf::stl::string UF_API toString( const uf::Object& object );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ T uf::Object::loadChild( const uf::Serializer& json, bool initialize ) {
|
||||
return this->loadChild(json, initialize);
|
||||
}
|
||||
template<typename T>
|
||||
T uf::Object::loadChild( const std::string& filename, bool initialize ) {
|
||||
T uf::Object::loadChild( const uf::stl::string& filename, bool initialize ) {
|
||||
// T is size_t
|
||||
if ( typeid(T) == typeid(std::size_t) ) return this->loadChildUid(filename, initialize);
|
||||
// T is pointer
|
||||
@ -17,8 +17,8 @@ T uf::Object::loadChild( const std::string& filename, bool initialize ) {
|
||||
return this->loadChild(filename, initialize);
|
||||
}
|
||||
template<typename T>
|
||||
size_t uf::Object::addHook( const std::string& name, T callback ) {
|
||||
std::string parsed = this->formatHookName( name );
|
||||
size_t uf::Object::addHook( const uf::stl::string& name, T callback ) {
|
||||
uf::stl::string parsed = this->formatHookName( name );
|
||||
std::size_t id = uf::hooks.addHook( parsed, callback );
|
||||
#if UF_ENTITY_METADATA_USE_JSON
|
||||
auto& metadata = this->getComponent<uf::Serializer>();
|
||||
@ -30,7 +30,7 @@ size_t uf::Object::addHook( const std::string& name, T callback ) {
|
||||
return id;
|
||||
}
|
||||
template<typename T>
|
||||
uf::Hooks::return_t uf::Object::callHook( const std::string& name, const T& p ) {
|
||||
uf::Hooks::return_t uf::Object::callHook( const uf::stl::string& name, const T& p ) {
|
||||
uf::Userdata payload;
|
||||
payload.create<T>(p);
|
||||
return uf::hooks.call( this->formatHookName( name ), payload );
|
||||
|
||||
@ -9,7 +9,7 @@ namespace uf {
|
||||
void UF_API render( uf::Object& );
|
||||
void UF_API destroy( uf::Object& );
|
||||
struct Metadata {
|
||||
std::vector<uf::Entity*> graph;
|
||||
uf::stl::vector<uf::Entity*> graph;
|
||||
bool invalidationQueued = false;
|
||||
struct {
|
||||
uf::Entity* controller = NULL;
|
||||
|
||||
@ -12,8 +12,8 @@ namespace uf {
|
||||
uf::Entity& getController();
|
||||
const uf::Entity& getController() const;
|
||||
|
||||
const std::vector<uf::Entity*>& getGraph();
|
||||
std::vector<uf::Entity*> getGraph( bool );
|
||||
const uf::stl::vector<uf::Entity*>& getGraph();
|
||||
uf::stl::vector<uf::Entity*> getGraph( bool );
|
||||
void invalidateGraph();
|
||||
|
||||
template<typename T> T& getController() {
|
||||
@ -25,18 +25,18 @@ namespace uf {
|
||||
};
|
||||
|
||||
namespace scene {
|
||||
extern UF_API std::vector<uf::Scene*> scenes;
|
||||
// extern UF_API std::vector<uf::Entity*> graph;
|
||||
extern UF_API uf::stl::vector<uf::Scene*> scenes;
|
||||
// extern UF_API uf::stl::vector<uf::Entity*> graph;
|
||||
// extern UF_API bool queuedInvalidation;
|
||||
// extern UF_API bool useGraph;
|
||||
// void UF_API invalidateGraph();
|
||||
// std::vector<uf::Entity*> UF_API generateGraph( bool = false );
|
||||
// uf::stl::vector<uf::Entity*> UF_API generateGraph( bool = false );
|
||||
|
||||
void UF_API invalidateGraphs();
|
||||
|
||||
Scene& UF_API getCurrentScene();
|
||||
Scene& UF_API loadScene( const std::string& name, const std::string& filename = "" );
|
||||
Scene& UF_API loadScene( const std::string& name, const uf::Serializer& );
|
||||
Scene& UF_API loadScene( const uf::stl::string& name, const uf::stl::string& filename = "" );
|
||||
Scene& UF_API loadScene( const uf::stl::string& name, const uf::Serializer& );
|
||||
void UF_API unloadScene();
|
||||
|
||||
void UF_API tick();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
#if !defined(EXT_STATIC)
|
||||
#if defined(UF_ENV_WINDOWS)
|
||||
@ -36,11 +36,11 @@
|
||||
#define EXT_API EXT_API_IMPORT
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/serialize/serializer.h>
|
||||
namespace ext {
|
||||
extern bool EXT_API ready;
|
||||
extern std::vector<std::string> EXT_API arguments;
|
||||
extern uf::stl::vector<uf::stl::string> EXT_API arguments;
|
||||
extern uf::Serializer EXT_API config;
|
||||
|
||||
extern void EXT_API load();
|
||||
|
||||
@ -29,8 +29,8 @@ namespace ext {
|
||||
UF_API bool initialized();
|
||||
UF_API void terminate();
|
||||
|
||||
UF_API ext::freetype::Glyph initialize( const std::string& );
|
||||
UF_API bool initialize( ext::freetype::Glyph&, const std::string& );
|
||||
UF_API ext::freetype::Glyph initialize( const uf::stl::string& );
|
||||
UF_API bool initialize( ext::freetype::Glyph&, const uf::stl::string& );
|
||||
UF_API void destroy( ext::freetype::Glyph& );
|
||||
|
||||
UF_API void setPixelSizes( ext::freetype::Glyph&, int );
|
||||
@ -39,7 +39,7 @@ namespace ext {
|
||||
UF_API bool load( ext::freetype::Glyph&, unsigned long );
|
||||
UF_API bool load( ext::freetype::Glyph&, const uf::String& );
|
||||
|
||||
UF_API std::string getError( int );
|
||||
UF_API uf::stl::string getError( int );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/string.h>
|
||||
|
||||
namespace ext {
|
||||
namespace glfw {
|
||||
@ -14,16 +14,16 @@ namespace ext {
|
||||
protected:
|
||||
size_t m_width;
|
||||
size_t m_height;
|
||||
std::string m_title;
|
||||
uf::stl::string m_title;
|
||||
GLFWwindow* m_window;
|
||||
public:
|
||||
void initialize( size_t width = 800, size_t height = 600, const std::string& title = "Window" );
|
||||
void initialize( size_t width = 800, size_t height = 600, const uf::stl::string& title = "Window" );
|
||||
void createSurface( VkInstance instance, VkSurfaceKHR& surface );
|
||||
void destroy();
|
||||
bool loop();
|
||||
void poll();
|
||||
bool minimized();
|
||||
std::vector<const char*> getExtensions( bool );
|
||||
uf::stl::vector<const char*> getExtensions( bool );
|
||||
operator GLFWwindow*();
|
||||
};
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
namespace ext {
|
||||
namespace gltf {
|
||||
pod::Graph UF_API load( const std::string&, uf::graph::load_mode_t = 0, const uf::Serializer& = {} );
|
||||
void UF_API save( const std::string&, const pod::Graph& );
|
||||
pod::Graph UF_API load( const uf::stl::string&, uf::graph::load_mode_t = 0, const uf::Serializer& = {} );
|
||||
void UF_API save( const uf::stl::string&, const pod::Graph& );
|
||||
}
|
||||
}
|
||||
@ -30,29 +30,29 @@ namespace ext {
|
||||
// cares not about breaking
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(ext::json::Value&)>& function );
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(size_t, ext::json::Value&)>& function );
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(const std::string&, ext::json::Value&)>& function );
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(const uf::stl::string&, ext::json::Value&)>& function );
|
||||
|
||||
// handles breaks
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(ext::json::Value&, bool&)>& function );
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(size_t, ext::json::Value&, bool&)>& function );
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(const std::string&, ext::json::Value&, bool&)>& function );
|
||||
void UF_API forEach( ext::json::Value& json, const std::function<void(const uf::stl::string&, ext::json::Value&, bool&)>& function );
|
||||
|
||||
// const
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(const ext::json::Value&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(const ext::json::Value&, bool&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(size_t, const ext::json::Value&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(const std::string&, const ext::json::Value&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(const uf::stl::string&, const ext::json::Value&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(size_t, const ext::json::Value&, bool&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(const std::string&, const ext::json::Value&, bool&)>& function );
|
||||
void UF_API forEach( const ext::json::Value& json, const std::function<void(const uf::stl::string&, const ext::json::Value&, bool&)>& function );
|
||||
|
||||
ext::json::Value UF_API reencode( const ext::json::Value& json, const ext::json::EncodingSettings& settings );
|
||||
ext::json::Value& UF_API reencode( ext::json::Value& json, const ext::json::EncodingSettings& settings );
|
||||
|
||||
std::string UF_API encode( const ext::json::Value& json, bool pretty = true );
|
||||
std::string UF_API encode( const ext::json::Value& json, const ext::json::EncodingSettings& settings );
|
||||
ext::json::Value& UF_API decode( ext::json::Value& json, const std::string& str );
|
||||
uf::stl::string UF_API encode( const ext::json::Value& json, bool pretty = true );
|
||||
uf::stl::string UF_API encode( const ext::json::Value& json, const ext::json::EncodingSettings& settings );
|
||||
ext::json::Value& UF_API decode( ext::json::Value& json, const uf::stl::string& str );
|
||||
#if UF_USE_LUA
|
||||
std::string UF_API encode( const sol::table& table );
|
||||
uf::stl::string UF_API encode( const sol::table& table );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,7 @@ namespace ext {
|
||||
inline Value object() { return Value(Json::objectValue); }
|
||||
inline Value null() { return Value(Json::nullValue); }
|
||||
|
||||
inline std::vector<std::string> keys( const Value& v ) { return v.getMemberNames(); }
|
||||
inline uf::stl::vector<uf::stl::string> keys( const Value& v ) { return v.getMemberNames(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
|
||||
#include <uf/config.h>
|
||||
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/string.h>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <nlohmann/fifo_map.hpp>
|
||||
|
||||
@ -45,7 +48,7 @@ namespace ext {
|
||||
inline Value null() { return Value(); }
|
||||
Value& UF_API reserve( Value& value, size_t size );
|
||||
|
||||
std::vector<std::string> UF_API keys( const Value& v );
|
||||
uf::stl::vector<uf::stl::string> UF_API keys( const Value& v );
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -90,7 +93,7 @@ template<> inline bool ext::json::Value::is<uint32_t>(bool strict) const { retur
|
||||
template<> inline bool ext::json::Value::is<uint64_t>(bool strict) const { return strict ? is_number_unsigned() : is_number(); }
|
||||
template<> inline bool ext::json::Value::is<float>(bool strict) const { return strict ? is_number_float() : is_number(); }
|
||||
template<> inline bool ext::json::Value::is<double>(bool strict) const { return strict ? is_number_float() : is_number(); }
|
||||
template<> inline bool ext::json::Value::is<std::string>(bool strict) const { return is_string(); }
|
||||
template<> inline bool ext::json::Value::is<uf::stl::string>(bool strict) const { return is_string(); }
|
||||
|
||||
#if UF_ENV_DREAMCAST
|
||||
template<> inline bool ext::json::Value::is<int>(bool strict) const { return strict ? is_number_integer() : is_number(); }
|
||||
@ -116,7 +119,7 @@ template<> inline bool ext::json::Value::as<bool>() const {
|
||||
// implicit conversion
|
||||
if ( is_null() ) return false; // always return falce
|
||||
if ( is_number() ) return get<int>(); // implicit conversion to bool
|
||||
if ( is_string() ) return get<std::string>() != ""; // true if not empty
|
||||
if ( is_string() ) return get<uf::stl::string>() != ""; // true if not empty
|
||||
if ( is_object() ) return !ext::json::keys( *this ).empty(); // true if not empty
|
||||
if ( is_array() ) return size() > 0; // true if not empty
|
||||
return false;
|
||||
|
||||
@ -39,7 +39,7 @@ namespace ext {
|
||||
}
|
||||
inline Value null() { return Value(); }
|
||||
|
||||
std::vector<std::string> UF_API keys( const Value& v );
|
||||
uf::stl::vector<uf::stl::string> UF_API keys( const Value& v );
|
||||
static rapidjson::Document::AllocatorType allocator;
|
||||
|
||||
struct Document : public rapidjson::Document {
|
||||
@ -53,7 +53,7 @@ namespace ext {
|
||||
}
|
||||
|
||||
template<typename... Args> ext::json::Value& ext::json::Value::operator[]( Args... args ) {
|
||||
const std::string k(args...);
|
||||
const uf::stl::string k(args...);
|
||||
auto key = rapidjson::StringRef(k.c_str());
|
||||
auto it = ext::json::base_value::FindMember(key);
|
||||
if ( it != ext::json::base_value::MemberEnd() )
|
||||
@ -64,7 +64,7 @@ template<typename... Args> ext::json::Value& ext::json::Value::operator[]( Args.
|
||||
return this->operator[](args...);
|
||||
}
|
||||
template<typename... Args> const ext::json::Value& ext::json::Value::operator[]( Args... args ) const {
|
||||
const std::string k(args...);
|
||||
const uf::stl::string k(args...);
|
||||
auto key = rapidjson::StringRef(k.c_str());
|
||||
auto it = ext::json::base_value::FindMember(key);
|
||||
if ( it != ext::json::base_value::MemberEnd() )
|
||||
@ -72,7 +72,7 @@ template<typename... Args> const ext::json::Value& ext::json::Value::operator[](
|
||||
|
||||
return ext::json::base_value();
|
||||
}
|
||||
template<> inline ext::json::Value& ext::json::Value::operator=<std::string>( std::string v ) {
|
||||
template<> inline ext::json::Value& ext::json::Value::operator=<uf::stl::string>( uf::stl::string v ) {
|
||||
ext::json::base_value::SetString( v.c_str(), ext::json::allocator );
|
||||
return *this;
|
||||
}
|
||||
@ -98,7 +98,7 @@ template<> inline ext::json::Value& ext::json::Value::operator=<double>( double
|
||||
}
|
||||
|
||||
template<typename... Args> ext::json::Value& ext::json::Document::operator[]( Args... args ) {
|
||||
const std::string k(args...);
|
||||
const uf::stl::string k(args...);
|
||||
auto key = rapidjson::StringRef(k.c_str());
|
||||
auto it = rapidjson::Document::FindMember(key);
|
||||
if ( it != rapidjson::Document::MemberEnd() )
|
||||
@ -109,7 +109,7 @@ template<typename... Args> ext::json::Value& ext::json::Document::operator[]( Ar
|
||||
return this->operator[](args...);
|
||||
}
|
||||
template<typename... Args> const ext::json::Value& ext::json::Document::operator[]( Args... args ) const {
|
||||
const std::string k(args...);
|
||||
const uf::stl::string k(args...);
|
||||
auto key = rapidjson::StringRef(k.c_str());
|
||||
auto it = rapidjson::Document::FindMember(key);
|
||||
if ( it != rapidjson::Document::MemberEnd() )
|
||||
@ -123,14 +123,14 @@ template<> inline bool ext::json::Value::is<int>() const { return IsInt64(); }
|
||||
template<> inline bool ext::json::Value::is<size_t>() const { return IsUint64(); }
|
||||
template<> inline bool ext::json::Value::is<float>() const { return IsDouble(); }
|
||||
template<> inline bool ext::json::Value::is<double>() const { return IsDouble(); }
|
||||
template<> inline bool ext::json::Value::is<std::string>() const { return IsString(); }
|
||||
template<> inline bool ext::json::Value::is<uf::stl::string>() const { return IsString(); }
|
||||
|
||||
template<> inline bool ext::json::Value::get<bool>() const { return GetBool(); }
|
||||
template<> inline int ext::json::Value::get<int>() const { return GetInt(); }
|
||||
template<> inline size_t ext::json::Value::get<size_t>() const { return GetUint64(); }
|
||||
template<> inline float ext::json::Value::get<float>() const { return GetDouble(); }
|
||||
template<> inline double ext::json::Value::get<double>() const { return GetDouble(); }
|
||||
template<> inline std::string ext::json::Value::get<std::string>() const { return GetString(); }
|
||||
template<> inline uf::stl::string ext::json::Value::get<uf::stl::string>() const { return GetString(); }
|
||||
|
||||
template<typename T> inline T ext::json::Value::as() const {
|
||||
if ( !is<T>() ) return T();
|
||||
@ -140,7 +140,7 @@ template<> inline bool ext::json::Value::as<bool>() const {
|
||||
if ( is<bool>() ) return get<bool>();
|
||||
if ( IsNull() ) return false;
|
||||
if ( IsNumber() ) return get<int>() != 0;
|
||||
if ( IsString() ) return get<std::string>() != "";
|
||||
if ( IsString() ) return get<uf::stl::string>() != "";
|
||||
if ( IsObject() ) return !ext::json::keys( *this ).empty();
|
||||
if ( IsArray() ) return size() > 0;
|
||||
return false;
|
||||
|
||||
@ -16,13 +16,13 @@
|
||||
#endif
|
||||
|
||||
#include <sol/sol.hpp>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
#include <uf/utils/singletons/pre_main.h>
|
||||
#include <uf/utils/string/ext.h>
|
||||
|
||||
namespace pod {
|
||||
struct UF_API LuaScript {
|
||||
std::string file;
|
||||
uf::stl::string file;
|
||||
sol::environment env;
|
||||
};
|
||||
}
|
||||
@ -30,23 +30,23 @@ namespace pod {
|
||||
namespace ext {
|
||||
namespace lua {
|
||||
extern UF_API sol::state state;
|
||||
extern UF_API std::string main;
|
||||
extern UF_API std::unordered_map<std::string, std::string> modules;
|
||||
extern UF_API std::vector<std::function<void()>>* onInitializationFunctions;
|
||||
extern UF_API uf::stl::string main;
|
||||
extern UF_API uf::stl::unordered_map<uf::stl::string, uf::stl::string> modules;
|
||||
extern UF_API uf::stl::vector<std::function<void()>>* onInitializationFunctions;
|
||||
|
||||
void UF_API initialize();
|
||||
void UF_API terminate();
|
||||
void UF_API onInitialization( const std::function<void()>& );
|
||||
|
||||
bool UF_API run( const std::string&, bool = true );
|
||||
bool UF_API run( const uf::stl::string&, bool = true );
|
||||
|
||||
pod::LuaScript UF_API script( const std::string& );
|
||||
pod::LuaScript UF_API script( const uf::stl::string& );
|
||||
bool UF_API run( const pod::LuaScript&, bool = true );
|
||||
|
||||
sol::table createTable();
|
||||
std::string sanitize( const std::string& dirty, int index = -1 );
|
||||
std::optional<std::string> encode( sol::table table );
|
||||
std::optional<sol::table> decode( const std::string& string );
|
||||
uf::stl::string sanitize( const uf::stl::string& dirty, int index = -1 );
|
||||
std::optional<uf::stl::string> encode( sol::table table );
|
||||
std::optional<sol::table> decode( const uf::stl::string& string );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
namespace {\
|
||||
static uf::StaticInitialization TOKEN_PASTE(STATIC_INITIALIZATION_, __LINE__)( []{\
|
||||
ext::lua::onInitialization( []{\
|
||||
std::string name = UF_NS_GET_LAST(type);\
|
||||
uf::stl::string name = UF_NS_GET_LAST(type);\
|
||||
auto usertype = ext::lua::state.new_usertype<type>(name);
|
||||
|
||||
#define UF_LUA_REGISTER_USERTYPE_DEFINE_RT(k, v) usertype[#k] = v;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include <uf/config.h>
|
||||
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
|
||||
namespace ext {
|
||||
class UF_API Ncurses {
|
||||
@ -34,7 +34,7 @@ namespace ext {
|
||||
void UF_API_CALL delCh();
|
||||
void UF_API_CALL addCh( char c );
|
||||
void UF_API_CALL addStr(const char* c_str);
|
||||
void UF_API_CALL addStr(const std::string str);
|
||||
void UF_API_CALL addStr(const uf::stl::string str);
|
||||
|
||||
void UF_API_CALL attrOn(int att);
|
||||
void UF_API_CALL attrOff(int att);
|
||||
@ -47,7 +47,7 @@ namespace ext {
|
||||
inline int UF_API_CALL getChar() { return this->getCh(); }
|
||||
inline void UF_API_CALL delChar() { this->delCh(); }
|
||||
inline void UF_API_CALL addChar( char c ) { this->addCh( c ); }
|
||||
inline void UF_API_CALL addString( const std::string& str ) { this->addStr( str.c_str() ); }
|
||||
inline void UF_API_CALL addString( const uf::stl::string& str ) { this->addStr( str.c_str() ); }
|
||||
inline void UF_API_CALL attribute(int att, bool on = true) { on ? this->attrOn(att) : this->attrOff(att); }
|
||||
};
|
||||
extern UF_API ext::Ncurses ncurses;
|
||||
|
||||
@ -11,7 +11,7 @@ namespace ext {
|
||||
namespace al {
|
||||
class UF_API Buffer {
|
||||
protected:
|
||||
std::vector<ALuint> m_indices;
|
||||
uf::stl::vector<ALuint> m_indices;
|
||||
public:
|
||||
// Buffer( size_t = 1 );
|
||||
// ~Buffer();
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alut.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
#define AL_CHECK_RESULT(f) {\
|
||||
(f);\
|
||||
@ -16,7 +16,7 @@
|
||||
if ( error != AL_NO_ERROR ) UF_MSG_ERROR("AL error: " << ext::al::getError(error) << ": " << #f);\
|
||||
}
|
||||
|
||||
// std::string errorString = alutGetErrorString(alutGetError());
|
||||
// uf::stl::string errorString = alutGetErrorString(alutGetError());
|
||||
// if ( errorString != "No ALUT error found" ) UF_MSG_ERROR("AL error: " << errorString);
|
||||
|
||||
#include "source.h"
|
||||
@ -35,18 +35,18 @@ namespace ext {
|
||||
void UF_API listener( ALenum name, ALfloat x, ALfloat y, ALfloat z );
|
||||
void UF_API listener( ALenum name, const ALfloat* f );
|
||||
|
||||
void UF_API listener( const std::string& name, ALfloat x );
|
||||
void UF_API listener( const std::string& name, ALfloat x, ALfloat y, ALfloat z );
|
||||
void UF_API listener( const std::string& name, const ALfloat* f );
|
||||
void UF_API listener( const uf::stl::string& name, ALfloat x );
|
||||
void UF_API listener( const uf::stl::string& name, ALfloat x, ALfloat y, ALfloat z );
|
||||
void UF_API listener( const uf::stl::string& name, const ALfloat* f );
|
||||
*/
|
||||
|
||||
std::string UF_API getError( ALenum = 0 );
|
||||
uf::stl::string UF_API getError( ALenum = 0 );
|
||||
|
||||
uf::audio::Metadata* UF_API create( const std::string&, bool, uint8_t );
|
||||
uf::audio::Metadata* UF_API open( const std::string& );
|
||||
uf::audio::Metadata* UF_API open( const std::string&, bool );
|
||||
uf::audio::Metadata* UF_API load( const std::string& );
|
||||
uf::audio::Metadata* UF_API stream( const std::string& );
|
||||
uf::audio::Metadata* UF_API create( const uf::stl::string&, bool, uint8_t );
|
||||
uf::audio::Metadata* UF_API open( const uf::stl::string& );
|
||||
uf::audio::Metadata* UF_API open( const uf::stl::string&, bool );
|
||||
uf::audio::Metadata* UF_API load( const uf::stl::string& );
|
||||
uf::audio::Metadata* UF_API stream( const uf::stl::string& );
|
||||
void UF_API update( uf::audio::Metadata& );
|
||||
|
||||
void UF_API close( uf::audio::Metadata* );
|
||||
|
||||
@ -38,21 +38,21 @@ namespace ext {
|
||||
void set( ALenum name, ALint x, ALint y, ALint z );
|
||||
void set( ALenum name, const ALint* f );
|
||||
|
||||
void get( const std::string& name, ALfloat& x );
|
||||
void get( const std::string& name, ALfloat& x, ALfloat& y, ALfloat& z );
|
||||
void get( const std::string& name, ALfloat* f );
|
||||
void get( const uf::stl::string& name, ALfloat& x );
|
||||
void get( const uf::stl::string& name, ALfloat& x, ALfloat& y, ALfloat& z );
|
||||
void get( const uf::stl::string& name, ALfloat* f );
|
||||
|
||||
void get( const std::string& name, ALint& x );
|
||||
void get( const std::string& name, ALint& x, ALint& y, ALint& z );
|
||||
void get( const std::string& name, ALint* f );
|
||||
void get( const uf::stl::string& name, ALint& x );
|
||||
void get( const uf::stl::string& name, ALint& x, ALint& y, ALint& z );
|
||||
void get( const uf::stl::string& name, ALint* f );
|
||||
|
||||
void set( const std::string& name, ALfloat x );
|
||||
void set( const std::string& name, ALfloat x, ALfloat y, ALfloat z );
|
||||
void set( const std::string& name, const ALfloat* f );
|
||||
void set( const uf::stl::string& name, ALfloat x );
|
||||
void set( const uf::stl::string& name, ALfloat x, ALfloat y, ALfloat z );
|
||||
void set( const uf::stl::string& name, const ALfloat* f );
|
||||
|
||||
void set( const std::string& name, ALint x );
|
||||
void set( const std::string& name, ALint x, ALint y, ALint z );
|
||||
void set( const std::string& name, const ALint* f );
|
||||
void set( const uf::stl::string& name, ALint x );
|
||||
void set( const uf::stl::string& name, ALint x, ALint y, ALint z );
|
||||
void set( const uf::stl::string& name, const ALint* f );
|
||||
|
||||
void play();
|
||||
void stop();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/ext/opengl/ogl.h>
|
||||
#include <uf/ext/opengl/enums.h>
|
||||
|
||||
@ -59,7 +59,7 @@ namespace ext {
|
||||
void destroy();
|
||||
};
|
||||
struct UF_API Buffers {
|
||||
std::vector<Buffer> buffers;
|
||||
uf::stl::vector<Buffer> buffers;
|
||||
Device* device;
|
||||
|
||||
// ~Buffers();
|
||||
|
||||
@ -103,7 +103,7 @@ namespace ext {
|
||||
|
||||
Device* device;
|
||||
size_t state = 0;
|
||||
std::vector<CommandBuffer::userdata_t> infos;
|
||||
uf::stl::vector<CommandBuffer::userdata_t> infos;
|
||||
std::mutex* mutex;
|
||||
|
||||
void initialize( Device& device );
|
||||
@ -121,8 +121,8 @@ namespace ext {
|
||||
protected:
|
||||
pod::Matrix4f bindUniform( const Buffer::Descriptor& descriptor );
|
||||
void drawIndexed( const InfoDraw& );
|
||||
// void draw( const InfoDraw&, const Info&, const std::vector<InfoTexture*>& = {} );
|
||||
// void drawIndexed( const InfoDraw&, const Info&, const Info&, const std::vector<InfoTexture*>& = {} );
|
||||
// void draw( const InfoDraw&, const Info&, const uf::stl::vector<InfoTexture*>& = {} );
|
||||
// void drawIndexed( const InfoDraw&, const Info&, const Info&, const uf::stl::vector<InfoTexture*>& = {} );
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ namespace ext {
|
||||
|
||||
enums::Command::type_t type;
|
||||
std::deque<handle_t> available;
|
||||
std::vector<handle_t> pool;
|
||||
uf::stl::vector<handle_t> pool;
|
||||
|
||||
void allocate();
|
||||
void allocate(size_t);
|
||||
|
||||
@ -19,7 +19,7 @@ namespace ext {
|
||||
#if !UF_USE_OPENGL_FIXED_FUNCTION
|
||||
GLuint pipeline;
|
||||
GLuint vertexArray;
|
||||
std::vector<Buffer::Descriptor> descriptorSet;
|
||||
uf::stl::vector<Buffer::Descriptor> descriptorSet;
|
||||
#endif
|
||||
|
||||
struct Descriptor {
|
||||
@ -30,7 +30,7 @@ namespace ext {
|
||||
struct {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string type = "";
|
||||
uf::stl::string type = "";
|
||||
bool process = true;
|
||||
} metadata;
|
||||
|
||||
@ -45,22 +45,22 @@ namespace ext {
|
||||
bool aliased = false;
|
||||
Device* device;
|
||||
|
||||
std::vector<Sampler> samplers;
|
||||
std::vector<Texture> textures;
|
||||
std::vector<Shader> shaders;
|
||||
uf::stl::vector<Sampler> samplers;
|
||||
uf::stl::vector<Texture> textures;
|
||||
uf::stl::vector<Shader> shaders;
|
||||
struct Metadata {
|
||||
uf::Serializer json;
|
||||
std::unordered_map<std::string, size_t> shaders;
|
||||
uf::stl::unordered_map<uf::stl::string, size_t> shaders;
|
||||
} metadata;
|
||||
|
||||
void initialize( Device& device );
|
||||
void destroy();
|
||||
|
||||
void attachShader( const std::string&, enums::Shader::type_t, const std::string& pipeline = "" );
|
||||
void initializeShaders( const std::vector<std::pair<std::string, enums::Shader::type_t>>&, const std::string& pipeline = "" );
|
||||
void attachShader( const uf::stl::string&, enums::Shader::type_t, const uf::stl::string& pipeline = "" );
|
||||
void initializeShaders( const uf::stl::vector<std::pair<uf::stl::string, enums::Shader::type_t>>&, const uf::stl::string& pipeline = "" );
|
||||
|
||||
bool hasShader( const std::string& type, const std::string& pipeline = "" );
|
||||
Shader& getShader( const std::string& type, const std::string& pipeline = "" );
|
||||
bool hasShader( const uf::stl::string& type, const uf::stl::string& pipeline = "" );
|
||||
Shader& getShader( const uf::stl::string& type, const uf::stl::string& pipeline = "" );
|
||||
|
||||
bool validate();
|
||||
};
|
||||
@ -70,14 +70,14 @@ namespace ext {
|
||||
bool initialized = false;
|
||||
bool process = true;
|
||||
Material material;
|
||||
std::unordered_map<GraphicDescriptor::hash_t, Pipeline> pipelines;
|
||||
uf::stl::unordered_map<GraphicDescriptor::hash_t, Pipeline> pipelines;
|
||||
|
||||
struct {
|
||||
std::unordered_map<std::string, size_t> buffers;
|
||||
uf::stl::unordered_map<uf::stl::string, size_t> buffers;
|
||||
} metadata;
|
||||
|
||||
~Graphic();
|
||||
void initialize( const std::string& = "" );
|
||||
void initialize( const uf::stl::string& = "" );
|
||||
void destroy();
|
||||
|
||||
template<typename T, typename U>
|
||||
@ -94,10 +94,10 @@ namespace ext {
|
||||
void record( CommandBuffer& commandBuffer, size_t pass = 0, size_t draw = 0 );
|
||||
void record( CommandBuffer& commandBuffer, GraphicDescriptor& descriptor, size_t pass = 0, size_t draw = 0 );
|
||||
|
||||
bool hasStorage( const std::string& name );
|
||||
Buffer* getStorageBuffer( const std::string& name );
|
||||
uf::Serializer getStorageJson( const std::string& name, bool cache = true );
|
||||
ext::opengl::userdata_t getStorageUserdata( const std::string& name, const ext::json::Value& payload );
|
||||
bool hasStorage( const uf::stl::string& name );
|
||||
Buffer* getStorageBuffer( const uf::stl::string& name );
|
||||
uf::Serializer getStorageJson( const uf::stl::string& name, bool cache = true );
|
||||
ext::opengl::userdata_t getStorageUserdata( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
|
||||
Buffer::Descriptor getUniform( size_t = 0 ) const;
|
||||
void updateUniform( void*, size_t, size_t = 0 );
|
||||
|
||||
@ -18,10 +18,10 @@ namespace ext {
|
||||
extern UF_API size_t viewCount;
|
||||
constexpr size_t maxViews = 6;
|
||||
|
||||
extern UF_API std::vector<std::string> validationFilters;
|
||||
extern UF_API std::vector<std::string> requestedDeviceFeatures;
|
||||
extern UF_API std::vector<std::string> requestedDeviceExtensions;
|
||||
extern UF_API std::vector<std::string> requestedInstanceExtensions;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> validationFilters;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> requestedDeviceFeatures;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> requestedDeviceExtensions;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> requestedInstanceExtensions;
|
||||
|
||||
extern UF_API ext::opengl::enums::Filter::type_t swapchainUpscaleFilter;
|
||||
|
||||
@ -31,7 +31,7 @@ namespace ext {
|
||||
extern UF_API bool individualPipelines;
|
||||
extern UF_API bool multithreadedCommandRecording;
|
||||
extern UF_API bool multithreadedCommandRendering;
|
||||
extern UF_API std::string deferredMode;
|
||||
extern UF_API uf::stl::string deferredMode;
|
||||
extern UF_API bool deferredReconstructPosition;
|
||||
extern UF_API bool deferredAliasOutputToSwapchain;
|
||||
extern UF_API bool multiview;
|
||||
@ -61,14 +61,14 @@ namespace ext {
|
||||
extern UF_API std::mutex immediateModeMutex;
|
||||
|
||||
extern UF_API RenderMode* currentRenderMode;
|
||||
extern UF_API std::vector<RenderMode*> renderModes;
|
||||
extern UF_API std::vector<uf::Scene*> scenes;
|
||||
extern UF_API uf::stl::vector<RenderMode*> renderModes;
|
||||
extern UF_API uf::stl::vector<uf::Scene*> scenes;
|
||||
|
||||
bool UF_API hasRenderMode( const std::string&, bool = true );
|
||||
RenderMode& UF_API addRenderMode( RenderMode*, const std::string& = "" );
|
||||
RenderMode& UF_API getRenderMode( const std::string&, bool = true );
|
||||
std::vector<RenderMode*> UF_API getRenderModes( const std::string&, bool = true );
|
||||
std::vector<RenderMode*> UF_API getRenderModes( const std::vector<std::string>&, bool = true );
|
||||
bool UF_API hasRenderMode( const uf::stl::string&, bool = true );
|
||||
RenderMode& UF_API addRenderMode( RenderMode*, const uf::stl::string& = "" );
|
||||
RenderMode& UF_API getRenderMode( const uf::stl::string&, bool = true );
|
||||
uf::stl::vector<RenderMode*> UF_API getRenderModes( const uf::stl::string&, bool = true );
|
||||
uf::stl::vector<RenderMode*> UF_API getRenderModes( const uf::stl::vector<uf::stl::string>&, bool = true );
|
||||
void UF_API removeRenderMode( RenderMode*, bool = true );
|
||||
|
||||
void UF_API initialize( /*uint8_t = 0*/ );
|
||||
@ -76,11 +76,11 @@ namespace ext {
|
||||
void UF_API render();
|
||||
void UF_API destroy();
|
||||
void UF_API synchronize( uint8_t = 0b11 );
|
||||
std::string UF_API allocatorStats();
|
||||
uf::stl::string UF_API allocatorStats();
|
||||
|
||||
ext::opengl::enums::Format::type_t UF_API formatFromString( const std::string& );
|
||||
ext::opengl::enums::Format::type_t UF_API formatFromString( const uf::stl::string& );
|
||||
|
||||
std::string UF_API errorString();
|
||||
std::string UF_API errorString( GLenum );
|
||||
uf::stl::string UF_API errorString();
|
||||
uf::stl::string UF_API errorString( GLenum );
|
||||
};
|
||||
}
|
||||
@ -17,10 +17,10 @@ namespace ext {
|
||||
struct {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string name = "";
|
||||
std::string type = "";
|
||||
std::string target = "";
|
||||
std::vector<uint8_t> outputs;
|
||||
uf::stl::string name = "";
|
||||
uf::stl::string type = "";
|
||||
uf::stl::string target = "";
|
||||
uf::stl::vector<uint8_t> outputs;
|
||||
|
||||
uint8_t subpasses = 1;
|
||||
uint8_t samples = 1;
|
||||
@ -36,21 +36,21 @@ namespace ext {
|
||||
RenderTarget renderTarget;
|
||||
|
||||
GLhandle(VkSemaphore) renderCompleteSemaphore;
|
||||
std::vector<GLhandle(VkFence)> fences;
|
||||
uf::stl::vector<GLhandle(VkFence)> fences;
|
||||
|
||||
std::thread::id mostRecentCommandPoolId;
|
||||
uf::ThreadUnique<CommandBuffer> commands;
|
||||
|
||||
virtual ~RenderMode();
|
||||
// RAII
|
||||
virtual const std::string getName() const;
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getName() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual RenderTarget& getRenderTarget(size_t = 0);
|
||||
virtual const RenderTarget& getRenderTarget(size_t = 0) const;
|
||||
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::opengl::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::opengl::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::opengl::Graphic*> getBlitters();
|
||||
|
||||
virtual CommandBuffer& getCommands();
|
||||
virtual CommandBuffer& getCommands( std::thread::id );
|
||||
@ -60,9 +60,9 @@ namespace ext {
|
||||
|
||||
virtual void initialize( Device& device );
|
||||
virtual void createCommandBuffers();
|
||||
virtual void createCommandBuffers( const std::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void bindPipelines();
|
||||
virtual void bindPipelines( const std::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void bindPipelines( const uf::stl::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void tick();
|
||||
virtual void render();
|
||||
virtual void destroy();
|
||||
|
||||
@ -7,10 +7,10 @@ namespace ext {
|
||||
struct UF_API BaseRenderMode : public RenderMode {
|
||||
// virtual ~RenderMode();
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
|
||||
virtual void initialize( Device& device );
|
||||
virtual void createCommandBuffers( const std::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void tick();
|
||||
virtual void render();
|
||||
virtual void destroy();
|
||||
|
||||
@ -10,10 +10,10 @@ namespace ext {
|
||||
pod::Vector2ui dispatchSize = { 32, 32 };
|
||||
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::opengl::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::opengl::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::opengl::Graphic*> getBlitters();
|
||||
|
||||
virtual void createCommandBuffers();
|
||||
virtual void initialize( Device& device );
|
||||
|
||||
@ -9,12 +9,12 @@ namespace ext {
|
||||
ext::opengl::Graphic blitter;
|
||||
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::opengl::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::opengl::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::opengl::Graphic*> getBlitters();
|
||||
|
||||
virtual void createCommandBuffers( const std::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void initialize( Device& device );
|
||||
virtual void tick();
|
||||
virtual void destroy();
|
||||
|
||||
@ -8,18 +8,18 @@ namespace ext {
|
||||
struct UF_API RenderTargetRenderMode : public RenderMode {
|
||||
ext::opengl::Graphic blitter;
|
||||
//
|
||||
const std::string getTarget() const;
|
||||
void setTarget( const std::string& );
|
||||
const uf::stl::string getTarget() const;
|
||||
void setTarget( const uf::stl::string& );
|
||||
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::opengl::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::opengl::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::opengl::Graphic*> getBlitters();
|
||||
|
||||
virtual GraphicDescriptor bindGraphicDescriptor( const GraphicDescriptor&, size_t = 0 );
|
||||
|
||||
virtual void createCommandBuffers( const std::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::opengl::Graphic*>& graphics );
|
||||
virtual void initialize( Device& device );
|
||||
virtual void tick();
|
||||
virtual void destroy();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include <uf/ext/opengl/ogl.h>
|
||||
#include <uf/ext/opengl/enums.h>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
namespace ext {
|
||||
namespace opengl {
|
||||
@ -28,31 +28,31 @@ namespace ext {
|
||||
|
||||
GLhandle(VkPipelineColorBlendAttachmentState) blendState;
|
||||
};
|
||||
std::vector<Attachment> attachments;
|
||||
uf::stl::vector<Attachment> attachments;
|
||||
|
||||
struct Subpass {
|
||||
GLhandle(VkPipelineStageFlags) stage;
|
||||
GLhandle(VkAccessFlags) access;
|
||||
bool autoBuildPipeline;
|
||||
|
||||
std::vector<GLhandle(VkAttachmentReference)> colors;
|
||||
std::vector<GLhandle(VkAttachmentReference)> inputs;
|
||||
std::vector<GLhandle(VkAttachmentReference)> resolves;
|
||||
uf::stl::vector<GLhandle(VkAttachmentReference)> colors;
|
||||
uf::stl::vector<GLhandle(VkAttachmentReference)> inputs;
|
||||
uf::stl::vector<GLhandle(VkAttachmentReference)> resolves;
|
||||
GLhandle(VkAttachmentReference) depth;
|
||||
};
|
||||
std::vector<Subpass> passes;
|
||||
uf::stl::vector<Subpass> passes;
|
||||
|
||||
bool initialized = false;
|
||||
Device* device = GL_NULL_HANDLE;
|
||||
GLhandle(VkRenderPass) renderPass = GL_NULL_HANDLE;
|
||||
std::vector<GLhandle(VkFramebuffer)> framebuffers;
|
||||
uf::stl::vector<GLhandle(VkFramebuffer)> framebuffers;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
uint8_t views = 1;
|
||||
// RAII
|
||||
void initialize( Device& device );
|
||||
void destroy();
|
||||
void addPass( GLhandle(VkPipelineStageFlags), GLhandle(VkAccessFlags), const std::vector<size_t>&, const std::vector<size_t>&, const std::vector<size_t>&, size_t, bool = true );
|
||||
void addPass( GLhandle(VkPipelineStageFlags), GLhandle(VkAccessFlags), const uf::stl::vector<size_t>&, const uf::stl::vector<size_t>&, const uf::stl::vector<size_t>&, size_t, bool = true );
|
||||
size_t attach( const Attachment::Descriptor& descriptor, Attachment* attachment = NULL );
|
||||
};
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace ext {
|
||||
bool aliased = false;
|
||||
|
||||
Device* device = NULL;
|
||||
std::string filename = "";
|
||||
uf::stl::string filename = "";
|
||||
|
||||
#if !UF_USE_OPENGL_FIXED_FUNCTION
|
||||
GLuint module = GL_NULL_HANDLE;
|
||||
@ -44,67 +44,67 @@ namespace ext {
|
||||
struct Metadata {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string pipeline = "";
|
||||
std::string type = "";
|
||||
uf::stl::string pipeline = "";
|
||||
uf::stl::string type = "";
|
||||
|
||||
struct Definition {
|
||||
struct Texture {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
ext::opengl::enums::Image::viewType_t type{};
|
||||
};
|
||||
struct Uniform {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
struct Storage {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
struct PushConstant {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
std::unordered_map<size_t, Texture> textures;
|
||||
std::unordered_map<std::string, Uniform> uniforms;
|
||||
std::unordered_map<std::string, Storage> storage;
|
||||
std::unordered_map<std::string, PushConstant> pushConstants;
|
||||
uf::stl::unordered_map<size_t, Texture> textures;
|
||||
uf::stl::unordered_map<uf::stl::string, Uniform> uniforms;
|
||||
uf::stl::unordered_map<uf::stl::string, Storage> storage;
|
||||
uf::stl::unordered_map<uf::stl::string, PushConstant> pushConstants;
|
||||
} definitions;
|
||||
} metadata;
|
||||
|
||||
ext::opengl::userdata_t specializationConstants;
|
||||
std::vector<ext::opengl::userdata_t> pushConstants;
|
||||
std::vector<ext::opengl::userdata_t> uniforms;
|
||||
uf::stl::vector<ext::opengl::userdata_t> pushConstants;
|
||||
uf::stl::vector<ext::opengl::userdata_t> uniforms;
|
||||
// ~Shader();
|
||||
void initialize( Device& device, const std::string&, enums::Shader::type_t stage );
|
||||
void initialize( Device& device, const uf::stl::string&, enums::Shader::type_t stage );
|
||||
void destroy();
|
||||
bool validate();
|
||||
|
||||
bool hasUniform( const std::string& name );
|
||||
bool hasUniform( const uf::stl::string& name );
|
||||
|
||||
Buffer* getUniformBuffer( const std::string& name );
|
||||
ext::opengl::userdata_t& getUniform( const std::string& name );
|
||||
uf::Serializer getUniformJson( const std::string& name, bool cache = true );
|
||||
ext::opengl::userdata_t getUniformUserdata( const std::string& name, const ext::json::Value& payload );
|
||||
bool updateUniform( const std::string& name );
|
||||
bool updateUniform( const std::string& name, const ext::opengl::userdata_t& );
|
||||
bool updateUniform( const std::string& name, const ext::json::Value& payload );
|
||||
Buffer* getUniformBuffer( const uf::stl::string& name );
|
||||
ext::opengl::userdata_t& getUniform( const uf::stl::string& name );
|
||||
uf::Serializer getUniformJson( const uf::stl::string& name, bool cache = true );
|
||||
ext::opengl::userdata_t getUniformUserdata( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
bool updateUniform( const uf::stl::string& name );
|
||||
bool updateUniform( const uf::stl::string& name, const ext::opengl::userdata_t& );
|
||||
bool updateUniform( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
|
||||
bool hasStorage( const std::string& name );
|
||||
Buffer* getStorageBuffer( const std::string& name );
|
||||
uf::Serializer getStorageJson( const std::string& name, bool cache = true );
|
||||
ext::opengl::userdata_t getStorageUserdata( const std::string& name, const ext::json::Value& payload );
|
||||
bool hasStorage( const uf::stl::string& name );
|
||||
Buffer* getStorageBuffer( const uf::stl::string& name );
|
||||
uf::Serializer getStorageJson( const uf::stl::string& name, bool cache = true );
|
||||
ext::opengl::userdata_t getStorageUserdata( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
|
||||
#if UF_USE_OPENGL_FIXED_FUNCTION
|
||||
static void bind( const std::string& name, const module_t& module );
|
||||
static void bind( const uf::stl::string& name, const module_t& module );
|
||||
void execute( const Graphic& graphic, void* = NULL );
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -76,11 +76,11 @@ namespace ext {
|
||||
void destroy();
|
||||
bool generated() const;
|
||||
void loadFromFile(
|
||||
const std::string& filename,
|
||||
const uf::stl::string& filename,
|
||||
enums::Format::type_t format = enums::Format::R8G8B8A8_UNORM
|
||||
);
|
||||
void loadFromFile(
|
||||
const std::string& filename,
|
||||
const uf::stl::string& filename,
|
||||
Device& device,
|
||||
enums::Format::type_t format = enums::Format::R8G8B8A8_UNORM
|
||||
);
|
||||
|
||||
@ -25,11 +25,11 @@ namespace vr {
|
||||
namespace ext {
|
||||
namespace openvr {
|
||||
struct Driver {
|
||||
std::string name;
|
||||
std::string serial;
|
||||
std::string manifest;
|
||||
uf::stl::string name;
|
||||
uf::stl::string serial;
|
||||
uf::stl::string manifest;
|
||||
vr::TrackedDevicePose_t poses[vr::k_unMaxTrackedDeviceCount];
|
||||
std::string types[vr::k_unMaxTrackedDeviceCount];
|
||||
uf::stl::string types[vr::k_unMaxTrackedDeviceCount];
|
||||
vr::IVRRenderModels* renderModels;
|
||||
};
|
||||
extern UF_API Driver driver;
|
||||
@ -61,7 +61,7 @@ namespace ext {
|
||||
pod::Matrix4t<> UF_API hmdViewMatrix( vr::Hmd_Eye eye, const pod::Matrix4f& = uf::matrix::identity() );
|
||||
pod::Matrix4t<> UF_API hmdProjectionMatrix( vr::Hmd_Eye, float = 0.1f, float = 1024.0f );
|
||||
|
||||
uf::Serializer UF_API controllerState( vr::Controller_Hand, const std::string& = "" );
|
||||
uf::Serializer UF_API controllerState( vr::Controller_Hand, const uf::stl::string& = "" );
|
||||
pod::Vector3f UF_API controllerPosition( vr::Controller_Hand, bool = false );
|
||||
pod::Quaternion<> UF_API controllerQuaternion( vr::Controller_Hand, bool = false );
|
||||
pod::Matrix4t<> UF_API controllerTranslationMatrix( vr::Controller_Hand, bool = false );
|
||||
@ -70,8 +70,8 @@ namespace ext {
|
||||
pod::Matrix4t<> UF_API controllerMatrix( vr::Controller_Hand, bool = false );
|
||||
bool UF_API controllerActive( vr::Controller_Hand );
|
||||
|
||||
bool UF_API requestRenderModel( const std::string& );
|
||||
uf::Graphic& UF_API getRenderModel( const std::string& );
|
||||
bool UF_API requestRenderModel( const uf::stl::string& );
|
||||
uf::Graphic& UF_API getRenderModel( const uf::stl::string& );
|
||||
uf::Graphic& UF_API controllerRenderModel( vr::Controller_Hand );
|
||||
|
||||
void UF_API resetPosition();
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
#include <uf/config.h>
|
||||
#if UF_USE_ULTRALIGHT
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/math/vector.h>
|
||||
#include <uf/utils/image/image.h>
|
||||
#include <uf/utils/string/io.h>
|
||||
@ -16,17 +16,17 @@ namespace pod {
|
||||
size_t uid = 0;
|
||||
ULView view;
|
||||
bool pending;
|
||||
std::string html;
|
||||
uf::stl::string html;
|
||||
pod::Vector2ui size;
|
||||
struct {
|
||||
std::string load = "";
|
||||
uf::stl::string load = "";
|
||||
} callbacks;
|
||||
};
|
||||
}
|
||||
|
||||
namespace ext {
|
||||
namespace ultralight {
|
||||
// extern UF_API std::string resourcesDir;
|
||||
// extern UF_API uf::stl::string resourcesDir;
|
||||
extern UF_API uint8_t log;
|
||||
extern UF_API double scale;
|
||||
|
||||
@ -35,12 +35,12 @@ namespace ext {
|
||||
void UF_API render();
|
||||
void UF_API terminate();
|
||||
|
||||
pod::HTML UF_API create( const std::string&, const pod::Vector2ui& );
|
||||
pod::HTML& UF_API create( pod::HTML&, const std::string&, const pod::Vector2ui& );
|
||||
pod::HTML UF_API create( const uf::stl::string&, const pod::Vector2ui& );
|
||||
pod::HTML& UF_API create( pod::HTML&, const uf::stl::string&, const pod::Vector2ui& );
|
||||
void UF_API destroy( pod::HTML& );
|
||||
void UF_API on( pod::HTML&, const std::string&, const std::string& );
|
||||
void UF_API on( pod::HTML&, const uf::stl::string&, const uf::stl::string& );
|
||||
void UF_API resize( pod::HTML&, const pod::Vector2ui& );
|
||||
void UF_API input( pod::HTML&, const std::string& );
|
||||
void UF_API input( pod::HTML&, const uf::stl::string& );
|
||||
uf::Image UF_API capture( pod::HTML& );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/ext/vulkan/vk.h>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
namespace ext {
|
||||
namespace vulkan {
|
||||
@ -60,7 +60,7 @@ namespace ext {
|
||||
void aliasBuffer( const Buffer& );
|
||||
};
|
||||
struct UF_API Buffers {
|
||||
std::vector<Buffer> buffers;
|
||||
uf::stl::vector<Buffer> buffers;
|
||||
Device* device;
|
||||
|
||||
// ~Buffers();
|
||||
|
||||
@ -15,9 +15,9 @@ namespace ext {
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkDevice logicalDevice;
|
||||
struct {
|
||||
// std::unordered_map<std::thread::id, VkCommandPool> graphics;
|
||||
// std::unordered_map<std::thread::id, VkCommandPool> compute;
|
||||
// std::unordered_map<std::thread::id, VkCommandPool> transfer;
|
||||
// uf::stl::unordered_map<std::thread::id, VkCommandPool> graphics;
|
||||
// uf::stl::unordered_map<std::thread::id, VkCommandPool> compute;
|
||||
// uf::stl::unordered_map<std::thread::id, VkCommandPool> transfer;
|
||||
uf::ThreadUnique<VkCommandPool> graphics;
|
||||
uf::ThreadUnique<VkCommandPool> compute;
|
||||
uf::ThreadUnique<VkCommandPool> transfer;
|
||||
@ -34,23 +34,23 @@ namespace ext {
|
||||
VkPhysicalDeviceMemoryProperties2 memoryProperties2;
|
||||
|
||||
struct {
|
||||
std::vector<VkExtensionProperties> instance;
|
||||
std::vector<VkExtensionProperties> device;
|
||||
uf::stl::vector<VkExtensionProperties> instance;
|
||||
uf::stl::vector<VkExtensionProperties> device;
|
||||
} extensionProperties;
|
||||
struct {
|
||||
std::vector<std::string> instance;
|
||||
std::vector<std::string> device;
|
||||
uf::stl::vector<uf::stl::string> instance;
|
||||
uf::stl::vector<uf::stl::string> device;
|
||||
} supportedExtensions;
|
||||
|
||||
VkPipelineCache pipelineCache;
|
||||
|
||||
std::vector<VkQueueFamilyProperties> queueFamilyProperties;
|
||||
uf::stl::vector<VkQueueFamilyProperties> queueFamilyProperties;
|
||||
|
||||
struct {
|
||||
// std::unordered_map<std::thread::id,VkQueue> graphics;
|
||||
// std::unordered_map<std::thread::id,VkQueue> present;
|
||||
// std::unordered_map<std::thread::id,VkQueue> compute;
|
||||
// std::unordered_map<std::thread::id,VkQueue> transfer;
|
||||
// uf::stl::unordered_map<std::thread::id,VkQueue> graphics;
|
||||
// uf::stl::unordered_map<std::thread::id,VkQueue> present;
|
||||
// uf::stl::unordered_map<std::thread::id,VkQueue> compute;
|
||||
// uf::stl::unordered_map<std::thread::id,VkQueue> transfer;
|
||||
uf::ThreadUnique<VkQueue> graphics;
|
||||
uf::ThreadUnique<VkQueue> present;
|
||||
uf::ThreadUnique<VkQueue> compute;
|
||||
|
||||
@ -26,7 +26,7 @@ namespace ext {
|
||||
struct {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string type = "";
|
||||
uf::stl::string type = "";
|
||||
bool process = true;
|
||||
} metadata;
|
||||
|
||||
@ -37,29 +37,29 @@ namespace ext {
|
||||
void record( Graphic& graphic, VkCommandBuffer, size_t = 0, size_t = 0 );
|
||||
void destroy();
|
||||
|
||||
std::vector<Shader*> getShaders( std::vector<Shader>& );
|
||||
uf::stl::vector<Shader*> getShaders( uf::stl::vector<Shader>& );
|
||||
};
|
||||
struct UF_API Material {
|
||||
bool aliased = false;
|
||||
Device* device;
|
||||
|
||||
std::vector<Sampler> samplers;
|
||||
std::vector<Texture2D> textures;
|
||||
std::vector<Shader> shaders;
|
||||
uf::stl::vector<Sampler> samplers;
|
||||
uf::stl::vector<Texture2D> textures;
|
||||
uf::stl::vector<Shader> shaders;
|
||||
|
||||
struct Metadata {
|
||||
uf::Serializer json;
|
||||
std::unordered_map<std::string, size_t> shaders;
|
||||
uf::stl::unordered_map<uf::stl::string, size_t> shaders;
|
||||
} metadata;
|
||||
|
||||
void initialize( Device& device );
|
||||
void destroy();
|
||||
|
||||
void attachShader( const std::string&, VkShaderStageFlagBits, const std::string& pipeline = "" );
|
||||
void initializeShaders( const std::vector<std::pair<std::string, VkShaderStageFlagBits>>&, const std::string& pipeline = "" );
|
||||
void attachShader( const uf::stl::string&, VkShaderStageFlagBits, const uf::stl::string& pipeline = "" );
|
||||
void initializeShaders( const uf::stl::vector<std::pair<uf::stl::string, VkShaderStageFlagBits>>&, const uf::stl::string& pipeline = "" );
|
||||
|
||||
bool hasShader( const std::string& type, const std::string& pipeline = "" );
|
||||
Shader& getShader( const std::string& type, const std::string& pipeline = "" );
|
||||
bool hasShader( const uf::stl::string& type, const uf::stl::string& pipeline = "" );
|
||||
Shader& getShader( const uf::stl::string& type, const uf::stl::string& pipeline = "" );
|
||||
|
||||
bool validate();
|
||||
};
|
||||
@ -69,14 +69,14 @@ namespace ext {
|
||||
bool initialized = false;
|
||||
bool process = true;
|
||||
Material material;
|
||||
std::unordered_map<GraphicDescriptor::hash_t, Pipeline> pipelines;
|
||||
uf::stl::unordered_map<GraphicDescriptor::hash_t, Pipeline> pipelines;
|
||||
|
||||
struct {
|
||||
std::unordered_map<std::string, size_t> buffers;
|
||||
uf::stl::unordered_map<uf::stl::string, size_t> buffers;
|
||||
} metadata;
|
||||
|
||||
~Graphic();
|
||||
void initialize( const std::string& = "" );
|
||||
void initialize( const uf::stl::string& = "" );
|
||||
void destroy();
|
||||
|
||||
template<typename T, typename U>
|
||||
@ -93,10 +93,10 @@ namespace ext {
|
||||
void record( VkCommandBuffer commandBuffer, size_t pass = 0, size_t draw = 0 );
|
||||
void record( VkCommandBuffer commandBuffer, GraphicDescriptor& descriptor, size_t pass = 0, size_t draw = 0 );
|
||||
|
||||
bool hasStorage( const std::string& name );
|
||||
Buffer* getStorageBuffer( const std::string& name );
|
||||
uf::Serializer getStorageJson( const std::string& name, bool cache = true );
|
||||
ext::vulkan::userdata_t getStorageUserdata( const std::string& name, const ext::json::Value& payload );
|
||||
bool hasStorage( const uf::stl::string& name );
|
||||
Buffer* getStorageBuffer( const uf::stl::string& name );
|
||||
uf::Serializer getStorageJson( const uf::stl::string& name, bool cache = true );
|
||||
ext::vulkan::userdata_t getStorageUserdata( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/ext/vulkan/vk.h>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
namespace ext {
|
||||
namespace vulkan {
|
||||
@ -194,7 +194,7 @@ namespace ext {
|
||||
}
|
||||
|
||||
inline VkDescriptorPoolCreateInfo descriptorPoolCreateInfo(
|
||||
const std::vector<VkDescriptorPoolSize>& poolSizes,
|
||||
const uf::stl::vector<VkDescriptorPoolSize>& poolSizes,
|
||||
uint32_t maxSets)
|
||||
{
|
||||
VkDescriptorPoolCreateInfo descriptorPoolInfo{};
|
||||
@ -241,7 +241,7 @@ namespace ext {
|
||||
}
|
||||
|
||||
inline VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo(
|
||||
const std::vector<VkDescriptorSetLayoutBinding>& bindings)
|
||||
const uf::stl::vector<VkDescriptorSetLayoutBinding>& bindings)
|
||||
{
|
||||
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo{};
|
||||
descriptorSetLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||
@ -462,7 +462,7 @@ namespace ext {
|
||||
}
|
||||
|
||||
inline VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo(
|
||||
const std::vector<VkDynamicState>& pDynamicStates,
|
||||
const uf::stl::vector<VkDynamicState>& pDynamicStates,
|
||||
VkPipelineDynamicStateCreateFlags flags = 0)
|
||||
{
|
||||
VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo{};
|
||||
|
||||
@ -17,10 +17,10 @@ namespace ext {
|
||||
struct {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string name = "";
|
||||
std::string type = "";
|
||||
std::string target = "";
|
||||
std::vector<uint8_t> outputs;
|
||||
uf::stl::string name = "";
|
||||
uf::stl::string type = "";
|
||||
uf::stl::string target = "";
|
||||
uf::stl::vector<uint8_t> outputs;
|
||||
|
||||
uint8_t subpasses = 1;
|
||||
uint8_t samples = 1;
|
||||
@ -36,22 +36,22 @@ namespace ext {
|
||||
RenderTarget renderTarget;
|
||||
|
||||
VkSemaphore renderCompleteSemaphore;
|
||||
std::vector<VkFence> fences;
|
||||
uf::stl::vector<VkFence> fences;
|
||||
|
||||
typedef std::vector<VkCommandBuffer> commands_container_t;
|
||||
typedef uf::stl::vector<VkCommandBuffer> commands_container_t;
|
||||
std::thread::id mostRecentCommandPoolId;
|
||||
uf::ThreadUnique<commands_container_t> commands;
|
||||
|
||||
virtual ~RenderMode();
|
||||
// RAII
|
||||
virtual const std::string getName() const;
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getName() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual RenderTarget& getRenderTarget(size_t = 0);
|
||||
virtual const RenderTarget& getRenderTarget(size_t = 0) const;
|
||||
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::vulkan::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
|
||||
virtual uf::Image screenshot(size_t = 0);
|
||||
|
||||
@ -62,9 +62,9 @@ namespace ext {
|
||||
|
||||
virtual void initialize( Device& device );
|
||||
virtual void createCommandBuffers();
|
||||
virtual void createCommandBuffers( const std::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void bindPipelines();
|
||||
virtual void bindPipelines( const std::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void bindPipelines( const uf::stl::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void tick();
|
||||
virtual void render();
|
||||
virtual void destroy();
|
||||
|
||||
@ -7,10 +7,10 @@ namespace ext {
|
||||
struct UF_API BaseRenderMode : RenderMode {
|
||||
// virtual ~RenderMode();
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
|
||||
virtual void initialize( Device& device );
|
||||
virtual void createCommandBuffers( const std::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void tick();
|
||||
virtual void render();
|
||||
virtual void destroy();
|
||||
|
||||
@ -10,10 +10,10 @@ namespace ext {
|
||||
pod::Vector2ui dispatchSize = { 32, 32 };
|
||||
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::vulkan::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
|
||||
virtual void createCommandBuffers();
|
||||
virtual void initialize( Device& device );
|
||||
|
||||
@ -9,14 +9,14 @@ namespace ext {
|
||||
ext::vulkan::Graphic blitter;
|
||||
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::vulkan::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
|
||||
virtual GraphicDescriptor bindGraphicDescriptor( const GraphicDescriptor&, size_t = 0 );
|
||||
|
||||
virtual void createCommandBuffers( const std::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void initialize( Device& device );
|
||||
virtual void tick();
|
||||
virtual void destroy();
|
||||
|
||||
@ -9,11 +9,11 @@ namespace ext {
|
||||
ext::vulkan::Graphic blitter;
|
||||
|
||||
typedef std::function<void(VkCommandBuffer)> callback_t;
|
||||
std::unordered_map<int32_t, callback_t> commandBufferCallbacks;
|
||||
uf::stl::unordered_map<int32_t, callback_t> commandBufferCallbacks;
|
||||
|
||||
//
|
||||
const std::string getTarget() const;
|
||||
void setTarget( const std::string& );
|
||||
const uf::stl::string getTarget() const;
|
||||
void setTarget( const uf::stl::string& );
|
||||
|
||||
void bindCallback( int32_t, const callback_t& );
|
||||
|
||||
@ -21,14 +21,14 @@ namespace ext {
|
||||
constexpr static int32_t CALLBACK_END = -2;
|
||||
|
||||
// RAII
|
||||
virtual const std::string getType() const;
|
||||
virtual const uf::stl::string getType() const;
|
||||
virtual const size_t blitters() const;
|
||||
virtual ext::vulkan::Graphic* getBlitter(size_t = 0);
|
||||
virtual std::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
virtual uf::stl::vector<ext::vulkan::Graphic*> getBlitters();
|
||||
|
||||
virtual GraphicDescriptor bindGraphicDescriptor( const GraphicDescriptor&, size_t = 0 );
|
||||
|
||||
virtual void createCommandBuffers( const std::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void createCommandBuffers( const uf::stl::vector<ext::vulkan::Graphic*>& graphics );
|
||||
virtual void initialize( Device& device );
|
||||
virtual void tick();
|
||||
virtual void destroy();
|
||||
|
||||
@ -19,12 +19,12 @@ namespace ext {
|
||||
VkImage image;
|
||||
VkDeviceMemory mem;
|
||||
VkImageView view;
|
||||
std::vector<VkImageView> views;
|
||||
uf::stl::vector<VkImageView> views;
|
||||
VmaAllocation allocation;
|
||||
VmaAllocationInfo allocationInfo;
|
||||
VkPipelineColorBlendAttachmentState blendState;
|
||||
};
|
||||
std::vector<Attachment> attachments;
|
||||
uf::stl::vector<Attachment> attachments;
|
||||
|
||||
struct Subpass {
|
||||
VkPipelineStageFlags stage;
|
||||
@ -32,24 +32,24 @@ namespace ext {
|
||||
uint8_t layer;
|
||||
bool autoBuildPipeline;
|
||||
|
||||
std::vector<VkAttachmentReference> colors;
|
||||
std::vector<VkAttachmentReference> inputs;
|
||||
std::vector<VkAttachmentReference> resolves;
|
||||
uf::stl::vector<VkAttachmentReference> colors;
|
||||
uf::stl::vector<VkAttachmentReference> inputs;
|
||||
uf::stl::vector<VkAttachmentReference> resolves;
|
||||
VkAttachmentReference depth;
|
||||
};
|
||||
std::vector<Subpass> passes;
|
||||
uf::stl::vector<Subpass> passes;
|
||||
|
||||
bool initialized = false;
|
||||
Device* device = VK_NULL_HANDLE;
|
||||
VkRenderPass renderPass = VK_NULL_HANDLE;
|
||||
std::vector<VkFramebuffer> framebuffers;
|
||||
uf::stl::vector<VkFramebuffer> framebuffers;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
uint8_t views = 1;
|
||||
// RAII
|
||||
void initialize( Device& device );
|
||||
void destroy();
|
||||
void addPass( VkPipelineStageFlags, VkAccessFlags, const std::vector<size_t>&, const std::vector<size_t>&, const std::vector<size_t>&, size_t, size_t = 0, bool = true );
|
||||
void addPass( VkPipelineStageFlags, VkAccessFlags, const uf::stl::vector<size_t>&, const uf::stl::vector<size_t>&, const uf::stl::vector<size_t>&, size_t, size_t = 0, bool = true );
|
||||
size_t attach( const Attachment::Descriptor& descriptor, Attachment* attachment = NULL );
|
||||
};
|
||||
}
|
||||
|
||||
@ -24,75 +24,75 @@ namespace ext {
|
||||
bool aliased = false;
|
||||
|
||||
Device* device = NULL;
|
||||
std::string filename = "";
|
||||
uf::stl::string filename = "";
|
||||
|
||||
VkShaderModule module = VK_NULL_HANDLE;
|
||||
VkPipelineShaderStageCreateInfo descriptor;
|
||||
std::vector<VkDescriptorSetLayoutBinding> descriptorSetLayoutBindings;
|
||||
std::vector<VkSpecializationMapEntry> specializationMapEntries;
|
||||
uf::stl::vector<VkDescriptorSetLayoutBinding> descriptorSetLayoutBindings;
|
||||
uf::stl::vector<VkSpecializationMapEntry> specializationMapEntries;
|
||||
VkSpecializationInfo specializationInfo;
|
||||
|
||||
struct Metadata {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string pipeline = "";
|
||||
std::string type = "";
|
||||
uf::stl::string pipeline = "";
|
||||
uf::stl::string type = "";
|
||||
|
||||
struct Definition {
|
||||
struct Texture {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
ext::vulkan::enums::Image::viewType_t type{};
|
||||
};
|
||||
struct Uniform {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
struct Storage {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
struct PushConstant {
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
uint32_t index = 0;
|
||||
uint32_t binding = 0;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
std::unordered_map<size_t, Texture> textures;
|
||||
std::unordered_map<std::string, Uniform> uniforms;
|
||||
std::unordered_map<std::string, Storage> storage;
|
||||
std::unordered_map<std::string, PushConstant> pushConstants;
|
||||
uf::stl::unordered_map<size_t, Texture> textures;
|
||||
uf::stl::unordered_map<uf::stl::string, Uniform> uniforms;
|
||||
uf::stl::unordered_map<uf::stl::string, Storage> storage;
|
||||
uf::stl::unordered_map<uf::stl::string, PushConstant> pushConstants;
|
||||
} definitions;
|
||||
} metadata;
|
||||
|
||||
ext::vulkan::userdata_t specializationConstants;
|
||||
std::vector<ext::vulkan::userdata_t> pushConstants;
|
||||
std::vector<ext::vulkan::userdata_t> uniforms;
|
||||
uf::stl::vector<ext::vulkan::userdata_t> pushConstants;
|
||||
uf::stl::vector<ext::vulkan::userdata_t> uniforms;
|
||||
// ~Shader();
|
||||
void initialize( Device& device, const std::string&, VkShaderStageFlagBits );
|
||||
void initialize( Device& device, const uf::stl::string&, VkShaderStageFlagBits );
|
||||
void destroy();
|
||||
bool validate();
|
||||
|
||||
bool hasUniform( const std::string& name );
|
||||
bool hasUniform( const uf::stl::string& name );
|
||||
|
||||
Buffer* getUniformBuffer( const std::string& name );
|
||||
ext::vulkan::userdata_t& getUniform( const std::string& name );
|
||||
uf::Serializer getUniformJson( const std::string& name, bool cache = true );
|
||||
ext::vulkan::userdata_t getUniformUserdata( const std::string& name, const ext::json::Value& payload );
|
||||
bool updateUniform( const std::string& name );
|
||||
bool updateUniform( const std::string& name, const ext::vulkan::userdata_t& );
|
||||
bool updateUniform( const std::string& name, const ext::json::Value& payload );
|
||||
Buffer* getUniformBuffer( const uf::stl::string& name );
|
||||
ext::vulkan::userdata_t& getUniform( const uf::stl::string& name );
|
||||
uf::Serializer getUniformJson( const uf::stl::string& name, bool cache = true );
|
||||
ext::vulkan::userdata_t getUniformUserdata( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
bool updateUniform( const uf::stl::string& name );
|
||||
bool updateUniform( const uf::stl::string& name, const ext::vulkan::userdata_t& );
|
||||
bool updateUniform( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
|
||||
bool hasStorage( const std::string& name );
|
||||
Buffer* getStorageBuffer( const std::string& name );
|
||||
uf::Serializer getStorageJson( const std::string& name, bool cache = true );
|
||||
ext::vulkan::userdata_t getStorageUserdata( const std::string& name, const ext::json::Value& payload );
|
||||
bool hasStorage( const uf::stl::string& name );
|
||||
Buffer* getStorageBuffer( const uf::stl::string& name );
|
||||
uf::Serializer getStorageJson( const uf::stl::string& name, bool cache = true );
|
||||
ext::vulkan::userdata_t getStorageUserdata( const uf::stl::string& name, const ext::json::Value& payload );
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ namespace ext {
|
||||
void initialize( Device& device );
|
||||
void destroy();
|
||||
|
||||
static std::vector<ext::vulkan::Sampler> samplers;
|
||||
static uf::stl::vector<ext::vulkan::Sampler> samplers;
|
||||
static ext::vulkan::Sampler retrieve( const Descriptor& info );
|
||||
};
|
||||
|
||||
@ -84,13 +84,13 @@ namespace ext {
|
||||
uint32_t mipLevels
|
||||
);
|
||||
void loadFromFile(
|
||||
const std::string& filename,
|
||||
const uf::stl::string& filename,
|
||||
VkFormat format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VkImageLayout imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
||||
);
|
||||
void loadFromFile(
|
||||
const std::string& filename,
|
||||
const uf::stl::string& filename,
|
||||
Device& device,
|
||||
VkFormat format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
|
||||
@ -30,7 +30,7 @@ namespace ext {
|
||||
void* pUserData
|
||||
);
|
||||
|
||||
std::string errorString( VkResult result );
|
||||
uf::stl::string errorString( VkResult result );
|
||||
VkSampleCountFlagBits sampleCount( uint8_t );
|
||||
void* alignedAlloc( size_t size, size_t alignment );
|
||||
void alignedFree(void* data);
|
||||
@ -45,10 +45,10 @@ namespace ext {
|
||||
extern UF_API size_t viewCount;
|
||||
constexpr size_t maxViews = 6;
|
||||
|
||||
extern UF_API std::vector<std::string> validationFilters;
|
||||
extern UF_API std::vector<std::string> requestedDeviceFeatures;
|
||||
extern UF_API std::vector<std::string> requestedDeviceExtensions;
|
||||
extern UF_API std::vector<std::string> requestedInstanceExtensions;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> validationFilters;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> requestedDeviceFeatures;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> requestedDeviceExtensions;
|
||||
extern UF_API uf::stl::vector<uf::stl::string> requestedInstanceExtensions;
|
||||
|
||||
extern UF_API VkFilter swapchainUpscaleFilter;
|
||||
|
||||
@ -58,7 +58,7 @@ namespace ext {
|
||||
extern UF_API bool individualPipelines;
|
||||
extern UF_API bool multithreadedCommandRecording;
|
||||
extern UF_API bool multithreadedCommandRendering;
|
||||
extern UF_API std::string deferredMode;
|
||||
extern UF_API uf::stl::string deferredMode;
|
||||
extern UF_API bool deferredReconstructPosition;
|
||||
extern UF_API bool deferredAliasOutputToSwapchain;
|
||||
extern UF_API bool multiview;
|
||||
@ -89,15 +89,15 @@ namespace ext {
|
||||
extern UF_API std::mutex mutex;
|
||||
|
||||
extern UF_API RenderMode* currentRenderMode;
|
||||
extern UF_API std::vector<RenderMode*> renderModes;
|
||||
extern UF_API std::unordered_map<std::string, RenderMode*> renderModesMap;
|
||||
extern UF_API std::vector<uf::Scene*> scenes;
|
||||
extern UF_API uf::stl::vector<RenderMode*> renderModes;
|
||||
extern UF_API uf::stl::unordered_map<uf::stl::string, RenderMode*> renderModesMap;
|
||||
extern UF_API uf::stl::vector<uf::Scene*> scenes;
|
||||
|
||||
bool UF_API hasRenderMode( const std::string&, bool = true );
|
||||
RenderMode& UF_API addRenderMode( RenderMode*, const std::string& = "" );
|
||||
RenderMode& UF_API getRenderMode( const std::string&, bool = true );
|
||||
std::vector<RenderMode*> UF_API getRenderModes( const std::string&, bool = true );
|
||||
std::vector<RenderMode*> UF_API getRenderModes( const std::vector<std::string>&, bool = true );
|
||||
bool UF_API hasRenderMode( const uf::stl::string&, bool = true );
|
||||
RenderMode& UF_API addRenderMode( RenderMode*, const uf::stl::string& = "" );
|
||||
RenderMode& UF_API getRenderMode( const uf::stl::string&, bool = true );
|
||||
uf::stl::vector<RenderMode*> UF_API getRenderModes( const uf::stl::string&, bool = true );
|
||||
uf::stl::vector<RenderMode*> UF_API getRenderModes( const uf::stl::vector<uf::stl::string>&, bool = true );
|
||||
void UF_API removeRenderMode( RenderMode*, bool = true );
|
||||
|
||||
void UF_API initialize( /*uint8_t = 0*/ );
|
||||
@ -105,7 +105,7 @@ namespace ext {
|
||||
void UF_API render();
|
||||
void UF_API destroy();
|
||||
void UF_API synchronize( uint8_t = 0b11 );
|
||||
std::string UF_API allocatorStats();
|
||||
ext::vulkan::enums::Format::type_t UF_API formatFromString( const std::string& );
|
||||
uf::stl::string UF_API allocatorStats();
|
||||
ext::vulkan::enums::Format::type_t UF_API formatFromString( const uf::stl::string& );
|
||||
}
|
||||
}
|
||||
@ -3,30 +3,31 @@
|
||||
#include <uf/config.h>
|
||||
#if UF_USE_ZLIB
|
||||
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/string.h>
|
||||
|
||||
namespace ext {
|
||||
namespace zlib {
|
||||
extern UF_API size_t bufferSize;
|
||||
/*
|
||||
std::vector<uint8_t> UF_API compress( const void*, size_t );
|
||||
std::vector<uint8_t> UF_API decompress( const void*, size_t );
|
||||
uf::stl::vector<uint8_t> UF_API compress( const void*, size_t );
|
||||
uf::stl::vector<uint8_t> UF_API decompress( const void*, size_t );
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> UF_API compress( const std::vector<T>& data ) {
|
||||
uf::stl::vector<T> UF_API compress( const uf::stl::vector<T>& data ) {
|
||||
auto compressed = ext::zlib::compress( data.data(), data.size() );
|
||||
std::vector<T> vector( compressed.size() / sizeof(T) );
|
||||
uf::stl::vector<T> vector( compressed.size() / sizeof(T) );
|
||||
memcpy( vector.data(), compressed.data(), compressed.size() );
|
||||
}
|
||||
template<typename T>
|
||||
std::vector<T> UF_API decompress( const std::vector<T>& data ) {
|
||||
uf::stl::vector<T> UF_API decompress( const uf::stl::vector<T>& data ) {
|
||||
auto compressed = ext::zlib::decompress( data.data(), data.size() );
|
||||
std::vector<T> vector( compressed.size() / sizeof(T) );
|
||||
uf::stl::vector<T> vector( compressed.size() / sizeof(T) );
|
||||
memcpy( vector.data(), compressed.data(), compressed.size() );
|
||||
}
|
||||
*/
|
||||
std::vector<uint8_t> UF_API decompressFromFile( const std::string& );
|
||||
size_t UF_API compressToFile( const std::string&, const void*, size_t );
|
||||
uf::stl::vector<uint8_t> UF_API decompressFromFile( const uf::stl::string& );
|
||||
size_t UF_API compressToFile( const uf::stl::string&, const void*, size_t );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
0
engine/inc/uf/helpers.inl
Normal file
0
engine/inc/uf/helpers.inl
Normal file
@ -6,12 +6,13 @@
|
||||
#define TIMER(x, ...) auto TOKEN_PASTE(TIMER, __LINE__) = []( double every = 1 ) {\
|
||||
static uf::Timer<long long> timer(false);\
|
||||
if ( !timer.running() ) {\
|
||||
timer.start(uf::Time<long long>(-x, uf::Time<long long>::seconds));\
|
||||
timer.start(uf::Time<long long>(-x * 1000, uf::Time<long long>::milliseconds));\
|
||||
}\
|
||||
double time = 0;\
|
||||
if ( (time = timer.elapsed().asDouble()) >= every ) {\
|
||||
timer.reset();\
|
||||
}\
|
||||
static bool first = true; if ( first ) { first = false; return every; }\
|
||||
return time;\
|
||||
};\
|
||||
double time = 0;\
|
||||
@ -39,9 +40,9 @@
|
||||
#define UF_EXCEPTION(X) { UF_MSG_ERROR(X); }
|
||||
#else
|
||||
#define UF_EXCEPTION(X) {\
|
||||
std::stringstream str;\
|
||||
uf::stl::stringstream str;\
|
||||
str << X;\
|
||||
std::string Y = str.str();\
|
||||
uf::stl::string Y = str.str();\
|
||||
UF_MSG_ERROR(Y);\
|
||||
throw std::runtime_error(Y);\
|
||||
}
|
||||
|
||||
@ -13,8 +13,8 @@ namespace spec {
|
||||
void UF_API terminate();
|
||||
|
||||
bool UF_API connected( size_t = 0 );
|
||||
bool UF_API pressed( const std::string&, size_t = 0 );
|
||||
float UF_API analog( const std::string&, size_t = 0 );
|
||||
bool UF_API pressed( const uf::stl::string&, size_t = 0 );
|
||||
float UF_API analog( const uf::stl::string&, size_t = 0 );
|
||||
}
|
||||
}
|
||||
namespace controller = dreamcast::controller;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
|
||||
#include <uf/utils/memory/string.h>
|
||||
namespace spec {
|
||||
namespace uni {
|
||||
namespace controller {
|
||||
@ -10,8 +10,8 @@ namespace spec {
|
||||
void UF_API terminate();
|
||||
|
||||
bool UF_API connected( size_t = 0 );
|
||||
bool UF_API pressed( const std::string&, size_t = 0 );
|
||||
float UF_API analog( const std::string&, size_t = 0 );
|
||||
bool UF_API pressed( const uf::stl::string&, size_t = 0 );
|
||||
float UF_API analog( const uf::stl::string&, size_t = 0 );
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -13,8 +13,8 @@ namespace spec {
|
||||
void UF_API terminate();
|
||||
|
||||
bool UF_API connected( size_t = 0 );
|
||||
bool UF_API pressed( const std::string&, size_t = 0 );
|
||||
float UF_API analog( const std::string&, size_t = 0 );
|
||||
bool UF_API pressed( const uf::stl::string&, size_t = 0 );
|
||||
float UF_API analog( const uf::stl::string&, size_t = 0 );
|
||||
}
|
||||
}
|
||||
namespace controller = win32::controller;
|
||||
|
||||
@ -54,7 +54,7 @@ namespace spec {
|
||||
/*virtual*/ bool UF_API hasFocus() const;
|
||||
// Update
|
||||
/*virtual*/ void UF_API processEvents();
|
||||
static /*virtual*/ bool UF_API isKeyPressed(const std::string&);
|
||||
static /*virtual*/ bool UF_API isKeyPressed(const uf::stl::string&);
|
||||
bool UF_API pollEvents( bool block = false );
|
||||
// Win32 specific functions
|
||||
void UF_API registerWindowClass();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include <uf/utils/math/vector.h>
|
||||
#include <uf/utils/hook/hook.h>
|
||||
#include <uf/utils/string/string.h>
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <queue>
|
||||
|
||||
namespace spec {
|
||||
@ -17,7 +17,7 @@ namespace spec {
|
||||
typedef pod::Vector2i vector_t;
|
||||
|
||||
struct Event {
|
||||
std::string name;
|
||||
uf::stl::string name;
|
||||
pod::Hook::userdata_t payload;
|
||||
};
|
||||
protected:
|
||||
@ -49,7 +49,7 @@ namespace spec {
|
||||
// Update
|
||||
void processEvents();/* = 0;*/
|
||||
|
||||
void pushEvent( const uf::Hooks::name_t& name, const std::string& payload );
|
||||
void pushEvent( const uf::Hooks::name_t& name, const uf::stl::string& payload );
|
||||
void pushEvent( const uf::Hooks::name_t& name, const ext::json::Value& payload );
|
||||
void pushEvent( const uf::Hooks::name_t& name, const uf::Serializer& payload );
|
||||
void pushEvent( const uf::Hooks::name_t& name, const uf::Hooks::argument_t& payload );
|
||||
@ -57,7 +57,7 @@ namespace spec {
|
||||
template<typename T> void pushEvent( const uf::Hooks::name_t& name, const T& payload );
|
||||
|
||||
bool pollEvents( bool block = false );
|
||||
static bool isKeyPressed( const std::string& );
|
||||
static bool isKeyPressed( const uf::stl::string& );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ namespace spec {
|
||||
/*virtual*/ bool UF_API_CALL hasFocus() const;
|
||||
// Update
|
||||
/*virtual*/ void UF_API_CALL processEvents();
|
||||
static /*virtual*/ bool UF_API_CALL isKeyPressed(const std::string&);
|
||||
static /*virtual*/ bool UF_API_CALL isKeyPressed(const uf::stl::string&);
|
||||
bool UF_API_CALL pollEvents( bool block = false );
|
||||
// Win32 specific functions
|
||||
void UF_API_CALL registerWindowClass();
|
||||
@ -72,10 +72,10 @@ namespace spec {
|
||||
static pod::Vector2ui UF_API_CALL getResolution();
|
||||
void UF_API_CALL switchToFullscreen( bool borderless = false );
|
||||
#if defined(UF_USE_VULKAN) && UF_USE_VULKAN == 1
|
||||
std::vector<std::string> UF_API_CALL getExtensions( bool validationEnabled );
|
||||
uf::stl::vector<uf::stl::string> UF_API_CALL getExtensions( bool validationEnabled );
|
||||
void UF_API_CALL createSurface( VkInstance instance, VkSurfaceKHR& surface );
|
||||
#endif
|
||||
static std::string UF_API_CALL getKey(WPARAM key, LPARAM flags);
|
||||
static uf::stl::string UF_API_CALL getKey(WPARAM key, LPARAM flags);
|
||||
};
|
||||
}
|
||||
typedef spec::win32::Window Window;
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
typedef float ALfloat;
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
|
||||
#include <uf/utils/math/vector.h>
|
||||
#include <uf/utils/math/quaternion.h>
|
||||
@ -39,10 +39,10 @@ namespace uf {
|
||||
bool initialized() const;
|
||||
bool playing() const;
|
||||
|
||||
void open( const std::string& );
|
||||
void open( const std::string&, bool );
|
||||
void load( const std::string& );
|
||||
void stream( const std::string& );
|
||||
void open( const uf::stl::string& );
|
||||
void open( const uf::stl::string&, bool );
|
||||
void load( const uf::stl::string& );
|
||||
void stream( const uf::stl::string& );
|
||||
void update();
|
||||
void destroy();
|
||||
|
||||
@ -72,7 +72,7 @@ namespace uf {
|
||||
float getVolume() const;
|
||||
void setVolume( float );
|
||||
|
||||
const std::string& getFilename() const;
|
||||
const uf::stl::string& getFilename() const;
|
||||
float getDuration() const;
|
||||
};
|
||||
namespace audio {
|
||||
|
||||
@ -4,21 +4,21 @@
|
||||
namespace uf {
|
||||
class UF_API SoundEmitter {
|
||||
public:
|
||||
typedef std::vector<uf::Audio> container_t;
|
||||
typedef uf::stl::vector<uf::Audio> container_t;
|
||||
protected:
|
||||
uf::SoundEmitter::container_t m_container;
|
||||
public:
|
||||
~SoundEmitter();
|
||||
|
||||
bool has( const std::string& ) const;
|
||||
bool has( const uf::stl::string& ) const;
|
||||
|
||||
uf::Audio& add();
|
||||
uf::Audio& add( const std::string& );
|
||||
uf::Audio& load( const std::string& );
|
||||
uf::Audio& stream( const std::string& );
|
||||
uf::Audio& add( const uf::stl::string& );
|
||||
uf::Audio& load( const uf::stl::string& );
|
||||
uf::Audio& stream( const uf::stl::string& );
|
||||
|
||||
uf::Audio& get( const std::string& );
|
||||
const uf::Audio& get( const std::string& ) const;
|
||||
uf::Audio& get( const uf::stl::string& );
|
||||
const uf::Audio& get( const uf::stl::string& ) const;
|
||||
|
||||
container_t& get();
|
||||
const container_t& get() const;
|
||||
@ -28,20 +28,20 @@ namespace uf {
|
||||
};
|
||||
class UF_API MappedSoundEmitter {
|
||||
public:
|
||||
typedef std::unordered_map<std::string, uf::Audio> container_t;
|
||||
typedef uf::stl::unordered_map<uf::stl::string, uf::Audio> container_t;
|
||||
protected:
|
||||
uf::MappedSoundEmitter::container_t m_container;
|
||||
public:
|
||||
~MappedSoundEmitter();
|
||||
|
||||
bool has( const std::string& ) const;
|
||||
bool has( const uf::stl::string& ) const;
|
||||
|
||||
uf::Audio& add( const std::string& );
|
||||
uf::Audio& load( const std::string& );
|
||||
uf::Audio& stream( const std::string& );
|
||||
uf::Audio& add( const uf::stl::string& );
|
||||
uf::Audio& load( const uf::stl::string& );
|
||||
uf::Audio& stream( const uf::stl::string& );
|
||||
|
||||
uf::Audio& get( const std::string& );
|
||||
const uf::Audio& get( const std::string& ) const;
|
||||
uf::Audio& get( const uf::stl::string& );
|
||||
const uf::Audio& get( const uf::stl::string& ) const;
|
||||
|
||||
container_t& get();
|
||||
const container_t& get() const;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <fstream>
|
||||
|
||||
#include <uf/ext/oal/source.h>
|
||||
@ -9,8 +9,8 @@
|
||||
namespace uf {
|
||||
namespace audio {
|
||||
struct UF_API Metadata {
|
||||
std::string filename = "";
|
||||
std::string extension = "";
|
||||
uf::stl::string filename = "";
|
||||
uf::stl::string extension = "";
|
||||
struct {
|
||||
std::ifstream* file = NULL;
|
||||
void* handle = NULL;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <uf/utils/userdata/userdata.h>
|
||||
#include <uf/utils/io/iostream.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
#include <typeinfo>
|
||||
|
||||
#define UF_COMPONENT_POINTERED_USERDATA 0
|
||||
@ -12,8 +12,8 @@
|
||||
namespace pod {
|
||||
struct UF_API Component {
|
||||
typedef std::size_t id_t;
|
||||
typedef std::unordered_map<pod::Component::id_t, pod::Component> container_t;
|
||||
// typedef std::unordered_map<pod::Component::id_t, pod::Component::id_t> alias_t;
|
||||
typedef uf::stl::unordered_map<pod::Component::id_t, pod::Component> container_t;
|
||||
// typedef uf::stl::unordered_map<pod::Component::id_t, pod::Component::id_t> alias_t;
|
||||
|
||||
pod::Component::id_t id;
|
||||
#if UF_COMPONENT_POINTERED_USERDATA
|
||||
|
||||
@ -22,7 +22,7 @@ namespace ext {
|
||||
size_t size = 0; // sizeof(Vertex::position::type_t)
|
||||
size_t components = 0; // Vertex::position::size
|
||||
ext::RENDERER::enums::Type::type_t type = 0; // ext::RENDERER::typeToEnum<Vertex::position::type_t>()
|
||||
std::string name = "";
|
||||
uf::stl::string name = "";
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@ namespace uf {
|
||||
void* pointer = NULL;
|
||||
size_t length = 0;
|
||||
} vertex, index;
|
||||
std::vector<ext::RENDERER::VertexDescriptor> descriptor;
|
||||
uf::stl::vector<ext::RENDERER::VertexDescriptor> descriptor;
|
||||
} attributes;
|
||||
|
||||
void generateIndices();
|
||||
@ -51,13 +51,13 @@ namespace ext {
|
||||
namespace RENDERER {
|
||||
struct UF_API GraphicDescriptor {
|
||||
#if UF_GRAPHIC_DESCRIPTOR_USE_STRING
|
||||
typedef std::string hash_t;
|
||||
typedef uf::stl::string hash_t;
|
||||
#else
|
||||
typedef size_t hash_t;
|
||||
#endif
|
||||
|
||||
std::string renderMode = "";
|
||||
std::string pipeline = "";
|
||||
uf::stl::string renderMode = "";
|
||||
uf::stl::string pipeline = "";
|
||||
|
||||
uint32_t renderTarget = 0;
|
||||
uint32_t subpass = 0;
|
||||
@ -106,5 +106,5 @@ namespace ext {
|
||||
},
|
||||
|
||||
#define UF_VERTEX_DESCRIPTOR( TYPE, ... )\
|
||||
std::vector<uf::renderer::VertexDescriptor> TYPE::descriptor = { __VA_ARGS__ };
|
||||
uf::stl::vector<uf::renderer::VertexDescriptor> TYPE::descriptor = { __VA_ARGS__ };
|
||||
|
||||
@ -9,7 +9,7 @@ namespace pod {
|
||||
/*alignas(16)*/ pod::Vector3f normal;
|
||||
/*alignas(16)*/ pod::Vector4f color;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_3F2F3F32B {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
@ -17,14 +17,14 @@ namespace pod {
|
||||
/*alignas(16)*/ pod::Vector3f normal;
|
||||
/*alignas(16)*/ pod::Vector4t<uint8_t> color;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_3F3F3F {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
/*alignas(16)*/ pod::Vector3f uv;
|
||||
/*alignas(16)*/ pod::Vector3f normal;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_3F2F3F1UI {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
@ -32,31 +32,31 @@ namespace pod {
|
||||
/*alignas(16)*/ pod::Vector3f normal;
|
||||
/*alignas(4)*/ pod::Vector1ui id;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_3F2F3F {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
/*alignas(8)*/ pod::Vector2f uv;
|
||||
/*alignas(16)*/ pod::Vector3f normal;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_3F2F {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
/*alignas(8)*/ pod::Vector2f uv;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_2F2F {
|
||||
/*alignas(8)*/ pod::Vector2f position;
|
||||
/*alignas(8)*/ pod::Vector2f uv;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
struct /*UF_API*/ Vertex_3F {
|
||||
/*alignas(16)*/ pod::Vector3f position;
|
||||
|
||||
static UF_API std::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
static UF_API uf::stl::vector<uf::renderer::VertexDescriptor> descriptor;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
|
||||
#include <uf/utils/userdata/userdata.h> // uf::Userdata
|
||||
|
||||
#include <string> // std::string
|
||||
#include <uf/utils/memory/string.h> // uf::stl::string
|
||||
#include <functional> // std::function
|
||||
#include <vector> // std::vector
|
||||
#include <unordered_map> // std::unordered_map
|
||||
#include <uf/utils/memory/vector.h> // uf::vector
|
||||
#include <uf/utils/memory/unordered_map.h> // uf::unordered_map
|
||||
|
||||
#include <uf/utils/userdata/userdata.h>
|
||||
#include <uf/utils/serialize/serializer.h>
|
||||
@ -36,12 +36,12 @@ namespace pod {
|
||||
namespace uf {
|
||||
class UF_API Hooks {
|
||||
public:
|
||||
typedef std::vector<pod::Hook> hooks_t;
|
||||
typedef std::unordered_map<std::string, hooks_t> container_t;
|
||||
typedef uf::stl::vector<pod::Hook> hooks_t;
|
||||
typedef uf::stl::unordered_map<uf::stl::string, hooks_t> container_t;
|
||||
|
||||
typedef std::string name_t;
|
||||
typedef uf::stl::string name_t;
|
||||
typedef pod::Hook::userdata_t argument_t;
|
||||
typedef std::vector<pod::Hook::userdata_t> return_t;
|
||||
typedef uf::stl::vector<pod::Hook::userdata_t> return_t;
|
||||
protected:
|
||||
static size_t uids;
|
||||
uf::Hooks::container_t m_container;
|
||||
@ -51,7 +51,7 @@ namespace uf {
|
||||
void removeHook( const name_t& name, size_t uid );
|
||||
return_t call( const name_t& name, const argument_t& payload );
|
||||
|
||||
return_t call( const name_t& name, const std::string& = "" );
|
||||
return_t call( const name_t& name, const uf::stl::string& = "" );
|
||||
return_t call( const name_t& name, const ext::json::Value& );
|
||||
return_t call( const name_t& name, const uf::Serializer& );
|
||||
|
||||
@ -74,7 +74,7 @@ namespace uf {
|
||||
namespace uf {
|
||||
namespace HookHandler {
|
||||
namespace Readable {
|
||||
typedef std::function<std::string(const std::string&)> function_t;
|
||||
typedef std::function<uf::stl::string(const uf::stl::string&)> function_t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
|
||||
namespace uf {
|
||||
struct UF_API Http {
|
||||
std::string header;
|
||||
std::string response;
|
||||
uf::stl::string header;
|
||||
uf::stl::string response;
|
||||
char* effective;
|
||||
long code;
|
||||
double elapsed;
|
||||
};
|
||||
namespace http {
|
||||
uf::Http UF_API get( const std::string& );
|
||||
uf::Http UF_API get( const uf::stl::string& );
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/utils/image/image.h>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
|
||||
namespace uf {
|
||||
class UF_API Atlas {
|
||||
public:
|
||||
typedef std::string hash_t;
|
||||
typedef uf::stl::string hash_t;
|
||||
struct Identifier {
|
||||
size_t index;
|
||||
hash_t hash;
|
||||
@ -17,8 +17,8 @@ namespace uf {
|
||||
pod::Vector2ui size = {};
|
||||
pod::Vector2ui coord = {};
|
||||
};
|
||||
typedef std::vector<uf::Image> images_t;
|
||||
typedef std::unordered_map<hash_t, Tile> atlas_t;
|
||||
typedef uf::stl::vector<uf::Image> images_t;
|
||||
typedef uf::stl::unordered_map<hash_t, Tile> atlas_t;
|
||||
protected:
|
||||
uf::Image m_atlas;
|
||||
atlas_t m_tiles;
|
||||
@ -28,7 +28,7 @@ namespace uf {
|
||||
hash_t addImage( const uint8_t*, const pod::Vector2ui&, std::size_t, std::size_t, bool = false, bool = false );
|
||||
|
||||
void generate(float padding = 1);
|
||||
void generate( const std::vector<uf::Image>&, float padding = 1);
|
||||
void generate( const uf::stl::vector<uf::Image>&, float padding = 1);
|
||||
void clear(bool = true);
|
||||
bool generated() const;
|
||||
|
||||
@ -45,8 +45,8 @@ namespace uf {
|
||||
#if 0
|
||||
class UF_API HashAtlas {
|
||||
public:
|
||||
typedef std::string hash_t;
|
||||
typedef std::unordered_map<hash_t, uf::Image> images_t;
|
||||
typedef uf::stl::string hash_t;
|
||||
typedef uf::stl::unordered_map<hash_t, uf::Image> images_t;
|
||||
|
||||
struct Identifier {
|
||||
hash_t hash;
|
||||
@ -66,7 +66,7 @@ namespace uf {
|
||||
void generate( const images_t&, float padding = 1);
|
||||
void clear();
|
||||
bool has( const uf::Image& ) const;
|
||||
bool has( const std::string& ) const;
|
||||
bool has( const uf::stl::string& ) const;
|
||||
|
||||
pod::Vector2f mapUv( const pod::Vector2f&, const hash_t& );
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <uf/utils/math/vector.h>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
#include "pixel.h"
|
||||
|
||||
@ -11,9 +11,9 @@ namespace uf {
|
||||
public:
|
||||
typedef pod::Vector2ui vec2_t;
|
||||
typedef pod::PixelRgba8 pixel_t;
|
||||
typedef std::vector<pixel_t::type_t> container_t;
|
||||
typedef uf::stl::vector<pixel_t::type_t> container_t;
|
||||
protected:
|
||||
std::string m_filename;
|
||||
uf::stl::string m_filename;
|
||||
Image::container_t m_pixels;
|
||||
Image::vec2_t m_dimensions;
|
||||
std::size_t m_bpp;
|
||||
@ -28,7 +28,7 @@ namespace uf {
|
||||
Image( Image::container_t&& move, const Image::vec2_t& size ); // Move from vector of pixels
|
||||
Image( const Image::container_t& copy, const Image::vec2_t& size ); // Copy from vector of pixels
|
||||
|
||||
bool open( const std::string& filename, bool = true ); // from file
|
||||
bool open( const uf::stl::string& filename, bool = true ); // from file
|
||||
void open( const std::istream& stream ); // from stream
|
||||
void move( Image::container_t&& move, const Image::vec2_t& size ); // move from vector of pixels
|
||||
void copy( const Image::container_t& copy, const Image::vec2_t& size ); // copy from vector of pixels
|
||||
@ -40,7 +40,7 @@ namespace uf {
|
||||
void loadFromBuffer( const Image::pixel_t::type_t* pointer, const pod::Vector2ui& size, std::size_t bpp, std::size_t channels, bool flip = false );
|
||||
void loadFromBuffer( const Image::container_t& container, const pod::Vector2ui& size, std::size_t bpp, std::size_t channels, bool flip = false );
|
||||
|
||||
std::string getFilename() const;
|
||||
uf::stl::string getFilename() const;
|
||||
|
||||
Image::container_t& getPixels();
|
||||
const Image::container_t& getPixels() const;
|
||||
@ -57,16 +57,16 @@ namespace uf {
|
||||
std::size_t& getChannels();
|
||||
std::size_t getChannels() const;
|
||||
|
||||
std::string getHash() const;
|
||||
uf::stl::string getHash() const;
|
||||
size_t getFormat() const;
|
||||
|
||||
Image::pixel_t at( const Image::vec2_t& at );
|
||||
// Modifiers
|
||||
void flip();
|
||||
void padToPowerOfTwo();
|
||||
bool save( const std::string& filename, bool flip = false ) const; // to file
|
||||
bool save( const uf::stl::string& filename, bool flip = false ) const; // to file
|
||||
void save( std::ostream& stream ) const; // to stream
|
||||
void convert( const std::string&, const std::string& = "rgba" );
|
||||
void convert( const uf::stl::string&, const uf::stl::string& = "rgba" );
|
||||
Image overlay(const Image& top, const Image::vec2_t& corner = {} ) const; // Merges one image on top of another
|
||||
Image replace(const Image::pixel_t& from, const Image::pixel_t& to ) const; // Changes all pixel from one color (from), to another (to)
|
||||
Image subImage( const Image::vec2_t& start, const Image::vec2_t& end) const; // Crops an image
|
||||
|
||||
@ -1,48 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <fstream>
|
||||
|
||||
namespace uf {
|
||||
namespace io {
|
||||
extern UF_API const std::string root;
|
||||
extern UF_API const uf::stl::string root;
|
||||
|
||||
std::string UF_API absolute( const std::string& );
|
||||
std::string UF_API filename( const std::string& );
|
||||
std::string UF_API basename( const std::string& );
|
||||
std::string UF_API extension( const std::string& );
|
||||
std::string UF_API extension( const std::string&, int32_t );
|
||||
std::string UF_API directory( const std::string& );
|
||||
std::string UF_API sanitize( const std::string&, const std::string& = "" );
|
||||
size_t UF_API size( const std::string& );
|
||||
uf::stl::string UF_API absolute( const uf::stl::string& );
|
||||
uf::stl::string UF_API filename( const uf::stl::string& );
|
||||
uf::stl::string UF_API basename( const uf::stl::string& );
|
||||
uf::stl::string UF_API extension( const uf::stl::string& );
|
||||
uf::stl::string UF_API extension( const uf::stl::string&, int32_t );
|
||||
uf::stl::string UF_API directory( const uf::stl::string& );
|
||||
uf::stl::string UF_API sanitize( const uf::stl::string&, const uf::stl::string& = "" );
|
||||
size_t UF_API size( const uf::stl::string& );
|
||||
|
||||
std::string UF_API readAsString( const std::string&, const std::string& = "" );
|
||||
std::vector<uint8_t> UF_API readAsBuffer( const std::string&, const std::string& = "" );
|
||||
uf::stl::string UF_API readAsString( const uf::stl::string&, const uf::stl::string& = "" );
|
||||
uf::stl::vector<uint8_t> UF_API readAsBuffer( const uf::stl::string&, const uf::stl::string& = "" );
|
||||
|
||||
size_t UF_API write( const std::string& filename, const void*, size_t = SIZE_MAX );
|
||||
template<typename T> inline size_t write( const std::string& filename, const std::vector<T>& buffer, size_t size = SIZE_MAX ) {
|
||||
size_t UF_API write( const uf::stl::string& filename, const void*, size_t = SIZE_MAX );
|
||||
template<typename T> inline size_t write( const uf::stl::string& filename, const uf::stl::vector<T>& buffer, size_t size = SIZE_MAX ) {
|
||||
return write( filename, buffer.data(), std::min( buffer.size(), size ) );
|
||||
}
|
||||
inline size_t write( const std::string& filename, const std::string& string, size_t size = SIZE_MAX ) {
|
||||
inline size_t write( const uf::stl::string& filename, const uf::stl::string& string, size_t size = SIZE_MAX ) {
|
||||
return write( filename, string.c_str(), std::min( string.size(), size ) );
|
||||
}
|
||||
|
||||
std::vector<uint8_t> UF_API decompress( const std::string& );
|
||||
uf::stl::vector<uint8_t> UF_API decompress( const uf::stl::string& );
|
||||
|
||||
size_t UF_API compress( const std::string&, const void*, size_t = SIZE_MAX );
|
||||
template<typename T> inline size_t compress( const std::string& filename, const std::vector<T>& buffer, size_t size = SIZE_MAX ) {
|
||||
size_t UF_API compress( const uf::stl::string&, const void*, size_t = SIZE_MAX );
|
||||
template<typename T> inline size_t compress( const uf::stl::string& filename, const uf::stl::vector<T>& buffer, size_t size = SIZE_MAX ) {
|
||||
return compress( filename, buffer.data(), std::min( buffer.size(), size ) );
|
||||
}
|
||||
inline size_t compress( const std::string& filename, const std::string& string, size_t size = SIZE_MAX ) {
|
||||
inline size_t compress( const uf::stl::string& filename, const uf::stl::string& string, size_t size = SIZE_MAX ) {
|
||||
return compress( filename, string.c_str(), std::min( string.size(), size ) );
|
||||
}
|
||||
|
||||
std::string UF_API hash( const std::string& );
|
||||
bool UF_API exists( const std::string& );
|
||||
size_t UF_API mtime( const std::string& );
|
||||
bool UF_API mkdir( const std::string& );
|
||||
std::string UF_API resolveURI( const std::string&, const std::string& = "" );
|
||||
uf::stl::string UF_API hash( const uf::stl::string& );
|
||||
bool UF_API exists( const uf::stl::string& );
|
||||
size_t UF_API mtime( const uf::stl::string& );
|
||||
bool UF_API mkdir( const uf::stl::string& );
|
||||
uf::stl::string UF_API resolveURI( const uf::stl::string&, const uf::stl::string& = "" );
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include <uf/config.h>
|
||||
|
||||
#include <string>
|
||||
#include <uf/utils/memory/string.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/unordered_map.h>
|
||||
|
||||
#include <uf/utils/serialize/serializer.h>
|
||||
#include <uf/utils/string/string.h>
|
||||
@ -18,7 +18,7 @@ namespace uf {
|
||||
short id;
|
||||
short foreground;
|
||||
short background;
|
||||
std::string name;
|
||||
uf::stl::string name;
|
||||
};
|
||||
|
||||
class UF_API Color {
|
||||
@ -30,25 +30,25 @@ namespace uf {
|
||||
uf::IoStream& io;
|
||||
UF_API_CALL Manip1( uf::IoStream& );
|
||||
public:
|
||||
uf::IoStream& UF_API_CALL operator<<( const std::string& name );
|
||||
uf::IoStream& UF_API_CALL operator<<( const uf::stl::string& name );
|
||||
};
|
||||
class UF_API Manip2 {
|
||||
friend class uf::IoStream;
|
||||
friend class uf::IoStream::Color;
|
||||
protected:
|
||||
std::string name;
|
||||
uf::stl::string name;
|
||||
|
||||
UF_API_CALL Manip2( const std::string& = "" );
|
||||
UF_API_CALL Manip2( const uf::stl::string& = "" );
|
||||
};
|
||||
|
||||
uf::IoStream::Color::Manip2 UF_API_CALL operator()( const std::string& = "" ) const;
|
||||
uf::IoStream& UF_API_CALL operator()( uf::IoStream&, const std::string& = "" ) const;
|
||||
uf::IoStream::Color::Manip2 UF_API_CALL operator()( const uf::stl::string& = "" ) const;
|
||||
uf::IoStream& UF_API_CALL operator()( uf::IoStream&, const uf::stl::string& = "" ) const;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<std::string, uf::IoStream::color_t> color_container_t;
|
||||
typedef uf::stl::unordered_map<uf::stl::string, uf::IoStream::color_t> color_container_t;
|
||||
static bool ncurses;
|
||||
protected:
|
||||
std::string m_currentColor;
|
||||
uf::stl::string m_currentColor;
|
||||
uf::IoStream::color_container_t m_registeredColors;
|
||||
public:
|
||||
UF_API_CALL IoStream();
|
||||
@ -58,11 +58,11 @@ namespace uf {
|
||||
void UF_API_CALL terminate();
|
||||
void UF_API_CALL clear(bool = true);
|
||||
void UF_API_CALL back();
|
||||
std::string getBuffer();
|
||||
std::vector<std::string> getHistory();
|
||||
uf::stl::string getBuffer();
|
||||
uf::stl::vector<uf::stl::string> getHistory();
|
||||
|
||||
char UF_API_CALL readChar(const bool& = true);
|
||||
std::string UF_API_CALL readString(const bool& = true);
|
||||
uf::stl::string UF_API_CALL readString(const bool& = true);
|
||||
uf::String UF_API_CALL readUString(const bool& = true);
|
||||
void UF_API_CALL operator>> (bool&);
|
||||
void UF_API_CALL operator>> (short&);
|
||||
@ -77,13 +77,13 @@ namespace uf {
|
||||
void UF_API_CALL operator>> (float&);
|
||||
void UF_API_CALL operator>> (double&);
|
||||
void UF_API_CALL operator>> (long double&);
|
||||
void UF_API_CALL operator>> (std::string&);
|
||||
void UF_API_CALL operator>> (uf::stl::string&);
|
||||
void UF_API_CALL operator>> (uf::String&);
|
||||
std::istream& UF_API_CALL operator>> ( std::istream& );
|
||||
friend std::istream& UF_API_CALL operator>> ( std::istream&, uf::IoStream& );
|
||||
|
||||
char UF_API_CALL writeChar(char);
|
||||
const std::string& UF_API_CALL writeString(const std::string&);
|
||||
const uf::stl::string& UF_API_CALL writeString(const uf::stl::string&);
|
||||
const uf::String& UF_API_CALL writeUString(const uf::String&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const bool&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const short&);
|
||||
@ -98,7 +98,7 @@ namespace uf {
|
||||
uf::IoStream& UF_API_CALL operator<< (const float&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const double&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const long double&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const std::string&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const uf::stl::string&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const uf::String&);
|
||||
uf::IoStream& UF_API_CALL operator<< (const char*);
|
||||
uf::IoStream& UF_API_CALL operator<< (const uf::Serializer& val);
|
||||
@ -109,8 +109,8 @@ namespace uf {
|
||||
uf::IoStream::Color::Manip1 UF_API_CALL operator<< ( const uf::IoStream::Color& );
|
||||
uf::IoStream& UF_API_CALL operator<< ( const uf::IoStream::Color::Manip2& );
|
||||
|
||||
std::string UF_API_CALL getColor();
|
||||
void UF_API_CALL setColor( const std::string& );
|
||||
uf::stl::string UF_API_CALL getColor();
|
||||
void UF_API_CALL setColor( const uf::stl::string& );
|
||||
};
|
||||
extern UF_API uf::IoStream iostream;
|
||||
}
|
||||
@ -6,12 +6,12 @@
|
||||
#include "./collision/boundingbox.h"
|
||||
#include "./collision/sphere.h"
|
||||
#include "./collision/mesh.h"
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
|
||||
namespace uf {
|
||||
class UF_API Collider {
|
||||
public:
|
||||
typedef std::vector<pod::Collider*> container_t;
|
||||
typedef uf::stl::vector<pod::Collider*> container_t;
|
||||
protected:
|
||||
uf::Collider::container_t m_container;
|
||||
public:
|
||||
@ -24,7 +24,7 @@ namespace uf {
|
||||
|
||||
std::size_t getSize() const;
|
||||
|
||||
std::vector<pod::Collider::Manifold> intersects( const uf::Collider&, bool = false ) const;
|
||||
std::vector<pod::Collider::Manifold> intersects( const pod::Collider&, bool = false ) const;
|
||||
uf::stl::vector<pod::Collider::Manifold> intersects( const uf::Collider&, bool = false ) const;
|
||||
uf::stl::vector<pod::Collider::Manifold> intersects( const pod::Collider&, bool = false ) const;
|
||||
};
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace uf {
|
||||
pod::Vector3 max() const;
|
||||
pod::Vector3 closest( const pod::Vector3f& ) const;
|
||||
|
||||
virtual std::string type() const;
|
||||
virtual uf::stl::string type() const;
|
||||
virtual pod::Vector3* expand() const;
|
||||
virtual pod::Vector3 support( const pod::Vector3& ) const;
|
||||
pod::Collider::Manifold intersects( const uf::BoundingBox& ) const;
|
||||
|
||||
@ -75,7 +75,7 @@ namespace pod {
|
||||
}
|
||||
};
|
||||
virtual ~Collider();
|
||||
virtual std::string type() const;
|
||||
virtual uf::stl::string type() const;
|
||||
virtual pod::Vector3* expand() const = 0;
|
||||
virtual pod::Vector3 support( const pod::Vector3& ) const = 0;
|
||||
pod::Collider::Manifold intersects( const pod::Collider& ) const;
|
||||
|
||||
@ -6,14 +6,14 @@
|
||||
namespace uf {
|
||||
class UF_API MeshCollider : public pod::Collider {
|
||||
protected:
|
||||
std::vector<pod::Vector3> m_positions;
|
||||
uf::stl::vector<pod::Vector3> m_positions;
|
||||
public:
|
||||
MeshCollider( const pod::Transform<>& = {}, const std::vector<pod::Vector3>& = {} );
|
||||
MeshCollider( const pod::Transform<>& = {}, const uf::stl::vector<pod::Vector3>& = {} );
|
||||
|
||||
std::vector<pod::Vector3>& getPositions();
|
||||
const std::vector<pod::Vector3>& getPositions() const;
|
||||
uf::stl::vector<pod::Vector3>& getPositions();
|
||||
const uf::stl::vector<pod::Vector3>& getPositions() const;
|
||||
|
||||
void setPositions( const std::vector<pod::Vector3>& );
|
||||
void setPositions( const uf::stl::vector<pod::Vector3>& );
|
||||
|
||||
template<typename T, typename U>
|
||||
void setPositions( const uf::BaseMesh<T, U>& mesh ) {
|
||||
@ -26,7 +26,7 @@ namespace uf {
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::string type() const;
|
||||
virtual uf::stl::string type() const;
|
||||
virtual pod::Vector3* expand() const;
|
||||
virtual pod::Vector3 support( const pod::Vector3& ) const;
|
||||
};
|
||||
|
||||
@ -27,7 +27,7 @@ namespace uf {
|
||||
uint getSize() const;
|
||||
void setContainer( pod::Vector3*, uint );
|
||||
|
||||
virtual std::string type() const;
|
||||
virtual uf::stl::string type() const;
|
||||
virtual pod::Vector3* expand() const;
|
||||
virtual pod::Vector3 support( const pod::Vector3& ) const;
|
||||
};
|
||||
|
||||
@ -16,7 +16,7 @@ namespace uf {
|
||||
void setRadius( float = 1.0f );
|
||||
void setOrigin( const pod::Vector3& );
|
||||
|
||||
virtual std::string type() const;
|
||||
virtual uf::stl::string type() const;
|
||||
virtual pod::Vector3* expand() const;
|
||||
virtual pod::Vector3 support( const pod::Vector3& ) const;
|
||||
pod::Collider::Manifold intersects( const uf::SphereCollider& ) const;
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
#include "math.h"
|
||||
namespace pod {
|
||||
template<typename T = pod::Math::num_t, size_t R = 4, size_t C = R>
|
||||
struct UF_API /*alignas(16)*/ Matrix {
|
||||
#if UF_MATRIX_ALIGNED
|
||||
struct /*UF_API*/ alignas(16) Matrix {
|
||||
#else
|
||||
struct /*UF_API*/ /*alignas(16)*/ Matrix {
|
||||
#endif
|
||||
// n-dimensional/unspecialized matrix access
|
||||
T components[R*C] = {};
|
||||
// T components[R][C] = {};
|
||||
@ -53,7 +57,7 @@ namespace uf {
|
||||
template<typename T=pod::Math::num_t> pod::Matrix4t<T> /*UF_API*/ identity();
|
||||
|
||||
template<typename T=pod::Math::num_t> pod::Matrix4t<T> /*UF_API*/ initialize( const T* );
|
||||
template<typename T=pod::Math::num_t> pod::Matrix4t<T> /*UF_API*/ initialize( const std::vector<T>& );
|
||||
template<typename T=pod::Math::num_t> pod::Matrix4t<T> /*UF_API*/ initialize( const uf::stl::vector<T>& );
|
||||
template<typename T> pod::Matrix<typename T::type_t, T::columns, T::columns> /*UF_API*/ identityi();
|
||||
|
||||
// Equality checking
|
||||
@ -104,7 +108,7 @@ namespace uf {
|
||||
template<typename T=pod::Matrix4> T& /*UF_API*/ copy( T& destination, const T& source );
|
||||
template<typename T=pod::Matrix4> T& /*UF_API*/ copy( T& destination, typename T::type_t* const source );
|
||||
|
||||
template<typename T, size_t R, size_t C = R> std::string /*UF_API*/ toString( const pod::Matrix<T,R,C>& v );
|
||||
template<typename T, size_t R, size_t C = R> uf::stl::string /*UF_API*/ toString( const pod::Matrix<T,R,C>& v );
|
||||
template<typename T, size_t R, size_t C> ext::json::Value /*UF_API*/ encode( const pod::Matrix<T,R,C>& v, const ext::json::EncodingSettings& = {} );
|
||||
template<typename T, size_t R, size_t C> pod::Matrix<T,R,C>& /*UF_API*/ decode( const ext::json::Value& v, pod::Matrix<T,R,C>& );
|
||||
template<typename T, size_t R, size_t C> pod::Matrix<T,R,C> /*UF_API*/ decode( const ext::json::Value& v, const pod::Matrix<T,R,C>& = uf::matrix::identity() );
|
||||
@ -131,7 +135,7 @@ namespace uf {
|
||||
Matrix(const Matrix<T,R,C>::pod_t& pod); // copies POD altogether
|
||||
Matrix(const T components[R][C]); // copies data into POD from 'components' (typed as C array)
|
||||
Matrix(const T components[R*C]); // copies data into POD from 'components' (typed as C array)
|
||||
Matrix(const std::vector<T>& components); // copies data into POD from 'components' (typed as std::matrix<T>)
|
||||
Matrix(const uf::stl::vector<T>& components); // copies data into POD from 'components' (typed as std::matrix<T>)
|
||||
// D-tor
|
||||
// Unneccesary
|
||||
// POD access
|
||||
@ -189,7 +193,7 @@ namespace uf {
|
||||
namespace uf {
|
||||
namespace string {
|
||||
template<typename T, size_t R, size_t C>
|
||||
std::string /*UF_API*/ toString( const pod::Matrix<T,R,C>& v );
|
||||
uf::stl::string /*UF_API*/ toString( const pod::Matrix<T,R,C>& v );
|
||||
}
|
||||
}
|
||||
namespace ext {
|
||||
|
||||
@ -21,7 +21,7 @@ uf::Matrix<T,R,C>::Matrix(const T components[R*C] ) {
|
||||
}
|
||||
// copies data into POD from 'components' (typed as std::matrix<T>)
|
||||
template<typename T, size_t R, size_t C>
|
||||
uf::Matrix<T,R,C>::Matrix(const std::vector<T>& components ) {
|
||||
uf::Matrix<T,R,C>::Matrix(const uf::stl::vector<T>& components ) {
|
||||
this->m_pod = uf::matrix::initialize( components );
|
||||
}
|
||||
// D-tor
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include "class.inl"
|
||||
|
||||
template<typename T, size_t R, size_t C>
|
||||
std::string /*UF_API*/ uf::string::toString( const pod::Matrix<T,R,C>& m ) {
|
||||
uf::stl::string /*UF_API*/ uf::string::toString( const pod::Matrix<T,R,C>& m ) {
|
||||
return uf::matrix::toString(m);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#if __GNUC__
|
||||
#if !__clang__ && __GNUC__
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("unroll-loops")
|
||||
#endif
|
||||
@ -47,7 +47,7 @@ const T* pod::Matrix<T,R,C>::operator[](size_t i) const {
|
||||
*/
|
||||
template<typename T>
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::identity() {
|
||||
pod::Matrix4t<T> matrix;
|
||||
alignas(16) pod::Matrix4t<T> matrix;
|
||||
#pragma unroll // GCC unroll 4
|
||||
for ( uint_fast8_t c = 0; c < 4; ++c )
|
||||
#pragma unroll // GCC unroll 4
|
||||
@ -57,7 +57,7 @@ pod::Matrix4t<T> /*UF_API*/ uf::matrix::identity() {
|
||||
}
|
||||
template<typename T>
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::initialize( const T* list ) {
|
||||
pod::Matrix4t<T> matrix;
|
||||
alignas(16) pod::Matrix4t<T> matrix;
|
||||
// memcpy(&matrix[0], list, sizeof(matrix));
|
||||
#pragma unroll // GCC unroll 16
|
||||
for ( uint_fast8_t i = 0; i < 16; ++i )
|
||||
@ -71,8 +71,8 @@ pod::Matrix4t<T> /*UF_API*/ uf::matrix::initialize( const T* list ) {
|
||||
return matrix;
|
||||
}
|
||||
template<typename T>
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::initialize( const std::vector<T>& list ) {
|
||||
pod::Matrix4t<T> matrix;
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::initialize( const uf::stl::vector<T>& list ) {
|
||||
alignas(16) pod::Matrix4t<T> matrix;
|
||||
if ( list.size() != 16 ) return matrix;
|
||||
// memcpy(&matrix[0], &list[0], sizeof(matrix));
|
||||
#pragma unroll // GCC unroll 16
|
||||
@ -89,7 +89,7 @@ pod::Matrix4t<T> /*UF_API*/ uf::matrix::initialize( const std::vector<T>& list )
|
||||
return matrix;
|
||||
}
|
||||
template<typename T> pod::Matrix<typename T::type_t, T::columns, T::columns> uf::matrix::identityi(){
|
||||
pod::Matrix<typename T::type_t, T::columns, T::columns> matrix;
|
||||
alignas(16) pod::Matrix<typename T::type_t, T::columns, T::columns> matrix;
|
||||
|
||||
#pragma unroll // GCC unroll T::columns
|
||||
for ( uint_fast8_t c = 0; c < T::columns; ++c )
|
||||
@ -149,7 +149,7 @@ template<typename T> bool uf::matrix::equals( const T& left, const T& right ) {
|
||||
// Basic arithmetic
|
||||
// Multiplies two matrices of same type and size together
|
||||
template<typename T> pod::Matrix<T,4,4> uf::matrix::multiply( const pod::Matrix<T,4,4>& left, const pod::Matrix<T,4,4>& right ) {
|
||||
pod::Matrix<T,4,4> res;
|
||||
alignas(16) pod::Matrix<T,4,4> res;
|
||||
#if UF_USE_SIMD
|
||||
auto row1 = uf::simd::load(&left[0]);
|
||||
auto row2 = uf::simd::load(&left[4]);
|
||||
@ -242,7 +242,7 @@ template<typename T> pod::Matrix<T,4,4> uf::matrix::multiply( const pod::Matrix<
|
||||
#endif
|
||||
}
|
||||
template<typename T, typename U> pod::Matrix<typename T::type_t, T::columns, T::columns> uf::matrix::multiply( const T& left, const U& right ) {
|
||||
pod::Matrix<typename T::type_t,T::rows,T::columns> res;
|
||||
alignas(16) pod::Matrix<typename T::type_t,T::rows,T::columns> res;
|
||||
#if 1
|
||||
float* dstPtr = &res[0];
|
||||
const float* leftPtr = &right[0];
|
||||
@ -279,16 +279,16 @@ template<typename T, typename U> pod::Matrix<typename T::type_t, T::columns, T::
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
template<typename T=pod::Matrix4> T /*UF_API*/ uf::matrix::multiplyAll( const T& m, typename T::type_t scalar ) {
|
||||
T matrix;
|
||||
template<typename T> T /*UF_API*/ uf::matrix::multiplyAll( const T& m, typename T::type_t scalar ) {
|
||||
alignas(16) T matrix;
|
||||
#pragma unroll // GCC unroll T::rows * T::columns
|
||||
for ( uint_fast8_t i = 0; i < T::rows * T::columns; ++i )
|
||||
matrix[i] = m[i] * scalar;
|
||||
|
||||
return matrix;
|
||||
}
|
||||
template<typename T=pod::Matrix4> T /*UF_API*/ uf::matrix::add( const T& lhs, const T& rhs ) {
|
||||
T matrix;
|
||||
template<typename T> T /*UF_API*/ uf::matrix::add( const T& lhs, const T& rhs ) {
|
||||
alignas(16) T matrix;
|
||||
#pragma unroll // GCC unroll T::rows * T::columns
|
||||
for ( uint_fast8_t i = 0; i < T::rows * T::columns; ++i )
|
||||
matrix[i] = lhs[i] + rhs[i];
|
||||
@ -297,7 +297,7 @@ template<typename T=pod::Matrix4> T /*UF_API*/ uf::matrix::add( const T& lhs, co
|
||||
}
|
||||
// Transpose matrix
|
||||
template<typename T> T uf::matrix::transpose( const T& matrix ) {
|
||||
T transpose;
|
||||
alignas(16) T transpose;
|
||||
|
||||
#pragma unroll // GCC unroll T::rows
|
||||
for ( typename T::type_t r = 0; r < T::rows; ++r )
|
||||
@ -313,7 +313,8 @@ template<typename T> T uf::matrix::inverse( const T& matrix ) {
|
||||
if ( T::rows != 4 || T::columns != 4 ) return matrix;
|
||||
|
||||
const typename T::type_t* m = &matrix[0];
|
||||
typename T::type_t inv[16], det;
|
||||
alignas(16) typename T::type_t inv[16];
|
||||
typename T::type_t det;
|
||||
uint_fast8_t i;
|
||||
|
||||
inv[0] = m[5] * m[10] * m[15] -
|
||||
@ -416,7 +417,7 @@ template<typename T> T uf::matrix::inverse( const T& matrix ) {
|
||||
det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12];
|
||||
if (det == 0) return matrix;
|
||||
det = 1.0 / det;
|
||||
T inverted;
|
||||
alignas(16) T inverted;
|
||||
#pragma unroll // GCC unroll 16
|
||||
for ( i = 0; i < 16; ++i )
|
||||
inverted[i] = inv[i] * det;
|
||||
@ -439,7 +440,7 @@ template<typename T> pod::Vector4t<T> uf::matrix::multiply( const pod::Matrix4t<
|
||||
if ( div && res.w > 0 ) res /= res.w;
|
||||
return res;
|
||||
#else
|
||||
auto res = pod::Vector4t<T>{
|
||||
alignas(16) auto res = pod::Vector4t<T>{
|
||||
vector[0] * mat[0] + vector[1] * mat[4] + vector[2] * mat[8] + vector[3] * mat[12],
|
||||
vector[0] * mat[1] + vector[1] * mat[5] + vector[2] * mat[9] + vector[3] * mat[13],
|
||||
vector[0] * mat[2] + vector[1] * mat[6] + vector[2] * mat[10] + vector[3] * mat[14],
|
||||
@ -455,14 +456,14 @@ template<typename T> T& uf::matrix::invert( T& matrix ) {
|
||||
}
|
||||
// Complex arithmetic
|
||||
template<typename T> T uf::matrix::translate( const T& matrix, const pod::Vector3t<typename T::type_t>& vector ) {
|
||||
T res = matrix;
|
||||
alignas(16) T res = matrix;
|
||||
res[12] = vector.x;
|
||||
res[13] = vector.y;
|
||||
res[14] = vector.z;
|
||||
return res;
|
||||
}
|
||||
template<typename T> T uf::matrix::rotate( const T& matrix, const pod::Vector3t<typename T::type_t>& vector ) {
|
||||
T res = matrix;
|
||||
alignas(16) T res = matrix;
|
||||
if ( vector.x != 0 ) {
|
||||
res[5] = cos( vector.x );
|
||||
res[6] = sin( vector.x );
|
||||
@ -486,7 +487,7 @@ template<typename T> T uf::matrix::rotate( const T& matrix, const pod::Vector3t<
|
||||
return res;
|
||||
}
|
||||
template<typename T> T uf::matrix::scale( const T& matrix, const pod::Vector3t<typename T::type_t>& vector ) {
|
||||
T res = matrix;
|
||||
alignas(16) T res = matrix;
|
||||
res[0] = vector.x;
|
||||
res[5] = vector.y;
|
||||
res[10] = vector.z;
|
||||
@ -529,7 +530,7 @@ template<typename T> T& uf::matrix::scale( T& matrix, const pod::Vector3t<typena
|
||||
}
|
||||
template<typename T>
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::orthographic( T l, T r, T b, T t, T f, T n ) {
|
||||
pod::Matrix4t<T> m = uf::matrix::identity();
|
||||
alignas(16) pod::Matrix4t<T> m = uf::matrix::identity();
|
||||
m[0*4+0] = 2 / (r - l);
|
||||
m[1*4+1] = 2 / (t - b);
|
||||
m[2*4+2] = - 2 / (f - n);
|
||||
@ -538,7 +539,7 @@ pod::Matrix4t<T> /*UF_API*/ uf::matrix::orthographic( T l, T r, T b, T t, T f, T
|
||||
m[3*4+2] = - (f + n) / (f - n);
|
||||
return m;
|
||||
/*
|
||||
std::vector<T> m = {
|
||||
uf::stl::vector<T> m = {
|
||||
2 / (r - l), 0, 0, 0,
|
||||
0, 2 / (t - b), 0, 0,
|
||||
0, 0, -2 / (f - n), 0,
|
||||
@ -549,15 +550,14 @@ pod::Matrix4t<T> /*UF_API*/ uf::matrix::orthographic( T l, T r, T b, T t, T f, T
|
||||
}
|
||||
template<typename T>
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::orthographic( T l, T r, T b, T t ) {
|
||||
std::vector<T> m = {
|
||||
return pod::Matrix4t<T>({
|
||||
2 / (r - l), 0, 0, 0,
|
||||
0, 2 / (t - b), 0, 0,
|
||||
0, 0, 1, 0,
|
||||
-(r + l) / (r - l), -(t+b)/(t-b), 0, 1
|
||||
};
|
||||
return uf::matrix::initialize(m);
|
||||
});
|
||||
}
|
||||
template<typename T=pod::Math::num_t>
|
||||
template<typename T>
|
||||
pod::Matrix4t<T> /*UF_API*/ uf::matrix::perspective( T fov, T raidou, T znear, T zfar ) {
|
||||
if ( uf::matrix::reverseInfiniteProjection ) {
|
||||
T f = static_cast<T>(1) / tan( static_cast<T>(0.5) * fov );
|
||||
@ -654,7 +654,7 @@ pod::Matrix<T,R,C>& /*UF_API*/ uf::matrix::decode( const ext::json::Value& json,
|
||||
|
||||
template<typename T, size_t R, size_t C>
|
||||
pod::Matrix<T,R,C> /*UF_API*/ uf::matrix::decode( const ext::json::Value& json, const pod::Matrix<T,R,C>& _m ) {
|
||||
pod::Matrix<T,R,C> m = _m;
|
||||
alignas(16) pod::Matrix<T,R,C> m = _m;
|
||||
if ( ext::json::isArray(json) )
|
||||
#pragma unroll // GCC unroll T::size
|
||||
for ( uint_fast8_t i = 0; i < R*C; ++i )
|
||||
@ -671,8 +671,8 @@ pod::Matrix<T,R,C> /*UF_API*/ uf::matrix::decode( const ext::json::Value& json,
|
||||
}
|
||||
|
||||
template<typename T, size_t R, size_t C>
|
||||
std::string /*UF_API*/ uf::matrix::toString( const pod::Matrix<T,R,C>& m ) {
|
||||
std::stringstream ss;
|
||||
uf::stl::string /*UF_API*/ uf::matrix::toString( const pod::Matrix<T,R,C>& m ) {
|
||||
uf::stl::stringstream ss;
|
||||
ss << "Matrix(\n\t";
|
||||
#pragma unroll // GCC unroll C
|
||||
for ( uint_fast8_t c = 0; c < C; ++c ) {
|
||||
@ -686,6 +686,6 @@ std::string /*UF_API*/ uf::matrix::toString( const pod::Matrix<T,R,C>& m ) {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
#if __GNUC__
|
||||
#if !__clang__ && __GNUC__
|
||||
#pragma GCC pop_options
|
||||
#endif
|
||||
@ -3,7 +3,7 @@ template<typename T> pod::Transform<T>& uf::physics::update( pod::Transform<T>&
|
||||
physics.previous = transform;
|
||||
|
||||
if ( physics.linear.acceleration != pod::Vector3t<T>{0,0,0} )
|
||||
physics.linear.velocity += (physics.linear.acceleration*uf::physics::time::delta);
|
||||
physics.linear.velocity += (physics.linear.acceleration * uf::physics::time::delta);
|
||||
if ( physics.rotational.acceleration != pod::Quaternion<T>{0,0,0,0} ) {
|
||||
physics.rotational.velocity = uf::quaternion::multiply(physics.rotational.velocity, physics.rotational.acceleration*uf::physics::time::delta);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <uf/config.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <cmath>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -94,7 +94,7 @@ public:
|
||||
Quaternion(T x, T y, T z, T w); // initializes POD to 'def'
|
||||
Quaternion(const Quaternion<T>::pod_t& pod); // copies POD altogether
|
||||
Quaternion(const T components[4]); // copies data into POD from 'components' (typed as C array)
|
||||
Quaternion(const std::vector<T>& components); // copies data into POD from 'components' (typed as std::vector<T>)
|
||||
Quaternion(const uf::stl::vector<T>& components); // copies data into POD from 'components' (typed as uf::stl::vector<T>)
|
||||
// D-tor
|
||||
// Unneccesary
|
||||
// POD access
|
||||
@ -140,7 +140,7 @@ public:
|
||||
|
||||
inline uf::Quaternion<T> getConjugate() const;
|
||||
inline uf::Quaternion<T> getInverse() const;
|
||||
inline std::string toString() const;
|
||||
inline uf::stl::string toString() const;
|
||||
// Overloaded ops
|
||||
// Accessing via subscripts
|
||||
T& operator[](std::size_t i);
|
||||
|
||||
@ -32,9 +32,9 @@ uf::Quaternion<T>::Quaternion(const T components[4] ) :
|
||||
{
|
||||
|
||||
}
|
||||
// copies data into POD from 'components' (typed as std::vector<T>)
|
||||
// copies data into POD from 'components' (typed as uf::stl::vector<T>)
|
||||
template<typename T>
|
||||
uf::Quaternion<T>::Quaternion(const std::vector<T>& components) {
|
||||
uf::Quaternion<T>::Quaternion(const uf::stl::vector<T>& components) {
|
||||
memcpy( this->m_pod.components, &components[0], 4 );
|
||||
}
|
||||
// D-tor
|
||||
@ -203,7 +203,7 @@ inline uf::Quaternion<T> uf::Quaternion<T>::getInverse() const {
|
||||
return uf::quaternion::inverse(this->m_pod);
|
||||
}
|
||||
template<typename T>
|
||||
inline std::string uf::Quaternion<T>::toString() const {
|
||||
inline uf::stl::string uf::Quaternion<T>::toString() const {
|
||||
return uf::vector::toString(this->m_pod);
|
||||
}
|
||||
// Overloaded ops
|
||||
|
||||
@ -27,9 +27,9 @@ namespace pod {
|
||||
|
||||
namespace uf {
|
||||
namespace primitive {
|
||||
std::vector<pod::Tree> UF_API populate( const std::vector<pod::Primitive>& cubes );
|
||||
std::vector<pod::Tree> UF_API populateEntirely( const std::vector<pod::Primitive>& cubes );
|
||||
std::vector<pod::Tree> UF_API populateEntirely( const std::vector<pod::Tree>& trees, bool = false );
|
||||
void UF_API test( const std::vector<pod::Primitive>& cubes, const std::vector<pod::Tree>& trees );
|
||||
uf::stl::vector<pod::Tree> UF_API populate( const uf::stl::vector<pod::Primitive>& cubes );
|
||||
uf::stl::vector<pod::Tree> UF_API populateEntirely( const uf::stl::vector<pod::Primitive>& cubes );
|
||||
uf::stl::vector<pod::Tree> UF_API populateEntirely( const uf::stl::vector<pod::Tree>& trees, bool = false );
|
||||
void UF_API test( const uf::stl::vector<pod::Primitive>& cubes, const uf::stl::vector<pod::Tree>& trees );
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
#include <uf/config.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <cmath>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -56,7 +56,7 @@ namespace uf {
|
||||
template<typename T> pod::Transform<T> /*UF_API*/ fromMatrix( const pod::Matrix4t<T>& matrix );
|
||||
template<typename T> pod::Transform<T>& /*UF_API*/ reference( pod::Transform<T>& transform, const pod::Transform<T>& parent, bool reorient = true );
|
||||
|
||||
template<typename T> std::string /*UF_API*/ toString( const pod::Transform<T>&, bool flatten = true );
|
||||
template<typename T> uf::stl::string /*UF_API*/ toString( const pod::Transform<T>&, bool flatten = true );
|
||||
template<typename T> ext::json::Value /*UF_API*/ encode( const pod::Transform<T>&, bool flatten = true, const ext::json::EncodingSettings& = {} );
|
||||
template<typename T> pod::Transform<T>& /*UF_API*/ decode( const ext::json::Value&, pod::Transform<T>& );
|
||||
template<typename T> pod::Transform<T> /*UF_API*/ decode( const ext::json::Value&, const pod::Transform<T>& = {} );
|
||||
@ -67,7 +67,7 @@ namespace uf {
|
||||
namespace uf {
|
||||
namespace string {
|
||||
template<typename T>
|
||||
std::string toString( const pod::Transform<T>& v, bool flatten = true );
|
||||
uf::stl::string toString( const pod::Transform<T>& v, bool flatten = true );
|
||||
}
|
||||
}
|
||||
namespace ext {
|
||||
|
||||
@ -152,9 +152,9 @@ template<typename T> pod::Transform<T>& /*UF_API*/ uf::transform::reference( pod
|
||||
}
|
||||
|
||||
template<typename T> // Normalizes a vector
|
||||
std::string /*UF_API*/ uf::transform::toString( const pod::Transform<T>& t, bool flatten ) {
|
||||
uf::stl::string /*UF_API*/ uf::transform::toString( const pod::Transform<T>& t, bool flatten ) {
|
||||
pod::Transform<T> transform = flatten ? uf::transform::flatten(t) : t;
|
||||
std::stringstream ss;
|
||||
uf::stl::stringstream ss;
|
||||
ss << "Transform(" << uf::string::toString(transform.position) << "; " << uf::string::toString(transform.orientation) << ")";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user