Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 45a92b362f | |||
| 2085d9ec9e | |||
| 0e5f6da9a9 | |||
| 42b52a6766 | |||
| 9090be8acf | |||
| a3d4eb65d5 | |||
| 9b2a4be707 | |||
| 5474a18753 | |||
| ca8b7cbee8 | |||
| 0c97ce7a4a |
@@ -9,9 +9,9 @@
|
||||
class CollidableOctreeSystem : public ImpureSystem, public PureSystem
|
||||
{
|
||||
public:
|
||||
CollidableOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
|
||||
CollidableOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree, const std::string& componentType)
|
||||
: System(world, eventBroker)
|
||||
, PureSystem("Collidable")
|
||||
, PureSystem(componentType)
|
||||
, m_Octree(octree)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class ComponentWrapperFactory
|
||||
{
|
||||
public:
|
||||
ComponentWrapperFactory() = default;
|
||||
ComponentWrapperFactory(std::string componentTypeName, std::size_t allocation = 0)
|
||||
ComponentWrapperFactory(std::string componentTypeName, unsigned int allocation = 0)
|
||||
{
|
||||
m_ComponentInfo.Name = componentTypeName;
|
||||
m_ComponentInfo.Meta->Allocation = allocation;
|
||||
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
~EntityFile();
|
||||
|
||||
public:
|
||||
static std::size_t GetTypeStride(std::string typeName);
|
||||
static unsigned int GetTypeStride(std::string typeName);
|
||||
static void WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes);
|
||||
static void WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ template<typename T>
|
||||
template<typename Box>
|
||||
void Octree<T>::ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects)
|
||||
{
|
||||
//static_assert(std::is_base_of<AABB, Box>::value, "template argument type Box in Octree<T>::ObjectsInSameRegion must be a subclass of AABB.");
|
||||
static_assert(std::is_base_of<AABB, Box>::value, "template argument type Box in Octree<T>::ObjectsInSameRegion must be a subclass of AABB.");
|
||||
falsifyObjectChecks();
|
||||
m_Root->ObjectsInSameRegion(box, outObjects);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ enum class FileWatcher::FileEventFlags
|
||||
};
|
||||
|
||||
inline FileWatcher::FileEventFlags operator|(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return static_cast<FileWatcher::FileEventFlags>(static_cast<int>(a) | static_cast<int>(b)); }
|
||||
inline bool operator&(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return static_cast<int>(a)& static_cast<int>(b); }
|
||||
inline bool operator&(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return (static_cast<int>(a) & static_cast<int>(b)) != 0; }
|
||||
|
||||
class FileWatcher::Worker
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
struct FileInfo
|
||||
{
|
||||
int Size;
|
||||
std::size_t Size;
|
||||
std::time_t Timestamp;
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
m_SpeedMultiplier = m_Config->Get<float>("Editor.CameraSpeed", 3.f);
|
||||
}
|
||||
|
||||
virtual const glm::vec3 Movement() const override { return m_Movement * m_SpeedMultiplier; }
|
||||
virtual const glm::vec3 Movement() const override { return m_Movement * static_cast<float>(m_SpeedMultiplier); }
|
||||
|
||||
void Enable() { m_Enabled = true; }
|
||||
void Disable() { m_Enabled = false; }
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
protected:
|
||||
ConfigFile* m_Config;
|
||||
bool m_Enabled = false;
|
||||
float m_SpeedMultiplier = 1.f;
|
||||
double m_SpeedMultiplier = 1.f;
|
||||
|
||||
EventRelay<EventContext, Events::MousePress> m_EMousePress;
|
||||
bool OnMousePress(const Events::MousePress& e)
|
||||
@@ -105,7 +105,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_SpeedMultiplier += e.DeltaY * (0.1f * m_SpeedMultiplier);
|
||||
m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier);
|
||||
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
|
||||
m_Config->SaveToDisk();
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,11 @@ public:
|
||||
virtual const glm::vec3 Rotation() const { return m_Rotation; }
|
||||
virtual bool Jumping() const { return m_Jumping; }
|
||||
virtual bool Crouching() const { return m_Crouching; }
|
||||
|
||||
virtual bool DoubleJumping() const { return m_DoubleJumping; }
|
||||
virtual void SetDoubleJumping(bool isDoubleJumping) {
|
||||
m_DoubleJumping = isDoubleJumping;
|
||||
}
|
||||
|
||||
void LockMouse();
|
||||
void UnlockMouse();
|
||||
virtual bool OnCommand(const Events::InputCommand& e) override;
|
||||
@@ -27,8 +31,9 @@ protected:
|
||||
glm::vec3 m_Rotation;
|
||||
glm::vec3 m_Movement;
|
||||
bool m_Jumping = false;
|
||||
bool m_DoubleJumping = false;
|
||||
bool m_Crouching = false;
|
||||
|
||||
|
||||
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
||||
bool OnLockMouse(const Events::LockMouse& e);
|
||||
EventRelay<EventContext, Events::UnlockMouse> m_EUnlockMouse;
|
||||
@@ -36,7 +41,7 @@ protected:
|
||||
};
|
||||
|
||||
template <typename EventContext>
|
||||
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
|
||||
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
|
||||
: InputController(eventBroker)
|
||||
, m_PlayerID(playerID)
|
||||
{
|
||||
@@ -113,14 +118,14 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
||||
template <typename EventContext>
|
||||
bool FirstPersonInputController<EventContext>::OnUnlockMouse(const Events::UnlockMouse& e)
|
||||
{
|
||||
m_MouseLocked = false;
|
||||
m_MouseLocked = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename EventContext>
|
||||
bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMouse& e)
|
||||
{
|
||||
m_MouseLocked = true;
|
||||
m_MouseLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,21 +75,21 @@ private:
|
||||
|
||||
|
||||
void ReadMeshFile(std::string filePath);
|
||||
void ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMesh(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadIndices(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMeshFileHeader(std::size_t& offset, char* fileData);
|
||||
void ReadMesh(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadVertices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadIndices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
|
||||
void ReadMaterialFile(std::string filePath);
|
||||
void ReadMaterials(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMaterialSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
|
||||
void ReadAnimationFile(std::string filePath);
|
||||
void ReadAnimationBindPoses(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadAnimationJoint(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
|
||||
void ReadAnimationClips(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfClips);
|
||||
void ReadAnimationClipSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int clipIndex);
|
||||
void ReadAnimationKeyFrame(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation);
|
||||
void ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadAnimationJoint(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips);
|
||||
void ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex);
|
||||
void ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation);
|
||||
|
||||
//void CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
|
||||
};
|
||||
|
||||
@@ -51,6 +51,7 @@ private:
|
||||
GUI::Frame* m_FrameStack;
|
||||
World* m_World;
|
||||
Octree<EntityAABB>* m_OctreeCollision;
|
||||
Octree<EntityAABB>* m_OctreeTrigger;
|
||||
Octree<EntityAABB>* m_OctreeFrustrumCulling;
|
||||
SystemPipeline* m_SystemPipeline;
|
||||
RenderFrame* m_RenderFrame;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<xs:element name="CapturePoint">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A Capture Point. Add a Team Component to specify who currently owns it</xs:documentation>
|
||||
<xs:documentation>A Capture Point. Make sure to update the HomePoint,CapturePointNumber,Team for each</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint/>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
<c:Transform/>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
|
||||
<Children/>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="0.340887427" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<HomePointForTeam>
|
||||
<Red/>
|
||||
</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Red/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="6.60000038" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
<c:Transform>
|
||||
<Position X="4.46673203" Y="0" Z="3.50259304"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Blue/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="3.00000024" Y="0" Z="0.113596022"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Blue/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="1.75382805" Y="0" Z="0.0895374417"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<HomePointForTeam>
|
||||
<Blue/>
|
||||
</HomePointForTeam>
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Blue/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="0.56674248" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:Health/>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitCube.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Blue/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="4.29100037" Y="-0.08556436" Z="1.29717529"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:Health/>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitCube.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Red/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="5.43557501" Y="0.888866663" Z="1.55849135"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.600000024" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -76,18 +76,18 @@ bool TriggerSystem::throwLeaveIfWasInTrigger(std::unordered_set<EntityWrapper>&
|
||||
|
||||
bool TriggerSystem::OnTouch(const Events::TriggerTouch &event)
|
||||
{
|
||||
LOG_INFO("Player entity %i touched trigger entity %i.", event.Entity, event.Trigger);
|
||||
LOG_INFO("Player entity %i touched trigger entity %i.", event.Entity.ID, event.Trigger.ID);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TriggerSystem::OnEnter(const Events::TriggerEnter &event)
|
||||
{
|
||||
LOG_INFO("Player entity %i entered trigger entity %i.", event.Entity, event.Trigger);
|
||||
LOG_INFO("Player entity %i entered trigger entity %i.", event.Entity.ID, event.Trigger.ID);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TriggerSystem::OnLeave(const Events::TriggerLeave &event)
|
||||
{
|
||||
LOG_INFO("Player entity %i left trigger entity %i.", event.Entity, event.Trigger);
|
||||
LOG_INFO("Player entity %i left trigger entity %i.", event.Entity.ID, event.Trigger.ID);
|
||||
return true;
|
||||
}
|
||||
@@ -40,9 +40,9 @@ void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
|
||||
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
|
||||
}
|
||||
|
||||
std::size_t EntityFile::GetTypeStride(std::string typeName)
|
||||
unsigned int EntityFile::GetTypeStride(std::string typeName)
|
||||
{
|
||||
std::map<std::string, size_t> typeStrides{
|
||||
std::map<std::string, unsigned int> typeStrides{
|
||||
{ "bool", sizeof(bool) },
|
||||
{ "int", sizeof(int) },
|
||||
{ "float", sizeof(float) },
|
||||
|
||||
@@ -114,7 +114,7 @@ void EntityFilePreprocessor::parseComponentInfo()
|
||||
std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName());
|
||||
|
||||
std::string effectiveType = type;
|
||||
size_t stride = EntityFile::GetTypeStride(type);
|
||||
unsigned int stride = EntityFile::GetTypeStride(type);
|
||||
if (stride == 0) {
|
||||
stride = EntityFile::GetTypeStride(baseType);
|
||||
if (stride == 0) {
|
||||
|
||||
@@ -218,7 +218,7 @@ void InputManager::PublishGamepadAxisIfChanged(int gamepadID, Gamepad::Axis axis
|
||||
void InputManager::PublishGamepadButtonIfChanged(int gamepadID, Gamepad::Button button)
|
||||
{
|
||||
bool currentState = m_CurrentGamepadButtonState[gamepadID][static_cast<int>(button)];
|
||||
float lastState = m_LastGamepadButtonState[gamepadID][static_cast<int>(button)];
|
||||
bool lastState = m_LastGamepadButtonState[gamepadID][static_cast<int>(button)];
|
||||
if (currentState != lastState) {
|
||||
if (currentState == true) {
|
||||
Events::GamepadButtonDown e;
|
||||
|
||||
@@ -69,7 +69,7 @@ void EditorGUI::drawTools()
|
||||
} else if (m_CurrentWidgetSpace == WidgetSpace::Local) {
|
||||
spaceTexture = tryLoadTexture("Textures/Icons/Local.png");
|
||||
}
|
||||
if (ImGui::ImageButton((void*)spaceTexture, ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
|
||||
if (ImGui::ImageButton(reinterpret_cast<void*>(spaceTexture), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
|
||||
toggleWidgetSpace();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
@@ -85,14 +85,14 @@ void EditorGUI::drawTools()
|
||||
|
||||
// Play button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ImageButton((void*)tryLoadTexture("Textures/Icons/Play.png"), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (!m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
if (ImGui::ImageButton(reinterpret_cast<void*>(tryLoadTexture("Textures/Icons/Play.png")), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (!m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
Events::Resume e;
|
||||
e.World = m_World;
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
// Pause button
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ImageButton((void*)tryLoadTexture("Textures/Icons/Pause.png"), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
if (ImGui::ImageButton(reinterpret_cast<void*>(tryLoadTexture("Textures/Icons/Pause.png")), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (m_Paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
Events::Pause e;
|
||||
e.World = m_World;
|
||||
m_EventBroker->Publish(e);
|
||||
@@ -262,7 +262,7 @@ void EditorGUI::drawComponents(EntityWrapper entity)
|
||||
// Draw combo box
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() - 10.f);
|
||||
int selectedItem = -1;
|
||||
if (ImGui::Combo("", &selectedItem, componentTypes.data(), componentTypes.size(), componentTypes.size())) {
|
||||
if (ImGui::Combo("", &selectedItem, componentTypes.data(), static_cast<int>(componentTypes.size()), static_cast<int>(componentTypes.size()))) {
|
||||
if (selectedItem != -1) {
|
||||
if (m_OnComponentAttach != nullptr) {
|
||||
std::string chosenComponentType(componentTypes.at(selectedItem));
|
||||
@@ -565,7 +565,7 @@ void EditorGUI::createWidgetToolButton(WidgetMode mode)
|
||||
break;
|
||||
}
|
||||
if (ImGui::ImageButton(
|
||||
(void*)texture,
|
||||
reinterpret_cast<void*>(texture),
|
||||
ImVec2(24, 24),
|
||||
ImVec2(0, 1),
|
||||
ImVec2(1, 0),
|
||||
|
||||
@@ -80,9 +80,9 @@ bool EditorRenderSystem::OnSetCamera(Events::SetCamera& e)
|
||||
{
|
||||
ComponentWrapper cTransform = e.CameraEntity["Transform"];
|
||||
ComponentWrapper cCamera = e.CameraEntity["Camera"];
|
||||
m_EditorCamera->SetFOV((double)cCamera["FOV"]);
|
||||
m_EditorCamera->SetNearClip((double)cCamera["NearClip"]);
|
||||
m_EditorCamera->SetFarClip((double)cCamera["FarClip"]);
|
||||
m_EditorCamera->SetFOV(static_cast<float>((double)cCamera["FOV"]));
|
||||
m_EditorCamera->SetNearClip(static_cast<float>((double)cCamera["NearClip"]));
|
||||
m_EditorCamera->SetFarClip(static_cast<float>((double)cCamera["FarClip"]));
|
||||
m_EditorCamera->SetPosition(cTransform["Position"]);
|
||||
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
||||
m_CurrentCamera = e.CameraEntity;
|
||||
|
||||
@@ -98,7 +98,7 @@ bool MouseInputHandler::OnMouseMove(const Events::MouseMove& e)
|
||||
Events::InputCommand ic;
|
||||
ic.PlayerID = -1;
|
||||
std::tie(ic.Command, ic.Value) = it->second;
|
||||
ic.Value *= e.DeltaX;
|
||||
ic.Value *= static_cast<float>(e.DeltaX);
|
||||
m_InputProxy->Publish(ic);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ bool MouseInputHandler::OnMouseMove(const Events::MouseMove& e)
|
||||
Events::InputCommand ic;
|
||||
ic.PlayerID = -1;
|
||||
std::tie(ic.Command, ic.Value) = it->second;
|
||||
ic.Value *= e.DeltaY;
|
||||
ic.Value *= static_cast<float>(e.DeltaY);
|
||||
m_InputProxy->Publish(ic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ bool ImGuiRenderPass::OnMouseRelease(const Events::MouseRelease& e)
|
||||
bool ImGuiRenderPass::OnMouseMove(const Events::MouseMove& e)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.MousePos.x = e.X;
|
||||
io.MousePos.y = e.Y;
|
||||
io.MousePos.x = static_cast<float>(e.X);
|
||||
io.MousePos.y = static_cast<float>(e.Y);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ bool ImGuiRenderPass::createFontsTexture()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void*)g_FontTexture;
|
||||
io.Fonts->TexID = reinterpret_cast<void*>(g_FontTexture);
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
@@ -291,7 +291,7 @@ void ImGuiRenderPass::newFrame()
|
||||
io.DisplaySize = ImVec2((float)w, (float)h);
|
||||
io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
|
||||
|
||||
io.DeltaTime = g_DeltaTime;
|
||||
io.DeltaTime = static_cast<float>(g_DeltaTime);
|
||||
|
||||
io.KeyCtrl = glfwGetKey(g_Window, GLFW_KEY_LEFT_CONTROL) || glfwGetKey(g_Window, GLFW_KEY_RIGHT_CONTROL);
|
||||
io.KeyShift = glfwGetKey(g_Window, GLFW_KEY_LEFT_SHIFT) || glfwGetKey(g_Window, GLFW_KEY_RIGHT_SHIFT);
|
||||
|
||||
@@ -71,12 +71,12 @@ PNG::PNG(std::string path)
|
||||
png_read_update_info(png_ptr, info_ptr);
|
||||
}
|
||||
|
||||
unsigned int row_bytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
std::size_t row_bytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
this->Data = new unsigned char[height * row_bytes];
|
||||
png_bytep* row_pointers = new png_bytep[height];
|
||||
|
||||
// Point each row to the continuous data array
|
||||
for (int i = 0; i < height; ++i) {
|
||||
for (unsigned int i = 0; i < height; ++i) {
|
||||
// Invert Y for OpenGL
|
||||
row_pointers[height - 1 - i] = this->Data + i * row_bytes;
|
||||
}
|
||||
|
||||
@@ -22,42 +22,42 @@ void RawModelCustom::ReadMeshFile(std::string filePath)
|
||||
if (!in.is_open()) {
|
||||
throw Resource::FailedLoadingException("Open mesh file failed");
|
||||
}
|
||||
unsigned int fileByteSize = in.tellg();
|
||||
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
|
||||
in.seekg(0, std::ios_base::beg);
|
||||
|
||||
fileData = new char[fileByteSize];
|
||||
in.read(fileData, fileByteSize);
|
||||
in.close();
|
||||
|
||||
unsigned int offset = 0;
|
||||
std::size_t offset = 0;
|
||||
if (fileByteSize > 0) {
|
||||
ReadMeshFileHeader(offset, fileData, fileByteSize);
|
||||
ReadMeshFileHeader(offset, fileData);
|
||||
ReadMesh(offset, fileData, fileByteSize);
|
||||
}
|
||||
delete fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMeshFileHeader(std::size_t& offset, char* fileData)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
m_Vertices.resize(*(unsigned int*)(fileData + offset));
|
||||
m_Vertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
offset += sizeof(unsigned int);
|
||||
m_Indices.resize(*(unsigned int*)(fileData + offset));
|
||||
m_Indices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
offset += sizeof(unsigned int);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMesh(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMesh(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
ReadVertices(offset, fileData, fileByteSize);
|
||||
ReadIndices(offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadVertices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
|
||||
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading vertices failed");
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, unsigned
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadIndices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadIndices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + m_Indices.size() * sizeof(unsigned int) > fileByteSize) {
|
||||
@@ -90,35 +90,36 @@ void RawModelCustom::ReadMaterialFile(std::string filePath)
|
||||
if (!in.is_open()) {
|
||||
throw Resource::FailedLoadingException("Open material file failed");
|
||||
}
|
||||
unsigned int fileByteSize = in.tellg();
|
||||
|
||||
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
|
||||
in.seekg(0, std::ios_base::beg);
|
||||
|
||||
fileData = new char[fileByteSize];
|
||||
in.read(fileData, fileByteSize);
|
||||
in.close();
|
||||
|
||||
unsigned int offset = 0;
|
||||
std::size_t offset = 0;
|
||||
if (fileByteSize > 0) {
|
||||
ReadMaterials(offset, fileData, fileByteSize);
|
||||
}
|
||||
delete fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterials(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
unsigned int* numMaterials = (unsigned int*)(fileData);
|
||||
MaterialGroups.reserve(*numMaterials);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
for (int i = 0; i < *numMaterials; i++) {
|
||||
for (unsigned int i = 0; i < *numMaterials; i++) {
|
||||
ReadMaterialSingle(offset, fileData, fileByteSize);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
MaterialGroup newMaterial;
|
||||
|
||||
@@ -210,14 +211,14 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int fileByteSize = in.tellg();
|
||||
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
|
||||
in.seekg(0, std::ios_base::beg);
|
||||
|
||||
fileData = new char[fileByteSize];
|
||||
in.read(fileData, fileByteSize);
|
||||
in.close();
|
||||
|
||||
unsigned int offset = 0;
|
||||
std::size_t offset = 0;
|
||||
if (fileByteSize > 0) {
|
||||
m_Skeleton = new Skeleton();
|
||||
|
||||
@@ -235,7 +236,7 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
delete fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationBindPoses(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
unsigned int* numBones = (unsigned int*)(fileData + offset);
|
||||
@@ -248,7 +249,7 @@ void RawModelCustom::ReadAnimationBindPoses(unsigned int &offset, char* fileData
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationJoint(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
|
||||
void RawModelCustom::ReadAnimationJoint(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + sizeof(unsigned int) > fileByteSize) {
|
||||
@@ -290,14 +291,14 @@ void RawModelCustom::ReadAnimationJoint(unsigned int &offset, char* fileData, un
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationClips(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfClips)
|
||||
void RawModelCustom::ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips)
|
||||
{
|
||||
for (unsigned int i = 0; i < numberOfClips; i++) {
|
||||
ReadAnimationClipSingle(offset, fileData, fileByteSize, i);
|
||||
}
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationClipSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int clipIndex)
|
||||
void RawModelCustom::ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
Skeleton::Animation newAnimation;
|
||||
@@ -342,7 +343,7 @@ void RawModelCustom::ReadAnimationClipSingle(unsigned int &offset, char* fileDat
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationKeyFrame(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int nrOfJoints, Skeleton::Animation& animation)
|
||||
void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation)
|
||||
{
|
||||
Skeleton::Animation::Keyframe newKeyFrame;
|
||||
|
||||
@@ -358,12 +359,12 @@ void RawModelCustom::ReadAnimationKeyFrame(unsigned int &offset, char* fileData,
|
||||
newKeyFrame.Time = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * nrOfJoints> fileByteSize) {
|
||||
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * numberOfJoints> fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationKeyFrame joints failed");
|
||||
}
|
||||
|
||||
Skeleton::Animation::Keyframe::BoneProperty newBone;
|
||||
for (unsigned int i = 0; i < nrOfJoints; i++) {
|
||||
for (unsigned int i = 0; i < numberOfJoints; i++) {
|
||||
memcpy(&newBone, (fileData + offset), sizeof(Skeleton::Animation::Keyframe::BoneProperty));
|
||||
offset += sizeof(Skeleton::Animation::Keyframe::BoneProperty);
|
||||
newKeyFrame.BoneProperties[newBone.ID] = newBone;
|
||||
|
||||
@@ -21,7 +21,7 @@ GLuint Shader::CompileShader(GLenum shaderType, std::string fileName)
|
||||
return 0;
|
||||
|
||||
const GLchar* shaderFiles = shaderFile.c_str();
|
||||
const GLint length = shaderFile.length();
|
||||
const GLint length = static_cast<GLint>(shaderFile.length());
|
||||
glShaderSource(shader, 1, &shaderFiles, &length);
|
||||
if (GLERROR("glShaderSource"))
|
||||
return 0;
|
||||
|
||||
@@ -53,11 +53,11 @@ std::vector<glm::mat4> Skeleton::GetFrameBones(const Animation& animation, doubl
|
||||
|
||||
const Animation::Keyframe& currentFrame = animation.Keyframes[currentKeyframeIndex];
|
||||
const Animation::Keyframe& nextFrame = animation.Keyframes[(currentKeyframeIndex + 1) % animation.Keyframes.size()];
|
||||
float alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
double alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
//auto animationFrame = Animations[""].Keyframes[frame];
|
||||
std::map<int, glm::mat4> frameBones;
|
||||
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, alpha, frameBones, RootBone, glm::mat4(1));
|
||||
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, static_cast<float>(alpha), frameBones, RootBone, glm::mat4(1));
|
||||
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto &kv : frameBones) {
|
||||
|
||||
@@ -116,7 +116,11 @@ void SoundSystem::updateEmitters(double dt)
|
||||
setSourcePos(it->second->ALsource, nextPos);
|
||||
setSourceVel(it->second->ALsource, velocity);
|
||||
float gain;
|
||||
(bool)(it->second->Type) ? gain = m_SFXVolumeChannel : gain = m_BGMVolumeChannel;
|
||||
if (it->second->Type == SoundType::SFX) {
|
||||
gain = m_SFXVolumeChannel;
|
||||
} else if (it->second->Type == SoundType::BGM) {
|
||||
gain = m_BGMVolumeChannel;
|
||||
}
|
||||
auto emitter = m_World->GetComponent(it->first, "SoundEmitter");
|
||||
setSoundProperties(it->second->ALsource, &emitter);
|
||||
|
||||
|
||||
+5
-2
@@ -74,6 +74,7 @@ Game::Game(int argc, char* argv[])
|
||||
|
||||
// Create Octrees
|
||||
m_OctreeCollision = new Octree<EntityAABB>(AABB(glm::vec3(-100), glm::vec3(100)), 4);
|
||||
m_OctreeTrigger = new Octree<EntityAABB>(AABB(glm::vec3(-100), glm::vec3(100)), 4);
|
||||
m_OctreeFrustrumCulling = new Octree<EntityAABB>(AABB(glm::vec3(-100), glm::vec3(100)), 4);
|
||||
// Create system pipeline
|
||||
m_SystemPipeline = new SystemPipeline(m_World, m_EventBroker);
|
||||
@@ -92,14 +93,15 @@ Game::Game(int argc, char* argv[])
|
||||
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
|
||||
// Populate Octree with collidables
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<CollidableOctreeSystem>(updateOrderLevel, m_OctreeCollision);
|
||||
m_SystemPipeline->AddSystem<CollidableOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||
m_SystemPipeline->AddSystem<CollidableOctreeSystem>(updateOrderLevel, m_OctreeTrigger, "Player");
|
||||
m_SystemPipeline->AddSystem<PlayerHUD>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<AnimationSystem>(updateOrderLevel);
|
||||
|
||||
// Collision and TriggerSystem should update after player.
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<CollisionSystem>(updateOrderLevel, m_OctreeCollision);
|
||||
m_SystemPipeline->AddSystem<TriggerSystem>(updateOrderLevel, m_OctreeCollision);
|
||||
m_SystemPipeline->AddSystem<TriggerSystem>(updateOrderLevel, m_OctreeTrigger);
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<RenderSystem>(updateOrderLevel, m_Renderer, m_RenderFrame);
|
||||
++updateOrderLevel;
|
||||
@@ -123,6 +125,7 @@ Game::~Game()
|
||||
delete m_SoundSystem;
|
||||
delete m_OctreeFrustrumCulling;
|
||||
delete m_OctreeCollision;
|
||||
delete m_OctreeTrigger;
|
||||
delete m_World;
|
||||
delete m_FrameStack;
|
||||
delete m_InputProxy;
|
||||
|
||||
@@ -64,9 +64,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
std::map<std::string, int> nextPossibleCapturePoint;
|
||||
nextPossibleCapturePoint["Red"] = -1;
|
||||
nextPossibleCapturePoint["Blue"] = -1;
|
||||
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
for (int i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
{
|
||||
if (m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
||||
if (!m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
||||
continue;
|
||||
}
|
||||
ComponentWrapper& capturePointOwnedBy = m_CapturePointNumberToEntityMap[i]["Team"];
|
||||
@@ -93,7 +93,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
|
||||
//reset timers and reset the bool that triggers this
|
||||
if (m_ResetTimers) {
|
||||
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
for (int i = 0; i < m_NumberOfCapturePoints; i++)
|
||||
{
|
||||
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
|
||||
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
|
||||
@@ -119,6 +119,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
if (std::get<1>(triggerTouched) == capturePointEntity) {
|
||||
//some player has touched this - lets figure out: what team, health
|
||||
EntityWrapper player = std::get<0>(triggerTouched);
|
||||
//check if its really a player that has triggered the touch
|
||||
if (!player.HasComponent("Player")) {
|
||||
//if a non-player has entered the capturePoint, just erase that event and continue
|
||||
m_ETriggerTouchVector.erase(m_ETriggerTouchVector.begin() + i - 1);
|
||||
|
||||
@@ -76,7 +76,13 @@ void PlayerMovementSystem::Update(double dt)
|
||||
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
|
||||
}
|
||||
|
||||
if (controller->Jumping() && !controller->Crouching() && velocity.y == 0.f) {
|
||||
if (controller->Jumping() && !controller->Crouching() && (velocity.y == 0.f || !controller->DoubleJumping())) {
|
||||
if (velocity.y == 0.f) {
|
||||
controller->SetDoubleJumping(false);
|
||||
}
|
||||
else {
|
||||
controller->SetDoubleJumping(true);
|
||||
}
|
||||
velocity.y += 4.f;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
|
||||
if (spawnPoints.size() > 1) {
|
||||
static std::random_device randomDevice;
|
||||
static std::mt19937 randomGenerator(randomDevice());
|
||||
std::uniform_int_distribution<> distribution(0, std::distance(spawnPoints.begin(), spawnPoints.end()) - 1);
|
||||
std::uniform_int_distribution<> distribution(0, static_cast<int>(std::distance(spawnPoints.begin(), spawnPoints.end())) - 1);
|
||||
auto randomSpawnPointIt = spawnPoints.begin();
|
||||
std::advance(randomSpawnPointIt, distribution(randomGenerator));
|
||||
spawnPoint = *randomSpawnPointIt;
|
||||
|
||||
Reference in New Issue
Block a user