Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09249c970a | |||
| fe3e0bac5b | |||
| fa4f007604 | |||
| 6fab971734 | |||
| 2c18068059 | |||
| 09aec08d0e | |||
| 4cf8c3d8d7 | |||
| 37414ce124 | |||
| adceccf402 | |||
| 201480b17f | |||
| c4d3c515e4 | |||
| 7cc58dc94c | |||
| 5e3af7ac5d | |||
| 4fd0108443 | |||
| 17da9a8036 |
+1
-1
Submodule assets updated: 1e7adc749e...651f65a98d
@@ -9,16 +9,13 @@ typedef unsigned int PacketID;
|
|||||||
class NetworkClient
|
class NetworkClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetworkClient();
|
|
||||||
virtual ~NetworkClient();
|
|
||||||
virtual void Connect(std::string playerName, std::string address, int port) = 0;
|
virtual void Connect(std::string playerName, std::string address, int port) = 0;
|
||||||
virtual void Disconnect() = 0;
|
virtual void Disconnect() = 0;
|
||||||
virtual void Receive(Packet& packet) = 0;
|
virtual void Receive(Packet& packet) = 0;
|
||||||
virtual void Send(Packet & packet) = 0;
|
virtual void Send(Packet & packet) = 0;
|
||||||
virtual bool IsSocketAvailable() = 0;
|
virtual bool IsSocketAvailable() = 0;
|
||||||
protected:
|
protected:
|
||||||
char* m_ReadBuffer;
|
char m_ReadBuffer[BUFFERSIZE] = { 0 };
|
||||||
unsigned int m_BufferSize = BUFFERSIZE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -10,15 +10,12 @@ typedef unsigned int PacketID;
|
|||||||
class NetworkServer
|
class NetworkServer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetworkServer();
|
|
||||||
virtual ~NetworkServer();
|
|
||||||
virtual void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers) = 0;
|
virtual void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers) = 0;
|
||||||
virtual void Receive(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
virtual void Receive(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
||||||
virtual void Send(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
virtual void Send(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
||||||
virtual void Send(Packet & packet) = 0;
|
virtual void Send(Packet & packet) = 0;
|
||||||
protected:
|
protected:
|
||||||
char* m_ReadBuffer;
|
char m_ReadBuffer[BUFFERSIZE] = { 0 };
|
||||||
unsigned int m_BufferSize = BUFFERSIZE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -54,7 +54,7 @@ private:
|
|||||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||||
//Timers
|
//Timers
|
||||||
std::clock_t m_StartPingTime;
|
std::clock_t m_StartPingTime;
|
||||||
|
|
||||||
// Packet loss logic
|
// Packet loss logic
|
||||||
PacketID m_PacketID = 0;
|
PacketID m_PacketID = 0;
|
||||||
PacketID m_PreviousPacketID = 0;
|
PacketID m_PreviousPacketID = 0;
|
||||||
@@ -64,7 +64,6 @@ private:
|
|||||||
void reliableBroadcast(Packet& packet);
|
void reliableBroadcast(Packet& packet);
|
||||||
void unreliableBroadcast(Packet& packet);
|
void unreliableBroadcast(Packet& packet);
|
||||||
void sendSnapshot();
|
void sendSnapshot();
|
||||||
void addPlayersToPacket(Packet& packet, EntityID entityID);
|
|
||||||
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
||||||
void addInputCommandsToPacket(Packet& packet);
|
void addInputCommandsToPacket(Packet& packet);
|
||||||
void sendPing();
|
void sendPing();
|
||||||
@@ -78,7 +77,7 @@ private:
|
|||||||
void parsePlayerTransform(Packet& packet);
|
void parsePlayerTransform(Packet& packet);
|
||||||
void parseOnInputCommand(Packet& packet);
|
void parseOnInputCommand(Packet& packet);
|
||||||
void parseClientPing();
|
void parseClientPing();
|
||||||
void parsePing();
|
void parsePing();
|
||||||
void parseUDPConnect(Packet & packet);
|
void parseUDPConnect(Packet & packet);
|
||||||
void parseTCPConnect(Packet & packet);
|
void parseTCPConnect(Packet & packet);
|
||||||
void parseDisconnect();
|
void parseDisconnect();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ private:
|
|||||||
boost::asio::ip::tcp::endpoint m_Endpoint;
|
boost::asio::ip::tcp::endpoint m_Endpoint;
|
||||||
boost::asio::io_service m_IOService;
|
boost::asio::io_service m_IOService;
|
||||||
std::unique_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
std::unique_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
||||||
size_t readBuffer();
|
size_t readBuffer(char* data);
|
||||||
PacketID m_SendPacketID = 0;
|
PacketID m_SendPacketID = 0;
|
||||||
bool m_IsConnected = false;
|
bool m_IsConnected = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ private:
|
|||||||
void handle_accept(boost::shared_ptr<boost::asio::ip::tcp::socket> socket,
|
void handle_accept(boost::shared_ptr<boost::asio::ip::tcp::socket> socket,
|
||||||
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
||||||
const boost::system::error_code& error);
|
const boost::system::error_code& error);
|
||||||
int readBuffer(PlayerDefinition& playerDefinition);
|
int readBuffer(char* data, PlayerDefinition& playerDefinition);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -20,7 +20,7 @@ private:
|
|||||||
boost::asio::io_service m_IOService;
|
boost::asio::io_service m_IOService;
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
boost::shared_ptr<boost::asio::ip::udp::socket> m_Socket;
|
boost::shared_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||||
int readBuffer();
|
int readBuffer(char* data);
|
||||||
PacketID m_SendPacketID = 0;
|
PacketID m_SendPacketID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ private:
|
|||||||
boost::asio::io_service m_IOService;
|
boost::asio::io_service m_IOService;
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
std::unique_ptr<boost::asio::ip::udp::socket> m_Socket;
|
std::unique_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||||
int readBuffer();
|
int readBuffer(char* data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
void InitializeTextures();
|
void InitializeTextures();
|
||||||
void InitializeFrameBuffers();
|
void InitializeFrameBuffers();
|
||||||
void InitializeShaderPrograms();
|
void InitializeShaderPrograms();
|
||||||
void Draw(RenderScene& scene);
|
void Draw(RenderScene& scene, GLuint SSAOTexture);
|
||||||
void ClearBuffer();
|
void ClearBuffer();
|
||||||
void OnWindowResize();
|
void OnWindowResize();
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ private:
|
|||||||
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
|
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
|
||||||
|
|
||||||
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
|
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
|
||||||
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene, GLuint SSAOTexture);
|
||||||
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ struct ModelJob : RenderJob
|
|||||||
|
|
||||||
void CalculateHash() override
|
void CalculateHash() override
|
||||||
{
|
{
|
||||||
Hash = TextureID + ModelID << 10 + ShaderID << 20;
|
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "DrawScreenQuadPass.h"
|
#include "DrawScreenQuadPass.h"
|
||||||
#include "DrawBloomPass.h"
|
#include "DrawBloomPass.h"
|
||||||
#include "DrawColorCorrectionPass.h"
|
#include "DrawColorCorrectionPass.h"
|
||||||
|
#include "SSAOPass.h"
|
||||||
#include "../Core/EventBroker.h"
|
#include "../Core/EventBroker.h"
|
||||||
#include "ImGuiRenderPass.h"
|
#include "ImGuiRenderPass.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
@@ -58,6 +59,12 @@ private:
|
|||||||
|
|
||||||
int m_DebugTextureToDraw = 0;
|
int m_DebugTextureToDraw = 0;
|
||||||
bool m_ResizeWindow = false;
|
bool m_ResizeWindow = false;
|
||||||
|
float m_SSAO_Radius = 1.0f;
|
||||||
|
float m_SSAO_Bias = 0.05f;
|
||||||
|
float m_SSAO_Contrast = 1.5f;
|
||||||
|
float m_SSAO_IntensityScale = 1.0f;
|
||||||
|
int m_SSAO_NumOfSamples = 24;
|
||||||
|
int m_SSAO_NumOfTurns = 7;
|
||||||
|
|
||||||
PickingPass* m_PickingPass;
|
PickingPass* m_PickingPass;
|
||||||
LightCullingPass* m_LightCullingPass;
|
LightCullingPass* m_LightCullingPass;
|
||||||
@@ -66,6 +73,7 @@ private:
|
|||||||
DrawScreenQuadPass* m_DrawScreenQuadPass;
|
DrawScreenQuadPass* m_DrawScreenQuadPass;
|
||||||
DrawBloomPass* m_DrawBloomPass;
|
DrawBloomPass* m_DrawBloomPass;
|
||||||
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
|
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
|
||||||
|
SSAOPass* m_SSAOPass;
|
||||||
|
|
||||||
//----------------------Functions----------------------//
|
//----------------------Functions----------------------//
|
||||||
void InitializeWindow();
|
void InitializeWindow();
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#ifndef SSAOPass_h__
|
||||||
|
#define SSAOPass_h__
|
||||||
|
|
||||||
|
#include "IRenderer.h"
|
||||||
|
#include "SSAOPassState.h"
|
||||||
|
//#include "LightCullingPass.h" Finalpass om den skall skickas in
|
||||||
|
#include "FrameBuffer.h"
|
||||||
|
#include "ShaderProgram.h"
|
||||||
|
#include "DrawBloomPass.h"
|
||||||
|
//#include "Util/UnorderedMapVec2.h"
|
||||||
|
#include "Texture.h"
|
||||||
|
|
||||||
|
class SSAOPass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SSAOPass(IRenderer* rendere);
|
||||||
|
~SSAOPass() { };
|
||||||
|
|
||||||
|
void Draw(GLuint depthBuffer, Camera* camera);
|
||||||
|
void Setting(float radius, float bias, float contrast, float intensityScale, int numOfSamples, int NumOfTurns);
|
||||||
|
void ClearBuffer();
|
||||||
|
|
||||||
|
//Return the SSAO of the texture sent to Draw
|
||||||
|
GLuint SSAOTexture() const { return m_DrawBloomPass->GaussianTexture(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void InitializeTexture();
|
||||||
|
void InitializeFrameBuffer();
|
||||||
|
void InitializeShaderProgram();
|
||||||
|
void InitializeBuffer();
|
||||||
|
|
||||||
|
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
|
||||||
|
|
||||||
|
void ComputeAO(GLuint depthBuffer, Camera* camera);
|
||||||
|
//void blurHorizontal(GLuint depthBuffer);
|
||||||
|
//void blurVertical(GLuint depthBuffer);
|
||||||
|
|
||||||
|
Model* m_ScreenQuad;
|
||||||
|
|
||||||
|
const IRenderer* m_Renderer;
|
||||||
|
|
||||||
|
float m_Radius;
|
||||||
|
float m_Bias;
|
||||||
|
float m_Contrast;
|
||||||
|
float m_IntensityScale;
|
||||||
|
int m_NumOfSamples;
|
||||||
|
int m_NumOfTurns;
|
||||||
|
|
||||||
|
GLuint m_SSAOTexture;
|
||||||
|
FrameBuffer m_SSAOFramBuffer;
|
||||||
|
|
||||||
|
GLuint m_SSAOViewSpaceZTexture;
|
||||||
|
FrameBuffer m_SSAOViewSpaceZFramBuffer;
|
||||||
|
|
||||||
|
ShaderProgram* m_SSAOProgram;
|
||||||
|
ShaderProgram* m_SSAOViewSpaceZProgram;
|
||||||
|
|
||||||
|
DrawBloomPass* m_DrawBloomPass;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef SSAOPassState_h__
|
||||||
|
#define SSAOPassState_h__
|
||||||
|
|
||||||
|
#include "Rendering/RenderState.h"
|
||||||
|
|
||||||
|
class SSAOPassState : public RenderState
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SSAOPassState();
|
||||||
|
~SSAOPassState();
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
struct SpriteJob : RenderJob
|
struct SpriteJob : RenderJob
|
||||||
{
|
{
|
||||||
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted)
|
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted, bool isIndicator)
|
||||||
: RenderJob()
|
: RenderJob()
|
||||||
{
|
{
|
||||||
Model = ResourceManager::Load<::Model>("Models/Core/UnitQuad.mesh");
|
Model = ResourceManager::Load<::Model>("Models/Core/UnitQuad.mesh");
|
||||||
@@ -30,7 +30,7 @@ struct SpriteJob : RenderJob
|
|||||||
|
|
||||||
StartIndex = matProp.material->StartIndex;
|
StartIndex = matProp.material->StartIndex;
|
||||||
EndIndex = matProp.material->EndIndex;
|
EndIndex = matProp.material->EndIndex;
|
||||||
Matrix = matrix;
|
Matrix = matrix;
|
||||||
Color = cSprite["Color"];
|
Color = cSprite["Color"];
|
||||||
Entity = cSprite.EntityID;
|
Entity = cSprite.EntityID;
|
||||||
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
|
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
|
||||||
@@ -41,7 +41,8 @@ struct SpriteJob : RenderJob
|
|||||||
}
|
}
|
||||||
World = world;
|
World = world;
|
||||||
Pickable = world->HasComponent(cSprite.EntityID, "Button");
|
Pickable = world->HasComponent(cSprite.EntityID, "Button");
|
||||||
|
IsIndicator = isIndicator;
|
||||||
|
|
||||||
FillColor = fillColor;
|
FillColor = fillColor;
|
||||||
FillPercentage = fillPercentage;
|
FillPercentage = fillPercentage;
|
||||||
};
|
};
|
||||||
@@ -61,7 +62,9 @@ struct SpriteJob : RenderJob
|
|||||||
unsigned int StartIndex = 0;
|
unsigned int StartIndex = 0;
|
||||||
unsigned int EndIndex = 0;
|
unsigned int EndIndex = 0;
|
||||||
World* World;
|
World* World;
|
||||||
|
|
||||||
bool Pickable;
|
bool Pickable;
|
||||||
|
bool IsIndicator = false;
|
||||||
|
|
||||||
glm::vec4 FillColor = glm::vec4(0);
|
glm::vec4 FillColor = glm::vec4(0);
|
||||||
float FillPercentage = 0.0;
|
float FillPercentage = 0.0;
|
||||||
|
|||||||
@@ -44,5 +44,6 @@
|
|||||||
<xs:include schemaLocation="Components/Menu.xsd"/>
|
<xs:include schemaLocation="Components/Menu.xsd"/>
|
||||||
<xs:include schemaLocation="Components/KillFeed.xsd"/>
|
<xs:include schemaLocation="Components/KillFeed.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Page.xsd"/>
|
<xs:include schemaLocation="Components/Page.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Button.xsd"/>
|
<xs:include schemaLocation="Components/Button.xsd"/>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<SpriteIndicator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SpriteIndicator.xsd">
|
||||||
|
<MinScale>10</MinScale>
|
||||||
|
<VisibleForSingleTeamOnly>false</VisibleForSingleTeamOnly>
|
||||||
|
</SpriteIndicator>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="SpriteIndicator">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Billbord a Sprite around global Y axis</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="MinScale" type="t:double" minOccurs="0"/>
|
||||||
|
<xs:element name="VisibleForSingleTeamOnly" type="t:bool" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>Add a Team component to this Entity or Parent to make it visible only for that team</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<c:DashAbility/>
|
<c:DashAbility/>
|
||||||
<c:Health/>
|
<c:Health/>
|
||||||
<c:Physics>
|
<c:Physics>
|
||||||
|
<PrevOrigin X="0" Y="0.772000015" Z="0"/>
|
||||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||||
</c:Physics>
|
</c:Physics>
|
||||||
<c:Player>
|
<c:Player>
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||||
<DepthSort>false</DepthSort>
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.200000003"/>
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
@@ -110,6 +112,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:HealthHUD/>
|
<c:HealthHUD/>
|
||||||
@@ -135,6 +138,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -152,6 +156,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -167,6 +172,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -185,6 +191,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -200,6 +207,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -217,6 +225,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -232,6 +241,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -249,6 +259,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -264,6 +275,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -279,6 +291,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -304,6 +317,7 @@
|
|||||||
<Entity name="KillFeed1">
|
<Entity name="KillFeed1">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
|
<Content></Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Right/>
|
<Right/>
|
||||||
@@ -316,6 +330,7 @@
|
|||||||
<Entity name="KillFeed2">
|
<Entity name="KillFeed2">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
|
<Content></Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Right/>
|
<Right/>
|
||||||
@@ -330,6 +345,7 @@
|
|||||||
<Entity name="KillFeed3">
|
<Entity name="KillFeed3">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
|
<Content></Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Right/>
|
<Right/>
|
||||||
@@ -349,13 +365,14 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.6050530664521858</Time1>
|
<Time1>0.97725610639912475</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
|
<AnimationName2></AnimationName2>
|
||||||
|
<AnimationName3></AnimationName3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0.309803933" R="0"/>
|
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -367,11 +384,10 @@
|
|||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.12043035" Y="-0.234149337" Z="-0.181454644"/>
|
<Position X="0.12043038" Y="-0.244988307" Z="-0.181454808"/>
|
||||||
<Orientation X="0.0104045281" Y="-0.00268131681" Z="0.0428438708"/>
|
<Orientation X="0.010404544" Y="-0.00268173823" Z="0.0428441577"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -408,6 +424,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -477,8 +494,10 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.620305457513453</Time1>
|
<Time1>0.87583812735846323</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
|
<AnimationName2></AnimationName2>
|
||||||
|
<AnimationName3></AnimationName3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
<AnimationName>AimRifle</AnimationName>
|
<AnimationName>AimRifle</AnimationName>
|
||||||
@@ -501,8 +520,8 @@
|
|||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.160351232" Y="1.02591991" Z="-0.215102971"/>
|
<Position X="0.163429111" Y="1.0235405" Z="-0.215489209"/>
|
||||||
<Orientation X="-0.0627480298" Y="-0.0432248674" Z="0.119431816"/>
|
<Orientation X="-0.0631071255" Y="-0.0576644838" Z="0.118255548"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -572,6 +591,26 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="Indicator">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:HiddenForLocalPlayer/>
|
||||||
|
<c:SpriteIndicator>
|
||||||
|
<MinScale>50</MinScale>
|
||||||
|
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
|
||||||
|
</c:SpriteIndicator>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.84019077" Z="0"/>
|
||||||
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<c:DashAbility/>
|
<c:DashAbility/>
|
||||||
<c:Health/>
|
<c:Health/>
|
||||||
<c:Physics>
|
<c:Physics>
|
||||||
|
<PrevOrigin X="0" Y="0.772000015" Z="0"/>
|
||||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||||
</c:Physics>
|
</c:Physics>
|
||||||
<c:Player>
|
<c:Player>
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||||
<DepthSort>false</DepthSort>
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.200000003"/>
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
@@ -110,6 +112,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:HealthHUD/>
|
<c:HealthHUD/>
|
||||||
@@ -135,6 +138,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -152,6 +156,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -167,6 +172,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -185,6 +191,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -200,6 +207,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -217,6 +225,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -232,6 +241,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -249,6 +259,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -264,6 +275,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -279,6 +291,7 @@
|
|||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
@@ -304,6 +317,7 @@
|
|||||||
<Entity name="KillFeed1">
|
<Entity name="KillFeed1">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
|
<Content></Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Right/>
|
<Right/>
|
||||||
@@ -316,6 +330,7 @@
|
|||||||
<Entity name="KillFeed2">
|
<Entity name="KillFeed2">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
|
<Content></Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Right/>
|
<Right/>
|
||||||
@@ -330,6 +345,7 @@
|
|||||||
<Entity name="KillFeed3">
|
<Entity name="KillFeed3">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
|
<Content></Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Right/>
|
<Right/>
|
||||||
@@ -349,13 +365,14 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.6050530664521858</Time1>
|
<Time1>1.2667383999985162</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
|
<AnimationName2></AnimationName2>
|
||||||
|
<AnimationName3></AnimationName3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -367,11 +384,10 @@
|
|||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.12043035" Y="-0.234149337" Z="-0.181454644"/>
|
<Position X="0.120430425" Y="-0.242105931" Z="-0.181454822"/>
|
||||||
<Orientation X="0.0104045281" Y="-0.00268131681" Z="0.0428438708"/>
|
<Orientation X="0.010404665" Y="-0.00268179877" Z="0.0428443067"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -408,6 +424,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -477,8 +494,10 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.620305457513453</Time1>
|
<Time1>0.26532318661337229</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
|
<AnimationName2></AnimationName2>
|
||||||
|
<AnimationName3></AnimationName3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
<AnimationName>AimRifle</AnimationName>
|
<AnimationName>AimRifle</AnimationName>
|
||||||
@@ -501,8 +520,8 @@
|
|||||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.160351232" Y="1.02591991" Z="-0.215102971"/>
|
<Position X="0.159282878" Y="1.0300566" Z="-0.216084003"/>
|
||||||
<Orientation X="-0.0627480298" Y="-0.0432248674" Z="0.119431816"/>
|
<Orientation X="-0.0626799241" Y="-0.0390551724" Z="0.119761385"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -572,6 +591,26 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:HiddenForLocalPlayer/>
|
||||||
|
<c:SpriteIndicator>
|
||||||
|
<MinScale>50</MinScale>
|
||||||
|
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
|
||||||
|
</c:SpriteIndicator>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.84000003" Z="0"/>
|
||||||
|
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ void main()
|
|||||||
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
|
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
|
||||||
vec4 hdrColorLowRes = texture(SceneTextureLowRes, Input.TextureCoordinate);
|
vec4 hdrColorLowRes = texture(SceneTextureLowRes, Input.TextureCoordinate);
|
||||||
vec4 bloomColorLowRes = texture(BloomTextureLowRes, Input.TextureCoordinate);
|
vec4 bloomColorLowRes = texture(BloomTextureLowRes, Input.TextureCoordinate);
|
||||||
|
|
||||||
|
//hdrColor = hdrColor * SSAO;
|
||||||
hdrColor += bloomColor;
|
hdrColor += bloomColor;
|
||||||
hdrColorLowRes;
|
hdrColorLowRes;
|
||||||
|
|
||||||
@@ -33,7 +35,6 @@ void main()
|
|||||||
|
|
||||||
//gamme correction
|
//gamme correction
|
||||||
result = pow(result, vec3(1.0 / Gamma));
|
result = pow(result, vec3(1.0 / Gamma));
|
||||||
|
|
||||||
fragmentColor = vec4(result, 1.0);
|
fragmentColor = vec4(result, 1.0);
|
||||||
//fragmentColor = hdrColor;
|
//fragmentColor = hdrColor;
|
||||||
//fragmentColor = bloomColor;
|
//fragmentColor = bloomColor;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -15,10 +17,11 @@ uniform vec2 DiffuseUVRepeat;
|
|||||||
uniform vec2 NormalUVRepeat;
|
uniform vec2 NormalUVRepeat;
|
||||||
uniform vec2 SpecularUVRepeat;
|
uniform vec2 SpecularUVRepeat;
|
||||||
uniform vec2 GlowUVRepeat;
|
uniform vec2 GlowUVRepeat;
|
||||||
layout (binding = 0) uniform sampler2D DiffuseTexture;
|
layout (binding = 0) uniform sampler2D AOTexture;
|
||||||
layout (binding = 1) uniform sampler2D NormalMapTexture;
|
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||||
layout (binding = 2) uniform sampler2D SpecularMapTexture;
|
layout (binding = 2) uniform sampler2D NormalMapTexture;
|
||||||
layout (binding = 3) uniform sampler2D GlowMapTexture;
|
layout (binding = 3) uniform sampler2D SpecularMapTexture;
|
||||||
|
layout (binding = 4) uniform sampler2D GlowMapTexture;
|
||||||
|
|
||||||
#define TILE_SIZE 16
|
#define TILE_SIZE 16
|
||||||
|
|
||||||
@@ -120,6 +123,8 @@ vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textu
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy), 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 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||||
@@ -134,7 +139,7 @@ void main()
|
|||||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||||
|
|
||||||
LightResult totalLighting;
|
LightResult totalLighting;
|
||||||
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
|
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 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 start = int(LightGrids.Data[currentTile].Start);
|
||||||
@@ -152,8 +157,8 @@ void main()
|
|||||||
} else if (light.Type == 2) { //Directional
|
} else if (light.Type == 2) { //Directional
|
||||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||||
}
|
}
|
||||||
totalLighting.Diffuse += light_result.Diffuse;
|
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||||
totalLighting.Specular += light_result.Specular;
|
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
uniform mat4 M;
|
uniform mat4 M;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
@@ -23,19 +25,20 @@ uniform vec2 SpecularUVRepeat3;
|
|||||||
uniform vec2 GlowUVRepeat1;
|
uniform vec2 GlowUVRepeat1;
|
||||||
uniform vec2 GlowUVRepeat2;
|
uniform vec2 GlowUVRepeat2;
|
||||||
uniform vec2 GlowUVRepeat3;
|
uniform vec2 GlowUVRepeat3;
|
||||||
layout (binding = 0) uniform sampler2D SplatMapTexture;
|
layout (binding = 0) uniform sampler2D AOTexture;
|
||||||
layout (binding = 1) uniform sampler2D DiffuseTexture1;
|
layout (binding = 1) uniform sampler2D SplatMapTexture;
|
||||||
layout (binding = 2) uniform sampler2D DiffuseTexture2;
|
layout (binding = 2) uniform sampler2D DiffuseTexture1;
|
||||||
layout (binding = 3) uniform sampler2D DiffuseTexture3;
|
layout (binding = 3) uniform sampler2D DiffuseTexture2;
|
||||||
layout (binding = 4) uniform sampler2D NormalMapTexture1;
|
layout (binding = 4) uniform sampler2D DiffuseTexture3;
|
||||||
layout (binding = 5) uniform sampler2D NormalMapTexture2;
|
layout (binding = 5) uniform sampler2D NormalMapTexture1;
|
||||||
layout (binding = 6) uniform sampler2D NormalMapTexture3;
|
layout (binding = 6) uniform sampler2D NormalMapTexture2;
|
||||||
layout (binding = 7) uniform sampler2D SpecularMapTexture1;
|
layout (binding = 7) uniform sampler2D NormalMapTexture3;
|
||||||
layout (binding = 8) uniform sampler2D SpecularMapTexture2;
|
layout (binding = 8) uniform sampler2D SpecularMapTexture1;
|
||||||
layout (binding = 9) uniform sampler2D SpecularMapTexture3;
|
layout (binding = 9) uniform sampler2D SpecularMapTexture2;
|
||||||
layout (binding = 10) uniform sampler2D GlowMapTexture1;
|
layout (binding = 10) uniform sampler2D SpecularMapTexture3;
|
||||||
layout (binding = 11) uniform sampler2D GlowMapTexture2;
|
layout (binding = 11) uniform sampler2D GlowMapTexture1;
|
||||||
layout (binding = 12) uniform sampler2D GlowMapTexture3;
|
layout (binding = 12) uniform sampler2D GlowMapTexture2;
|
||||||
|
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
||||||
|
|
||||||
#define TILE_SIZE 16
|
#define TILE_SIZE 16
|
||||||
|
|
||||||
@@ -174,6 +177,9 @@ vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy), 0).r;
|
||||||
|
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
|
||||||
|
|
||||||
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
||||||
|
|
||||||
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3,
|
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3,
|
||||||
@@ -195,7 +201,7 @@ void main()
|
|||||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||||
|
|
||||||
LightResult totalLighting;
|
LightResult totalLighting;
|
||||||
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
|
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 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 start = int(LightGrids.Data[currentTile].Start);
|
||||||
@@ -213,8 +219,8 @@ void main()
|
|||||||
} else if (light.Type == 2) { //Directional
|
} else if (light.Type == 2) { //Directional
|
||||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||||
}
|
}
|
||||||
totalLighting.Diffuse += light_result.Diffuse;
|
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||||
totalLighting.Specular += light_result.Specular;
|
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
//Number of samples per pixel
|
||||||
|
uniform int uNumOfSamples;
|
||||||
|
//#define NUM_SAMPLES (11)
|
||||||
|
|
||||||
|
//Number of turns around the cirle
|
||||||
|
uniform int uNumOfTurns;
|
||||||
|
//#define NUM_TURNS (7)
|
||||||
|
|
||||||
|
layout (binding = 0) uniform sampler2D ViewSpaceZ;
|
||||||
|
|
||||||
|
uniform vec4 uProjInfo;
|
||||||
|
|
||||||
|
uniform float uProjScale;
|
||||||
|
//#define ProjScale 500
|
||||||
|
|
||||||
|
uniform float uRadius;
|
||||||
|
//#define Radius 1.0f
|
||||||
|
|
||||||
|
uniform float uBias;
|
||||||
|
//#define Bias 0.012f
|
||||||
|
|
||||||
|
uniform float uContrast;
|
||||||
|
//#define IntensityDivR6 1
|
||||||
|
|
||||||
|
uniform float uIntensityScale;
|
||||||
|
|
||||||
|
out float AO;
|
||||||
|
|
||||||
|
vec3 getVSPosition(ivec2 ScreenSpaceCoord) {
|
||||||
|
float z = texelFetch(ViewSpaceZ, ScreenSpaceCoord, 0).r;
|
||||||
|
//Get the xy view space coordinates and add the z value from ViewSpaceZ buffer.
|
||||||
|
return vec3((uProjInfo[0] + (ScreenSpaceCoord.x * uProjInfo[1])) * z, (uProjInfo[2] + (ScreenSpaceCoord.y * uProjInfo[3])) * z, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 getVSFaceNormal(vec3 ViewSpacePosition) {
|
||||||
|
// Get tangets vector for the plane and ViewSpacePositin... don't ask how this functions works. It's pure magic.
|
||||||
|
// They do this and it just works... I would guess that they approximate the function of a plane from pixels close to the pixel were on now.
|
||||||
|
return normalize(cross(dFdx(ViewSpacePosition), dFdy(ViewSpacePosition)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec3 getSampleViewSpacePos(ivec2 ScreenSpaceCoord, int SampleIndex, float RotationAngle, float ScreenSpaceSampleRadius){
|
||||||
|
// Pure Magic...
|
||||||
|
float alpha = float(SampleIndex) * (1.0 / uNumOfSamples);
|
||||||
|
|
||||||
|
// Angle to where to sample
|
||||||
|
float angle = alpha * (uNumOfTurns * 6.28) + RotationAngle;
|
||||||
|
|
||||||
|
//Lenght to were to sample
|
||||||
|
ScreenSpaceSampleRadius = ScreenSpaceSampleRadius * alpha;
|
||||||
|
|
||||||
|
vec2 screenSpaceSampleOffsetVecor = vec2(cos(angle), sin(angle));
|
||||||
|
|
||||||
|
// Get texel coordinate on where to sample by going screenSpaceSampleOffsetVecor direction in ScreenSpaceSampleRadius units from ScreenSpaceCoord (the point being shaded);
|
||||||
|
ivec2 screenSpaceSampleTexel = ivec2(ScreenSpaceSampleRadius * screenSpaceSampleOffsetVecor) + ScreenSpaceCoord;
|
||||||
|
|
||||||
|
return getVSPosition(screenSpaceSampleTexel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float sampleAO(ivec2 ScreenSpaceCoord, vec3 Origin, vec3 OriginNormal, float ScreenSpaceSampleRadius, int SampleIndex, float RotationAngle, float Radius) {
|
||||||
|
float radius2 = Radius * Radius;
|
||||||
|
vec3 sampleViewSpacePosition = getSampleViewSpacePos(ScreenSpaceCoord, SampleIndex, RotationAngle, ScreenSpaceSampleRadius);
|
||||||
|
|
||||||
|
vec3 sampleVector = Origin - sampleViewSpacePosition;
|
||||||
|
|
||||||
|
// vv = sampleVectorLenght ^ 2
|
||||||
|
float vv = dot(sampleVector, sampleVector);
|
||||||
|
// vn = angle between sampleVector and Normal
|
||||||
|
float vn = dot(sampleVector, OriginNormal);
|
||||||
|
|
||||||
|
const float epsilon = 0.0001f;
|
||||||
|
|
||||||
|
// vv < radius2 if the vector is shorter then the radius;
|
||||||
|
// vn - bias, offset the angle to reduse self occlusion.
|
||||||
|
// epsilon is here to make divison by 0 impossible.
|
||||||
|
return float(vv < radius2) * max((vn - uBias) / (epsilon + vv), 0.0);
|
||||||
|
//float f = max(radius2 - vv, 0.0);
|
||||||
|
//return f * f * f * max((vn - uBias) / (epsilon + vv), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
ivec2 originScreenCoord = ivec2(gl_FragCoord.xy);
|
||||||
|
|
||||||
|
vec3 origin = getVSPosition(originScreenCoord);
|
||||||
|
|
||||||
|
float radius;
|
||||||
|
if(origin.z < uRadius){
|
||||||
|
radius = origin.z;
|
||||||
|
} else {
|
||||||
|
radius = uRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec3 originNormal = getVSFaceNormal(origin);
|
||||||
|
|
||||||
|
float screenSpaceSampleRadius = -uProjScale * radius / origin.z;
|
||||||
|
|
||||||
|
float rotationAngleOffset = 30 * originScreenCoord.x ^ originScreenCoord.y + 10 * originScreenCoord.x * originScreenCoord.y;
|
||||||
|
|
||||||
|
float sum = 0.0;
|
||||||
|
for (int i = 0; i < uNumOfSamples; i++) {
|
||||||
|
sum += sampleAO(originScreenCoord, origin, originNormal, screenSpaceSampleRadius, i, rotationAngleOffset, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
//float A = max(0.0, 1.0 - sum * (2.0f / uNumOfSamples));
|
||||||
|
float A = 1.0 - sum * (2.0f * uIntensityScale / float(uNumOfSamples));
|
||||||
|
AO = clamp(pow(A, uContrast), 0.0f, 1.0f);
|
||||||
|
//AO = vec4(originNormal, 1.0f);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
layout (location = 0) in vec3 Position;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = vec4(Position, 1.0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
layout (binding = 0) uniform sampler2D DepthBuffer;
|
||||||
|
uniform vec3 ClipInfo;
|
||||||
|
|
||||||
|
out float depthLinear;
|
||||||
|
//Just for Debug, should be depthLinear
|
||||||
|
//out vec4 fragmentColor;
|
||||||
|
void main() {
|
||||||
|
float depthSample = texelFetch(DepthBuffer, ivec2(gl_FragCoord.xy), 0).r;
|
||||||
|
depthLinear = ClipInfo[0] / (ClipInfo[1] * depthSample + ClipInfo[2]);
|
||||||
|
//float depthLinear = (NearClip) / ( -depthSample + 1.0f);
|
||||||
|
//fragmentColor = vec4(depthLinear, depthLinear, depthLinear, 1.0f);
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@ uniform mat4 M;
|
|||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
uniform mat4 P;
|
uniform mat4 P;
|
||||||
|
|
||||||
layout (binding = 0) uniform sampler2D DiffuseTexture;
|
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||||
layout (binding = 1) uniform sampler2D GlowMapTexture;
|
layout (binding = 2) uniform sampler2D GlowMapTexture;
|
||||||
|
|
||||||
|
|
||||||
in VertexData{
|
in VertexData{
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#include "Network/NetworkClient.h"
|
|
||||||
|
|
||||||
NetworkClient::NetworkClient()
|
|
||||||
{
|
|
||||||
m_ReadBuffer = new char[m_BufferSize];
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkClient::~NetworkClient()
|
|
||||||
{
|
|
||||||
delete[] m_ReadBuffer;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#include "Network/NetworkServer.h"
|
|
||||||
|
|
||||||
NetworkServer::NetworkServer()
|
|
||||||
{
|
|
||||||
m_ReadBuffer = new char[m_BufferSize];
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkServer::~NetworkServer()
|
|
||||||
{
|
|
||||||
delete[] m_ReadBuffer;
|
|
||||||
}
|
|
||||||
@@ -146,7 +146,7 @@ void Server::sendSnapshot()
|
|||||||
{
|
{
|
||||||
Packet packet(MessageType::Snapshot);
|
Packet packet(MessageType::Snapshot);
|
||||||
addInputCommandsToPacket(packet);
|
addInputCommandsToPacket(packet);
|
||||||
addPlayersToPacket(packet, EntityID_Invalid);
|
addChildrenToPacket(packet, EntityID_Invalid);
|
||||||
unreliableBroadcast(packet);
|
unreliableBroadcast(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ void Server::addInputCommandsToPacket(Packet& packet)
|
|||||||
m_InputCommandsToBroadcast.clear();
|
m_InputCommandsToBroadcast.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::addPlayersToPacket(Packet & packet, EntityID entityID)
|
void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
|
||||||
{
|
{
|
||||||
auto itPair = m_World->GetChildren(entityID);
|
auto itPair = m_World->GetChildren(entityID);
|
||||||
std::unordered_map<std::string, ComponentPool*> worldComponentPools = m_World->GetComponentPools();
|
std::unordered_map<std::string, ComponentPool*> worldComponentPools = m_World->GetComponentPools();
|
||||||
@@ -212,49 +212,6 @@ void Server::addPlayersToPacket(Packet & packet, EntityID entityID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
|
|
||||||
{
|
|
||||||
auto itPair = m_World->GetChildren(entityID);
|
|
||||||
std::unordered_map<std::string, ComponentPool*> worldComponentPools = m_World->GetComponentPools();
|
|
||||||
// Loop through every child
|
|
||||||
for (auto it = itPair.first; it != itPair.second; it++) {
|
|
||||||
EntityID childEntityID = it->second;
|
|
||||||
// Write EntityID and parentsID and Entity name
|
|
||||||
packet.WritePrimitive(childEntityID);
|
|
||||||
packet.WritePrimitive(entityID);
|
|
||||||
packet.WriteString(m_World->GetName(childEntityID));
|
|
||||||
// Write components to child
|
|
||||||
int numberOfComponents = 0;
|
|
||||||
for (auto& i : worldComponentPools) {
|
|
||||||
if (i.second->KnowsEntity(childEntityID)) {
|
|
||||||
numberOfComponents++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Write how many components should be read
|
|
||||||
packet.WritePrimitive(numberOfComponents);
|
|
||||||
for (auto& i : worldComponentPools) {
|
|
||||||
// If the entity exist in the pool
|
|
||||||
if (i.second->KnowsEntity(childEntityID)) {
|
|
||||||
ComponentWrapper componentWrapper = i.second->GetByEntity(childEntityID);
|
|
||||||
// ComponentType
|
|
||||||
packet.WriteString(componentWrapper.Info.Name);
|
|
||||||
// Loop through fields
|
|
||||||
for (auto& componentField : componentWrapper.Info.FieldsInOrder) {
|
|
||||||
ComponentInfo::Field_t fieldInfo = componentWrapper.Info.Fields.at(componentField);
|
|
||||||
if (fieldInfo.Type == "string") {
|
|
||||||
std::string& value = componentWrapper[componentField];
|
|
||||||
packet.WriteString(value);
|
|
||||||
} else {
|
|
||||||
packet.WriteData(componentWrapper.Data + fieldInfo.Offset, fieldInfo.Stride);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Go to to your children
|
|
||||||
addChildrenToPacket(packet, childEntityID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::sendPing()
|
void Server::sendPing()
|
||||||
{
|
{
|
||||||
// Prints connected players ping
|
// Prints connected players ping
|
||||||
@@ -347,11 +304,6 @@ void Server::parseTCPConnect(Packet & packet)
|
|||||||
connnectPacket.WritePrimitive(playerID);
|
connnectPacket.WritePrimitive(playerID);
|
||||||
m_Reliable.Send(connnectPacket);
|
m_Reliable.Send(connnectPacket);
|
||||||
|
|
||||||
Packet firstSnapshot(MessageType::Snapshot);
|
|
||||||
addInputCommandsToPacket(firstSnapshot);
|
|
||||||
addChildrenToPacket(firstSnapshot, EntityID_Invalid);
|
|
||||||
m_Reliable.Send(firstSnapshot);
|
|
||||||
|
|
||||||
// Send notification that a player has connected
|
// Send notification that a player has connected
|
||||||
//Packet notificationPacket(MessageType::PlayerConnected);
|
//Packet notificationPacket(MessageType::PlayerConnected);
|
||||||
//broadcast(notificationPacket);
|
//broadcast(notificationPacket);
|
||||||
@@ -494,9 +446,7 @@ void Server::parsePing()
|
|||||||
{
|
{
|
||||||
for (auto& kv : m_ConnectedPlayers) {
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
if (kv.second.TCPAddress == m_Address &&
|
if (kv.second.TCPAddress == m_Address &&
|
||||||
kv.second.TCPPort == m_Port
|
kv.second.TCPPort == m_Port) {
|
||||||
|| (kv.second.Endpoint.address() == m_Address
|
|
||||||
&& kv.second.Endpoint.port() == m_Port)) {
|
|
||||||
kv.second.StopTime = std::clock();
|
kv.second.StopTime = std::clock();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,62 +56,32 @@ void TCPClient::Disconnect()
|
|||||||
|
|
||||||
void TCPClient::Receive(Packet& packet)
|
void TCPClient::Receive(Packet& packet)
|
||||||
{
|
{
|
||||||
size_t bytesRead = readBuffer();
|
size_t bytesRead = readBuffer(m_ReadBuffer);
|
||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t TCPClient::readBuffer()
|
size_t TCPClient::readBuffer(char* data)
|
||||||
{
|
{
|
||||||
//if (!m_Socket) {
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
//boost::system::error_code error;
|
|
||||||
//// Read size of packet
|
|
||||||
//size_t bytesReceived = m_Socket->read_some(boost
|
|
||||||
// ::asio::buffer((void*)data, sizeof(int)),
|
|
||||||
// error);
|
|
||||||
//int sizeOfPacket = 0;
|
|
||||||
//memcpy(&sizeOfPacket, data, sizeof(int));
|
|
||||||
|
|
||||||
//// Read the rest of the message
|
|
||||||
//bytesReceived += m_Socket->read_some(boost
|
|
||||||
// ::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
|
|
||||||
// error);
|
|
||||||
//if (error) {
|
|
||||||
// //LOG_ERROR("receive: %s", error.message().c_str());
|
|
||||||
//}
|
|
||||||
//return bytesReceived;
|
|
||||||
|
|
||||||
if (!m_Socket) {
|
if (!m_Socket) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
// Read size of packet
|
// Read size of packet
|
||||||
m_Socket->receive(boost
|
|
||||||
::asio::buffer((void*)m_ReadBuffer, sizeof(int)),
|
|
||||||
boost::asio::ip::tcp::socket::message_peek, error);
|
|
||||||
unsigned int sizeOfPacket = 0;
|
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
|
||||||
|
|
||||||
// if the buffer is to small increase the size of it
|
|
||||||
// TODO if message is huge 1 time the buffer will not decrease.
|
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
|
||||||
delete[] m_ReadBuffer;
|
|
||||||
m_ReadBuffer = new char[sizeOfPacket];
|
|
||||||
m_BufferSize = sizeOfPacket;
|
|
||||||
}
|
|
||||||
// Read the rest of the message
|
|
||||||
size_t bytesReceived = m_Socket->read_some(boost
|
size_t bytesReceived = m_Socket->read_some(boost
|
||||||
::asio::buffer((void*)(m_ReadBuffer), sizeOfPacket),
|
::asio::buffer((void*)data, sizeof(int)),
|
||||||
|
error);
|
||||||
|
int sizeOfPacket = 0;
|
||||||
|
memcpy(&sizeOfPacket, data, sizeof(int));
|
||||||
|
|
||||||
|
// Read the rest of the message
|
||||||
|
bytesReceived += m_Socket->read_some(boost
|
||||||
|
::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
|
||||||
error);
|
error);
|
||||||
if (error) {
|
if (error) {
|
||||||
//LOG_ERROR("receive: %s", error.message().c_str());
|
//LOG_ERROR("receive: %s", error.message().c_str());
|
||||||
}
|
}
|
||||||
if (sizeOfPacket > 1000000)
|
|
||||||
LOG_WARNING("The packets received are bigger than 1MB");
|
|
||||||
|
|
||||||
return bytesReceived;
|
return bytesReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ TCPServer::TCPServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
TCPServer::~TCPServer()
|
TCPServer::~TCPServer()
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TCPServer::AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers)
|
void TCPServer::AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers)
|
||||||
{
|
{
|
||||||
@@ -30,7 +31,7 @@ PlayerID GetPlayerIDFromEndpoint(const std::map<PlayerID, PlayerDefinition>& con
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCPServer::handle_accept(boost::shared_ptr<tcp::socket> socket,
|
void TCPServer::handle_accept(boost::shared_ptr<tcp::socket> socket,
|
||||||
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
||||||
const boost::system::error_code& error)
|
const boost::system::error_code& error)
|
||||||
{
|
{
|
||||||
@@ -50,8 +51,8 @@ void TCPServer::handle_accept(boost::shared_ptr<tcp::socket> socket,
|
|||||||
|
|
||||||
void TCPServer::Send(Packet & packet, PlayerDefinition & playerDefinition)
|
void TCPServer::Send(Packet & packet, PlayerDefinition & playerDefinition)
|
||||||
{
|
{
|
||||||
packet.UpdateSize();
|
|
||||||
try {
|
try {
|
||||||
|
packet.UpdateSize();
|
||||||
int bytesSent = playerDefinition.TCPSocket->send(
|
int bytesSent = playerDefinition.TCPSocket->send(
|
||||||
boost::asio::buffer(packet.Data(), packet.Size()),
|
boost::asio::buffer(packet.Data(), packet.Size()),
|
||||||
0);
|
0);
|
||||||
@@ -72,79 +73,38 @@ void TCPServer::Send(Packet & packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TCPServer::Disconnect()
|
void TCPServer::Disconnect()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void TCPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
|
||||||
//{
|
|
||||||
// int bytesRead = readBuffer(m_ReadBuffer, playerDefinition);
|
|
||||||
// if (bytesRead > 0) {
|
|
||||||
// packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
|
||||||
// }
|
|
||||||
// lastReceivedSocket = playerDefinition.TCPSocket;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//int TCPServer::readBuffer(char* data, PlayerDefinition & playerDefinition)
|
|
||||||
//{
|
|
||||||
// if (!playerDefinition.TCPSocket) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// boost::system::error_code error;
|
|
||||||
// // Read size of packet
|
|
||||||
// size_t bytesReceived = playerDefinition.TCPSocket->read_some(boost
|
|
||||||
// ::asio::buffer((void*)data, sizeof(int)),
|
|
||||||
// error);
|
|
||||||
// int sizeOfPacket = 0;
|
|
||||||
// memcpy(&sizeOfPacket, data, sizeof(int));
|
|
||||||
//
|
|
||||||
// // Read the rest of the message
|
|
||||||
// bytesReceived += playerDefinition.TCPSocket->read_some(boost
|
|
||||||
// ::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
|
|
||||||
// error);
|
|
||||||
// if (error) {
|
|
||||||
// //LOG_ERROR("receive: %s", error.message().c_str());
|
|
||||||
// }
|
|
||||||
// return bytesReceived;
|
|
||||||
//}
|
|
||||||
|
|
||||||
void TCPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
void TCPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
||||||
{
|
{
|
||||||
int bytesRead = readBuffer(playerDefinition);
|
int bytesRead = readBuffer(m_ReadBuffer, playerDefinition);
|
||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
}
|
}
|
||||||
lastReceivedSocket = playerDefinition.TCPSocket;
|
lastReceivedSocket = playerDefinition.TCPSocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TCPServer::readBuffer(PlayerDefinition & playerDefinition)
|
int TCPServer::readBuffer(char* data, PlayerDefinition & playerDefinition)
|
||||||
{
|
{
|
||||||
if (!playerDefinition.TCPSocket) {
|
if (!playerDefinition.TCPSocket) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
// Read size of packet
|
// Read size of packet
|
||||||
playerDefinition.TCPSocket->receive(boost
|
|
||||||
::asio::buffer((void*)m_ReadBuffer, sizeof(int)),
|
|
||||||
boost::asio::ip::tcp::socket::message_peek, error);
|
|
||||||
unsigned int sizeOfPacket = 0;
|
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
|
||||||
|
|
||||||
// if the buffer is to small increase the size of it
|
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
|
||||||
delete[] m_ReadBuffer;
|
|
||||||
m_ReadBuffer = new char[sizeOfPacket];
|
|
||||||
m_BufferSize = sizeOfPacket;
|
|
||||||
}
|
|
||||||
// Read the rest of the message
|
|
||||||
size_t bytesReceived = playerDefinition.TCPSocket->read_some(boost
|
size_t bytesReceived = playerDefinition.TCPSocket->read_some(boost
|
||||||
::asio::buffer((void*)(m_ReadBuffer), sizeOfPacket),
|
::asio::buffer((void*)data, sizeof(int)),
|
||||||
|
error);
|
||||||
|
int sizeOfPacket = 0;
|
||||||
|
memcpy(&sizeOfPacket, data, sizeof(int));
|
||||||
|
|
||||||
|
// Read the rest of the message
|
||||||
|
bytesReceived += playerDefinition.TCPSocket->read_some(boost
|
||||||
|
::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
|
||||||
error);
|
error);
|
||||||
if (error) {
|
if (error) {
|
||||||
//LOG_ERROR("receive: %s", error.message().c_str());
|
//LOG_ERROR("receive: %s", error.message().c_str());
|
||||||
}
|
}
|
||||||
if (sizeOfPacket > 1000000)
|
|
||||||
LOG_WARNING("The packets received are bigger than 1MB");
|
|
||||||
|
|
||||||
return bytesReceived;
|
return bytesReceived;
|
||||||
}
|
}
|
||||||
@@ -27,62 +27,30 @@ void UDPClient::Disconnect()
|
|||||||
|
|
||||||
void UDPClient::Receive(Packet& packet)
|
void UDPClient::Receive(Packet& packet)
|
||||||
{
|
{
|
||||||
int bytesRead = readBuffer();
|
int bytesRead = readBuffer(m_ReadBuffer);
|
||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPClient::readBuffer()
|
int UDPClient::readBuffer(char* data)
|
||||||
{
|
{
|
||||||
//if (!m_Socket) {
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
//boost::system::error_code error;
|
|
||||||
//int bytesReceived = m_Socket->receive_from(boost
|
|
||||||
// ::asio::buffer((void*)data, BUFFERSIZE),
|
|
||||||
// m_ReceiverEndpoint,
|
|
||||||
// 0, error);
|
|
||||||
//if (error) {
|
|
||||||
// //LOG_ERROR("receive: %s", error.message().c_str());
|
|
||||||
//}
|
|
||||||
//return bytesReceived;
|
|
||||||
if (!m_Socket) {
|
if (!m_Socket) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
// Read size of packet
|
int bytesReceived = m_Socket->receive_from(boost
|
||||||
m_Socket->receive(boost
|
::asio::buffer((void*)data, BUFFERSIZE),
|
||||||
::asio::buffer((void*)m_ReadBuffer, sizeof(int)),
|
m_ReceiverEndpoint,
|
||||||
boost::asio::ip::udp::socket::message_peek, error);
|
0, error);
|
||||||
int sizeOfPacket = 0;
|
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
|
||||||
|
|
||||||
// if the buffer is to small increase the size of it
|
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
|
||||||
delete[] m_ReadBuffer;
|
|
||||||
m_ReadBuffer = new char[sizeOfPacket];
|
|
||||||
m_BufferSize = sizeOfPacket;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t availableData = m_Socket->available();
|
|
||||||
// Read the rest of the message
|
|
||||||
size_t bytesReceived = m_Socket->receive_from(boost
|
|
||||||
::asio::buffer((void*)(m_ReadBuffer),
|
|
||||||
sizeOfPacket),
|
|
||||||
m_ReceiverEndpoint, 0, error);
|
|
||||||
if (error) {
|
if (error) {
|
||||||
//LOG_ERROR("receive: %s", error.message().c_str());
|
//LOG_ERROR("receive: %s", error.message().c_str());
|
||||||
}
|
}
|
||||||
if (sizeOfPacket > 1000000)
|
|
||||||
LOG_WARNING("The packets received are bigger than 1MB");
|
|
||||||
|
|
||||||
return bytesReceived;
|
return bytesReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPClient::Send(Packet& packet)
|
void UDPClient::Send(Packet& packet)
|
||||||
{
|
{
|
||||||
packet.UpdateSize();
|
|
||||||
m_Socket->send_to(boost::asio::buffer(
|
m_Socket->send_to(boost::asio::buffer(
|
||||||
packet.Data(),
|
packet.Data(),
|
||||||
packet.Size()),
|
packet.Size()),
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ UDPServer::~UDPServer()
|
|||||||
|
|
||||||
void UDPServer::Send(Packet& packet, PlayerDefinition & playerDefinition)
|
void UDPServer::Send(Packet& packet, PlayerDefinition & playerDefinition)
|
||||||
{
|
{
|
||||||
packet.UpdateSize();
|
|
||||||
try {
|
try {
|
||||||
int bytesSent = m_Socket->send_to(
|
int bytesSent = m_Socket->send_to(
|
||||||
boost::asio::buffer(packet.Data(), packet.Size()),
|
boost::asio::buffer(packet.Data(), packet.Size()),
|
||||||
@@ -24,7 +23,6 @@ void UDPServer::Send(Packet& packet, PlayerDefinition & playerDefinition)
|
|||||||
// Send back to endpoint of received packet
|
// Send back to endpoint of received packet
|
||||||
void UDPServer::Send(Packet & packet)
|
void UDPServer::Send(Packet & packet)
|
||||||
{
|
{
|
||||||
packet.UpdateSize();
|
|
||||||
m_Socket->send_to(
|
m_Socket->send_to(
|
||||||
boost::asio::buffer(
|
boost::asio::buffer(
|
||||||
packet.Data(),
|
packet.Data(),
|
||||||
@@ -35,7 +33,7 @@ void UDPServer::Send(Packet & packet)
|
|||||||
|
|
||||||
void UDPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
void UDPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
||||||
{
|
{
|
||||||
int bytesRead = readBuffer();
|
int bytesRead = readBuffer(m_ReadBuffer);
|
||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
}
|
}
|
||||||
@@ -47,47 +45,17 @@ bool UDPServer::IsSocketAvailable()
|
|||||||
return m_Socket->available();
|
return m_Socket->available();
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPServer::readBuffer()
|
int UDPServer::readBuffer(char* data)
|
||||||
{
|
{
|
||||||
//boost::system::error_code error = boost::asio::error::host_not_found;
|
boost::system::error_code error = boost::asio::error::host_not_found;
|
||||||
//unsigned int length = m_Socket->receive_from(
|
unsigned int length = m_Socket->receive_from(
|
||||||
// boost::asio::buffer((void*)data
|
boost::asio::buffer((void*)data
|
||||||
// , BUFFERSIZE)
|
, BUFFERSIZE)
|
||||||
// , m_ReceiverEndpoint, 0, error);
|
, m_ReceiverEndpoint, 0, error);
|
||||||
//if (error) {
|
if (error) {
|
||||||
// LOG_WARNING(error.message().c_str());
|
LOG_WARNING(error.message().c_str());
|
||||||
//}
|
|
||||||
//return length;
|
|
||||||
if (!m_Socket) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
boost::system::error_code error;
|
return length;
|
||||||
// Read size of packet
|
|
||||||
m_Socket->receive_from(boost
|
|
||||||
::asio::buffer((void*)m_ReadBuffer, sizeof(int)),
|
|
||||||
m_ReceiverEndpoint, boost::asio::ip::udp::socket::message_peek, error);
|
|
||||||
unsigned int sizeOfPacket = 0;
|
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
|
||||||
|
|
||||||
// if the buffer is to small increase the size of it
|
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
|
||||||
delete[] m_ReadBuffer;
|
|
||||||
m_ReadBuffer = new char[sizeOfPacket];
|
|
||||||
m_BufferSize = sizeOfPacket;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read the rest of the message
|
|
||||||
size_t bytesReceived = m_Socket->receive_from(boost
|
|
||||||
::asio::buffer((void*)(m_ReadBuffer),
|
|
||||||
sizeOfPacket),
|
|
||||||
m_ReceiverEndpoint, 0, error);
|
|
||||||
if (error) {
|
|
||||||
//LOG_ERROR("receive: %s", error.message().c_str());
|
|
||||||
}
|
|
||||||
if (sizeOfPacket > 1000000)
|
|
||||||
LOG_WARNING("The packets received are bigger than 1MB");
|
|
||||||
|
|
||||||
return bytesReceived;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPServer::AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers)
|
void UDPServer::AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers)
|
||||||
|
|||||||
@@ -19,16 +19,20 @@ void DrawBloomPass::InitializeTextures()
|
|||||||
void DrawBloomPass::InitializeShaderPrograms()
|
void DrawBloomPass::InitializeShaderPrograms()
|
||||||
{
|
{
|
||||||
m_GaussianProgram_horiz = ResourceManager::Load<ShaderProgram>("##GaussianProgramHoriz");
|
m_GaussianProgram_horiz = ResourceManager::Load<ShaderProgram>("##GaussianProgramHoriz");
|
||||||
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
|
if (m_GaussianProgram_horiz->GetHandle() == 0) {
|
||||||
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
|
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
|
||||||
m_GaussianProgram_horiz->Compile();
|
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
|
||||||
m_GaussianProgram_horiz->Link();
|
m_GaussianProgram_horiz->Compile();
|
||||||
|
m_GaussianProgram_horiz->Link();
|
||||||
|
}
|
||||||
|
|
||||||
m_GaussianProgram_vert = ResourceManager::Load<ShaderProgram>("##GaussianProgramVert");
|
m_GaussianProgram_vert = ResourceManager::Load<ShaderProgram>("##GaussianProgramVert");
|
||||||
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
|
if (m_GaussianProgram_vert->GetHandle() == 0) {
|
||||||
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
|
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
|
||||||
m_GaussianProgram_vert->Compile();
|
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
|
||||||
m_GaussianProgram_vert->Link();
|
m_GaussianProgram_vert->Compile();
|
||||||
|
m_GaussianProgram_vert->Link();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,15 +75,12 @@ void DrawBloomPass::Draw(GLuint texture)
|
|||||||
//Horizontal pass, first use the given texture then save it to the horizontal framebuffer.
|
//Horizontal pass, first use the given texture then save it to the horizontal framebuffer.
|
||||||
m_GaussianFrameBuffer_horiz.Bind();
|
m_GaussianFrameBuffer_horiz.Bind();
|
||||||
m_GaussianProgram_horiz->Bind();
|
m_GaussianProgram_horiz->Bind();
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
|
||||||
glBindVertexArray(m_ScreenQuad->VAO);
|
glBindVertexArray(m_ScreenQuad->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||||
|
|
||||||
//Iterate some times to make it more gaussian.
|
//Iterate some times to make it more gaussian.
|
||||||
for (int i = 1; i < m_iterations; i++) {
|
for (int i = 1; i < m_iterations; i++) {
|
||||||
//Vertical pass
|
//Vertical pass
|
||||||
@@ -92,7 +93,6 @@ void DrawBloomPass::Draw(GLuint texture)
|
|||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||||
|
|
||||||
//horizontal pass
|
//horizontal pass
|
||||||
|
|
||||||
m_GaussianFrameBuffer_horiz.Bind();
|
m_GaussianFrameBuffer_horiz.Bind();
|
||||||
@@ -112,7 +112,6 @@ void DrawBloomPass::Draw(GLuint texture)
|
|||||||
m_GaussianProgram_vert->Bind();
|
m_GaussianProgram_vert->Bind();
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
|
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
|
||||||
|
|
||||||
glBindVertexArray(m_ScreenQuad->VAO);
|
glBindVertexArray(m_ScreenQuad->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ void DrawFinalPass::InitializeFrameBuffers()
|
|||||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
GLERROR("RenderBuffer generation");
|
GLERROR("RenderBuffer generation");
|
||||||
|
|
||||||
|
|
||||||
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
//GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
//GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
@@ -173,25 +174,25 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
GLERROR("Creating DepthFill program");
|
GLERROR("Creating DepthFill program");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawFinalPass::Draw(RenderScene& scene)
|
void DrawFinalPass::Draw(RenderScene& scene, GLuint SSAOTexture)
|
||||||
{
|
{
|
||||||
GLERROR("Pre");
|
GLERROR("Pre");
|
||||||
|
|
||||||
DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
|
DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
|
||||||
if (scene.ClearDepth) {
|
if (scene.ClearDepth) {
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
state->Disable(GL_DEPTH_TEST);
|
||||||
|
state->DepthMask(GL_FALSE);
|
||||||
}
|
}
|
||||||
//TODO: Do we need check for this or will it be per scene always?
|
//TODO: Do we need check for this or will it be per scene always?
|
||||||
glClearStencil(0x00);
|
glClearStencil(0x00);
|
||||||
glClear(GL_STENCIL_BUFFER_BIT);
|
glClear(GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
//Fill depth buffer
|
//Fill depth buffer
|
||||||
|
|
||||||
|
|
||||||
state->StencilMask(0x00);
|
state->StencilMask(0x00);
|
||||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene, SSAOTexture);
|
||||||
GLERROR("OpaqueObjects");
|
GLERROR("OpaqueObjects");
|
||||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
|
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene, SSAOTexture);
|
||||||
GLERROR("TransparentObjects");
|
GLERROR("TransparentObjects");
|
||||||
DrawSprites(scene.Jobs.SpriteJob, scene);
|
DrawSprites(scene.Jobs.SpriteJob, scene);
|
||||||
GLERROR("SpriteJobs");
|
GLERROR("SpriteJobs");
|
||||||
@@ -206,11 +207,11 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
|||||||
//Draw Opaque shielded objects
|
//Draw Opaque shielded objects
|
||||||
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||||
state->StencilMask(0x00);
|
state->StencilMask(0x00);
|
||||||
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
|
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene, SSAOTexture); //might need changing
|
||||||
GLERROR("Shielded Opaque object");
|
GLERROR("Shielded Opaque object");
|
||||||
|
|
||||||
//Draw Transparen Shielded objects
|
//Draw Transparen Shielded objects
|
||||||
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
|
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene, SSAOTexture); //might need changing
|
||||||
GLERROR("Shielded Transparent objects");
|
GLERROR("Shielded Transparent objects");
|
||||||
|
|
||||||
GLERROR("END");
|
GLERROR("END");
|
||||||
@@ -241,14 +242,14 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
|||||||
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
|
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
|
||||||
GLERROR("StencilPass");
|
GLERROR("StencilPass");
|
||||||
|
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
stateLowRes->Enable(GL_DEPTH_TEST);
|
stateLowRes->Enable(GL_DEPTH_TEST);
|
||||||
stateLowRes->StencilFunc(GL_LEQUAL, 1, 0xFF);
|
stateLowRes->StencilFunc(GL_LEQUAL, 1, 0xFF);
|
||||||
stateLowRes->StencilMask(0x00);
|
stateLowRes->StencilMask(0x00);
|
||||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene, SSAOTexture);
|
||||||
GLERROR("OpaqueObjects");
|
GLERROR("OpaqueObjects");
|
||||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
|
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene, SSAOTexture);
|
||||||
GLERROR("TransparentObjects");
|
GLERROR("TransparentObjects");
|
||||||
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
@@ -321,7 +322,7 @@ void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm:
|
|||||||
GLERROR("MipMap Texture initialization failed");
|
GLERROR("MipMap Texture initialization failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene, GLuint SSAOTexture)
|
||||||
{
|
{
|
||||||
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||||
GLERROR("forwardHandle");
|
GLERROR("forwardHandle");
|
||||||
@@ -344,6 +345,9 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO());
|
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO());
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightCullingPass->LightIndexSSBO());
|
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightCullingPass->LightIndexSSBO());
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, SSAOTexture);
|
||||||
|
|
||||||
for (auto &job : jobs) {
|
for (auto &job : jobs) {
|
||||||
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
|
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
|
||||||
if (explosionEffectJob) {
|
if (explosionEffectJob) {
|
||||||
@@ -690,14 +694,14 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
|
|||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(spriteJob->FillColor));
|
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(spriteJob->FillColor));
|
||||||
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), spriteJob->FillPercentage);
|
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), spriteJob->FillPercentage);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
if (spriteJob->DiffuseTexture != nullptr) {
|
if (spriteJob->DiffuseTexture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, spriteJob->DiffuseTexture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, spriteJob->DiffuseTexture->m_Texture);
|
||||||
} else {
|
} else {
|
||||||
glBindTexture(GL_TEXTURE_2D, m_ErrorTexture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, m_ErrorTexture->m_Texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
if (spriteJob->IncandescenceTexture != nullptr) {
|
if (spriteJob->IncandescenceTexture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, spriteJob->IncandescenceTexture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, spriteJob->IncandescenceTexture->m_Texture);
|
||||||
} else {
|
} else {
|
||||||
@@ -807,7 +811,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
case RawModel::MaterialType::SingleTextures:
|
case RawModel::MaterialType::SingleTextures:
|
||||||
case RawModel::MaterialType::Basic:
|
case RawModel::MaterialType::Basic:
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
||||||
@@ -817,7 +821,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
||||||
@@ -827,7 +831,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE3);
|
||||||
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
||||||
@@ -837,7 +841,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE3);
|
glActiveTexture(GL_TEXTURE4);
|
||||||
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
||||||
@@ -850,7 +854,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
}
|
}
|
||||||
case RawModel::MaterialType::SplatMapping:
|
case RawModel::MaterialType::SplatMapping:
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
||||||
|
|
||||||
int texturePosition = GL_TEXTURE1;
|
int texturePosition = GL_TEXTURE1;
|
||||||
@@ -925,7 +929,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
case RawModel::MaterialType::SingleTextures:
|
case RawModel::MaterialType::SingleTextures:
|
||||||
case RawModel::MaterialType::Basic:
|
case RawModel::MaterialType::Basic:
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
||||||
@@ -935,7 +939,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
||||||
@@ -945,7 +949,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE3);
|
||||||
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
||||||
@@ -955,7 +959,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE3);
|
glActiveTexture(GL_TEXTURE4);
|
||||||
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
||||||
@@ -968,10 +972,10 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
}
|
}
|
||||||
case RawModel::MaterialType::SplatMapping:
|
case RawModel::MaterialType::SplatMapping:
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
||||||
|
|
||||||
int texturePosition = GL_TEXTURE1;
|
int texturePosition = GL_TEXTURE2;
|
||||||
|
|
||||||
//Bind 5 diffuse textures
|
//Bind 5 diffuse textures
|
||||||
std::string UniformName = "DiffuseUVRepeat";
|
std::string UniformName = "DiffuseUVRepeat";
|
||||||
|
|||||||
@@ -25,11 +25,20 @@ void PickingPass::InitializeTextures()
|
|||||||
|
|
||||||
void PickingPass::InitializeFrameBuffers()
|
void PickingPass::InitializeFrameBuffers()
|
||||||
{
|
{
|
||||||
glGenRenderbuffers(1, &m_DepthBuffer);
|
/* glGenRenderbuffers(1, &m_DepthBuffer);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);*/
|
||||||
|
|
||||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new RenderBuffer(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
|
glGenTextures(1, &m_DepthBuffer);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_DepthBuffer);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width), (int)(m_Renderer->GetViewportSize().Height), 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||||
|
|
||||||
|
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
|
||||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0)));
|
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0)));
|
||||||
m_PickingBuffer.Generate();
|
m_PickingBuffer.Generate();
|
||||||
}
|
}
|
||||||
@@ -63,7 +72,9 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
m_PickingProgram->Bind();
|
m_PickingProgram->Bind();
|
||||||
|
|
||||||
if (scene.ClearDepth) {
|
if (scene.ClearDepth) {
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
state->Disable(GL_DEPTH_TEST);
|
||||||
|
state->DepthMask(GL_FALSE);
|
||||||
}
|
}
|
||||||
m_Camera = scene.Camera;
|
m_Camera = scene.Camera;
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,101 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::mat4 modelMatrix;
|
||||||
|
|
||||||
|
// See a sprite is an SpriteIndicator
|
||||||
|
bool isIndicator = false;
|
||||||
|
if (world->HasComponent(entity.ID, "SpriteIndicator"))
|
||||||
|
{
|
||||||
|
auto indicator = entity["SpriteIndicator"];
|
||||||
|
|
||||||
|
float minScale = (float)(double)indicator["MinScale"];
|
||||||
|
bool hasTeam = indicator["VisibleForSingleTeamOnly"];
|
||||||
|
isIndicator = true;
|
||||||
|
glm::vec3 pos = Transform::AbsolutePosition(entity);
|
||||||
|
|
||||||
|
|
||||||
|
EntityWrapper entityTeam;
|
||||||
|
if (hasTeam && (entity.HasComponent("Team") || entity.FirstParentWithComponent("Team").Valid()) && m_LocalPlayer.World != nullptr) {
|
||||||
|
if (!entity.HasComponent("Team")) {
|
||||||
|
entityTeam = entity.FirstParentWithComponent("Team");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
entityTeam = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentWrapper& entityTeamComponent = entityTeam["Team"];
|
||||||
|
ComponentWrapper& localComponent = m_LocalPlayer["Team"];
|
||||||
|
int entityTeamInt = entityTeamComponent["Team"];
|
||||||
|
int localComponentInt = localComponent["Team"];
|
||||||
|
int SpectatorInt = localComponent["Team"].Enum("Spectator");
|
||||||
|
if (entityTeamInt != localComponentInt && localComponentInt != SpectatorInt) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code for check if sprite is inside or outside of screen
|
||||||
|
//glm::vec4 projectedPos = m_Camera->ProjectionMatrix() * m_Camera->ViewMatrix() * glm::vec4(pos, 1.0f);
|
||||||
|
//projectedPos /= projectedPos.w;
|
||||||
|
//// Check if inside of outside of screen.
|
||||||
|
//if (projectedPos.x < -1.0f || projectedPos.x > 1.0f || projectedPos.y < -1.0f || projectedPos.y > 1.0f) {
|
||||||
|
// // is outside of screen
|
||||||
|
//} else {
|
||||||
|
// // is inside of screen
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
glm::vec3 zAxis = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||||
|
glm::vec3 normal = pos - m_Camera->Position();
|
||||||
|
|
||||||
|
//float distance = glm::length(normal);
|
||||||
|
//if (distance < minDistance) {
|
||||||
|
// pos = pos - glm::normalize(normal) * (distance - minDistance);
|
||||||
|
//} else if (distance > maxDistance) {
|
||||||
|
// pos = pos - glm::normalize(normal) * (distance - maxDistance);
|
||||||
|
//}
|
||||||
|
normal.y = 0;
|
||||||
|
normal = glm::normalize(normal);
|
||||||
|
glm::vec3 right = glm::cross(normal, zAxis);
|
||||||
|
glm::vec3 up = glm::cross(right, normal);
|
||||||
|
|
||||||
|
modelMatrix[0][0] = right.x;
|
||||||
|
modelMatrix[0][1] = right.y;
|
||||||
|
modelMatrix[0][2] = right.z;
|
||||||
|
modelMatrix[0][3] = 0.0f;
|
||||||
|
|
||||||
|
modelMatrix[1][0] = zAxis.x;
|
||||||
|
modelMatrix[1][1] = zAxis.y;
|
||||||
|
modelMatrix[1][2] = zAxis.z;
|
||||||
|
modelMatrix[1][3] = 0.0f;
|
||||||
|
|
||||||
|
modelMatrix[2][0] = normal.x;
|
||||||
|
modelMatrix[2][1] = normal.y;
|
||||||
|
modelMatrix[2][2] = normal.z;
|
||||||
|
modelMatrix[2][3] = 0.0f;
|
||||||
|
|
||||||
|
modelMatrix[3][0] = pos.x;
|
||||||
|
modelMatrix[3][1] = pos.y;
|
||||||
|
modelMatrix[3][2] = pos.z;
|
||||||
|
modelMatrix[3][3] = 1.0f;
|
||||||
|
|
||||||
|
glm::mat4 tranformationMatrix = modelMatrix * glm::scale(Transform::AbsoluteScale(entity));
|
||||||
|
glm::vec4 tmp = tranformationMatrix * glm::vec4(glm::vec3(0.5, 0.5, 0), 1.0f);
|
||||||
|
glm::vec2 projectedTopRight = m_Camera->WorldToScreen(glm::vec3(tmp), m_Renderer->GetViewportSize());
|
||||||
|
tmp = tranformationMatrix * glm::vec4(glm::vec3(-0.5, -0.5, 0), 1.0f);
|
||||||
|
glm::vec2 projectedBottomLeft = m_Camera->WorldToScreen(glm::vec3(tmp), m_Renderer->GetViewportSize());
|
||||||
|
|
||||||
|
float diag = glm::length(projectedBottomLeft - projectedTopRight);
|
||||||
|
if (diag < minScale) {
|
||||||
|
tranformationMatrix = tranformationMatrix * glm::scale(glm::vec3(minScale / diag, minScale / diag, minScale / diag));
|
||||||
|
}
|
||||||
|
modelMatrix = tranformationMatrix;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
modelMatrix = Transform::ModelMatrix(entity.ID, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string diffuseResource = cSprite["DiffuseTexture"];
|
std::string diffuseResource = cSprite["DiffuseTexture"];
|
||||||
std::string glowResource = cSprite["GlowMap"];
|
std::string glowResource = cSprite["GlowMap"];
|
||||||
bool depthSorted = cSprite["DepthSort"];
|
bool depthSorted = cSprite["DepthSort"];
|
||||||
@@ -67,11 +162,7 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
fillColor = (glm::vec4)fillComponent["Color"];
|
fillColor = (glm::vec4)fillComponent["Color"];
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, world);
|
std::shared_ptr<SpriteJob> spriteJob = std::shared_ptr<SpriteJob>(new SpriteJob(cSprite, m_Camera, modelMatrix, world, fillColor, fillPercentage, depthSorted, isIndicator));
|
||||||
//modelMatrix *= m_Camera->BillboardMatrix();
|
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<SpriteJob> spriteJob = std::shared_ptr<SpriteJob>(new SpriteJob(cSprite, m_Camera, modelMatrix, world, fillColor, fillPercentage, depthSorted));
|
|
||||||
|
|
||||||
jobs.push_back(spriteJob);
|
jobs.push_back(spriteJob);
|
||||||
}
|
}
|
||||||
@@ -93,7 +184,6 @@ bool RenderSystem::isEntityVisible(EntityWrapper& entity)
|
|||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,15 @@ void Renderer::Update(double dt)
|
|||||||
|
|
||||||
void Renderer::Draw(RenderFrame& frame)
|
void Renderer::Draw(RenderFrame& frame)
|
||||||
{
|
{
|
||||||
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking");
|
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking\0Ambient Occlusion");
|
||||||
|
|
||||||
|
ImGui::SliderFloat("SSAO sample radius", &m_SSAO_Radius, 0.01f, 5.0f);
|
||||||
|
ImGui::SliderFloat("SSAO bias", &m_SSAO_Bias, 0.0f, 0.1f);
|
||||||
|
ImGui::SliderFloat("SSAO contrast", &m_SSAO_Contrast, 0.0f, 10.0f);
|
||||||
|
ImGui::SliderFloat("SSAO IntensityScale", &m_SSAO_IntensityScale, 0.0f, 10.0f);
|
||||||
|
ImGui::SliderInt("SSAO Number of Samples", &m_SSAO_NumOfSamples, 2, 100);
|
||||||
|
ImGui::SliderInt("SSAO Number of Turns", &m_SSAO_NumOfTurns, 0, 50);
|
||||||
|
m_SSAOPass->Setting(m_SSAO_Radius, m_SSAO_Bias, m_SSAO_Contrast, m_SSAO_IntensityScale, m_SSAO_NumOfSamples, m_SSAO_NumOfTurns);
|
||||||
//clear buffer 0
|
//clear buffer 0
|
||||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
@@ -119,15 +127,21 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
m_DrawFinalPass->ClearBuffer();
|
m_DrawFinalPass->ClearBuffer();
|
||||||
m_DrawBloomPass->ClearBuffer();
|
m_DrawBloomPass->ClearBuffer();
|
||||||
PerformanceTimer::StopTimer("Renderer-ClearBuffers");
|
PerformanceTimer::StopTimer("Renderer-ClearBuffers");
|
||||||
|
for (auto scene : frame.RenderScenes) {
|
||||||
|
PerformanceTimer::StartTimer("Renderer-Depth");
|
||||||
|
m_PickingPass->Draw(*scene);
|
||||||
|
GLERROR("Drawing pickingpass");
|
||||||
|
PerformanceTimer::StopTimer("Renderer-Depth");
|
||||||
|
}
|
||||||
|
PerformanceTimer::StartTimer("AO generation");
|
||||||
|
m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera);
|
||||||
|
GLuint ao = m_SSAOPass->SSAOTexture();
|
||||||
|
PerformanceTimer::StopTimer("AO generation");
|
||||||
for (auto scene : frame.RenderScenes){
|
for (auto scene : frame.RenderScenes){
|
||||||
|
|
||||||
PerformanceTimer::StartTimer("Renderer-Depth");
|
PerformanceTimer::StartTimer("Renderer-Drawing PickingPass");
|
||||||
SortRenderJobsByDepth(*scene);
|
SortRenderJobsByDepth(*scene);
|
||||||
GLERROR("SortByDepth");
|
GLERROR("SortByDepth");
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Drawing PickingPass");
|
|
||||||
m_PickingPass->Draw(*scene);
|
|
||||||
GLERROR("Drawing pickingpass");
|
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Generate Frustrums");
|
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Generate Frustrums");
|
||||||
m_LightCullingPass->GenerateNewFrustum(*scene);
|
m_LightCullingPass->GenerateNewFrustum(*scene);
|
||||||
GLERROR("Generate frustums");
|
GLERROR("Generate frustums");
|
||||||
@@ -137,8 +151,8 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Light Culling");
|
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Light Culling");
|
||||||
m_LightCullingPass->CullLights(*scene);
|
m_LightCullingPass->CullLights(*scene);
|
||||||
GLERROR("LightCulling");
|
GLERROR("LightCulling");
|
||||||
|
m_DrawFinalPass->Draw(*scene, ao);
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
|
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
|
||||||
m_DrawFinalPass->Draw(*scene);
|
|
||||||
GLERROR("Draw Geometry+Light");
|
GLERROR("Draw Geometry+Light");
|
||||||
//m_DrawScenePass->Draw(*scene);
|
//m_DrawScenePass->Draw(*scene);
|
||||||
|
|
||||||
@@ -147,14 +161,17 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
GLERROR("Draw Text");
|
GLERROR("Draw Text");
|
||||||
PerformanceTimer::StopTimer("Renderer-Draw Text");
|
PerformanceTimer::StopTimer("Renderer-Draw Text");
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceTimer::StartTimer("Renderer-Draw Bloom");
|
PerformanceTimer::StartTimer("Renderer-Draw Bloom");
|
||||||
m_DrawBloomPass->Draw(m_DrawFinalPass->BloomTexture());
|
m_DrawBloomPass->Draw(m_DrawFinalPass->BloomTexture());
|
||||||
PerformanceTimer::StopTimer("Renderer-Draw Bloom");
|
PerformanceTimer::StopTimer("Renderer-Draw Bloom");
|
||||||
|
|
||||||
if (m_DebugTextureToDraw == 0) {
|
if (m_DebugTextureToDraw == 0) {
|
||||||
PerformanceTimer::StartTimer("Renderer-Color Correction Pass");
|
PerformanceTimer::StartTimer("Renderer-Color Correction Pass");
|
||||||
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), m_DrawFinalPass->SceneTextureLowRes(), m_DrawFinalPass->BloomTextureLowRes(), frame.Gamma, frame.Exposure);
|
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), m_DrawFinalPass->SceneTextureLowRes(), m_DrawFinalPass->BloomTextureLowRes(), frame.Gamma, frame.Exposure);
|
||||||
PerformanceTimer::StopTimer("Renderer-Color Correction Pass");
|
PerformanceTimer::StopTimer("Renderer-Color Correction Pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceTimer::StartTimer("Renderer-Misc Debug Draws");
|
PerformanceTimer::StartTimer("Renderer-Misc Debug Draws");
|
||||||
if (m_DebugTextureToDraw == 1) {
|
if (m_DebugTextureToDraw == 1) {
|
||||||
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->SceneTexture());
|
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->SceneTexture());
|
||||||
@@ -174,7 +191,10 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
if (m_DebugTextureToDraw == 6) {
|
if (m_DebugTextureToDraw == 6) {
|
||||||
m_DrawScreenQuadPass->Draw(m_PickingPass->PickingTexture());
|
m_DrawScreenQuadPass->Draw(m_PickingPass->PickingTexture());
|
||||||
}
|
}
|
||||||
PerformanceTimer::StopTimer("Renderer-Misc Debug Draws");
|
if (m_DebugTextureToDraw == 7) {
|
||||||
|
m_DrawScreenQuadPass->Draw(m_SSAOPass->SSAOTexture());
|
||||||
|
}
|
||||||
|
PerformanceTimer::StopTimer("Renderer-Misc Debug Draws");
|
||||||
|
|
||||||
PerformanceTimer::StartTimer("Renderer-ImGuiRenderPass");
|
PerformanceTimer::StartTimer("Renderer-ImGuiRenderPass");
|
||||||
m_ImGuiRenderPass->Draw();
|
m_ImGuiRenderPass->Draw();
|
||||||
@@ -223,4 +243,5 @@ void Renderer::InitializeRenderPasses()
|
|||||||
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
|
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
|
||||||
m_DrawBloomPass = new DrawBloomPass(this);
|
m_DrawBloomPass = new DrawBloomPass(this);
|
||||||
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
|
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
|
||||||
|
m_SSAOPass = new SSAOPass(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
#include "Rendering/SSAOPass.h"
|
||||||
|
|
||||||
|
SSAOPass::SSAOPass(IRenderer* renderer)
|
||||||
|
{
|
||||||
|
m_Renderer = renderer;
|
||||||
|
|
||||||
|
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
|
||||||
|
|
||||||
|
InitializeBuffer();
|
||||||
|
InitializeShaderProgram();
|
||||||
|
Setting(0.1f, 0.012f, 1.0f, 1.0f, 13, 7);
|
||||||
|
|
||||||
|
m_DrawBloomPass = new DrawBloomPass(renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSAOPass::InitializeShaderProgram()
|
||||||
|
{
|
||||||
|
m_SSAOProgram = ResourceManager::Load<ShaderProgram>("##SSAOProgram");
|
||||||
|
m_SSAOProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SSAO.vert.glsl")));
|
||||||
|
m_SSAOProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SSAO.frag.glsl")));
|
||||||
|
m_SSAOProgram->Compile();
|
||||||
|
m_SSAOProgram->Link();
|
||||||
|
|
||||||
|
m_SSAOViewSpaceZProgram = ResourceManager::Load<ShaderProgram>("##SSAOViewSpaceZProgram");
|
||||||
|
m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SSAO.vert.glsl")));
|
||||||
|
m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SSAOViewSpaceZ.frag.glsl")));
|
||||||
|
m_SSAOViewSpaceZProgram->Compile();
|
||||||
|
m_SSAOViewSpaceZProgram->Link();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SSAOPass::InitializeBuffer()
|
||||||
|
{
|
||||||
|
GenerateTexture(&m_SSAOTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_R8, GL_RED, GL_FLOAT);
|
||||||
|
|
||||||
|
m_SSAOFramBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SSAOTexture, GL_COLOR_ATTACHMENT0)));
|
||||||
|
m_SSAOFramBuffer.Generate();
|
||||||
|
|
||||||
|
GenerateTexture(&m_SSAOViewSpaceZTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_R32F, GL_RED, GL_FLOAT);
|
||||||
|
|
||||||
|
m_SSAOViewSpaceZFramBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SSAOViewSpaceZTexture, GL_COLOR_ATTACHMENT0)));
|
||||||
|
m_SSAOViewSpaceZFramBuffer.Generate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSAOPass::ClearBuffer()
|
||||||
|
{
|
||||||
|
m_SSAOFramBuffer.Bind();
|
||||||
|
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
m_SSAOFramBuffer.Unbind();
|
||||||
|
|
||||||
|
m_SSAOViewSpaceZFramBuffer.Bind();
|
||||||
|
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
m_SSAOViewSpaceZFramBuffer.Unbind();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSAOPass::Setting(float radius, float bias, float contrast, float intensityScale, int numOfSamples, int NumOfTurns) {
|
||||||
|
m_Radius = radius;
|
||||||
|
m_Bias = bias;
|
||||||
|
m_Contrast = contrast;
|
||||||
|
m_IntensityScale = intensityScale;
|
||||||
|
m_NumOfSamples = numOfSamples;
|
||||||
|
m_NumOfTurns = NumOfTurns;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSAOPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
||||||
|
{
|
||||||
|
glGenTextures(1, texture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapping);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);
|
||||||
|
GLERROR("Texture initialization failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSAOPass::Draw(GLuint depthBuffer, Camera* camera)
|
||||||
|
{
|
||||||
|
SSAOPassState state;
|
||||||
|
GLuint viewSpaceZPShaderHandle = m_SSAOViewSpaceZProgram->GetHandle();
|
||||||
|
GLuint SSAOShaderHandle = m_SSAOProgram->GetHandle();
|
||||||
|
|
||||||
|
m_SSAOViewSpaceZFramBuffer.Bind();
|
||||||
|
m_SSAOViewSpaceZProgram->Bind();
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, depthBuffer);
|
||||||
|
glm::vec3 clipInfo = glm::vec3(
|
||||||
|
(camera->NearClip() * camera->FarClip()),
|
||||||
|
(camera->NearClip() - camera->FarClip()),
|
||||||
|
(camera->FarClip())
|
||||||
|
);
|
||||||
|
/*glm::vec3 clipInfo = glm::vec3(
|
||||||
|
(camera->NearClip()),
|
||||||
|
(-1.0f),
|
||||||
|
(+1.0f)
|
||||||
|
);*/
|
||||||
|
glUniform3fv(glGetUniformLocation(viewSpaceZPShaderHandle, "ClipInfo"), 1, glm::value_ptr(clipInfo));
|
||||||
|
|
||||||
|
glBindVertexArray(m_ScreenQuad->VAO);
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||||
|
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex + 1
|
||||||
|
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||||
|
|
||||||
|
glm::vec4 projInfo = glm::vec4(
|
||||||
|
((1.0 - camera->ProjectionMatrix()[0][2]) / camera->ProjectionMatrix()[0][0]),
|
||||||
|
(-2.0 / (m_Renderer->GetViewportSize().Width * camera->ProjectionMatrix()[0][0])),
|
||||||
|
((1.0 + camera->ProjectionMatrix()[1][2]) / camera->ProjectionMatrix()[1][1]),
|
||||||
|
(-2.0 / (m_Renderer->GetViewportSize().Height * camera->ProjectionMatrix()[1][1]))
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
m_SSAOFramBuffer.Bind();
|
||||||
|
m_SSAOProgram->Bind();
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_SSAOViewSpaceZTexture);
|
||||||
|
|
||||||
|
// How many pixel there are in a 1m long object 1m away from the camera
|
||||||
|
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uProjScale"), m_Renderer->GetViewportSize().Height / (-2.0f * glm::tan(camera->FOV() * 0.5f)));
|
||||||
|
|
||||||
|
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uRadius"), m_Radius);
|
||||||
|
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uBias"), m_Bias);
|
||||||
|
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uContrast"), m_Contrast);
|
||||||
|
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uIntensityScale"), m_IntensityScale);
|
||||||
|
glUniform1i(glGetUniformLocation(SSAOShaderHandle, "uNumOfSamples"), m_NumOfSamples);
|
||||||
|
glUniform1i(glGetUniformLocation(SSAOShaderHandle, "uNumOfTurns"), m_NumOfTurns);;
|
||||||
|
|
||||||
|
glUniform4fv(glGetUniformLocation(SSAOShaderHandle, "uProjInfo"), 1, glm::value_ptr(projInfo));
|
||||||
|
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex + 1
|
||||||
|
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||||
|
|
||||||
|
m_DrawBloomPass->ClearBuffer();
|
||||||
|
m_DrawBloomPass->Draw(m_SSAOTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComputeAO(GLuint depthBuffer, Camera* camera) {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include "Rendering/SSAOPassState.h"
|
||||||
|
|
||||||
|
|
||||||
|
SSAOPassState::SSAOPassState()
|
||||||
|
{
|
||||||
|
//BindFramebuffer(0);
|
||||||
|
Disable(GL_BLEND);
|
||||||
|
Disable(GL_DEPTH_TEST);
|
||||||
|
Disable(GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SSAOPassState::~SSAOPassState()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -98,8 +98,7 @@ void ShaderProgram::AddShader(std::shared_ptr<Shader> shader)
|
|||||||
|
|
||||||
void ShaderProgram::Compile()
|
void ShaderProgram::Compile()
|
||||||
{
|
{
|
||||||
if (m_ShaderProgramHandle == 0)
|
if (m_ShaderProgramHandle == 0) {
|
||||||
{
|
|
||||||
m_ShaderProgramHandle = glCreateProgram();
|
m_ShaderProgramHandle = glCreateProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user