Compare commits

...

123 Commits

Author SHA1 Message Date
Tleety b81f2b3240 WIP Bloom 2016-02-10 15:00:12 +01:00
Tleety 03d77beff9 MipMapping all textures 2016-02-10 10:46:27 +01:00
Tleety 64e7bb1e94 Good looking blur, need some fixes, but framerates takes a huge hit. 2016-02-09 16:19:17 +01:00
Tleety a33cd42ca3 WIP 2016-02-08 17:53:31 +01:00
Tleety 9055d5f697 Bugfix 2016-02-08 15:22:28 +01:00
Tleety 971beb29d8 Merge remote-tracking branch 'origin/master' into DefenderShield
# Conflicts:
#	resources/Schema/Components.xsd
2016-02-08 12:30:41 +01:00
Tleety 2ee21e05d4 Fixed so that Shielded objects can be picked. Shield objects can not however, so they will not be able to be picked in editor either. 2016-02-08 12:29:41 +01:00
William Moberg 5987751add Merge pull request #81 from teamfisk/HealthPickup
Health pickup
2016-02-08 11:50:47 +01:00
Tleety 94b59af973 Defender shield should now be working 2016-02-08 11:47:35 +01:00
Jace 70f8237a16 Merge pull request #60 from teamfisk/3rdPersonDeathCam
3rd person death cam
2016-02-08 11:39:57 +01:00
Jace 99cbdd3c1e Player death effect fixes 2016-02-08 11:39:29 +01:00
verysecrethero ce22854168 HealthPickups are now based on a percentage of player maxhealth. You can no longer pickup healthpacks if you are at max health. You can no longer gain more than maxHealth. 2016-02-08 11:22:28 +01:00
Jace 35b0193f15 Merge pull request #72 from teamfisk/BoxModelCollision
Collision in test phase
2016-02-08 10:29:41 +01:00
verysecrethero f8e514d21e Merge remote-tracking branch 'origin/master' into HealthPickup 2016-02-08 10:22:35 +01:00
verysecrethero fad25c6e16 Merge remote-tracking branch 'origin/master' into 3rdPersonDeathCam
# Conflicts:
#	include/Engine/Core/EPlayerHealthPickup.h
2016-02-08 10:21:30 +01:00
verysecrethero 4103c878ec Refactoring: Changed HealthPickupSystem to use a struct instead. Removed the Id in EPickupSpawned 2016-02-05 18:05:46 +01:00
William Moberg 40788c7400 Merge pull request #80 from teamfisk/DashFixBranch
Miscellaneous small fixes: For Tests, CapturePoint xml file, HealthSy…
2016-02-05 18:04:15 +01:00
William Moberg 59bdc614f2 Put SpecialAbility on left shift, and Sprint on left shift in DefaultInput. 2016-02-05 17:34:19 +01:00
verysecrethero be628d9406 Merge remote-tracking branch 'origin/master' into HealthPickup
# Conflicts:
#	resources/Schema/Components.xsd
2016-02-05 16:23:22 +01:00
verysecrethero 66f442f1af Added HealthGain to HealthPickup component. Changed PickupSpawnSystem so it copies the values from the old to the new entity. 2016-02-05 16:13:59 +01:00
verysecrethero 2542397511 Miscellaneous small fixes: For Tests, CapturePoint xml file, HealthSystem, DashAbility xml file. 2016-02-05 15:35:51 +01:00
William Moberg 7641ba49c7 Weapon doesn't explode in first person. 2016-02-05 15:16:24 +01:00
verysecrethero fe6fd0bbe3 PickupSpawnSystem now spawns a new HealthPickup after the respawnTimer is up. Added HealthPickup.xml entity. Event PickupSpawned now gets published when a new HealthPickup spawns. Player now gains health as he picks up the HealthPickup. 2016-02-05 15:15:04 +01:00
William Moberg e3a44d37d2 Merge branch 'master' into BoxModelCollision
# Conflicts:
#	src/Game/Systems/PlayerMovementSystem.cpp
2016-02-05 14:59:14 +01:00
William Moberg 428dca003d Tiny bug fix. 2016-02-05 14:40:50 +01:00
William Moberg 4fe9e4f1c3 Debug cleanup and some bug fixes. 2016-02-05 14:38:08 +01:00
William Moberg d61e605093 Can walk up "stair-steps". Cleanup WIP.
Better performance in RectanglevsTriangle check.
Added IsOnGround flag and VerticalStepHeight in Physics.
Lotsa commented code saved for historical reasons, remove later.
2016-02-05 10:56:34 +01:00
Tleety c526a7af55 WIP stencil stuff 2016-02-04 17:58:36 +01:00
verysecrethero 6a23a987b3 Started PickupSpawnSystem, added 2 events and a system 2016-02-04 17:43:45 +01:00
Tleety 7c582898f4 Working stencil buffer for the shield. 2016-02-04 14:33:39 +01:00
Jace ff26e1235c Merge pull request #77 from teamfisk/AMDCrashFix
AMD crash fix???????????
2016-02-04 12:05:05 +01:00
Jace 6990e473b3 Adding a clear here makes AMD drivers NOT crash for some reason. We're fixing the symptom but not the underlying cause. 2016-02-04 11:53:35 +01:00
Jace c87e4d4fd6 Added mutex to resource manager cache reading to avoid a potential race condition. We hope this is the actual bug we saw. 2016-02-04 11:53:11 +01:00
verysecrethero d4292d4b43 Merge pull request #63 from teamfisk/AssaultDash
Added AssaultDash
2016-02-04 11:50:00 +01:00
verysecrethero 035c79564b Changed Dash name to DashAbility. Fixed dash bug where you could do two different keys to dash. 2016-02-04 11:41:21 +01:00
Tleety 379d211832 some fixes with the stencil states and implemented stencil func/stencilop/stencilmask to renderstate 2016-02-04 11:13:26 +01:00
verysecrethero 03a16b46b5 Dash component now has the dash-maxCoolDownVariable in it. 2016-02-04 10:28:28 +01:00
verysecrethero 0bbaf1d576 Oops! Removed DebugCode... 2016-02-04 10:04:44 +01:00
Tleety bc01e147c2 Some state stuff, some draw stuff, some QA map stuff 2016-02-03 18:09:44 +01:00
verysecrethero 1bd4aa91ff Oops! Readded "Sprint" command. Removed some unnecessary variables in FirstPersonInputController. Fixed bug where you couldnt dash right away as the game started. 2016-02-03 17:45:37 +01:00
verysecrethero 7b5a2a5388 Dashing now works great both with shift and doubletap. Added Dash Component. Changed default Player.xml to have a Dash Component. Disabled Sprint. You can now disable DoubleTapToDash in Input.Ini. Added command "SpecialAbility". 2016-02-03 17:30:46 +01:00
Jace bd2da7bc9f Revert "Revert "Merge pull request #75 from teamfisk/NormalSpecularMapping""
This reverts commit b56824786c.
2016-02-03 16:30:00 +01:00
Jace b56824786c Revert "Merge pull request #75 from teamfisk/NormalSpecularMapping"
This reverts commit 192de80782, reversing
changes made to 24aac6a00d.
2016-02-03 16:16:06 +01:00
verysecrethero 13161b4f57 Merge remote-tracking branch 'origin/master' into AssaultDash 2016-02-03 15:07:19 +01:00
Tleety 5665c0f298 Models with Shield and shielded component now added to queues 2016-02-03 14:20:47 +01:00
Tleety 7ffbd8455f Added Queues for the models with shield and shielded components. 2016-02-03 13:53:57 +01:00
Tleety 83713b3b6d Renamde ShieldComponent since Component should not be in the name. Added Shielded component that will be put on objects that should be hidden behind shields. 2016-02-03 13:27:46 +01:00
Tleety 7bae2d0873 Added a ShieldComponent and a test area in QA map for defender shield 2016-02-03 11:58:06 +01:00
verysecrethero 9d3171540d AssaultDashCheck is now in FirstPersonInputController instead. TODO: config option, shift button, forward/backward dash 2016-02-03 11:54:14 +01:00
verysecrethero 2391a0dbe9 Merge remote-tracking branch 'origin/master' into AssaultDash 2016-02-03 11:51:26 +01:00
verysecrethero 2961f198b3 PlayerDeathSystem is now working well. Changed so the model is oriented correctly. Changed so camera is behind the player. Copied the current animation and froze it. 2016-02-03 11:48:22 +01:00
Tleety 455e59a04f Made the TEMPORARY capture point boxes transparent. 2016-02-03 11:39:18 +01:00
verysecrethero 39653a1e4c Merge remote-tracking branch 'origin/master' into 3rdPersonDeathCam 2016-02-03 10:38:21 +01:00
Jace 2cbeef4c69 Merge pull request #74 from teamfisk/Warnings-Jocke
Fixed warnings associated with Network
2016-02-03 10:37:10 +01:00
Jace 192de80782 Merge pull request #75 from teamfisk/NormalSpecularMapping
Normal specular mapping
2016-02-03 10:34:22 +01:00
Tleety 51a588657e QA map change 2016-02-03 10:11:53 +01:00
verysecrethero 73ab9bb4c6 Merge remote-tracking branch 'origin/master' into AssaultDash
# Conflicts:
#	src/Game/Systems/PlayerMovementSystem.cpp
2016-02-03 09:52:54 +01:00
Tleety 73716c28e2 pickpass fix 2016-02-02 17:40:22 +01:00
Tleety a3b7bd7df5 Fix in picking pass, QA map fix. Blue and red ray change. Player weapon change. 2016-02-02 17:39:57 +01:00
William Moberg c4fb604617 Merge branch 'BoxModelCollision' of github.com:teamfisk/TacticalZ into BoxModelCollision 2016-02-02 17:36:50 +01:00
William Moberg 214dad2afc Removed commented code. 2016-02-02 17:25:59 +01:00
William Moberg affcc5305b Collision affects velocity correctly, no wierd ice cream sliding along walls. 2016-02-02 17:19:59 +01:00
Tleety 11025b5466 QA-map stuff 2016-02-02 17:19:58 +01:00
verysecrethero 5e472cd69c DeathExplosion is now an XML file, changed PlayerDeathSystem accordingly. The effect should show as soon as the explosioneffect-fix is merged into master. TODO: remove the test 2016-02-02 17:18:12 +01:00
Tleety eba36b8492 Some QA-map fixes 2016-02-02 17:12:14 +01:00
Tleety 55854f5c0d Merge remote-tracking branch 'origin/master' into NormalSpecularMapping 2016-02-02 16:30:57 +01:00
Tleety 12a181c1ff Fixed a bug where normals scaled with model scale. Again. 2016-02-02 16:11:03 +01:00
Tleety b131f56f5e Made a quality assurance world that will need to be used before creating a pull request 2016-02-02 16:06:42 +01:00
Jace 24aac6a00d Merge pull request #62 from teamfisk/DoubleJump
You can now DoubleJump!
2016-02-02 15:31:03 +01:00
verysecrethero 7236da09b4 Merge remote-tracking branch 'origin/master' into 3rdPersonDeathCam 2016-02-02 15:13:00 +01:00
verysecrethero 45a92b362f DoubleJumping now in InputController instead. 2016-02-02 15:10:11 +01:00
verysecrethero 2085d9ec9e Merge remote-tracking branch 'origin/master' into DoubleJump 2016-02-02 14:22:00 +01:00
Jocke 6a3f585fb9 Fixed warnings associated with Network.cpp, Client.cpp, Server.cpp and Packet.cpp.
BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT': macro redefinition was fixed by https://svn.boost.org/trac/boost/ticket/11539
2016-02-02 13:26:15 +01:00
Tleety 7b4826cb44 Merge remote-tracking branch 'origin/master' into NormalSpecularMapping 2016-02-02 13:24:31 +01:00
Tleety 28d412f5c7 Some small changes to test world and assets 2016-02-02 13:24:18 +01:00
Jace 0e5f6da9a9 Merge pull request #73 from teamfisk/CapturePointFixBranch
Several changes/fixes based on the latest broken refactoring in master
2016-02-02 13:22:03 +01:00
Jace 563fd4082e Updated movement test for model collisions 2016-02-02 12:10:39 +01:00
verysecrethero 42b52a6766 Several changes/fixes based on the latest broken refactoring.
Fixed Simon's mistake in CapturePointLogic. William fixed so TriggerSystem works again with CapturePoints.
2016-02-02 11:37:22 +01:00
Tleety 9c2e459e0c Deatheffect color now correctly calculated 2016-02-02 10:58:00 +01:00
William Moberg 796e3eac79 Merge branch 'master' into BoxModelCollision 2016-02-02 10:16:48 +01:00
Tleety 8299b99e2f Test world changes and some other small fixes 2016-02-01 19:08:46 +01:00
Tleety c708f1582c Merge remote-tracking branch 'origin/master' into NormalSpecularMapping 2016-02-01 18:30:30 +01:00
Tleety 782c1a388a Comment 2016-02-01 18:23:40 +01:00
Tleety a188a3f7fa Removed widget pointlight since it is now redundant 2016-02-01 18:22:36 +01:00
Tleety ed7d00c1d8 Bug where widgets did not get their ambient light now fixed. 2016-02-01 18:19:38 +01:00
William Moberg 30b1dab764 More efficient collision resolution case + comments. 2016-02-01 18:06:28 +01:00
Jace 9090be8acf Merge branch 'Warnings-Simon' 2016-02-01 17:53:55 +01:00
Jace a3d4eb65d5 Fixes #66 warnings 2016-02-01 17:53:01 +01:00
Jace 9b2a4be707 Merge pull request #71 from teamfisk/Warnings-Adam
Warnings adam
2016-02-01 17:52:18 +01:00
stiffly 5474a18753 #68 Fixed warning in SoundSystem.cpp 2016-02-01 17:15:51 +01:00
William Moberg 5a45f778e6 Fixed so players don't teleport to (NaN, NaN, NaN) on spawning. 2016-02-01 17:01:58 +01:00
Tleety 53cae25eb2 WIP on widget fuckery 2016-02-01 16:56:55 +01:00
William Moberg 30ad238697 Merge branch 'master' into BoxModelCollision 2016-02-01 16:17:10 +01:00
William Moberg 3cfbbbbf54 CollisionSystem now utilizes Octree for collision detection. 2016-02-01 16:13:48 +01:00
Adam Byléhn ca8b7cbee8 Merge pull request #65 from teamfisk/EditorUsefulness
Editor usefulness
2016-02-01 16:13:37 +01:00
William Moberg d7b02e79c8 Merge branch 'master' into BoxModelCollision
# Conflicts:
#	include/Engine/Collision/CollisionSystem.h
#	src/Engine/Collision/CollisionSystem.cpp
2016-02-01 13:48:05 +01:00
William Moberg 76274c326e Fixed going through flat large triangles. Velocity affected by collision. 2016-02-01 13:34:39 +01:00
Tleety 7054822be2 SceneLight component now working 2016-02-01 11:12:03 +01:00
verysecrethero 7987d4b27c Added AssaultDash and all its logic, including a doubletapkey. Doubletapkey could be made more generic. 2016-01-29 12:06:14 +01:00
verysecrethero 0c97ce7a4a You can now DoubleJump! 2016-01-29 10:12:49 +01:00
verysecrethero df05f1909b Completed the code to trigger the 3rd person camera on death. Cleaned up PlayerDeathSystem. Fixed HealthSystemTest. Removed the test for PlayerDeathSystem 2016-01-28 11:43:38 +01:00
Tleety 8bcafc1151 WIP 2016-01-27 18:07:05 +01:00
verysecrethero 7497ff39d2 Simon added Copy method to ComponentWrapper. Its being used in PlayerDeathSystem to copy model,animation,transform. TODO: 3rd person camera, cleanup, tests 2016-01-27 18:00:31 +01:00
Tleety 97cbc55223 Some debug features for color corrections and glow strength fix. 2016-01-27 17:21:00 +01:00
verysecrethero 5cdf6db340 Modified HealthSystem so it actually publishes the DeathEvent. Modified EPlayerHealthPickup. Fixed 2 tests. Started work on PlayerDeathSystem 2016-01-27 14:46:45 +01:00
William Moberg 90f05442aa Merge branch 'master' into BoxModelCollision
# Conflicts:
#	include/Engine/Core/Octree.h
#	resources/Schema/Entities/CollisionTestLevel.xml
#	src/Engine/Collision/CollisionSystem.cpp
#	src/Engine/Core/Octree.cpp
2016-01-27 10:52:27 +01:00
William Moberg 6ea490e215 Tried a horrible recursive method, extreme framedrop. 2016-01-27 10:34:26 +01:00
William Moberg 3389b965eb Test on game level v1. 2016-01-25 10:55:05 +01:00
William Moberg f1343e2f82 Collision may be working, kind of. 2016-01-24 21:08:42 +01:00
William Moberg c9dc9a3570 Merge branch 'master' into BoxModelCollision 2016-01-24 15:38:38 +01:00
William Moberg 910b3d10e4 WIP (false collisions), collision method expanded, not working. 2016-01-24 15:32:10 +01:00
William Moberg e6224a4e96 WIP (not working), attempt at separating axis theorem stuff. 2016-01-23 18:31:27 +01:00
William Moberg 6eeb3ea524 WIP, Bug fix + nitpicks + optimizations. 2016-01-23 17:50:35 +01:00
William Moberg 71404c8828 Special case for collision vs ground (upward facing) triangles. 2016-01-23 14:01:54 +01:00
William Moberg 3974c649ab WIP on ModelBoxCollision. Octree works in Release mode. 2016-01-23 10:45:50 +01:00
William Moberg 1670fb4e48 Moved triangle vs ray code to method. 2016-01-22 14:45:50 +01:00
William Moberg 3955e1d60c Can resolve collision when AABB corners cut through triangle.
At least two more cases left to resolve.
2016-01-22 13:46:09 +01:00
William Moberg d25804e6f8 Merge branch 'master' into BoxModelCollision 2016-01-22 11:24:19 +01:00
William Moberg 52765cc85b TriangleVsBox detection seems to work in all cases, but cannot resolve all cases yet.
Also added default ctor for Ray and removed compilation errors in CollisionSystem.
2016-01-22 11:22:56 +01:00
William Moberg d2984c6ae4 Merge branch 'master' into BoxModelCollision 2016-01-21 17:42:58 +01:00
William Moberg 9f6fa40448 Merge branch 'master' into BoxModelCollision
# Conflicts:
#	src/Engine/Collision/CollisionSystem.cpp
2016-01-21 17:16:55 +01:00
William Moberg de7c8e9234 WIP, collision detects too much, no resolving for most cases. 2016-01-21 17:10:36 +01:00
William Moberg 4d5b835352 WIP triangles vs. AABB. 2016-01-20 16:43:09 +01:00
136 changed files with 5400 additions and 738 deletions
+1 -1
Submodule assets updated: 091ad5c01b...cfeeb1f880
@@ -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)
{ }
+18
View File
@@ -28,6 +28,21 @@ bool RayVsAABB(const Ray& ray, const AABB& box);
//Return true if the ray hits the box, also outputs distance from ray origin to intersection point in [outDistance].
bool RayVsAABB(const Ray& ray, const AABB& box, float& outDistance);
//Return true if the ray hits the triangle.
bool RayVsTriangle(const Ray& ray,
const glm::vec3& v0,
const glm::vec3& v1,
const glm::vec3& v2,
bool trueOnNegativeDistance = false);
//Return true if the ray hits the triangle, and the distance is less than outDistance.
bool RayVsTriangle(const Ray& ray,
const glm::vec3& v0,
const glm::vec3& v1,
const glm::vec3& v2,
float& outDistance,
float& outUCoord,
float& outVCoord,
bool trueOnNegativeDistance = false);
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
bool RayVsModel(const Ray& ray,
const std::vector<RawModel::Vertex>& modelVertices,
@@ -52,6 +67,9 @@ bool AABBvsTriangles(const AABB& box,
const std::vector<RawModel::Vertex>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& boxVelocity,
float verticalStepHeight,
bool& isOnGround,
glm::vec3& outResolutionVector);
//Return true if the boxes are intersecting.
+6 -1
View File
@@ -43,6 +43,11 @@ struct ComponentWrapper
// Specialization for string literals
template <std::size_t N>
void SetField(std::string name, const char(&value)[N]) { Field<std::string>(name) = std::string(value); }
void Copy(ComponentWrapper& destination)
{
memcpy(destination.Data, this->Data, Info.Stride);
}
struct SubscriptProxy
{
@@ -81,7 +86,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;
+17
View File
@@ -0,0 +1,17 @@
#ifndef EPickupSpawned_h__
#define EPickupSpawned_h__
#include "Core/Event.h"
#include "Core/EntityWrapper.h"
namespace Events
{
struct PickupSpawned : Event
{
EntityWrapper Pickup;
};
}
#endif
+1
View File
@@ -9,6 +9,7 @@ namespace Events
struct PlayerDamage : Event
{
//NOTE: this struct is missing information on what the damageSource is
EntityWrapper Player;
double Damage;
};
+2 -3
View File
@@ -2,7 +2,7 @@
#define EPlayerDeath_h__
#include "EventBroker.h"
#include "../Core/Entity.h"
#include "../Core/EntityWrapper.h"
namespace Events
{
@@ -10,8 +10,7 @@ namespace Events
struct PlayerDeath : Event
{
//KilledBy,KilledByWhat is optional for now. It might be used later in the playerlog-system
EntityID KilledBy;
EntityID PlayerID;
EntityWrapper Player;
std::string KilledByWhat;
};
+6 -6
View File
@@ -2,16 +2,16 @@
#define EPlayerHealthPickup_h__
#include "EventBroker.h"
#include "../Core/Entity.h"
#include "../Core/EntityWrapper.h"
namespace Events
{
struct PlayerHealthPickup : Event
{
double HealthAmount;
EntityID PlayerHealedID;
};
struct PlayerHealthPickup : Event
{
EntityWrapper Player;
double HealthAmount;
};
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -102,7 +102,7 @@ public:
m_ExtraMemory.push_back((char*)malloc(m_Stride));
//We should preferably not enter here to avoid performance issues. Set more numMaxElements in constructor instead.
if (!DisableMemoryPool::Value) {
LOG_WARNING("Allocated slots exceed Pool size, extra memory allocated dynamically. Pool size: %u, dynamic size: %u.", m_NumSlots, m_ExtraMemory.size());
LOG_DEBUG("Allocated slots exceed Pool size, extra memory allocated dynamically. Pool size: %u, dynamic size: %u.", m_NumSlots, m_ExtraMemory.size());
}
return m_ExtraMemory.back();
}
+2 -2
View File
@@ -111,7 +111,7 @@ struct Child
std::vector<ContainedObject>& m_StaticObjectsRef;
std::vector<ContainedObject>& m_DynamicObjectsRef;
bool hasChildren() const;
inline bool hasChildren() const { return m_Children[0] != nullptr; }
int childIndexContainingPoint(const glm::vec3& point) const;
std::vector<int> childIndicesContainingBox(const AABB& box) const;
};
@@ -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);
}
+4
View File
@@ -7,6 +7,10 @@
class Ray
{
public:
Ray()
: m_Origin(glm::vec3(0.f))
, m_Direction(glm::vec3(0, 0, 1))
{}
Ray(const glm::vec3& origin, const glm::vec3& dir)
: m_Origin(origin)
, m_Direction(glm::normalize(dir))
+10 -7
View File
@@ -200,13 +200,16 @@ static T* ResourceManager::Load(const std::string& resourceName, Resource* paren
}
//If resource has already been cached and completely loaded.
it = m_ResourceCache.find(cacheKey);
if (it != m_ResourceCache.end()) {
if (it->second != nullptr) {
return static_cast<T*>(it->second);
} else {
//Don't return null on failure, exception instead.
throw Resource::FailedLoadingException();
{
boost::lock_guard<decltype(m_Mutex)> guard(m_Mutex);
it = m_ResourceCache.find(cacheKey);
if (it != m_ResourceCache.end()) {
if (it->second != nullptr) {
return static_cast<T*>(it->second);
} else {
//Don't return null on failure, exception instead.
throw Resource::FailedLoadingException();
}
}
}
+1
View File
@@ -18,6 +18,7 @@ glm::vec3 AbsoluteScale(EntityWrapper entity);
glm::vec3 AbsoluteScale(World* world, EntityID entity);
glm::mat4 ModelMatrix(EntityWrapper entity);
glm::mat4 ModelMatrix(EntityID entity, World* world);
glm::vec3 TransformPoint(const glm::vec3& point, const glm::mat4& matrix);
}
+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); }
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;
@@ -4,6 +4,7 @@
#include "../GLM.h"
#include "../Core/InputController.h"
#include "../Core/ELockMouse.h"
#include "InputHandler.h"
template <typename EventContext>
class FirstPersonInputController : public InputController<EventContext>
@@ -15,20 +16,45 @@ 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;
virtual void Reset();
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
protected:
const int m_PlayerID;
bool m_MouseLocked = false;
glm::vec3 m_Rotation;
glm::vec3 m_Movement;
bool m_Jumping = false;
bool m_DoubleJumping = false;
bool m_Crouching = false;
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
double m_AssaultDashDoubleTapDeltaTime = 0.0;
double m_AssaultDashCoolDownTimer = 0.0;
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
//and its very unlikely that someone wants to change that value
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
std::string m_AssaultDashTapDirection = "";
std::string m_CurrentDirectionVector = "";
bool m_AssaultDashDoubleTapped = false;
bool m_PlayerIsDashing = false;
bool m_ShiftDashing = false;
bool m_ValidDoubleTap = false;
//specialabilitys
bool m_MovementKeyDown = false;
bool m_SpecialAbilityKeyDown = false;
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
bool OnLockMouse(const Events::LockMouse& e);
EventRelay<EventContext, Events::UnlockMouse> m_EUnlockMouse;
@@ -36,7 +62,7 @@ protected:
};
template <typename EventContext>
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
: InputController(eventBroker)
, m_PlayerID(playerID)
{
@@ -99,6 +125,26 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
}
}
if (e.Command == "Forward" || e.Command == "Right") {
if (e.Value != 0) {
m_CurrentDirectionVector = e.Command == "Right" ? (e.Value > 0 ? "Right" : "Left") : (e.Value > 0 ? "Forward" : "Backward");
}
//if value = 0 then you have just released this key
if (e.Value != 0) {
m_MovementKeyDown = true;
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
m_ValidDoubleTap = true;
}
} else {
//== 0
m_MovementKeyDown = false;
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
m_AssaultDashTapDirection = m_CurrentDirectionVector;
m_AssaultDashDoubleTapDeltaTime = 0.f;
}
}
if (e.Command == "Jump") {
m_Jumping = e.Value > 0;
}
@@ -107,21 +153,83 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
m_Crouching = e.Value > 0;
}
if (e.Command == "SpecialAbility") {
if (e.Value > 0) {
m_SpecialAbilityKeyDown = true;
} else {
m_SpecialAbilityKeyDown = false;
}
}
if (m_SpecialAbilityKeyDown && m_MovementKeyDown) {
m_ShiftDashing = true;
} else {
m_ShiftDashing = false;
}
return true;
}
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;
}
template <typename EventContext>
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer) {
m_AssaultDashDoubleTapDeltaTime += dt;
m_AssaultDashCoolDownTimer -= dt;
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
if (m_AssaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
m_PlayerIsDashing = true;
} else {
m_PlayerIsDashing = false;
}
//dashing with shift
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f && !isJumping) {
//player is dashing with shift
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
m_AssaultDashDoubleTapped = true;
m_AssaultDashDoubleTapDeltaTime = 0.f;
//moving to the side has priority
return;
}
//dashing with doubletap - check if doubletap to dash enabled
if (ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
return;
}
//reset the DoubleTapped state in case we recently doubleTapped (doubletap will only happen during 1 frame)
if (m_AssaultDashDoubleTapped) {
m_AssaultDashDoubleTapped = false;
}
//check if we have received a valid doubletap
if (!m_ValidDoubleTap) {
return;
}
m_ValidDoubleTap = false;
if (!(m_AssaultDashCoolDownTimer <= 0.0f && !isJumping)) {
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
m_AssaultDashDoubleTapDeltaTime = 0.f;
return;
}
//ok, we have a valid tap, lets do it
m_AssaultDashDoubleTapped = true;
m_AssaultDashDoubleTapDeltaTime = 0.f;
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
}
#endif
+2 -2
View File
@@ -36,7 +36,7 @@ private:
boost::asio::ip::udp::socket m_Socket;
// Sending message to server logic
int bytesRead = -1;
size_t bytesRead = 0;
char readBuf[INPUTSIZE] = { 0 };
// Packet loss logic
@@ -69,7 +69,7 @@ private:
// Private member functions
void readFromServer();
int receive(char* data);
size_t receive(char* data);
void send(Packet& packet);
void connect();
void disconnect();
+1 -1
View File
@@ -29,7 +29,7 @@ protected:
unsigned int m_SaveDataIntervalMs = 1000;
std::clock_t m_SaveDataTimer;
unsigned int m_MaxConnections;
unsigned int m_TimeoutMs;
double m_TimeoutMs;
void saveToFile();
void updateNetworkData();
void initialize();
+8 -8
View File
@@ -3,16 +3,16 @@
#include <vector>
struct NetworkData {
unsigned int TotalTime = 0;
unsigned int TotalDataReceived = 0;
unsigned int TotalDataSent = 0;
unsigned int AmountOfMessagesReceived = 0;
double TotalTime = 0;
size_t TotalDataReceived = 0;
size_t TotalDataSent = 0;
size_t AmountOfMessagesReceived = 0;
unsigned int AmountOfMessagesSent = 0;
// Interval based
unsigned int DataReceivedThisInterval = 0;
unsigned int DataSentThisInterval = 0;
size_t DataReceivedThisInterval = 0;
size_t DataSentThisInterval = 0;
// pair: first=reveived, second=send
std::vector<std::pair<unsigned int, unsigned int>> BandwidthBytes;
std::vector<std::pair<size_t, size_t>> BandwidthBytes;
};
#endif
#endif
+9 -9
View File
@@ -13,7 +13,7 @@ public:
// arg2: PacketID for identifying packet loss.
Packet(MessageType type, unsigned int& packetID);
// Used to create packet from already existing data buffer.
Packet(char* data, const int sizeOfPacket);
Packet(char* data, const size_t sizeOfPacket);
Packet(MessageType type);
~Packet();
void Init(MessageType type, unsigned int& packetID);
@@ -51,18 +51,18 @@ public:
std::string ReadString();
char* ReadData(int SizeOfData);
void ChangePacketID(unsigned int& packetID);
int Size() { return m_Offset; };
size_t Size() { return m_Offset; };
char* Data() { return m_Data; };
unsigned int DataReadSize() { return m_ReturnDataOffset; }
unsigned int MaxSize() { return m_MaxPacketSize; }
unsigned int HeaderSize() { return m_HeaderSize; }
size_t DataReadSize() { return m_ReturnDataOffset; }
size_t MaxSize() { return m_MaxPacketSize; }
size_t HeaderSize() { return m_HeaderSize; }
private:
char* m_Data;
unsigned int m_ReturnDataOffset = 0;
int m_Offset = 0;
unsigned int m_MaxPacketSize = 512;
unsigned int m_HeaderSize = 0;
size_t m_ReturnDataOffset = 0;
size_t m_Offset = 0;
size_t m_MaxPacketSize = 512;
size_t m_HeaderSize = 0;
void resizeData();
};
+4 -4
View File
@@ -36,14 +36,14 @@ private:
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
// HACK: Fix INPUTSIZE
char readBuffer[INPUTSIZE] = { 0 };
int bytesRead = 0;
size_t bytesRead = 0;
// time for previouse message
std::clock_t previousePingMessage = std::clock();
std::clock_t previousSnapshotMessage = std::clock();
std::clock_t timOutTimer = std::clock();
// How often we send messages (milliseconds)
int pingIntervalMs;
int snapshotInterval;
float pingIntervalMs;
float snapshotInterval;
int checkTimeOutInterval = 100;
int m_NextPlayerID = 0;
@@ -59,7 +59,7 @@ private:
PacketID m_PreviousPacketID = 0;
// Private member functions
int receive(char* data);
size_t receive(char* data);
void readFromClients();
void send(PlayerID player, Packet& packet);
void send(Packet& packet);
+12 -2
View File
@@ -8,6 +8,7 @@
#include "ShaderProgram.h"
//#include "Util/UnorderedMapVec2.h"
#include "Texture.h"
#include "imgui/imgui.h"
class DrawBloomPass
{
@@ -26,27 +27,36 @@ public:
//Getters
//Return the blurred result of the texture that was sent into draw
GLuint GaussianTexture() const { return m_GaussianTexture_vert; }
GLuint GaussianTexture() const { return m_FinalBlurTexture; }
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void BlurOneMipMapLevel(GLuint* texture, GLint iterations, GLint mipMapLevel);
Texture* m_WhiteTexture;
Model* m_ScreenQuad;
const IRenderer* m_Renderer;
//const LightCullingPass* m_LightCullingPass
GLuint m_iterations = 9;
//GLuint m_iterations = 5;
GLint m_DebugTextureToDraw = 0;
GLint m_Iterations = 3;
float m_ScreenSizes[10];
GLuint m_FinalBlurTexture;
GLuint m_GaussianTexture_horiz;
GLuint m_GaussianTexture_vert;
FrameBuffer m_GaussianFrameBuffer_horiz;
FrameBuffer m_GaussianFrameBuffer_vert;
FrameBuffer m_BlurredFinalTexture;
ShaderProgram* m_GaussianProgram_horiz;
ShaderProgram* m_GaussianProgram_vert;
ShaderProgram* m_GaussianProgram_both;
ShaderProgram* m_CombineProgram;
};
@@ -7,6 +7,7 @@
#include "ShaderProgram.h"
//#include "Util/UnorderedMapVec2.h"
#include "Texture.h"
#include "imgui/imgui.h"
class DrawColorCorrectionPass
{
@@ -16,14 +17,13 @@ public:
void InitializeFrameBuffers();
void InitializeShaderPrograms();
void Draw(GLuint sceneTexture, GLuint bloomTexture);
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLfloat gamma, GLfloat exposure);
private:
const IRenderer* m_Renderer;
ShaderProgram* m_ColorCorrectionProgram;
Model* m_ScreenQuad;
GLfloat m_Exposure;
};
#endif
+18 -1
View File
@@ -22,15 +22,23 @@ public:
//Return the texture that is used in later stages to apply the bloom effect
GLuint BloomTexture() const { return m_BloomTexture; }
GLuint BloomTextureLowRes() const { return m_BloomTextureLowRes; }
//Return the texture with diffuse and lighting of the scene.
GLuint SceneTexture() const { return m_SceneTexture; }
GLuint SceneTextureLowRes() const { return m_SceneTextureLowRes; }
//Return the framebuffer used in the scene rendering stage.
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& job, RenderScene& scene);
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
@@ -44,15 +52,24 @@ private:
Texture* m_GreyTexture;
FrameBuffer m_FinalPassFrameBuffer;
FrameBuffer m_FinalPassFrameBufferLowRes;
GLuint m_BloomTexture;
GLuint m_SceneTexture;
GLuint m_BloomTextureLowRes;
GLuint m_SceneTextureLowRes;
GLuint m_DepthBuffer;
GLuint m_DepthBufferLowRes;
//maqke this component based i guess?
GLuint m_ShieldPixelRate = 16;
const IRenderer* m_Renderer;
const LightCullingPass* m_LightCullingPass;
ShaderProgram* m_ForwardPlusProgram;
ShaderProgram* m_ExplosionEffectProgram;
ShaderProgram* m_ShieldToStencilProgram;
ShaderProgram* m_FillDepthBufferProgram;
};
#endif
@@ -12,4 +12,11 @@ private:
};
class DrawStencilState : public RenderState
{
public:
DrawStencilState(GLuint frameBuffer);
~DrawStencilState();
};
#endif
+11 -11
View File
@@ -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);
};
+22 -10
View File
@@ -19,27 +19,39 @@
struct RenderScene
{
::Camera* Camera = nullptr;
std::list<std::shared_ptr<RenderJob>> OpaqueObjects;
std::list<std::shared_ptr<RenderJob>> TransparentObjects;
std::list<std::shared_ptr<RenderJob>> PointLightJobs;
std::list<std::shared_ptr<RenderJob>> TextJobs;
std::list<std::shared_ptr<RenderJob>> DirectionalLightJobs;
struct Queues {
std::list<std::shared_ptr<RenderJob>> OpaqueObjects;
std::list<std::shared_ptr<RenderJob>> TransparentObjects;
std::list<std::shared_ptr<RenderJob>> OpaqueShieldedObjects;
std::list<std::shared_ptr<RenderJob>> TransparentShieldedObjects;
std::list<std::shared_ptr<RenderJob>> ShieldObjects;
std::list<std::shared_ptr<RenderJob>> PointLight;
std::list<std::shared_ptr<RenderJob>> Text;
std::list<std::shared_ptr<RenderJob>> DirectionalLight;
} Jobs;
Rectangle Viewport;
bool ClearDepth = false;
glm::vec4 AmbientColor;
void Clear()
{
OpaqueObjects.clear();
TransparentObjects.clear();
PointLightJobs.clear();
TextJobs.clear();
DirectionalLightJobs.clear();
Jobs.OpaqueObjects.clear();
Jobs.TransparentObjects.clear();
Jobs.OpaqueShieldedObjects.clear();
Jobs.TransparentShieldedObjects.clear();
Jobs.ShieldObjects.clear();
Jobs.Text.clear();
Jobs.DirectionalLight.clear();
}
};
struct RenderFrame
{
public:
//TODO: Getters
GLfloat Gamma = 2.2f;
GLfloat Exposure = 1.f;
void Add(RenderScene &scene)
{
+4
View File
@@ -2,6 +2,7 @@
#define RenderState_h__
#include <functional>
#include <boost/range/adaptor/reversed.hpp>
#include "../Common.h"
#include "../OpenGL.h"
#include "../GLM.h"
@@ -19,6 +20,9 @@ public:
bool BindFramebuffer(GLint framebuffer);
bool BlendEquation(GLenum mode);
bool BlendFunc(GLenum sfactor, GLenum dfactor);
bool StencilOp(GLenum sfail, GLenum dpfail, GLenum dppass);
bool StencilFunc(GLenum func, GLint ref, GLuint mask);
bool StencilMask(GLuint mask);
bool DepthMask(GLboolean flag);
private:
+1 -1
View File
@@ -40,7 +40,7 @@ private:
EventRelay<RenderSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(Events::PlayerSpawned& e);
void fillModels(std::list<std::shared_ptr<RenderJob>>& opaqueJobs, std::list<std::shared_ptr<RenderJob>>& transparentJobs);
void fillModels(RenderScene::Queues &jobs);
void fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
void fillPointLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
+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, %i, %s", info, error, gluErrorString(error));
_LOG(LOG_LEVEL_ERROR, file, func, line, "GL Error: %s\nError code: %i, %s\n", info, error, gluErrorString(error));
return true;
}
+1
View File
@@ -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;
+2 -1
View File
@@ -12,6 +12,7 @@
#include <tuple>
#include <vector>
#include <algorithm>
class HealthSystem : public PureSystem
{
@@ -26,7 +27,7 @@ private:
EventRelay<HealthSystem, Events::PlayerDamage> m_EPlayerDamage;
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
bool HealthSystem::OnPlayerHealthPickup(const Events::PlayerHealthPickup& e);
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e);
//vector which will keep track of health changes
std::vector<std::tuple<EntityID, double>> m_DeltaHealthVector;
+1 -1
View File
@@ -23,7 +23,7 @@ class InterpolationSystem : public PureSystem
glm::vec3 Position;
glm::vec3 Scale;
glm::quat Orientation;
double interpolationTime;
float interpolationTime;
};
public:
InterpolationSystem(World* world, EventBroker* eventBroker);
+33
View File
@@ -0,0 +1,33 @@
#ifndef PickupSpawnSystem_h__
#define PickupSpawnSystem_h__
#include "Core/System.h"
#include "Core/Transform.h"
#include "Core/ResourceManager.h"
#include "Core/EntityFileParser.h"
#include "Core/EPickupSpawned.h"
#include "Core/EPlayerHealthPickup.h"
#include "Engine/Collision/ETrigger.h"
#include "Common.h"
#include <tuple>
class PickupSpawnSystem : public ImpureSystem
{
public:
PickupSpawnSystem(World* world, EventBroker* eventBroker);
virtual void Update(double dt) override;
private:
EventRelay<PickupSpawnSystem, Events::TriggerTouch> m_ETriggerTouch;
bool OnTriggerTouch(Events::TriggerTouch& e);
struct NewHealthPickup {
glm::vec3 Pos;
double HealthGain;
double RespawnTimer;
double DecreaseThisRespawnTimer;
};
std::vector<NewHealthPickup> m_ETriggerTouchVector;
};
#endif
+29
View File
@@ -0,0 +1,29 @@
#ifndef PlayerDeathSystem_h__
#define PlayerDeathSystem_h__
#include "Core/System.h"
#include "Input/EInputCommand.h"
#include "GLM.h"
#include "Rendering/ESetCamera.h"
#include "Core/ConfigFile.h"
#include "Core/EntityFile.h"
#include "Core/EntityFileParser.h"
#include "Core/EPlayerDeath.h"
class PlayerDeathSystem : public ImpureSystem
{
public:
PlayerDeathSystem(World* world, EventBroker* eventBroker);
virtual void Update(double dt) override;
private:
EventRelay<PlayerDeathSystem, Events::PlayerDeath> m_OnPlayerDeath;
bool OnPlayerDeath(Events::PlayerDeath& e);
void createDeathEffect(EntityWrapper player);
};
#endif
@@ -20,4 +20,5 @@ private:
EventRelay<PlayerMovementSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(Events::PlayerSpawned& e);
};
+1
View File
@@ -3,6 +3,7 @@
#include "Systems/SpawnerSystem.h"
#include "Events/ESpawnerSpawn.h"
#include "Core/EPlayerSpawned.h"
#include "Core/EPlayerDeath.h"
#include "Rendering/ESetCamera.h"
#include "Core/ConfigFile.h"
+2 -1
View File
@@ -13,7 +13,8 @@ A=Right,-1
R=Reload
Space=Jump
LeftControl=Crouch
LeftShift=Sprint
RightShift=Sprint
LeftShift=SpecialAbility
F1=ToggleEditor
C=ConnectToServer
N=SwitchToServer
+5
View File
@@ -11,6 +11,7 @@
<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"/>
@@ -29,4 +30,8 @@
<xs:include schemaLocation="Components/Fill.xsd"/>
<xs:include schemaLocation="Components/Lifetime.xsd"/>
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
<xs:include schemaLocation="Components/DashAbility.xsd"/>
<xs:include schemaLocation="Components/Shield.xsd"/>
<xs:include schemaLocation="Components/Shielded.xsd"/>
</xs:schema>
+2 -2
View File
@@ -7,10 +7,10 @@
<xs:complexType>
<xs:all>
<xs:element name="Origin" type="t:Vector" minOccurs="0">
<xs:annotation><xs:documentation>Middle point of the bounding box</xs:documentation></xs:annotation>
<xs:annotation><xs:documentation>Middle point of the bounding box, in model space</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Size" type="t:Vector" minOccurs="0">
<xs:annotation><xs:documentation>Size of the bounding box</xs:documentation></xs:annotation>
<xs:annotation><xs:documentation>Size of the bounding box, in model space</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
+1 -1
View File
@@ -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,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
</DashAbility>
@@ -0,0 +1,18 @@
<?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="DashAbility">
<xs:annotation>
<xs:documentation>A dash component for one of the classes</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<HealthPickup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="HealthPickup.xsd">
<RespawnTimer>3</RespawnTimer>
<HealthGain>30</HealthGain>
</HealthPickup>
@@ -0,0 +1,21 @@
<?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="HealthPickup">
<xs:annotation>
<xs:documentation>A Health Pickup</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="RespawnTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The respawn timer for a health pickup</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="HealthGain" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>How much percent max-health the player will get when he picks the healthPickup up</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+2
View File
@@ -2,4 +2,6 @@
<Physics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Physics.xsd">
<Velocity X="0" Y="0" Z="0"/>
<Gravity>true</Gravity>
<IsOnGround>false</IsOnGround>
<VerticalStepHeight>0.33</VerticalStepHeight>
</Physics>
+4
View File
@@ -13,6 +13,10 @@
<xs:annotation><xs:documentation>m/s^2</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Gravity" type="t:bool" minOccurs="0"/>
<xs:element name="IsOnGround" type="t:bool" minOccurs="0"/>
<xs:element name="VerticalStepHeight" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The largest height of a "stair-step" that can be walked over</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
@@ -0,0 +1,7 @@
<?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>
@@ -0,0 +1,25 @@
<?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>
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Shield xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Shield.xsd">
</Shield>
+7
View File
@@ -0,0 +1,7 @@
<?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="Shield">
</xs:element>
</xs:schema>
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Shielded xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Shielded.xsd">
</Shielded>
+7
View File
@@ -0,0 +1,7 @@
<?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="Shielded">
</xs:element>
</xs:schema>
@@ -0,0 +1,51 @@
<?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>
@@ -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>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>
@@ -0,0 +1,164 @@
<?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/>
</Components>
<Children>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Test/ObstacleCourse.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="0.00638055196"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:DirectionalLight>
<Intensity>0.46000027656555176</Intensity>
</c:DirectionalLight>
<c:Transform>
<Orientation X="0" Y="2.59000015" Z="0.799000025"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1.52309108" Y="5.72108126" Z="0"/>
<Scale X="5" Y="5" Z="5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BluSpawn">
<Components>
<c:PlayerSpawn/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="1" Y="1.60000002" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="RedSpawn">
<Components>
<c:PlayerSpawn/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="-1.20000005" Y="1.60000002" Z="-8.40000057"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="0" Y="0" Z="2.24403"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+66 -121
View File
@@ -1,122 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<Entity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd" xmlns:c="components">
<Components>
<c:Transform>
<Orientation X="0" Y="0" Z="0"/>
</c:Transform>
<c:Model>
<Resource>Models/DummyScene.mesh</Resource>
</c:Model>
</Components>
<Children>
<Entity>
<Components>
<c:Transform>
<Position X="-1.5"/>
<Scale X="1" Y="1" Z="1"/>
</c:Transform>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
</Components>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="1.5"/>
<Scale X="2" Y="2" Z="2"/>
</c:Transform>
<c:Model>
<Resource>Models/RotationWidgetX.mesh</Resource>
</c:Model>
<c:Trigger>
</c:Trigger>
</Components>
</Entity>
<Entity>
<Components>
<c:Player>
<Velocity X="0" Y="0" Z="0"/>
</c:Player>
<c:Transform>
<Position X="2.5"/>
</c:Transform>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:AABB>
</c:AABB>
</Components>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="0" Y="-0"/>
<Scale X="1" Y="1" Z="1"/>
</c:Transform>
<!--<c:Move>
<Speed>1</Speed>
<Direction X="-1"/>
<Rotation Y="3.14"/>
</c:Move>-->
</Components>
<Children>
<Entity>
<Components>
<c:Transform>
<Position X="0" Y="0"/>
<Orientation X="0.0" Y="0" Z="1.0"/>
</c:Transform>
<c:Model>
<Resource>Models/Core/UnitRaptor.mesh</Resource>
<Color R="1" G="0.4" B="0.8"/>
</c:Model>
</Components>
<Children>
<Entity>
<Components>
<c:Transform>
<Position X="-0.01" Y="0.55"/>
<Orientation X="0" Y="0" Z="-1"/>
</c:Transform>
<c:RaptorCopter>
<Speed>20</Speed>
<Axis Y="1"/>
</c:RaptorCopter>
</Components>
<Children>
<Entity>
<Components>
<c:Transform>
<Position X="0" Y="0"/>
<Scale X="1.7" Y="0.03" Z="0.1"/>
<Orientation X="0" Y="0" Z="0"/>
</c:Transform>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color R="1" G="0.4" B="0.8"/>
</c:Model>
</Components>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="0" Y="0"/>
<Scale X="1.7" Y="0.03" Z="0.1"/>
<Orientation X="0" Y="1.57" Z="0"/>
</c:Transform>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color R="1" G="0.4" B="0.8"/>
</c:Model>
</Components>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Test/ObstacleCourse.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="0.00638055196"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:DirectionalLight>
<Intensity>0.46000027656555176</Intensity>
</c:DirectionalLight>
<c:Transform>
<Orientation X="0" Y="2.59000015" Z="0.799000025"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Physics>
<Gravity>false</Gravity>
</c:Physics>
<c:Player/>
<c:Transform>
<Position X="-8.80904388" Y="1.82786822" Z="7.97052002"/>
<Scale X="0.100000001" Y="1" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Core/colorbox.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-1.52309108" Y="5.72108126" Z="0"/>
<Scale X="5" Y="5" Z="5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+122 -74
View File
@@ -2,7 +2,9 @@
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
<c:Transform>
<Position X="0" Y="-1" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -18,7 +20,7 @@
</Components>
<Children/>
</Entity>
<Entity>
<Entity name="Listener">
<Components>
<c:Camera/>
<c:Listener/>
@@ -38,18 +40,27 @@
<Resource>Models/DirectionalLightWidget.mesh</Resource>
</c:Model>
<c:RaptorCopter>
<Speed>1.0499999523162842</Speed>
<Speed>1</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="1422.89319" Z="0"/>
<Orientation X="4.16300011" Y="7875.41211" 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>
@@ -62,11 +73,26 @@
<Entity name="SecondaryWeapon">
<Components>
<c:Model>
<Resource>Models/SecondaryWeapon.mesh</Resource>
<Resource>Models/AssaultWeaponRed.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="-0.546139359" Y="0.853016734" Z="0.177482292"/>
<Orientation X="1.47266471" Y="0.524984181" Z="1.243698"/>
<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"/>
</c:Transform>
</Components>
<Children/>
@@ -85,7 +111,7 @@
<Components>
<c:Animation>
<Name>Run</Name>
<Time>0.62051775215976157</Time>
<Time>0.17818245776980568</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
@@ -101,7 +127,7 @@
<Components>
<c:Animation>
<Name>Walk</Name>
<Time>0.28779680073140668</Time>
<Time>0.34546191187031372</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
@@ -147,70 +173,6 @@
</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>
@@ -227,7 +189,7 @@
<Axis X="1" Y="1" Z="1"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="53.9495354" Y="53.9495354" Z="53.9495354"/>
<Orientation X="6484.80273" Y="6484.80273" Z="6484.80273"/>
</c:Transform>
</Components>
<Children>
@@ -284,8 +246,94 @@
</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,15 +84,6 @@
</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>
+6 -2
View File
@@ -8,6 +8,10 @@
<Children>
<Entity name="Scenemesh">
<Components>
<c:AABB>
<Size X="150" Y="64" Z="180"/>
</c:AABB>
<c:Collidable/>
<c:Model>
<Resource>Models\MapVersion1.mesh</Resource>
</c:Model>
@@ -139,7 +143,7 @@
</Team>
</c:Team>
<c:Transform>
<Position X="57.7363472" Y="1.18853188" Z="79.5"/>
<Position X="57.7363472" Y="2.38900018" Z="79.5"/>
</c:Transform>
</Components>
<Children>
@@ -201,7 +205,7 @@
</Team>
</c:Team>
<c:Transform>
<Position X="-60.2567062" Y="1.60000002" Z="-78.1000061"/>
<Position X="-60.2567062" Y="3.4000001" Z="-78.1000061"/>
</c:Transform>
</Components>
<Children>
@@ -0,0 +1,18 @@
<?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:HealthPickup/>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="1" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
@@ -0,0 +1,294 @@
<?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/>
</Components>
<Children>
<Entity name="Scenemesh">
<Components>
<c:Model>
<Resource>Models\MapVersion1.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DirectionalLight">
<Components>
<c:DirectionalLight>
<Intensity>2</Intensity>
</c:DirectionalLight>
<c:Model>
<Resource>Models/DirectionalLightWidget.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="61.9050903" Z="0"/>
<Scale X="50" Y="50" Z="50"/>
<Orientation X="4.42700005" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="PointLight">
<Components>
<c:PointLight>
<Radius>8</Radius>
<Intensity>2.7999999523162842</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="PointLight">
<Components>
<c:PointLight>
<Radius>8</Radius>
<Intensity>2.7999999523162842</Intensity>
</c:PointLight>
<c:Transform>
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="10.460474" Y="0" Z="-3.92580295"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
<Scale X="150" Y="1" Z="180"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BluSpawn">
<Components>
<c:PlayerSpawn/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="57.7363472" Y="1.18853188" Z="79.5"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="RedSpawn">
<Components>
<c:PlayerSpawn/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="-60.2567062" Y="1.60000002" Z="-78.1000061"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="0" Y="0" Z="2.24403"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:HealthPickup>
<RespawnTimer>1</RespawnTimer>
<HealthGain>22</HealthGain>
</c:HealthPickup>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="60" Y="1" Z="80"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:HealthPickup>
<RespawnTimer>1</RespawnTimer>
<HealthGain>22</HealthGain>
</c:HealthPickup>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="60" Y="1" Z="80"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:HealthPickup>
<RespawnTimer>4</RespawnTimer>
<HealthGain>44</HealthGain>
</c:HealthPickup>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="60" Y="1" Z="80"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,41 @@
<?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:Collidable/>
<c:Model>
<Resource>../assets/Models/MapVersion1.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Physics>
<Gravity>false</Gravity>
</c:Physics>
<c:Player/>
<c:Transform>
<Position X="-1.48400009" Y="3.68200016" Z="24.7580013"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:DirectionalLight/>
<c:Transform>
<Orientation X="3.80300021" Y="1.37800002" Z="4.10000038"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,65 @@
<?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" Y="0" Z="-0.313012958"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Camera/>
<c:Listener/>
<c:Transform>
<Position X="2.56531811" Y="0.637967348" Z="0.202344239"/>
<Orientation X="2.68780756" Y="1.36143553" Z="3.14159179"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Core/Tri.obj</Resource>
<Color A="1" B="1" G="0.392156869" R="0"/>
</c:Model>
<c:Transform>
<Scale X="2" Y="2" Z="0.200000003"/>
<Orientation X="2.70100021" Y="2.37000012" Z="0.266000003"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>../assets/Models/Core/Tri.obj</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Orientation X="0" Y="3.14159274" Z="4.71238899"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>../assets/Models/Core/UnitCube.obj</Resource>
</c:Model>
<c:Physics/>
<c:Transform>
<Position X="-1.95333278" Y="0.296304941" Z="2.56487775"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+5 -62
View File
@@ -6,22 +6,6 @@
</Components>
<Children>
<Entity name="Ground">
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="0.513725519" G="0" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="7" Y="-0.727000058" Z="-1.22800004"/>
<Scale X="50" Y="1.45100009" Z="50"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="RedSpawn">
<Components>
<c:PlayerSpawn/>
@@ -81,6 +65,10 @@
</Entity>
<Entity name="ObstacleCourse">
<Components>
<c:AABB>
<Size X="50" Y="50" Z="50"/>
</c:AABB>
<c:Collidable/>
<c:Model>
<Resource>Models/Test/ObstacleCourse.mesh</Resource>
</c:Model>
@@ -88,51 +76,6 @@
</Components>
<Children/>
</Entity>
<Entity name="ObstacleCoursePlayerBox">
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="6.32800007" Y="0.807000041" Z="-2.2750001"/>
<Scale X="1" Y="1.60000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ObstacleCourse1uHigh">
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="9.11900043" Y="0.5" Z="-2.10900021"/>
<Scale X="1" Y="1" Z="8.1960001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ObstacleCourseWhoTheFuckKnows">
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="13.2370005" Y="1.28600001" Z="-1.71700013"/>
<Scale X="2.58000016" Y="2.58300018" Z="21.1860008"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BlueSpawn">
<Components>
<c:PlayerSpawn/>
@@ -197,7 +140,7 @@
</Team>
</c:Team>
<c:Transform>
<Position X="-1.68112314" Y="0.0264999866" Z="3.06287026"/>
<Position X="-1.68112314" Y="0.0288829971" Z="3.06287026"/>
<Orientation X="0" Y="2.14675093" Z="0"/>
</c:Transform>
</Components>
+8 -5
View File
@@ -2,12 +2,15 @@
<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:DashAbility>
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
</c:DashAbility>
<c:Collidable/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
@@ -20,7 +23,7 @@
</Team>
</c:Team>
<c:Transform>
<Position X="8.60201447e-23" Y="0" Z="3.9201616e-23"/>
<Position X="9.56501799e-22" Y="-0.471999973" Z="4.35902473e-22"/>
</c:Transform>
</Components>
@@ -102,11 +105,11 @@
<Entity name="Weapon">
<Components>
<c:Model>
<Resource>Models/AssaultWeapon.mesh</Resource>
<Resource>Models/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
<Orientation X="0" Y="4.64700031" Z="0"/>
<Orientation X="0" Y="3.08300018" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -141,7 +144,7 @@
<Components>
<c:Animation>
<Name>Hold Pos</Name>
<Time>0.73515426169631848</Time>
<Time>0.73506627647571587</Time>
<Speed>1</Speed>
</c:Animation>
<c:HiddenForLocalPlayer/>
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Explosion" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Animation>
<Name>Hold Pos</Name>
</c:Animation>
<c:Lifetime>
<Lifetime>2.5</Lifetime>
</c:Lifetime>
<c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance>
<Velocity X="0" Y="7.76300049" Z="0"/>
<ExplosionOrigin X="0" Y="0.67900002" Z="0"/>
<ExponentialAccelaration>true</ExponentialAccelaration>
<ExplosionDuration>3</ExplosionDuration>
<EndColor A="0" B="0" G="0" R="1"/>
<Randomness>true</Randomness>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/AssaultAnimated.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="3.46966481"/>
</c:Transform>
</Components>
<Children>
<Entity name="Camera">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="2.49700022" Z="4.31700039"/>
<Orientation X="5.95600033" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -7,7 +7,8 @@
</c:Lifetime>
<c:Model>
<Resource>Models/CylinderBullet.mesh</Resource>
<Color A="1" B="39.2156868" G="7.84313726" R="0"/>
<Color A="0.156862751" B="39.2156868" G="7.84313726" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Scale X="0.0109999999" Y="0.0289999992" Z="100"/>
+2 -1
View File
@@ -7,7 +7,8 @@
</c:Lifetime>
<c:Model>
<Resource>Models/CylinderBullet.mesh</Resource>
<Color A="1" B="0" G="0.525490224" R="39.2156868"/>
<Color A="0.156862751" B="0" G="0.525490224" R="39.2156868"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Scale X="0.0110000009" Y="0.029000001" Z="100"/>
@@ -0,0 +1,24 @@
<?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>
@@ -0,0 +1,68 @@
<?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>
@@ -0,0 +1,16 @@
<?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>
@@ -0,0 +1,39 @@
<?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/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/Unithexagon.mesh</Resource>
</c:Model>
<c:Shield/>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="dl">
<Components>
<c:DirectionalLight/>
<c:Transform>
<Orientation X="0" Y="2.61800003" Z="0.756000042"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="sl">
<Components>
<c:SceneLight>
<Gamma>2.2000000476837158</Gamma>
</c:SceneLight>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+3
View File
@@ -31,12 +31,15 @@
<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"/>
<xs:element ref="c:HiddenForLocalPlayer" minOccurs="0"/>
<xs:element ref="c:Fill" minOccurs="0"/>
<xs:element ref="c:Animation" minOccurs="0"/>
<xs:element ref="c:Shield" minOccurs="0"/>
<xs:element ref="c:Shielded" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
@@ -2,7 +2,10 @@
layout (binding = 0) uniform sampler2D SceneTexture;
layout (binding = 1) uniform sampler2D BloomTexture;
layout (binding = 2) uniform sampler2D SceneTextureLowRes;
layout (binding = 3) uniform sampler2D BloomTextureLowRes;
uniform float Exposure;
uniform float Gamma;
in VertexData{
vec2 TextureCoordinate;
@@ -12,16 +15,24 @@ out vec4 fragmentColor;
void main()
{
const float gamma = 2.2;
vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate);
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
vec4 hdrColorLowRes = texture(SceneTextureLowRes, Input.TextureCoordinate);
vec4 bloomColorLowRes = texture(BloomTextureLowRes, Input.TextureCoordinate);
hdrColor += bloomColor;
hdrColorLowRes;
float hdrColorsum = hdrColorLowRes.r + hdrColorLowRes.g + hdrColorLowRes.b;
//Toon mapping thingy
vec3 result = vec3(1.0) - exp(-hdrColor.rgb * Exposure);
vec3 result;
if(hdrColorsum > 0.0) {
result = vec3(1.0) - exp(-hdrColorLowRes.rgb * Exposure);
} else {
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;
+23 -5
View File
@@ -17,15 +17,21 @@ 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;
@@ -114,12 +120,17 @@ 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 * (length(triangleCenter2ExplosionRadius) / s);
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = te;
}
else
{
Output.ExplosionColor = EndColor * timePercetage;
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = timePercetage;
}
// for every vertex on the triangle...
@@ -132,6 +143,8 @@ 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);
@@ -154,11 +167,14 @@ void main()
// if explosion color should be affected by distance instead of time...
if (ColorByDistance == true)
{
Output.ExplosionColor = vec4(0.0);
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = 0.0;
}
else
{
Output.ExplosionColor = EndColor * timePercetage;
Output.ExplosionColor = EndColor;
Output.ExplosionPercentageElapsed = timePercetage;
}
// for every vertex on the triangle...
@@ -168,7 +184,9 @@ 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();
@@ -0,0 +1,11 @@
#version 430
in VertexData{
vec3 Position;
}Input;
void main()
{
}
@@ -0,0 +1,21 @@
#version 430
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
layout(location = 0) in vec3 Position;
layout(location = 5) in vec4 BoneIndices;
layout(location = 6) in vec4 BoneWeights;
out VertexData{
vec3 Position;
}Output;
void main()
{
gl_Position = P * V * M * vec4(Position, 1.0);
Output.Position = Position;
}
+8 -7
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,13 +55,12 @@ 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;
@@ -120,6 +119,7 @@ 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 = scene_ambient;
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
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,8 +150,9 @@ void main()
totalLighting.Specular += light_result.Specular;
}
vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
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;
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
@@ -160,7 +161,7 @@ void main()
color_result += FillColor;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
color_result += glowTexel;
color_result += glowTexel*3;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
+3 -1
View File
@@ -20,6 +20,7 @@ out VertexData{
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Output;
void main()
@@ -41,5 +42,6 @@ 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(0.0);
Output.ExplosionColor = vec4(1.0);
Output.ExplosionPercentageElapsed = 0.0;
}
+36
View File
@@ -0,0 +1,36 @@
#version 430
#extension GL_EXT_gpu_shader4 : enable
uniform int MipMapLevel;
uniform bool Horizontal;
uniform vec2 ScreenSize[5];
layout (binding = 0) uniform sampler2D Texture;
in VertexData{
vec2 TextureCoordinate;
}Input;
out vec4 fragmentColor;
uniform float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 );
uniform float weight[5] = float[]( 0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 );
void main()
{
//vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = textureLod(Texture, vec2(gl_FragCoord)/ScreenSize[0], MipMapLevel ).rgb * weight[0];
if(Horizontal) {
for( int i = 1; i<3; i++) {
result += textureLod( Texture, Input.TextureCoordinate + vec2(offset[i], 0.0), MipMapLevel ).rgb * weight[i];
result += textureLod( Texture, Input.TextureCoordinate - vec2(offset[i], 0.0), MipMapLevel ).rgb * weight[i];
}
} else {
for( int i = 1; i<3; i++) {
result += textureLod( Texture, Input.TextureCoordinate + vec2(0.0, offset[i]), MipMapLevel ).rgb * weight[i];
result += textureLod( Texture, Input.TextureCoordinate - vec2(0.0, offset[i]), MipMapLevel ).rgb * weight[i];
}
}
fragmentColor = vec4(result, 1.0);
}
+13
View File
@@ -0,0 +1,13 @@
#version 430
layout (location = 0) in vec3 Position;
out VertexData{
vec2 TextureCoordinate;
}Output;
void main()
{
gl_Position = vec4(Position, 1.0);
Output.TextureCoordinate = (vec2(Position) + 1) / 2;
}
+7 -3
View File
@@ -1,6 +1,7 @@
#version 430
#extension GL_EXT_gpu_shader4 : enable
uniform int MipMapLevel;
layout (binding = 0) uniform sampler2D Texture;
in VertexData{
@@ -14,11 +15,14 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01
void main()
{
vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
vec3 result = textureLod(Texture, Input.TextureCoordinate, MipMapLevel).rgb * weight[0];
//vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
for(int i = 1; i < 5; ++i) {
result += texture(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
result += texture(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
result += textureLod(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0), MipMapLevel).rgb * weight[i];
result += textureLod(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0), MipMapLevel).rgb * weight[i];
//result += texture(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
//result += texture(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
}
fragmentColor = vec4(result, 1.0);
}
+7 -3
View File
@@ -1,6 +1,7 @@
#version 430
#extension GL_EXT_gpu_shader4 : enable
uniform int MipMapLevel;
layout (binding = 0) uniform sampler2D Texture;
in VertexData{
@@ -14,11 +15,14 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01
void main()
{
vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
//vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
vec3 result = textureLod(Texture, Input.TextureCoordinate, MipMapLevel).rgb * weight[0];
for(int i = 1; i < 5; ++i) {
result += texture(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i)).rgb * weight[i];
result += texture(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i)).rgb * weight[i];
result += textureLod(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i), MipMapLevel).rgb * weight[i];
result += textureLod(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i), MipMapLevel).rgb * weight[i];
//result += texture(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i)).rgb * weight[i];
//result += texture(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i)).rgb * weight[i];
}
fragmentColor = vec4(result, 1.0);
}
+15
View File
@@ -0,0 +1,15 @@
#version 430
in VertexData{
vec3 Position;
}Input;
out vec4 fragmentColor;
void main()
{
fragmentColor = vec4(0.5, 0.0, 0.0, 0.0);
}
+19
View File
@@ -0,0 +1,19 @@
#version 430
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
layout(location = 0) in vec3 Position;
out VertexData{
vec3 Position;
}Output;
void main()
{
gl_Position = P * V * M * vec4(Position, 1.0);
Output.Position = Position;
}
@@ -0,0 +1,21 @@
#version 430
layout (binding = 0) uniform sampler2D Texture0;
layout (binding = 1) uniform sampler2D Texture1;
in VertexData{
vec2 TextureCoordinate;
}Input;
out vec4 fragmentColor;
void main()
{
vec4 texel0 = texture(Texture0, Input.TextureCoordinate);
vec4 texel1 = texture(Texture1, Input.TextureCoordinate);
fragmentColor = texel0 + texel1;
//fragmentColor = vec4(1,0.5,0.7,1);
}
@@ -0,0 +1,13 @@
#version 430
layout (location = 0) in vec3 Position;
out VertexData{
vec2 TextureCoordinate;
}Output;
void main()
{
gl_Position = vec4(Position, 1.0);
Output.TextureCoordinate = (vec2(Position) + 1) / 2;
}
+391 -66
View File
@@ -4,6 +4,7 @@
#include "Engine/GLM.h"
#include "Core/World.h"
#include "Rendering/Model.h"
#include "imgui/imgui.h"
namespace Collision
{
@@ -116,36 +117,79 @@ bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation)
return glm::all(axisesIntersecting);
}
bool RayVsTriangle(const Ray& ray,
const glm::vec3& v0,
const glm::vec3& v1,
const glm::vec3& v2,
bool trueOnNegativeDistance)
{
glm::vec3 e1 = v1 - v0; //v1 - v0
glm::vec3 e2 = v2 - v0; //v2 - v0
glm::vec3 m = ray.Origin() - v0;
glm::vec3 MxE1 = glm::cross(m, e1);
glm::vec3 DxE2 = glm::cross(ray.Direction(), e2);
float DetInv = glm::dot(e1, DxE2);
if (std::abs(DetInv) < FLT_EPSILON) {
return false;
}
DetInv = 1.0f / DetInv;
float u = glm::dot(m, DxE2) * DetInv;
float v = glm::dot(ray.Direction(), MxE1) * DetInv;
//u,v can be very close to 0 but still negative sometimes. added a deltafactor to compensate for that problem
if ((u + 0.001f) < 0 || (v + 0.001f) < 0 || 1 < u + v) {
return false;
}
//Here, u and v are positive, u+v <= 1, and if distance is positive - triangle is hit.
return trueOnNegativeDistance || 0 <= glm::dot(e2, MxE1) * DetInv;
}
bool RayVsModel(const Ray& ray,
const std::vector<RawModel::Vertex>& modelVertices,
const std::vector<unsigned int>& modelIndices)
{
for (int i = 0; i < modelIndices.size(); ++i) {
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
glm::vec3 e1 = modelVertices[modelIndices[++i]].Position - v0; //v1 - v0
glm::vec3 e2 = modelVertices[modelIndices[++i]].Position - v0; //v2 - v0
glm::vec3 m = ray.Origin() - v0;
glm::vec3 MxE1 = glm::cross(m, e1);
glm::vec3 DxE2 = glm::cross(ray.Direction(), e2);
float DetInv = glm::dot(e1, DxE2);
if (std::abs(DetInv) < FLT_EPSILON) {
continue;
}
DetInv = 1.0f / DetInv;
float u = glm::dot(m, DxE2) * DetInv;
float v = glm::dot(ray.Direction(), MxE1) * DetInv;
//u,v can be very close to 0 but still negative sometimes. added a deltafactor to compensate for that problem
if ((u + 0.001f) < 0 || (v + 0.001f) < 0 || 1 < u + v) {
continue;
}
//Here, u and v are positive, u+v <= 1, and if distance is positive - triangle is hit.
if (0 <= glm::dot(e2, MxE1) * DetInv) {
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
if (RayVsTriangle(ray, v0, v1, v2)) {
return true;
}
}
return false;
}
bool RayVsTriangle(const Ray& ray,
const glm::vec3& v0,
const glm::vec3& v1,
const glm::vec3& v2,
float& outDistance,
float& outUCoord,
float& outVCoord,
bool trueOnNegativeDistance)
{
glm::vec3 e1 = v1 - v0; //v1 - v0
glm::vec3 e2 = v2 - v0; //v2 - v0
glm::vec3 m = ray.Origin() - v0;
glm::vec3 MxE1 = glm::cross(m, e1);
glm::vec3 DxE2 = glm::cross(ray.Direction(), e2);//pVec
float DetInv = glm::dot(e1, DxE2);
if (std::abs(DetInv) < FLT_EPSILON) {
return false;
}
DetInv = 1.0f / DetInv;
float dist = glm::dot(e2, MxE1) * DetInv;
if (dist >= outDistance) {
return false;
}
outDistance = dist;
outUCoord = glm::dot(m, DxE2) * DetInv;
outVCoord = glm::dot(ray.Direction(), MxE1) * DetInv;
//u,v can be very close to 0 but still negative sometimes. added a deltafactor to compensate for that problem
//If u and v are positive, u+v <= 1, dist is positive, and less than closest.
return (0 <= (outUCoord + 0.001f) && 0 <= (outVCoord + 0.001f) && outUCoord + outVCoord <= 1 && (trueOnNegativeDistance || 0 <= dist));
}
bool RayVsModel(const Ray& ray,
const std::vector<RawModel::Vertex>& modelVertices,
const std::vector<unsigned int>& modelIndices,
@@ -157,26 +201,12 @@ bool RayVsModel(const Ray& ray,
bool hit = false;
for (int i = 0; i < modelIndices.size(); ++i) {
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
glm::vec3 e1 = modelVertices[modelIndices[++i]].Position - v0; //v1 - v0
glm::vec3 e2 = modelVertices[modelIndices[++i]].Position - v0; //v2 - v0
glm::vec3 m = ray.Origin() - v0;
glm::vec3 MxE1 = glm::cross(m, e1);
glm::vec3 DxE2 = glm::cross(ray.Direction(), e2);//pVec
float DetInv = glm::dot(e1, DxE2);
if (std::abs(DetInv) < FLT_EPSILON) {
continue;
}
DetInv = 1.0f / DetInv;
float dist = glm::dot(e2, MxE1) * DetInv;
if (dist >= outDistance) {
continue;
}
float u = glm::dot(m, DxE2) * DetInv;
float v = glm::dot(ray.Direction(), MxE1) * DetInv;
//u,v can be very close to 0 but still negative sometimes. added a deltafactor to compensate for that problem
//If u and v are positive, u+v <= 1, dist is positive, and less than closest.
if (0 <= (u + 0.001f) && 0 <= (v + 0.001f) && u + v <= 1 && 0 <= dist) {
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
float dist;
float u;
float v;
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
outDistance = dist;
outUCoord = u;
outVCoord = v;
@@ -199,43 +229,338 @@ bool RayVsModel(const Ray& ray,
return hit;
}
bool AABBvsTriangles(const AABB& box, const std::vector<RawModel::Vertex>& modelVertices, const std::vector<unsigned int>& modelIndices, const glm::mat4& modelMatrix, glm::vec3& outResolutionVector)
constexpr inline int signNonZero(float x)
{
bool hit = false;
return x < 0 ? -1 : 1;
}
inline glm::vec3 signNonZero(const glm::vec3& x)
{
glm::vec3 r;
for (int i = 0; i < 3; ++i) {
r[i] = (float)signNonZero(x[i]);
}
return r;
}
template<typename T>
bool vectorHasLength(const T& vec)
{
return glm::any(glm::greaterThan(glm::abs(vec), T(0.0001f)));
}
bool rectangleVsTriangle(const glm::vec2& boxMin,
const glm::vec2& boxMax,
const std::array<glm::vec2, 3>& triPos,
glm::vec2& resolutionDirection,
float& resolutionDistanceSq,
bool& pushedFromTriNormal)
{
pushedFromTriNormal = false;
resolutionDistanceSq = INFINITY;
//Project along box normals (coordinate axes, since it's axis-aligned).
for (int ax = 0; ax < 2; ++ax) {
float minTri = INFINITY;
float maxTri = -INFINITY;
for (const glm::vec2& t : triPos) {
minTri = std::min(t[ax], minTri);
maxTri = std::max(t[ax], maxTri);
}
if (boxMax[ax] <= minTri || maxTri <= boxMin[ax]) {
return false;
}
//Here: maxBox > minTri && minBox < maxTri
//Left is negative.
float leftRes = minTri - boxMax[ax];
float rightRes = maxTri - boxMin[ax];
float push = rightRes < -leftRes ? rightRes : leftRes;
float absPushSq = abs(push);
absPushSq *= absPushSq;
if (absPushSq < resolutionDistanceSq) {
resolutionDistanceSq = absPushSq;
resolutionDirection[1 - ax] = 0.f;
resolutionDirection[ax] = push;
}
}
//Project along triangle normals.
//Put edges into normal vector, make normals in the loop.
std::array<glm::vec2, 3> triNormals = {
triPos[1] - triPos[0],
triPos[2] - triPos[1],
triPos[0] - triPos[2]
};
std::array<glm::vec2, 4> boxPos = {
boxMax,
glm::vec2(boxMax.x, boxMin.y),
glm::vec2(boxMin.x, boxMax.y),
boxMin
};
for (auto& normal : triNormals) {
if (!vectorHasLength(normal)) {
continue;
}
//Rotate edge to a normal.
normal = glm::normalize(glm::vec2(-normal.y, normal.x));
//Project triangle onto the normal.
float minTri = INFINITY;
float maxTri = -INFINITY;
for (const glm::vec2& point : triPos) {
float dot = glm::dot(normal, point);
minTri = std::min(dot, minTri);
maxTri = std::max(dot, maxTri);
}
//Project box onto the normal.
float minBox = INFINITY;
float maxBox = -INFINITY;
for (const glm::vec2& point : boxPos) {
float dot = glm::dot(normal, point);
minBox = std::min(dot, minBox);
maxBox = std::max(dot, maxBox);
}
if (maxBox <= minTri || maxTri <= minBox) {
return false;
}
//Here: maxBox > minTri && minBox < maxTri
//Left is negative.
float leftRes = minTri - maxBox;
float rightRes = maxTri - minBox;
float push = rightRes < -leftRes ? rightRes : leftRes;
float absPushSq = abs(push);
absPushSq *= absPushSq;
if (absPushSq < resolutionDistanceSq) {
resolutionDistanceSq = absPushSq;
resolutionDirection = push * normal;
pushedFromTriNormal = true;
}
}
return true;
}
constexpr float SlopeConstant(float degrees)
{
return (1.0f - degrees / 90.f);
}
//Returns true if the angle between horizon and the collision surface is less than 45 degrees.
constexpr bool FaceIsGround(float faceNormalY)
{
//TODO: Perhaps the 45 degrees could be saved in a component or in the config..
return faceNormalY > SlopeConstant(45.0f);
}
//An array containing 3 int pairs { 0, 2 }, { 0, 1 }, { 1, 2 }
constexpr std::array<std::pair<int, int>, 3> dimensionPairs({ std::pair<int, int>(0, 2), std::pair<int, int>(0, 1), std::pair<int, int>(1, 2) });
bool AABBvsTriangle(const AABB& box,
const std::array<glm::vec3, 3>& triPos,
const glm::vec3& originalBoxVelocity,
float verticalStepHeight,
bool& isOnGround,
glm::vec3& boxVelocity,
glm::vec3& outResolution)
{
//Check so we don't have a zero area triangle when calculating the normal.
//Also, don't check a triangle facing away from the player.
//Less checks, and we should be able to walk out from models if we are trapped inside.
glm::vec3 triNormal = glm::cross(triPos[1] - triPos[0], triPos[2] - triPos[0]);
if (!vectorHasLength(triNormal) || (glm::dot(triNormal, originalBoxVelocity) > 0)) {
return false;
}
triNormal = glm::normalize(triNormal);
enum BoxTriResolveCase
{
ResolveDimX,
ResolveDimY,
ResolveDimZ,
Line, //Box edge colliding with triangle line.
Corner //Box corner colliding with the triangle face.
};
struct Resolution
{
Resolution()
: DistanceSq(INFINITY)
, Vector(0.f)
{}
BoxTriResolveCase Case;
float DistanceSq;
glm::vec3 Vector;
};
//The smallest resolution that solves the collision.
Resolution resolveShortest;
//The smallest resolution that solves the collision, that resolves upwards.
Resolution resolveUpwards;
//If player stands on the ground and collides with a ground triangle,
//we might step up onto it if the step is small enough.
bool canStairStepUp = isOnGround && FaceIsGround(triNormal.y);
const glm::vec3& origin = box.Origin();
const glm::vec3& half = box.HalfSize();
const glm::vec3& min = box.MinCorner();
const glm::vec3& max = box.MaxCorner();
outResolutionVector.x = INFINITY;
for (int i = 0; i < modelIndices.size(); ++i) {
glm::vec3 p = modelVertices[i].Position;
p = glm::vec3(modelMatrix * glm::vec4(p.x, p.y, p.z, 1));
float distFromOrigin = glm::abs(origin.x - p.x);
float penetration = box.HalfSize().x - distFromOrigin;
if (penetration > 0 && penetration < glm::abs(outResolutionVector.x)) {
if (p.x > origin.x) {
outResolutionVector.x = -penetration;
} else {
outResolutionVector.x = penetration;
//For each projection in xy-, xz-, and yx-planes.
for (std::pair<int, int> dim : dimensionPairs) {
//2D Triangle.
//Project triangle.
std::array<glm::vec2, 3> t2D = {
glm::vec2(triPos[0][dim.first], triPos[0][dim.second]),
glm::vec2(triPos[1][dim.first], triPos[1][dim.second]),
glm::vec2(triPos[2][dim.first], triPos[2][dim.second])
};
//Project box.
glm::vec2 boxMin(min[dim.first], min[dim.second]);
glm::vec2 boxMax(max[dim.first], max[dim.second]);
glm::vec2 resolutionVector;
float resolutionDist;
bool pushedFromTriangleLine;
//if projections don't overlap, return false.
if (!rectangleVsTriangle(boxMin, boxMax, t2D, resolutionVector, resolutionDist, pushedFromTriangleLine)) {
return false;
} else {
//Overwrite the smallest resolution if this is smaller.
if (resolutionDist < resolveShortest.DistanceSq) {
resolveShortest.Vector = glm::vec3(0.f);
resolveShortest.Vector[dim.first] = resolutionVector.x;
resolveShortest.Vector[dim.second] = resolutionVector.y;
resolveShortest.DistanceSq = resolutionDist;
//If we pushed away from triangle line (edge), or if we
//move the player along one coordinate axis (pick the dimension that isn't zero).
resolveShortest.Case = pushedFromTriangleLine ? Line : static_cast<BoxTriResolveCase>((abs(resolveShortest.Vector[dim.first]) < 0.0001f) ? dim.second : dim.first);
}
//Overwrite the smallest upward resolution if this is smaller, and resolves upwards.
constexpr int yAxis = 1;
bool resIsUpwardsIn3D = dim.first == yAxis && resolutionVector.x > 0 || dim.second == yAxis && resolutionVector.y > 0;
if (canStairStepUp && resIsUpwardsIn3D && resolutionDist < resolveUpwards.DistanceSq) {
resolveUpwards.Vector = glm::vec3(0.f);
resolveUpwards.Vector[dim.first] = resolutionVector.x;
resolveUpwards.Vector[dim.second] = resolutionVector.y;
resolveUpwards.DistanceSq = resolutionDist;
//If we pushed away from triangle line (edge), or if we
//move the player along one coordinate axis (pick the dimension that isn't zero).
resolveUpwards.Case = pushedFromTriangleLine ? Line : static_cast<BoxTriResolveCase>((abs(resolveUpwards.Vector[dim.first]) < 0.0001f) ? dim.second : dim.first);
}
hit = true;
}
//glm::vec3 pLocal = origin - p;
//for (int axis = 0; axis < 3; ++axis) {
// if (p[axis] < min[axis] || p[axis] > max[axis]) {
// continue;
// }
// if (glm::abs(pLocal[axis]) < box.HalfSize()[axis]) {
// outResolutionVector[axis] = (glm::sign(pLocal[axis]) * box.HalfSize()[axis]) - pLocal[axis];
// hit = true;
// }
//}
}
//If the triangle does intersect any of the cube diagonals, it will
//intersect the cube diagonal that comes
//closest to being perpendicular to the plane of the triangle.
glm::vec3 diagonal = signNonZero(triNormal) * half;
//The triangle plane contains all points P in dot(triNormal, P) == dot(triNormal, v0)
//The diagonal line contains all points P in P = origin + diagonal * t.
float t = glm::dot(triNormal, triPos[0] - origin) / glm::dot(triNormal, diagonal);
//If intersection point between plane and diagonal is within the box.
if (glm::abs(t) > 1) {
return false;
}
glm::vec3 cornerResolution = (1+t) * diagonal;
//Overwrite the smallest resolution if cornerResolution is smaller.
float lenSq = glm::length2(cornerResolution);
if (lenSq < resolveShortest.DistanceSq) {
resolveShortest.Vector = cornerResolution;
resolveShortest.Case = Corner;
}
if (canStairStepUp && cornerResolution.y > 0 && lenSq < resolveUpwards.DistanceSq) {
resolveUpwards.Vector = cornerResolution;
resolveUpwards.Case = Corner;
resolveUpwards.DistanceSq = lenSq;
}
//Force the resolution upwards if it is smaller than the threshold verticalStepHeight.
//Else take the shortest resolution.
bool takeUp = resolveUpwards.Vector.y > 0 && resolveUpwards.Vector.y < verticalStepHeight;
Resolution& bestResolve = takeUp ? resolveUpwards : resolveShortest;
outResolution = bestResolve.Vector;
glm::vec3 projNorm;
switch (bestResolve.Case) {
case ResolveDimY:
boxVelocity.y = 0.f;
if (outResolution.y > 0)
isOnGround = true;
case ResolveDimX:
case ResolveDimZ:
//If we get here, the resolution is along one coordinate axis.
//set velocity to 0 in y if it is along y-axis.
return true;
case Line:
projNorm = glm::normalize(outResolution);
break;
case Corner:
projNorm = triNormal;
break;
default:
break;
}
//If the collision was not on steep wall or similarly (e.g. walking on the ground), force resolution in y only.
if (FaceIsGround(projNorm.y)) {
//Ensure that the player always is moved upwards, instead of sliding down.
float len = glm::length(outResolution);
float ang = glm::half_pi<float>() - glm::acos(outResolution.y / len);
if (len > 0.0000001f && ang > 0.0000001f) {
outResolution.x = 0;
outResolution.y = len / glm::sin(ang);
outResolution.z = 0;
}
//Also zero the vertical velocity, if it is positive, else project it onto the normal.
//Project the velocity onto the normal of the hit line/face.
//w = v - <v,n>*n, |n|==1.
boxVelocity.y = std::min(boxVelocity.y - glm::dot(boxVelocity, projNorm) * projNorm.y, 0.f);
isOnGround = true;
} else {
//Enter here if the triangle is a steep slope, and it is not facing downwards.
//Project the velocity onto the normal of the hit line/face.
//w = v - <v,n>*n, |n|==1.
//"ice cream"-effect, air resistance + projected velocity.
if (!isOnGround) {
boxVelocity = boxVelocity - glm::dot(boxVelocity, projNorm) * projNorm;
}
}
return true;
}
bool AABBvsTriangles(const AABB& box,
const std::vector<RawModel::Vertex>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& boxVelocity,
float verticalStepHeight,
bool& isOnGround,
glm::vec3& outResolutionVector)
{
bool hit = false;
bool everHitTheGround = false;
AABB newBox = box;
outResolutionVector = glm::vec3(0.f);
glm::vec3 originalBoxVelocity(boxVelocity);
for (int i = 0; i < modelIndices.size(); ) {
std::array<glm::vec3, 3> triVertices = {
Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix),
Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix),
Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix)
};
glm::vec3 outVec;
bool collideWithGround = isOnGround;
if (AABBvsTriangle(newBox, triVertices, originalBoxVelocity, verticalStepHeight, collideWithGround, boxVelocity, outVec)) {
hit = true;
outResolutionVector += outVec;
newBox = AABB::FromOriginSize(newBox.Origin() + outVec, newBox.Size());
if (collideWithGround) {
everHitTheGround = isOnGround = true;
}
}
}
if (!everHitTheGround) {
isOnGround = false;
}
return hit;
}
+27 -25
View File
@@ -1,6 +1,7 @@
#include "Collision/Collision.h"
#include "Collision/CollisionSystem.h"
#include "Core/AABB.h"
#include "Rendering/Model.h"
void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
@@ -25,33 +26,34 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
continue;
}
if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
if (boxB.Entity.HasComponent("Model") && Collision::AABBVsAABB(boxA, boxB)) {
//Here we know boxB is a entity with Collideable, AABB, and Model.
RawModel* model;
try {
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
} catch (const std::exception&) {
continue;
}
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
bool isOnGround = (bool)cPhysics["IsOnGround"];
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
if (Collision::AABBvsTriangles(boxA, model->m_Vertices, model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
(glm::vec3&)cTransform["Position"] += resolutionVector;
cPhysics["Velocity"] = inOutVelocity;
(bool)cPhysics["IsOnGround"] = isOnGround;
} else {
(bool)cPhysics["IsOnGround"] = false;
}
} else if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
//Enter here if boxB has no Model.
(glm::vec3&)cTransform["Position"] += resolutionVector;
if (resolutionVector.y > 0) {
(bool)cPhysics["IsOnGround"] = resolutionVector.y > 0;
if ((bool)cPhysics["IsOnGround"]){
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
}
}
}
// HACK: Temporarily collide against all collidable models since they're not in the octree yet
//auto otherCollidables = world->GetComponents("Model");
//for (auto& cModel : *otherCollidables) {
// if (cModel.EntityID == entity) {
// continue;
// }
// if (!world->HasComponent(cModel.EntityID, "Collidable")) {
// continue;
// }
// auto absPosition = RenderQueueFactory::AbsolutePosition(world, cModel.EntityID);
// auto absOrientation = RenderQueueFactory::AbsoluteOrientation(world, cModel.EntityID);
// auto absScale = RenderQueueFactory::AbsoluteScale(world, cModel.EntityID);
// glm::mat4 modelMatrix = glm::translate(absPosition); // *glm::toMat4(absOrientation) * glm::scale(absScale);
// auto model = ResourceManager::Load<Model>(cModel["Resource"]);
// glm::vec3 resolutionVector;
// if (Collision::AABBvsTriangles(boxA, model->m_Vertices, model->m_Indices, modelMatrix, resolutionVector)) {
// (glm::vec3&)cTransform["Position"] += resolutionVector;
// }
//}
}
}
+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, 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;
}
+2 -2
View File
@@ -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) },
+1 -1
View File
@@ -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) {
+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)];
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;
-5
View File
@@ -275,9 +275,4 @@ std::vector<int> Child::childIndicesContainingBox(const AABB& box) const
}
}
bool Child::hasChildren() const
{
return m_Children[0] != nullptr;
}
}
+4
View File
@@ -97,3 +97,7 @@ glm::mat4 Transform::ModelMatrix(EntityID entity, World* world)
return modelMatrix;
}
glm::vec3 Transform::TransformPoint(const glm::vec3& point, const glm::mat4& matrix)
{
return glm::vec3(matrix * glm::vec4(point.x, point.y, point.z, 1));
}
+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((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),

Some files were not shown because too many files have changed in this diff Show More