Merge remote-tracking branch 'origin/master' into TCPConnections

This commit is contained in:
Jocke
2016-02-03 10:29:36 +01:00
127 changed files with 3135 additions and 690 deletions
+9
View File
@@ -14,6 +14,9 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
#set(BUILD_SHARED_LIBS FALSE)
@@ -34,6 +37,12 @@ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
# DEBUG definition
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:RelWithDebInfo>:DEBUG>
)
include(cotire)
add_subdirectory(src/Engine)
add_subdirectory(src/Game)
+1 -1
Submodule assets updated: 068fbb2d20...091ad5c01b
@@ -4,13 +4,14 @@
#include "../Core/System.h"
#include "../Core/Octree.h"
#include "Collision.h"
#include "EntityAABB.h"
class CollidableOctreeSystem : public ImpureSystem, public PureSystem
{
public:
CollidableOctreeSystem(World* world, EventBroker* eventBroker, Octree<AABB>* octree)
CollidableOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree, const std::string& componentType)
: System(world, eventBroker)
, PureSystem("Collidable")
, PureSystem(componentType)
, m_Octree(octree)
{ }
@@ -18,7 +19,7 @@ public:
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
private:
Octree<AABB>* m_Octree;
Octree<EntityAABB>* m_Octree;
};
#endif
+2 -2
View File
@@ -15,6 +15,7 @@
#include "../Core/Transform.h"
#include "../Core/Entity.h"
#include "../Core/EntityWrapper.h"
#include "EntityAABB.h"
class World;
struct ComponentWrapper;
@@ -58,10 +59,9 @@ bool AABBVsAABB(const AABB& a, const AABB& b);
//Return true if the boxes are intersecting.
//Also outputs the minimum translation that box [a] would need in order to resolve collision.
bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
bool IsSameBoxProbably(const AABB& first, const AABB& second, const float epsilon = 0.0001f);
// Calculates an absolute AABB from an entity AABB component
boost::optional<AABB> EntityAbsoluteAABB(EntityWrapper& entity);
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity);
}
+5 -12
View File
@@ -7,30 +7,23 @@
#include "../Common.h"
#include "../Core/System.h"
#include "../Core/EventBroker.h"
#include "../Core/EKeyUp.h"
#include "../Core/Octree.h"
#include "EntityAABB.h"
class CollisionSystem : public PureSystem
{
public:
CollisionSystem(World* world, EventBroker* eventBroker, Octree<AABB>* octree)
CollisionSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
: System(world, eventBroker)
, PureSystem("Collidable")
, m_Octree(octree)
, zPress(false)
{
//TODO: Debug stuff, remove later.
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &CollisionSystem::OnKeyUp);
}
{ }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
private:
Octree<AABB>* m_Octree;
bool zPress;
EventRelay<CollisionSystem, Events::KeyUp> m_EKeyUp;
bool OnKeyUp(const Events::KeyUp &event);
Octree<EntityAABB>* m_Octree;
std::vector<EntityAABB> m_OctreeResult;
};
#endif
+7 -7
View File
@@ -2,7 +2,7 @@
#define Events_TriggerEnter_h__
#include "../Core/EventBroker.h"
#include "../Core/Entity.h"
#include "../Core/EntityWrapper.h"
namespace Events
{
@@ -11,27 +11,27 @@ namespace Events
struct TriggerTouch : Event
{
/** The id of the entity that touches the trigger. */
EntityID Entity;
EntityWrapper Entity;
/** The id of the trigger entity. */
EntityID Trigger;
EntityWrapper Trigger;
};
/** Thrown once, when an entity has completely left a trigger. */
struct TriggerLeave : Event
{
/** The id of the entity that left the trigger. */
EntityID Entity;
EntityWrapper Entity;
/** The id of the trigger entity. */
EntityID Trigger;
EntityWrapper Trigger;
};
/** Thrown once, when an entity is completely contained inside a trigger. */
struct TriggerEnter : Event
{
/** The id of the entity that entered the trigger. */
EntityID Entity;
EntityWrapper Entity;
/** The id of the trigger entity. */
EntityID Trigger;
EntityWrapper Trigger;
};
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef EntityAABB_h__
#define EntityAABB_h__
#include "../Core/AABB.h"
#include "../Core/EntityWrapper.h"
struct EntityAABB : AABB
{
EntityAABB() = default;
EntityAABB(const glm::vec3& minPos, const glm::vec3& maxPos)
: AABB(minPos, maxPos)
{ }
EntityAABB(const AABB& aabb)
: AABB(aabb)
{ }
EntityWrapper Entity;
};
#endif
+10 -8
View File
@@ -8,13 +8,14 @@
#include "../Core/EventBroker.h"
#include "../Core/Octree.h"
#include "ETrigger.h"
#include "EntityAABB.h"
class AABB;
class TriggerSystem : public PureSystem
{
public:
TriggerSystem(World* world, EventBroker* eventBroker, Octree<AABB>* octree)
TriggerSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
: System(world, eventBroker)
, PureSystem("Trigger")
, m_Octree(octree)
@@ -27,9 +28,10 @@ public:
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
private:
Octree<AABB>* m_Octree;
std::unordered_map<EntityID, std::unordered_set<EntityID>> m_EntitiesTouchingTrigger;
std::unordered_map<EntityID, std::unordered_set<EntityID>> m_EntitiesCompletelyInTrigger;
Octree<EntityAABB>* m_Octree;
std::vector<EntityAABB> m_OctreeOut;
std::unordered_map<EntityWrapper, std::unordered_set<EntityWrapper>> m_EntitiesTouchingTrigger;
std::unordered_map<EntityWrapper, std::unordered_set<EntityWrapper>> m_EntitiesCompletelyInTrigger;
//TODO: Only exists for debug purposes, remove later.
EventRelay<TriggerSystem, Events::TriggerEnter> m_EEnter;
@@ -40,13 +42,13 @@ private:
bool OnLeave(const Events::TriggerLeave &event);
//True if leave event was thrown.
bool throwLeaveIfWasInTrigger(std::unordered_set<EntityID>& triggerSet, EntityID pId, EntityID tId);
bool throwLeaveIfWasInTrigger(std::unordered_set<EntityWrapper>& triggerSet, EntityWrapper colliderENtity, EntityWrapper triggerEntity);
template<typename Event>
void publish(EntityID pId, EntityID tId)
void publish(EntityWrapper collider, EntityWrapper trigger)
{
Event e;
e.Trigger = tId;
e.Entity = pId;
e.Trigger = trigger;
e.Entity = collider;
m_EventBroker->Publish(e);
}
};
+1
View File
@@ -5,6 +5,7 @@
#include <map>
#include <unordered_map>
#include <algorithm>
#include <array>
#include "Core/Util/Logging.h"
#include "Core/Util/IfDebug.h"
-1
View File
@@ -9,7 +9,6 @@ public:
AABB() = default;
//No checks are made. Values in minPos must be less than values in maxPos, i.e. min.x < max.x, etc.
AABB(const glm::vec3& minPos, const glm::vec3& maxPos);
AABB(const glm::vec4& minPos, const glm::vec4& maxPos);
//No checks are made. Size must consist of non-negative numbers.
static AABB FromOriginSize(const glm::vec3& origin, const glm::vec3& size);
virtual ~AABB();
+1 -1
View File
@@ -81,7 +81,7 @@ class ComponentWrapperFactory
{
public:
ComponentWrapperFactory() = default;
ComponentWrapperFactory(std::string componentTypeName, std::size_t allocation = 0)
ComponentWrapperFactory(std::string componentTypeName, unsigned int allocation = 0)
{
m_ComponentInfo.Name = componentTypeName;
m_ComponentInfo.Meta->Allocation = allocation;
+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);
+4 -1
View File
@@ -23,6 +23,7 @@ struct EntityWrapper
static const EntityWrapper Invalid;
const std::string Name();
bool HasComponent(const std::string& componentType);
EntityWrapper Parent();
EntityWrapper FirstChildByName(const std::string& name);
@@ -34,7 +35,9 @@ struct EntityWrapper
bool operator==(const EntityWrapper& e) const;
bool operator!=(const EntityWrapper& e) const;
explicit operator EntityID() const;
operator bool();
private:
EntityWrapper firstChildByNameRecursive(const std::string& name, EntityID parent);
};
namespace std
+2
View File
@@ -8,8 +8,10 @@
namespace Transform
{
glm::mat4 AbsoluteTransformation(EntityWrapper entity);
glm::vec3 AbsolutePosition(EntityWrapper entity);
glm::vec3 AbsolutePosition(World* world, EntityID entity);
glm::vec3 AbsoluteOrientationEuler(EntityWrapper entity);
glm::quat AbsoluteOrientation(EntityWrapper entity);
glm::quat AbsoluteOrientation(World* world, EntityID entity);
glm::vec3 AbsoluteScale(EntityWrapper entity);
+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;
};
+6 -34
View File
@@ -29,41 +29,9 @@ enum _LOG_LEVEL
extern _LOG_LEVEL LOG_LEVEL;
const static char* _LOG_LEVEL_PREFIX[] =
{
"EE: ",
"",
"WW: ",
"DD: "
};
extern const char* _LOG_LEVEL_PREFIX[];
static void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int line, const char* format, ...)
{
if (logLevel > LOG_LEVEL) {
return;
}
char* message = nullptr;
va_list args;
va_start(args, format);
size_t size = vsnprintf(message, 0, format, args) + 1;
va_end(args);
va_start(args, format);
message = new char[size];
vsnprintf(message, size, format, args);
va_end(args);
if (logLevel == LOG_LEVEL_ERROR) {
std::cerr << file << ":" << line << " " << func << std::endl;
std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} else {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
}
delete[] message;
}
extern void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int line, const char* format, ...);
#define LOG(logLevel, format, ...) \
_LOG(logLevel, __BASE_FILE__, __func__, __LINE__, format, ##__VA_ARGS__)
@@ -77,7 +45,11 @@ static void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsign
#define LOG_INFO(format, ...) \
LOG(LOG_LEVEL_INFO, format, ##__VA_ARGS__)
#ifdef DEBUG
#define LOG_DEBUG(format, ...) \
LOG(LOG_LEVEL_DEBUG, format, ##__VA_ARGS__)
#else
#define LOG_DEBUG(format, ...)
#endif
#endif // Logging_h__
@@ -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;
+30
View File
@@ -7,6 +7,7 @@
#include <nativefiledialog/nfd.h>
#include <boost/filesystem.hpp>
#include <boost/any.hpp>
#include <boost/algorithm/string/replace.hpp>
#include "../Common.h"
#include "../GLM.h"
#include <glm/gtx/common.hpp>
@@ -18,6 +19,8 @@
#include "../Core/ResourceManager.h"
#include "../Core/EPause.h"
#include "../Core/EKeyDown.h"
#include "../Core/ELockMouse.h"
#include "../Core/EFileDropped.h"
#include "../Rendering/Texture.h"
class EditorGUI
@@ -32,6 +35,12 @@ public:
Scale
};
enum class WidgetSpace
{
Global,
Local
};
void Draw();
void SelectEntity(EntityWrapper entity);
@@ -73,6 +82,9 @@ public:
// Called when the user selects a widget mode.
typedef std::function<void(WidgetMode)> OnWidgetMode_t;
void SetWidgetModeCallback(OnWidgetMode_t f) { m_OnWidgetMode = f; }
// Called when the user selects a widget space.
typedef std::function<void(WidgetSpace)> OnWidgetSpace_t;
void SetWidgetSpaceCallback(OnWidgetSpace_t f) { m_OnWidgetSpace = f; }
private:
World* m_World;
@@ -93,8 +105,12 @@ private:
EntityWrapper m_CurrentlyDragging = EntityWrapper::Invalid;
std::string m_LastErrorMessage;
WidgetMode m_CurrentWidgetMode = WidgetMode::Translate;
WidgetSpace m_CurrentWidgetSpace = WidgetSpace::Global;
std::set<std::string> m_ModalsToOpen;
std::map<std::string, boost::any> m_ModalData;
std::string m_DroppedFile = "";
bool m_Paused = false;
bool m_MouseLocked = false;
// Callbacks
OnEntitySelectedCallback_t m_OnEntitySelected = nullptr;
@@ -107,10 +123,21 @@ private:
OnComponentAttach_t m_OnComponentAttach = nullptr;
OnComponentDelete_t m_OnComponentDelete = nullptr;
OnWidgetMode_t m_OnWidgetMode = nullptr;
OnWidgetSpace_t m_OnWidgetSpace = nullptr;
// Events
EventRelay<EditorGUI, Events::KeyDown> m_EKeyDown;
bool OnKeyDown(const Events::KeyDown& e);
EventRelay<EditorGUI, Events::FileDropped> m_EFileDropped;
bool OnFileDropped(const Events::FileDropped& e);
EventRelay<EditorGUI, Events::Pause> m_EPause;
bool OnPause(const Events::Pause& e);
EventRelay<EditorGUI, Events::Resume> m_EResume;
bool OnResume(const Events::Resume& e);
EventRelay<EditorGUI, Events::LockMouse> m_ELockMouse;
bool OnLockMouse(const Events::LockMouse& e);
EventRelay<EditorGUI, Events::UnlockMouse> m_EUnlockMouse;
bool OnUnlockMouse(const Events::UnlockMouse& e);
// Utility functions
boost::filesystem::path fileOpenDialog();
@@ -118,6 +145,9 @@ private:
const std::string formatEntityName(EntityWrapper entity);
GLuint tryLoadTexture(std::string filePath);
void openModal(const std::string& modal);
void setWidgetMode(WidgetMode mode);
void toggleWidgetSpace();
static bool compareCharArray(const char* c1, const char* c2);
// Entity file handling methods
void entityImport(World* world);
+2
View File
@@ -41,6 +41,7 @@ private:
double m_LastTime = 0.f;
bool m_Enabled = true;
EditorGUI::WidgetMode m_WidgetMode = EditorGUI::WidgetMode::Translate;
EditorGUI::WidgetSpace m_WidgetSpace = EditorGUI::WidgetSpace::Global;
EntityWrapper m_Widget = EntityWrapper::Invalid;
EntityWrapper m_CurrentSelection = EntityWrapper::Invalid;
@@ -57,6 +58,7 @@ private:
void OnEntityChangeName(EntityWrapper entity, const std::string& name);
void OnComponentAttach(EntityWrapper entity, const std::string& componentType);
void OnComponentDelete(EntityWrapper entity, const std::string& componentType);
void OnWidgetSpace(EditorGUI::WidgetSpace widgetSpace);
// Events
EventRelay<EditorSystem, Events::MousePress> m_EMousePress;
+2
View File
@@ -2,6 +2,7 @@
#define Events_InputCommand_h__
#include "Core/EventBroker.h"
#include "Core/EntityWrapper.h"
namespace Events
{
@@ -10,6 +11,7 @@ struct InputCommand : Event
{
/** Numerical ID of the player. */
int PlayerID;
EntityWrapper Player;
/** The command that was sent. */
std::string Command;
/** The value of the command. */
@@ -15,7 +15,11 @@ public:
virtual const glm::vec3 Rotation() const { return m_Rotation; }
virtual bool Jumping() const { return m_Jumping; }
virtual bool Crouching() const { return m_Crouching; }
virtual bool DoubleJumping() const { return m_DoubleJumping; }
virtual void SetDoubleJumping(bool isDoubleJumping) {
m_DoubleJumping = isDoubleJumping;
}
void LockMouse();
void UnlockMouse();
virtual bool OnCommand(const Events::InputCommand& e) override;
@@ -27,8 +31,9 @@ protected:
glm::vec3 m_Rotation;
glm::vec3 m_Movement;
bool m_Jumping = false;
bool m_DoubleJumping = false;
bool m_Crouching = false;
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
bool OnLockMouse(const Events::LockMouse& e);
EventRelay<EventContext, Events::UnlockMouse> m_EUnlockMouse;
@@ -36,7 +41,7 @@ protected:
};
template <typename EventContext>
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
: InputController(eventBroker)
, m_PlayerID(playerID)
{
@@ -113,14 +118,14 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
template <typename EventContext>
bool FirstPersonInputController<EventContext>::OnUnlockMouse(const Events::UnlockMouse& e)
{
m_MouseLocked = false;
m_MouseLocked = false;
return true;
}
template <typename EventContext>
bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMouse& e)
{
m_MouseLocked = true;
m_MouseLocked = true;
return true;
}
+1 -1
View File
@@ -12,7 +12,7 @@
#include <fstream>
#include <iostream>
#define INPUTSIZE 4097
#define INPUTSIZE 32000
typedef unsigned int PlayerID;
typedef unsigned int PacketID;
+1
View File
@@ -34,6 +34,7 @@ private:
// Sending messages to client logic
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
// HACK: Fix INPUTSIZE
char readBuffer[INPUTSIZE] = { 0 };
int bytesRead = 0;
// time for previouse message
@@ -0,0 +1,29 @@
#ifndef AnimationSystem_h__
#define AnimationSystem_h__
#include "GLM.h"
#include "Common.h"
#include "Core/System.h"
#include "Core/ResourceManager.h"
#include "Rendering/Model.h"
#include "Rendering/EAnimationComplete.h"
#include "Rendering/Skeleton.h"
class AnimationSystem : public PureSystem
{
public:
AnimationSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
, PureSystem("Animation")
{
}
~AnimationSystem() { }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) override;
private:
};
#endif
+10
View File
@@ -30,9 +30,18 @@ public:
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 BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
void BindExplosionTextures(std::shared_ptr<ExplosionEffectJob>& job);
void BindModelTextures(std::shared_ptr<ModelJob>& job);
Texture* m_WhiteTexture;
Texture* m_BlackTexture;
Texture* m_NeutralNormalTexture;
Texture* m_GreyTexture;
FrameBuffer m_FinalPassFrameBuffer;
GLuint m_BloomTexture;
@@ -43,6 +52,7 @@ private:
const LightCullingPass* m_LightCullingPass;
ShaderProgram* m_ForwardPlusProgram;
ShaderProgram* m_ExplosionEffectProgram;
};
#endif
@@ -0,0 +1,18 @@
#ifndef Events_AnimationComplete_h__
#define Events_AnimationComplete_h__
#include "../Core/EventBroker.h"
#include "../Core/EntityWrapper.h"
namespace Events
{
struct AnimationComplete : Event
{
EntityWrapper Entity;
std::string Name;
};
}
#endif
@@ -0,0 +1,106 @@
#ifndef ExplosionEffectJob_h__
#define ExplosionEffectJob_h__
#include <cstdint>
#include "../Common.h"
#include "../GLM.h"
#include "../Core/ComponentWrapper.h"
#include "Texture.h"
#include "Model.h"
#include "RenderJob.h"
#include "../Core/ResourceManager.h"
#include "Camera.h"
#include "../Core/World.h"
struct ExplosionEffectJob : ModelJob
{
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialGroup matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage)
: ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage)
{
ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"];
TimeSinceDeath = (double)explosionEffectComponent["TimeSinceDeath"];
ExplosionDuration = (double)explosionEffectComponent["ExplosionDuration"];
EndColor = (glm::vec4)explosionEffectComponent["EndColor"];
Randomness = (bool)explosionEffectComponent["Randomness"];
RandomnessScalar = (double)explosionEffectComponent["RandomnessScalar"];
Velocity = (glm::vec2)explosionEffectComponent["Velocity"];
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
};
glm::vec3 ExplosionOrigin;
double TimeSinceDeath = 0.f; //Seconds
double ExplosionDuration = 2.f;
//bool Gravity = true;
//double GravityForce = 1.f; // Speed
//double ObjectRadius = 2.f; // TODO: Change this for object radius when it's available
glm::vec4 EndColor;
bool Randomness = false;
float RandomnessScalar = 1.f;
glm::vec2 Velocity;
bool ColorByDistance = false;
//bool ReverseAnimation = false;
//bool Wireframe = false;
bool ExponentialAccelaration = false;
std::array<float, 50> RandomNumbers = {
0.3257552917701f,
0.07601508315467f,
0.57408909014151f,
0.0f,
0.8618231368539f,
0.074957156588769f,
0.39413607511396f,
0.54579346698979f,
0.83222648353885f,
0.83635707285086f,
0.34473986148124f,
0.98092448710507f,
0.46346380070944f,
0.7308761201477f,
0.70832470371776f,
0.28268750909841f,
0.26291620883295f,
0.07685032816457f,
0.30760929515008f,
0.2781575388639f ,
0.016950582161988f ,
0.25787915254844f ,
0.76293767279151f ,
0.67730279903733f ,
0.49042877018937f ,
0.13002237823327f ,
0.62803373841012f ,
0.94525353747665f ,
0.32893980076953f ,
0.95952951719962f ,
0.056386206790985f ,
0.012030893476694f ,
0.93090049220757f,
0.83579883064879f,
0.79733513938139f,
0.8796381046435f ,
0.94160434600972f ,
0.76901855588379f ,
0.50253688101775f ,
0.82457069578793f ,
0.80157403359263f ,
0.87291810189975f ,
0.64679548919517f ,
0.42664138899494f ,
0.77171308303797f ,
0.75567959237643f ,
0.45190826265696f ,
0.59844922628181f ,
0.56534937655802f ,
0.195656257307f};
void CalculateHash() override
{
Hash = 0;
}
};
#endif
+7 -5
View File
@@ -25,21 +25,23 @@ class IRenderer
{
public:
GLFWwindow* Window() const { return m_Window; }
//Returns screen size including window border and header
Rectangle Resolution() const { return m_Resolution; }
void SetResolution(const Rectangle& resolution) { m_Resolution = resolution; }
virtual void SetResolution(const Rectangle& resolution) { m_Resolution = resolution; }
bool Fullscreen() { return m_Fullscreen; }
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
virtual void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
bool VSYNC() const { return m_VSYNC; }
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
virtual void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
//Returns screen size excluding window border and header
Rectangle GetViewportSize() const { return m_ViewportSize; }
virtual void Initialize() = 0;
virtual void Update(double dt) = 0;
virtual void Draw(RenderFrame& rq) = 0;
virtual PickData Pick(glm::vec2 screenCord) = 0;
World* m_World; //Temp world, untill viktor merge.
protected:
Rectangle m_Resolution = Rectangle::Rectangle(1280, 720);
Rectangle m_ViewportSize = Rectangle::Rectangle(1280, 720);
bool m_Fullscreen = false;
bool m_VSYNC = false;
int m_GLVersion[2];
+40 -5
View File
@@ -13,18 +13,35 @@
#include "Camera.h"
#include "../Core/World.h"
#include "../Core/Transform.h"
#include "Skeleton.h"
struct ModelJob : RenderJob
{
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialGroup matGroup, ComponentWrapper modelComponent, World* world)
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialGroup matGroup, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage)
: RenderJob()
{
Model = model;
TextureID = (matGroup.Texture) ? matGroup.Texture->ResourceID : 0;
DiffuseTexture = matGroup.Texture.get();
NormalTexture = matGroup.NormalMap.get();
SpecularTexture = matGroup.SpecularMap.get();
IncandescenceTexture = matGroup.IncandescenceMap.get();
if (modelComponent["DiffuseTexture"]) {
DiffuseTexture = matGroup.Texture.get();
} else {
DiffuseTexture = nullptr;
}
if (modelComponent["NormalMap"]) {
NormalTexture = matGroup.NormalMap.get();
} else {
NormalTexture = nullptr;
}
if (modelComponent["SpecularMap"]) {
SpecularTexture = matGroup.SpecularMap.get();
} else {
SpecularTexture = nullptr;
}
if (modelComponent["GlowMap"]) {
IncandescenceTexture = matGroup.IncandescenceMap.get();
} else {
IncandescenceTexture = nullptr;
}
DiffuseColor = matGroup.DiffuseColor;
SpecularColor = matGroup.SpecularColor;
IncandescenceColor = matGroup.IncandescenceColor;
@@ -37,6 +54,16 @@ struct ModelJob : RenderJob
glm::vec3 worldpos = glm::vec3(camera->ViewMatrix() * glm::vec4(abspos, 1));
Depth = worldpos.z;
World = world;
FillColor = fillColor;
FillPercentage = fillPercentage;
Skeleton = Model->m_RawModel->m_Skeleton;
if (world->HasComponent(Entity, "Animation") && Skeleton != nullptr) {
auto animationComponent = world->GetComponent(Entity, "Animation");
Animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["Name"]);
AnimationTime = (double)animationComponent["Time"];
}
};
unsigned int TextureID;
@@ -51,6 +78,11 @@ struct ModelJob : RenderJob
float Shininess = 0.f;
glm::vec4 Color;
const ::Model* Model = nullptr;
::Skeleton* Skeleton = nullptr;
const ::Skeleton::Animation* Animation = nullptr;
float AnimationTime = 0.f;
glm::vec4 DiffuseColor;
glm::vec4 SpecularColor;
glm::vec4 IncandescenceColor;
@@ -58,6 +90,9 @@ struct ModelJob : RenderJob
unsigned int EndIndex = 0;
World* World;
glm::vec4 FillColor = glm::vec4(0);
float FillPercentage = 0.0;
void CalculateHash() override
{
Hash = TextureID;
+1 -4
View File
@@ -1,8 +1,6 @@
#ifndef PickingPass_h__
#define PickingPass_h__
#include "IRenderer.h"
#include "PickingPassState.h"
#include "FrameBuffer.h"
@@ -10,8 +8,7 @@
#include "Util/UnorderedMapiVec2.h"
#include "../Core/EventBroker.h"
#include "../Core/World.h"
#include "Rendering/Skeleton.h"
class PickingPass
{
+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);
};
+5 -2
View File
@@ -14,11 +14,13 @@
#include "TextJob.h"
#include "PointLightJob.h"
#include "DirectionalLightJob.h"
#include "ExplosionEffectJob.h"
struct RenderScene
{
::Camera* Camera = nullptr;
std::list<std::shared_ptr<RenderJob>> ForwardJobs;
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;
@@ -27,7 +29,8 @@ struct RenderScene
void Clear()
{
ForwardJobs.clear();
OpaqueObjects.clear();
TransparentObjects.clear();
PointLightJobs.clear();
TextJobs.clear();
DirectionalLightJobs.clear();
+9 -6
View File
@@ -29,22 +29,25 @@ private:
const IRenderer* m_Renderer;
RenderFrame* m_RenderFrame;
Camera* m_Camera;
World* m_World;
EntityWrapper m_CurrentCamera = EntityWrapper::Invalid;
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
EventRelay<RenderSystem, Events::SetCamera> m_ESetCamera;
bool OnSetCamera(Events::SetCamera &event);
EventRelay<RenderSystem, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(const Events::InputCommand& e);
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 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);
EventRelay<RenderSystem, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(const Events::InputCommand& e);
void fillModels(std::list<std::shared_ptr<RenderJob>>& jobs);
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
bool isChildOfACamera(EntityWrapper entity);
bool isChildOfCurrentCamera(EntityWrapper entity);
EventRelay<RenderSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(Events::PlayerSpawned& e);
};
#endif
+2
View File
@@ -73,6 +73,8 @@ private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
//--------------------ShaderPrograms-------------------//
ShaderProgram* m_BasicForwardProgram;
ShaderProgram* m_ExplosionEffectProgram;
};
#endif
+24
View File
@@ -0,0 +1,24 @@
#include "Common.h"
#include "Core/System.h"
class ExplosionEffectSystem : public PureSystem
{
public:
ExplosionEffectSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
, PureSystem("ExplosionEffect")
{ }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
{
if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"]) {
(double)component["TimeSinceDeath"] = 0.f;
}
(double&)component["TimeSinceDeath"] += dt;
//if ((bool)Component["Gravity"] == true) {
// (bool)Component["ExponentialAccelaration"] = false;
//}
}
};
+5 -2
View File
@@ -14,6 +14,7 @@
#include "Core/EKeyDown.h"
#include "Core/EntityFilePreprocessor.h"
#include "Core/SystemPipeline.h"
#include "ExplosionEffectSystem.h"
#include "Editor/EditorSystem.h"
#include "Core/EntityFile.h"
#include "Rendering/RenderSystem.h"
@@ -21,6 +22,7 @@
#include "Core/Octree.h"
#include "Rendering/Font.h"
#include "Systems/InterpolationSystem.h"
#include "Collision/EntityAABB.h"
// Network
#include <boost/thread.hpp>
#include "Network/Network.h"
@@ -48,8 +50,9 @@ private:
InputProxy* m_InputProxy;
GUI::Frame* m_FrameStack;
World* m_World;
Octree<AABB>* m_OctreeCollision;
Octree<AABB>* m_OctreeFrustrumCulling;
Octree<EntityAABB>* m_OctreeCollision;
Octree<EntityAABB>* m_OctreeTrigger;
Octree<EntityAABB>* m_OctreeFrustrumCulling;
SystemPipeline* m_SystemPipeline;
RenderFrame* m_RenderFrame;
// Network variables
+3 -3
View File
@@ -40,7 +40,7 @@ private:
int m_BlueTeamHomeCapturePoint = m_NotACapturePoint;
int m_NumberOfCapturePoints = 0;
std::map<int, EntityID> m_CapturePointNumberToEntityIDMap;
std::map<int, EntityWrapper> m_CapturePointNumberToEntityMap;
//std::vector<ComponentWrapper>
@@ -48,8 +48,8 @@ private:
bool m_ResetTimers = false;
//vectors which will keep track of enter/leave changes
std::vector<std::tuple<EntityID, EntityID>> m_ETriggerTouchVector;
std::vector<std::tuple<EntityID, EntityID>> m_ETriggerLeaveVector;
std::vector<std::tuple<EntityWrapper, EntityWrapper>> m_ETriggerTouchVector;
std::vector<std::tuple<EntityWrapper, EntityWrapper>> m_ETriggerLeaveVector;
};
#endif
+1 -1
View File
@@ -24,7 +24,7 @@ public:
private:
//methods which will take care of specific events
EventRelay<HealthSystem, Events::PlayerDamage> m_EPlayerDamage;
bool HealthSystem::OnPlayerDamaged(const Events::PlayerDamage& e);
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
bool HealthSystem::OnPlayerHealthPickup(const Events::PlayerHealthPickup& e);
+21
View File
@@ -0,0 +1,21 @@
#ifndef LifetimeSystem_h__
#define LifetimeSystem_h__
#include "Core/System.h"
class LifetimeSystem : public ImpureSystem, PureSystem
{
public:
LifetimeSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
, PureSystem("Lifetime")
{ }
virtual void Update(double dt) override;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cLifetime, double dt) override;
private:
std::vector<EntityWrapper> m_Deletions;
};
#endif
+23
View File
@@ -0,0 +1,23 @@
#ifndef PlayerHUD_h__
#define PlayerHUD_h__
#include "../../Engine/Core/System.h"
#include "../../Engine/GLM.h"
#include "../../Engine/Rendering/ESetCamera.h"
#include <imgui/imgui.h>
class PlayerHUD : public ImpureSystem
{
public:
PlayerHUD(World* world, EventBroker* eventBrokerer);
~PlayerHUD();
virtual void Update(double dt) override;
private:
World* m_World;
EventBroker* m_EventBroker;
};
#endif
+3 -1
View File
@@ -11,6 +11,8 @@
#include "Core/EShoot.h"
#include "Core/EPlayerSpawned.h"
#include "Input/EInputCommand.h"
#include "Core/EntityFile.h"
#include "Core/EntityFileParser.h"
#include <tuple>
#include <vector>
@@ -33,7 +35,7 @@ private:
EventRelay<WeaponSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool WeaponSystem::OnPlayerSpawned(const Events::PlayerSpawned& e);
EventRelay<WeaponSystem, Events::Shoot> m_EShoot;
bool WeaponSystem::OnShoot(const Events::Shoot& e);
bool WeaponSystem::OnShoot(Events::Shoot& e);
EventRelay<WeaponSystem, Events::InputCommand> m_EInputCommand;
bool WeaponSystem::OnInputCommand(const Events::InputCommand& e);
};
-4
View File
@@ -15,10 +15,6 @@ Space=Jump
LeftControl=Crouch
LeftShift=Sprint
F1=ToggleEditor
1=EditorToolMove
2=EditorToolRotate
3=EditorToolScale
X=EditorToggleTransformSpace
C=ConnectToServer
N=SwitchToServer
M=SwitchToClient
+6
View File
@@ -12,6 +12,7 @@
<xs:include schemaLocation="Components/PointLight.xsd"/>
<xs:include schemaLocation="Components/DirectionalLight.xsd"/>
<xs:include schemaLocation="Components/Trigger.xsd"/>
<xs:include schemaLocation="Components/ExplosionEffect.xsd"/>
<xs:include schemaLocation="Components/Health.xsd"/>
<xs:include schemaLocation="Components/CapturePoint.xsd"/>
<xs:include schemaLocation="Components/Listener.xsd"/>
@@ -23,4 +24,9 @@
<xs:include schemaLocation="Components/Team.xsd"/>
<xs:include schemaLocation="Components/UniformScale.xsd"/>
<xs:include schemaLocation="Components/EditorWidget.xsd"/>
<xs:include schemaLocation="Components/HealthHUD.xsd"/>
<xs:include schemaLocation="Components/Animation.xsd"/>
<xs:include schemaLocation="Components/Fill.xsd"/>
<xs:include schemaLocation="Components/Lifetime.xsd"/>
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
</xs:schema>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Animation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Animation.xsd">
<Name></Name>
<Time>0</Time>
<Speed>0</Speed>
<Loop>true</Loop>
</Animation>
+16
View File
@@ -0,0 +1,16 @@
<?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="Animation">
<xs:complexType>
<xs:all>
<xs:element name="Name" type="t:string" minOccurs="0"/>
<xs:element name="Time" type="t:double" minOccurs="0"/>
<xs:element name="Speed" type="t:double" minOccurs="0"/>
<xs:element name="Loop" type="t:bool" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+2 -13
View File
@@ -2,22 +2,11 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:complexType name="TeamEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Spectator" type="xs:integer" fixed="1" minOccurs="0"/>
<xs:element name="Red" type="xs:integer" fixed="2" minOccurs="0"/>
<xs:element name="Blue" type="xs:integer" fixed="3" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:include schemaLocation="../Types/TeamEnum.xsd"/>
<xs:element name="CapturePoint">
<xs:annotation>
<xs:documentation>A Capture Point. Add a Team Component to specify who currently owns it</xs:documentation>
<xs:documentation>A Capture Point. Make sure to update the HomePoint,CapturePointNumber,Team for each</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ExplosionEffect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ExplosionEffect.xsd">
<ExplosionOrigin X="0" Y="0" Z="0"/>
<TimeSinceDeath>0</TimeSinceDeath>
<ExplosionDuration>2</ExplosionDuration>
<!--<Gravity>1</Gravity>-->
<!--<GravityForce>1</GravityForce>-->
<!--<ObjectRadius>2</ObjectRadius>-->
<EndColor R="0" G="0" B="0" A="0"/>
<Randomness>0</Randomness>
<RandomnessScalar>1</RandomnessScalar>
<Velocity X="2" Y="2"/>
<ColorByDistance>0</ColorByDistance>
<!--<ReverseAnimation>0</ReverseAnimation>-->
<!--<Wireframe>0</Wireframe>-->
<ExponentialAccelaration>0</ExponentialAccelaration>
</ExplosionEffect>
@@ -0,0 +1,57 @@
<?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="ExplosionEffect">
<xs:annotation>
<xs:documentation>A component that trigger the death effect</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="ExplosionOrigin" type="t:Vector" minOccurs="0">
<xs:annotation><xs:documentation>The position in which to spawn the component</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="TimeSinceDeath" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Seconds since death</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ExplosionDuration" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>How many seconds the death animation should be</xs:documentation></xs:annotation>
</xs:element>
<!--<xs:element name="Gravity" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Enable/disable gravity</xs:documentation></xs:annotation>
</xs:element>-->
<!--<xs:element name="GravityForce" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The force of the gravity</xs:documentation></xs:annotation>
</xs:element>-->
<!--<xs:element name="ObjectRadius" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Object radius (TO BE REMOVED AND AUTOMATED)</xs:documentation></xs:annotation>
</xs:element>-->
<xs:element name="EndColor" type="t:Color" minOccurs="0">
<xs:annotation><xs:documentation>The tint the polys end with</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Randomness" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Add some randomness to the explosion</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="RandomnessScalar" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Alter the power of the randomness</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Velocity" type="t:Vector" minOccurs="0">
<xs:annotation><xs:documentation>The velocity factors (start/end)</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ColorByDistance" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Change the color by its moved distance instead of by its time</xs:documentation></xs:annotation>
</xs:element>
<!--<xs:element name="ReverseAnimation" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Implosions are cooler</xs:documentation></xs:annotation>
</xs:element>-->
<!--<xs:element name="Wireframe" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Enable/disable wireframe</xs:documentation></xs:annotation>
</xs:element>-->
<xs:element name="ExponentialAccelaration" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Linear/Exponential accelaration</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Fill xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Fill.xsd">
<Percentage>0.0</Percentage>
<Color R="1" G="1" B="1" A="1"/>
</Fill>
+14
View File
@@ -0,0 +1,14 @@
<?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="Fill">
<xs:complexType>
<xs:all>
<xs:element name="Percentage" type="t:double" minOccurs="0"/>
<xs:element name="Color" type="t:Color" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<HealthHUD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="HealthHUD.xsd"/>
@@ -0,0 +1,8 @@
<?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="HealthHUD">
</xs:element>
</xs:schema>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<HiddenForLocalPlayer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="HiddenForLocalPlayer.xsd"/>
@@ -0,0 +1,11 @@
<?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="HiddenForLocalPlayer">
<xs:annotation>
<xs:documentation>Used to make the entity invisible if it's parented to the current local player entity (for first person player model and such)</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Lifetime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Lifetime.xsd">
<Lifetime>0</Lifetime>
</Lifetime>
+13
View File
@@ -0,0 +1,13 @@
<?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="Lifetime">
<xs:complexType>
<xs:all>
<xs:element name="Lifetime" type="t:double" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+5
View File
@@ -2,5 +2,10 @@
<Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Model.xsd">
<Resource></Resource>
<Color R="1" G="1" B="1" A="1"/>
<Transparent>false</Transparent>
<Visible>true</Visible>
<DiffuseTexture>true</DiffuseTexture>
<NormalMap>true</NormalMap>
<SpecularMap>true</SpecularMap>
<GlowMap>true</GlowMap>
</Model>
+16 -1
View File
@@ -15,8 +15,23 @@
<xs:element name="Color" type="t:Color" minOccurs="0">
<xs:annotation><xs:documentation>Color tint</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Transparent" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Wether the model is transparent or not</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Visible" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Wether the model is visible or not</xs:documentation></xs:annotation>
<xs:annotation><xs:documentation>Whether the model is visible or not</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="DiffuseTexture" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Whether the model should use the Diffuse texture or not</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="NormalMap" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Whether the model should use the Normalmap or not</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="SpecularMap" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Whether the model should use the Specularmap or not</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="GlowMap" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Whether the model should use the Glowmap or not</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
+1 -12
View File
@@ -2,18 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:complexType name="TeamEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Spectator" type="xs:integer" fixed="1" minOccurs="0"/>
<xs:element name="Red" type="xs:integer" fixed="2" minOccurs="0"/>
<xs:element name="Blue" type="xs:integer" fixed="3" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:include schemaLocation="../Types/TeamEnum.xsd"/>
<xs:element name="Team">
<xs:annotation>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:AABB/>
<c:CapturePoint/>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
</c:Model>
<c:Team/>
<c:Transform/>
<c:Trigger/>
</Components>
<Children/>
</Entity>
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Position X="0.340887427" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:AABB/>
<c:CapturePoint>
<HomePointForTeam>
<Red/>
</HomePointForTeam>
</c:CapturePoint>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
<Color A="1" B="0" G="0.200000003" R="1"/>
</c:Model>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="6.60000038" Y="0" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:CapturePoint>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePoint>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
<Color A="1" B="1" G="1" R="0"/>
</c:Model>
<c:Team/>
<c:Transform>
<Position X="4.46673203" Y="0" Z="3.50259304"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:CapturePoint>
<CapturePointNumber>2</CapturePointNumber>
</c:CapturePoint>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
<Color A="1" B="1" G="0.200000003" R="0"/>
</c:Model>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="3.00000024" Y="0" Z="0.113596022"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:CapturePoint>
<CapturePointNumber>3</CapturePointNumber>
</c:CapturePoint>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
<Color A="1" B="1" G="0.200000003" R="0"/>
</c:Model>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="1.75382805" Y="0" Z="0.0895374417"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:CapturePoint>
<HomePointForTeam>
<Blue/>
</HomePointForTeam>
<CapturePointNumber>4</CapturePointNumber>
</c:CapturePoint>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
<Color A="1" B="1" G="0.200000003" R="0"/>
</c:Model>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="0.56674248" Y="0" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Health/>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitCube.mesh</Resource>
</c:Model>
<c:Player/>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="4.29100037" Y="-0.08556436" Z="1.29717529"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Health/>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitCube.mesh</Resource>
</c:Model>
<c:Player/>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="5.43557501" Y="0.888866663" Z="1.55849135"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\DummyScene.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.600000024" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+221 -37
View File
@@ -6,7 +6,7 @@
</Components>
<Children>
<Entity>
<Entity name="Ground">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
@@ -18,69 +18,51 @@
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>An error</Resource>
</c:Model>
<c:Transform>
<Position X="1" Y="1" Z="0"/>
<Orientation X="0" Y="0.785390019" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>An error</Resource>
</c:Model>
<c:Transform>
<Position X="2" Y="0" Z="0"/>
<Orientation X="0" Y="0.785390019" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Camera/>
<c:Listener/>
<c:Transform>
<Position X="1.36896265" Y="4.4259491" Z="10.6640663"/>
<Position X="1.36896265" Y="4.10503054" Z="10.6640663"/>
<Orientation X="-0.0349078141" Y="0.157154545" Z="-2.60252193e-07"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Entity name="DirectionalLight">
<Components>
<c:DirectionalLight/>
<c:DirectionalLight>
<Intensity>0.80000001192092896</Intensity>
</c:DirectionalLight>
<c:Model>
<Resource>Models/DirectionalLightWidget.mesh</Resource>
</c:Model>
<c:RaptorCopter>
<Speed>1.0499999523162842</Speed>
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Position X="2.1529963" Y="6.59221172" Z="0.169116676"/>
<Orientation X="4.32000017" Y="4.6340003" Z="0"/>
<Orientation X="4.16300011" Y="1422.89319" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Entity name="AssaultTPose">
<Components>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-2.00568962" Y="0.527161121" Z="0"/>
<Position X="-1.68900967" Y="0.527161121" Z="-1.59648728"/>
<Orientation X="0" Y="1.64900005" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Entity name="SecondaryWeapon">
<Components>
<c:Model>
<Resource>Models/SecondaryWeapon.fbx</Resource>
<Resource>Models/SecondaryWeapon.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.546139359" Y="0.853016734" Z="0.177482292"/>
@@ -91,17 +73,219 @@
</Entity>
</Children>
</Entity>
<Entity>
<Entity name="AnimationGroupOrigin">
<Components>
<c:Transform>
<Position X="1.11190474" Y="0.490183681" Z="0"/>
<Orientation X="0" Y="1.02100003" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="RunAnim">
<Components>
<c:Animation>
<Name>Run</Name>
<Time>0.62051775215976157</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
<Resource>models/AssaultAnimated.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.786919653" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Walkanim">
<Components>
<c:Animation>
<Name>Walk</Name>
<Time>0.28779680073140668</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
<Resource>models/AssaultAnimated.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="UnitSphere">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Color A="0.294117659" B="19.6078434" G="1.17647064" R="0.0392156877"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.754540265" Z="0"/>
<Scale X="0.800000012" Y="1.9000001" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Log">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Resource>Models/Log.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="3.70000029" Z="0"/>
<Position X="-4" Y="0.698000014" Z="-1"/>
<Orientation X="0" Y="2.74900007" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpheresOrigin">
<Components>
<c:Transform>
<Position X="6.80000019" Y="4.9000001" Z="-5.9000001"/>
</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>
<Resource>models/NormSpecIncdMapSphere.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="RotationPoint">
<Components>
<c:RaptorCopter>
<Speed>1</Speed>
<Axis X="1" Y="1" Z="1"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="53.9495354" Y="53.9495354" Z="53.9495354"/>
</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="-1.70000005" Y="0" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<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>5.0100002288818359</Radius>
<Intensity>0.69999998807907104</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.900000036" Y="1.10000002" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<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>4</Radius>
<Intensity>0.80000001192092896</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.400000006" Y="-1" Z="-1.50000012"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+1 -11
View File
@@ -5,16 +5,6 @@
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
<Children/>
</Entity>
+78
View File
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="GotToGoFast" 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.00432979874" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Color A="1" B="1" G="39.2156868" R="392.15686"/>
</c:Model>
<c:RaptorCopter>
<Axis X="1.50000012" Y="-2.20000005" Z="2.10000014"/>
</c:RaptorCopter>
<c:Transform>
<Position X="0" Y="2.87819886" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Animation>
<Name>Run</Name>
<Time>0.56277947897317659</Time>
<Speed>1</Speed>
</c:Animation>
<c:ExplosionEffect>
<Velocity X="0" Y="1.10000002" Z="3.30000019"/>
<ExplosionOrigin X="-0.600000024" Y="1" Z="0"/>
<TimeSinceDeath>0.95625903442123672</TimeSinceDeath>
<EndColor A="0" B="0.815686285" G="1" R="0"/>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/AssaultAnimated.mesh</Resource>
<Color A="1" B="392156.875" G="1" R="1"/>
</c:Model>
<c:Transform>
<Position X="0" Y="0.5" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Text>
<Content>pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew pew </Content>
<Resource>Fonts/DroidSans.ttf,60</Resource>
<Color A="0" B="0.972549021" G="3.92156863" R="39.2156868"/>
<Alignment>
<Left/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="0.245514169" Y="0.817000031" Z="-0.883219421"/>
<Scale X="0.300000012" Y="0.300000012" Z="1"/>
<Orientation X="0" Y="1.52600002" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:DirectionalLight/>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+115
View File
@@ -123,6 +123,121 @@
</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>
</Children>
</Entity>
+117 -1
View File
@@ -146,7 +146,6 @@
</c:Team>
<c:Transform>
<Position X="0.300000012" Y="0.0270000007" Z="6.67400026"/>
<Orientation X="0" Y="3.20700026" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -178,6 +177,123 @@
</Entity>
</Children>
</Entity>
<Entity name="Player">
<Components>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:Collidable/>
<c:Model/>
<c:Physics>
<Gravity>false</Gravity>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
</c:Player>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="-1.68112314" Y="0.0264999866" Z="3.06287026"/>
<Orientation X="0" Y="2.14675093" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Camera">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="1.37700009" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="PlayerName">
<Components>
<c:Text>
<Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/>
<Visible>false</Visible>
</c:Text>
<c:Transform>
<Position X="0" Y="0.247910097" Z="-0.447844714"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CameraModel">
<Components>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ThirdPersonCamera">
<Components>
<c:Camera/>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
<Orientation X="5.95600033" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="PlayerModel">
<Components>
<c:Model>
<Resource>Models/AssaultHeadless.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Orientation X="0" Y="3.14159274" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AABBStanding">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.427450985" B="1" G="1" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
<Scale X="1" Y="1.60000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AABBCrouching">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.745098054" B="1" G="0" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+76 -10
View File
@@ -2,13 +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:Collidable/>
<c:Model/>
<c:Physics/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
</c:Player>
@@ -18,8 +20,7 @@
</Team>
</c:Team>
<c:Transform>
<Position X="-0.246963501" Y="0.0265000071" Z="3.01600003"/>
<Orientation X="0" Y="2.14675093" Z="0"/>
<Position X="8.60201447e-23" Y="0" Z="3.9201616e-23"/>
</c:Transform>
</Components>
@@ -37,10 +38,9 @@
<c:Text>
<Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/>
<Visible>false</Visible>
</c:Text>
<c:Transform>
<Position X="0" Y="0.247910097" Z="-0.447844714"/>
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
@@ -51,6 +51,7 @@
<Components>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
@@ -59,6 +60,67 @@
</Components>
<Children/>
</Entity>
<Entity name="HUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="HealthBar">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0" B="1" G="0" R="0"/>
</c:Fill>
<c:HealthHUD/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
</c:Model>
<c:Transform>
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
<Orientation X="0" Y="0.594000041" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Crosshair">
<Components>
<c:Model>
<Resource>Models/CrosshairQuad.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="0.200000003"/>
<Scale X="0.00600000005" Y="1" Z="0.00600000005"/>
<Orientation X="1.57000005" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Weapon">
<Components>
<c:Model>
<Resource>Models/AssaultWeapon.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
<Orientation X="0" Y="4.64700031" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzle">
<Components>
<c:Transform>
<Position X="0.215000004" Y="-0.153000012" Z="-0.266000003"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ThirdPersonCamera">
@@ -77,13 +139,17 @@
</Entity>
<Entity name="PlayerModel">
<Components>
<c:Animation>
<Name>Hold Pos</Name>
<Time>0.73515426169631848</Time>
<Speed>1</Speed>
</c:Animation>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/AssaultHeadless.mesh</Resource>
<Resource>Models/AssaultAnimated.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Orientation X="0" Y="3.14159274" Z="0"/>
</c:Transform>
<c:Transform/>
</Components>
<Children/>
</Entity>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="PointLight" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<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>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+17
View File
@@ -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:Model>
<Resource>Models/Core/UnitCylinder.mesh</Resource>
<Color A="0" B="0" G="0" R="39.2156868"/>
</c:Model>
<c:Transform>
<Scale X="0.0400000028" Y="26.2000008" Z="0.0400000028"/>
<Orientation X="1.57070005" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+19
View File
@@ -0,0 +1,19 @@
<?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:Lifetime>
<Lifetime>0.25</Lifetime>
</c:Lifetime>
<c:Model>
<Resource>Models/CylinderBullet.mesh</Resource>
<Color A="1" B="39.2156868" G="7.84313726" R="0"/>
</c:Model>
<c:Transform>
<Scale X="0.0109999999" Y="0.0289999992" Z="100"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+17
View File
@@ -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:Model>
<Resource>Models/Core/UnitCylinder.mesh</Resource>
<Color A="0" B="0" G="0" R="39.2156868"/>
</c:Model>
<c:Transform>
<Scale X="0.0400000028" Y="26.2000008" Z="0.0400000028"/>
<Orientation X="1.57070005" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+19
View File
@@ -0,0 +1,19 @@
<?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:Lifetime>
<Lifetime>0.25</Lifetime>
</c:Lifetime>
<c:Model>
<Resource>Models/CylinderBullet.mesh</Resource>
<Color A="1" B="0" G="0.525490224" R="39.2156868"/>
</c:Model>
<c:Transform>
<Scale X="0.0110000009" Y="0.029000001" Z="100"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+154 -65
View File
@@ -6,34 +6,115 @@
</Components>
<Children>
<Entity>
<Entity name="Player">
<Components>
<c:Camera>
<Name>ActionCamera</Name>
</c:Camera>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
</c:Model>
<c:Health>
<Health>65.990005493164063</Health>
</c:Health>
<c:Player/>
<c:Transform>
<Position X="-0.504807115" Y="6.00582743" Z="9.68687439"/>
<Orientation X="-0.733036518" Y="0.000105090476" Z="5.12391125e-07"/>
<Position X="0" Y="0" Z="2.5"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Entity name="Model">
<Components>
<c:Text>
<Content>Camera #2</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>0</Alignment>
</c:Text>
<c:Model>
<Resource>Models/Assault.obj</Resource>
<Color A="1" B="3.92156863" G="3.92156863" R="3.92156863"/>
</c:Model>
<c:Transform>
<Position X="0.700063765" Y="0.310270816" Z="-1"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="0" Y="3.14159203" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Camera">
<Components>
<c:Camera>
<FOV>80</FOV>
</c:Camera>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="1.39121652" Z="-0.043014247"/>
<Orientation X="6.28300047" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="HUD">
<Components>
<c:Transform>
<Position X="0" Y="-0.000463247066" Z="-0.744767368"/>
</c:Transform>
</Components>
<Children>
<Entity name="Hexagon">
<Components>
<c:HealthHUD/>
<c:Fill>
<Percentage>0.65990006923675537</Percentage>
<Color A="0" B="0.659900069" G="0" R="0.340099931"/>
</c:Fill>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="0.313725501" B="0.70588237" G="0.70588237" R="0.70588237"/>
</c:Model>
<c:Transform>
<Position X="-0.285538822" Y="-0.282350302" Z="-1.52214652e-05"/>
<Scale X="0.200000003" Y="0.200000003" Z="0.5"/>
<Orientation X="0" Y="0.666000009" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>24</Content>
<Resource>Fonts/DroidSans.ttf,60</Resource>
</c:Text>
<c:Transform>
<Position X="-1.43861985e-06" Y="0.0125972452" Z="0.0100018298"/>
<Scale X="0.349999994" Y="0.349999994" Z="0.200000003"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Text>
<Content>262</Content>
<Resource>Fonts/DroidSans.ttf,60</Resource>
</c:Text>
<c:Transform>
<Position X="-4.27209579e-06" Y="-0.0390000008" Z="5.43686883e-06"/>
<Scale X="0.65200001" Y="0.643000007" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:HealthHUD/>
<c:Text>
<Content>65/100</Content>
<Resource>Fonts/DroidSans.ttf,60</Resource>
<Color A="1" B="0.659900069" G="0" R="0.340099931"/>
</c:Text>
<c:Transform>
<Scale X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity>
@@ -42,7 +123,7 @@
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="-1" Z="0.600000024"/>
<Position X="0" Y="-0.689623177" Z="0.600000024"/>
<Scale X="100" Y="1" Z="100"/>
</c:Transform>
</Components>
@@ -52,6 +133,7 @@
<Components>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
<Color A="1" B="3.92156863" G="1" R="1"/>
</c:Model>
<c:Transform>
<Position X="-2.5" Y="0" Z="1"/>
@@ -64,6 +146,7 @@
<c:Text>
<Content>Welcome!</Content>
<Resource>Fonts/DroidSans.ttf,1280</Resource>
<Color A="0" B="3.92156863" G="3.92156863" R="3.92156863"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0" Z="0.700000048"/>
@@ -74,32 +157,40 @@
<Entity>
<Components>
<c:RaptorCopter>
<Speed>2</Speed>
<Axis X="0" Y="1" Z="0"/>
<Speed>3</Speed>
<Axis X="0.200000003" Y="3.4000001" Z="0.5"/>
</c:RaptorCopter>
<c:Transform>
<Position X="0" Y="2.37320328" Z="0"/>
<Orientation X="0" Y="8252.15918" Z="0"/>
<Orientation X="758.058899" Y="20632.8691" Z="1320.68018"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="7.84313726" G="0" R="7.84313726"/>
</c:Model>
<c:PointLight>
<Color A="1" B="1" G="0" R="1"/>
<Radius>6</Radius>
<Radius>70</Radius>
<Intensity>0.5</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-2.5" Y="0" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="0" G="0" R="7.84313726"/>
</c:Model>
<c:PointLight>
<Color A="1" B="0" G="0" R="1"/>
<Radius>8</Radius>
<Radius>70</Radius>
</c:PointLight>
<c:Transform>
<Position X="-5" Y="0" Z="0"/>
@@ -111,21 +202,30 @@
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="0" G="7.84313726" R="7.84313726"/>
</c:Model>
<c:PointLight>
<Color A="1" B="0" G="1" R="1"/>
<Radius>6</Radius>
<Radius>70</Radius>
<Intensity>0.5</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0" Y="0" Z="-2.5"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="0" G="7.84313726" R="0"/>
</c:Model>
<c:PointLight>
<Color A="1" B="0" G="1" R="0"/>
<Radius>8</Radius>
<Radius>70</Radius>
</c:PointLight>
<c:Transform>
<Position X="0" Y="0" Z="-5"/>
@@ -137,21 +237,30 @@
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="7.84313726" G="7.84313726" R="0"/>
</c:Model>
<c:PointLight>
<Color A="1" B="1" G="1" R="0"/>
<Radius>6</Radius>
<Radius>70</Radius>
<Intensity>0.5</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0" Y="0" Z="2.5"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="7.84313726" G="0" R="0"/>
</c:Model>
<c:PointLight>
<Color A="1" B="1" G="0.00784313772" R="0"/>
<Radius>8</Radius>
<Color A="1" B="1" G="0" R="0"/>
<Radius>70</Radius>
</c:PointLight>
<c:Transform>
<Position X="0" Y="0" Z="5"/>
@@ -163,19 +272,28 @@
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="7.84313726" G="7.84313726" R="7.84313726"/>
</c:Model>
<c:PointLight>
<Radius>6</Radius>
<Radius>70</Radius>
<Intensity>0.5</Intensity>
</c:PointLight>
<c:Transform>
<Position X="2.5" Y="0" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.obj</Resource>
<Color A="1" B="7.84313726" G="7.84313726" R="7.84313726"/>
</c:Model>
<c:PointLight>
<Radius>8</Radius>
<Radius>70</Radius>
</c:PointLight>
<c:Transform>
<Position X="5" Y="0" Z="0"/>
@@ -191,6 +309,7 @@
<Components>
<c:Model>
<Resource>Models/Assault.mesh</Resource>
<Color A="1" B="1" G="1" R="3.92156863"/>
</c:Model>
<c:Transform>
<Position X="2.5" Y="0" Z="1"/>
@@ -198,46 +317,15 @@
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Camera>
<Name>MainCamera</Name>
</c:Camera>
<c:Listener/>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="-1.27354908" Y="5.18422079" Z="10.6223917"/>
<Orientation X="-0.436328411" Y="-0.0523675606" Z="1.67869363e-08"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Text>
<Content>Taiwan #1</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>0</Alignment>
</c:Text>
<c:Transform>
<Position X="0.716896772" Y="0.296712071" Z="-1"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Entity name="DirectionalLight">
<Components>
<c:DirectionalLight>
<Color A="1" B="0.996078432" G="1" R="1"/>
<Intensity>0.80000001192092896</Intensity>
<Intensity>0.10000000149011612</Intensity>
</c:DirectionalLight>
<c:Model>
<Resource>Models/DirectionalLightWidget.mesh</Resource>
<Color A="1" B="0" G="3.92156863" R="3.92156863"/>
</c:Model>
<c:Transform>
<Position X="-0.0013256073" Y="1.89540339" Z="6.53467274"/>
@@ -250,6 +338,7 @@
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="39.2156868" R="1"/>
</c:Model>
<c:Transform>
<Position X="-5.4082036" Y="0" Z="-1.84950542"/>
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="BluSpawn" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:PlayerSpawn/>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</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>
</Children>
</Entity>
+17
View File
@@ -18,6 +18,23 @@
</c:Transform>
<c:Camera>
</c:Camera>
<Orientation X="0.0" Y="0.0" Z="0"/>
<c:ExplosionEffect>
<ExplosionOrigin X="0" Y="0" Z="0"/>
<TimeSinceDeath>0</TimeSinceDeath>
<ExplosionDuration>2</ExplosionDuration>
<!--<Gravity>1</Gravity>-->
<!--<GravityForce>1</GravityForce>-->
<!--<ObjectRadius>2</ObjectRadius>-->
<EndColor R="0" G="0" B="0" A="0"/>
<Randomness>0</Randomness>
<RandomnessScalar>1</RandomnessScalar>
<Velocity X="2" Y="2"/>
<ColorByDistance>0</ColorByDistance>
<!--<ReverseAnimation>0</ReverseAnimation>-->
<!--<Wireframe>0</Wireframe>-->
<ExponentialAccelaration>0</ExponentialAccelaration>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/Camera.mesh</Resource>
</c:Model>
+7 -2
View File
@@ -15,6 +15,7 @@
<xs:element ref="c:Model" minOccurs="0"/>
<xs:element ref="c:RaptorCopter" minOccurs="0"/>
<xs:element ref="c:Player" minOccurs="0"/>
<xs:element ref="c:ExplosionEffect" minOccurs="0"/>
<xs:element ref="c:Camera" minOccurs="0"/>
<xs:element ref="c:Text" minOccurs="0"/>
<xs:element ref="c:AABB" minOccurs="0"/>
@@ -32,6 +33,10 @@
<xs:element ref="c:DirectionalLight" 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:all>
</xs:complexType>
</xs:element>
@@ -42,7 +47,7 @@
<xs:element ref="Entity" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="EntityRef" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="file" type="xs:string" minOccurs="0"/>
<xs:attribute name="file" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
@@ -50,7 +55,7 @@
</xs:element>
</xs:all>
<xs:attribute ref="xml:base"/>
<xs:attribute name="name" type="xs:string" minOccurs="0" default=""/>
<xs:attribute name="name" type="xs:string" default=""/>
</xs:complexType>
</xs:element>
</xs:schema>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:complexType name="TeamEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Spectator" type="t:int" fixed="1" minOccurs="0"/>
<xs:element name="Red" type="t:int" fixed="2" minOccurs="0"/>
<xs:element name="Blue" type="t:int" fixed="3" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,25 @@
#version 430
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform vec4 Color;
uniform sampler2D texture0;
in VertexData{
vec3 Position;
vec3 Normal;
vec2 TextureCoordinate;
vec4 DiffuseColor;
vec4 ExplosionColor;
}Input;
out vec4 fragmentColor;
void main()
{
vec4 texel = texture2D(texture0, Input.TextureCoordinate);
fragmentColor = texel * Input.DiffuseColor * Color + Input.ExplosionColor;
}
+179
View File
@@ -0,0 +1,179 @@
#version 430
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform vec3 ExplosionOrigin;
uniform float TimeSinceDeath;
uniform float ExplosionDuration;
uniform vec4 EndColor;
uniform bool Randomness;
uniform float RandomNumbers[50];
uniform float RandomnessScalar;
uniform vec2 Velocity;
uniform bool ColorByDistance;
uniform bool ExponentialAccelaration;
in VertexData{
vec3 Position;
vec3 Normal;
vec2 TextureCoordinate;
vec4 ExplosionColor;
}Input[];
out VertexData{
vec3 Position;
vec3 Normal;
vec2 TextureCoordinate;
vec4 ExplosionColor;
}Output;
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
// returns a "random" number based on input parameter
float GetRandomNumber(int polygon_index)
{
int randomIndex = int(mod(polygon_index, 50));
return RandomNumbers[randomIndex];
}
float randomNumber = 0.0;
float randomDistance = 0.0;
void main()
{
// calculate middle of vectors
vec3 v1 = Input[1].Position - Input[0].Position;
vec3 v2 = Input[2].Position - Input[0].Position;
vec3 v3 = Input[2].Position - (v1 / 2);
vec3 v4 = Input[1].Position - (v2 / 2);
// calculate intersection
// normalize direction
vec3 dir1 = normalize(v1);
vec3 dir2 = normalize(v2);
vec3 vecA = Input[2].Position - Input[1].Position; //o2 - o1
vec3 vecB = cross(dir1, dir2);
mat3 matrisA = mat3(vecA, dir2, vecB);
float lengthA = length(vecB);
lengthA = lengthA * lengthA;
float s = determinant(matrisA) / lengthA;
// center position of triangle
vec3 centerOfTriangle = Input[1].Position + (s * dir1);
// center position of triangle to origin vector
vec3 origin2TriangleCenterVector = centerOfTriangle - ExplosionOrigin;
vec3 normalizedOrigin2TriangleCenterVector = normalize(origin2TriangleCenterVector);
// time percentage until end of explosion (0.0-1.0)
float timePercetage = TimeSinceDeath / ExplosionDuration;
// get a random number if randomness is enabled, otherwise the random number will be zero and won't affect the other algorithms
if (Randomness == true)
{
randomDistance = GetRandomNumber(gl_PrimitiveIDIn) * RandomnessScalar;
}
vec2 randomVelocity = Velocity * (randomDistance + 1.0);
// accelaration to use on current frame. is a interpolation between start and end value
float currentVelocity = mix(randomVelocity.x, randomVelocity.y, timePercetage);
if (ExponentialAccelaration == true)
{
currentVelocity = pow(currentVelocity, 2) / 2.0;
}
// distance between origin and the center of the current triangle
float origin2TriangleCenterDistance = length(origin2TriangleCenterVector);
// the distance from origin to the triangle center with eventual randomness added
float fullDistanceWithRandomness = origin2TriangleCenterDistance + randomDistance;
// vector from the triangle center to the explosion's shockwave
vec3 triangleCenter2ExplosionRadius = (normalizedOrigin2TriangleCenterVector * (TimeSinceDeath * currentVelocity)) - (normalizedOrigin2TriangleCenterVector * fullDistanceWithRandomness);
// if the triangle is inside the blast radius...
if (fullDistanceWithRandomness <= (TimeSinceDeath * currentVelocity))
{
float maxRadius = max(TimeSinceDeath * currentVelocity, (ExplosionDuration * currentVelocity));
float a = (randomVelocity.y - randomVelocity.x) / ExplosionDuration;
//float t = sqrt((2 * origin2TriangleCenterDistance) / a);
// if explosion color should be affected by distance instead of time...
if (ColorByDistance == true)
{
// calculate the max distance (s) the triangle will move
float s = (randomVelocity.x * ExplosionDuration) + (0.5 * a * pow(ExplosionDuration, 2));
Output.ExplosionColor = EndColor * (length(triangleCenter2ExplosionRadius) / s);
}
else
{
Output.ExplosionColor = EndColor * timePercetage;
}
// for every vertex on the triangle...
for (int i = 0; i < gl_in.length(); i++)
{
// move the triangle to the blast radius
vec3 ExplodedPosition = Input[i].Position + triangleCenter2ExplosionRadius;
// pass through vertex data
Output.Normal = Input[i].Normal;
Output.Position = Input[i].Position;
Output.TextureCoordinate = Input[i].TextureCoordinate;
// convert to model space for the gravity to always be in -y
vec4 ExplodedPositionInModelSpace = M * vec4(ExplodedPosition, 1.0);
// if there is gravity, apply it
//if (Gravity == true)
//{
// // ---DO THIS----> //ExplodedPositionInModelSpace.y = ExplodedPositionInModelSpace.y - TimeSinceHit;
//
// ExplodedPositionInModelSpace.y = ExplodedPositionInModelSpace.y - pow(TimeSinceDeath, 2);
//}
// convert to screen space
gl_Position = P*V * ExplodedPositionInModelSpace;
EmitVertex();
}
}
else
{
// if explosion color should be affected by distance instead of time...
if (ColorByDistance == true)
{
Output.ExplosionColor = vec4(0.0);
}
else
{
Output.ExplosionColor = EndColor * timePercetage;
}
// for every vertex on the triangle...
for(int i = 0; i < gl_in.length(); i++)
{
// pass through vertex data
Output.Normal = Input[i].Normal;
Output.Position = Input[i].Position;
Output.TextureCoordinate = Input[i].TextureCoordinate;
// no change in position, pass through vertex
gl_Position = gl_in[i].gl_Position;
EmitVertex();
}
}
//EndPrimitive();
}
@@ -0,0 +1,36 @@
#version 430
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
layout(location = 0) in vec3 Position;
layout(location = 1) in vec3 Normal;
layout(location = 2) in vec3 Tangent;
layout(location = 3) in vec3 BiTangent;
layout(location = 4) in vec2 TextureCoords;
layout(location = 5) in vec4 DiffuseVertexColor;
layout(location = 6) in vec4 SpecularVertexColor;
layout(location = 7) in vec4 BoneIndices1;
layout(location = 8) in vec4 BoneIndices2;
layout(location = 9) in vec4 BoneWeights1;
layout(location = 10) in vec4 BoneWeights2;
out VertexData{
vec3 Position;
vec3 Normal;
vec2 TextureCoordinate;
vec4 DiffuseColor;
vec4 ExplosionColor;
}Output;
void main()
{
gl_Position = P*V*M * vec4(Position, 1.0);
Output.Position = Position;
Output.TextureCoordinate = TextureCoords;
Output.Normal = Normal;
Output.DiffuseColor = DiffuseVertexColor;
Output.ExplosionColor = vec4(0.0);
}
+31 -20
View File
@@ -6,8 +6,13 @@ uniform mat4 P;
uniform vec4 Color;
uniform vec4 DiffuseColor;
uniform vec2 ScreenDimensions;
uniform vec4 FillColor;
uniform float FillPercentage;
layout (binding = 0) uniform sampler2D DiffuseTexture;
layout (binding = 1) uniform sampler2D GlowMap;
layout (binding = 1) uniform sampler2D NormalMapTexture;
layout (binding = 2) uniform sampler2D SpecularMapTexture;
layout (binding = 3) uniform sampler2D GlowMapTexture;
#define TILE_SIZE 16
@@ -46,7 +51,10 @@ layout (std430, binding = 4) buffer LightIndexBuffer
in VertexData{
vec3 Position;
vec3 Normal;
vec3 Tangent;
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
}Input;
out vec4 sceneColor;
@@ -98,13 +106,21 @@ LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensi
return result;
}
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
{
mat3 TBN = mat3(tangent, bitangent, normal);
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
return vec4(TBN * normalize(NormalMap), 0.0);
}
void main()
{
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate);
vec4 glowTexel = texture2D(GlowMap, Input.TextureCoordinate);
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate);
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate);
vec4 position = V * M * vec4(Input.Position, 1.0);
vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, NormalMapTexture);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position);
vec2 tilePos;
@@ -134,24 +150,19 @@ void main()
totalLighting.Specular += light_result.Specular;
}
//sceneColor += Input.DiffuseColor;
vec4 color_result = DiffuseColor * (totalLighting.Diffuse + totalLighting.Specular) * diffuseTexel * Color;
//bloomColor = vec4(0.3, 0.8, 0.6, 1.0);
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//These if statements should be removed if they are slow.
color_result += glowTexel;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
/*
if(color_result.x > 1 || color_result.y > 1 || color_result.z > 1) {
bloomColor = vec4(color_result.xyz, 1.0);
} else {
bloomColor = vec4(0.0, 0.0, 0.0, 1.0);
} */
//sceneColor += Input.DiffuseColor * (totalLighting.Diffuse) * diffuseTexel * Color;
//sceneColor += Input.DiffuseColor + vec4(0.0, LightGrids.Data[currentTile].Amount/3, 0, 1);
//sceneColor = diffuseTexel * Input.DiffuseColor * Color;
//sceneColor += vec4(currentTile/3600.f, 0, 0, 1);
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;
if(pos <= FillPercentage) {
color_result += FillColor;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
color_result += glowTexel;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
//Tiled Debug Code
/*
+6
View File
@@ -16,7 +16,10 @@ layout(location = 6) in vec4 BoneWeights;
out VertexData{
vec3 Position;
vec3 Normal;
vec3 Tangent;
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
}Output;
void main()
@@ -36,4 +39,7 @@ void main()
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
Output.TextureCoordinate = TextureCoords;
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);
}
+2 -1
View File
@@ -1,4 +1,5 @@
#version 430
#extension GL_EXT_gpu_shader4 : enable
layout (binding = 0) uniform sampler2D Texture;
@@ -12,7 +13,7 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01
void main()
{
vec2 tex_offset = 1.0 / textureSize(Texture, 0);
vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
for(int i = 1; i < 5; ++i) {
+2 -1
View File
@@ -1,4 +1,5 @@
#version 430
#extension GL_EXT_gpu_shader4 : enable
layout (binding = 0) uniform sampler2D Texture;
@@ -12,7 +13,7 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01
void main()
{
vec2 tex_offset = 1.0 / textureSize(Texture, 0);
vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
for(int i = 1; i < 5; ++i) {
+12 -8
View File
@@ -3,18 +3,15 @@
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform mat4 Bones[100];
layout(location = 0) in vec3 Position;
layout(location = 1) in vec3 Normal;
layout(location = 2) in vec3 Tangent;
layout(location = 3) in vec3 BiTangent;
layout(location = 4) in vec2 TextureCoords;
layout(location = 5) in vec4 DiffuseVertexColor;
layout(location = 6) in vec4 SpecularVertexColor;
layout(location = 7) in vec4 BoneIndices1;
layout(location = 8) in vec4 BoneIndices2;
layout(location = 9) in vec4 BoneWeights1;
layout(location = 10) in vec4 BoneWeights2;
layout(location = 5) in vec4 BoneIndices;
layout(location = 6) in vec4 BoneWeights;
out VertexData{
vec3 Position;
@@ -22,7 +19,14 @@ out VertexData{
void main()
{
gl_Position = P * V* M * vec4(Position, 1.0);
mat4 boneTransform = mat4(1);
if(BoneWeights[0] > 0.0f){
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
}
Output.Position = Position;
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
}
@@ -8,7 +8,7 @@ void CollidableOctreeSystem::Update(double dt)
void CollidableOctreeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
if (entity.HasComponent("AABB")) {
boost::optional<AABB> absoluteAABB = Collision::EntityAbsoluteAABB(entity);
boost::optional<EntityAABB> absoluteAABB = Collision::EntityAbsoluteAABB(entity);
if (absoluteAABB) {
m_Octree->AddDynamicObject(*absoluteAABB);
}
+6 -16
View File
@@ -239,20 +239,6 @@ bool AABBvsTriangles(const AABB& box, const std::vector<RawModel::Vertex>& model
return hit;
}
bool IsSameBoxProbably(const AABB& first, const AABB& second, const float epsilon)
{
const glm::vec3& ma1 = first.MaxCorner();
const glm::vec3& ma2 = second.MaxCorner();
const glm::vec3& mi1 = first.MinCorner();
const glm::vec3& mi2 = second.MinCorner();
return (std::abs(ma1.x - ma2.x) < epsilon) &&
(std::abs(mi1.x - mi2.x) < epsilon) &&
(std::abs(ma1.z - ma2.z) < epsilon) &&
(std::abs(mi1.z - mi2.z) < epsilon) &&
(std::abs(ma1.y - ma2.y) < epsilon) &&
(std::abs(mi1.y - mi2.y) < epsilon);
}
bool attachAABBComponentFromModel(World* world, EntityID id)
{
if (!world->HasComponent(id, "Model")) {
@@ -283,7 +269,7 @@ bool attachAABBComponentFromModel(World* world, EntityID id)
return true;
}
boost::optional<AABB> EntityAbsoluteAABB(EntityWrapper& entity)
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity)
{
if (!entity.HasComponent("AABB")) {
return boost::none;
@@ -294,7 +280,11 @@ boost::optional<AABB> EntityAbsoluteAABB(EntityWrapper& entity)
glm::vec3 absScale = Transform::AbsoluteScale(entity.World, entity.ID);
glm::vec3 origin = absPosition + (glm::vec3)cAABB["Origin"];
glm::vec3 size = (glm::vec3)cAABB["Size"] * absScale;
return AABB::FromOriginSize(origin, size);
EntityAABB aabb = EntityAABB::FromOriginSize(origin, size);
aabb.Entity = entity;
return aabb;
}
}
+12 -22
View File
@@ -9,29 +9,27 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
}
ComponentWrapper& cPhysics = entity["Physics"];
boost::optional<AABB> boundingBox = Collision::EntityAbsoluteAABB(entity);
boost::optional<EntityAABB> boundingBox = Collision::EntityAbsoluteAABB(entity);
if (!boundingBox) {
return;
}
ComponentWrapper& cTransform = entity["Transform"];
AABB& boxA = *boundingBox;
EntityAABB& boxA = *boundingBox;
//Press 'Z' to enable/disable collision.
if (zPress) {
return;
}
// Collide against octree
std::vector<AABB> octreeResult;
m_Octree->ObjectsInSameRegion(*boundingBox, octreeResult);
for (auto& boxB : octreeResult) {
// Collide against octree items
m_OctreeResult.clear();
m_Octree->ObjectsInSameRegion(*boundingBox, m_OctreeResult);
for (auto& boxB : m_OctreeResult) {
glm::vec3 resolutionVector;
if (Collision::IsSameBoxProbably(boxA, boxB)) {
if (boxA.Entity == boxB.Entity) {
continue;
}
if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
(glm::vec3&)cTransform["Position"] += resolutionVector;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
if (resolutionVector.y > 0) {
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
}
}
}
@@ -56,12 +54,4 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
// (glm::vec3&)cTransform["Position"] += resolutionVector;
// }
//}
}
bool CollisionSystem::OnKeyUp(const Events::KeyUp & event)
{
if (event.KeyCode == GLFW_KEY_Z) {
zPress = !zPress;
}
return false;
}
}
+47 -54
View File
@@ -3,79 +3,72 @@
#include "Core/AABB.h"
#include "Rendering/Model.h"
void TriggerSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapper& cTrigger, double dt)
{
//Currently only players can trigger things.
auto players = m_World->GetComponents("Player");
if (players == nullptr) {
return;
}
EntityID tId = component.EntityID;
boost::optional<AABB> triggerBox = Collision::EntityAbsoluteAABB(entity);
//The trigger *should* have a bounding box, or something, to test against so it can be triggered.
// The trigger *should* have a bounding box, or something, to test against so it can be triggered.
boost::optional<EntityAABB> triggerBox = Collision::EntityAbsoluteAABB(triggerEntity);
if (!triggerBox) {
return;
}
for (auto& pc : *players) {
EntityID pId = pc.EntityID;
boost::optional<AABB> playerBox = Collision::EntityAbsoluteAABB(EntityWrapper(m_World, pId));
//The player can't trigger anything without an AABB.
if (!playerBox) {
continue;
}
if (!Collision::AABBVsAABB(*triggerBox, *playerBox)) {
//Entity is not touching the trigger,
//Throw event if it was previously.
if (throwLeaveIfWasInTrigger(m_EntitiesTouchingTrigger[tId], pId, tId)) {
continue;
}
//This only occurs if the entity was completely inside the trigger one frame,
//then completely outside the trigger, e.g. when dying and respawning.
throwLeaveIfWasInTrigger(m_EntitiesCompletelyInTrigger[tId], pId, tId);
} else {
//Entity is at least touching the trigger.
m_OctreeOut.clear();
m_Octree->ObjectsInSameRegion(*triggerBox, m_OctreeOut);
for (EntityAABB& colliderBox : m_OctreeOut) {
EntityWrapper colliderEntity = colliderBox.Entity;
if (Collision::AABBVsAABB(*triggerBox, colliderBox)) {
AABB completelyInsideBox;
bool playerFitsInTrigger = glm::all(glm::greaterThan((*triggerBox).Size(), (*playerBox).Size()));
if (playerFitsInTrigger) {
completelyInsideBox = AABB::FromOriginSize((*triggerBox).Origin(), (*triggerBox).Size() - 2.0f * (*playerBox).Size());
bool colliderFitsInTrigger = glm::all(glm::greaterThan((*triggerBox).Size(), colliderBox.Size()));
if (colliderFitsInTrigger) {
completelyInsideBox = AABB::FromOriginSize((*triggerBox).Origin(), (*triggerBox).Size() - 2.0f * colliderBox.Size());
}
if (playerFitsInTrigger && Collision::AABBVsAABB(completelyInsideBox, *playerBox)) {
//Entity is completely inside the trigger.
//If it was only touching before, it is erased.
m_EntitiesTouchingTrigger[tId].erase(pId);
std::unordered_set<EntityID>& completeSet = m_EntitiesCompletelyInTrigger[tId];
if (completeSet.count(pId) == 0) {
//If it wasn't completely in the trigger, throw Enter and add to the set.
completeSet.insert(pId);
publish<Events::TriggerEnter>(pId, tId);
if (colliderFitsInTrigger && Collision::AABBVsAABB(completelyInsideBox, colliderBox)) {
// Entity is completely inside the trigger.
// If it was only touching before, it is erased.
m_EntitiesTouchingTrigger[triggerEntity].erase(colliderEntity);
auto& completeSet = m_EntitiesCompletelyInTrigger[triggerEntity];
if (completeSet.count(colliderEntity) == 0) {
// If it wasn't completely in the trigger, throw Enter and add to the set.
completeSet.insert(colliderEntity);
publish<Events::TriggerEnter>(colliderEntity, triggerEntity);
}
} else {
//Entity is only touching the trigger.
std::unordered_set<EntityID>& touchSet = m_EntitiesTouchingTrigger[tId];
std::unordered_set<EntityID>& completeSet = m_EntitiesCompletelyInTrigger[tId];
const auto& it = completeSet.find(pId);
// Entity is only touching the trigger.
auto& touchSet = m_EntitiesTouchingTrigger[triggerEntity];
auto& completeSet = m_EntitiesCompletelyInTrigger[triggerEntity];
const auto& it = completeSet.find(colliderEntity);
//If it was completely inside before.
if (it != completeSet.end()) {
completeSet.erase(it);
touchSet.insert(pId);
touchSet.insert(colliderEntity);
//If it was completely outside before.
} else if (touchSet.count(pId) == 0) {
publish<Events::TriggerTouch>(pId, tId);
touchSet.insert(pId);
} else if (touchSet.count(colliderEntity) == 0) {
publish<Events::TriggerTouch>(colliderEntity, triggerEntity);
touchSet.insert(colliderEntity);
}
//Else, it was touching the trigger last frame too and nothing is done.
// Else, it was touching the trigger last frame too and nothing is done.
}
} else {
// Entity is not touching the trigger,
// Throw event if it was previously.
if (throwLeaveIfWasInTrigger(m_EntitiesTouchingTrigger[triggerEntity], colliderEntity, triggerEntity)) {
continue;
}
// This only occurs if the entity was completely inside the trigger one frame,
// then completely outside the trigger, e.g. when dying and respawning.
throwLeaveIfWasInTrigger(m_EntitiesCompletelyInTrigger[triggerEntity], colliderEntity, triggerEntity);
}
}
}
bool TriggerSystem::throwLeaveIfWasInTrigger(std::unordered_set<EntityID>& triggerSet, EntityID pId, EntityID tId)
bool TriggerSystem::throwLeaveIfWasInTrigger(std::unordered_set<EntityWrapper>& triggerSet, EntityWrapper colliderEntity, EntityWrapper triggerEntity)
{
const auto& it = triggerSet.find(pId);
const auto& it = triggerSet.find(colliderEntity);
if (it != triggerSet.end()) {
//If it was in the trigger, but not anymore, throw leaveEvent and erase from the set.
triggerSet.erase(it);
publish<Events::TriggerLeave>(pId, tId);
publish<Events::TriggerLeave>(colliderEntity, triggerEntity);
return true;
}
return false;
@@ -83,18 +76,18 @@ bool TriggerSystem::throwLeaveIfWasInTrigger(std::unordered_set<EntityID>& trigg
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;
}
-4
View File
@@ -20,10 +20,6 @@ AABB::AABB(const glm::vec3& minPos, const glm::vec3& maxPos)
}
}
AABB::AABB(const glm::vec4& minPos, const glm::vec4& maxPos)
: AABB(glm::vec3(minPos), glm::vec3(maxPos))
{ }
AABB AABB::FromOriginSize(const glm::vec3& origin, const glm::vec3& size)
{
return AABB(origin - (size/2.f), origin + (size/2.f));
+22 -12
View File
@@ -20,7 +20,7 @@ void EntityFile::Parse(const EntityFileHandler* handler) const
{
using namespace xercesc;
EntityFileSAXHandler saxHandler(handler, nullptr);
EntityFileSAXHandler saxHandler(handler, m_SAX2XMLReader);
setReaderFeatures(m_SAX2XMLReader);
m_SAX2XMLReader->setContentHandler(&saxHandler);
m_SAX2XMLReader->setErrorHandler(&saxHandler);
@@ -37,11 +37,12 @@ void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
reader->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
reader->setFeature(XMLUni::fgXercesSchema, true);
reader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
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) },
@@ -111,8 +112,9 @@ void EntityFile::WriteValueData(char* outData, const ComponentInfo::Field_t& fie
} catch (const boost::bad_lexical_cast&) { }
}
EntityFileSAXHandler::EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader) : m_Handler(handler)
, m_Reader(reader)
EntityFileSAXHandler::EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader)
: m_Handler(handler)
, m_Reader(reader)
{
// 0 is imaginary base parent
m_EntityStack.push(0);
@@ -188,21 +190,29 @@ void EntityFileSAXHandler::characters(const XMLCh* const chars, const XMLSize_t
void EntityFileSAXHandler::fatalError(const xercesc::SAXParseException& e)
{
XS::ToString s(e.getMessage());
LOG_ERROR("SAXParseException: %s", ((std::string)s).c_str());
//throw e;
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tFatal Error: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::error(const xercesc::SAXParseException& e)
{
XS::ToString s(e.getMessage());
LOG_ERROR("SAXParseException: %s", ((std::string)s).c_str());
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tError: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::warning(const xercesc::SAXParseException& e)
{
XS::ToString s(e.getMessage());
LOG_ERROR("SAXParseException: %s", ((std::string)s).c_str());
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tWarning: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::onStartEntity(const xercesc::Attributes& attrs)
+3 -2
View File
@@ -65,6 +65,7 @@ void EntityFilePreprocessor::parseComponentInfo()
// Name
compInfo.Name = XS::ToString(element->getName());
bool brk = compInfo.Name == "HiddenForLocalPlayer";
// Known allocation
compInfo.Meta->Allocation = m_ComponentCounts[compInfo.Name];
// Annotation
@@ -90,7 +91,7 @@ void EntityFilePreprocessor::parseComponentInfo()
// <xs:all>
auto modelGroupParticle = complexTypeDefinition->getParticle();
if (modelGroupParticle == nullptr || modelGroupParticle->getTermType() != XSParticle::TERM_MODELGROUP) {
//LOG_ERROR("Failed to parse component definition for \"%s\": Model group particle was null or wasn't TERM_MODELGROUP!", compInfo.Name.c_str());
LOG_ERROR("Failed to parse component definition for \"%s\": Model group particle was null or wasn't TERM_MODELGROUP!", compInfo.Name.c_str());
continue;
}
auto modelGroup = modelGroupParticle->getModelGroupTerm();
@@ -113,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) {
+29 -14
View File
@@ -3,6 +3,11 @@
const EntityWrapper EntityWrapper::Invalid = EntityWrapper(nullptr, EntityID_Invalid);
const std::string EntityWrapper::Name()
{
return World->GetName(ID);
}
bool EntityWrapper::HasComponent(const std::string& componentName)
{
if (!Valid()) {
@@ -22,18 +27,7 @@ EntityWrapper EntityWrapper::Parent()
EntityWrapper EntityWrapper::FirstChildByName(const std::string& name)
{
auto itPair = this->World->GetChildren(this->ID);
if (itPair.first == itPair.second) {
return EntityWrapper::Invalid;
}
for (auto it = itPair.first; it != itPair.second; ++it) {
if (this->World->GetName(it->second) == name) {
return EntityWrapper(this->World, it->second);
}
}
return EntityWrapper::Invalid;
return firstChildByNameRecursive(name, this->ID);
}
EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType)
@@ -103,8 +97,29 @@ EntityWrapper::operator EntityID() const
return this->ID;
}
EntityWrapper::operator bool()
EntityWrapper EntityWrapper::firstChildByNameRecursive(const std::string& name, EntityID parent)
{
return this->Valid();
if (!this->World->ValidEntity(parent)) {
return EntityWrapper::Invalid;
}
auto itPair = this->World->GetChildren(parent);
if (itPair.first == itPair.second) {
return EntityWrapper::Invalid;
}
for (auto it = itPair.first; it != itPair.second; ++it) {
std::string itName = this->World->GetName(it->second);
if (itName == name) {
return EntityWrapper(this->World, it->second);
} else if (it->second != EntityID_Invalid) {
EntityWrapper result = firstChildByNameRecursive(name, it->second);
if (result != EntityWrapper::Invalid) {
return result;
}
}
}
return EntityWrapper::Invalid;
}
+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;
+1 -2
View File
@@ -105,8 +105,7 @@ bool Child::BoxCollides(const AABB& boxToTest, AABB& outBoxIntersected) const
for (int i : m_DynamicObjIndices) {
if (!m_DynamicObjectsRef[i].Checked) {
const AABB& objBox = *m_DynamicObjectsRef[i].Box;
if (!Collision::IsSameBoxProbably(boxToTest, objBox) &&
Collision::AABBVsAABB(boxToTest, objBox)) {
if (Collision::AABBVsAABB(boxToTest, objBox)) {
outBoxIntersected = objBox;
return true;
}
+27
View File
@@ -1,5 +1,17 @@
#include "Core/Transform.h"
glm::mat4 Transform::AbsoluteTransformation(EntityWrapper entity)
{
glm::mat4 t = glm::mat4(1.f);
while (entity.Valid()) {
t = glm::translate((glm::vec3&)entity["Transform"]["Position"]) * glm::toMat4(glm::quat((glm::vec3&)entity["Transform"]["Orientation"])) * glm::scale((glm::vec3&)entity["Transform"]["Scale"]) * t;
entity = entity.Parent();
}
return t;
}
glm::vec3 Transform::AbsolutePosition(EntityWrapper entity)
{
return AbsolutePosition(entity.World, entity.ID);
@@ -19,6 +31,19 @@ glm::vec3 Transform::AbsolutePosition(World* world, EntityID entity)
return position;
}
glm::vec3 Transform::AbsoluteOrientationEuler(EntityWrapper entity)
{
glm::vec3 orientation;
while (entity.Valid()) {
ComponentWrapper transform = entity["Transform"];
orientation += (glm::vec3)transform["Orientation"];
entity = entity.Parent();
}
return orientation;
}
glm::quat Transform::AbsoluteOrientation(EntityWrapper entity)
{
return AbsoluteOrientation(entity.World, entity.ID);
@@ -62,6 +87,8 @@ glm::mat4 Transform::ModelMatrix(EntityWrapper entity)
glm::mat4 Transform::ModelMatrix(EntityID entity, World* world)
{
return AbsoluteTransformation(EntityWrapper(world, entity));
glm::vec3 position = Transform::AbsolutePosition(world, entity);
glm::quat orientation = Transform::AbsoluteOrientation(world, entity);
glm::vec3 scale = Transform::AbsoluteScale(world, entity);
+37 -1
View File
@@ -4,4 +4,40 @@
_LOG_LEVEL LOG_LEVEL = LOG_LEVEL_DEBUG;
#else
_LOG_LEVEL LOG_LEVEL = LOG_LEVEL_INFO;
#endif
#endif
const char* _LOG_LEVEL_PREFIX[] =
{
"EE: ",
"",
"WW: ",
"DD: "
};
void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int line, const char* format, ...)
{
if (logLevel > LOG_LEVEL) {
return;
}
char* message = nullptr;
va_list args;
va_start(args, format);
size_t size = vsnprintf(message, 0, format, args) + 1;
va_end(args);
va_start(args, format);
message = new char[size];
vsnprintf(message, size, format, args);
va_end(args);
if (logLevel == LOG_LEVEL_ERROR) {
std::cerr << file << ":" << line << " " << func << std::endl;
std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} else {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
}
delete[] message;
}
+13 -2
View File
@@ -54,8 +54,12 @@ ComponentWrapper World::AttachComponent(EntityID entity, const std::string& comp
bool World::HasComponent(EntityID entity, const std::string& componentType) const
{
ComponentPool* pool = m_ComponentPools.at(componentType);
return pool->KnowsEntity(entity);
auto it = m_ComponentPools.find(componentType);
if (it == m_ComponentPools.end()) {
return false;
} else {
return it->second->KnowsEntity(entity);
}
}
ComponentWrapper World::GetComponent(EntityID entity, const std::string& componentType)
@@ -92,6 +96,13 @@ EntityID World::GetParent(EntityID entity)
void World::SetParent(EntityID entity, EntityID parent)
{
// Don't allow an entity to be a child to itself!
if (entity == parent) {
// HACK: We purposely don't check the whole hierarchy of children here, since it would be way too slow.
// This might result in infinite loops if an entity somehow ends up as a child.
return;
}
EntityID lastParent = m_EntityParents.at(entity);
auto parentChildren = m_EntityChildren.equal_range(lastParent);
for (auto it = parentChildren.first; it != parentChildren.second; it++) {
+150 -26
View File
@@ -1,10 +1,16 @@
#include "Editor/EditorGUI.h"
#include "Rendering/ESetCamera.h"
EditorGUI::EditorGUI(World* world, EventBroker* eventBroker)
: m_World(world)
, m_EventBroker(eventBroker)
{
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &EditorGUI::OnKeyDown);
EVENT_SUBSCRIBE_MEMBER(m_EFileDropped, &EditorGUI::OnFileDropped);
EVENT_SUBSCRIBE_MEMBER(m_EPause, &EditorGUI::OnPause);
EVENT_SUBSCRIBE_MEMBER(m_EResume, &EditorGUI::OnResume);
EVENT_SUBSCRIBE_MEMBER(m_ELockMouse, &EditorGUI::OnLockMouse);
EVENT_SUBSCRIBE_MEMBER(m_EUnlockMouse, &EditorGUI::OnUnlockMouse);
}
void EditorGUI::Draw()
@@ -36,39 +42,60 @@ void EditorGUI::drawTools()
return;
}
// Widget modes
createWidgetToolButton(WidgetMode::Translate);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Translate");
ImGui::SetTooltip("Translate (W)");
}
ImGui::SameLine();
createWidgetToolButton(WidgetMode::Rotate);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Rotate");
ImGui::SetTooltip("Rotate (E)");
}
ImGui::SameLine();
createWidgetToolButton(WidgetMode::Scale);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Scale");
ImGui::SetTooltip("Scale (R)");
}
ImGui::SameLine();
ImGui::ItemSize(ImVec2(5, 0));
// Widget space
ImGui::SameLine();
GLuint spaceTexture = 0;
if (m_CurrentWidgetSpace == WidgetSpace::Global) {
spaceTexture = tryLoadTexture("Textures/Icons/Global.png");
} else if (m_CurrentWidgetSpace == WidgetSpace::Local) {
spaceTexture = tryLoadTexture("Textures/Icons/Local.png");
}
if (ImGui::ImageButton(reinterpret_cast<void*>(spaceTexture), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
toggleWidgetSpace();
}
if (ImGui::IsItemHovered()) {
if (m_CurrentWidgetSpace == WidgetSpace::Global) {
ImGui::SetTooltip("Widget space: Global (X)");
} else if (m_CurrentWidgetSpace == WidgetSpace::Local) {
ImGui::SetTooltip("Widget space: Local (X)");
}
}
ImGui::SameLine();
ImGui::ItemSize(ImVec2(5, 0));
// Play button
ImGui::SameLine();
static bool paused = false;
if (ImGui::ImageButton((void*)tryLoadTexture("Textures/Icons/Play.png"), ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (!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);
paused = false;
}
// 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), (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);
paused = true;
}
ImGui::End();
@@ -167,10 +194,7 @@ bool EditorGUI::drawEntityNode(EntityWrapper entity)
ImGui::Text(formatEntityName(entity).c_str());
ImGui::End();
}
}/* else if (m_CurrentlyDragging == entity) {
LOG_DEBUG("Stopped dragging %i", entity.ID);
m_CurrentlyDragging = EntityWrapper::Invalid;
}*/
}
// Entity context menu
std::string contextMenuUniqueID = std::string("EntityContextMenu") + std::to_string(entity.ID);
if (hovered && ImGui::IsMouseClicked(1)) {
@@ -233,10 +257,12 @@ void EditorGUI::drawComponents(EntityWrapper entity)
componentTypes.push_back(pair.first.c_str());
}
}
// Sort components in alphabetical order
std::sort(componentTypes.begin(), componentTypes.end(), compareCharArray);
// Draw combo box
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() - 10.f);
int selectedItem = -1;
if (ImGui::Combo("", &selectedItem, componentTypes.data(), 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));
@@ -282,9 +308,8 @@ bool EditorGUI::drawComponentNode(EntityWrapper entity, const ComponentInfo& ci)
// Draw component fields
ComponentWrapper& component = entity.World->GetComponent(entity.ID, ci.Name);
for (auto& kv : ci.Fields) {
const std::string& fieldName = kv.first;
const ComponentInfo::Field_t& field = kv.second;
for (auto& fieldName : ci.FieldsInOrder) {
const ComponentInfo::Field_t& field = ci.Fields.at(fieldName);
// Draw the field widget based on its type
bool dirty = drawComponentField(component, field);
@@ -305,6 +330,14 @@ bool EditorGUI::drawComponentNode(EntityWrapper entity, const ComponentInfo& ci)
}
}
if (ci.Name == "Camera") {
if (ImGui::Button("Activate")) {
Events::SetCamera e;
e.CameraEntity = entity;
m_EventBroker->Publish(e);
}
}
return true;
}
@@ -426,18 +459,31 @@ bool EditorGUI::drawComponentField_bool(ComponentWrapper &c, const ComponentInfo
bool EditorGUI::drawComponentField_string(ComponentWrapper &c, const ComponentInfo::Field_t &field)
{
bool result = false;
auto& val = c.Field<std::string>(field.Name);
char tempString[1024]; // Let's just hope this is an sufficiently large buffer for strings :)
tempString[1023] = '\0'; // Null terminator just in case the string is larger than the buffer
// Copy the string into the buffer, taking the null terminator into account
memcpy(tempString, val.c_str(), std::min(val.length() + 1, sizeof(tempString) - 1));
if (ImGui::InputText("", tempString, sizeof(tempString))) {
val = std::string(tempString);
return true;
} else {
return false;
result = true;
}
// TODO: Handle drag and drop of files
// Handle file drag and drop
if (ImGui::IsItemHovered() && !m_DroppedFile.empty()) {
// Unset potential input focus or our newly set value will be overwritten!
if (ImGui::IsItemActive()) {
ImGui::SetActiveID(0, nullptr);
}
// Set the actual dropped value
val = m_DroppedFile;
m_DroppedFile = "";
}
return result;
}
void EditorGUI::drawModals()
@@ -519,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),
@@ -528,10 +574,7 @@ void EditorGUI::createWidgetToolButton(WidgetMode mode)
(m_CurrentWidgetMode == mode) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1)
)
) {
if (m_OnWidgetMode != nullptr) {
m_OnWidgetMode(mode);
}
m_CurrentWidgetMode = mode;
setWidgetMode(mode);
}
}
@@ -561,6 +604,61 @@ bool EditorGUI::OnKeyDown(const Events::KeyDown& e)
}
}
if (!m_MouseLocked) {
if (e.KeyCode == GLFW_KEY_W) {
setWidgetMode(WidgetMode::Translate);
}
if (e.KeyCode == GLFW_KEY_E) {
setWidgetMode(WidgetMode::Rotate);
}
if (e.KeyCode == GLFW_KEY_R) {
setWidgetMode(WidgetMode::Scale);
}
if (e.KeyCode == GLFW_KEY_X) {
toggleWidgetSpace();
}
}
return true;
}
bool EditorGUI::OnFileDropped(const Events::FileDropped& e)
{
// Make a best effort to make the path relative to the working directory of the executable
m_DroppedFile = boost::filesystem::path(e.Path).lexically_relative(boost::filesystem::current_path()).string();
// Compensate for Windows retardedness
std::replace(m_DroppedFile.begin(), m_DroppedFile.end(), '\\', '/');
// Special case for when people drop from the asset folder instead of from the symlink to the asset folders in bin
boost::algorithm::replace_first(m_DroppedFile, "../assets/", "");
return true;
}
bool EditorGUI::OnPause(const Events::Pause& e)
{
if (e.World == m_World) {
m_Paused = true;
}
return true;
}
bool EditorGUI::OnResume(const Events::Resume& e)
{
if (e.World == m_World) {
m_Paused = false;
}
return true;
}
bool EditorGUI::OnLockMouse(const Events::LockMouse& e)
{
m_MouseLocked = true;
return true;
}
bool EditorGUI::OnUnlockMouse(const Events::UnlockMouse& e)
{
m_MouseLocked = false;
return true;
}
@@ -635,6 +733,32 @@ void EditorGUI::openModal(const std::string& modal)
m_ModalsToOpen.insert(modal);
}
void EditorGUI::setWidgetMode(WidgetMode mode)
{
if (m_OnWidgetMode != nullptr) {
m_OnWidgetMode(mode);
}
m_CurrentWidgetMode = mode;
}
void EditorGUI::toggleWidgetSpace()
{
if (m_CurrentWidgetSpace == WidgetSpace::Global) {
m_CurrentWidgetSpace = WidgetSpace::Local;
} else if (m_CurrentWidgetSpace == WidgetSpace::Local) {
m_CurrentWidgetSpace = WidgetSpace::Global;
}
if (m_OnWidgetSpace != nullptr) {
m_OnWidgetSpace(m_CurrentWidgetSpace);
}
}
bool EditorGUI::compareCharArray(const char* c1, const char* c2)
{
return strcmp(c1, c2) < 0;
}
void EditorGUI::SetDirty(EntityWrapper entity)
{
EntityWrapper baseParent = entity;
@@ -722,7 +846,7 @@ void EditorGUI::entityDelete(EntityWrapper entity)
void EditorGUI::entityChangeParent(EntityWrapper entity, EntityWrapper parent)
{
if (entity == parent) {
if (entity == parent || parent.IsChildOf(entity)) {
return;
}
+10 -6
View File
@@ -12,7 +12,7 @@ EditorRenderSystem::EditorRenderSystem(World* m_World, EventBroker* eventBroker,
void EditorRenderSystem::Update(double dt)
{
if (m_CurrentCamera) {
if (m_CurrentCamera.Valid()) {
ComponentWrapper cameraTransform = m_CurrentCamera["Transform"];
m_EditorCamera->SetPosition(cameraTransform["Position"]);
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cameraTransform["Orientation"]));
@@ -48,8 +48,12 @@ void EditorRenderSystem::Update(double dt)
EntityWrapper entity(m_World, cModel.EntityID);
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
for (auto matGroup : model->MaterialGroups()) {
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World);
scene.ForwardJobs.push_back(modelJob);
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f);
if(cModel["Transparent"]) {
scene.TransparentObjects.push_back(modelJob);
} else {
scene.OpaqueObjects.push_back(modelJob);
}
}
}
}
@@ -76,9 +80,9 @@ bool EditorRenderSystem::OnSetCamera(Events::SetCamera& e)
{
ComponentWrapper cTransform = e.CameraEntity["Transform"];
ComponentWrapper cCamera = e.CameraEntity["Camera"];
m_EditorCamera->SetFOV((double)cCamera["FOV"]);
m_EditorCamera->SetNearClip((double)cCamera["NearClip"]);
m_EditorCamera->SetFarClip((double)cCamera["FarClip"]);
m_EditorCamera->SetFOV(static_cast<float>((double)cCamera["FOV"]));
m_EditorCamera->SetNearClip(static_cast<float>((double)cCamera["NearClip"]));
m_EditorCamera->SetFarClip(static_cast<float>((double)cCamera["FarClip"]));
m_EditorCamera->SetPosition(cTransform["Position"]);
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
m_CurrentCamera = e.CameraEntity;

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