Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c5e0a1566e | |||
| 167f78951e | |||
| 4b6d4e581f | |||
| 123fbf5633 | |||
| 4c054d5b8c | |||
| 012420b4da | |||
| 50b0a091ec | |||
| 727b6ba871 | |||
| e11cdaa662 |
@@ -2,14 +2,14 @@
|
||||
#define EEntityDeleted_h__
|
||||
|
||||
#include "Event.h"
|
||||
#include "Entity.h"
|
||||
#include "EntityWrapper.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct EntityDeleted : Event
|
||||
{
|
||||
EntityID DeletedEntity;
|
||||
EntityWrapper DeletedEntity;
|
||||
// True if the entity deletion was triggered because the entity's parent was deleted before it
|
||||
bool Cascaded;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef RespawnSystem_h__
|
||||
#define RespawnSystem_h__
|
||||
|
||||
#include "System.h"
|
||||
#include "SpawnerSystem.h"
|
||||
#include "EEntityDeleted.h"
|
||||
#include "EPause.h"
|
||||
|
||||
class RespawnSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
RespawnSystem(SystemParams params);
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cRespawn, double dt) override;
|
||||
|
||||
private:
|
||||
std::unordered_map<EntityWrapper, EntityWrapper> m_LastRespawnedEntity;
|
||||
bool m_Paused = false;
|
||||
|
||||
EventRelay<RespawnSystem, Events::EntityDeleted> m_EEntityDeleted;
|
||||
bool OnEntityDeleted(const Events::EntityDeleted& e);
|
||||
EventRelay<RespawnSystem, Events::Pause> m_EPause;
|
||||
bool OnPause(const Events::Pause& e);
|
||||
EventRelay<RespawnSystem, Events::Resume> m_EResume;
|
||||
bool OnResume(const Events::Resume& e);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "Common.h"
|
||||
#include "GLM.h"
|
||||
#include "Core/System.h"
|
||||
#include "Events/ESpawnerSpawn.h"
|
||||
#include "Core/ESpawnerSpawn.h"
|
||||
#include "Core/Transform.h"
|
||||
#include "Core/EntityFile.h"
|
||||
|
||||
@@ -68,7 +68,7 @@ protected:
|
||||
|
||||
const std::string m_ComponentType;
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) = 0;
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt) = 0;
|
||||
};
|
||||
|
||||
class ImpureSystem : public virtual System
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "../Core/ELockMouse.h"
|
||||
#include "../Core/EFileDropped.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
#include "Game/Events/ESpawnerSpawn.h"
|
||||
#include "../Core/ESpawnerSpawn.h"
|
||||
|
||||
class EditorGUI
|
||||
{
|
||||
|
||||
@@ -63,8 +63,7 @@ private:
|
||||
|
||||
GLuint m_DepthMap;
|
||||
FrameBuffer m_DepthBuffer;
|
||||
ShaderProgram* m_ShadowProgram;
|
||||
ShaderProgram* m_ShadowProgramSkinned;
|
||||
ShaderProgram* m_ShadowProgram;
|
||||
|
||||
std::array<glm::mat4, MAX_SPLITS> m_LightProjection;
|
||||
std::array<glm::mat4, MAX_SPLITS> m_LightView;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "Rendering/IRenderer.h"
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Core/Event.h"
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Core/SpawnerSystem.h"
|
||||
|
||||
|
||||
#include "GUI/EButtonClicked.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Core/System.h"
|
||||
#include "Input/EInputCommand.h"
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Events/ESpawnerSpawn.h"
|
||||
#include "Core/SpawnerSystem.h"
|
||||
#include "Core/ESpawnerSpawn.h"
|
||||
#include "Core/EPlayerSpawned.h"
|
||||
#include "Core/EPlayerDeath.h"
|
||||
#include "Rendering/ESetCamera.h"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "Rendering/IRenderer.h"
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Core/Event.h"
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Core/SpawnerSystem.h"
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
#include "Network/ESearchForServers.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "Core/Octree.h"
|
||||
#include "Collision/EntityAABB.h"
|
||||
#include "Input/EInputCommand.h"
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Core/SpawnerSystem.h"
|
||||
#include "Rendering/ESetCamera.h"
|
||||
#include "Core/ConfigFile.h"
|
||||
#include "Rendering/EAutoAnimationBlend.h"
|
||||
|
||||
@@ -68,4 +68,5 @@
|
||||
<xs:include schemaLocation="Components/NetworkComponent.xsd"/>
|
||||
<xs:include schemaLocation="Components/ServerIdentity.xsd"/>
|
||||
<xs:include schemaLocation="Components/ServerList.xsd"/>
|
||||
<xs:include schemaLocation="Components/Respawn.xsd"/>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Respawn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Respawn.xsd">
|
||||
<Delay>0</Delay>
|
||||
<_RespawnCountdown>0</_RespawnCountdown>
|
||||
</Respawn>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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="Respawn">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Triggers a Spawner component after its last spawned entity is destroyed with an optional delay.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Delay" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="_RespawnCountdown" type="t:double" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -2,19 +2,13 @@
|
||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:NetworkComponent/>
|
||||
<c:HealthPickup/>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/PickUps/HealthPickUp.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:RaptorCopter>
|
||||
<Speed>8</Speed>
|
||||
<Axis X="0" Y="0.100000001" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:NetworkComponent/>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="2.36784196" Z="0"/>
|
||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||
<Orientation X="0" Y="18767.0273" Z="0"/>
|
||||
<Scale X="0.25" Y="0.25" Z="0.25"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.871185362" Z="1.77631724"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/PickUps/PickUpHolder.mesh</Resource>
|
||||
<Shadow>false</Shadow>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Scale X="0.479999989" Y="0.479999989" Z="0.479999989"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.41138339" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Respawn>
|
||||
<Delay>3</Delay>
|
||||
</c:Respawn>
|
||||
<c:RaptorCopter>
|
||||
<Speed>1</Speed>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:FloatingEffect>
|
||||
<Period>2</Period>
|
||||
<Time>75.797556530109119</Time>
|
||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||
</c:FloatingEffect>
|
||||
<c:Spawner>
|
||||
<EntityFile>Schema/Entities/HealthPickup.xml</EntityFile>
|
||||
</c:Spawner>
|
||||
<c:Transform>
|
||||
<Position X="-0" Y="-0.118795805" Z="-0"/>
|
||||
<Orientation X="0" Y="13.0735149" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -71,6 +71,7 @@
|
||||
<xs:element ref="c:NetworkComponent" minOccurs="0"/>
|
||||
<xs:element ref="c:ServerIdentity" minOccurs="0"/>
|
||||
<xs:element ref="c:ServerList" minOccurs="0"/>
|
||||
<xs:element ref="c:Respawn" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
layout (location = 0) in vec3 Position;
|
||||
layout (location = 4) in vec2 TextureCoords;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
out VertexData{
|
||||
vec2 TextureCoordinate;
|
||||
}Output;
|
||||
|
||||
void main()
|
||||
{
|
||||
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])];
|
||||
}
|
||||
|
||||
gl_Position = P * V * M * boneTransform * vec4(Position, 1.0);
|
||||
Output.TextureCoordinate = TextureCoords;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "Core/RespawnSystem.h"
|
||||
|
||||
RespawnSystem::RespawnSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("Respawn")
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &RespawnSystem::OnEntityDeleted);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &RespawnSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &RespawnSystem::OnResume);
|
||||
}
|
||||
|
||||
void RespawnSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cRespawn, double dt)
|
||||
{
|
||||
if (m_Paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.HasComponent("Spawner")) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityWrapper& lastRespawnedEntity = m_LastRespawnedEntity[entity];
|
||||
if (!lastRespawnedEntity.Valid()) {
|
||||
double& _respawnCountdown = cRespawn["_RespawnCountdown"];
|
||||
_respawnCountdown -= dt;
|
||||
if (_respawnCountdown <= 0) {
|
||||
lastRespawnedEntity = SpawnerSystem::Spawn(entity, entity);
|
||||
_respawnCountdown = cRespawn["Delay"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool RespawnSystem::OnEntityDeleted(const Events::EntityDeleted& e)
|
||||
{
|
||||
m_LastRespawnedEntity.erase(e.DeletedEntity);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RespawnSystem::OnPause(const Events::Pause& e)
|
||||
{
|
||||
if (e.World == m_World) {
|
||||
m_Paused = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RespawnSystem::OnResume(const Events::Resume& e)
|
||||
{
|
||||
if (e.World == m_World) {
|
||||
m_Paused = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Core/SpawnerSystem.h"
|
||||
#include "Collision/Collision.h"
|
||||
|
||||
SpawnerSystem::SpawnerSystem(SystemParams params)
|
||||
@@ -24,7 +24,7 @@ glm::vec3 Transform::AbsolutePosition(World* world, EntityID entity)
|
||||
while (entity != EntityID_Invalid) {
|
||||
ComponentWrapper transform = world->GetComponent(entity, "Transform");
|
||||
EntityID parent = world->GetParent(entity);
|
||||
position += Transform::AbsoluteOrientation(world, parent) * (glm::vec3)transform["Position"];
|
||||
position += Transform::AbsoluteScale(world, parent) * (Transform::AbsoluteOrientation(world, parent) * (glm::vec3)transform["Position"]);
|
||||
entity = parent;
|
||||
}
|
||||
|
||||
@@ -89,12 +89,12 @@ 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);
|
||||
//glm::vec3 position = Transform::AbsolutePosition(world, entity);
|
||||
//glm::quat orientation = Transform::AbsoluteOrientation(world, entity);
|
||||
//glm::vec3 scale = Transform::AbsoluteScale(world, entity);
|
||||
|
||||
glm::mat4 modelMatrix = glm::translate(glm::mat4(), position) * glm::toMat4(orientation) * glm::scale(scale);
|
||||
return modelMatrix;
|
||||
//glm::mat4 modelMatrix = glm::translate(glm::mat4(), position) * glm::toMat4(orientation) * glm::scale(scale);
|
||||
//return modelMatrix;
|
||||
}
|
||||
|
||||
glm::vec3 Transform::TransformPoint(const glm::vec3& point, const glm::mat4& matrix)
|
||||
|
||||
@@ -223,7 +223,7 @@ void World::deleteEntityRecursive(EntityID entity, bool cascaded /*= false*/)
|
||||
|
||||
if (m_EventBroker != nullptr) {
|
||||
Events::EntityDeleted e;
|
||||
e.DeletedEntity = entity;
|
||||
e.DeletedEntity = EntityWrapper(this, entity);
|
||||
e.Cascaded = cascaded;
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ EditorRenderSystem::EditorRenderSystem(SystemParams params, IRenderer* renderer,
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &EditorRenderSystem::OnSetCamera);
|
||||
auto resolution = Rectangle::Rectangle(1280, 720);
|
||||
m_EditorCamera = new Camera((float)resolution.Width / resolution.Height, glm::radians(45.f), 0.01f, 5000.f);
|
||||
m_EditorCamera = new Camera((float)resolution.Width / resolution.Height, glm::radians(45.f), 0.001f, 500.f);
|
||||
}
|
||||
|
||||
void EditorRenderSystem::Update(double dt)
|
||||
|
||||
@@ -204,14 +204,21 @@ bool EditorSystem::OnWidgetDelta(const Events::WidgetDelta& e)
|
||||
if (m_CurrentSelection.Valid()) {
|
||||
if (m_WidgetSpace == EditorGUI::WidgetSpace::Global) {
|
||||
glm::quat parentOrientation;
|
||||
glm::vec3 parentScale(1.f);
|
||||
EntityWrapper parent = m_CurrentSelection.Parent();
|
||||
if (parent.Valid()) {
|
||||
parentOrientation = glm::inverse(Transform::AbsoluteOrientation(parent));
|
||||
parentScale = Transform::AbsoluteScale(parent);
|
||||
}
|
||||
(glm::vec3&)m_CurrentSelection["Transform"]["Position"] += parentOrientation * e.Translation;
|
||||
(glm::vec3&)m_CurrentSelection["Transform"]["Position"] += parentOrientation * e.Translation / parentScale;
|
||||
} else if (m_WidgetSpace == EditorGUI::WidgetSpace::Local) {
|
||||
glm::vec3 parentScale(1.f);
|
||||
EntityWrapper parent = m_CurrentSelection.Parent();
|
||||
if (parent.Valid()) {
|
||||
parentScale = Transform::AbsoluteScale(parent);
|
||||
}
|
||||
glm::quat selectionOri = glm::quat((glm::vec3)m_CurrentSelection["Transform"]["Orientation"]);
|
||||
glm::vec3 localTranslation = selectionOri * e.Translation;
|
||||
glm::vec3 localTranslation = selectionOri * e.Translation / parentScale;
|
||||
(glm::vec3&)m_CurrentSelection["Transform"]["Position"] += localTranslation;
|
||||
}
|
||||
m_EditorGUI->SetDirty(m_CurrentSelection);
|
||||
|
||||
@@ -494,7 +494,7 @@ bool Server::OnEntityDeleted(const Events::EntityDeleted & e)
|
||||
{
|
||||
if (!e.Cascaded) {
|
||||
Packet packet = Packet(MessageType::EntityDeleted);
|
||||
packet.WritePrimitive<EntityID>(e.DeletedEntity);
|
||||
packet.WritePrimitive<EntityID>(e.DeletedEntity.ID);
|
||||
reliableBroadcast(packet);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -127,12 +127,12 @@ void AnimationSystem::UpdateAnimations(double dt)
|
||||
void AnimationSystem::UpdateWeights(double dt)
|
||||
{
|
||||
for (auto it = m_AutoBlendQueues.begin(); it != m_AutoBlendQueues.end(); ) {
|
||||
/* LOG_INFO("%s", it->first.Name().c_str());
|
||||
it->second.PrintQueue();*/
|
||||
LOG_INFO("%s", it->first.Name().c_str());
|
||||
it->second.PrintQueue();
|
||||
|
||||
if(it->second.HasActiveBlendJob()) {
|
||||
AutoBlendQueue::AutoBlendJob& blendJob = it->second.GetActiveBlendJob();
|
||||
//LOG_INFO("%s", blendJob.RootNode.Name().c_str());
|
||||
LOG_INFO("%s", blendJob.RootNode.Name().c_str());
|
||||
std::shared_ptr<BlendTree> blendTree = it->second.GetBlendTree();
|
||||
if (blendTree != nullptr) {
|
||||
if (blendJob.Duration != 0.0) {
|
||||
@@ -283,7 +283,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
||||
|
||||
bool AnimationSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||
{
|
||||
EntityWrapper entity = EntityWrapper(m_World, e.DeletedEntity);
|
||||
EntityWrapper entity = e.DeletedEntity;
|
||||
|
||||
if (entity.HasComponent("Model")) {
|
||||
Model* model;
|
||||
|
||||
@@ -219,7 +219,7 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
m_PickingSkinnedProgram->Bind();
|
||||
lastShader = m_PickingSkinnedProgram->GetHandle();
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix));
|
||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
|
||||
std::vector<glm::mat4> frameBones;
|
||||
|
||||
@@ -156,12 +156,7 @@ void ShadowPass::InitializeShaderPrograms()
|
||||
m_ShadowProgram->BindFragDataLocation(0, "ShadowMap");
|
||||
m_ShadowProgram->Link();
|
||||
|
||||
m_ShadowProgramSkinned = ResourceManager::Load<ShaderProgram>("#ShadowProgramSkinned");
|
||||
m_ShadowProgramSkinned->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ShadowSkinned.vert.glsl")));
|
||||
m_ShadowProgramSkinned->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Shadow.frag.glsl")));
|
||||
m_ShadowProgramSkinned->Compile();
|
||||
m_ShadowProgramSkinned->BindFragDataLocation(0, "ShadowMap");
|
||||
m_ShadowProgramSkinned->Link();
|
||||
|
||||
}
|
||||
|
||||
void ShadowPass::ClearBuffer()
|
||||
@@ -217,7 +212,8 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
|
||||
ShadowPassState* state = new ShadowPassState(m_DepthBuffer.GetHandle());
|
||||
|
||||
|
||||
m_ShadowProgram->Bind();
|
||||
GLuint shaderHandle = m_ShadowProgram->GetHandle();
|
||||
glViewport(0, 0, m_ResolutionSizeWidth, m_ResolutionSizeHeight);
|
||||
|
||||
for (int i = 0; i < m_CurrentNrOfSplits; i++) {
|
||||
@@ -225,11 +221,7 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_DepthMap, 0, i);
|
||||
|
||||
|
||||
GLuint shaderHandle;
|
||||
|
||||
for (auto &job : scene.Jobs.DirectionalLight) {
|
||||
|
||||
auto directionalLightJob = std::dynamic_pointer_cast<DirectionalLightJob>(job);
|
||||
|
||||
if (directionalLightJob) {
|
||||
@@ -240,19 +232,9 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
//RadiusToLightspace(m_shadowFrusta[i]);
|
||||
m_LightProjection[i] = glm::ortho(m_shadowFrusta[i].LRBT[LEFT], m_shadowFrusta[i].LRBT[RIGHT], m_shadowFrusta[i].LRBT[BOTTOM], m_shadowFrusta[i].LRBT[TOP], m_NearFarPlane[NEAR], m_NearFarPlane[FAR]);
|
||||
|
||||
|
||||
m_ShadowProgram->Bind();
|
||||
shaderHandle = m_ShadowProgram->GetHandle();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(m_LightProjection[i]));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(m_LightView[i]));
|
||||
|
||||
m_ShadowProgramSkinned->Bind();
|
||||
shaderHandle = m_ShadowProgramSkinned->GetHandle();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(m_LightProjection[i]));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(m_LightView[i]));
|
||||
|
||||
|
||||
|
||||
GLERROR("ShadowLight ERROR");
|
||||
|
||||
for (auto &objectJob : scene.Jobs.OpaqueObjects) {
|
||||
@@ -263,23 +245,6 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(modelJob->Model->IsSkinned()) {
|
||||
m_ShadowProgramSkinned->Bind();
|
||||
shaderHandle = m_ShadowProgramSkinned->GetHandle();
|
||||
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->BlendTree != nullptr) {
|
||||
frameBones = modelJob->BlendTree->GetFinalPose();
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetTPose();
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
m_ShadowProgram->Bind();
|
||||
shaderHandle = m_ShadowProgram->GetHandle();
|
||||
}
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "Alpha"), 1.f);
|
||||
|
||||
@@ -300,23 +265,6 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (modelJob->Model->IsSkinned()) {
|
||||
m_ShadowProgramSkinned->Bind();
|
||||
shaderHandle = m_ShadowProgramSkinned->GetHandle();
|
||||
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->BlendTree != nullptr) {
|
||||
frameBones = modelJob->BlendTree->GetFinalPose();
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetTPose();
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
m_ShadowProgram->Bind();
|
||||
shaderHandle = m_ShadowProgram->GetHandle();
|
||||
}
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "Alpha"), modelJob->Color.a);
|
||||
|
||||
|
||||
+3
-1
@@ -7,7 +7,7 @@
|
||||
#include "Systems/RaptorCopterSystem.h"
|
||||
#include "Systems/HealthSystem.h"
|
||||
#include "Systems/PlayerMovementSystem.h"
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Core/SpawnerSystem.h"
|
||||
#include "Systems/PlayerSpawnSystem.h"
|
||||
#include "Systems/PlayerDeathSystem.h"
|
||||
#include "Systems/FloatingEffectSystem.h"
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "Game/Systems/MainMenuSystem.h"
|
||||
#include "Game/Systems/ServerListSystem.h"
|
||||
#include "Game/Systems/StartSystem.h"
|
||||
#include "Core/RespawnSystem.h"
|
||||
#include "Rendering/TextureSprite.h"
|
||||
|
||||
|
||||
@@ -135,6 +136,7 @@ Game::Game(int argc, char* argv[])
|
||||
m_SystemPipeline->AddSystem<HealthSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<SpawnerSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<RespawnSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<PlayerSpawnSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<AssaultWeaponBehaviour>(updateOrderLevel, m_Renderer, m_OctreeCollision);
|
||||
m_SystemPipeline->AddSystem<DefenderWeaponBehaviour>(updateOrderLevel, m_Renderer, m_OctreeCollision);
|
||||
|
||||
@@ -67,7 +67,7 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
||||
bool PlayerDeathSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||
{
|
||||
// We only care about when the local players death effect is removed.
|
||||
if (m_LocalPlayerDeathEffect.ID != e.DeletedEntity) {
|
||||
if (m_LocalPlayerDeathEffect != e.DeletedEntity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,18 +208,6 @@ bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
||||
m_EventBroker->Publish(lock);
|
||||
}
|
||||
|
||||
// HACK: Set the player model color to team color
|
||||
EntityWrapper playerModel = e.Player.FirstChildByName("PlayerModel");
|
||||
if (playerModel.Valid() && e.Player.HasComponent("Team")) {
|
||||
ComponentWrapper cTeam = e.Player["Team"];
|
||||
ComponentWrapper cModel = playerModel["Model"];
|
||||
if ((ComponentInfo::EnumType)cTeam["Team"] == cTeam["Team"].Enum("Red")) {
|
||||
cModel["Color"] = glm::vec3(1.f, 0.f, 0.f);
|
||||
} else if ((ComponentInfo::EnumType)cTeam["Team"] == cTeam["Team"].Enum("Blue")) {
|
||||
cModel["Color"] = glm::vec3(0.f, 0.25f, 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user