Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e150da7ff | |||
| 9b5e4c10fd | |||
| 52e5e2527a | |||
| 36253a8afd | |||
| b73595eed0 | |||
| f9e640ffc6 | |||
| ac20e41a5d | |||
| 4f99f6ef74 | |||
| d0a083a1e3 | |||
| d5f06fa8c2 | |||
| 8bb8ebbea3 | |||
| b7d88808e2 | |||
| f8f536802f | |||
| 60df30fa59 | |||
| c544f349fd | |||
| 0c1a2d3160 |
+1
-1
Submodule assets updated: bc6e7df04c...504752c949
@@ -48,13 +48,13 @@ bool RayVsTriangle(const Ray& ray,
|
||||
bool trueOnNegativeDistance = false);
|
||||
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix);
|
||||
//Return true if the ray hits any of the triangles in the model.
|
||||
//Also returns the position of the intersection point. Will loop through all the whole model indices.
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& outHitPosition);
|
||||
@@ -62,7 +62,7 @@ bool RayVsModel(const Ray& ray,
|
||||
//Also returns the distance from the ray origin to the closest
|
||||
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
float& outDistance,
|
||||
@@ -70,7 +70,7 @@ bool RayVsModel(const Ray& ray,
|
||||
float& outVCoord);
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& boxVelocity,
|
||||
@@ -80,7 +80,7 @@ bool AABBvsTriangles(const AABB& box,
|
||||
|
||||
//Detects collision, but does not resolve.
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix);
|
||||
|
||||
@@ -92,7 +92,7 @@ enum Output
|
||||
};
|
||||
//Detects intersection and containment.
|
||||
Output AABBvsTrianglesWContainment(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ECaptured_h__
|
||||
#define ECaptured_h__
|
||||
#ifndef Events_Captured_h__
|
||||
#define Events_Captured_h__
|
||||
|
||||
#include "EventBroker.h"
|
||||
#include "../Core/Entity.h"
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
#include "../Game/Events/EDashAbility.h"
|
||||
#include "Network/EDisplayServerlist.h"
|
||||
#include "Network/EConnectRequest.h"
|
||||
#include "Network/EPlayerDisconnected.h"
|
||||
#include "Game/Events/EReset.h"
|
||||
|
||||
class Client : public Network
|
||||
{
|
||||
public:
|
||||
@@ -40,7 +43,7 @@ public:
|
||||
~Client();
|
||||
|
||||
void Connect(std::string address, int port);
|
||||
void Update() override;
|
||||
void Update(double dt) override;
|
||||
private:
|
||||
UDPClient m_Unreliable;
|
||||
TCPClient m_Reliable;
|
||||
@@ -74,10 +77,10 @@ private:
|
||||
// Network logic
|
||||
PlayerDefinition m_PlayerDefinitions[8];
|
||||
SnapshotDefinitions m_NextSnapshot;
|
||||
double m_DurationOfPingTime;
|
||||
std::clock_t m_StartPingTime;
|
||||
std::clock_t m_TimeSinceSentInputs;
|
||||
unsigned int m_SendInputIntervalMs;
|
||||
double m_DurationOfPingTime = 0;
|
||||
double m_StartPingTime = 0;
|
||||
double m_TimeSinceSentInputs = 0;
|
||||
double m_SendInputInterval = 0.033;
|
||||
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
||||
|
||||
// Private member functions
|
||||
@@ -100,6 +103,7 @@ private:
|
||||
void parseDoubleJump(Packet& packet);
|
||||
void parseDashEffect(Packet& packet);
|
||||
void parseAmmoPickup(Packet& packet);
|
||||
void parseRemoveWorld(Packet& packet);
|
||||
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||
void parseSnapshot(Packet& packet);
|
||||
void identifyPacketLoss();
|
||||
@@ -109,7 +113,6 @@ private:
|
||||
void sendLocalPlayerTransform();
|
||||
void becomePlayer();
|
||||
void displayServerlist();
|
||||
void removeWorld();
|
||||
void createMainMenu();
|
||||
// Mapping Logic
|
||||
// Returns if local EntityID exist in map
|
||||
@@ -138,8 +141,8 @@ private:
|
||||
UDPClient m_ServerlistRequest;
|
||||
std::vector<ServerInfo> m_Serverlist;
|
||||
bool m_SearchingForServers = false;
|
||||
std::clock_t m_StartSearchTime;
|
||||
double m_SearchingTime = 200; // Config I guess
|
||||
double m_TimeSearched = 0;
|
||||
double m_SearchingTime = 0.2; // Config I guess
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@ enum class MessageType
|
||||
OnDashEffect,
|
||||
ServerlistRequest,
|
||||
AmmoPickup,
|
||||
RemoveWorld,
|
||||
Invalid
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
Network(World* world, EventBroker* eventBroker);
|
||||
virtual ~Network() { };
|
||||
|
||||
virtual void Update() = 0;
|
||||
virtual void Update(double dt) = 0;
|
||||
|
||||
protected:
|
||||
World* m_World;
|
||||
@@ -40,6 +40,7 @@ protected:
|
||||
void saveToFile();
|
||||
void updateNetworkData();
|
||||
void popNetworkSegmentOfHeader(Packet& packet);
|
||||
void removeWorld();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Network/MessageType.h"
|
||||
#include "Network/PlayerDefinition.h"
|
||||
#include "Core/World.h"
|
||||
#include "Core/EntityFile.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "../Network/Network.h"
|
||||
#include "Input/EInputCommand.h"
|
||||
@@ -24,6 +25,8 @@
|
||||
#include "Core/EPlayerDeath.h"
|
||||
#include "Network/EPlayerConnected.h"
|
||||
#include "Network/EKillDeath.h"
|
||||
#include "Core/EWin.h"
|
||||
#include "Game/Events/EReset.h"
|
||||
|
||||
class Server : public Network
|
||||
{
|
||||
@@ -31,7 +34,7 @@ public:
|
||||
Server(World* world, EventBroker* eventBroker, int port);
|
||||
~Server();
|
||||
|
||||
void Update() override;
|
||||
void Update(double dt) override;
|
||||
|
||||
private:
|
||||
// Network channels
|
||||
@@ -41,6 +44,7 @@ private:
|
||||
// dont forget to set these in the childrens receive logic
|
||||
boost::asio::ip::address m_Address;
|
||||
int m_Port = 27666;
|
||||
bool m_GameIsOver = false;
|
||||
// Sending messages to client logic
|
||||
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
|
||||
std::vector<PlayerID> m_PlayersToDisconnect;
|
||||
@@ -48,14 +52,14 @@ private:
|
||||
char readBuffer[BUFFERSIZE] = { 0 };
|
||||
size_t bytesRead = 0;
|
||||
// time for previouse message
|
||||
std::clock_t previousePingMessage = std::clock();
|
||||
std::clock_t previousSnapshotMessage = std::clock();
|
||||
std::clock_t timOutTimer = std::clock();
|
||||
double previousPingMessage = 0;
|
||||
double previousSnapshotMessage = 0;
|
||||
double timeOutTimer = 0;
|
||||
|
||||
// How often we send messages (milliseconds)
|
||||
float pingIntervalMs;
|
||||
float snapshotInterval;
|
||||
int checkTimeOutInterval = 100;
|
||||
// How often we send messages (seconds)
|
||||
double pingInterval = 1;
|
||||
double snapshotInterval = 0.05;
|
||||
double checkTimeOutInterval = 0.1;
|
||||
int m_NextPlayerID = 0;
|
||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||
//Timers
|
||||
@@ -71,6 +75,7 @@ private:
|
||||
void reliableBroadcast(Packet& packet);
|
||||
void unreliableBroadcast(Packet& packet);
|
||||
void sendSnapshot();
|
||||
void createWorldSnapshot(Packet& packet);
|
||||
void addPlayersToPacket(Packet& packet, EntityID entityID);
|
||||
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
||||
void addInputCommandsToPacket(Packet& packet);
|
||||
@@ -83,6 +88,7 @@ private:
|
||||
void kick(PlayerID player);
|
||||
PlayerID getPlayerIDFromEndpoint();
|
||||
PlayerID getPlayerIDFromEntityID(EntityID entityID);
|
||||
void resetMap();
|
||||
void parsePlayerTransform(Packet& packet);
|
||||
void parseOnInputCommand(Packet& packet);
|
||||
void parseClientPing();
|
||||
@@ -110,6 +116,8 @@ private:
|
||||
bool OnAmmoPickup(const Events::AmmoPickup& e);
|
||||
EventRelay<Server, Events::PlayerDeath> m_EPlayerDeath;
|
||||
bool OnPlayerDeath(const Events::PlayerDeath& e);
|
||||
EventRelay<Server, Events::Win> m_EWin;
|
||||
bool OnWin(const Events::Win& e);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -76,6 +76,7 @@ private:
|
||||
const ShadowPass* m_ShadowPass;
|
||||
|
||||
ShaderProgram* m_ForwardPlusProgram;
|
||||
ShaderProgram* m_ForwardPlusNoShadowsProgram;
|
||||
ShaderProgram* m_ExplosionEffectProgram;
|
||||
ShaderProgram* m_ExplosionEffectSplatMapProgram;
|
||||
ShaderProgram* m_SpriteProgram;
|
||||
|
||||
@@ -16,18 +16,15 @@ private:
|
||||
|
||||
public:
|
||||
~Model();
|
||||
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_Materials; }
|
||||
//const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
|
||||
unsigned int NumberOfVertices() const { return m_Vertices.size(); }
|
||||
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_RawModel->m_Materials; }
|
||||
const glm::mat4& Matrix() const { return m_RawModel->m_Matrix; }
|
||||
const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
|
||||
unsigned int NumberOfVertices() const { return m_RawModel->NumVertices(); }
|
||||
const AABB& Box() const { return m_Box; }
|
||||
bool IsSkinned() const { return m_IsSkinned; }
|
||||
bool IsSkinned() const { return m_RawModel->IsSkinned(); }
|
||||
GLuint VAO;
|
||||
GLuint ElementBuffer;
|
||||
//RawModel* m_RawModel;
|
||||
|
||||
Skeleton* m_Skeleton = nullptr;
|
||||
std::vector<glm::vec3> m_Vertices;
|
||||
std::vector<unsigned int> m_Indices;
|
||||
RawModel* m_RawModel;
|
||||
|
||||
private:
|
||||
AABB m_Box;
|
||||
@@ -37,9 +34,6 @@ private:
|
||||
GLuint TangentNormalsBuffer;
|
||||
GLuint BiTangentNormalsBuffer;
|
||||
GLuint TextureCoordBuffer;
|
||||
|
||||
std::vector<RawModel::MaterialProperties> m_Materials;
|
||||
bool m_IsSkinned;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -105,7 +105,7 @@ struct ModelJob : RenderJob
|
||||
IsShielded = isShielded;
|
||||
|
||||
if (model->IsSkinned()) {
|
||||
Skeleton = Model->m_Skeleton;
|
||||
Skeleton = Model->m_RawModel->m_Skeleton;
|
||||
|
||||
if (Skeleton != nullptr) {
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <boost/endian/buffers.hpp>
|
||||
#include "../Common.h"
|
||||
#include "../GLM.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
@@ -21,10 +20,14 @@
|
||||
#include "Skeleton.h"
|
||||
#include "ShaderProgram.h"
|
||||
|
||||
#include "boost\endian\buffers.hpp"
|
||||
|
||||
|
||||
|
||||
class RawModelCustom : public Resource
|
||||
{
|
||||
friend class ResourceManager;
|
||||
friend class Model;
|
||||
|
||||
protected:
|
||||
RawModelCustom(std::string fileName);
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ private:
|
||||
bool m_ResizeWindow = false;
|
||||
int m_SSAO_Quality = 0;
|
||||
int m_GLOW_Quality = 2;
|
||||
bool m_Shadow_Enabled = true;
|
||||
|
||||
PickingPass* m_PickingPass;
|
||||
LightCullingPass* m_LightCullingPass;
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
void ClearBuffer();
|
||||
void Draw(RenderScene& scene);
|
||||
|
||||
void CheckStatus(bool status);
|
||||
|
||||
void DebugGUI();
|
||||
|
||||
GLuint DepthMap() const { return m_DepthMap; }
|
||||
@@ -45,6 +47,7 @@ public:
|
||||
std::array<glm::mat4, MAX_SPLITS> LightV() const { return m_LightView; }
|
||||
std::array<float, MAX_SPLITS> FarDistance() const { std::array<float, MAX_SPLITS> f; for (int i = 0; i < MAX_SPLITS; i++) f[i] = m_shadowFrusta[i].FarClip; return f; }
|
||||
int CurrentNrOfSplits() const { return m_CurrentNrOfSplits; }
|
||||
bool EnableShadows() const { return m_EnableShadows; }
|
||||
|
||||
void SetSplitWeight(float split_weight) { m_SplitWeight = split_weight; };
|
||||
private:
|
||||
@@ -63,8 +66,8 @@ private:
|
||||
|
||||
GLuint m_DepthMap;
|
||||
FrameBuffer m_DepthBuffer;
|
||||
ShaderProgram* m_ShadowProgram;
|
||||
ShaderProgram* m_ShadowProgramSkinned;
|
||||
ShaderProgram* m_ShadowProgram;
|
||||
ShaderProgram* m_ShadowProgramSkinned;
|
||||
|
||||
std::array<glm::mat4, MAX_SPLITS> m_LightProjection;
|
||||
std::array<glm::mat4, MAX_SPLITS> m_LightView;
|
||||
@@ -75,7 +78,7 @@ private:
|
||||
|
||||
bool m_TransparentObjects = false;
|
||||
bool m_TexturedShadows = false;
|
||||
bool m_EnableShadows = true;
|
||||
bool m_EnableShadows = false;
|
||||
|
||||
int m_CurrentNrOfSplits = 4;
|
||||
float m_SplitWeight = 0.962f;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef Events_Reset_h__
|
||||
#define Events_Reset_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Core/EntityWrapper.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct Reset : Event
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Engine/Collision/ETrigger.h"
|
||||
#include "Core/ECaptured.h"
|
||||
#include "Core/EWin.h"
|
||||
#include "Game/Events/EReset.h"
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
@@ -23,6 +24,7 @@ public:
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
//methods which will take care of specific events
|
||||
EventRelay<CapturePointSystem, Events::TriggerTouch> m_ETriggerTouch;
|
||||
bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e);
|
||||
@@ -30,6 +32,8 @@ private:
|
||||
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e);
|
||||
EventRelay<CapturePointSystem, Events::Captured> m_ECaptured;
|
||||
bool CapturePointSystem::OnCaptured(const Events::Captured& e);
|
||||
EventRelay<CapturePointSystem, Events::Reset> m_EReset;
|
||||
bool CapturePointSystem::OnReset(const Events::Reset& e);
|
||||
void ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner);
|
||||
|
||||
bool m_WinnerWasFound = false;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "Core/EPlayerSpawned.h"
|
||||
#include "Network/EPlayerConnected.h"
|
||||
#include "Network/EPlayerDisconnected.h"
|
||||
#include "Game/Events/EReset.h"
|
||||
#include "Engine/Input/EInputCommand.h"
|
||||
#include "GLM.h"
|
||||
|
||||
class ScoreScreenSystem : public PureSystem
|
||||
@@ -25,6 +27,10 @@ public:
|
||||
bool OnPlayerConnected(const Events::PlayerConnected& e);
|
||||
EventRelay<ScoreScreenSystem, Events::PlayerDisconnected> m_EPlayerDisconnected;
|
||||
bool OnPlayerDisconnected(const Events::PlayerDisconnected& e);
|
||||
EventRelay<ScoreScreenSystem, Events::Reset> m_EReset;
|
||||
bool OnReset(const Events::Reset& e);
|
||||
EventRelay<ScoreScreenSystem, Events::InputCommand> m_EInputCommand;
|
||||
bool OnInputCommand(const Events::InputCommand& e);
|
||||
|
||||
private:
|
||||
struct PlayerData {
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "Events/ESpawnerSpawn.h"
|
||||
#include "Core/TransformSystem.h"
|
||||
#include "Core/EntityFile.h"
|
||||
#include "Rendering/Model.h"
|
||||
|
||||
class SpawnerSystem : public System
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Core/System.h"
|
||||
#include "Input/EInputCommand.h"
|
||||
#include "Network/EPlayerDisconnected.h"
|
||||
#include "Game/Events/EReset.h"
|
||||
|
||||
class SpectatorCameraSystem : public ImpureSystem
|
||||
{
|
||||
@@ -15,11 +16,14 @@ public:
|
||||
private:
|
||||
int m_PickedTeam;
|
||||
bool m_CamSetToTeamPick;
|
||||
void reset();
|
||||
|
||||
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
||||
bool OnInputCommand(const Events::InputCommand& e);
|
||||
EventRelay<SpectatorCameraSystem, Events::PlayerDisconnected> m_EDisconnect;
|
||||
bool OnDisconnect(const Events::PlayerDisconnected& e);
|
||||
EventRelay<SpectatorCameraSystem, Events::Reset> m_EReset;
|
||||
bool OnReset(const Events::Reset& e);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -2,4 +2,5 @@
|
||||
<CapturePointGameMode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointGameMode.xsd">
|
||||
<RespawnTime>0.0</RespawnTime>
|
||||
<MaxRespawnTime>8.0</MaxRespawnTime>
|
||||
<ResetCountdown>10.0</ResetCountdown>
|
||||
</CapturePointGameMode>
|
||||
@@ -12,6 +12,9 @@
|
||||
<xs:element name="MaxRespawnTime" type="t:double" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Players will be spawned when RespawnTime reaches this.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="ResetCountdown" type="t:double" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>The map will be reset when time reaches 0.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
+10123
-8186
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="BlueCapturepointBorde" 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.271661639" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="Bottom">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>3</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.392156869" B="10" G="0.784313738" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.5" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="LowerMid">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>2</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0866025388" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.313725501" B="10" G="0.784313738" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.899999976" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="UpperMid">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>1</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0866025463" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.196078435" B="10" G="0.784313738" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.29999995" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Top">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.117647059" B="10" G="0.784313738" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.70000005" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="RedCapturepointBorde" 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.271661639" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="Bottom">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>3</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.392156869" B="0" G="0.235294119" R="21.9607849"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.5" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="LowerMid">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>2</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0866025388" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.313725501" B="0" G="0.235294119" R="21.9607849"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.899999976" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="UpperMid">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>1</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0866025463" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.196078435" B="0" G="0.235294119" R="21.9607849"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.29999995" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Top">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.117647059" B="0" G="0.235294119" R="21.9607849"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.70000005" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="SpectatorCapturepointBorde" 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.271661639" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="Bottom">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>3</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.392156869" B="8.03921604" G="8.03921604" R="8.03921604"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.5" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="LowerMid">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>2</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0866025388" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.313725501" B="10" G="8.03921604" R="8.03921604"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.899999976" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="UpperMid">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Time>1</Time>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0866025463" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.196078435" B="8.03921604" G="8.03921604" R="8.03921604"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.29999995" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Top">
|
||||
<Components>
|
||||
<c:FloatingEffect>
|
||||
<Period>6</Period>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
<Amplitude>0.10000000149011612</Amplitude>
|
||||
</c:FloatingEffect>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||
<Color A="0.117647059" B="8.03921604" G="8.03921604" R="8.03921604"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.70000005" Z="0"/>
|
||||
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,204 @@
|
||||
#version 430
|
||||
|
||||
#define MIN_AMBIENT_LIGHT 0.3
|
||||
#define MAX_SPLITS 4
|
||||
|
||||
uniform mat4 VM;
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform vec4 Color;
|
||||
uniform vec4 DiffuseColor;
|
||||
uniform vec2 ScreenDimensions;
|
||||
uniform vec4 FillColor;
|
||||
uniform vec4 AmbientColor;
|
||||
uniform float FillPercentage;
|
||||
uniform float GlowIntensity;
|
||||
uniform vec3 CameraPosition;
|
||||
uniform int SSAOQuality;
|
||||
uniform float FarDistance[MAX_SPLITS];
|
||||
|
||||
uniform vec2 DiffuseUVRepeat;
|
||||
uniform vec2 NormalUVRepeat;
|
||||
uniform vec2 SpecularUVRepeat;
|
||||
uniform vec2 GlowUVRepeat;
|
||||
layout (binding = 0) uniform sampler2D AOTexture;
|
||||
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 2) uniform sampler2D NormalMapTexture;
|
||||
layout (binding = 3) uniform sampler2D SpecularMapTexture;
|
||||
layout (binding = 4) uniform sampler2D GlowMapTexture;
|
||||
layout (binding = 5) uniform samplerCube CubeMap;
|
||||
|
||||
#define TILE_SIZE 16
|
||||
|
||||
struct LightSource {
|
||||
vec4 Position;
|
||||
vec4 Direction;
|
||||
vec4 Color;
|
||||
float Radius;
|
||||
float Intensity;
|
||||
float Falloff;
|
||||
int Type;
|
||||
};
|
||||
|
||||
layout (std430, binding = 1) buffer LightBuffer
|
||||
{
|
||||
LightSource List[];
|
||||
} LightSources;
|
||||
|
||||
struct LightGrid {
|
||||
float Start;
|
||||
float Amount;
|
||||
vec2 Padding;
|
||||
};
|
||||
|
||||
layout (std430, binding = 2) buffer LightGridBuffer
|
||||
{
|
||||
LightGrid Data[];
|
||||
} LightGrids;
|
||||
|
||||
layout (std430, binding = 4) buffer LightIndexBuffer
|
||||
{
|
||||
float LightIndex[];
|
||||
};
|
||||
|
||||
in VertexData{
|
||||
vec3 Position;
|
||||
vec3 Normal;
|
||||
vec3 Tangent;
|
||||
vec3 BiTangent;
|
||||
vec2 TextureCoordinate;
|
||||
vec4 ExplosionColor;
|
||||
float ExplosionPercentageElapsed;
|
||||
vec4 PositionLightSpace[MAX_SPLITS];
|
||||
}Input;
|
||||
|
||||
out vec4 sceneColor;
|
||||
out vec4 bloomColor;
|
||||
|
||||
struct LightResult {
|
||||
vec4 Diffuse;
|
||||
vec4 Specular;
|
||||
};
|
||||
|
||||
float CalcAttenuation(float radius, float dist, float falloff) {
|
||||
return 1.0 - smoothstep(radius * falloff, radius, dist);
|
||||
}
|
||||
|
||||
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
|
||||
vec4 R = normalize( reflect(-lightVec, normal));
|
||||
float RdotV = max( dot(R, viewVec), 0.0);
|
||||
return lightColor * pow(RdotV, 90.0);
|
||||
}
|
||||
|
||||
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
|
||||
float power = max( dot(normal, lightVec), 0.0);
|
||||
return lightColor * power;
|
||||
}
|
||||
|
||||
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
|
||||
{
|
||||
vec4 L = lightPos - position;
|
||||
float dist = length(L);
|
||||
L = normalize(L);
|
||||
|
||||
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
|
||||
|
||||
LightResult result;
|
||||
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
|
||||
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
|
||||
return result;
|
||||
}
|
||||
|
||||
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
||||
{
|
||||
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
||||
|
||||
LightResult result;
|
||||
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
||||
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
|
||||
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()
|
||||
{
|
||||
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 0).r;
|
||||
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
|
||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||
vec4 position = VM * vec4(Input.Position, 1.0);
|
||||
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
||||
normal = normalize(normal);
|
||||
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||
vec4 viewVec = normalize(-position);
|
||||
vec3 I = normalize(vec3(M * vec4(Input.Position, 1.0)) - CameraPosition);
|
||||
vec3 R = reflect(-I, Input.Normal);
|
||||
//R = vec3(P * vec4(R, 1.0));
|
||||
vec4 reflectionColor = texture(CubeMap, R);
|
||||
|
||||
vec2 tilePos;
|
||||
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
|
||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||
|
||||
LightResult totalLighting;
|
||||
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
|
||||
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
|
||||
|
||||
int start = int(LightGrids.Data[currentTile].Start);
|
||||
int amount = int(LightGrids.Data[currentTile].Amount);
|
||||
|
||||
for(int i = start; i < start + amount; i++) {
|
||||
|
||||
int l = int(LightIndex[i]);
|
||||
LightSource light = LightSources.List[l];
|
||||
|
||||
LightResult light_result;
|
||||
//These if statements should be removed.
|
||||
if(light.Type == 1) { // point
|
||||
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
|
||||
} else if (light.Type == 2) { //Directional
|
||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||
}
|
||||
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||
}
|
||||
|
||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
||||
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
|
||||
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
||||
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
|
||||
//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));
|
||||
//sceneColor = CommonUniforms.testColour;
|
||||
//sceneColor = vec4(reflectionColor.xyz, 1);
|
||||
color_result.xyz += glowTexel.xyz*GlowIntensity;
|
||||
|
||||
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1));
|
||||
|
||||
//Tiled Debug Code
|
||||
/*
|
||||
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
|
||||
sceneColor += vec4(0.5, 0, 0, 0);
|
||||
} else {
|
||||
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -146,14 +146,14 @@ bool RayVsTriangle(const Ray& ray,
|
||||
}
|
||||
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix)
|
||||
{
|
||||
for (int i = 0; i < modelIndices.size();) {
|
||||
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
|
||||
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
|
||||
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
|
||||
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
if (RayVsTriangle(ray, v0, v1, v2)) {
|
||||
return true;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ bool RayVsTriangle(const Ray& ray,
|
||||
}
|
||||
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
float& outDistance,
|
||||
@@ -204,9 +204,9 @@ bool RayVsModel(const Ray& ray,
|
||||
outDistance = INFINITY;
|
||||
bool hit = false;
|
||||
for (int i = 0; i < modelIndices.size();) {
|
||||
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
|
||||
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
|
||||
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
|
||||
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
float dist = outDistance;
|
||||
float u;
|
||||
float v;
|
||||
@@ -221,7 +221,7 @@ bool RayVsModel(const Ray& ray,
|
||||
}
|
||||
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& outHitPosition)
|
||||
@@ -548,7 +548,7 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
||||
}
|
||||
|
||||
Output AABBvsTriangles(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& boxVelocity,
|
||||
@@ -565,9 +565,9 @@ Output AABBvsTriangles(const AABB& box,
|
||||
glm::vec3 originalBoxVelocity(boxVelocity);
|
||||
for (int i = 0; i < modelIndices.size(); ) {
|
||||
std::array<glm::vec3, 3> triVertices = {
|
||||
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix),
|
||||
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix),
|
||||
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix)
|
||||
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix),
|
||||
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix),
|
||||
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix)
|
||||
};
|
||||
glm::vec3 outVec;
|
||||
bool collideWithGround = isOnGround;
|
||||
@@ -595,7 +595,7 @@ Output AABBvsTriangles(const AABB& box,
|
||||
}
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& boxVelocity,
|
||||
@@ -615,7 +615,7 @@ bool AABBvsTriangles(const AABB& box,
|
||||
}
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix)
|
||||
{
|
||||
@@ -633,7 +633,7 @@ bool AABBvsTriangles(const AABB& box,
|
||||
}
|
||||
|
||||
Output AABBvsTrianglesWContainment(const AABB& box,
|
||||
const std::vector<glm::vec3>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix)
|
||||
{
|
||||
@@ -741,7 +741,7 @@ boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<Enti
|
||||
continue;
|
||||
}
|
||||
float u, v;
|
||||
if (RayVsModel(ray, model->m_Vertices, model->m_Indices, TransformSystem::ModelMatrix(entityBox.Entity), outDistance, u, v)) {
|
||||
if (RayVsModel(ray, model->Vertices(), model->m_RawModel->m_Indices, TransformSystem::ModelMatrix(entityBox.Entity), outDistance, u, v)) {
|
||||
outIntersectPos = ray.Origin() + outDistance * ray.Direction();
|
||||
return entityBox;
|
||||
}
|
||||
|
||||
@@ -41,15 +41,15 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
// Don't collide against invisible models.
|
||||
continue;
|
||||
}
|
||||
Model* model;
|
||||
RawModel* model;
|
||||
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
|
||||
try {
|
||||
model = ResourceManager::Load<Model, true>(res);
|
||||
model = ResourceManager::Load<RawModel, true>(res);
|
||||
} catch (const std::exception&) {
|
||||
continue;
|
||||
}
|
||||
float u, v;
|
||||
hit = Collision::RayVsModel(ray, model->m_Vertices, model->m_Indices, TransformSystem::ModelMatrix(boxB.Entity), dist, u, v);
|
||||
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, TransformSystem::ModelMatrix(boxB.Entity), dist, u, v);
|
||||
} else {
|
||||
hit = Collision::RayVsAABB(ray, boxB, dist);
|
||||
}
|
||||
@@ -86,9 +86,9 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
// Don't collide against invisible models.
|
||||
continue;
|
||||
}
|
||||
Model* model;
|
||||
RawModel* model;
|
||||
try {
|
||||
model = ResourceManager::Load<Model, true>(boxB.Entity["Model"]["Resource"]);
|
||||
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
|
||||
} catch (const std::exception&) {
|
||||
continue;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
|
||||
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
||||
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
||||
if (Collision::AABBvsTriangles(boxA, model->m_Vertices, model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
||||
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
||||
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
|
||||
(Field<glm::vec3>)cTransform["Position"] += resolutionVector;
|
||||
boxA = *Collision::EntityAbsoluteAABB(entity);
|
||||
|
||||
@@ -10,11 +10,11 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
|
||||
return;
|
||||
}
|
||||
|
||||
Model* triggerModel = nullptr;
|
||||
RawModel* triggerModel = nullptr;
|
||||
glm::mat4 triggerModelMat;
|
||||
if (triggerEntity.HasComponent("Model")) {
|
||||
try {
|
||||
triggerModel = ResourceManager::Load<Model, true>(triggerEntity["Model"]["Resource"]);
|
||||
triggerModel = ResourceManager::Load<RawModel, true>(triggerEntity["Model"]["Resource"]);
|
||||
triggerModelMat = TransformSystem::ModelMatrix(triggerEntity);
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
@@ -38,7 +38,7 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
|
||||
? Collision::Output::OutContained
|
||||
: Collision::AABBvsTrianglesWContainment(
|
||||
colliderBox,
|
||||
triggerModel->m_Vertices,
|
||||
triggerModel->Vertices(),
|
||||
triggerModel->m_Indices,
|
||||
triggerModelMat);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "Network/Client.h"
|
||||
#include "Network/EPlayerDisconnected.h"
|
||||
|
||||
using namespace boost::asio::ip;
|
||||
|
||||
Client::Client(World* world, EventBroker* eventBroker)
|
||||
@@ -12,7 +12,7 @@ Client::Client(World* world, EventBroker* eventBroker)
|
||||
|
||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
|
||||
m_SendInputIntervalMs = config->Get<int>("Networking.SendInputIntervalMs", 33);
|
||||
m_SendInputInterval = config->Get<int>("Networking.SendInputIntervalMs", 33) / 1000.0;
|
||||
LOG_INFO("Client initialized");
|
||||
|
||||
m_ServerlistRequest.Connect(m_PlayerName, "192.168.1.255", 32554);
|
||||
@@ -48,7 +48,7 @@ void Client::Connect(std::string address, int port)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::Update()
|
||||
void Client::Update(double dt)
|
||||
{
|
||||
m_EventBroker->Process<Client>();
|
||||
while (m_Unreliable.IsSocketAvailable()) {
|
||||
@@ -85,7 +85,9 @@ void Client::Update()
|
||||
}
|
||||
|
||||
if (m_SearchingForServers) {
|
||||
if (m_SearchingTime < (1000* (std::clock() - m_StartSearchTime) / (double)CLOCKS_PER_SEC)) {
|
||||
m_TimeSearched += dt;
|
||||
if (m_SearchingTime < m_TimeSearched) {
|
||||
m_TimeSearched = 0;
|
||||
m_SearchingForServers = false;
|
||||
//displayServerlist();
|
||||
Events::DisplayServerlist e;
|
||||
@@ -96,9 +98,10 @@ void Client::Update()
|
||||
|
||||
if (m_IsConnected) {
|
||||
// Don't send 1 input in 1 packet, bunch em up.
|
||||
if (m_SendInputIntervalMs < (1000 * (std::clock() - m_TimeSinceSentInputs) / (double)CLOCKS_PER_SEC)) {
|
||||
m_TimeSinceSentInputs += dt;
|
||||
if (m_SendInputInterval < m_TimeSinceSentInputs) {
|
||||
sendInputCommands();
|
||||
m_TimeSinceSentInputs = std::clock();
|
||||
m_TimeSinceSentInputs = 0;
|
||||
}
|
||||
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
||||
sendLocalPlayerTransform();
|
||||
@@ -159,6 +162,9 @@ void Client::parseMessageType(Packet& packet)
|
||||
case MessageType::AmmoPickup:
|
||||
parseAmmoPickup(packet);
|
||||
break;
|
||||
case MessageType::RemoveWorld:
|
||||
parseRemoveWorld(packet);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -336,6 +342,13 @@ void Client::parseAmmoPickup(Packet & packet)
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
void Client::parseRemoveWorld(Packet & packet)
|
||||
{
|
||||
removeWorld();
|
||||
Events::Reset e;
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
||||
{
|
||||
for (auto field : componentInfo.FieldsInOrder) {
|
||||
@@ -583,7 +596,7 @@ bool Client::OnConnectRequest(const Events::ConnectRequest& e)
|
||||
bool Client::OnSearchForServers(const Events::SearchForServers& e)
|
||||
{
|
||||
m_SearchingForServers = true;
|
||||
m_StartSearchTime = std::clock();
|
||||
m_TimeSearched = 0;
|
||||
m_Serverlist.clear();
|
||||
Packet packet(MessageType::ServerlistRequest);
|
||||
m_ServerlistRequest.Broadcast(packet, 13); // TODO: Config
|
||||
@@ -706,19 +719,6 @@ void Client::displayServerlist()
|
||||
}
|
||||
}
|
||||
|
||||
void Client::removeWorld()
|
||||
{
|
||||
std::vector<EntityID> childrenToBeDeleted;
|
||||
auto rootEntites = m_World->GetDirectChildren(EntityID_Invalid);
|
||||
for (auto it = rootEntites.first; it != rootEntites.second; it++) {
|
||||
childrenToBeDeleted.push_back(it->second);
|
||||
}
|
||||
for (int i = 0; i < childrenToBeDeleted.size(); ++i) {
|
||||
m_World->DeleteEntity(childrenToBeDeleted[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Client::createMainMenu()
|
||||
{
|
||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/StartMenu.xml");
|
||||
|
||||
@@ -9,7 +9,7 @@ Network::Network(World* world, EventBroker* eventBroker)
|
||||
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
||||
}
|
||||
|
||||
void Network::Update()
|
||||
void Network::Update(double dt)
|
||||
{
|
||||
updateNetworkData();
|
||||
}
|
||||
@@ -92,3 +92,15 @@ void Network::popNetworkSegmentOfHeader(Packet & packet)
|
||||
packet.ReadPrimitive<int>();
|
||||
packet.ReadPrimitive<int>();
|
||||
}
|
||||
|
||||
void Network::removeWorld()
|
||||
{
|
||||
std::vector<EntityID> childrenToBeDeleted;
|
||||
auto rootEntites = m_World->GetDirectChildren(EntityID_Invalid);
|
||||
for (auto it = rootEntites.first; it != rootEntites.second; it++) {
|
||||
childrenToBeDeleted.push_back(it->second);
|
||||
}
|
||||
for (int i = 0; i < childrenToBeDeleted.size(); ++i) {
|
||||
m_World->DeleteEntity(childrenToBeDeleted[i]);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
|
||||
, m_ServerlistRequest(13)
|
||||
{
|
||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
snapshotInterval = 1000 * config->Get<float>("Networking.SnapshotInterval", 0.05f);
|
||||
pingIntervalMs = config->Get<float>("Networking.PingIntervalMs", 1000);
|
||||
snapshotInterval = config->Get<float>("Networking.SnapshotInterval", 0.05);
|
||||
pingInterval = config->Get<float>("Networking.PingIntervalMs", 1000) / 1000.0;
|
||||
m_ServerName = config->Get<std::string>("Networking.Name", "Unnamed");
|
||||
|
||||
// Subscribe to events
|
||||
@@ -17,6 +17,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &Server::OnPlayerDeath);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EWin, &Server::OnWin);
|
||||
// BindWW
|
||||
if (port == 0) {
|
||||
port = config->Get<float>("Networking.Port", 27666);
|
||||
@@ -30,7 +31,7 @@ Server::~Server()
|
||||
|
||||
}
|
||||
|
||||
void Server::Update()
|
||||
void Server::Update(double dt)
|
||||
{
|
||||
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
||||
|
||||
@@ -86,26 +87,44 @@ void Server::Update()
|
||||
}
|
||||
m_PlayersToDisconnect.clear();
|
||||
|
||||
std::clock_t currentTime = std::clock();
|
||||
// Send snapshot
|
||||
if (snapshotInterval < (1000 * (currentTime - previousSnapshotMessage) / (double)CLOCKS_PER_SEC)) {
|
||||
previousSnapshotMessage += dt;
|
||||
if (snapshotInterval < previousSnapshotMessage) {
|
||||
sendSnapshot();
|
||||
previousSnapshotMessage = currentTime;
|
||||
previousSnapshotMessage = 0;
|
||||
}
|
||||
// Send pings each
|
||||
if (pingIntervalMs < (1000 * (currentTime - previousePingMessage) / (double)CLOCKS_PER_SEC)) {
|
||||
previousPingMessage += dt;
|
||||
if (pingInterval < previousPingMessage) {
|
||||
sendPing();
|
||||
previousePingMessage = currentTime;
|
||||
previousPingMessage = 0;
|
||||
}
|
||||
|
||||
// Time out logic
|
||||
if (checkTimeOutInterval < (1000 * (currentTime - timOutTimer) / (double)CLOCKS_PER_SEC)) {
|
||||
timeOutTimer += dt;
|
||||
if (checkTimeOutInterval < timeOutTimer) {
|
||||
checkForTimeOuts();
|
||||
timOutTimer = currentTime;
|
||||
timeOutTimer = 0;
|
||||
}
|
||||
m_EventBroker->Process<Server>();
|
||||
if (isReadingData) {
|
||||
Network::Update();
|
||||
Network::Update(dt);
|
||||
}
|
||||
|
||||
if (m_GameIsOver) {
|
||||
auto pool = m_World->GetComponents("CapturePointGameMode");
|
||||
if (pool != nullptr && pool->size() > 0) {
|
||||
// Take the first CapturePointGameMode component found.
|
||||
ComponentWrapper& modeComponent = *pool->begin();
|
||||
// Decrease timer.
|
||||
Field<double> timer = modeComponent["ResetCountdown"];
|
||||
timer -= dt;
|
||||
if (timer < 0) {
|
||||
resetMap();
|
||||
}
|
||||
} else {
|
||||
resetMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +183,7 @@ void Server::reliableBroadcast(Packet& packet)
|
||||
|
||||
void Server::unreliableBroadcast(Packet& packet)
|
||||
{
|
||||
m_Unreliable.SendToConnectedPlayers(packet, m_ConnectedPlayers);
|
||||
m_Unreliable.SendToConnectedPlayers(packet, m_ConnectedPlayers);
|
||||
}
|
||||
|
||||
// Send snapshot fields
|
||||
@@ -173,10 +192,16 @@ void Server::sendSnapshot()
|
||||
Packet packet(MessageType::Snapshot);
|
||||
addInputCommandsToPacket(packet);
|
||||
addPlayersToPacket(packet, EntityID_Invalid);
|
||||
//addChildrenToPacket(packet, EntityID_Invalid);
|
||||
unreliableBroadcast(packet);
|
||||
}
|
||||
|
||||
// Send snapshot fields
|
||||
void Server::createWorldSnapshot(Packet& packet)
|
||||
{
|
||||
addInputCommandsToPacket(packet);
|
||||
addChildrenToPacket(packet, EntityID_Invalid);
|
||||
}
|
||||
|
||||
void Server::addInputCommandsToPacket(Packet& packet)
|
||||
{
|
||||
// Number of input commands
|
||||
@@ -379,8 +404,7 @@ void Server::parseTCPConnect(Packet & packet)
|
||||
m_Reliable.Send(connnectPacket, m_ConnectedPlayers.at(playerID));
|
||||
|
||||
Packet firstSnapshot(MessageType::Snapshot);
|
||||
addInputCommandsToPacket(firstSnapshot);
|
||||
addChildrenToPacket(firstSnapshot, EntityID_Invalid);
|
||||
createWorldSnapshot(firstSnapshot);
|
||||
m_Reliable.Send(firstSnapshot);
|
||||
|
||||
// Send notification that a player has connected
|
||||
@@ -542,6 +566,13 @@ bool Server::OnPlayerDeath(const Events::PlayerDeath& e)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Server::OnWin(const Events::Win & e)
|
||||
{
|
||||
// Postpone the gameover reset
|
||||
m_GameIsOver = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Server::parseClientPing()
|
||||
{
|
||||
LOG_INFO("%i: Parsing ping", m_PacketID);
|
||||
@@ -663,4 +694,20 @@ PlayerID Server::getPlayerIDFromEntityID(EntityID entityID)
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Server::resetMap()
|
||||
{
|
||||
m_GameIsOver = false;
|
||||
Events::Reset reset;
|
||||
m_EventBroker->Publish(reset);
|
||||
Packet removeMap(MessageType::RemoveWorld);
|
||||
reliableBroadcast(removeMap);
|
||||
removeWorld();
|
||||
// Hardcoded for now.
|
||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/CP_Rocky2.xml");
|
||||
entityFile->MergeInto(m_World);
|
||||
Packet newWorld(MessageType::Snapshot);
|
||||
createWorldSnapshot(newWorld);
|
||||
reliableBroadcast(newWorld);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void AnimationSystem::CreateBlendTrees()
|
||||
continue;;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
continue;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void AnimationSystem::UpdateAnimations(double dt)
|
||||
return;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
||||
return false;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ bool AnimationSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||
return false;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -325,7 +325,7 @@ bool AnimationSystem::OnSetBlendWeight(Events::SetBlendWeight& e)
|
||||
return false;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob)
|
||||
return;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ bool AutoBlendQueue::HasActiveBlendJob()
|
||||
return HasActiveBlendJob();
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
m_BlendQueue.pop_front();
|
||||
return HasActiveBlendJob();
|
||||
@@ -173,7 +173,7 @@ std::shared_ptr<BlendTree> AutoBlendQueue::GetBlendTree()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
if (skeleton == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
|
||||
return;
|
||||
}
|
||||
|
||||
Skeleton* skeleton = model->m_Skeleton;
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
|
||||
if(skeleton == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -65,6 +65,15 @@ void DrawFinalPass::InitializeShaderPrograms()
|
||||
m_ForwardPlusProgram->Link();
|
||||
GLERROR("Creating forward+ program");
|
||||
|
||||
m_ForwardPlusNoShadowsProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusNoShadowProgram");
|
||||
m_ForwardPlusNoShadowsProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||
m_ForwardPlusNoShadowsProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusNoShadows.frag.glsl")));
|
||||
m_ForwardPlusNoShadowsProgram->Compile();
|
||||
m_ForwardPlusNoShadowsProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ForwardPlusNoShadowsProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ForwardPlusNoShadowsProgram->Link();
|
||||
GLERROR("Creating forward+ program without shadows");
|
||||
|
||||
m_ExplosionEffectProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectProgram");
|
||||
m_ExplosionEffectProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||
m_ExplosionEffectProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
||||
@@ -354,7 +363,12 @@ void DrawFinalPass::OnWindowResize()
|
||||
|
||||
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
||||
{
|
||||
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
GLuint forwardHandle;
|
||||
if (m_ShadowPass->EnableShadows()) {
|
||||
forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
} else {
|
||||
forwardHandle = m_ForwardPlusNoShadowsProgram->GetHandle();
|
||||
}
|
||||
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
|
||||
GLuint explosionSplatMapHandle = m_ExplosionEffectSplatMapProgram->GetHandle();
|
||||
GLuint forwardSplatMapHandle = m_ForwardPlusSplatMapProgram->GetHandle();
|
||||
@@ -530,15 +544,19 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->BlendTree != nullptr) {
|
||||
frameBones = modelJob->BlendTree->GetFinalPose();
|
||||
} else if (modelJob->Skeleton != nullptr) {
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetTPose();
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
else {
|
||||
if (lastShader != m_ForwardPlusProgram->GetHandle()) {
|
||||
m_ForwardPlusProgram->Bind();
|
||||
lastShader = m_ForwardPlusProgram->GetHandle();
|
||||
if (lastShader != forwardHandle) {
|
||||
if (forwardHandle == m_ForwardPlusProgram->GetHandle()) {
|
||||
m_ForwardPlusProgram->Bind();
|
||||
} else {
|
||||
m_ForwardPlusNoShadowsProgram->Bind();
|
||||
}
|
||||
lastShader = forwardHandle;
|
||||
GLERROR("Bind ForwardPlusProgram program");
|
||||
glUniform1i(glGetUniformLocation(forwardHandle, "SSAOQuality"), m_SSAOPass->TextureQuality());
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
@@ -623,7 +641,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
||||
|
||||
void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
||||
{
|
||||
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
GLuint forwardHandle;
|
||||
if (m_ShadowPass->EnableShadows()) {
|
||||
forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
} else {
|
||||
forwardHandle = m_ForwardPlusNoShadowsProgram->GetHandle();
|
||||
}
|
||||
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
|
||||
GLuint explosionSplatMapHandle = m_ExplosionEffectSplatMapProgram->GetHandle();
|
||||
GLuint forwardSplatMapHandle = m_ForwardPlusSplatMapProgram->GetHandle();
|
||||
@@ -1024,9 +1047,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
|
||||
|
||||
}
|
||||
else {
|
||||
if (lastShader != m_ForwardPlusProgram->GetHandle()) {
|
||||
m_ForwardPlusProgram->Bind();
|
||||
lastShader = m_ForwardPlusProgram->GetHandle();
|
||||
if (lastShader != forwardHandle) {
|
||||
if (forwardHandle == m_ForwardPlusProgram->GetHandle()) {
|
||||
m_ForwardPlusProgram->Bind();
|
||||
}
|
||||
else {
|
||||
m_ForwardPlusNoShadowsProgram->Bind();
|
||||
}
|
||||
lastShader = forwardHandle;
|
||||
GLERROR("Bind ForwardPlusProgram program");
|
||||
glUniform1i(glGetUniformLocation(forwardHandle, "SSAOQuality"), m_SSAOPass->TextureQuality());
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
@@ -1112,7 +1140,12 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
|
||||
|
||||
void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
||||
{
|
||||
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
GLuint forwardHandle;
|
||||
if (m_ShadowPass->EnableShadows()) {
|
||||
forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
} else {
|
||||
forwardHandle = m_ForwardPlusNoShadowsProgram->GetHandle();
|
||||
}
|
||||
GLERROR("forwardHandle");
|
||||
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
|
||||
GLERROR("explosionHandle");
|
||||
@@ -1171,7 +1204,11 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
if (modelJob) {
|
||||
//bind forward program
|
||||
m_ForwardPlusProgram->Bind();
|
||||
if (m_ShadowPass->EnableShadows()) {
|
||||
m_ForwardPlusProgram->Bind();
|
||||
} else {
|
||||
m_ForwardPlusNoShadowsProgram->Bind();
|
||||
}
|
||||
glUniform2f(glGetUniformLocation(forwardHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
|
||||
//bind uniforms
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
Model::Model(std::string fileName)
|
||||
{
|
||||
//fileName = "Models/Core/ScreenQuad.mesh";
|
||||
//Try loading the model asyncronously, if it throws any exceptions then let it propagate back to caller.
|
||||
auto m_RawModel = ResourceManager::Load<RawModel, true>(fileName);
|
||||
//throw FailedLoadingException("Test");
|
||||
m_RawModel = ResourceManager::Load<RawModel, true>(fileName);
|
||||
|
||||
for (auto& materialProperty : m_RawModel->m_Materials) {
|
||||
switch (materialProperty.type) {
|
||||
@@ -101,24 +99,14 @@ Model::Model(std::string fileName)
|
||||
|
||||
glm::vec3 mini(INFINITY);
|
||||
glm::vec3 maxi(-INFINITY);
|
||||
|
||||
for (unsigned int i = 0; i < m_RawModel->NumVertices(); i++) {
|
||||
const auto& v = m_RawModel->Vertices()[i];
|
||||
mini = glm::min(mini, v.Position);
|
||||
maxi = glm::max(maxi, v.Position);
|
||||
}
|
||||
|
||||
m_Box = AABB(mini, maxi);
|
||||
|
||||
//m_Skeleton = m_RawModel->m_Skeleton;
|
||||
delete m_RawModel->m_Skeleton;
|
||||
m_Materials = m_RawModel->m_Materials;
|
||||
//m_Indices = m_RawModel->m_Indices;
|
||||
m_IsSkinned = m_RawModel->IsSkinned();
|
||||
// Copy vertex positions for collisions later
|
||||
for (auto& v : m_RawModel->m_Vertices) {
|
||||
//m_Vertices.push_back(v.Position);
|
||||
}
|
||||
|
||||
ResourceManager::Release("RawModel", fileName);
|
||||
}
|
||||
|
||||
Model::~Model()
|
||||
|
||||
@@ -110,7 +110,7 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->BlendTree != nullptr) {
|
||||
frameBones = modelJob->BlendTree->GetFinalPose();
|
||||
} else if (modelJob->Skeleton != nullptr) {
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetTPose();
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
@@ -493,13 +493,12 @@ void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData,
|
||||
|
||||
RawModelCustom::~RawModelCustom()
|
||||
{
|
||||
// Ownership of skeleton and materials get transferred to Model
|
||||
// if (m_Skeleton != nullptr) {
|
||||
// delete m_Skeleton;
|
||||
// }
|
||||
//for (auto material : m_Materials) {
|
||||
// delete material.material;
|
||||
//}
|
||||
if (m_Skeleton != nullptr) {
|
||||
delete m_Skeleton;
|
||||
}
|
||||
for (auto material : m_Materials) {
|
||||
delete material.material;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -168,8 +168,10 @@ void Renderer::Draw(RenderFrame& frame)
|
||||
|
||||
ImGui::SliderInt("SSAO Quality", &m_SSAO_Quality, 0, 3);
|
||||
ImGui::SliderInt("Glow Quality", &m_GLOW_Quality, 0, 3);
|
||||
ImGui::Checkbox("EnableShadows", &m_Shadow_Enabled);
|
||||
m_SSAOPass->ChangeQuality(m_SSAO_Quality);
|
||||
m_DrawBloomPass->ChangeQuality(m_GLOW_Quality);
|
||||
m_ShadowPass->CheckStatus(m_Shadow_Enabled);
|
||||
GLERROR("SSAO Settings");
|
||||
//clear buffer 0
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
+148
-127
@@ -6,7 +6,7 @@ ShadowPass::ShadowPass(IRenderer * renderer, int shadow_res_x, int shadow_res_y)
|
||||
m_ResolutionSizeWidth = shadow_res_x;
|
||||
m_ResolutionSizeHeight = shadow_res_y;
|
||||
|
||||
InitializeFrameBuffers();
|
||||
CheckStatus(true);
|
||||
InitializeShaderPrograms();
|
||||
}
|
||||
|
||||
@@ -14,18 +14,17 @@ ShadowPass::ShadowPass(IRenderer * renderer)
|
||||
{
|
||||
m_Renderer = renderer;
|
||||
|
||||
InitializeFrameBuffers();
|
||||
CheckStatus(true);
|
||||
InitializeShaderPrograms();
|
||||
}
|
||||
|
||||
ShadowPass::~ShadowPass()
|
||||
{
|
||||
|
||||
CommonFunctions::DeleteTexture(&m_DepthMap);
|
||||
}
|
||||
|
||||
void ShadowPass::DebugGUI()
|
||||
{
|
||||
ImGui::Checkbox("EnableShadows", &m_EnableShadows);
|
||||
ImGui::DragFloat2("ShadowMapNearFar", m_NearFarPlane, 1.f, -1000.f, 1000.f);
|
||||
ImGui::DragFloat("ShadowClippingWeight", &m_SplitWeight, 0.001f, 0.f, 1.f);
|
||||
ImGui::Checkbox("ShadowTransparentObjects", &m_TransparentObjects);
|
||||
@@ -126,6 +125,7 @@ float ShadowPass::FindRadius(ShadowFrustum& frustum)
|
||||
void ShadowPass::InitializeFrameBuffers()
|
||||
{
|
||||
// Depth texture
|
||||
glDeleteTextures(1, &m_DepthMap);
|
||||
glGenTextures(1, &m_DepthMap);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, m_DepthMap);
|
||||
@@ -156,12 +156,12 @@ 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();
|
||||
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()
|
||||
@@ -209,53 +209,109 @@ void ShadowPass::RadiusToLightspace(ShadowFrustum& frustum)
|
||||
frustum.LRBT = { left, right, bottom, top };
|
||||
}
|
||||
|
||||
void ShadowPass::CheckStatus(bool shadowStatus)
|
||||
{
|
||||
if (m_EnableShadows == shadowStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_EnableShadows = shadowStatus;
|
||||
|
||||
if (m_EnableShadows == false) {
|
||||
CommonFunctions::DeleteTexture(&m_DepthMap);
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeFrameBuffers();
|
||||
}
|
||||
|
||||
void ShadowPass::Draw(RenderScene & scene)
|
||||
{
|
||||
if (m_EnableShadows) {
|
||||
InitializeCameras(scene);
|
||||
UpdateSplitDist(m_shadowFrusta, scene.Camera->NearClip(), scene.Camera->FarClip());
|
||||
if (!m_EnableShadows) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShadowPassState* state = new ShadowPassState(m_DepthBuffer.GetHandle());
|
||||
InitializeCameras(scene);
|
||||
UpdateSplitDist(m_shadowFrusta, scene.Camera->NearClip(), scene.Camera->FarClip());
|
||||
|
||||
|
||||
glViewport(0, 0, m_ResolutionSizeWidth, m_ResolutionSizeHeight);
|
||||
ShadowPassState* state = new ShadowPassState(m_DepthBuffer.GetHandle());
|
||||
|
||||
for (int i = 0; i < m_CurrentNrOfSplits; i++) {
|
||||
UpdateFrustumPoints(m_shadowFrusta[i], scene.Camera->Position(), scene.Camera->Forward());
|
||||
glViewport(0, 0, m_ResolutionSizeWidth, m_ResolutionSizeHeight);
|
||||
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_DepthMap, 0, i);
|
||||
for (int i = 0; i < m_CurrentNrOfSplits; i++) {
|
||||
UpdateFrustumPoints(m_shadowFrusta[i], scene.Camera->Position(), scene.Camera->Forward());
|
||||
|
||||
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) {
|
||||
m_LightView[i] = glm::lookAt(glm::vec3(-directionalLightJob->Direction) + m_shadowFrusta[i].MiddlePoint, m_shadowFrusta[i].MiddlePoint, glm::vec3(0.f, 1.f, 0.f));
|
||||
|
||||
PointsToLightspace(m_shadowFrusta[i], m_LightView[i]);
|
||||
//FindRadius(m_shadowFrusta[i]);
|
||||
//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]);
|
||||
|
||||
|
||||
GLuint shaderHandle;
|
||||
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]));
|
||||
|
||||
for (auto &job : scene.Jobs.DirectionalLight) {
|
||||
|
||||
auto directionalLightJob = std::dynamic_pointer_cast<DirectionalLightJob>(job);
|
||||
|
||||
if (directionalLightJob) {
|
||||
m_LightView[i] = glm::lookAt(glm::vec3(-directionalLightJob->Direction) + m_shadowFrusta[i].MiddlePoint, m_shadowFrusta[i].MiddlePoint, glm::vec3(0.f, 1.f, 0.f));
|
||||
|
||||
PointsToLightspace(m_shadowFrusta[i], m_LightView[i]);
|
||||
//FindRadius(m_shadowFrusta[i]);
|
||||
//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]));
|
||||
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");
|
||||
GLERROR("ShadowLight ERROR");
|
||||
|
||||
for (auto &objectJob : scene.Jobs.OpaqueObjects) {
|
||||
for (auto &objectJob : scene.Jobs.OpaqueObjects) {
|
||||
if (!std::dynamic_pointer_cast<ExplosionEffectJob>(objectJob)) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(objectJob);
|
||||
|
||||
if (!modelJob->Shadow) {
|
||||
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);
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||
|
||||
GLERROR("Shadow Draw ERROR");
|
||||
}
|
||||
}
|
||||
if (m_TransparentObjects) {
|
||||
state->CullFace(GL_BACK);
|
||||
for (auto &objectJob : scene.Jobs.TransparentObjects) {
|
||||
if (!std::dynamic_pointer_cast<ExplosionEffectJob>(objectJob)) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(objectJob);
|
||||
|
||||
@@ -263,25 +319,53 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(modelJob->Model->IsSkinned()) {
|
||||
m_ShadowProgramSkinned->Bind();
|
||||
shaderHandle = m_ShadowProgramSkinned->GetHandle();
|
||||
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 if (modelJob->Skeleton != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetTPose();
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
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();
|
||||
}
|
||||
}
|
||||
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);
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "Alpha"), modelJob->Color.a);
|
||||
|
||||
if (m_TexturedShadows) {
|
||||
switch (modelJob->Type) {
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
case RawModel::MaterialType::Basic:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE24);
|
||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE24);
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
@@ -290,76 +374,13 @@ void ShadowPass::Draw(RenderScene & scene)
|
||||
GLERROR("Shadow Draw ERROR");
|
||||
}
|
||||
}
|
||||
if (m_TransparentObjects) {
|
||||
state->CullFace(GL_BACK);
|
||||
for (auto &objectJob : scene.Jobs.TransparentObjects) {
|
||||
if (!std::dynamic_pointer_cast<ExplosionEffectJob>(objectJob)) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(objectJob);
|
||||
|
||||
if (!modelJob->Shadow) {
|
||||
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);
|
||||
|
||||
if (m_TexturedShadows) {
|
||||
switch (modelJob->Type) {
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
case RawModel::MaterialType::Basic:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE24);
|
||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE24);
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||
|
||||
GLERROR("Shadow Draw ERROR");
|
||||
}
|
||||
}
|
||||
state->CullFace(GL_FRONT);
|
||||
}
|
||||
state->CullFace(GL_FRONT);
|
||||
}
|
||||
}
|
||||
}
|
||||
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
m_DepthBuffer.Unbind();
|
||||
delete state;
|
||||
}
|
||||
|
||||
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
m_DepthBuffer.Unbind();
|
||||
delete state;
|
||||
}
|
||||
+2
-2
@@ -232,10 +232,10 @@ void Game::Tick()
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
||||
m_EventBroker->Process<MultiplayerSnapshotFilter>();
|
||||
if (m_NetworkClient != nullptr) {
|
||||
m_NetworkClient->Update();
|
||||
m_NetworkClient->Update(dt);
|
||||
}
|
||||
if (m_NetworkServer != nullptr) {
|
||||
m_NetworkServer->Update();
|
||||
m_NetworkServer->Update(dt);
|
||||
}
|
||||
//m_SoundManager->Update(dt);
|
||||
|
||||
|
||||
@@ -10,8 +10,26 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EReset, &CapturePointSystem::OnReset);
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
void CapturePointSystem::Init()
|
||||
{
|
||||
m_WinnerWasFound = false;
|
||||
//need to track these variables for the captureSystem to work as per design!
|
||||
m_RedTeamNextPossibleCapturePoint = m_NotACapturePoint;
|
||||
m_BlueTeamNextPossibleCapturePoint = m_NotACapturePoint;
|
||||
m_RedTeamHomeCapturePoint = m_NotACapturePoint;
|
||||
m_BlueTeamHomeCapturePoint = m_NotACapturePoint;
|
||||
m_NumberOfCapturePoints = 0;
|
||||
m_ResetTimers = false;
|
||||
m_RecentlyCapturedNeedNextCapturePointNow = false;
|
||||
m_CapturePointNumberToEntityMap.clear();
|
||||
//vectors which will keep track of enter/leave changes
|
||||
m_ETriggerTouchVector.clear();
|
||||
m_ETriggerLeaveVector.clear();
|
||||
}
|
||||
|
||||
//here all capturepoints will update their component
|
||||
@@ -24,6 +42,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
if (m_WinnerWasFound) {
|
||||
return;
|
||||
}
|
||||
if (!capturePointEntity.Valid()) {
|
||||
return;
|
||||
}
|
||||
const int capturePointNumber = cCapturePoint["CapturePointNumber"];
|
||||
const bool hasTeamComponent = capturePointEntity.HasComponent("Team");
|
||||
|
||||
@@ -60,7 +81,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
}
|
||||
|
||||
//if we havent received all capturepoints yet, just return
|
||||
if (m_NumberOfCapturePoints == 0 || m_NumberOfCapturePoints != m_CapturePointNumberToEntityMap.size()) {
|
||||
if (m_NumberOfCapturePoints == 0 || m_NumberOfCapturePoints > m_CapturePointNumberToEntityMap.size()) {
|
||||
m_CapturePointNumberToEntityMap.insert(std::make_pair(capturePointNumber, capturePointEntity));
|
||||
return;
|
||||
}
|
||||
@@ -232,10 +253,10 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
||||
|
||||
}
|
||||
|
||||
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner) {
|
||||
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner)
|
||||
{
|
||||
(Field<bool>)capturePointModels["Model"]["Visible"] = isOwner;
|
||||
for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform"))
|
||||
{
|
||||
for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform")) {
|
||||
if (capModel.HasComponent("Model")) {
|
||||
(Field<bool>)capModel["Model"]["Visible"] = isOwner;
|
||||
}
|
||||
@@ -269,3 +290,9 @@ bool CapturePointSystem::OnCaptured(const Events::Captured& e)
|
||||
m_ResetTimers = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CapturePointSystem::OnReset(const Events::Reset& e)
|
||||
{
|
||||
Init();
|
||||
return true;
|
||||
}
|
||||
@@ -9,6 +9,8 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params)
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &ScoreScreenSystem::OnPlayerSpawn);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerConnected, &ScoreScreenSystem::OnPlayerConnected);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDisconnected, &ScoreScreenSystem::OnPlayerDisconnected);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EReset, &ScoreScreenSystem::OnReset);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &ScoreScreenSystem::OnInputCommand);
|
||||
}
|
||||
|
||||
void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt)
|
||||
@@ -156,3 +158,25 @@ bool ScoreScreenSystem::OnPlayerDisconnected(const Events::PlayerDisconnected& e
|
||||
m_DisconnectedIdentities.push_back(e.PlayerID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ScoreScreenSystem::OnReset(const Events::Reset & e)
|
||||
{
|
||||
for (auto& it : m_PlayerIdentities) {
|
||||
it.second.Deaths = 0;
|
||||
it.second.Kills = 0;
|
||||
it.second.Team = 1;
|
||||
it.second.Player = EntityWrapper::Invalid;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScoreScreenSystem::OnInputCommand(const Events::InputCommand & e)
|
||||
{
|
||||
if (e.Command != "PickTeam" || e.PlayerID == -1 || e.Value == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_PlayerIdentities.at(e.PlayerID).Team = e.Value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -103,15 +103,15 @@ bool SpawnerSystem::spawnedEntityIsColliding(EntityWrapper spawnedEntity, Entity
|
||||
if (!spawnedBox.Entity.HasComponent("Model")) {
|
||||
return true;
|
||||
}
|
||||
Model* model = nullptr;
|
||||
RawModel* model = nullptr;
|
||||
try {
|
||||
model = ResourceManager::Load<Model, true>(otherEntity["Model"]["Resource"]);
|
||||
model = ResourceManager::Load<RawModel, true>(otherEntity["Model"]["Resource"]);
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
|
||||
if (model != nullptr && Collision::AABBvsTriangles(
|
||||
spawnedBox,
|
||||
model->m_Vertices,
|
||||
model->Vertices(),
|
||||
model->m_Indices,
|
||||
TransformSystem::ModelMatrix(otherEntity))) {
|
||||
return true;
|
||||
|
||||
@@ -9,6 +9,7 @@ SpectatorCameraSystem::SpectatorCameraSystem(SystemParams params)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EDisconnect, &SpectatorCameraSystem::OnDisconnect);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EReset, &SpectatorCameraSystem::OnReset);
|
||||
}
|
||||
|
||||
void SpectatorCameraSystem::Update(double dt)
|
||||
@@ -27,6 +28,14 @@ void SpectatorCameraSystem::Update(double dt)
|
||||
}
|
||||
}
|
||||
|
||||
void SpectatorCameraSystem::reset()
|
||||
{
|
||||
m_CamSetToTeamPick = false;
|
||||
// They will also be set to menu, so unlock mouse just in case they were in game with locked mouse.
|
||||
Events::UnlockMouse unlock;
|
||||
m_EventBroker->Publish(unlock);
|
||||
}
|
||||
|
||||
bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
|
||||
{
|
||||
// Only the client should do this, and only if player is not spawned.
|
||||
@@ -95,10 +104,13 @@ bool SpectatorCameraSystem::OnDisconnect(const Events::PlayerDisconnected& e)
|
||||
// If local player gets disconnected, they should be set to
|
||||
// the spectator camera next time a map loads that has one.
|
||||
if (e.Entity == LocalPlayer.ID) {
|
||||
m_CamSetToTeamPick = false;
|
||||
// They will also be set to menu, so unlock mouse just in case they were in game with locked mouse.
|
||||
Events::UnlockMouse unlock;
|
||||
m_EventBroker->Publish(unlock);
|
||||
reset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpectatorCameraSystem::OnReset(const Events::Reset & e)
|
||||
{
|
||||
reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ bool Material::findColorTexture(MaterialNode& material_node, MFnDependencyNode&
|
||||
return true;
|
||||
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
MGlobal::displayInfo(MString() + "found color splat map");
|
||||
return findSplatTextures(material_node, material_node.ColorMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
@@ -162,9 +162,9 @@ bool Material::findNormalTexture(MaterialNode& material_node, MFnDependencyNode&
|
||||
|
||||
material_node.NormalMaps.push_back(newTexture);
|
||||
return true;
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
return findSplatTextures(material_node, material_node.NormalMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
} else if (AllBumpConnections[j].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "found normal splat map");
|
||||
return findSplatTextures(material_node, material_node.NormalMaps, MFnDependencyNode(AllBumpConnections[j].node()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ bool Material::findSpecularTexture(MaterialNode& material_node, MFnDependencyNod
|
||||
material_node.type = MaterialNode::MaterialType::SingleTextures;
|
||||
return true;
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
MGlobal::displayInfo(MString() + "found specular splat map");
|
||||
return findSplatTextures(material_node, material_node.SpecularMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ bool Material::findIncandescenceTexture(MaterialNode& material_node, MFnDependen
|
||||
return true;
|
||||
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
MGlobal::displayInfo(MString() + "found incandescens splat map");
|
||||
return findSplatTextures(material_node, material_node.IncandescenceMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user