1
0
Fork 0

Gitlab CI

sphinx
May B. 2020-11-04 22:04:37 +01:00
parent f7c2f7069e
commit f5c46d5b46
20 changed files with 69 additions and 10 deletions

29
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,29 @@
image: gcc
before_script:
- apt-get update
- apt-get install -y --no-install-recommends cmake libssl-dev libvulkan-dev xorg-dev doxygen graphviz
build:
stage: build
script:
- mkdir build # compile
- cd build
- cmake ..
- make -j2 univerxel univerxel-client univerxel-server docs
- mkdir -p ../out/full ../out/client ../out/server/content # package artifacts
- cp -r univerxel content ../out/full
- cp -r univerxel-client content ../out/client
- rm ../out/client/content/cert.pem ../out/client/content/key.pem ../out/client/content/zstd.dict
- cp univerxel-server ../out/server
- cp content/cert.pem content/key.pem content/zstd.dict ../out/server/content
artifacts:
paths:
- out/full
- out/client
- out/server
- build/docs
expire_in: 1 week
# cache:
# paths:
# - "*.o"

View File

@ -1,5 +1,5 @@
/**
* \file server.cpp
* \file client.cpp
* \brief Univerxel client
* \author Maelys Bois
* \version 0.0.1

View File

@ -24,6 +24,7 @@ inline std::string toHexa(const glm::vec4& rgb) {
return sstr.str();
}
/// Client side configuration
struct options {
public:
options(toml::node_view<toml::node> config) {

View File

@ -12,6 +12,7 @@ enum queue: uint8_t {
count
};
/// Network client
class Client final: public Context, public Connection {
public:
Client(const address& ct,

View File

@ -10,6 +10,7 @@
class Window;
class Camera;
/// Graphics pipeline
namespace render {
class Model;
class LodModel;

View File

@ -323,7 +323,7 @@ UI::Actions UI::draw(config::client::options &options, state::state &state, cons
const auto flags = ImGuiInputTextFlags_EnterReturnsTrue;
// | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
ImGui::GetColumnWidth();
if (ImGui::InputText("", state.console.buffer.data(), state.console.buffer.size(), flags /*, TODO: callback, context*/) && strlen(state.console.buffer.data()) > 0)
if (ImGui::InputText("", state.console.buffer.data(), state.console.buffer.size(), flags /*TODO: completion (, callback, context)*/) && strlen(state.console.buffer.data()) > 0)
actions |= Actions::Message;
// Auto-focus on window apparition

View File

@ -65,7 +65,7 @@ std::optional<Image::properties> Image::Read(const std::string& imagepath, std::
default:
return {};
}
//FIXME: miplevels with size < block size (2 last) are corrupted
//WONT-FIX: miplevels with size < block size (2 last) are corrupted
const uint maxMipmapLevels = 1 + std::floor(std::log2(std::max(info.size.height, info.size.width))) - 2;
info.mipmapLevels = std::min(maxMipmapLevels, info.mipmapLevels);

View File

@ -10,6 +10,7 @@
#include "api/Images.hpp"
struct windowOptions;
/// OpenGL graphics pipeline
namespace render::gl {
/// OpenGL rendering

View File

@ -13,7 +13,6 @@ namespace render {
namespace render::gl {
class Renderer;
}
/// OpenGL programs
namespace pass {
/// OpenGL shaders pipeline
class Program {

View File

@ -188,7 +188,7 @@ bool Renderer::Load(Window& window, const renderOptions& opt, const windowOption
appInfo.applicationVersion = VK_MAKE_VERSION(0, 0, 1);
appInfo.pEngineName = "No Engine";
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.apiVersion = VK_API_VERSION_1_2;
appInfo.apiVersion = VK_MAKE_VERSION(1, 2, 0);
VkInstanceCreateInfo createInfo{};
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;

View File

@ -3,6 +3,7 @@
#include "forward.hpp"
struct windowOptions;
/// Vulkan graphics pipeline
namespace render::vk {
class Allocator;
class SwapChain;

View File

@ -40,7 +40,7 @@ void DistantUniverse::update(voxel_pos pos, float deltaTime) {
if (glm::length2(diff - it_c->first) > glm::pow2(keepDistance)) {
it_c = chunks.erase(it_c);
} else {
if(const auto neighbors = std::dynamic_pointer_cast<world::client::EdittableChunk>(it_c->second)->update(deltaTime, true /*FIXME: rnd from contouring*/)) {
if(const auto neighbors = std::dynamic_pointer_cast<world::client::EdittableChunk>(it_c->second)->update(deltaTime, true /*MAYBE: random update*/)) {
contouring->onUpdate(std::make_pair(area.first, it_c->first), diff, chunks, neighbors.value());
}
++it_c;

View File

@ -6,9 +6,10 @@
namespace data {
/// File loader
class file_content: public std::vector<char> {
public:
// Read first
/// Read first
file_content(const std::vector<std::string>& paths, data::out_view prefix = data::out_view(nullptr, 0)):
std::vector<char>(), prefix_size(prefix.size())
{

View File

@ -4,7 +4,9 @@
#include <vector>
#include <optional>
/// Generation indexing and containers (index, generation)
namespace data::generational {
/// Generation element identifier
struct id {
id(size_t index, size_t generation = 0): index(index), generation(generation) { }
id(): id(0) { }
@ -14,6 +16,7 @@ namespace data::generational {
bool operator==(const id &i) const { return index == i.index && generation == i.generation; }
};
/// Closed generational allocator
class allocator {
public:
allocator() { }
@ -68,6 +71,7 @@ namespace data::generational {
std::vector<size_t> freed;
};
/// Generational container accessible by id
template<typename T>
class vector {
public:
@ -229,6 +233,7 @@ namespace data::generational {
std::vector<size_t> freed;
};
/// Dummy generational container without allocation nor validation. A view to vector
template<typename T>
class view_vector: public std::vector<std::optional<T>> {
public:

View File

@ -7,12 +7,14 @@
namespace data {
/// Map vector to istream
struct vec_istream: std::streambuf {
vec_istream(std::vector<char> &vec) {
this->setg(&vec[0], &vec[0], &vec[0] + vec.size());
}
};
/// Abstract data with moving cursor
struct view {
view(size_t size): siz(size) { }
@ -22,6 +24,7 @@ struct view {
constexpr size_t size() const { return siz; }
constexpr bool isDone() const { return cur >= siz; }
};
/// Vector with in_view interface
struct in_vector {
/// 512 Mébibits
static constexpr size_t MAX_SIZE = 1ul << 26;
@ -41,6 +44,7 @@ struct in_vector {
memcpy(writeTo(len), data, len);
}
};
// Abstract data writer
struct in_view: view {
in_view(uint8_t *ptr, size_t size): view(size), ptr(ptr) {
assert(ptr != nullptr);
@ -57,6 +61,7 @@ struct in_view: view {
memcpy(writeTo(len), data, len);
}
};
/// Abstract data reader
struct out_view: view {
out_view(): out_view(nullptr, 0) { }
out_view(const uint8_t *ptr, size_t size): view(size), ptr(ptr) { }
@ -75,7 +80,9 @@ struct out_view: view {
constexpr const uint8_t* data() const { return ptr; }
constexpr size_t remaining() const { return size() - cur; }
};
/// Pointer to opaque owned memory
using handle_t = std::shared_ptr<const void>;
/// out_view with owned data
struct out_buffer: out_view {
out_buffer(): out_view() { }
out_buffer(const out_view& view, const handle_t& handle):

View File

@ -7,6 +7,7 @@
namespace net {
/// Abstract stream
struct stream_ctx {
stream_ctx(uint64_t id): stream_id(id) { }
uint64_t stream_id;
@ -17,6 +18,7 @@ struct stream_ctx {
friend bool operator==(const stream_ctx &a, const stream_ctx &b) { return a.stream_id == b.stream_id; }
};
/// Outgoing stream
struct out_stream_ctx: stream_ctx {
out_stream_ctx(uint64_t id, uint8_t queue_id, const data::out_buffer& buf):
stream_ctx(id), buffer(buf), queue_id(queue_id) { }
@ -24,10 +26,12 @@ struct out_stream_ctx: stream_ctx {
data::out_buffer buffer;
uint8_t queue_id;
};
/// Incoming stream
struct in_stream_ctx: stream_ctx {
in_stream_ctx(uint64_t id): stream_ctx(id) { }
data::in_vector buffer;
};
/// Informations about packets
enum class PacketFlags {
NONE = 0,
DATAGRAM = 1 << 0,
@ -156,7 +160,6 @@ private:
std::forward_list<in_stream_ctx> incoming;
// MAYBE: add bidirectional streams
// TODO: premanant streams: background, priority
};
}

View File

@ -4,11 +4,13 @@
#include "../utils/logger.hpp"
#include <picoquic/picosocks.h>
/// Network protocol
namespace net {
/// Application Protocol Negotiation
constexpr auto ALPN = "univerxel_quic";
/// Reasons for client server connection to break
enum class disconnect_reason: uint16_t {
UNEXPECTED = 0,
// Client quit
@ -20,6 +22,7 @@ enum class disconnect_reason: uint16_t {
PROTOCOL_VIOLATION = 15,
};
/// Packets from server to client
enum class server_packet_type: uint8_t {
/// MAYBE: HELLO = 0,
@ -50,7 +53,6 @@ enum class server_packet_type: uint8_t {
/// Update entities instances position and velocity
/// {size_t(entity), size_t(count), {size_t(index), ifvec3(pos), vec3(velocity)}[]}[]
/// FIXME: fromat to fit PICOQUIC_MAX_PACKET_SIZE
ENTITIES = 21,
/// World compression dictionary
@ -64,6 +66,7 @@ enum class server_packet_type: uint8_t {
/// char[] (not null terminated)
MESSAGE = 29,
};
/// Packets from client to server
enum class client_packet_type: uint8_t {
/// Interact with voxels
/// actions::FillShape
@ -84,6 +87,7 @@ enum class client_packet_type: uint8_t {
constexpr auto MAX_PENDING_CHUNK_COUNT = 256;
/// Server address as name(ip or dns name) and port
struct address {
std::string host;
int port;
@ -103,9 +107,12 @@ struct address {
return os << ct.host << ':' << ct.port;
}
};
/// Server properties
struct exposure: address {
uint32_t max_connections;
/// TLS private key
std::string key;
/// TLS public key
std::string cert;
};

View File

@ -7,7 +7,7 @@ namespace net {
//TODO: preallocate static data pool
/// Write allocated packets
/// Helper to write allocated packets
class PacketWriter final {
public:
PacketWriter(size_t size): buffer((uint8_t*)malloc(size), size) { }
@ -100,6 +100,7 @@ private:
data::in_view buffer;
};
/// Helper to read out_view
class PacketReader final {
public:
PacketReader(const data::out_view& buf): buffer(buf) { }

View File

@ -4,6 +4,7 @@
#include "world/actions.hpp"
#include "geometry/Faces.hpp"
/// Link between world::server::SharedUniverse and world::client::LocalUniverse
struct server_handle {
bool running = false;
const world::client::area_map *areas;

View File

@ -5,6 +5,7 @@
namespace config::server {
/// Server side configuration
struct options {
public:
options(toml::node_view<toml::node> config): world() {