text
stringlengths
1
24.5M
#include "Gui.hpp" #include "Graphics/Graphics.hpp" #include "Uis/Drivers/ConstantDriver.hpp" #include "Models/Vertex2d.hpp" namespace acid { static const std::vector<Vertex2d> VERTICES = { {{0.0f, 0.0f}, {0.0f, 0.0f}}, {{1.0f, 0.0f}, {1.0f, 0.0f}}, {{1.0f, 1.0f}, {1.0f, 1.0f}}, {{0.0f, 1.0f}, {0.0f, 1.0f}} }; st...
#pragma once #include "Maths/Colour.hpp" #include "Maths/Vector2.hpp" #include "Models/Model.hpp" #include "Graphics/Buffers/UniformHandler.hpp" #include "Graphics/Descriptors/DescriptorsHandler.hpp" #include "Graphics/Images/Image2d.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" #include "Uis/UiObject.hpp" ...
#include "GuisSubrender.hpp" #include "Models/Vertex2d.hpp" #include "Uis/Uis.hpp" #include "Gui.hpp" namespace acid { GuisSubrender::GuisSubrender(const Pipeline::Stage &pipelineStage) : Subrender(pipelineStage), pipeline(pipelineStage, {"Shaders/Guis/Gui.vert", "Shaders/Guis/Gui.frag"}, {Vertex2d::GetVertexInput(...
#pragma once #include "Graphics/Subrender.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" namespace acid { class ACID_EXPORT GuisSubrender : public Subrender { public: explicit GuisSubrender(const Pipeline::Stage &pipelineStage); void Render(const CommandBuffer &commandBuffer) override; private: Pipeline...
#pragma once #include <rocket.hpp> #include "Devices/Windows.hpp" #include "Utils/StreamFactory.hpp" namespace acid { /** * @brief Interface for an axis based input device. */ class ACID_EXPORT InputAxis : public StreamFactory<InputAxis>, public virtual rocket::trackable { public: class Argument { public: frie...
#pragma once #include "Devices/Windows.hpp" #include "Utils/StreamFactory.hpp" #include "InputAxis.hpp" namespace acid { /** * @brief Interface for a binary input device. */ class ACID_EXPORT InputButton : public StreamFactory<InputButton>, public virtual rocket::trackable { public: virtual ~InputButton() = defaul...
#include "InputDelay.hpp" namespace acid { InputDelay::InputDelay(const Time &delay, const Time &repeat) : elapsedDelay(delay), elapsedRepeat(repeat) { } void InputDelay::Update(bool keyIsDown) { if (keyIsDown) { delayOver = elapsedDelay.GetElapsed() != 0; } else { delayOver = false; elapsedDelay.SetStartTi...
#pragma once #include "Engine/Engine.hpp" namespace acid { class ACID_EXPORT InputDelay { public: explicit InputDelay(const Time &delay = 0.06s, const Time &repeat = Time::Seconds(0.06f)); void Update(bool keyIsDown); bool CanInput(); const Time &GetDelay() const { return elapsedDelay.GetInterval(); } void Se...
#include "Inputs.hpp" #include <iomanip> namespace acid { Inputs::Inputs() : nullScheme(std::make_unique<InputScheme>()), currentScheme(nullScheme.get()) { } void Inputs::Update() { } InputScheme *Inputs::GetScheme(const std::string &name) const { auto it = schemes.find(name); if (it == schemes.end()) { Log::...
#pragma once #include "Engine/Engine.hpp" #include "InputScheme.hpp" namespace acid { /** * @brief Module used for managing abstract inputs organized in schemes. */ class ACID_EXPORT Inputs : public Module::Registrar<Inputs> { inline static const bool Registered = Register(Stage::Pre, Requires<Windows, Joysticks>(...
#include "InputScheme.hpp" #include <iomanip> #include "Files/Json/Json.hpp" namespace acid { InputScheme::InputScheme(const std::filesystem::path &filename) : file(filename, std::make_unique<Json>()) { // Load this scheme from the file right away. file.Load(); file.GetNode() >> *this; File testOutFile(filenam...
#pragma once #include "Devices/Joysticks.hpp" #include "Devices/Windows.hpp" #include "Files/File.hpp" #include "InputAxis.hpp" #include "InputButton.hpp" namespace acid { /** * Class is used to abstract and wrap input methods inside a serializable factory. */ class ACID_EXPORT InputScheme : NonCopyable { friend c...
#include "ButtonInputAxis.hpp" namespace acid { ButtonInputAxis::ButtonInputAxis(std::unique_ptr<InputButton> &&negative, std::unique_ptr<InputButton> &&positive) : negative(std::move(negative)), positive(std::move(positive)) { negative->OnButton().connect(this, [this](InputAction action, bitmask::bitmask<InputMod>...
#pragma once #include "Inputs/InputButton.hpp" #include "Inputs/InputAxis.hpp" namespace acid { /** * @brief InputAxis composed of two buttons. */ class ACID_EXPORT ButtonInputAxis : public InputAxis::Registrar<ButtonInputAxis> { inline static const bool Registered = Register("button"); public: /** * Creates a ...
#include "CompoundInputAxis.hpp" namespace acid { CompoundInputAxis::CompoundInputAxis(std::vector<std::unique_ptr<InputAxis>> &&axes) : axes(std::move(axes)) { ConnectAxes(); } float CompoundInputAxis::GetAmount() const { float result = 0.0f; for (const auto &axis : axes) result += axis->GetAmount(); return ...
#pragma once #include "Utils/NonCopyable.hpp" #include "Inputs/InputAxis.hpp" namespace acid { /** * @brief Combines multiple axes inputs into a single axis. */ class ACID_EXPORT CompoundInputAxis : public InputAxis::Registrar<CompoundInputAxis>, NonCopyable { inline static const bool Registered = Register("compou...
#include "JoystickHatInput.hpp" namespace acid { JoystickHatInput::JoystickHatInput(JoystickPort port, JoystickHat hat, const bitmask::bitmask<JoystickHatValue> &hatFlags) : hat(hat), hatFlags(hatFlags) { SetPort(port); } InputAxis::ArgumentDescription JoystickHatInput::GetArgumentDescription() const { return { ...
#pragma once #include "Devices/Joysticks.hpp" #include "Inputs/InputButton.hpp" #include "Inputs/InputAxis.hpp" namespace acid { /** * @brief InputButton from a joystick. */ class ACID_EXPORT JoystickHatInput : public InputAxis::Registrar<JoystickHatInput>, public InputButton::Registrar<JoystickHatInput> { inline ...
#include "JoystickInputAxis.hpp" namespace acid { JoystickInputAxis::JoystickInputAxis(JoystickPort port, JoystickAxis axis) : axis(axis) { SetPort(port); } float JoystickInputAxis::GetAmount() const { return scale * joystick->GetAxis(axis) + offset; } void JoystickInputAxis::SetPort(JoystickPort port) { joystic...
#pragma once #include "Devices/Joysticks.hpp" #include "Inputs/InputAxis.hpp" namespace acid { /** * @brief InputAxis input from a joystick input device. */ class ACID_EXPORT JoystickInputAxis : public InputAxis::Registrar<JoystickInputAxis> { inline static const bool Registered = Register("joystick"); public: /*...
#include "MouseInputAxis.hpp" namespace acid { MouseInputAxis::MouseInputAxis(uint8_t axis) : axis(axis) { Windows::Get()->GetWindow(0)->OnMousePosition().connect(this, [this](Vector2d value) { onAxis(GetAmount()); }); } float MouseInputAxis::GetAmount() const { return scale * static_cast<float>(Windows::Get()-...
#pragma once #include "Inputs/InputAxis.hpp" namespace acid { /** * @brief InputAxis input from a mouse. */ class ACID_EXPORT MouseInputAxis : public InputAxis::Registrar<MouseInputAxis> { inline static const bool Registered = Register("mouse"); public: /** * Creates a new axis mouse. * @param axis The axis o...
#include "AxisInputButton.hpp" namespace acid { AxisInputButton::AxisInputButton(std::unique_ptr<InputAxis> &&axis, float min, float max) : axis(std::move(axis)), min(min), max(max) { /*if (this->axis) { this->axis->OnAxis().connect(this, [this](float value) { onButton(IsDown()); }); }*/ } bool AxisInputB...
#pragma once #include "Inputs/InputAxis.hpp" #include "Inputs/InputButton.hpp" namespace acid { /** * @brief InputButton composed of a axis. */ class ACID_EXPORT AxisInputButton : public InputButton::Registrar<AxisInputButton> { inline static const bool Registered = Register("axis"); public: /** * Creates a new...
#include "CompoundInputButton.hpp" namespace acid { CompoundInputButton::CompoundInputButton(std::vector<std::unique_ptr<InputButton>> &&buttons, bool useAnd) : buttons(std::move(buttons)), useAnd(useAnd) { ConnectButtons(); } bool CompoundInputButton::IsDown() const { for (const auto &button : buttons) { if (u...
#pragma once #include "Utils/NonCopyable.hpp" #include "Inputs/InputButton.hpp" namespace acid { /** * @brief Combines multiple button inputs into a single button. */ class ACID_EXPORT CompoundInputButton : public InputButton::Registrar<CompoundInputButton>, NonCopyable { inline static const bool Registered = Regi...
#include "JoystickInputButton.hpp" namespace acid { JoystickInputButton::JoystickInputButton(JoystickPort port, JoystickButton button) : button(button) { SetPort(port); } bool JoystickInputButton::IsDown() const { return (joystick->GetButton(button) != InputAction::Release) ^ inverted; } void JoystickInputButton:...
#pragma once #include "Devices/Joysticks.hpp" #include "Inputs/InputButton.hpp" namespace acid { /** * @brief InputButton input from a joystick input device. */ class ACID_EXPORT JoystickInputButton : public InputButton::Registrar<JoystickInputButton> { inline static const bool Registered = Register("joystick"); p...
#include "KeyboardInputButton.hpp" namespace acid { KeyboardInputButton::KeyboardInputButton(Key key) : key(key) { Windows::Get()->GetWindow(0)->OnKey().connect(this, [this](Key key, InputAction action, bitmask::bitmask<InputMod> mods) { if (this->key == key) { onButton(action, mods); } }); } bool KeyboardI...
#pragma once #include "Inputs/InputButton.hpp" namespace acid { /** * @brief InputButton input from the keyboard input device. */ class ACID_EXPORT KeyboardInputButton : public InputButton::Registrar<KeyboardInputButton> { inline static const bool Registered = Register("keyboard"); public: /** * Creates a new b...
#include "MouseInputButton.hpp" namespace acid { MouseInputButton::MouseInputButton(MouseButton button) : button(button) { Windows::Get()->GetWindow(0)->OnMouseButton().connect(this, [this](MouseButton button, InputAction action, bitmask::bitmask<InputMod> mods) { if (this->button == button) { onButton(action, ...
#pragma once #include "Inputs/InputButton.hpp" namespace acid { /** * @brief InputButton input from the mouse input device. */ class ACID_EXPORT MouseInputButton : public InputButton::Registrar<MouseInputButton> { inline static const bool Registered = Register("mouse"); public: /** * Creates a new button mouse....
#include "Fog.hpp" namespace acid { Fog::Fog(const Colour &colour, float density, float gradient, float lowerLimit, float upperLimit) : colour(colour), density(density), gradient(gradient), lowerLimit(lowerLimit), upperLimit(upperLimit) { } void Fog::Start() { } void Fog::Update() { } const Node &operator>>(co...
#pragma once #include "Maths/Colour.hpp" #include "Files/Node.hpp" #include "Scenes/Component.hpp" namespace acid { /** * @brief Component that represents a 3d fog. */ class ACID_EXPORT Fog : public Component::Registrar<Fog> { inline static const bool Registered = Register("fog"); public: /** * Creates a new ha...
#include "Light.hpp" #include "Scenes/Entity.hpp" namespace acid { Light::Light(const Colour &colour, float radius) : colour(colour), radius(radius) { } void Light::Start() { } void Light::Update() { } const Node &operator>>(const Node &node, Light &light) { node["colour"].Get(light.colour); node["radius"].Get...
#pragma once #include "Maths/Colour.hpp" #include "Maths/Vector3.hpp" #include "Scenes/Component.hpp" namespace acid { /** * @brief Component that represents a point light. */ class ACID_EXPORT Light : public Component::Registrar<Light> { inline static const bool Registered = Register("light"); public: /** * Cr...
#include "DefaultMaterial.hpp" #include "Animations/AnimatedMesh.hpp" #include "Maths/Transform.hpp" namespace acid { DefaultMaterial::DefaultMaterial(const Colour &baseDiffuse, std::shared_ptr<Image2d> imageDiffuse, float metallic, float roughness, std::shared_ptr<Image2d> imageMaterial, std::shared_ptr<Image2d> im...
#pragma once #include "Maths/Colour.hpp" #include "Graphics/Images/Image2d.hpp" #include "Material.hpp" namespace acid { /** * @brief Class that represents the default material shader. */ class ACID_EXPORT DefaultMaterial : public Material::Registrar<DefaultMaterial> { inline static const bool Registered = Registe...
#pragma once #include "Utils/StreamFactory.hpp" #include "Graphics/Descriptors/DescriptorsHandler.hpp" #include "Graphics/Buffers/UniformHandler.hpp" #include "Maths/Transform.hpp" #include "MaterialPipeline.hpp" namespace acid { /** * @brief Component that represents a material shader that is used to render a model...
#include "MaterialPipeline.hpp" #include "Resources/Resources.hpp" #include "Graphics/Graphics.hpp" namespace acid { std::shared_ptr<MaterialPipeline> MaterialPipeline::Create(const Node &node) { if (auto resource = Resources::Get()->Find<MaterialPipeline>(node)) return resource; auto result = std::make_shared<M...
#pragma once #include "Graphics/Pipelines/PipelineGraphics.hpp" #include "Graphics/RenderStage.hpp" namespace acid { /** * @brief Resource that represents a material pipeline. */ class ACID_EXPORT MaterialPipeline : public Resource { public: /** * Creates a new material pipeline, or finds one with the same value...
#include "Colour.hpp" namespace acid { const Colour Colour::Clear(0x00000000, Type::RGBA); const Colour Colour::Black(0x000000FF, Type::RGBA); const Colour Colour::Grey(0x808080); const Colour Colour::Silver(0xC0C0C0); const Colour Colour::White(0xFFFFFF); const Colour Colour::Maroon(0x800000); const Colour Colour::Re...
#pragma once #include <cassert> #include <sstream> #include <iomanip> #include "Maths.hpp" namespace acid { class Node; /** * @brief Holds a RGBA colour. */ class ACID_EXPORT Colour { public: /// In order of how bits are mapped [24, 16, 8, 0xFF]. enum class Type { RGBA, ARGB, RGB }; Colour() = default; /...
#include "ElapsedTime.hpp" #include <cmath> namespace acid { ElapsedTime::ElapsedTime(const Time &interval) : startTime(Time::Now()), interval(interval) { } uint32_t ElapsedTime::GetElapsed() { auto now = Time::Now(); auto elapsed = static_cast<uint32_t>(std::floor((now - startTime) / interval)); if (elapsed !...
#pragma once #include "Time.hpp" namespace acid { class ACID_EXPORT ElapsedTime { public: explicit ElapsedTime(const Time &interval = -1s); uint32_t GetElapsed(); const Time &GetStartTime() const { return startTime; } void SetStartTime(const Time &startTime) { this->startTime = startTime; } const Time &GetInt...
#include "Maths.hpp" #include <random> namespace acid { static std::random_device RandomDevice; static std::mt19937 RandomGenerator(RandomDevice()); float Maths::Random(float min, float max) { std::uniform_real_distribution<float> dist(min, max); return dist(RandomGenerator); } float Maths::RandomNormal(float sta...
#pragma once #include <algorithm> #include <cstdint> #include <cmath> #include <functional> #include "Export.hpp" namespace acid { /** * @brief Class that holds many various math functions. */ class ACID_EXPORT Maths { public: template<typename T> constexpr static T PI = static_cast<T>(3.141592653589793238462643...
#include "Matrix2.hpp" #include <cassert> #include <cstring> #include "Matrix3.hpp" #include "Matrix4.hpp" namespace acid { Matrix2::Matrix2(float diagonal) { std::memset(rows, 0, 2 * 2 * sizeof(float)); rows[0][0] = diagonal; rows[1][1] = diagonal; } Matrix2::Matrix2(const Matrix3 &source) { std::memcpy(rows, ...
#pragma once #include "Vector2.hpp" namespace acid { class Matrix3; class Matrix4; /** * @brief Holds a row major 2x2 matrix. */ class ACID_EXPORT Matrix2 { public: /** * Constructor for Matrix2. The matrix is initialised to the identity. * @param diagonal The value set to the diagonals. */ Matrix2(float d...
#include "Matrix3.hpp" #include <cassert> #include <cstring> #include "Matrix2.hpp" #include "Matrix4.hpp" namespace acid { Matrix3::Matrix3(float diagonal) { std::memset(rows, 0, 3 * 3 * sizeof(float)); rows[0][0] = diagonal; rows[1][1] = diagonal; rows[2][2] = diagonal; } Matrix3::Matrix3(const Matrix2 &sourc...
#pragma once #include "Vector3.hpp" namespace acid { class Matrix2; class Matrix4; /** * @brief Holds a row major 3x3 matrix. */ class ACID_EXPORT Matrix3 { public: /** * Constructor for Matrix3. The matrix is initialised to the identity. * @param diagonal The value set to the diagonals. */ Matrix3(float d...
#include "Matrix4.hpp" #include <cassert> #include <cstring> #include "Matrix2.hpp" #include "Matrix3.hpp" namespace acid { Matrix4::Matrix4(float diagonal) { std::memset(rows, 0, 4 * sizeof(Vector4f)); rows[0][0] = diagonal; rows[1][1] = diagonal; rows[2][2] = diagonal; rows[3][3] = diagonal; } Matrix4::Matri...
#pragma once #include "Vector2.hpp" #include "Vector3.hpp" #include "Vector4.hpp" namespace acid { class Matrix2; class Matrix3; /** * @brief Holds a row major 4x4 matrix. */ class ACID_EXPORT Matrix4 { public: /** * Constructor for Matrix4. The matrix is initialised to the identity. * @param diagonal The val...
#include "Quaternion.hpp" namespace acid { const Quaternion Quaternion::Zero(0.0f, 0.0f, 0.0f, 0.0f); const Quaternion Quaternion::One(1.0f, 1.0f, 1.0f, 1.0f); const Quaternion Quaternion::PositiveInfinity(+std::numeric_limits<float>::infinity(), +std::numeric_limits<float>::infinity(), +std::numeric_limits<float>::i...
#pragma once #include "Matrix4.hpp" #include "Vector3.hpp" namespace acid { /** * @brief A vector like object of the form w + xi + yj + zk, where w, x, y, z are real numbers and i, j, k are imaginary units. */ class ACID_EXPORT Quaternion { public: /** * Constructor for Quaternion. */ Quaternion() = default; ...
#pragma once #include <chrono> #include <string> #include <iomanip> #include <sstream> #include "Export.hpp" namespace acid { using namespace std::chrono_literals; class Node; /** * @brief Represents a time value stored in microseconds. */ class ACID_EXPORT Time { public: Time() = default; /* * Creates a ne...
#include "Transform.hpp" #include "Scenes/Entity.hpp" namespace acid { Transform::Transform(const Vector3f &position, const Vector3f &rotation, const Vector3f &scale) : position(position), rotation(rotation), scale(scale) { } Transform::~Transform() { delete worldTransform; for (auto &child : children) child...
#pragma once #include "Matrix4.hpp" #include "Vector3.hpp" #include "Scenes/Component.hpp" namespace acid { /** * @brief Holds position, rotation, and scale components. */ class ACID_EXPORT Transform : public Component::Registrar<Transform> { inline static const bool Registered = Register("transform"); public: ...
#include "Vector2.hpp" namespace acid { template<> const Vector2f Vector2f::Zero(0.0f); template<> const Vector2f Vector2f::One(1.0f); template<> const Vector2f Vector2f::Infinity(std::numeric_limits<float>::infinity()); template<> const Vector2f Vector2f::Left(-1.0f, 0.0f); template<> const Vector2f Vector2f::Right(1...
#pragma once #include <cstdint> #include <type_traits> #include "Export.hpp" namespace acid { template<typename T> class Vector3; /** * @brief Holds a 2-tuple vector. * @tparam T The value type. */ template<typename T> class Vector2 { public: /** * Constructor for Vector2. */ constexpr Vector2() = default;...
#include "Vector3.hpp" namespace acid { template<> const Vector3f Vector3f::Zero(0.0f); template<> const Vector3f Vector3f::One(1.0f); template<> const Vector3f Vector3f::Infinity(std::numeric_limits<float>::infinity()); template<> const Vector3f Vector3f::Left(-1.0f, 0.0f, 0.0f); template<> const Vector3f Vector3f::R...
#pragma once #include <cstdint> #include <type_traits> #include "Export.hpp" namespace acid { template<typename T> class Vector2; template<typename T> class Vector4; /** * @brief Holds a 3-tuple vector. * @tparam T The value type. */ template<typename T> class Vector3 { public: /** * Constructor for Vector3....
#include "Vector4.hpp" namespace acid { template<typename T> const Vector4<T> Vector4<T>::Zero(0.0f); template<typename T> const Vector4<T> Vector4<T>::One(1.0f); template<typename T> const Vector4<T> Vector4<T>::Infinity(std::numeric_limits<float>::infinity()); }
#pragma once #include <cstdint> #include <type_traits> #include "Export.hpp" namespace acid { template<typename T> class Vector2; template<typename T> class Vector3; /** * @brief Holds a 4-tuple vector. * @tparam T The value type. */ template<typename T> class Vector4 { public: /** * Constructor for Vector4....
#include "Mesh.hpp" #include "Scenes/Entity.hpp" #include "Maths/Transform.hpp" #include "Scenes/Scenes.hpp" namespace acid { Mesh::Mesh(std::shared_ptr<Model> model, std::unique_ptr<Material> &&material) : model(std::move(model)), material(std::move(material)) { } void Mesh::Start() { if (material) material->C...
#pragma once #include "Models/Model.hpp" #include "Models/Vertex3d.hpp" #include "Scenes/Component.hpp" #include "Materials/Material.hpp" namespace acid { /** * @brief Component that represents a model/mesh. */ class ACID_EXPORT Mesh : public Component::Registrar<Mesh> { inline static const bool Registered = Regis...
#include "MeshesSubrender.hpp" #include "Animations/AnimatedMesh.hpp" #include "Scenes/Scenes.hpp" #include "Mesh.hpp" namespace acid { MeshesSubrender::MeshesSubrender(const Pipeline::Stage &pipelineStage, Sort sort) : Subrender(pipelineStage), sort(sort), uniformScene(true) { } void MeshesSubrender::Render(cons...
#pragma once #include "Graphics/Subrender.hpp" #include "Graphics/Buffers/UniformHandler.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" namespace acid { class ACID_EXPORT MeshesSubrender : public Subrender { public: enum class Sort { None, Front, Back }; explicit MeshesSubrender(const Pipeline::Stag...
#include "Model.hpp" #include "Scenes/Scenes.hpp" #include "Resources/Resources.hpp" namespace acid { bool Model::CmdRender(const CommandBuffer &commandBuffer, uint32_t instances) const { if (vertexBuffer && indexBuffer) { VkBuffer vertexBuffers[1] = {vertexBuffer->GetBuffer()}; VkDeviceSize offsets[1] = {0}; ...
#pragma once #include <cstring> #include <functional> #include <unordered_map> #include "Maths/Vector3.hpp" #include "Graphics/Buffers/Buffer.hpp" #include "Resources/Resource.hpp" namespace acid { template<typename Base> class ModelFactory { public: using TCreateReturn = std::shared_ptr<Base>; using TCreateMeth...
#pragma once #include "Maths/Vector2.hpp" #include "Graphics/Pipelines/Shader.hpp" namespace acid { class ACID_EXPORT Vertex2d { public: Vertex2d() = default; Vertex2d(const Vector2f &position, const Vector2f &uv) : position(position), uv(uv) { } static Shader::VertexInput GetVertexInput(uint32_t baseBinding...
#pragma once #include "Maths/Vector2.hpp" #include "Maths/Vector3.hpp" #include "Graphics/Pipelines/Shader.hpp" namespace acid { class ACID_EXPORT Vertex3d { public: Vertex3d() = default; Vertex3d(const Vector3f &position, const Vector2f &uv, const Vector3f &normal) : position(position), uv(uv), normal(normal...
#include "GltfModel.hpp" #include <tiny_gltf.h> #include "Files/Files.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { std::shared_ptr<GltfModel> GltfModel::Create(const Node &node) { if (auto resource = Resources::Get()->Find<GltfModel>(node)) return resource; auto result...
#pragma once #include "Models/Model.hpp" #include "Graphics/Images/Image2d.hpp" namespace acid { /** * @brief Resource that represents a GLTF model. */ class ACID_EXPORT GltfModel : public Model::Registrar<GltfModel> { inline static const bool Registered = Register("gltf", ".gltf"); public: /** * Creates a new ...
#include "ObjModel.hpp" #include <tiny_obj.h> #include "Files/Files.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { class MaterialStreamReader : public tinyobj::MaterialReader { public: explicit MaterialStreamReader(std::filesystem::path folder) : folder(std::move(folder)) ...
#pragma once #include "Models/Model.hpp" namespace acid { /** * @brief Resource that represents a OBJ model. */ class ACID_EXPORT ObjModel : public Model::Registrar<ObjModel> { inline static const bool Registered = Register("obj", ".obj");; public: /** * Creates a new OBJ model, or finds one with the same value...
#include "CubeModel.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { std::shared_ptr<CubeModel> CubeModel::Create(const Node &node) { if (auto resource = Resources::Get()->Find<CubeModel>(node)) return resource; auto result = std::make_shared<CubeModel>(Vector3f()); Resour...
#pragma once #include "Models/Model.hpp" namespace acid { /** * @brief Resource that represents a cube model. */ class ACID_EXPORT CubeModel : public Model::Registrar<CubeModel> { inline static const bool Registered = Register("cube"); public: /** * Creates a new cube model, or finds one with the same values. ...
#include "CylinderModel.hpp" #include "Maths/Maths.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { std::shared_ptr<CylinderModel> CylinderModel::Create(const Node &node) { if (auto resource = Resources::Get()->Find<CylinderModel>(node)) return resource; auto result = std::...
#pragma once #include "Models/Model.hpp" namespace acid { /** * @brief Resource that represents a cylinder model. */ class ACID_EXPORT CylinderModel : public Model::Registrar<CylinderModel> { inline static const bool Registered = Register("cylinder"); public: /** * Creates a new cylinder model, or finds one wit...
#include "DiskModel.hpp" #include "Maths/Maths.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { std::shared_ptr<DiskModel> DiskModel::Create(const Node &node) { if (auto resource = Resources::Get()->Find<DiskModel>(node)) return resource; auto result = std::make_shared<Disk...
#pragma once #include "Models/Model.hpp" namespace acid { /** * @brief Resource that represents a disk model. */ class ACID_EXPORT DiskModel : public Model::Registrar<DiskModel> { inline static const bool Registered = Register("disk"); public: /** * Creates a new disk model, or finds one with the same values. ...
#include "PatternMesh.hpp" namespace acid { PatternMesh::PatternMesh(float sideLength, float squareSize, uint32_t vertexCount, float uvScale) : sideLength(sideLength), squareSize(squareSize), vertexCount(vertexCount), uvScale(uvScale) { } Vertex3d PatternMesh::GetVertex(uint32_t col, uint32_t row) { auto x = ((r...
#pragma once #include "Models/Model.hpp" #include "Models/Vertex3d.hpp" namespace acid { class ACID_EXPORT PatternMesh : public Model { public: PatternMesh(float sideLength, float squareSize, uint32_t vertexCount, float uvScale); protected: virtual Vertex3d GetVertex(uint32_t col, uint32_t row); void GenerateMes...
#include "RectangleModel.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { std::shared_ptr<RectangleModel> RectangleModel::Create(const Node &node) { if (auto resource = Resources::Get()->Find<RectangleModel>(node)) return resource; auto result = std::make_shared<RectangleMo...
#pragma once #include "Models/Model.hpp" namespace acid { /** * @brief Resource that represents a rectangle model. */ class ACID_EXPORT RectangleModel : public Model::Registrar<RectangleModel> { inline static const bool Registered = Register("rectangle"); public: /** * Creates a new rectangle model, or finds on...
#include "SimpleMesh.hpp" namespace acid { SimpleMesh::SimpleMesh(float sideLength, float squareSize, uint32_t vertexCount, float uvScale) : sideLength(sideLength), squareSize(squareSize), vertexCount(vertexCount), uvScale(uvScale) { } Vertex3d SimpleMesh::GetVertex(uint32_t col, uint32_t row) { auto x = ((row *...
#pragma once #include "Models/Model.hpp" #include "Models/Vertex3d.hpp" namespace acid { class ACID_EXPORT SimpleMesh : public Model { public: SimpleMesh(float sideLength, float squareSize, uint32_t vertexCount, float uvScale); protected: virtual Vertex3d GetVertex(uint32_t col, uint32_t row); void GenerateMesh(...
#include "SphereModel.hpp" #include "Maths/Maths.hpp" #include "Resources/Resources.hpp" #include "Models/Vertex3d.hpp" namespace acid { std::shared_ptr<SphereModel> SphereModel::Create(const Node &node) { if (auto resource = Resources::Get()->Find<SphereModel>(node)) return resource; auto result = std::make_sha...
#pragma once #include "Models/Model.hpp" namespace acid { /** * @brief Resource that represents a sphere model. */ class ACID_EXPORT SphereModel : public Model::Registrar<SphereModel> { inline static const bool Registered = Register("sphere"); public: /** * Creates a new sphere model, or finds one with the same...
#include "IpAddress.hpp" #ifdef ACID_BUILD_WINDOWS #include <WinSock2.h> #include <WS2tcpip.h> #else #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #endif #include "Http/Http.hpp" #include "Socket.hpp" namespace acid { const IpAddress IpAddress::None; const IpAddress IpAddress::Any(0, 0, 0, 0); con...
#pragma once #include <string> #include <ostream> #include <istream> #include "Maths/Time.hpp" namespace acid { /** * @brief A utility class for manipulating network addresses. * It provides a set a implicit constructors and conversion functions * to easily build or transform an IP address from/to various represe...
#include "Packet.hpp" #include <cstring> #include <cwchar> #ifdef ACID_BUILD_WINDOWS #include <WinSock2.h> #else #include <netinet/in.h> #endif #include "Socket.hpp" namespace acid { Packet::Packet() : isValid(true) { } void Packet::Append(const void *data, std::size_t sizeInBytes) { if (data && (sizeInBytes > 0)...
#pragma once #include <cstddef> #include <cstdint> #include <string> #include <vector> #include "Export.hpp" namespace acid { /** * @brief Packets provide a safe and easy way to serialize data, * in order to send it over the network using sockets (acid::TcpSocket, acid::UdpSocket). * * Packets solve 2 fundamenta...
#include "Socket.hpp" #include <cstring> #ifdef ACID_BUILD_WINDOWS #include <WinSock2.h> #else #include <netinet/in.h> #include <netinet/tcp.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> #endif #include "Engine/Log.hpp" namespace acid { Socket::Socket(Type type) : type(type), socket(InvalidSocketHan...
#pragma once #include <cstdint> #include "Export.hpp" struct sockaddr_in; namespace acid { // Define the low-level socket handle type, specific to each platform. #ifdef ACID_BUILD_WINDOWS #ifdef _WIN64 using SocketHandle = unsigned __int64; #else using SocketHandle = unsigned int; #endif using SocketAddrLength = in...
#include "SocketSelector.hpp" #ifdef ACID_BUILD_WINDOWS #include <WinSock2.h> #else #include <sys/types.h> #include <unistd.h> #endif #include "Engine/Log.hpp" #include "Socket.hpp" #ifdef _MSC_VER #pragma warning(disable: 4127) // "conditional expression is constant" generated by the FD_SET macro #endif namespace ...
#pragma once #include <memory> #include "Maths/Time.hpp" namespace acid { class Socket; /** * @brief Socket selectors provide a way to wait until some data is available on a set of sockets, * instead of just one. This is convenient when you have multiple sockets that may * possibly receive data, but you don't kn...
#include "Ftp.hpp" #include <sstream> #include <fstream> #include "Network/IpAddress.hpp" namespace acid { Ftp::Ftp() { } Ftp::~Ftp() { Disconnect(); } FtpResponse Ftp::Connect(const IpAddress &server, uint16_t port, const Time &timeout) { // Connect to the server. if (commandSocket.Connect(server, port, timeou...
#pragma once #include "Network/Tcp/TcpSocket.hpp" #include "Network/IpAddress.hpp" #include "FtpDataChannel.hpp" #include "FtpResponse.hpp" #include "FtpResponseDirectory.hpp" #include "FtpResponseListing.hpp" namespace acid { /** * @brief A very simple FTP client that allows you to communicate with a FTP server. *...