mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Make all header files use #pragma once
This commit is contained in:
parent
16357675a7
commit
d2223a7b45
@ -10,8 +10,6 @@ a random game engine thing. Now finally with ECS!
|
|||||||
|
|
||||||
- Support dynamic shadow mapping (at least for shadows cast from the scene's sun)
|
- Support dynamic shadow mapping (at least for shadows cast from the scene's sun)
|
||||||
|
|
||||||
- Sort out LOG_X calls and ensure DEBUG, TRACE, INFO, etc are being used appropriately
|
|
||||||
|
|
||||||
## Medium priority (next week)
|
## Medium priority (next week)
|
||||||
|
|
||||||
- UI generator exposed at the Application level (Scene UI Systems could use this to draw menus every frame)
|
- UI generator exposed at the Application level (Scene UI Systems could use this to draw menus every frame)
|
||||||
@ -58,3 +56,5 @@ Added the BVH AABB tree made in Summer to start a much better Collision system.
|
|||||||
The CameraControllerSystem now uses raycasting to enable FPS-style player movement.
|
The CameraControllerSystem now uses raycasting to enable FPS-style player movement.
|
||||||
|
|
||||||
Added static soft shadows.
|
Added static soft shadows.
|
||||||
|
|
||||||
|
Sort out LOG_X calls and ensure DEBUG, TRACE, INFO, etc are being used appropriately
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_APPLICATION_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_APPLICATION_H_
|
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -96,5 +95,3 @@ class Application {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_COMPONENTS_CUSTOM_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_COMPONENTS_CUSTOM_H_
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -11,5 +10,3 @@ struct CustomComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_COMPONENTS_MESH_RENDERABLE_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_COMPONENTS_MESH_RENDERABLE_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -15,5 +14,3 @@ struct MeshRenderableComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_COMPONENTS_TRANSFORM_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_COMPONENTS_TRANSFORM_H_
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -26,5 +25,3 @@ struct TransformComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
struct UIRenderableComponent {
|
struct UIRenderableComponent {
|
||||||
int x;
|
int x;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_ECS_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_ECS_H_
|
|
||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -25,7 +24,8 @@ class IComponentArray {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
class ComponentArray : public IComponentArray {
|
class ComponentArray : public IComponentArray {
|
||||||
public:
|
public:
|
||||||
void InsertData(Entity entity, const T& component) {
|
void InsertData(Entity entity, const T& component)
|
||||||
|
{
|
||||||
if (component_array_.size() < entity + 1) {
|
if (component_array_.size() < entity + 1) {
|
||||||
component_array_.resize(entity + 1);
|
component_array_.resize(entity + 1);
|
||||||
}
|
}
|
||||||
@ -33,11 +33,13 @@ class ComponentArray : public IComponentArray {
|
|||||||
component_array_.at(entity) = component;
|
component_array_.at(entity) = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteData(Entity entity) {
|
void DeleteData(Entity entity)
|
||||||
|
{
|
||||||
(void)entity; // TODO
|
(void)entity; // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
T* GetData(Entity entity) {
|
T* GetData(Entity entity)
|
||||||
|
{
|
||||||
assert(entity < component_array_.size());
|
assert(entity < component_array_.size());
|
||||||
return &component_array_[entity];
|
return &component_array_[entity];
|
||||||
}
|
}
|
||||||
@ -67,5 +69,3 @@ class System {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,6 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_ENGINE_API_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_ENGINE_API_H_
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifndef ENGINE_API
|
#ifndef ENGINE_API
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
@ -16,5 +14,3 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define ENGINE_API
|
#define ENGINE_API
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_EVENT_SYSTEM_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_EVENT_SYSTEM_H_
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -32,25 +31,25 @@ class EventQueue : public IEventQueue {
|
|||||||
// holds events of type T and subscribers to those events
|
// holds events of type T and subscribers to those events
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Subscribe(EventSubscriberKind kind, uint32_t id,
|
void Subscribe(EventSubscriberKind kind, uint32_t id, EventHandler<T>* handler)
|
||||||
EventHandler<T>* handler) {
|
{
|
||||||
// For the time being, ignore kind (TODO)
|
// For the time being, ignore kind (TODO)
|
||||||
(void)kind;
|
(void)kind;
|
||||||
assert(subscribers_.contains(id) == false &&
|
assert(subscribers_.contains(id) == false && "subscribing to an event with ID that's already in use!");
|
||||||
"subscribing to an event with ID that's already in use!");
|
|
||||||
subscribers_.emplace(id, handler);
|
subscribers_.emplace(id, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueueEvent(EventSubscriberKind kind, uint32_t id, T event) {
|
void QueueEvent(EventSubscriberKind kind, uint32_t id, T event)
|
||||||
|
{
|
||||||
// For the time being, ignore kind (TODO)
|
// For the time being, ignore kind (TODO)
|
||||||
(void)kind;
|
(void)kind;
|
||||||
assert(subscribers_.contains(id) &&
|
assert(subscribers_.contains(id) && "Attempt to submit event to non-existing subscriber!");
|
||||||
"Attempt to submit event to non-existing subscriber!");
|
|
||||||
EventHandler<T>* handler = subscribers_.at(id);
|
EventHandler<T>* handler = subscribers_.at(id);
|
||||||
event_queue_.emplace(handler, event);
|
event_queue_.emplace(handler, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DespatchEvents() override {
|
void DespatchEvents() override
|
||||||
|
{
|
||||||
while (event_queue_.empty() == false) {
|
while (event_queue_.empty() == false) {
|
||||||
auto [handler, event] = event_queue_.front();
|
auto [handler, event] = event_queue_.front();
|
||||||
handler->OnEvent(event);
|
handler->OnEvent(event);
|
||||||
@ -62,8 +61,7 @@ class EventQueue : public IEventQueue {
|
|||||||
std::unordered_map<uint32_t, EventHandler<T>*> subscribers_;
|
std::unordered_map<uint32_t, EventHandler<T>*> subscribers_;
|
||||||
|
|
||||||
struct QueuedEvent {
|
struct QueuedEvent {
|
||||||
QueuedEvent(EventHandler<T>* handler, T event)
|
QueuedEvent(EventHandler<T>* handler, T event) : handler(handler), event(event) {}
|
||||||
: handler(handler), event(event) {}
|
|
||||||
|
|
||||||
EventHandler<T>* handler;
|
EventHandler<T>* handler;
|
||||||
T event;
|
T event;
|
||||||
@ -79,37 +77,35 @@ class EventSystem {
|
|||||||
~EventSystem() {}
|
~EventSystem() {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void RegisterEventType() {
|
void RegisterEventType()
|
||||||
|
{
|
||||||
size_t hash = typeid(T).hash_code();
|
size_t hash = typeid(T).hash_code();
|
||||||
assert(event_queues_.contains(hash) == false &&
|
assert(event_queues_.contains(hash) == false && "Registering an event queue more than once!");
|
||||||
"Registering an event queue more than once!");
|
|
||||||
event_queues_.emplace(hash, std::make_unique<EventQueue<T>>());
|
event_queues_.emplace(hash, std::make_unique<EventQueue<T>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SubscribeToEventType(EventSubscriberKind kind, uint32_t id,
|
void SubscribeToEventType(EventSubscriberKind kind, uint32_t id, EventHandler<T>* handler)
|
||||||
EventHandler<T>* handler) {
|
{
|
||||||
size_t hash = typeid(T).hash_code();
|
size_t hash = typeid(T).hash_code();
|
||||||
assert(event_queues_.contains(hash) &&
|
assert(event_queues_.contains(hash) && "Subscribing to event type that isn't registered!");
|
||||||
"Subscribing to event type that isn't registered!");
|
EventQueue<T>* queue = dynamic_cast<EventQueue<T>*>(event_queues_.at(hash).get());
|
||||||
EventQueue<T>* queue =
|
|
||||||
dynamic_cast<EventQueue<T>*>(event_queues_.at(hash).get());
|
|
||||||
assert(queue != nullptr && "This cast should work?!! wot");
|
assert(queue != nullptr && "This cast should work?!! wot");
|
||||||
queue->Subscribe(kind, id, handler);
|
queue->Subscribe(kind, id, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void QueueEvent(EventSubscriberKind kind, uint32_t subscriber_id, T event) {
|
void QueueEvent(EventSubscriberKind kind, uint32_t subscriber_id, T event)
|
||||||
|
{
|
||||||
size_t hash = typeid(T).hash_code();
|
size_t hash = typeid(T).hash_code();
|
||||||
assert(event_queues_.contains(hash) &&
|
assert(event_queues_.contains(hash) && "Subscribing to event type that isn't registered!");
|
||||||
"Subscribing to event type that isn't registered!");
|
EventQueue<T>* queue = dynamic_cast<EventQueue<T>*>(event_queues_.at(hash).get());
|
||||||
EventQueue<T>* queue =
|
|
||||||
dynamic_cast<EventQueue<T>*>(event_queues_.at(hash).get());
|
|
||||||
assert(queue != nullptr && "This cast should work?!! wot");
|
assert(queue != nullptr && "This cast should work?!! wot");
|
||||||
queue->QueueEvent(kind, subscriber_id, event);
|
queue->QueueEvent(kind, subscriber_id, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DespatchEvents() {
|
void DespatchEvents()
|
||||||
|
{
|
||||||
for (auto& [hash, queue] : event_queues_) {
|
for (auto& [hash, queue] : event_queues_) {
|
||||||
queue->DespatchEvents();
|
queue->DespatchEvents();
|
||||||
}
|
}
|
||||||
@ -120,5 +116,3 @@ class EventSystem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_GFX_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_GFX_H_
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -169,5 +168,3 @@ struct hash<engine::gfx::SamplerInfo> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_GFX_DEVICE_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_GFX_DEVICE_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -12,8 +11,7 @@ namespace engine {
|
|||||||
|
|
||||||
class GFXDevice {
|
class GFXDevice {
|
||||||
public:
|
public:
|
||||||
GFXDevice(const char* app_name, const char* app_version, SDL_Window* window,
|
GFXDevice(const char* app_name, const char* app_version, SDL_Window* window, gfx::GraphicsSettings settings);
|
||||||
gfx::GraphicsSettings settings);
|
|
||||||
|
|
||||||
GFXDevice(const GFXDevice&) = delete;
|
GFXDevice(const GFXDevice&) = delete;
|
||||||
GFXDevice& operator=(const GFXDevice&) = delete;
|
GFXDevice& operator=(const GFXDevice&) = delete;
|
||||||
@ -37,72 +35,51 @@ class GFXDevice {
|
|||||||
|
|
||||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
||||||
- pipeline MUST be a valid pointer returned by CreatePipeline() */
|
- pipeline MUST be a valid pointer returned by CreatePipeline() */
|
||||||
void CmdBindPipeline(gfx::DrawBuffer* draw_buffer,
|
void CmdBindPipeline(gfx::DrawBuffer* draw_buffer, const gfx::Pipeline* pipeline);
|
||||||
const gfx::Pipeline* pipeline);
|
|
||||||
|
|
||||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
||||||
- buffer MUST be a valid pointer returned by CreateBuffer */
|
- buffer MUST be a valid pointer returned by CreateBuffer */
|
||||||
void CmdBindVertexBuffer(gfx::DrawBuffer* draw_buffer, uint32_t binding,
|
void CmdBindVertexBuffer(gfx::DrawBuffer* draw_buffer, uint32_t binding, const gfx::Buffer* buffer);
|
||||||
const gfx::Buffer* buffer);
|
|
||||||
|
|
||||||
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
/* - draw_buffer MUST be a valid pointer returned by BeginRender()
|
||||||
- buffer MUST be a valid pointer returned by CreateBuffer */
|
- buffer MUST be a valid pointer returned by CreateBuffer */
|
||||||
void CmdBindIndexBuffer(gfx::DrawBuffer* draw_buffer,
|
void CmdBindIndexBuffer(gfx::DrawBuffer* draw_buffer, const gfx::Buffer* buffer);
|
||||||
const gfx::Buffer* buffer);
|
|
||||||
|
|
||||||
void CmdDrawIndexed(gfx::DrawBuffer* draw_buffer, uint32_t index_count,
|
void CmdDrawIndexed(gfx::DrawBuffer* draw_buffer, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t vertex_offset,
|
||||||
uint32_t instance_count, uint32_t first_index,
|
|
||||||
int32_t vertex_offset, uint32_t first_instance);
|
|
||||||
|
|
||||||
void CmdDraw(gfx::DrawBuffer* drawBuffer, uint32_t vertex_count,
|
|
||||||
uint32_t instance_count, uint32_t first_vertex,
|
|
||||||
uint32_t first_instance);
|
uint32_t first_instance);
|
||||||
|
|
||||||
void CmdPushConstants(gfx::DrawBuffer* draw_buffer,
|
void CmdDraw(gfx::DrawBuffer* drawBuffer, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance);
|
||||||
const gfx::Pipeline* pipeline, uint32_t offset,
|
|
||||||
uint32_t size, const void* data);
|
|
||||||
|
|
||||||
void CmdBindDescriptorSet(gfx::DrawBuffer* draw_buffer,
|
void CmdPushConstants(gfx::DrawBuffer* draw_buffer, const gfx::Pipeline* pipeline, uint32_t offset, uint32_t size, const void* data);
|
||||||
const gfx::Pipeline* pipeline,
|
|
||||||
const gfx::DescriptorSet* set, uint32_t set_number);
|
void CmdBindDescriptorSet(gfx::DrawBuffer* draw_buffer, const gfx::Pipeline* pipeline, const gfx::DescriptorSet* set, uint32_t set_number);
|
||||||
|
|
||||||
gfx::Pipeline* CreatePipeline(const gfx::PipelineInfo& info);
|
gfx::Pipeline* CreatePipeline(const gfx::PipelineInfo& info);
|
||||||
|
|
||||||
void DestroyPipeline(const gfx::Pipeline* pipeline);
|
void DestroyPipeline(const gfx::Pipeline* pipeline);
|
||||||
|
|
||||||
gfx::DescriptorSetLayout* CreateDescriptorSetLayout(
|
gfx::DescriptorSetLayout* CreateDescriptorSetLayout(const std::vector<gfx::DescriptorSetLayoutBinding>& bindings);
|
||||||
const std::vector<gfx::DescriptorSetLayoutBinding>& bindings);
|
|
||||||
|
|
||||||
void DestroyDescriptorSetLayout(const gfx::DescriptorSetLayout* layout);
|
void DestroyDescriptorSetLayout(const gfx::DescriptorSetLayout* layout);
|
||||||
|
|
||||||
gfx::DescriptorSet* AllocateDescriptorSet(
|
gfx::DescriptorSet* AllocateDescriptorSet(const gfx::DescriptorSetLayout* layout);
|
||||||
const gfx::DescriptorSetLayout* layout);
|
|
||||||
|
|
||||||
void FreeDescriptorSet(const gfx::DescriptorSet* set);
|
void FreeDescriptorSet(const gfx::DescriptorSet* set);
|
||||||
|
|
||||||
// This updates all copies of the descriptor.
|
// This updates all copies of the descriptor.
|
||||||
// This cannot be used after any frames have been renderered
|
// This cannot be used after any frames have been renderered
|
||||||
void UpdateDescriptorUniformBuffer(const gfx::DescriptorSet* set,
|
void UpdateDescriptorUniformBuffer(const gfx::DescriptorSet* set, uint32_t binding, const gfx::UniformBuffer* buffer, size_t offset, size_t range);
|
||||||
uint32_t binding,
|
|
||||||
const gfx::UniformBuffer* buffer,
|
|
||||||
size_t offset, size_t range);
|
|
||||||
|
|
||||||
void UpdateDescriptorCombinedImageSampler(const gfx::DescriptorSet* set,
|
void UpdateDescriptorCombinedImageSampler(const gfx::DescriptorSet* set, uint32_t binding, const gfx::Image* image, const gfx::Sampler* sampler);
|
||||||
uint32_t binding,
|
|
||||||
const gfx::Image* image,
|
|
||||||
const gfx::Sampler* sampler);
|
|
||||||
|
|
||||||
gfx::UniformBuffer* CreateUniformBuffer(uint64_t size,
|
gfx::UniformBuffer* CreateUniformBuffer(uint64_t size, const void* initial_data);
|
||||||
const void* initial_data);
|
|
||||||
|
|
||||||
void DestroyUniformBuffer(const gfx::UniformBuffer* descriptor_buffer);
|
void DestroyUniformBuffer(const gfx::UniformBuffer* descriptor_buffer);
|
||||||
|
|
||||||
void WriteUniformBuffer(gfx::UniformBuffer* buffer, uint64_t offset,
|
void WriteUniformBuffer(gfx::UniformBuffer* buffer, uint64_t offset, uint64_t size, const void* data);
|
||||||
uint64_t size, const void* data);
|
|
||||||
|
|
||||||
// Loads data into staging buffer and copies that into a single GPU buffer.
|
// Loads data into staging buffer and copies that into a single GPU buffer.
|
||||||
gfx::Buffer* CreateBuffer(gfx::BufferType type, uint64_t size,
|
gfx::Buffer* CreateBuffer(gfx::BufferType type, uint64_t size, const void* data);
|
||||||
const void* data);
|
|
||||||
|
|
||||||
void DestroyBuffer(const gfx::Buffer* buffer);
|
void DestroyBuffer(const gfx::Buffer* buffer);
|
||||||
|
|
||||||
@ -129,5 +106,3 @@ class GFXDevice {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_INPUT_MANAGER_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_INPUT_MANAGER_H_
|
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -18,7 +17,8 @@ class InputManager {
|
|||||||
public:
|
public:
|
||||||
/* The Window object here is stored for the duration of the InputManager.
|
/* The Window object here is stored for the duration of the InputManager.
|
||||||
* 'win' must point to a valid Window object. */
|
* 'win' must point to a valid Window object. */
|
||||||
InputManager(const Window* win) : win_(win) {
|
InputManager(const Window* win) : win_(win)
|
||||||
|
{
|
||||||
assert(win != nullptr);
|
assert(win != nullptr);
|
||||||
enabled_devices_.fill(true);
|
enabled_devices_.fill(true);
|
||||||
}
|
}
|
||||||
@ -28,50 +28,39 @@ class InputManager {
|
|||||||
|
|
||||||
~InputManager() {}
|
~InputManager() {}
|
||||||
|
|
||||||
void AddInputButton(const std::string& name, inputs::MouseButton button) {
|
void AddInputButton(const std::string& name, inputs::MouseButton button) { AddInputDeviceButton(name, InputDevice::kMouse, static_cast<int>(button)); }
|
||||||
AddInputDeviceButton(name, InputDevice::kMouse, static_cast<int>(button));
|
|
||||||
|
void AddInputButton(const std::string& name, inputs::Key button) { AddInputDeviceButton(name, InputDevice::kKeyboard, static_cast<int>(button)); }
|
||||||
|
|
||||||
|
void AddInputAxis(const std::string& name, inputs::MouseAxis axis) { AddInputDeviceAxis(name, InputDevice::kMouse, static_cast<int>(axis)); }
|
||||||
|
|
||||||
|
void AddInputButtonAsAxis(const std::string& name, inputs::MouseButton high, inputs::MouseButton low)
|
||||||
|
{
|
||||||
|
AddInputDeviceButtonAsAxis(name, InputDevice::kMouse, static_cast<int>(high), static_cast<int>(low));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddInputButton(const std::string& name, inputs::Key button) {
|
void AddInputButtonAsAxis(const std::string& name, inputs::Key high, inputs::Key low)
|
||||||
AddInputDeviceButton(name, InputDevice::kKeyboard,
|
{
|
||||||
static_cast<int>(button));
|
AddInputDeviceButtonAsAxis(name, InputDevice::kKeyboard, static_cast<int>(high), static_cast<int>(low));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddInputAxis(const std::string& name, inputs::MouseAxis axis) {
|
void DelInputButton(int index)
|
||||||
AddInputDeviceAxis(name, InputDevice::kMouse, static_cast<int>(axis));
|
{
|
||||||
}
|
|
||||||
|
|
||||||
void AddInputButtonAsAxis(const std::string& name, inputs::MouseButton high,
|
|
||||||
inputs::MouseButton low) {
|
|
||||||
AddInputDeviceButtonAsAxis(name, InputDevice::kMouse,
|
|
||||||
static_cast<int>(high), static_cast<int>(low));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddInputButtonAsAxis(const std::string& name, inputs::Key high,
|
|
||||||
inputs::Key low) {
|
|
||||||
AddInputDeviceButtonAsAxis(name, InputDevice::kKeyboard,
|
|
||||||
static_cast<int>(high), static_cast<int>(low));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DelInputButton(int index) {
|
|
||||||
std::vector<struct ButtonEntry>::iterator it = button_entries_.begin();
|
std::vector<struct ButtonEntry>::iterator it = button_entries_.begin();
|
||||||
std::advance(it, index);
|
std::advance(it, index);
|
||||||
button_entries_.erase(it);
|
button_entries_.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DelInputAxis(int index) {
|
void DelInputAxis(int index)
|
||||||
|
{
|
||||||
std::vector<struct AxisEntry>::iterator it = axis_entries_.begin();
|
std::vector<struct AxisEntry>::iterator it = axis_entries_.begin();
|
||||||
std::advance(it, index);
|
std::advance(it, index);
|
||||||
axis_entries_.erase(it);
|
axis_entries_.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDeviceActive(enum InputDevice device, bool active) {
|
void SetDeviceActive(enum InputDevice device, bool active) { enabled_devices_[static_cast<int>(device)] = active; }
|
||||||
enabled_devices_[static_cast<int>(device)] = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetDeviceActive(enum InputDevice device) const {
|
bool GetDeviceActive(enum InputDevice device) const { return enabled_devices_[static_cast<int>(device)]; }
|
||||||
return enabled_devices_[static_cast<int>(device)];
|
|
||||||
}
|
|
||||||
|
|
||||||
float GetAxis(const std::string& axis_name) const;
|
float GetAxis(const std::string& axis_name) const;
|
||||||
|
|
||||||
@ -114,7 +103,8 @@ class InputManager {
|
|||||||
|
|
||||||
bool GetDeviceButtonUp(enum InputDevice device, int button) const;
|
bool GetDeviceButtonUp(enum InputDevice device, int button) const;
|
||||||
|
|
||||||
float GetButtonAxis(enum InputDevice device, int high, int low) const {
|
float GetButtonAxis(enum InputDevice device, int high, int low) const
|
||||||
|
{
|
||||||
float value = 0.0f;
|
float value = 0.0f;
|
||||||
if (GetDeviceButton(device, high)) value += 1.0f;
|
if (GetDeviceButton(device, high)) value += 1.0f;
|
||||||
if (low != 0) {
|
if (low != 0) {
|
||||||
@ -123,22 +113,14 @@ class InputManager {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddInputDeviceButton(const std::string& name, InputDevice device,
|
void AddInputDeviceButton(const std::string& name, InputDevice device, int button) { button_entries_.push_back({name, device, button}); }
|
||||||
int button) {
|
|
||||||
button_entries_.push_back({name, device, button});
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddInputDeviceAxis(const std::string& name, InputDevice device,
|
void AddInputDeviceAxis(const std::string& name, InputDevice device, int axis) { axis_entries_.push_back({name, device, axis, false, 0, 0}); }
|
||||||
int axis) {
|
|
||||||
axis_entries_.push_back({name, device, axis, false, 0, 0});
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddInputDeviceButtonAsAxis(const std::string& name, InputDevice device,
|
void AddInputDeviceButtonAsAxis(const std::string& name, InputDevice device, int high, int low)
|
||||||
int high, int low) {
|
{
|
||||||
axis_entries_.push_back({name, device, 0, true, high, low});
|
axis_entries_.push_back({name, device, 0, true, high, low});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_INPUTS_KEYBOARD_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_INPUTS_KEYBOARD_H_
|
|
||||||
|
|
||||||
// Keyboard scancodes, taken from SDL_scancode.h
|
// Keyboard scancodes, taken from SDL_scancode.h
|
||||||
|
|
||||||
@ -375,5 +374,3 @@ enum class Key : int {
|
|||||||
|
|
||||||
} // namespace inputs
|
} // namespace inputs
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,22 +1,11 @@
|
|||||||
#ifndef ENGINE_INCLUDE_INPUTS_MOUSE_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_INPUTS_MOUSE_H_
|
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
namespace inputs {
|
namespace inputs {
|
||||||
|
|
||||||
enum class MouseButton : int {
|
enum class MouseButton : int { M_LEFT, M_MIDDLE, M_RIGHT, M_X1, M_X2, M_INVALID = 7, M_SIZE = 7 };
|
||||||
M_LEFT,
|
|
||||||
M_MIDDLE,
|
|
||||||
M_RIGHT,
|
|
||||||
M_X1,
|
|
||||||
M_X2,
|
|
||||||
M_INVALID = 7,
|
|
||||||
M_SIZE = 7
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class MouseAxis : int { X, Y, X_SCR, Y_SCR };
|
enum class MouseAxis : int { X, Y, X_SCR, Y_SCR };
|
||||||
|
|
||||||
} // namespace inputs
|
} // namespace inputs
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef ENGINE_INCLUDE_LOG_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_LOG_H_
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define SPDLOG_ACTIVE_LEVEL 2 // info, warn, error, critical
|
#define SPDLOG_ACTIVE_LEVEL 2 // info, warn, error, critical
|
||||||
//#define SPDLOG_ACTIVE_LEVEL 0 // trace, debug, info, warn, error, critical
|
// #define SPDLOG_ACTIVE_LEVEL 0 // trace, debug, info, warn, error, critical
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_ACTIVE_LEVEL 0 // trace, debug, info, warn, error, critical
|
#define SPDLOG_ACTIVE_LEVEL 0 // trace, debug, info, warn, error, critical
|
||||||
#endif
|
#endif
|
||||||
@ -16,5 +15,3 @@
|
|||||||
#define LOG_WARN SPDLOG_WARN
|
#define LOG_WARN SPDLOG_WARN
|
||||||
#define LOG_ERROR SPDLOG_ERROR
|
#define LOG_ERROR SPDLOG_ERROR
|
||||||
#define LOG_CRITICAL SPDLOG_CRITICAL
|
#define LOG_CRITICAL SPDLOG_CRITICAL
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_LOGGER_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_LOGGER_H_
|
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -12,13 +11,13 @@
|
|||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
// To be executed in the target application, NOT engine.dll
|
// To be executed in the target application, NOT engine.dll
|
||||||
void SetupLog(const char* appName) {
|
void SetupLog(const char* appName)
|
||||||
|
{
|
||||||
const std::string LOG_FILENAME{std::string(appName) + ".log"};
|
const std::string LOG_FILENAME{std::string(appName) + ".log"};
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
// RELEASE
|
// RELEASE
|
||||||
const std::filesystem::path log_path{std::filesystem::temp_directory_path() /
|
const std::filesystem::path log_path{std::filesystem::temp_directory_path() / LOG_FILENAME};
|
||||||
LOG_FILENAME};
|
|
||||||
#else
|
#else
|
||||||
// DEBUG
|
// DEBUG
|
||||||
const std::filesystem::path log_path{LOG_FILENAME};
|
const std::filesystem::path log_path{LOG_FILENAME};
|
||||||
@ -26,15 +25,13 @@ void SetupLog(const char* appName) {
|
|||||||
|
|
||||||
std::vector<spdlog::sink_ptr> sinks;
|
std::vector<spdlog::sink_ptr> sinks;
|
||||||
|
|
||||||
sinks.emplace_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(
|
sinks.emplace_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(log_path.string(), true));
|
||||||
log_path.string(), true));
|
|
||||||
sinks.back()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v");
|
sinks.back()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v");
|
||||||
|
|
||||||
sinks.emplace_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
|
sinks.emplace_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
|
||||||
sinks.back()->set_pattern("[%H:%M:%S.%e] [%l] %v");
|
sinks.back()->set_pattern("[%H:%M:%S.%e] [%l] %v");
|
||||||
|
|
||||||
auto logger =
|
auto logger = std::make_shared<spdlog::logger>(appName, sinks.begin(), sinks.end());
|
||||||
std::make_shared<spdlog::logger>(appName, sinks.begin(), sinks.end());
|
|
||||||
|
|
||||||
// Logs below INFO are ignored through macros in release (see log.hpp)
|
// Logs below INFO are ignored through macros in release (see log.hpp)
|
||||||
logger->set_level(spdlog::level::trace);
|
logger->set_level(spdlog::level::trace);
|
||||||
@ -47,5 +44,3 @@ void SetupLog(const char* appName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_RENDERER_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_RENDERER_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -120,5 +119,3 @@ class Renderer : private ApplicationComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_RESOURCE_MANAGER_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_RESOURCE_MANAGER_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -22,31 +21,30 @@ class IResourceManager {
|
|||||||
template <class T>
|
template <class T>
|
||||||
class ResourceManager : public IResourceManager {
|
class ResourceManager : public IResourceManager {
|
||||||
public:
|
public:
|
||||||
~ResourceManager() override {
|
~ResourceManager() override { LOG_DEBUG("Destroying resource manager... '{}'", typeid(T).name()); }
|
||||||
LOG_DEBUG("Destroying resource manager... '{}'", typeid(T).name());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<T> Add(const std::string& name,
|
std::shared_ptr<T> Add(const std::string& name, std::unique_ptr<T>&& resource)
|
||||||
std::unique_ptr<T>&& resource) {
|
{
|
||||||
if (resources_.contains(name) == false) {
|
if (resources_.contains(name) == false) {
|
||||||
std::shared_ptr<T> resource_shared(std::move(resource));
|
std::shared_ptr<T> resource_shared(std::move(resource));
|
||||||
resources_.emplace(name, resource_shared);
|
resources_.emplace(name, resource_shared);
|
||||||
return resource_shared;
|
return resource_shared;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
throw std::runtime_error("Cannot add a resource which already exists");
|
throw std::runtime_error("Cannot add a resource which already exists");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPersistent(const std::string& name, std::unique_ptr<T>&& resource) {
|
void AddPersistent(const std::string& name, std::unique_ptr<T>&& resource) { persistent_resources_.push_back(Add(name, std::move(resource))); }
|
||||||
persistent_resources_.push_back(Add(name, std::move(resource)));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<T> Get(const std::string& name) {
|
std::shared_ptr<T> Get(const std::string& name)
|
||||||
|
{
|
||||||
if (resources_.contains(name)) {
|
if (resources_.contains(name)) {
|
||||||
std::weak_ptr<T> ptr = resources_.at(name);
|
std::weak_ptr<T> ptr = resources_.at(name);
|
||||||
if (ptr.expired() == false) {
|
if (ptr.expired() == false) {
|
||||||
return ptr.lock();
|
return ptr.lock();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
resources_.erase(name);
|
resources_.erase(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,5 +60,3 @@ class ResourceManager : public IResourceManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_RESOURCES_FONT_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_RESOURCES_FONT_H_
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -17,10 +16,7 @@ class Font {
|
|||||||
Font(const Font&) = delete;
|
Font(const Font&) = delete;
|
||||||
Font& operator=(const Font&) = delete;
|
Font& operator=(const Font&) = delete;
|
||||||
|
|
||||||
std::unique_ptr<std::vector<uint8_t>> GetTextBitmap(const std::string& text,
|
std::unique_ptr<std::vector<uint8_t>> GetTextBitmap(const std::string& text, float height_px, int& width_out, int& height_out);
|
||||||
float height_px,
|
|
||||||
int& width_out,
|
|
||||||
int& height_out);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<stbtt_fontinfo> font_info_{};
|
std::unique_ptr<stbtt_fontinfo> font_info_{};
|
||||||
@ -31,5 +27,3 @@ class Font {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_RESOURCES_MATERIAL_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_RESOURCES_MATERIAL_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -36,5 +35,3 @@ class Material {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,6 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_RESOURCES_MESH_H_
|
#pragma once
|
||||||
#ifndef ENGINE_INCLUDE_RESOURCES_MESH_H_
|
|
||||||
#define ENGINE_INCLUDE_RESOURCES_MESH_H_
|
|
||||||
|
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
#include <glm/vec3.hpp>
|
#include <glm/vec3.hpp>
|
||||||
@ -47,5 +45,3 @@ class Mesh {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -26,8 +26,7 @@ class Shader {
|
|||||||
|
|
||||||
static constexpr int kHighestRenderOrder = 1;
|
static constexpr int kHighestRenderOrder = 1;
|
||||||
|
|
||||||
Shader(Renderer* renderer, const std::string& vert_path, const std::string& frag_path,
|
Shader(Renderer* renderer, const std::string& vert_path, const std::string& frag_path, const ShaderSettings& settings);
|
||||||
const ShaderSettings& settings);
|
|
||||||
~Shader();
|
~Shader();
|
||||||
Shader(const Shader&) = delete;
|
Shader(const Shader&) = delete;
|
||||||
Shader& operator=(const Shader&) = delete;
|
Shader& operator=(const Shader&) = delete;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_RESOURCES_TEXTURE_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_RESOURCES_TEXTURE_H_
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -10,7 +9,6 @@ namespace engine {
|
|||||||
|
|
||||||
class Texture {
|
class Texture {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Texture(Renderer* renderer, const uint8_t* bitmap, int width, int height, gfx::SamplerInfo samplerInfo, bool srgb);
|
Texture(Renderer* renderer, const uint8_t* bitmap, int width, int height, gfx::SamplerInfo samplerInfo, bool srgb);
|
||||||
|
|
||||||
~Texture();
|
~Texture();
|
||||||
@ -29,5 +27,3 @@ class Texture {
|
|||||||
std::unique_ptr<Texture> LoadTextureFromFile(const std::string& path, gfx::SamplerInfo samplerInfo, Renderer* renderer, bool srgb = true);
|
std::unique_ptr<Texture> LoadTextureFromFile(const std::string& path, gfx::SamplerInfo samplerInfo, Renderer* renderer, bool srgb = true);
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_SCENE_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_SCENE_H_
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -70,21 +69,13 @@ class Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// because GetComponent<Transformzzzzzz takes too long
|
// because GetComponent<Transformzzzzzz takes too long
|
||||||
TransformComponent* GetTransform(Entity entity) {
|
TransformComponent* GetTransform(Entity entity) { return GetComponent<TransformComponent>(entity); }
|
||||||
return GetComponent<TransformComponent>(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3& GetPosition(Entity entity) {
|
glm::vec3& GetPosition(Entity entity) { return GetTransform(entity)->position; }
|
||||||
return GetTransform(entity)->position;
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::quat& GetRotation(Entity entity) {
|
glm::quat& GetRotation(Entity entity) { return GetTransform(entity)->rotation; }
|
||||||
return GetTransform(entity)->rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3& GetScale(Entity entity) {
|
glm::vec3& GetScale(Entity entity) { return GetTransform(entity)->scale; }
|
||||||
return GetTransform(entity)->scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T* AddComponent(Entity entity, const T& comp = T{})
|
T* AddComponent(Entity entity, const T& comp = T{})
|
||||||
@ -174,5 +165,3 @@ class Scene {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_SCENE_MANAGER_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_SCENE_MANAGER_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -57,5 +56,3 @@ class SceneManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_SYSTEMS_COLLISIONS_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_SYSTEMS_COLLISIONS_H_
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -75,5 +74,3 @@ class CollisionSystem : public System {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_CUSTOM_BEHAVIOUR_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_CUSTOM_BEHAVIOUR_H_
|
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
@ -23,5 +22,3 @@ class CustomBehaviourSystem : public System {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -39,7 +39,6 @@ class MeshRenderSystem : public System {
|
|||||||
// with_static_entities = false, build list of dynamic meshes
|
// with_static_entities = false, build list of dynamic meshes
|
||||||
// with_static_entities = true, build list of static meshes
|
// with_static_entities = true, build list of static meshes
|
||||||
void BuildRenderList(RenderList& render_list, bool with_static_entities);
|
void BuildRenderList(RenderList& render_list, bool with_static_entities);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_SYSTEMS_TRANSFORM_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_SYSTEMS_TRANSFORM_H_
|
|
||||||
|
|
||||||
#include "ecs.h"
|
#include "ecs.h"
|
||||||
|
|
||||||
@ -20,5 +19,3 @@ class TransformSystem : public System {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
class UIRenderSystem : public System {
|
class UIRenderSystem : public System {
|
||||||
public:
|
public:
|
||||||
UIRenderSystem(Scene* scene);
|
UIRenderSystem(Scene* scene);
|
||||||
~UIRenderSystem();
|
~UIRenderSystem();
|
||||||
@ -17,7 +17,6 @@ namespace engine {
|
|||||||
void OnUpdate(float ts) override;
|
void OnUpdate(float ts) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
};
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
#ifndef ENGINE_INCLUDE_UTIL_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_UTIL_H_
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
inline bool VersionFromCharArray(const char* version, int* major, int* minor,
|
inline bool VersionFromCharArray(const char* version, int* major, int* minor, int* patch)
|
||||||
int* patch) {
|
{
|
||||||
if (sscanf(version, "%d.%d.%d", major, minor, patch) != 3) {
|
if (sscanf(version, "%d.%d.%d", major, minor, patch) != 3) {
|
||||||
*major = 0;
|
*major = 0;
|
||||||
*minor = 0;
|
*minor = 0;
|
||||||
*patch = 0;
|
*patch = 0;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_UTIL_FILES_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_UTIL_FILES_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -13,10 +12,7 @@ std::unique_ptr<std::vector<uint8_t>> ReadBinaryFile(const std::string& path);
|
|||||||
|
|
||||||
// Read an image file into a vector byte buffer. PNG and JPG support at a
|
// Read an image file into a vector byte buffer. PNG and JPG support at a
|
||||||
// minimum. Output format is R8G8B8A8_UINT
|
// minimum. Output format is R8G8B8A8_UINT
|
||||||
std::unique_ptr<std::vector<uint8_t>> ReadImageFile(const std::string& path,
|
std::unique_ptr<std::vector<uint8_t>> ReadImageFile(const std::string& path, int& width, int& height);
|
||||||
int& width, int& height);
|
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -17,4 +17,4 @@ namespace engine::util {
|
|||||||
*/
|
*/
|
||||||
engine::Entity LoadGLTF(Scene& scene, const std::string& path, bool isStatic = false);
|
engine::Entity LoadGLTF(Scene& scene, const std::string& path, bool isStatic = false);
|
||||||
|
|
||||||
}
|
} // namespace engine::util
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_INCLUDE_WINDOW_H_
|
#pragma once
|
||||||
#define ENGINE_INCLUDE_WINDOW_H_
|
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -14,8 +13,7 @@ namespace engine {
|
|||||||
|
|
||||||
class Window {
|
class Window {
|
||||||
public:
|
public:
|
||||||
Window(const std::string& title, bool resizable = true,
|
Window(const std::string& title, bool resizable = true, bool fullscreen = true);
|
||||||
bool fullscreen = true);
|
|
||||||
Window(const Window&) = delete;
|
Window(const Window&) = delete;
|
||||||
Window& operator=(const Window&) = delete;
|
Window& operator=(const Window&) = delete;
|
||||||
~Window();
|
~Window();
|
||||||
@ -188,5 +186,3 @@ class Window {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
|
|
||||||
#endif
|
|
@ -49,7 +49,7 @@ float InterleavedGradientNoise(vec2 position_screen)
|
|||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
const vec4 albedo_alpha = texture(materialSetAlbedoSampler, fragUV);
|
const vec4 albedo_alpha = texture(materialSetAlbedoSampler, fragUV);
|
||||||
if (albedo_alpha.a < 0.9) discard; // discard fragments without alpha = 1.0
|
if (albedo_alpha.a < 0.9) discard;
|
||||||
const vec3 albedo = albedo_alpha.xyz;
|
const vec3 albedo = albedo_alpha.xyz;
|
||||||
|
|
||||||
const vec3 occlusion_roughness_metallic = vec3(texture(materialSetOcclusionRoughnessMetallic, fragUV));
|
const vec3 occlusion_roughness_metallic = vec3(texture(materialSetOcclusionRoughnessMetallic, fragUV));
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(set = 2, binding = 0) uniform sampler2D materialSetSampler;
|
|
||||||
|
|
||||||
layout(location = 0) in vec2 fragUV;
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 outColor;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
outColor = texture(materialSetSampler, fragUV);
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(set = 0, binding = 0) uniform GlobalSetUniformBuffer {
|
|
||||||
mat4 proj;
|
|
||||||
} globalSetUniformBuffer;
|
|
||||||
|
|
||||||
layout(set = 1, binding = 0) uniform FrameSetUniformBuffer {
|
|
||||||
mat4 view;
|
|
||||||
} frameSetUniformBuffer;
|
|
||||||
|
|
||||||
layout( push_constant ) uniform Constants {
|
|
||||||
mat4 model;
|
|
||||||
} constants;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 inPosition;
|
|
||||||
layout(location = 1) in vec3 inNorm;
|
|
||||||
layout(location = 2) in vec4 inTangent;
|
|
||||||
layout(location = 3) in vec2 inUV;
|
|
||||||
|
|
||||||
layout(location = 0) out vec2 fragUV;
|
|
||||||
|
|
||||||
vec2 positions[6] = vec2[](
|
|
||||||
vec2( 1.0, 1.0),
|
|
||||||
vec2(-1.0, 1.0),
|
|
||||||
vec2(-1.0, -1.0),
|
|
||||||
vec2( 1.0, 1.0),
|
|
||||||
vec2(-1.0, -1.0),
|
|
||||||
vec2( 1.0, -1.0)
|
|
||||||
);
|
|
||||||
|
|
||||||
vec2 uvs[6] = vec2[](
|
|
||||||
vec2(1.0, 0.0),
|
|
||||||
vec2(0.0, 0.0),
|
|
||||||
vec2(0.0, 1.0),
|
|
||||||
vec2(1.0, 0.0),
|
|
||||||
vec2(0.0, 1.0),
|
|
||||||
vec2(1.0, 1.0)
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_Position = constants.model * vec4(positions[gl_VertexIndex], 0.0, 1.0);
|
|
||||||
fragUV = uvs[gl_VertexIndex];
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(set = 2, binding = 0) uniform sampler2D materialSetAlbedoSampler;
|
|
||||||
layout(set = 2, binding = 1) uniform sampler2D materialSetNormalSampler;
|
|
||||||
layout(set = 2, binding = 2) uniform sampler2D materialSetOcclusionSampler;
|
|
||||||
layout(set = 2, binding = 3) uniform sampler2D materialSetMetallicRoughnessSampler;
|
|
||||||
|
|
||||||
layout(location = 0) in vec2 fragUV;
|
|
||||||
layout(location = 1) in vec3 fragPosTangentSpace;
|
|
||||||
layout(location = 2) in vec3 fragViewPosTangentSpace;
|
|
||||||
layout(location = 3) in vec3 fragLightPosTangentSpace;
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 outColor;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec3 norm = vec3(texture(materialSetNormalSampler, fragUV));
|
|
||||||
//norm.y = 1.0 - norm.y;
|
|
||||||
norm = normalize(norm * 2.0 - 1.0);
|
|
||||||
norm.b = 0.0;
|
|
||||||
norm *= 100.0;
|
|
||||||
norm = clamp(norm, 0.0, 1.0);
|
|
||||||
outColor = vec4(norm, 1.0);
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(set = 0, binding = 0) uniform GlobalSetUniformBuffer {
|
|
||||||
mat4 proj;
|
|
||||||
} globalSetUniformBuffer;
|
|
||||||
|
|
||||||
layout(set = 1, binding = 0) uniform FrameSetUniformBuffer {
|
|
||||||
mat4 view;
|
|
||||||
} frameSetUniformBuffer;
|
|
||||||
|
|
||||||
layout( push_constant ) uniform Constants {
|
|
||||||
mat4 model;
|
|
||||||
} constants;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 inPosition;
|
|
||||||
layout(location = 1) in vec3 inNorm;
|
|
||||||
layout(location = 2) in vec4 inTangent;
|
|
||||||
layout(location = 3) in vec2 inUV;
|
|
||||||
|
|
||||||
layout(location = 0) out vec2 fragUV;
|
|
||||||
layout(location = 1) out vec3 fragPosTangentSpace;
|
|
||||||
layout(location = 2) out vec3 fragViewPosTangentSpace;
|
|
||||||
layout(location = 3) out vec3 fragLightPosTangentSpace;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec4 worldPosition = constants.model * vec4(inPosition, 1.0);
|
|
||||||
gl_Position = globalSetUniformBuffer.proj * frameSetUniformBuffer.view * worldPosition;
|
|
||||||
|
|
||||||
vec3 T = normalize(vec3(constants.model * vec4(inTangent.xyz, 0.0)));
|
|
||||||
vec3 N = normalize(vec3(constants.model * vec4(inNorm, 0.0)));
|
|
||||||
vec3 B = cross(T, N) * inTangent.w;
|
|
||||||
mat3 worldToTangentSpace = transpose(mat3(T, B, N));
|
|
||||||
|
|
||||||
fragUV = inUV;
|
|
||||||
fragPosTangentSpace = worldToTangentSpace * vec3(worldPosition);
|
|
||||||
fragViewPosTangentSpace = worldToTangentSpace * vec3(inverse(frameSetUniformBuffer.view) * vec4(0.0, 0.0, 0.0, 1.0));
|
|
||||||
fragLightPosTangentSpace = worldToTangentSpace * vec3(59000.0, 0000.0, 10000.0);
|
|
||||||
|
|
||||||
gl_Position.y *= -1.0;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(location = 0) in vec2 fragUV;
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 outColor;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec3 baseColor = vec3(fragUV, 0.0);
|
|
||||||
outColor = vec4(baseColor, 1.0);
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout( push_constant ) uniform Constants {
|
|
||||||
mat4 model;
|
|
||||||
mat4 view;
|
|
||||||
} constants;
|
|
||||||
|
|
||||||
layout(set = 0, binding = 0) uniform SetZeroBuffer {
|
|
||||||
mat4 proj;
|
|
||||||
vec2 myValue;
|
|
||||||
} setZeroBuffer;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 inPosition;
|
|
||||||
layout(location = 1) in vec3 inNorm;
|
|
||||||
layout(location = 2) in vec4 inTangent;
|
|
||||||
layout(location = 3) in vec2 inUV;
|
|
||||||
|
|
||||||
layout(location = 0) out vec2 fragUV;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_Position = setZeroBuffer.proj * constants.view * constants.model * vec4(inPosition, 1.0);
|
|
||||||
fragUV = inUV;
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(set = 2, binding = 0) uniform sampler2D materialSetAlbedoSampler;
|
|
||||||
layout(set = 2, binding = 1) uniform sampler2D materialSetNormalSampler;
|
|
||||||
layout(set = 2, binding = 2) uniform sampler2D materialSetOcclusionSampler;
|
|
||||||
layout(set = 2, binding = 3) uniform sampler2D materialSetMetallicRoughnessSampler;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 fragPos;
|
|
||||||
layout(location = 1) in vec3 fragNorm;
|
|
||||||
layout(location = 2) in vec2 fragUV;
|
|
||||||
layout(location = 3) in vec3 fragLightPos;
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 outColor;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
// constants
|
|
||||||
vec3 lightColor = vec3(1.0, 1.0, 1.0);
|
|
||||||
vec3 ambientColor = vec3(1.0, 1.0, 1.0);
|
|
||||||
float ambientStrength = 0.05;
|
|
||||||
vec3 baseColor = vec3(texture(materialSetAlbedoSampler, fragUV));
|
|
||||||
vec3 emission = vec3(0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
// code
|
|
||||||
|
|
||||||
vec3 norm = normalize(fragNorm);
|
|
||||||
vec3 lightDir = normalize(fragLightPos - fragPos);
|
|
||||||
|
|
||||||
vec3 diffuse = max(dot(norm, lightDir), 0.0) * lightColor;
|
|
||||||
vec3 ambient = ambientColor * ambientStrength;
|
|
||||||
|
|
||||||
vec3 viewDir = normalize(-fragPos);
|
|
||||||
vec3 reflectDir = reflect(-lightDir, norm);
|
|
||||||
|
|
||||||
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);
|
|
||||||
vec3 specular = 0.5 * spec * lightColor;
|
|
||||||
|
|
||||||
vec3 lighting = min(diffuse + ambient + specular, 1.0);
|
|
||||||
outColor = min( ( vec4(baseColor, 1.0) ) * vec4(lighting + emission, 1.0), vec4(1.0));
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
#version 450
|
|
||||||
|
|
||||||
layout(set = 0, binding = 0) uniform GlobalSetUniformBuffer {
|
|
||||||
mat4 proj;
|
|
||||||
} globalSetUniformBuffer;
|
|
||||||
|
|
||||||
layout(set = 1, binding = 0) uniform FrameSetUniformBuffer {
|
|
||||||
mat4 view;
|
|
||||||
} frameSetUniformBuffer;
|
|
||||||
|
|
||||||
layout( push_constant ) uniform Constants {
|
|
||||||
mat4 model;
|
|
||||||
} constants;
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 inPosition;
|
|
||||||
layout(location = 1) in vec3 inNorm;
|
|
||||||
layout(location = 2) in vec4 inTangent;
|
|
||||||
layout(location = 3) in vec2 inUV;
|
|
||||||
|
|
||||||
layout(location = 0) out vec3 fragPos;
|
|
||||||
layout(location = 1) out vec3 fragNorm;
|
|
||||||
layout(location = 2) out vec2 fragUV;
|
|
||||||
layout(location = 3) out vec3 fragLightPos;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_Position = globalSetUniformBuffer.proj * frameSetUniformBuffer.view * constants.model * vec4(inPosition, 1.0);
|
|
||||||
|
|
||||||
fragPos = vec3(frameSetUniformBuffer.view * constants.model * vec4(inPosition, 1.0));
|
|
||||||
fragNorm = mat3(transpose(inverse(frameSetUniformBuffer.view * constants.model))) * inNorm;
|
|
||||||
fragUV = inUV;
|
|
||||||
|
|
||||||
vec3 lightPos = vec3(5900.0, -2000.0, 1000.0);
|
|
||||||
fragLightPos = vec3(frameSetUniformBuffer.view * vec4(lightPos, 1.0));
|
|
||||||
|
|
||||||
gl_Position.y *= -1.0;
|
|
||||||
}
|
|
@ -75,7 +75,7 @@ namespace engine {
|
|||||||
LOG_DEBUG("VULKAN MESSAGE{}: ID: {} MSG: {}", msgType, pCallbackData->pMessageIdName, pCallbackData->pMessage);
|
LOG_DEBUG("VULKAN MESSAGE{}: ID: {} MSG: {}", msgType, pCallbackData->pMessageIdName, pCallbackData->pMessage);
|
||||||
break;
|
break;
|
||||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
|
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
|
||||||
LOG_INFO("VULKAN MESSAGE{}: ID: {} MSG: {}", msgType, pCallbackData->pMessageIdName, pCallbackData->pMessage);
|
LOG_TRACE("VULKAN MESSAGE{}: ID: {} MSG: {}", msgType, pCallbackData->pMessageIdName, pCallbackData->pMessage);
|
||||||
break;
|
break;
|
||||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
|
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
|
||||||
LOG_WARN("VULKAN MESSAGE{}: ID: {} MSG: {}", msgType, pCallbackData->pMessageIdName, pCallbackData->pMessage);
|
LOG_WARN("VULKAN MESSAGE{}: ID: {} MSG: {}", msgType, pCallbackData->pMessageIdName, pCallbackData->pMessage);
|
||||||
|
@ -19,7 +19,7 @@ namespace engine {
|
|||||||
sc->device = info.device;
|
sc->device = info.device;
|
||||||
sc->allocator = info.allocator;
|
sc->allocator = info.allocator;
|
||||||
|
|
||||||
LOG_INFO("Recreating swapchain!\n");
|
LOG_DEBUG("Recreating swapchain!\n");
|
||||||
|
|
||||||
// get surface caps and features
|
// get surface caps and features
|
||||||
VkResult res;
|
VkResult res;
|
||||||
|
@ -184,7 +184,7 @@ void CameraControllerSystem::OnUpdate(float ts)
|
|||||||
/* user interface inputs */
|
/* user interface inputs */
|
||||||
|
|
||||||
if (scene_->app()->window()->GetKeyPress(engine::inputs::Key::K_R) || glm::length(t->position) > CameraControllerComponent::kMaxDistanceFromOrigin) {
|
if (scene_->app()->window()->GetKeyPress(engine::inputs::Key::K_R) || glm::length(t->position) > CameraControllerComponent::kMaxDistanceFromOrigin) {
|
||||||
t->position = {0.0f, 0.0f, 100.0f};
|
t->position = {0.0f, 0.0f, 10.0f};
|
||||||
c->vel = {0.0f, 0.0f, 0.0f};
|
c->vel = {0.0f, 0.0f, 0.0f};
|
||||||
c->pitch = glm::half_pi<float>();
|
c->pitch = glm::half_pi<float>();
|
||||||
c->yaw = 0.0f;
|
c->yaw = 0.0f;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_TEST_SRC_CAMERA_CONTROLLER_H_
|
#pragma once
|
||||||
#define ENGINE_TEST_SRC_CAMERA_CONTROLLER_H_
|
|
||||||
|
|
||||||
#include <glm/vec3.hpp>
|
#include <glm/vec3.hpp>
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ struct CameraControllerComponent {
|
|||||||
static constexpr size_t kNumHorizontalRays = 20;
|
static constexpr size_t kNumHorizontalRays = 20;
|
||||||
|
|
||||||
static constexpr float kGravAccel = -9.81f;
|
static constexpr float kGravAccel = -9.81f;
|
||||||
static constexpr float kMaxDistanceFromOrigin = 1000.0f;
|
static constexpr float kMaxDistanceFromOrigin = 200.0f;
|
||||||
|
|
||||||
bool noclip = false;
|
bool noclip = false;
|
||||||
|
|
||||||
@ -50,5 +49,3 @@ class CameraControllerSystem : public engine::System {
|
|||||||
|
|
||||||
engine::Scene* next_scene_ = nullptr;
|
engine::Scene* next_scene_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
@ -16,7 +16,6 @@
|
|||||||
#include "systems/mesh_render_system.h"
|
#include "systems/mesh_render_system.h"
|
||||||
#include "systems/transform.h"
|
#include "systems/transform.h"
|
||||||
#include "util/gltf_loader.h"
|
#include "util/gltf_loader.h"
|
||||||
#include "util/model_loader.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
@ -47,8 +46,8 @@ void PlayGame(GameSettings settings)
|
|||||||
|
|
||||||
engine::gfx::GraphicsSettings graphics_settings{};
|
engine::gfx::GraphicsSettings graphics_settings{};
|
||||||
graphics_settings.enable_validation = settings.enable_validation;
|
graphics_settings.enable_validation = settings.enable_validation;
|
||||||
graphics_settings.vsync = true;
|
graphics_settings.vsync = false;
|
||||||
graphics_settings.wait_for_present = true;
|
graphics_settings.wait_for_present = false;
|
||||||
graphics_settings.msaa_level = engine::gfx::MSAALevel::kOff;
|
graphics_settings.msaa_level = engine::gfx::MSAALevel::kOff;
|
||||||
graphics_settings.enable_anisotropy = true;
|
graphics_settings.enable_anisotropy = true;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef ENGINE_TEST_SRC_GAME_H_
|
#pragma once
|
||||||
#define ENGINE_TEST_SRC_GAME_H_
|
|
||||||
|
|
||||||
struct GameSettings {
|
struct GameSettings {
|
||||||
bool enable_frame_limiter;
|
bool enable_frame_limiter;
|
||||||
@ -7,5 +6,3 @@ struct GameSettings {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void PlayGame(GameSettings settings);
|
void PlayGame(GameSettings settings);
|
||||||
|
|
||||||
#endif
|
|
@ -1,16 +1,9 @@
|
|||||||
#ifndef ENGINE_TEST_SRC_MESHGEN_H_
|
#pragma once
|
||||||
#define ENGINE_TEST_SRC_MESHGEN_H_
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "resources/mesh.h"
|
#include "resources/mesh.h"
|
||||||
|
|
||||||
std::unique_ptr<engine::Mesh> GenSphereMesh(
|
std::unique_ptr<engine::Mesh> GenSphereMesh(engine::GFXDevice* gfx, float r, int detail, bool wind_inside = false, bool flip_normals = false);
|
||||||
engine::GFXDevice* gfx, float r, int detail, bool wind_inside = false,
|
|
||||||
bool flip_normals = false);
|
|
||||||
|
|
||||||
std::unique_ptr<engine::Mesh> GenCuboidMesh(
|
std::unique_ptr<engine::Mesh> GenCuboidMesh(engine::GFXDevice* gfx, float x, float y, float z, float tiling = 1.0f, bool wind_inside = false);
|
||||||
engine::GFXDevice* gfx, float x, float y, float z, float tiling = 1.0f,
|
|
||||||
bool wind_inside = false);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user