Compare commits

..

1 Commits

Author SHA1 Message Date
Tleety f3aba6748b Warning fixes. 2016-02-08 16:02:23 +01:00
64 changed files with 252 additions and 2347 deletions
+1 -1
Submodule assets updated: c4898d8281...091ad5c01b
@@ -9,9 +9,9 @@
class CollidableOctreeSystem : public ImpureSystem, public PureSystem
{
public:
CollidableOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree, const std::string& componentType)
CollidableOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
: System(world, eventBroker)
, PureSystem(componentType)
, PureSystem("Collidable")
, m_Octree(octree)
{ }
+1 -1
View File
@@ -81,7 +81,7 @@ class ComponentWrapperFactory
{
public:
ComponentWrapperFactory() = default;
ComponentWrapperFactory(std::string componentTypeName, unsigned int allocation = 0)
ComponentWrapperFactory(std::string componentTypeName, std::size_t allocation = 0)
{
m_ComponentInfo.Name = componentTypeName;
m_ComponentInfo.Meta->Allocation = allocation;
+1 -1
View File
@@ -143,7 +143,7 @@ private:
~EntityFile();
public:
static unsigned int GetTypeStride(std::string typeName);
static std::size_t 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);
+1 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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)) != 0; }
inline bool operator&(FileWatcher::FileEventFlags a, FileWatcher::FileEventFlags b) { return static_cast<int>(a)& static_cast<int>(b); }
class FileWatcher::Worker
{
@@ -54,7 +54,7 @@ public:
private:
struct FileInfo
{
std::size_t Size;
int 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 * static_cast<float>(m_SpeedMultiplier); }
virtual const glm::vec3 Movement() const override { return m_Movement * 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;
double m_SpeedMultiplier = 1.f;
float 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.1 * m_SpeedMultiplier);
m_SpeedMultiplier += e.DeltaY * (0.1f * m_SpeedMultiplier);
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
m_Config->SaveToDisk();
return true;
@@ -15,11 +15,7 @@ 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;
@@ -31,9 +27,8 @@ 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;
@@ -41,7 +36,7 @@ protected:
};
template <typename EventContext>
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
: InputController(eventBroker)
, m_PlayerID(playerID)
{
@@ -118,14 +113,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;
}
@@ -19,7 +19,7 @@ struct DirectionalLightJob : RenderJob
Direction = glm::vec4(0,0,-1,0) * glm::inverse(Transform::AbsoluteOrientation(m_World, transformComponent.EntityID));
//Direction = glm::vec4((glm::vec3)directionalLightComponent["Direction"], 0.f);
Color = (glm::vec4)directionalLightComponent["Color"];
Intensity = (double)directionalLightComponent["Intensity"];
Intensity = (float)directionalLightComponent["Intensity"];
};
glm::vec4 Direction;
@@ -7,7 +7,6 @@
#include "ShaderProgram.h"
//#include "Util/UnorderedMapVec2.h"
#include "Texture.h"
#include "imgui/imgui.h"
class DrawColorCorrectionPass
{
@@ -17,13 +16,14 @@ public:
void InitializeFrameBuffers();
void InitializeShaderPrograms();
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure);
void Draw(GLuint sceneTexture, GLuint bloomTexture);
private:
const IRenderer* m_Renderer;
ShaderProgram* m_ColorCorrectionProgram;
Model* m_ScreenQuad;
GLfloat m_Exposure;
};
#endif
@@ -23,7 +23,7 @@ struct ExplosionEffectJob : ModelJob
ExplosionDuration = (double)explosionEffectComponent["ExplosionDuration"];
EndColor = (glm::vec4)explosionEffectComponent["EndColor"];
Randomness = (bool)explosionEffectComponent["Randomness"];
RandomnessScalar = (double)explosionEffectComponent["RandomnessScalar"];
RandomnessScalar = (float)((double)explosionEffectComponent["RandomnessScalar"]);
Velocity = (glm::vec2)explosionEffectComponent["Velocity"];
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
+1 -1
View File
@@ -62,7 +62,7 @@ struct ModelJob : RenderJob
if (world->HasComponent(Entity, "Animation") && Skeleton != nullptr) {
auto animationComponent = world->GetComponent(Entity, "Animation");
Animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["Name"]);
AnimationTime = (double)animationComponent["Time"];
AnimationTime = (float)((double)animationComponent["Time"]);
}
};
+3 -3
View File
@@ -18,9 +18,9 @@ struct PointLightJob : RenderJob
Position = glm::vec4((glm::vec3)transformComponent["Position"], 1.0f);
Position = glm::vec4(Transform::AbsolutePosition(m_World, transformComponent.EntityID), 1.f);
Color = (glm::vec4)pointLightComponent["Color"];
Radius = (double)pointLightComponent["Radius"];
Intensity = (double)pointLightComponent["Intensity"];
Falloff = (double)pointLightComponent["Falloff"];
Radius = (float)((double)pointLightComponent["Radius"]);
Intensity = (float)pointLightComponent["Intensity"];
Falloff = (float)pointLightComponent["Falloff"];
};
glm::vec4 Position;
+11 -11
View File
@@ -75,21 +75,21 @@ private:
void ReadMeshFile(std::string filePath);
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 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 ReadMaterialFile(std::string filePath);
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 ReadMaterials(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
void ReadMaterialSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize);
void ReadAnimationFile(std::string filePath);
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 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 CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
};
-4
View File
@@ -26,7 +26,6 @@ struct RenderScene
std::list<std::shared_ptr<RenderJob>> DirectionalLightJobs;
Rectangle Viewport;
bool ClearDepth = false;
glm::vec4 AmbientColor;
void Clear()
{
@@ -41,9 +40,6 @@ struct RenderScene
struct RenderFrame
{
public:
//TODO: Getters
GLfloat Gamma = 2.2f;
GLfloat Exposure = 1.f;
void Add(RenderScene &scene)
{
+1 -1
View File
@@ -9,7 +9,7 @@ inline bool _GLERROR(const char* info, const char* file, const char* func, unsig
GLenum error = glGetError();
if (error != GL_NO_ERROR)
{
_LOG(LOG_LEVEL_ERROR, file, func, line, "GL Error: %s\nError code: %i, %s\n", info, error, gluErrorString(error));
_LOG(LOG_LEVEL_ERROR, file, func, line, "GL Error: %s, %i, %s", info, error, gluErrorString(error));
return true;
}
@@ -11,7 +11,7 @@ struct std::hash<glm::ivec2>
{
inline std::size_t operator()(const glm::ivec2 &v) const
{
return boost::hash<float>()(v.x) ^ boost::hash<float>()(v.y);
return boost::hash<int>()(v.x) ^ boost::hash<int>()(v.y);
}
inline bool operator()(const glm::ivec2& a, const glm::ivec2& b)const
-1
View File
@@ -51,7 +51,6 @@ 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;
-1
View File
@@ -11,7 +11,6 @@
<xs:include schemaLocation="Components/AABB.xsd"/>
<xs:include schemaLocation="Components/PointLight.xsd"/>
<xs:include schemaLocation="Components/DirectionalLight.xsd"/>
<xs:include schemaLocation="Components/SceneLight.xsd"/>
<xs:include schemaLocation="Components/Trigger.xsd"/>
<xs:include schemaLocation="Components/ExplosionEffect.xsd"/>
<xs:include schemaLocation="Components/Health.xsd"/>
+1 -1
View File
@@ -6,7 +6,7 @@
<xs:element name="CapturePoint">
<xs:annotation>
<xs:documentation>A Capture Point. Make sure to update the HomePoint,CapturePointNumber,Team for each</xs:documentation>
<xs:documentation>A Capture Point. Add a Team Component to specify who currently owns it</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SceneLight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SceneLight.xsd">
<AmbientColor R="0.2" G="0.2" B="0.2" A="1"/>
<Visible>true</Visible>
<Gamma>2.2</Gamma>
<Exposure>1</Exposure>
</SceneLight>
@@ -1,25 +0,0 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="SceneLight">
<xs:annotation>
<xs:documentation>Some settings for the scene lighting</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="AmbientColor" type="t:Color" minOccurs="0">
<xs:annotation><xs:documentation>Color of the ambient light</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Visible" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Wether the ambient light should be applied or not</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Gamma" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Gamma correction for the scene</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Exposure" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The exposure of the camera</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="AssetBase" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Core/UnitCylinder.mesh</Resource>
<Color A="1" B="1.56862748" G="1.56862748" R="1.56862748"/>
</c:Model>
<c:Transform>
<Position X="0" Y="-0.231354833" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Light">
<Components>
<c:PointLight/>
<c:Transform>
<Position X="0" Y="0.663784981" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="RotationOrigin">
<Components>
<c:RaptorCopter>
<Speed>0.5</Speed>
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="28.7916641" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Asset">
<Components>
<c:Model>
<Resource>Models/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="1" Z="0"/>
<Orientation X="0.524000049" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -1,17 +0,0 @@
<?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>
@@ -1,173 +0,0 @@
<?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>
+74 -122
View File
@@ -2,9 +2,7 @@
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Position X="0" Y="-1" Z="0"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
@@ -20,7 +18,7 @@
</Components>
<Children/>
</Entity>
<Entity name="Listener">
<Entity>
<Components>
<c:Camera/>
<c:Listener/>
@@ -40,27 +38,18 @@
<Resource>Models/DirectionalLightWidget.mesh</Resource>
</c:Model>
<c:RaptorCopter>
<Speed>1</Speed>
<Speed>1.0499999523162842</Speed>
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Position X="2.1529963" Y="6.59221172" Z="0.169116676"/>
<Orientation X="4.16300011" Y="7875.41211" Z="0"/>
<Orientation X="4.16300011" Y="1422.89319" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AssaultTPose">
<Components>
<c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance>
<Velocity X="0" Y="0" Z="0.300000012"/>
<ExplosionOrigin X="0" Y="1.30000007" Z="0"/>
<TimeSinceDeath>5.0498686575577523</TimeSinceDeath>
<ExplosionDuration>5</ExplosionDuration>
<EndColor A="1" B="1" G="0" R="0"/>
<RandomnessScalar>3</RandomnessScalar>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
@@ -73,26 +62,11 @@
<Entity name="SecondaryWeapon">
<Components>
<c:Model>
<Resource>Models/AssaultWeaponRed.mesh</Resource>
<Transparent>true</Transparent>
<Resource>Models/SecondaryWeapon.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.560000002" Y="0.754308224" Z="0.181485131"/>
<Orientation X="0.989000022" Y="0" Z="6.10900021"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryWeaponRed">
<Components>
<c:Model>
<Resource>Models/DefenderGunRed.mesh</Resource>
<Transparent>true</Transparent>
<NormalMap>false</NormalMap>
</c:Model>
<c:Transform>
<Position X="0.515922487" Y="0.787437975" Z="0.132855967"/>
<Orientation X="0.989000022" Y="0" Z="0"/>
<Position X="-0.546139359" Y="0.853016734" Z="0.177482292"/>
<Orientation X="1.47266471" Y="0.524984181" Z="1.243698"/>
</c:Transform>
</Components>
<Children/>
@@ -111,7 +85,7 @@
<Components>
<c:Animation>
<Name>Run</Name>
<Time>0.17818245776980568</Time>
<Time>0.62051775215976157</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
@@ -127,7 +101,7 @@
<Components>
<c:Animation>
<Name>Walk</Name>
<Time>0.34546191187031372</Time>
<Time>0.28779680073140668</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
@@ -173,6 +147,70 @@
</c:Transform>
</Components>
<Children>
<Entity name="NormalSphere">
<Components>
<c:Model>
<Resource>Models/NormalMapSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="1.82700014" Y="0" Z="-0.166000009"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpecularSphere">
<Components>
<c:Model>
<Resource>Models/SpecularMapSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1.06487739" Y="0" Z="1.52336037"/>
</c:Transform>
</Components>
<Children>
<Entity name="Rotationpoint">
<Components>
<c:RaptorCopter>
<Speed>1</Speed>
<Axis X="0.699999988" Y="1" Z="0.300000012"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="404.200684" Y="577.428955" Z="173.228897"/>
</c:Transform>
</Components>
<Children>
<Entity name="PointLight">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Color A="1" B="0" G="3.92156863" R="3.92156863"/>
</c:Model>
<c:PointLight>
<Radius>3</Radius>
<Intensity>1.1399998664855957</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.600000024" Y="0.5" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="GlowMap">
<Components>
<c:Model>
<Resource>Models/IncandescenceMapSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1.10000002" Y="0" Z="-1.80000007"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CombinedSpheres">
<Components>
<c:Model>
@@ -189,7 +227,7 @@
<Axis X="1" Y="1" Z="1"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="6484.80273" Y="6484.80273" Z="6484.80273"/>
<Orientation X="53.9495354" Y="53.9495354" Z="53.9495354"/>
</c:Transform>
</Components>
<Children>
@@ -246,94 +284,8 @@
</Entity>
</Children>
</Entity>
<Entity name="SphereRotationOrigin">
<Components>
<c:RaptorCopter>
<Speed>1</Speed>
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="6281.02246" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="NormalSphere">
<Components>
<c:Model>
<Resource>Models/NormalMapSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="1.82700014" Y="0" Z="-0.166000009"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpecularSphere">
<Components>
<c:Model>
<Resource>Models/SpecularMapSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1.06487739" Y="0" Z="1.52336037"/>
</c:Transform>
</Components>
<Children>
<Entity name="Rotationpoint">
<Components>
<c:RaptorCopter>
<Speed>1</Speed>
<Axis X="0.699999988" Y="1" Z="0.300000012"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="4905.44824" Y="7008.50781" Z="2103.03223"/>
</c:Transform>
</Components>
<Children>
<Entity name="PointLight">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Color A="1" B="0" G="3.92156863" R="3.92156863"/>
</c:Model>
<c:PointLight>
<Radius>3</Radius>
<Intensity>1.1399998664855957</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.600000024" Y="0.5" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="GlowMap">
<Components>
<c:Model>
<Resource>Models/IncandescenceMapSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1.10000002" Y="0" Z="-1.80000007"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="SceneColors">
<Components>
<c:SceneLight>
<Gamma>1.3999999761581421</Gamma>
</c:SceneLight>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -84,6 +84,15 @@
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight/>
<c:Transform>
<Position X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+5 -12
View File
@@ -2,12 +2,12 @@
<Entity name="Player" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Health/>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:Collidable/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
@@ -20,7 +20,7 @@
</Team>
</c:Team>
<c:Transform>
<Position X="9.56501799e-22" Y="-0.471999973" Z="4.35902473e-22"/>
<Position X="8.60201447e-23" Y="0" Z="3.9201616e-23"/>
</c:Transform>
</Components>
@@ -101,19 +101,12 @@
</Entity>
<Entity name="Weapon">
<Components>
<c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance>
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
<Randomness>true</Randomness>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/AssaultWeaponRed.mesh</Resource>
<Resource>Models/AssaultWeapon.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
<Orientation X="0" Y="3.08300018" Z="0"/>
<Orientation X="0" Y="4.64700031" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -148,7 +141,7 @@
<Components>
<c:Animation>
<Name>Hold Pos</Name>
<Time>0.73506627647571587</Time>
<Time>0.73515426169631848</Time>
<Speed>1</Speed>
</c:Animation>
<c:HiddenForLocalPlayer/>
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -7,8 +7,7 @@
</c:Lifetime>
<c:Model>
<Resource>Models/CylinderBullet.mesh</Resource>
<Color A="0.156862751" B="39.2156868" G="7.84313726" R="0"/>
<Transparent>true</Transparent>
<Color A="1" B="39.2156868" G="7.84313726" R="0"/>
</c:Model>
<c:Transform>
<Scale X="0.0109999999" Y="0.0289999992" Z="100"/>
+1 -2
View File
@@ -7,8 +7,7 @@
</c:Lifetime>
<c:Model>
<Resource>Models/CylinderBullet.mesh</Resource>
<Color A="0.156862751" B="0" G="0.525490224" R="39.2156868"/>
<Transparent>true</Transparent>
<Color A="1" B="0" G="0.525490224" R="39.2156868"/>
</c:Model>
<c:Transform>
<Scale X="0.0110000009" Y="0.029000001" Z="100"/>
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SoundEmitter" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:SoundEmitter/>
<c:Transform/>
</Components>
<Children>
<Entity name="SoundEmitterText">
<Components>
<c:Text>
<Content>SoundEmitter</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
</c:Text>
<c:Transform>
<Scale X="0.5" Y="0.5" Z="0.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SpawnerRedTeam" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform/>
</Components>
<Children>
<Entity name="SpawnPointRedTeam">
<Components>
<c:SpawnPoint/>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="1" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpawnPointRedTeam">
<Components>
<c:SpawnPoint/>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpawnPointRedTeam">
<Components>
<c:SpawnPoint/>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpawnPointRedTeam">
<Components>
<c:SpawnPoint/>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="-1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SpawnPointRedTeam" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:SpawnPoint/>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="1.31625879" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
-1
View File
@@ -31,7 +31,6 @@
<xs:element ref="c:PlayerSpawn" minOccurs="0"/>
<xs:element ref="c:Team" minOccurs="0"/>
<xs:element ref="c:DirectionalLight" minOccurs="0"/>
<xs:element ref="c:SceneLight" minOccurs="0"/>
<xs:element ref="c:UniformScale" minOccurs="0"/>
<xs:element ref="c:EditorWidget" minOccurs="0"/>
<xs:element ref="c:Lifetime" minOccurs="0"/>
@@ -3,7 +3,6 @@
layout (binding = 0) uniform sampler2D SceneTexture;
layout (binding = 1) uniform sampler2D BloomTexture;
uniform float Exposure;
uniform float Gamma;
in VertexData{
vec2 TextureCoordinate;
@@ -13,6 +12,7 @@ out vec4 fragmentColor;
void main()
{
const float gamma = 2.2;
vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate);
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
hdrColor += bloomColor;
@@ -21,7 +21,7 @@ void main()
vec3 result = vec3(1.0) - exp(-hdrColor.rgb * Exposure);
//gamme correction
result = pow(result, vec3(1.0 / Gamma));
result = pow(result, vec3(1.0 / gamma));
fragmentColor = vec4(result, 1.0);
//fragmentColor = hdrColor;
+5 -23
View File
@@ -17,21 +17,15 @@ uniform bool ExponentialAccelaration;
in VertexData{
vec3 Position;
vec3 Normal;
vec3 Tangent;
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Input[];
out VertexData{
vec3 Position;
vec3 Normal;
vec3 Tangent;
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Output;
layout(triangles) in;
@@ -120,17 +114,12 @@ void main()
{
// calculate the max distance (s) the triangle will move
float s = (randomVelocity.x * ExplosionDuration) + (0.5 * a * pow(ExplosionDuration, 2));
float te = (length(triangleCenter2ExplosionRadius) / s);
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = te;
Output.ExplosionColor = EndColor * (length(triangleCenter2ExplosionRadius) / s);
}
else
{
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = timePercetage;
Output.ExplosionColor = EndColor * timePercetage;
}
// for every vertex on the triangle...
@@ -143,8 +132,6 @@ void main()
Output.Normal = Input[i].Normal;
Output.Position = Input[i].Position;
Output.TextureCoordinate = Input[i].TextureCoordinate;
Output.Tangent = Input[i].Tangent;
Output.BiTangent = Input[i].BiTangent;
// convert to model space for the gravity to always be in -y
vec4 ExplodedPositionInModelSpace = M * vec4(ExplodedPosition, 1.0);
@@ -167,14 +154,11 @@ void main()
// if explosion color should be affected by distance instead of time...
if (ColorByDistance == true)
{
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = 0.0;
Output.ExplosionColor = vec4(0.0);
}
else
{
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = timePercetage;
Output.ExplosionColor = EndColor * timePercetage;
}
// for every vertex on the triangle...
@@ -184,9 +168,7 @@ void main()
Output.Normal = Input[i].Normal;
Output.Position = Input[i].Position;
Output.TextureCoordinate = Input[i].TextureCoordinate;
Output.Tangent = Input[i].Tangent;
Output.BiTangent = Input[i].BiTangent;
// no change in position, pass through vertex
gl_Position = gl_in[i].gl_Position;
EmitVertex();
+7 -8
View File
@@ -7,13 +7,13 @@ uniform vec4 Color;
uniform vec4 DiffuseColor;
uniform vec2 ScreenDimensions;
uniform vec4 FillColor;
uniform vec4 AmbientColor;
uniform float FillPercentage;
layout (binding = 0) uniform sampler2D DiffuseTexture;
layout (binding = 1) uniform sampler2D NormalMapTexture;
layout (binding = 2) uniform sampler2D SpecularMapTexture;
layout (binding = 3) uniform sampler2D GlowMapTexture;
#define TILE_SIZE 16
struct LightSource {
@@ -55,12 +55,13 @@ in VertexData{
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Input;
out vec4 sceneColor;
out vec4 bloomColor;
vec4 scene_ambient = vec4(0.3,0.3,0.3,1);
struct LightResult {
vec4 Diffuse;
vec4 Specular;
@@ -119,7 +120,6 @@ void main()
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate);
vec4 position = V * M * vec4(Input.Position, 1.0);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, NormalMapTexture);
normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position);
@@ -128,7 +128,7 @@ void main()
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
LightResult totalLighting;
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
totalLighting.Diffuse = scene_ambient;
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
int start = int(LightGrids.Data[currentTile].Start);
@@ -150,9 +150,8 @@ void main()
totalLighting.Specular += light_result.Specular;
}
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
@@ -161,7 +160,7 @@ void main()
color_result += FillColor;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
color_result += glowTexel*3;
color_result += glowTexel;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
+1 -3
View File
@@ -20,7 +20,6 @@ out VertexData{
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Output;
void main()
@@ -42,6 +41,5 @@ void main()
Output.Normal = vec3(M * vec4(Normal, 0.0));
Output.Tangent = vec3(M * vec4(Tangent, 0.0));
Output.BiTangent = vec3(M * vec4(BiTangent, 0.0));
Output.ExplosionColor = vec4(1.0);
Output.ExplosionPercentageElapsed = 0.0;
Output.ExplosionColor = vec4(0.0);
}
+3 -3
View File
@@ -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.ID, event.Trigger.ID);
LOG_INFO("Player entity %i touched trigger entity %i.", event.Entity, event.Trigger);
return true;
}
bool TriggerSystem::OnEnter(const Events::TriggerEnter &event)
{
LOG_INFO("Player entity %i entered trigger entity %i.", event.Entity.ID, event.Trigger.ID);
LOG_INFO("Player entity %i entered trigger entity %i.", event.Entity, event.Trigger);
return true;
}
bool TriggerSystem::OnLeave(const Events::TriggerLeave &event)
{
LOG_INFO("Player entity %i left trigger entity %i.", event.Entity.ID, event.Trigger.ID);
LOG_INFO("Player entity %i left trigger entity %i.", event.Entity, event.Trigger);
return true;
}
+2 -2
View File
@@ -40,9 +40,9 @@ void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
}
unsigned int EntityFile::GetTypeStride(std::string typeName)
std::size_t EntityFile::GetTypeStride(std::string typeName)
{
std::map<std::string, unsigned int> typeStrides{
std::map<std::string, size_t> typeStrides{
{ "bool", sizeof(bool) },
{ "int", sizeof(int) },
{ "float", sizeof(float) },
+1 -1
View File
@@ -114,7 +114,7 @@ void EntityFilePreprocessor::parseComponentInfo()
std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName());
std::string effectiveType = type;
unsigned int stride = EntityFile::GetTypeStride(type);
size_t stride = EntityFile::GetTypeStride(type);
if (stride == 0) {
stride = EntityFile::GetTypeStride(baseType);
if (stride == 0) {
+1 -1
View File
@@ -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)];
bool lastState = m_LastGamepadButtonState[gamepadID][static_cast<int>(button)];
float lastState = m_LastGamepadButtonState[gamepadID][static_cast<int>(button)];
if (currentState != lastState) {
if (currentState == true) {
Events::GamepadButtonDown e;
+5 -5
View File
@@ -69,7 +69,7 @@ void EditorGUI::drawTools()
} else if (m_CurrentWidgetSpace == WidgetSpace::Local) {
spaceTexture = tryLoadTexture("Textures/Icons/Local.png");
}
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))) {
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))) {
toggleWidgetSpace();
}
if (ImGui::IsItemHovered()) {
@@ -85,14 +85,14 @@ void EditorGUI::drawTools()
// Play button
ImGui::SameLine();
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))) {
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))) {
Events::Resume e;
e.World = m_World;
m_EventBroker->Publish(e);
}
// Pause button
ImGui::SameLine();
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))) {
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))) {
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(), static_cast<int>(componentTypes.size()), static_cast<int>(componentTypes.size()))) {
if (ImGui::Combo("", &selectedItem, componentTypes.data(), componentTypes.size(), 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(
reinterpret_cast<void*>(texture),
(void*)texture,
ImVec2(24, 24),
ImVec2(0, 1),
ImVec2(1, 0),
+4 -10
View File
@@ -23,12 +23,6 @@ void EditorRenderSystem::Update(double dt)
scene.Camera = m_EditorCamera;
scene.Viewport = Rectangle(1920, 1080);
auto cSceneLight = m_World->GetComponents("SceneLight");
if (cSceneLight != nullptr) {
//these are hardcoded since they want special light treatment and a component just for widgets is stupid.
scene.AmbientColor = glm::vec4(0.8, 0.8, 0.8, 1.0);
}
auto models = m_World->GetComponents("Model");
if (models != nullptr) {
for (auto& cModel : *models) {
@@ -55,7 +49,7 @@ void EditorRenderSystem::Update(double dt)
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
for (auto matGroup : model->MaterialGroups()) {
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f);
if (cModel["Transparent"]) {
if(cModel["Transparent"]) {
scene.TransparentObjects.push_back(modelJob);
} else {
scene.OpaqueObjects.push_back(modelJob);
@@ -86,9 +80,9 @@ bool EditorRenderSystem::OnSetCamera(Events::SetCamera& e)
{
ComponentWrapper cTransform = e.CameraEntity["Transform"];
ComponentWrapper cCamera = e.CameraEntity["Camera"];
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->SetFOV((double)cCamera["FOV"]);
m_EditorCamera->SetNearClip((double)cCamera["NearClip"]);
m_EditorCamera->SetFarClip((double)cCamera["FarClip"]);
m_EditorCamera->SetPosition(cTransform["Position"]);
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
m_CurrentCamera = e.CameraEntity;
+2 -2
View File
@@ -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 *= static_cast<float>(e.DeltaX);
ic.Value *= 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 *= static_cast<float>(e.DeltaY);
ic.Value *= e.DeltaY;
m_InputProxy->Publish(ic);
}
}
+2 -2
View File
@@ -81,7 +81,7 @@ void DrawBloomPass::Draw(GLuint texture)
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
//Iterate some times to make it more gaussian.
for (int i = 1; i < m_iterations; i++) {
for (int i = 1; i < (int)m_iterations; i++) {
//Vertical pass
m_GaussianFrameBuffer_vert.Bind();
m_GaussianProgram_vert->Bind();
@@ -129,6 +129,6 @@ void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum fil
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, (GLsizei)dimensions.x, (GLsizei)dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
@@ -5,8 +5,7 @@ DrawColorCorrectionPass::DrawColorCorrectionPass(IRenderer* renderer)
m_Renderer = renderer;
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
//m_Exposure = 0.4; //TODO: Renderer: Fixa så att denna går att ändra på genom komponent eller setting.
m_Exposure = 0.4; //TODO: Renderer: Fixa så att denna går att ändra på genom komponent eller setting.
InitializeShaderPrograms();
}
@@ -20,16 +19,15 @@ void DrawColorCorrectionPass::InitializeShaderPrograms()
m_ColorCorrectionProgram->Link();
}
void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure)
void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture)
{
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERROR("DrawScreenQuadPass::Draw: Pre");
DrawScreenQuadPassState state = DrawScreenQuadPassState();
m_ColorCorrectionProgram->Bind();
//glClear(GL_COLOR_BUFFER_BIT);
glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Exposure"), exposure);
glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Gamma"), gamma);
glClear(GL_COLOR_BUFFER_BIT);
glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Exposure"), m_Exposure);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, sceneTexture);
+19 -71
View File
@@ -44,7 +44,6 @@ void DrawFinalPass::InitializeShaderPrograms()
m_ForwardPlusProgram->BindFragDataLocation(0, "sceneColor");
m_ForwardPlusProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusProgram->Link();
GLERROR("Creating forward+ program");
m_ExplosionEffectProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectProgram");
m_ExplosionEffectProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
@@ -54,12 +53,11 @@ void DrawFinalPass::InitializeShaderPrograms()
m_ExplosionEffectProgram->BindFragDataLocation(0, "sceneColor");
m_ExplosionEffectProgram->BindFragDataLocation(1, "bloomColor");
m_ExplosionEffectProgram->Link();
GLERROR("Creating explosion program");
}
void DrawFinalPass::Draw(RenderScene& scene)
{
GLERROR("Pre");
GLERROR("DrawFinalPass::Draw: Pre");
DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
if (scene.ClearDepth) {
@@ -67,12 +65,12 @@ void DrawFinalPass::Draw(RenderScene& scene)
}
DrawModelRenderQueues(scene.OpaqueObjects, scene);
GLERROR("OpaqueObjects");
GLERROR("DrawFinalPass::Draw: OpaqueObjects");
DrawModelRenderQueues(scene.TransparentObjects, scene);
GLERROR("TransparentObjects");
GLERROR("DrawFinalPass::Draw: TransparentObjects");
GLERROR("DrawFinalPass::Draw: END");
delete state;
GLERROR("END");
}
@@ -92,7 +90,7 @@ void DrawFinalPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum fil
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, (GLsizei)dimensions.x, (GLsizei)dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
@@ -100,8 +98,8 @@ void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm:
{
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexStorage2D(GL_TEXTURE_2D, numMipMaps, GL_RGBA8, dimensions.x, dimensions.y);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dimensions.x, dimensions.y, format, type, texture);
glTexStorage2D(GL_TEXTURE_2D, numMipMaps, GL_RGBA8, (GLsizei)dimensions.x, (GLsizei)dimensions.y);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (GLsizei)dimensions.x, (GLsizei)dimensions.y, format, type, texture);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
@@ -113,9 +111,7 @@ void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm:
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& job, RenderScene& scene)
{
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
GLERROR("forwardHandle");
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
GLERROR("explosionHandle");
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO());
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO());
@@ -126,53 +122,32 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
if(explosionEffectJob) {
//Bind program
if(GLERROR("Prebind")) {
continue;
}
m_ExplosionEffectProgram->Bind();
if(GLERROR("BindProgram")) {
continue;
}
glDisable(GL_CULL_FACE);
//Bind uniforms
BindExplosionUniforms(explosionHandle, explosionEffectJob, scene);
if(GLERROR("BindExplosionUniforms")) {
continue;
}
if (explosionEffectJob->Model->m_RawModel->m_Skeleton != nullptr) {
if (explosionEffectJob->Animation != nullptr) {
std::vector<glm::mat4> frameBones = explosionEffectJob->Skeleton->GetFrameBones(*explosionEffectJob->Animation, explosionEffectJob->AnimationTime);
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), (GLsizei)frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
}
if(GLERROR("Animation")) {
continue;
}
//bind textures
BindExplosionTextures(explosionEffectJob);
if(GLERROR("BindExplosionTextures")) {
continue;
}
//draw
glBindVertexArray(explosionEffectJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int)));
glEnable(GL_CULL_FACE);
if(GLERROR("explosion effect end")) {
continue;
}
} else {
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
if (modelJob) {
//bind forward program
m_ForwardPlusProgram->Bind();
glUniform2f(glGetUniformLocation(forwardHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glUniform2f(glGetUniformLocation(forwardHandle, "ScreenDimensions"), (GLfloat)m_Renderer->GetViewportSize().Width, (GLfloat)m_Renderer->GetViewportSize().Height);
//bind uniforms
BindModelUniforms(forwardHandle, modelJob, scene);
@@ -184,7 +159,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
if (modelJob->Animation != nullptr) {
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), (GLsizei)frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
}
@@ -192,9 +167,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
glBindVertexArray(modelJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int)));
if(GLERROR("models end")) {
continue;
}
GLERROR("DrawFinalPass::Model: END");
}
}
}
@@ -203,46 +176,36 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene)
{
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), (GLfloat)m_Renderer->Resolution().Width, (GLfloat)m_Renderer->Resolution().Height);
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix));
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration);
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), (GLfloat)job->TimeSinceDeath);
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), (GLfloat)job->ExplosionDuration);
glUniform4fv(glGetUniformLocation(shaderHandle, "EndColor"), 1, glm::value_ptr(job->EndColor));
glUniform1i(glGetUniformLocation(shaderHandle, "Randomness"), job->Randomness);
glUniform1fv(glGetUniformLocation(shaderHandle, "RandomNumbers"), 50, job->RandomNumbers.data());
glUniform1f(glGetUniformLocation(shaderHandle, "RandomnessScalar"), job->RandomnessScalar);
glUniform2fv(glGetUniformLocation(shaderHandle, "Velocity"), 1, glm::value_ptr(job->Velocity));
glUniform1i(glGetUniformLocation(shaderHandle, "ColorByDistance"), job->ColorByDistance);
glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration);
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(job->DiffuseColor));
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor));
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage);
glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor));
GLERROR("END");
glUniform1fv(glGetUniformLocation(shaderHandle, "RandomNumbers"), 50, job->RandomNumbers.data());
}
void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene)
{
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), (GLfloat)m_Renderer->Resolution().Width, (GLfloat)m_Renderer->Resolution().Height);
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix));
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(job->DiffuseColor));
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor));
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage);
glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor));
GLERROR("END");
}
@@ -254,22 +217,7 @@ void DrawFinalPass::BindExplosionTextures(std::shared_ptr<ExplosionEffectJob>& j
} else {
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
}
glActiveTexture(GL_TEXTURE1);
if (job->NormalTexture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->NormalTexture->m_Texture);
} else {
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
}
glActiveTexture(GL_TEXTURE2);
if (job->SpecularTexture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture->m_Texture);
} else {
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
}
glActiveTexture(GL_TEXTURE3);
if (job->IncandescenceTexture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture->m_Texture);
} else {
+8 -1
View File
@@ -54,6 +54,13 @@ void FrameBuffer::Generate()
case GL_RENDERBUFFER:
glFramebufferRenderbuffer(GL_FRAMEBUFFER, (*it)->m_Attachment, (*it)->m_ResourceType, *(*it)->m_ResourceHandle);
GLERROR("FrameBuffer generate: glFramebufferRenderbuffer");
if ( (*it)->m_Attachment != GL_COLOR_ATTACHMENT0 ||
(*it)->m_Attachment != GL_COLOR_ATTACHMENT1 ||
(*it)->m_Attachment != GL_DEPTH_ATTACHMENT ||
(*it)->m_Attachment != GL_STENCIL_ATTACHMENT) //TODO: Viktor: Fixa detta
{
LOG_ERROR("RenderBuffer Attachment not valid.");
}
break;
}
@@ -64,7 +71,7 @@ void FrameBuffer::Generate()
}
GLenum* bufferTextures = &attachments[0];
glDrawBuffers(attachments.size(), bufferTextures);
glDrawBuffers((GLsizei)attachments.size(), bufferTextures);
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
LOG_ERROR("FrameBuffer incomplete: 0x%x\n", frameBufferStatus);
+4 -4
View File
@@ -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 = static_cast<float>(e.X);
io.MousePos.y = static_cast<float>(e.Y);
io.MousePos.x = e.X;
io.MousePos.y = 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 = reinterpret_cast<void*>(g_FontTexture);
io.Fonts->TexID = (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 = static_cast<float>(g_DeltaTime);
io.DeltaTime = 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);
+3 -3
View File
@@ -25,7 +25,7 @@ void LightCullingPass::GenerateNewFrustum(RenderScene& scene)
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
glUniformMatrix4fv(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "P"), 1, false, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniform2f(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glUniform2f(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "ScreenDimensions"), (GLfloat)m_Renderer->GetViewportSize().Width, (GLfloat)m_Renderer->GetViewportSize().Height);
glDispatchCompute((int)(m_Renderer->GetViewportSize().Width/(TILE_SIZE*TILE_SIZE) + 1), (int)(m_Renderer->GetViewportSize().Height/(TILE_SIZE*TILE_SIZE) + 1), 1);
GLERROR("CalculateFrustum Error: End");
@@ -67,14 +67,14 @@ void LightCullingPass::CullLights(RenderScene& scene)
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
m_LightCullProgram->Bind();
glUniform2f(glGetUniformLocation(m_LightCullProgram->GetHandle(), "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glUniform2f(glGetUniformLocation(m_LightCullProgram->GetHandle(), "ScreenDimensions"), (GLfloat)m_Renderer->GetViewportSize().Width, (GLfloat)m_Renderer->GetViewportSize().Height);
glUniformMatrix4fv(glGetUniformLocation(m_LightCullProgram->GetHandle(), "V"), 1, false, glm::value_ptr(scene.Camera->ViewMatrix()));
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightSSBO);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightGridSSBO);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, m_LightOffsetSSBO);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightIndexSSBO);
glDispatchCompute(glm::ceil(m_Renderer->GetViewportSize().Width/ TILE_SIZE), glm::ceil(m_Renderer->GetViewportSize().Height / TILE_SIZE), 1);
glDispatchCompute(glm::ceil((GLuint)m_Renderer->GetViewportSize().Width/ TILE_SIZE), glm::ceil((GLuint)m_Renderer->GetViewportSize().Height / TILE_SIZE), 1);
GLERROR("CullLights Error: End");
}
+2 -2
View File
@@ -71,12 +71,12 @@ PNG::PNG(std::string path)
png_read_update_info(png_ptr, info_ptr);
}
std::size_t row_bytes = png_get_rowbytes(png_ptr, info_ptr);
unsigned int 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 (unsigned int i = 0; i < height; ++i) {
for (int i = 0; i < height; ++i) {
// Invert Y for OpenGL
row_pointers[height - 1 - i] = this->Data + i * row_bytes;
}
+7 -7
View File
@@ -75,9 +75,9 @@ void PickingPass::Draw(RenderScene& scene)
m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]);
if (m_ColorCounter[0] > 255) {
m_ColorCounter[0] = 0;
m_ColorCounter[1] += 1;
m_ColorCounter[1] += 5;
} else {
m_ColorCounter[0] += 1;
m_ColorCounter[0] += 50;
}
}
@@ -92,7 +92,7 @@ void PickingPass::Draw(RenderScene& scene)
if (modelJob->Animation != nullptr) {
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), (GLsizei)frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
}
@@ -121,9 +121,9 @@ void PickingPass::Draw(RenderScene& scene)
m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]);
if (m_ColorCounter[0] > 255) {
m_ColorCounter[0] = 0;
m_ColorCounter[1] += 1;
m_ColorCounter[1] += 5;
} else {
m_ColorCounter[0] += 1;
m_ColorCounter[0] += 50;
}
}
@@ -138,7 +138,7 @@ void PickingPass::Draw(RenderScene& scene)
if (modelJob->Animation != nullptr) {
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), (GLsizei)frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
}
@@ -208,6 +208,6 @@ void PickingPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filte
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, (GLsizei)dimensions.x, (GLsizei)dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
+24 -25
View File
@@ -22,42 +22,42 @@ void RawModelCustom::ReadMeshFile(std::string filePath)
if (!in.is_open()) {
throw Resource::FailedLoadingException("Open mesh file failed");
}
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
unsigned int fileByteSize = in.tellg();
in.seekg(0, std::ios_base::beg);
fileData = new char[fileByteSize];
in.read(fileData, fileByteSize);
in.close();
std::size_t offset = 0;
unsigned int offset = 0;
if (fileByteSize > 0) {
ReadMeshFileHeader(offset, fileData);
ReadMeshFileHeader(offset, fileData, fileByteSize);
ReadMesh(offset, fileData, fileByteSize);
}
delete fileData;
}
void RawModelCustom::ReadMeshFileHeader(std::size_t& offset, char* fileData)
void RawModelCustom::ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
{
#ifdef BOOST_LITTLE_ENDIAN
m_Vertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
m_Vertices.resize(*(unsigned int*)(fileData + offset));
offset += sizeof(unsigned int);
m_Indices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
m_Indices.resize(*(unsigned int*)(fileData + offset));
offset += sizeof(unsigned int);
#else
#endif
}
void RawModelCustom::ReadMesh(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadMesh(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
{
ReadVertices(offset, fileData, fileByteSize);
ReadIndices(offset, fileData, fileByteSize);
}
void RawModelCustom::ReadVertices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, 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(std::size_t& offset, char* fileData, const uns
#endif
}
void RawModelCustom::ReadIndices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadIndices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
{
#ifdef BOOST_LITTLE_ENDIAN
if (offset + m_Indices.size() * sizeof(unsigned int) > fileByteSize) {
@@ -90,36 +90,35 @@ void RawModelCustom::ReadMaterialFile(std::string filePath)
if (!in.is_open()) {
throw Resource::FailedLoadingException("Open material file failed");
}
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
unsigned int fileByteSize = in.tellg();
in.seekg(0, std::ios_base::beg);
fileData = new char[fileByteSize];
in.read(fileData, fileByteSize);
in.close();
std::size_t offset = 0;
unsigned int offset = 0;
if (fileByteSize > 0) {
ReadMaterials(offset, fileData, fileByteSize);
}
delete fileData;
}
void RawModelCustom::ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadMaterials(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
{
#ifdef BOOST_LITTLE_ENDIAN
unsigned int* numMaterials = (unsigned int*)(fileData);
MaterialGroups.reserve(*numMaterials);
offset += sizeof(unsigned int);
for (unsigned int i = 0; i < *numMaterials; i++) {
for (int i = 0; i < *numMaterials; i++) {
ReadMaterialSingle(offset, fileData, fileByteSize);
}
#else
#endif
}
void RawModelCustom::ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadMaterialSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
{
MaterialGroup newMaterial;
@@ -211,14 +210,14 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
return;
}
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
unsigned int fileByteSize = in.tellg();
in.seekg(0, std::ios_base::beg);
fileData = new char[fileByteSize];
in.read(fileData, fileByteSize);
in.close();
std::size_t offset = 0;
unsigned int offset = 0;
if (fileByteSize > 0) {
m_Skeleton = new Skeleton();
@@ -236,7 +235,7 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
delete fileData;
}
void RawModelCustom::ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadAnimationBindPoses(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
{
#ifdef BOOST_LITTLE_ENDIAN
unsigned int* numBones = (unsigned int*)(fileData + offset);
@@ -249,7 +248,7 @@ void RawModelCustom::ReadAnimationBindPoses(std::size_t& offset, char* fileData,
#endif
}
void RawModelCustom::ReadAnimationJoint(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
void RawModelCustom::ReadAnimationJoint(unsigned int &offset, char* fileData, unsigned int& fileByteSize)
{
#ifdef BOOST_LITTLE_ENDIAN
if (offset + sizeof(unsigned int) > fileByteSize) {
@@ -291,14 +290,14 @@ void RawModelCustom::ReadAnimationJoint(std::size_t& offset, char* fileData, con
#endif
}
void RawModelCustom::ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips)
void RawModelCustom::ReadAnimationClips(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int numberOfClips)
{
for (unsigned int i = 0; i < numberOfClips; i++) {
ReadAnimationClipSingle(offset, fileData, fileByteSize, i);
}
}
void RawModelCustom::ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex)
void RawModelCustom::ReadAnimationClipSingle(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int clipIndex)
{
#ifdef BOOST_LITTLE_ENDIAN
Skeleton::Animation newAnimation;
@@ -343,7 +342,7 @@ void RawModelCustom::ReadAnimationClipSingle(std::size_t& offset, char* fileData
#endif
}
void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation)
void RawModelCustom::ReadAnimationKeyFrame(unsigned int &offset, char* fileData, unsigned int& fileByteSize, unsigned int nrOfJoints, Skeleton::Animation& animation)
{
Skeleton::Animation::Keyframe newKeyFrame;
@@ -359,12 +358,12 @@ void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData,
newKeyFrame.Time = *(float*)(fileData + offset);
offset += sizeof(float);
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * numberOfJoints> fileByteSize) {
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * nrOfJoints> fileByteSize) {
throw Resource::FailedLoadingException("Reading AnimationKeyFrame joints failed");
}
Skeleton::Animation::Keyframe::BoneProperty newBone;
for (unsigned int i = 0; i < numberOfJoints; i++) {
for (unsigned int i = 0; i < nrOfJoints; i++) {
memcpy(&newBone, (fileData + offset), sizeof(Skeleton::Animation::Keyframe::BoneProperty));
offset += sizeof(Skeleton::Animation::Keyframe::BoneProperty);
newKeyFrame.BoneProperties[newBone.ID] = newBone;
+4 -11
View File
@@ -22,9 +22,9 @@ bool RenderSystem::OnSetCamera(Events::SetCamera& e)
{
ComponentWrapper cTransform = e.CameraEntity["Transform"];
ComponentWrapper cCamera = e.CameraEntity["Camera"];
m_Camera->SetFOV((double)cCamera["FOV"]);
m_Camera->SetNearClip((double)cCamera["NearClip"]);
m_Camera->SetFarClip((double)cCamera["FarClip"]);
m_Camera->SetFOV((float)cCamera["FOV"]);
m_Camera->SetNearClip((float)cCamera["NearClip"]);
m_Camera->SetFarClip((float)cCamera["FarClip"]);
m_Camera->SetPosition(cTransform["Position"]);
m_Camera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
m_CurrentCamera = e.CameraEntity;
@@ -240,17 +240,10 @@ void RenderSystem::Update(double dt)
m_Camera->SetOrientation(Transform::AbsoluteOrientation(m_CurrentCamera));
}
RenderScene scene;
scene.Camera = m_Camera;
scene.Viewport = Rectangle(1280, 720);
auto cSceneLight = m_World->GetComponents("SceneLight");
if (cSceneLight != nullptr && cSceneLight->begin() != cSceneLight->end()) {
m_RenderFrame->Gamma = (double)(*cSceneLight->begin())["Gamma"];
m_RenderFrame->Exposure = (double)(*cSceneLight->begin())["Exposure"];
scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"];
}
fillModels(scene.OpaqueObjects, scene.TransparentObjects);
fillPointLights(scene.PointLightJobs, m_World);
fillDirectionalLights(scene.DirectionalLightJobs, m_World);
+3 -3
View File
@@ -119,8 +119,8 @@ void Renderer::Draw(RenderFrame& frame)
}
m_DrawBloomPass->Draw(m_DrawFinalPass->BloomTexture());
if (m_DebugTextureToDraw == 0) {
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), frame.Gamma, frame.Exposure);
if(m_DebugTextureToDraw == 0) {
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture());
}
if (m_DebugTextureToDraw == 1) {
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->SceneTexture());
@@ -165,7 +165,7 @@ void Renderer::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filterin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, (GLsizei)dimensions.x, (GLsizei)dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
+1 -1
View File
@@ -21,7 +21,7 @@ GLuint Shader::CompileShader(GLenum shaderType, std::string fileName)
return 0;
const GLchar* shaderFiles = shaderFile.c_str();
const GLint length = static_cast<GLint>(shaderFile.length());
const GLint length = shaderFile.length();
glShaderSource(shader, 1, &shaderFiles, &length);
if (GLERROR("glShaderSource"))
return 0;
+2 -2
View File
@@ -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()];
double alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
float alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
//auto animationFrame = Animations[""].Keyframes[frame];
std::map<int, glm::mat4> frameBones;
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, static_cast<float>(alpha), frameBones, RootBone, glm::mat4(1));
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, alpha, frameBones, RootBone, glm::mat4(1));
std::vector<glm::mat4> finalMatrices;
for (auto &kv : frameBones) {
+1 -5
View File
@@ -116,11 +116,7 @@ void SoundSystem::updateEmitters(double dt)
setSourcePos(it->second->ALsource, nextPos);
setSourceVel(it->second->ALsource, velocity);
float gain;
if (it->second->Type == SoundType::SFX) {
gain = m_SFXVolumeChannel;
} else if (it->second->Type == SoundType::BGM) {
gain = m_BGMVolumeChannel;
}
(bool)(it->second->Type) ? gain = m_SFXVolumeChannel : gain = m_BGMVolumeChannel;
auto emitter = m_World->GetComponent(it->first, "SoundEmitter");
setSoundProperties(it->second->ALsource, &emitter);
+2 -5
View File
@@ -74,7 +74,6 @@ 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);
@@ -93,15 +92,14 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
// Populate Octree with collidables
++updateOrderLevel;
m_SystemPipeline->AddSystem<CollidableOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
m_SystemPipeline->AddSystem<CollidableOctreeSystem>(updateOrderLevel, m_OctreeTrigger, "Player");
m_SystemPipeline->AddSystem<CollidableOctreeSystem>(updateOrderLevel, m_OctreeCollision);
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_OctreeTrigger);
m_SystemPipeline->AddSystem<TriggerSystem>(updateOrderLevel, m_OctreeCollision);
++updateOrderLevel;
m_SystemPipeline->AddSystem<RenderSystem>(updateOrderLevel, m_Renderer, m_RenderFrame);
++updateOrderLevel;
@@ -125,7 +123,6 @@ Game::~Game()
delete m_SoundSystem;
delete m_OctreeFrustrumCulling;
delete m_OctreeCollision;
delete m_OctreeTrigger;
delete m_World;
delete m_FrameStack;
delete m_InputProxy;
+3 -4
View File
@@ -64,9 +64,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
std::map<std::string, int> nextPossibleCapturePoint;
nextPossibleCapturePoint["Red"] = -1;
nextPossibleCapturePoint["Blue"] = -1;
for (int i = 0; i < m_NumberOfCapturePoints; i++)
for (size_t 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 (int i = 0; i < m_NumberOfCapturePoints; i++)
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
{
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
@@ -119,7 +119,6 @@ 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);
+1 -7
View File
@@ -76,13 +76,7 @@ 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 || !controller->DoubleJumping())) {
if (velocity.y == 0.f) {
controller->SetDoubleJumping(false);
}
else {
controller->SetDoubleJumping(true);
}
if (controller->Jumping() && !controller->Crouching() && velocity.y == 0.f) {
velocity.y += 4.f;
}
+1 -1
View File
@@ -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, static_cast<int>(std::distance(spawnPoints.begin(), spawnPoints.end())) - 1);
std::uniform_int_distribution<> distribution(0, std::distance(spawnPoints.begin(), spawnPoints.end()) - 1);
auto randomSpawnPointIt = spawnPoints.begin();
std::advance(randomSpawnPointIt, distribution(randomGenerator));
spawnPoint = *randomSpawnPointIt;