Compare commits

...

30 Commits

Author SHA1 Message Date
verysecrethero 01e0e41122 Merge remote-tracking branch 'origin/master' into AndersTest
# Conflicts:
#	include/Engine/Core/MemoryPool.h
#	include/Engine/Network/Packet.h
#	include/Game/Systems/AmmoPickupSystem.h
#	include/Game/Systems/PickupSpawnSystem.h
#	resources/Schema/Entities/NewMap2version2.xml
#	src/Game/Game.cpp
#	src/Game/Systems/AmmoPickupSystem.cpp
#	src/Game/Systems/PickupSpawnSystem.cpp
2016-03-14 10:31:03 +01:00
Jace 18ea938b56 Added start menu shortcut to starting a server 2016-03-14 09:59:54 +01:00
Jace 6c14b2a97e Updated start menu to load same map as game to save video memory 2016-03-14 09:26:16 +01:00
Jace 54eb3727b0 Fixed respawn 2016-03-14 09:26:04 +01:00
Jace 39e5f7b2dc Actually DDS 2016-03-14 09:21:07 +01:00
Jace cce43ebc1a DDS and shit 2016-03-14 09:08:14 +01:00
Jace 2a1f6cd9cf Updated installer 2016-03-14 08:38:08 +01:00
Jace 39da2bff27 README 2016-03-14 08:38:00 +01:00
Teejoon 28de3c716c Hopefully everything is working with dds and PNG textures 2016-03-14 08:16:35 +01:00
Teejoon 003f5b14a5 Merge remote-tracking branch 'origin/master' into DDS
Conflicts:
	assets
2016-03-14 06:10:30 +01:00
Teejoon a3f215831d Fixed DDS after merge 2016-03-14 06:09:06 +01:00
Joachim Pettersson 16ef09b20b Merge pull request #222 from teamfisk/DeathAnimation
Death effect re-added
2016-03-14 05:48:07 +01:00
viktorljung b9b5f4bff7 Removed healing effect of defender boost 2016-03-14 04:37:43 +01:00
viktorljung 5db1bddd08 Merge branch 'master' of github.com:teamfisk/TacticalZ 2016-03-14 04:31:45 +01:00
viktorljung b366a8c149 Red players fixes 2016-03-14 04:31:38 +01:00
Teejoon 659dfed088 Commit reminder 2016-03-14 02:52:33 +01:00
Teejoon 8151e9a9a4 Merge branch 'master' into DDS
Conflicts:
	assets
	include/Engine/Core/ResourceManager.h
	include/Engine/Rendering/Image.h
	include/Engine/Rendering/TextureSprite.h
	resources/Schema/Entities/MovementTest.xml
	resources/Shaders/ForwardPlus.frag.glsl
	resources/Shaders/ForwardPlusShieldCheck.frag.glsl
	src/Engine/Rendering/CubeMapPass.cpp
	src/Engine/Rendering/Texture.cpp
	src/Game/Game.cpp
2016-03-14 02:51:45 +01:00
Teejoon d6f0528a87 2 more shaders with DTX5nm calculations 2016-03-10 20:03:13 +01:00
Teejoon 0382708b85 Fixed so that we could use DTX5nm as normal map 2016-03-10 19:57:01 +01:00
Teejoon d8f9f15d34 Merge branch 'master' into DDS
Conflicts:
	assets
	src/Engine/Rendering/Texture.cpp
	src/Engine/Rendering/Util/CommonFunctions.cpp
	src/Game/Game.cpp
2016-03-10 19:55:25 +01:00
Jace ffa9d7e607 WIP 2016-03-02 18:06:20 +01:00
Jace edf481b4d7 Load the error texture when a texture isn't found instead of just passing null to OpenGL! 2016-03-02 17:42:27 +01:00
verysecrethero 63e8fb4bc8 misc 2016-03-01 16:11:55 +01:00
verysecrethero 842f26d8fc HealthPickupSystem seems to work ok 2016-03-01 14:57:50 +01:00
verysecrethero 1b2055e11a initial fixes 2016-03-01 14:05:17 +01:00
verysecrethero 37996b4e18 Merge remote-tracking branch 'origin/master' into AndersTest 2016-03-01 09:47:24 +01:00
verysecrethero 37918a9c4a Merge remote-tracking branch 'origin/master' into AndersTest 2016-02-26 17:03:10 +01:00
verysecrethero 335fda47d6 DamageIndicatorSystem can no longer crash if the player doesnt have a parent (rare bug) 2016-02-26 17:02:27 +01:00
verysecrethero 764a3f454e Further work on the Pickup fix 2016-02-26 14:08:34 +01:00
verysecrethero fc2d588bf9 Initial SpawnSystem fixes 2016-02-26 11:15:00 +01:00
42 changed files with 57788 additions and 15955 deletions
+1 -1
Submodule assets updated: ed93148764...902cbf2ba6
+71
View File
@@ -0,0 +1,71 @@
#ifndef DDS_h__
#define DDS_h__
#include <cstdint>
#include "../Common.h"
#include "../Core/ResourceManager.h"
#include "Image.h"
// DXT5
class DDS : public Image, public Resource
{
public:
DDS(std::string path);
~DDS();
void FlipY(unsigned char* data, std::size_t rowBytes, std::size_t totalSize, std::size_t numBlocksWide);
private:
static const uint32_t MagicNumber = 0x20534444; // "DDS "
struct Header_t
{
uint32_t Size;
uint32_t Flags;
uint32_t Height;
uint32_t Width;
uint32_t PitchOrLinearSize;
uint32_t Depth;
uint32_t MipMapCount;
uint32_t RESERVED1[11];
struct PixelFormat_t
{
uint32_t Size;
uint32_t Flags;
uint32_t FourCC;
uint32_t RGBBitCount;
uint32_t RBitMask;
uint32_t GBitMask;
uint32_t BBitMask;
uint32_t ABitMask;
} PixelFormat;
uint32_t Caps;
uint32_t Caps2;
uint32_t Caps3;
uint32_t Caps4;
uint32_t RESERVED2;
} m_Header;
struct Block_t
{
struct Alpha_t
{
uint8_t Colors[2];
uint8_t Data[6];
} Alpha;
struct Data_t
{
uint16_t Colors[2];
uint8_t Data[4];
} Data;
};
std::size_t m_NumBlocksWide;
std::size_t m_NumBlocksHigh;
std::size_t m_RowBytes;
void flipBlock(Block_t* block);
};
#endif
+3
View File
@@ -15,7 +15,10 @@ struct Image
unsigned int Width = 0; unsigned int Width = 0;
unsigned int Height = 0; unsigned int Height = 0;
ImageFormat Format = ImageFormat::Unknown; ImageFormat Format = ImageFormat::Unknown;
unsigned int MipMapLevels = 0;
bool Compressed = false;
unsigned char* Data = nullptr; unsigned char* Data = nullptr;
std::size_t ByteSize = 0;
}; };
#endif #endif
+5 -2
View File
@@ -1,9 +1,11 @@
#ifndef Texture_h__ #ifndef Texture_h__
#define Texture_h__ #define Texture_h__
#include <boost/filesystem.hpp>
#include "../OpenGL.h" #include "../OpenGL.h"
#include "BaseTexture.h" #include "BaseTexture.h"
#include "PNG.h" #include "PNG.h"
#include "DDS.h"
class Texture : public BaseTexture class Texture : public BaseTexture
{ {
@@ -18,8 +20,9 @@ public:
void Bind(GLenum textureUnit = GL_TEXTURE0); void Bind(GLenum textureUnit = GL_TEXTURE0);
GLuint m_Texture = 0; GLuint m_Texture = 0;
unsigned char* Data = nullptr;
enum TextureType : GLint { cInvalid = 0, cDDS = 1, cPNG = 2};
TextureType m_Type;
}; };
#endif #endif
-5
View File
@@ -14,11 +14,6 @@ protected:
TextureSprite(std::string path); TextureSprite(std::string path);
public: public:
void Bind(GLenum textureUnit = GL_TEXTURE0);
GLuint m_Texture = 0;
unsigned char* Data = nullptr;
}; };
#endif #endif
+45
View File
@@ -0,0 +1,45 @@
#ifndef HealthPickupSystem_h__
#define HealthPickupSystem_h__
#include "Core/System.h"
#include "Core/Transform.h"
#include "Core/ResourceManager.h"
#include "Core/EntityFileParser.h"
#include "Core/EPickupSpawned.h"
#include "Core/EPlayerHealthPickup.h"
#include "Engine/Collision/ETrigger.h"
#include "Common.h"
#include <tuple>
#include "Core/ConfigFile.h"
class HealthPickupSystem : public ImpureSystem
{
public:
HealthPickupSystem(SystemParams params);
virtual void Update(double dt) override;
private:
EventRelay<HealthPickupSystem, Events::TriggerTouch> m_ETriggerTouch;
bool OnTriggerTouch(Events::TriggerTouch& e);
EventRelay<HealthPickupSystem, Events::TriggerLeave> m_ETriggerLeave;
bool OnTriggerLeave(Events::TriggerLeave& e);
struct NewHealthPickup {
glm::vec3 Pos;
double HealthGain;
double RespawnTimer;
double DecreaseThisRespawnTimer;
EntityID parentID;
};
std::vector<NewHealthPickup> m_ETriggerTouchVector;
struct EntityAtMaxValuePickupStruct {
EntityWrapper player;
NewHealthPickup pickup;
EntityWrapper trigger;
};
std::vector<EntityAtMaxValuePickupStruct> m_PickupAtMaximum;
void DoPickup(EntityWrapper &player, EntityWrapper &trigger);
void DoPickup(EntityWrapper &player, NewHealthPickup &triggerCopy, EntityWrapper &trigger);
};
#endif
+6 -6
View File
@@ -3,11 +3,11 @@ AutoReload=true
[Debug] [Debug]
LogLevel=1 LogLevel=1
LoadMap= LoadMap=Schema/Entities/StartMenu.xml
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation. ; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
; if false -> Use pool allocation. ; if false -> Use pool allocation.
DisableMemoryPool=false DisableMemoryPool=false
RespawnTime = -1.0 RespawnTime=-1.0
EditorEnabled=false EditorEnabled=false
OutOfBodyExperience=false OutOfBodyExperience=false
@@ -22,7 +22,7 @@ Height=720
FOV=45 FOV=45
[Networking] [Networking]
StartNetwork=false StartNetwork=true
IsServer=false IsServer=false
Name=Bob Name=Bob
Address=127.0.0.1 Address=127.0.0.1
@@ -30,7 +30,7 @@ Port=27666
MaxConnections=8 MaxConnections=8
SnapshotInterval=0.05 SnapshotInterval=0.05
SendInputIntervalMs=33 SendInputIntervalMs=33
PingIntervalMs= 1000 PingIntervalMs=1000
TimeoutMs=15000 TimeoutMs=15000
[Multithreading] [Multithreading]
@@ -43,7 +43,7 @@ AnnouncerVolume=1.0
Announcer=female Announcer=female
[SSAO] [SSAO]
Quality=0 Quality=1
[SSAO1] [SSAO1]
Radius=1.0 Radius=1.0
@@ -88,4 +88,4 @@ NumIterations=4
NumIterations=6 NumIterations=6
[MSAA] [MSAA]
Level = 0; Level=2
+1 -1
View File
@@ -1,5 +1,5 @@
[Mouse] [Mouse]
Sensitivity=0.5 Sensitivity=0.05
InvertPitch=false InvertPitch=false
[Keyboard] [Keyboard]
+17
View File
@@ -0,0 +1,17 @@
To start a server
1. Run "Axyz Server" from the start menu or "Server.bat" in the installation directory (C:\Program Files\Axyz)
2. Press F1 to open the editor mode
3. Expand the Entities window if it is minimized, by double-clicking it
4. Mark StartMenu_Origin and hit Delete twice
5. Hit Import and choose CP_Valhalla.xml
6. Press F1 again to leave editor mode for an acceptable framerate
To join a game
1. Run "Axyz" from the start menu or "Axyz.exe" in the installation directory (C:\Program Files\Axyz)
2. Press Play
3. Hit the refresh icon if no server is visible
4. Click the server you want to join
5. Follow on-screen directions
6. Enjoy the game :)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:SceneLight>
<AmbientColor A="1" B="1" G="1" R="1"/>
</c:SceneLight>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitRaptor.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-1.60000002"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+4 -4
View File
@@ -20,8 +20,8 @@
</Team> </Team>
</c:Team> </c:Team>
<c:PlayerSpawn> <c:PlayerSpawn>
<AssaultFile>Schema/Entities/PlayerAssaultBlue.xml</AssaultFile> <AssaultFile>Schema/Entities/PlayerAssaultRed.xml</AssaultFile>
<DefenderFile>Schema/Entities/PlayerDefenderBlue.xml</DefenderFile> <DefenderFile>Schema/Entities/PlayerDefenderRed.xml</DefenderFile>
<SniperFile></SniperFile> <SniperFile></SniperFile>
</c:PlayerSpawn> </c:PlayerSpawn>
<c:Spawner> <c:Spawner>
@@ -115,7 +115,7 @@
<Color A="1" B="1" G="0.254901975" R="0"/> <Color A="1" B="1" G="0.254901975" R="0"/>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="-0.600000024" Y="0" Z="0.549540162"/> <Position X="0.800000012" Y="0" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children/> <Children/>
@@ -128,7 +128,7 @@
<Color A="1" B="1" G="0.254901975" R="0"/> <Color A="1" B="1" G="0.254901975" R="0"/>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="0.800000012" Y="0" Z="0"/> <Position X="-0.600000024" Y="0" Z="0.549540162"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children/> <Children/>
@@ -130,6 +130,66 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="Lights">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Light_front">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Visible>false</Visible>
<Shadow>false</Shadow>
</c:Model>
<c:PointLight>
<Color A="1" B="0.588235319" G="0.588235319" R="1"/>
</c:PointLight>
<c:Transform>
<Position X="-0.000288648967" Y="0.000489665952" Z="0.0824639797"/>
<Scale X="0.0299999993" Y="0.0299999993" Z="0.0299999993"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light_Side">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Color A="1" B="1" G="1" R="0"/>
<Visible>false</Visible>
<Shadow>false</Shadow>
</c:Model>
<c:PointLight>
<Color A="1" B="0.588235319" G="0.588235319" R="1"/>
<Radius>0.40000000596046448</Radius>
</c:PointLight>
<c:Transform>
<Position X="-0.0870000049" Y="0.0210000016" Z="0.186000004"/>
<Scale X="0.0299999993" Y="0.0299999993" Z="0.0299999993"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light_front2">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Visible>false</Visible>
<Shadow>false</Shadow>
</c:Model>
<c:PointLight>
<Color A="1" B="0.588235319" G="0.588235319" R="1"/>
</c:PointLight>
<c:Transform>
<Position X="0.000448234321" Y="-0.000760387513" Z="-0.323961914"/>
<Scale X="0.0299999993" Y="0.0299999993" Z="0.0299999993"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children> </Children>
</Entity> </Entity>
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="MuzzleFlashBlueSidearm" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Lifetime>
<Lifetime>0.080000000000000002</Lifetime>
</c:Lifetime>
<c:Transform/>
</Components>
<Children>
<Entity name="Level1">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Cone1Outside">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/Cone1Outside.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Cone1Inside">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/Cone1Inside.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Level2">
<Components>
<c:Transform>
<Position X="0.000134464673" Y="8.11116188e-05" Z="-0.0197895896"/>
</c:Transform>
</Components>
<Children>
<Entity name="Cone2Inside">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/Cone2Inside.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Cone2Outside">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/Cone2Outside.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Level3">
<Components>
<c:Transform>
<Position X="0.000216802931" Y="0.000130779619" Z="-0.0319075659"/>
</c:Transform>
</Components>
<Children>
<Entity name="PlaneLeft">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/PlaneLeft.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="PlaneRight">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/PlaneRight.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="PlaneUp">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/PlaneUp.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="PlaneDown">
<Components>
<c:Fade>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:Model>
<GlowIntensity>2</GlowIntensity>
<Resource>Models/Effects/MuzzleFlash/Red/PlaneDown.mesh</Resource>
<Shadow>false</Shadow>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Lights">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Light_front">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Visible>false</Visible>
<Shadow>false</Shadow>
</c:Model>
<c:PointLight>
<Color A="1" B="0.588235319" G="0.588235319" R="1"/>
</c:PointLight>
<c:Transform>
<Position X="-0.000288648967" Y="0.000489665952" Z="0.0824639797"/>
<Scale X="0.0299999993" Y="0.0299999993" Z="0.0299999993"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light_Side">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Color A="1" B="1" G="1" R="0"/>
<Visible>false</Visible>
<Shadow>false</Shadow>
</c:Model>
<c:PointLight>
<Color A="1" B="0.588235319" G="0.588235319" R="1"/>
<Radius>0.40000000596046448</Radius>
</c:PointLight>
<c:Transform>
<Position X="-0.0870000049" Y="0.0210000016" Z="0.186000004"/>
<Scale X="0.0299999993" Y="0.0299999993" Z="0.0299999993"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light_front2">
<Components>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Visible>false</Visible>
<Shadow>false</Shadow>
</c:Model>
<c:PointLight>
<Color A="1" B="0.588235319" G="0.588235319" R="1"/>
</c:PointLight>
<c:Transform>
<Position X="0.000448234321" Y="-0.000760387513" Z="-0.323961914"/>
<Scale X="0.0299999993" Y="0.0299999993" Z="0.0299999993"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -435,7 +435,7 @@
<Model>Models/Core/UnitQuad.mesh</Model> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Boosts/Assault-01.png</DiffuseTexture> <DiffuseTexture>Textures/Icons/Boosts/Assault-01.png</DiffuseTexture>
<Color A="0.392156869" B="0.352941185" G="0.196078435" R="0"/> <Color A="0.392156869" B="0.196078435" G="0.196078435" R="0.352941185"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0.0250000004" Y="0.0650000051" Z="0"/> <Position X="0.0250000004" Y="0.0650000051" Z="0"/>
@@ -455,7 +455,7 @@
<Model>Models/Core/UnitQuad.mesh</Model> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Boosts/Defender-01.png</DiffuseTexture> <DiffuseTexture>Textures/Icons/Boosts/Defender-01.png</DiffuseTexture>
<Color A="0.392156869" B="0.352941185" G="0.196078435" R="0"/> <Color A="0.392156869" B="0.196078435" G="0.196078435" R="0.352941185"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0.0240000002" Y="0.104000002" Z="0"/> <Position X="0.0240000002" Y="0.104000002" Z="0"/>
@@ -475,7 +475,7 @@
<Model>Models/Core/UnitQuad.mesh</Model> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Boosts/Sniper-01.png</DiffuseTexture> <DiffuseTexture>Textures/Icons/Boosts/Sniper-01.png</DiffuseTexture>
<Color A="0.392156869" B="0.352941185" G="0.196078435" R="0"/> <Color A="0.392156869" B="0.196078435" G="0.196078435" R="0.352941185"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0.0240000002" Y="0.145000011" Z="0"/> <Position X="0.0240000002" Y="0.145000011" Z="0"/>
@@ -909,10 +909,10 @@
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="DashRight"> <Entity name="DashLeft">
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>DashRightF</AnimationName> <AnimationName>DashLeftF</AnimationName>
<Time>1</Time> <Time>1</Time>
<Speed>1.7999999523162842</Speed> <Speed>1.7999999523162842</Speed>
<Loop>false</Loop> <Loop>false</Loop>
@@ -921,10 +921,10 @@
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="DashLeft"> <Entity name="DashRight">
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>DashLeftF</AnimationName> <AnimationName>DashRightF</AnimationName>
<Time>1</Time> <Time>1</Time>
<Speed>1.7999999523162842</Speed> <Speed>1.7999999523162842</Speed>
<Loop>false</Loop> <Loop>false</Loop>
+37 -37
View File
@@ -472,7 +472,7 @@
<Model>Models/Core/UnitQuad.mesh</Model> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Boosts/Assault-01.png</DiffuseTexture> <DiffuseTexture>Textures/Icons/Boosts/Assault-01.png</DiffuseTexture>
<Color A="0.392156869" B="0.352941185" G="0.196078435" R="0"/> <Color A="0.392156869" B="0.196078435" G="0.196078435" R="0.352941185"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0.0250000004" Y="0.0650000051" Z="0"/> <Position X="0.0250000004" Y="0.0650000051" Z="0"/>
@@ -492,7 +492,7 @@
<Model>Models/Core/UnitQuad.mesh</Model> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Boosts/Defender-01.png</DiffuseTexture> <DiffuseTexture>Textures/Icons/Boosts/Defender-01.png</DiffuseTexture>
<Color A="0.392156869" B="0.352941185" G="0.196078435" R="0"/> <Color A="0.392156869" B="0.196078435" G="0.196078435" R="0.352941185"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0.0240000002" Y="0.104000002" Z="0"/> <Position X="0.0240000002" Y="0.104000002" Z="0"/>
@@ -512,7 +512,7 @@
<Model>Models/Core/UnitQuad.mesh</Model> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Boosts/Sniper-01.png</DiffuseTexture> <DiffuseTexture>Textures/Icons/Boosts/Sniper-01.png</DiffuseTexture>
<Color A="0.392156869" B="0.352941185" G="0.196078435" R="0"/> <Color A="0.392156869" B="0.196078435" G="0.196078435" R="0.352941185"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0.0240000002" Y="0.145000011" Z="0"/> <Position X="0.0240000002" Y="0.145000011" Z="0"/>
@@ -890,40 +890,6 @@
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="ActionBlend">
<Components>
<c:Blend>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ShootgunReloadU</AnimationName>
<Time>0.14583822250136791</Time>
<Speed>0.5</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>ShootRifleU</AnimationName>
<Time>1</Time>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ShieldBlend"> <Entity name="ShieldBlend">
<Components> <Components>
<c:Blend> <c:Blend>
@@ -959,6 +925,40 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="ActionBlend">
<Components>
<c:Blend>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ShootgunReloadU</AnimationName>
<Time>0.14583822250136791</Time>
<Speed>0.5</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>ShootRifleU</AnimationName>
<Time>1</Time>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="IdleDefender"> <Entity name="IdleDefender">
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SidearmWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Weapons/Red/SecondaryWeaponRed.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="-0.0169804785" Y="-0.0188358482" Z="-0.222064406"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RaySideArmRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.125075191" Z="-0.206788138"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/MuzzleFlashSideArmRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0240342002" Y="0.116005458" Z="-0.0419839472"/>
<Scale X="0.5" Y="0.5" Z="0.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -50,21 +50,26 @@ Source: "..\..\bin\Schema\*"; DestDir: "{app}\Schema\"; Flags: ignoreversion cre
Source: "..\..\bin\Shaders\*"; DestDir: "{app}\Shaders\"; Flags: ignoreversion createallsubdirs recursesubdirs Source: "..\..\bin\Shaders\*"; DestDir: "{app}\Shaders\"; Flags: ignoreversion createallsubdirs recursesubdirs
Source: "..\..\bin\Textures\*"; DestDir: "{app}\Textures\"; Flags: ignoreversion createallsubdirs recursesubdirs Source: "..\..\bin\Textures\*"; DestDir: "{app}\Textures\"; Flags: ignoreversion createallsubdirs recursesubdirs
Source: "..\..\bin\assimp.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\assimp.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\DefaultConfig.ini"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\resources\DefaultConfig.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\DefaultInput.ini"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\resources\DefaultInput.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\glew32.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\glew32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\glfw3.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\glfw3.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\OpenAL32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\imgui.ini"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\imgui.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\Input.ini"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\Input.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\libpng16.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\libpng16.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\Axyz.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\Axyz.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\Server.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\xerces-c_3_1.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\xerces-c_3_1.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\zlib.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\bin\zlib.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\resources\README.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\deps\redist\VC_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall Source: "..\..\deps\redist\VC_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
[Icons] [Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{commonprograms}\{#MyAppName} Server"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--server"
Name: "{commondesktop}\{#MyAppName} Server"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--server"; Tasks: desktopicon
[INI] [INI]
Filename: "{app}\Config.ini"; Section: "Networking"; Key: "Name"; String: "{%USERNAME}"; Flags: createkeyifdoesntexist Filename: "{app}\Config.ini"; Section: "Networking"; Key: "Name"; String: "{%USERNAME}"; Flags: createkeyifdoesntexist
+5 -8
View File
@@ -1,7 +1,10 @@
#version 430 #version 430
#include "Shaders/Util/CommonNormalFunc.glsl"
#define MIN_AMBIENT_LIGHT 0.3 #define MIN_AMBIENT_LIGHT 0.3
#define MAX_SPLITS 4 #define MAX_SPLITS 4
uniform mat4 M; uniform mat4 M;
uniform mat4 V; uniform mat4 V;
uniform mat4 P; uniform mat4 P;
@@ -16,6 +19,7 @@ uniform vec3 CameraPosition;
uniform int SSAOQuality; uniform int SSAOQuality;
uniform float FarDistance[MAX_SPLITS]; uniform float FarDistance[MAX_SPLITS];
uniform int NormalTextureType;
uniform vec2 DiffuseUVRepeat; uniform vec2 DiffuseUVRepeat;
uniform vec2 NormalUVRepeat; uniform vec2 NormalUVRepeat;
uniform vec2 SpecularUVRepeat; uniform vec2 SpecularUVRepeat;
@@ -139,13 +143,6 @@ LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensi
return result; return result;
} }
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
{
mat3 TBN = mat3(tangent, bitangent, normal);
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
return vec4(TBN * normalize(NormalMap), 0.0);
}
// Returns a "random" value. // Returns a "random" value.
float Random(vec3 seed, int i) float Random(vec3 seed, int i)
{ {
@@ -301,7 +298,7 @@ void main()
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);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture); vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture, NormalTextureType);
normal = normalize(normal); normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0)); //vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-Input.ViewSpacePosition); vec4 viewVec = normalize(-Input.ViewSpacePosition);
@@ -1,5 +1,7 @@
#version 430 #version 430
#include "Shaders/Util/CommonNormalFunc.glsl"
#define MIN_AMBIENT_LIGHT 0.3 #define MIN_AMBIENT_LIGHT 0.3
#define MAX_SPLITS 4 #define MAX_SPLITS 4
@@ -17,6 +19,7 @@ uniform float GlowIntensity;
uniform vec3 CameraPosition; uniform vec3 CameraPosition;
uniform int SSAOQuality; uniform int SSAOQuality;
uniform int NormalTextureType;
uniform vec2 DiffuseUVRepeat; uniform vec2 DiffuseUVRepeat;
uniform vec2 NormalUVRepeat; uniform vec2 NormalUVRepeat;
uniform vec2 SpecularUVRepeat; uniform vec2 SpecularUVRepeat;
@@ -122,13 +125,6 @@ LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensi
return result; return result;
} }
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
{
mat3 TBN = mat3(tangent, bitangent, normal);
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
return vec4(TBN * normalize(NormalMap), 0.0);
}
void main() void main()
{ {
float shieldDepthValue = texelFetch(ShieldBuffer, ivec2(gl_FragCoord.xy), 0).r; float shieldDepthValue = texelFetch(ShieldBuffer, ivec2(gl_FragCoord.xy), 0).r;
@@ -142,7 +138,7 @@ void main()
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);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture); vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture, NormalTextureType);
normal = normalize(normal); normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0)); //vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-Input.ViewSpacePosition); vec4 viewVec = normalize(-Input.ViewSpacePosition);
@@ -1,5 +1,7 @@
#version 430 #version 430
#include "Shaders/Util/CommonNormalFunc.glsl"
#define MIN_AMBIENT_LIGHT 0.3 #define MIN_AMBIENT_LIGHT 0.3
#define MAX_SPLITS 4 #define MAX_SPLITS 4
uniform mat4 M; uniform mat4 M;
@@ -18,6 +20,10 @@ layout (binding = 0) uniform sampler2D AOTexture;
layout (binding = 30) uniform sampler2DArrayShadow DepthMap; layout (binding = 30) uniform sampler2DArrayShadow DepthMap;
//Get bineded at the same time as the textures //Get bineded at the same time as the textures
uniform int NormalTextureType1;
uniform int NormalTextureType2;
uniform int NormalTextureType3;
uniform vec2 DiffuseUVRepeat1; uniform vec2 DiffuseUVRepeat1;
uniform vec2 DiffuseUVRepeat2; uniform vec2 DiffuseUVRepeat2;
uniform vec2 DiffuseUVRepeat3; uniform vec2 DiffuseUVRepeat3;
@@ -181,11 +187,12 @@ vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
} }
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){ vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues,
int R_TextureType, int G_TextureType, int B_TextureType) {
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal); mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0); vec3 R_Channel = NormalMapValue(Input.TextureCoordinate * R_TileValues, R, R_TextureType);
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0); vec3 G_Channel = NormalMapValue(Input.TextureCoordinate * G_TileValues, G, G_TextureType);
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0); vec3 B_Channel = NormalMapValue(Input.TextureCoordinate * B_TileValues, B, B_TextureType);
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a; float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
float totalDiv = 1 / total; float totalDiv = 1 / total;
@@ -363,7 +370,8 @@ void main()
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3); SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture); //vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3, vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3); NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3,
NormalTextureType1, NormalTextureType2, NormalTextureType3);
normal = normalize(normal); normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0)); //vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-Input.ViewSpacePosition); vec4 viewVec = normalize(-Input.ViewSpacePosition);
@@ -1,5 +1,7 @@
#version 430 #version 430
#include "Shaders/Util/CommonNormalFunc.glsl"
#define MIN_AMBIENT_LIGHT 0.3 #define MIN_AMBIENT_LIGHT 0.3
#define MAX_SPLITS 4 #define MAX_SPLITS 4
uniform mat4 M; uniform mat4 M;
@@ -14,6 +16,10 @@ uniform vec4 AmbientColor;
uniform int SSAOQuality; uniform int SSAOQuality;
//Get bineded at the same time as the textures //Get bineded at the same time as the textures
uniform int NormalTextureType1;
uniform int NormalTextureType2;
uniform int NormalTextureType3;
uniform vec2 DiffuseUVRepeat1; uniform vec2 DiffuseUVRepeat1;
uniform vec2 DiffuseUVRepeat2; uniform vec2 DiffuseUVRepeat2;
uniform vec2 DiffuseUVRepeat3; uniform vec2 DiffuseUVRepeat3;
@@ -160,11 +166,12 @@ vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
} }
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){ vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues,
int R_TextureType, int G_TextureType, int B_TextureType) {
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal); mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0); vec3 R_Channel = NormalMapValue(Input.TextureCoordinate * R_TileValues, R, R_TextureType);
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0); vec3 G_Channel = NormalMapValue(Input.TextureCoordinate * G_TileValues, G, G_TextureType);
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0); vec3 B_Channel = NormalMapValue(Input.TextureCoordinate * B_TileValues, B, B_TextureType);
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a; float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
float totalDiv = 1 / total; float totalDiv = 1 / total;
@@ -194,7 +201,8 @@ void main()
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3); SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture); //vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3, vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3); NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3,
NormalTextureType1, NormalTextureType2, NormalTextureType3);
normal = normalize(normal); normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0)); //vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-Input.ViewSpacePosition); vec4 viewVec = normalize(-Input.ViewSpacePosition);
Binary file not shown.
+1 -1
View File
@@ -225,7 +225,7 @@ void Client::parsePing()
m_IsConnected = true; m_IsConnected = true;
// Time since last ping was received // Time since last ping was received
m_DurationOfPingTime = 1000 * (std::clock() - m_StartPingTime) / static_cast<double>(CLOCKS_PER_SEC); m_DurationOfPingTime = 1000 * (std::clock() - m_StartPingTime) / static_cast<double>(CLOCKS_PER_SEC);
LOG_INFO("%i: response time with ctime(ms): %f", m_PacketID, m_DurationOfPingTime); //LOG_INFO("%i: response time with ctime(ms): %f", m_PacketID, m_DurationOfPingTime);
m_StartPingTime = std::clock(); m_StartPingTime = std::clock();
Packet packet(MessageType::Ping, m_SendPacketID); Packet packet(MessageType::Ping, m_SendPacketID);
+1 -1
View File
@@ -747,7 +747,7 @@ void Server::resetMap()
reliableBroadcast(removeMap); reliableBroadcast(removeMap);
removeWorld(); removeWorld();
// Hardcoded for now. // Hardcoded for now.
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/CP_Rocky2.xml"); auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/CP_Valhalla.xml");
entityFile->MergeInto(m_World); entityFile->MergeInto(m_World);
Packet newWorld(MessageType::Snapshot); Packet newWorld(MessageType::Snapshot);
createWorldSnapshot(newWorld); createWorldSnapshot(newWorld);
+12 -5
View File
@@ -11,7 +11,7 @@ void CubeMapPass::LoadTextures(std::string cubemapName)
if (m_PreviusCubeMapTexture != cubemapName) { if (m_PreviusCubeMapTexture != cubemapName) {
m_CubeMapTextures.clear(); m_CubeMapTextures.clear();
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
std::string path = "Textures/Test/CubeMap/" + cubemapName + "/CubeMapTest0" + std::to_string(i) + ".png"; std::string path = "Textures/Test/CubeMap/" + cubemapName + "/CubeMapTest0" + std::to_string(i) + ".dds";
m_CubeMapTextures.push_back(path); m_CubeMapTextures.push_back(path);
} }
GenerateCubeMapTexture(); GenerateCubeMapTexture();
@@ -21,15 +21,22 @@ void CubeMapPass::LoadTextures(std::string cubemapName)
void CubeMapPass::GenerateCubeMapTexture() void CubeMapPass::GenerateCubeMapTexture()
{ {
if (m_CubeMapTexture == -1) { if (m_CubeMapTexture == 0) {
glGenTextures(1, &m_CubeMapTexture); glGenTextures(1, &m_CubeMapTexture);
} }
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapTexture); glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapTexture);
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
PNG* img = ResourceManager::Load<PNG>(m_CubeMapTextures[i]); DDS* img = ResourceManager::Load<DDS>(m_CubeMapTextures[i]);
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, img->Width, img->Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img->Data); std::size_t bpe = 16;
ResourceManager::Release("PNG", m_CubeMapTextures[i]); std::size_t numBlocksWide = std::max<std::size_t>(1, (img->Width + 3) / 4);
std::size_t numBlocksHigh = std::max<std::size_t>(1, (img->Height + 3) / 4);
std::size_t rowBytes = numBlocksWide * bpe;
std::size_t numRows = numBlocksHigh;
std::size_t numBytes = rowBytes * numBlocksHigh;
glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, img->Width, img->Height, 0, numBytes, img->Data);
//glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, img->Width, img->Height, 0, GL_COMPRESSED_RGBA, GL_UNSIGNED_BYTE, img->Data);
ResourceManager::Release("DDS", m_CubeMapTextures[i]);
} }
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+121
View File
@@ -0,0 +1,121 @@
#include "Rendering/DDS.h"
DDS::DDS(std::string path)
{
std::ifstream in(path.c_str(), std::ios_base::binary | std::ios_base::ate);
if (!in.is_open()) {
throw Resource::FailedLoadingException("Failed to open file.");
}
unsigned int fileSize = static_cast<unsigned int>(in.tellg());
in.seekg(0, std::ios_base::beg);
if (fileSize < sizeof(MagicNumber) + sizeof(DDS::Header_t)) {
throw Resource::FailedLoadingException("Invalid DDS file; not even big enough to contain the DDS header!");
}
// Read magic number
uint32_t magicNumber;
in.read(reinterpret_cast<char*>(&magicNumber), sizeof(MagicNumber));
if (magicNumber != DDS::MagicNumber) {
throw Resource::FailedLoadingException("Invalid DDS file; magic number doesn't match.");
}
// Read header
in.read(reinterpret_cast<char*>(&m_Header), sizeof(DDS::Header_t));
// Validate header
if (m_Header.Size != sizeof(DDS::Header_t) || m_Header.PixelFormat.Size != sizeof(DDS::Header_t::PixelFormat_t)) {
throw Resource::FailedLoadingException("Corrupt DDS file; header size doesn't match!");
}
// Make sure it's DC3 (DXT5)
char format[5];
memcpy(&format, &m_Header.PixelFormat.FourCC, 4);
format[4] = '\0';
if (strcmp(format, "DXT5")) {
std::stringstream ss;
ss << "Invalid DDS file; Unsupported compression format \"" << format << "\"";
throw Resource::FailedLoadingException(ss.str().c_str());
}
this->Width = m_Header.Width;
this->Height = m_Header.Height;
this->Format = Image::ImageFormat::RGBA;
this->Compressed = true;
if (m_Header.MipMapCount != 0) {
this->MipMapLevels = m_Header.MipMapCount - 1;
}
// Read data
std::size_t dataSize = fileSize - sizeof(MagicNumber) - sizeof(DDS::Header_t);
this->Data = new unsigned char[dataSize];
this->ByteSize = dataSize;
in.read(reinterpret_cast<char*>(this->Data), dataSize);
// Flip!
unsigned int w = this->Width;
unsigned int h = this->Height;
unsigned char* mipMapData = this->Data;
for (unsigned int i = 0; i < this->MipMapLevels; ++i) {
std::size_t bpe = 16;
std::size_t numBlocksWide = std::max<std::size_t>(1, (w + 3) / 4);
std::size_t numBlocksHigh = std::max<std::size_t>(1, (h + 3) / 4);
std::size_t rowBytes = numBlocksWide * bpe;
std::size_t numRows = numBlocksHigh;
std::size_t numBytes = rowBytes * numBlocksHigh;
FlipY(mipMapData, rowBytes, numBytes, numBlocksWide);
w = w >> 1;
h = h >> 1;
mipMapData += numBytes;
}
}
DDS::~DDS()
{
if (this->Data != nullptr) {
delete[] this->Data;
this->Data = nullptr;
}
}
void DDS::FlipY(unsigned char* data, std::size_t rowBytes, std::size_t totalSize, std::size_t numBlocksWide)
{
std::size_t height = totalSize / rowBytes;
unsigned char* topLine = data;
unsigned char* bottomLine = data + (height - 1) * rowBytes;
for (std::size_t line = 0; line < height / 2; ++line) {
Block_t* topBlocks = reinterpret_cast<Block_t*>(topLine);
Block_t* bottomBlocks = reinterpret_cast<Block_t*>(bottomLine);
for (std::size_t block = 0; block < numBlocksWide; ++block) {
flipBlock(&topBlocks[block]);
flipBlock(&bottomBlocks[block]);
std::swap(topBlocks[block], bottomBlocks[block]);
}
topLine += rowBytes;
bottomLine -= rowBytes;
}
}
void DDS::flipBlock(Block_t* block)
{
// Extract both rows of pixel Data into a 32 bit sized values.
uint32_t pixelRow0 = block->Alpha.Data[0] + ((block->Alpha.Data[1] + (block->Alpha.Data[2] << 8)) << 8);
uint32_t pixelRow1 = block->Alpha.Data[3] + ((block->Alpha.Data[4] + (block->Alpha.Data[5] << 8)) << 8);
// Swap the extracted row Data. These values will be read from and shifted into the final block locations.
uint32_t pixelRow0Swapped = ((pixelRow0 & 0x000fff) << 12) | ((pixelRow0 & 0xfff000) >> 12);
uint32_t pixelRow1Swapped = ((pixelRow1 & 0x000fff) << 12) | ((pixelRow1 & 0xfff000) >> 12);
// Swapped Data from row 1 is written
block->Alpha.Data[0] = static_cast<uint8_t>(pixelRow1Swapped & 0x0000ff);
block->Alpha.Data[1] = static_cast<uint8_t>((pixelRow1Swapped & 0x00ff00) >> 8);
block->Alpha.Data[2] = static_cast<uint8_t>((pixelRow1Swapped & 0xff0000) >> 16);
// Swapped Data from row 0 is written
block->Alpha.Data[3] = static_cast<uint8_t>(pixelRow0Swapped & 0x0000ff);
block->Alpha.Data[4] = static_cast<uint8_t>((pixelRow0Swapped & 0x00ff00) >> 8);
block->Alpha.Data[5] = static_cast<uint8_t>((pixelRow0Swapped & 0xff0000) >> 16);
std::swap(block->Data.Data[0], block->Data.Data[3]);
std::swap(block->Data.Data[1], block->Data.Data[2]);
}
+22 -13
View File
@@ -1523,10 +1523,12 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
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));
glUniform1i(glGetUniformLocation(shaderHandle, "NormalTextureType"), job->NormalTexture[0]->Texture->m_Type);
} }
else { else {
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
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)));
glUniform1i(glGetUniformLocation(shaderHandle, "NormalTextureType"), m_NeutralNormalTexture->m_Type);
} }
glActiveTexture(GL_TEXTURE3); glActiveTexture(GL_TEXTURE3);
@@ -1579,10 +1581,12 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) { if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture); glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->NormalTexture[i]->UVRepeat)); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->NormalTexture[i]->UVRepeat));
glUniform1i(glGetUniformLocation(shaderHandle, "NormalTextureType"), job->NormalTexture[0]->Texture->m_Type);
} }
else { else {
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f))); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
glUniform1i(glGetUniformLocation(shaderHandle, "NormalTextureType"), m_NeutralNormalTexture->m_Type);
} }
texturePosition++; texturePosition++;
} }
@@ -1641,10 +1645,12 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
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));
glUniform1i(glGetUniformLocation(shaderHandle, "NormalTextureType"), job->NormalTexture[0]->Texture->m_Type);
} }
else { else {
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
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)));
glUniform1i(glGetUniformLocation(shaderHandle, "NormalTextureType"), m_NeutralNormalTexture->m_Type);
} }
glActiveTexture(GL_TEXTURE3); glActiveTexture(GL_TEXTURE3);
@@ -1676,57 +1682,60 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
int texturePosition = GL_TEXTURE2; int texturePosition = GL_TEXTURE2;
//Bind 5 diffuse textures //Bind 5 diffuse textures
std::string UniformName = "DiffuseUVRepeat"; std::string UVRepeatName = "DiffuseUVRepeat";
for (unsigned int i = 0; i < 3; i++) { for (unsigned int i = 0; i < 3; i++) {
glActiveTexture(texturePosition); glActiveTexture(texturePosition);
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) { if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture); glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->DiffuseTexture[i]->UVRepeat)); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->DiffuseTexture[i]->UVRepeat));
} else { } else {
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f))); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
} }
texturePosition++; texturePosition++;
} }
//Bind 5 Normal textures //Bind 5 Normal textures
UniformName = "NormalUVRepeat"; std::string textureType = "NormalTextureType";
UVRepeatName = "NormalUVRepeat";
for (unsigned int i = 0; i < 3; i++) { for (unsigned int i = 0; i < 3; i++) {
glActiveTexture(texturePosition); glActiveTexture(texturePosition);
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) { if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture); glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->NormalTexture[i]->UVRepeat)); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->NormalTexture[i]->UVRepeat));
glUniform1i(glGetUniformLocation(shaderHandle, std::string(textureType + ((char)(i + '1'))).c_str()), job->NormalTexture[i]->Texture->m_Type);
} else { } else {
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f))); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
glUniform1i(glGetUniformLocation(shaderHandle, std::string(textureType + ((char)(i + '1'))).c_str()), m_NeutralNormalTexture->m_Type);
} }
texturePosition++; texturePosition++;
} }
//Bind 5 Specular textures //Bind 5 Specular textures
UniformName = "SpecularUVRepeat"; UVRepeatName = "SpecularUVRepeat";
for (unsigned int i = 0; i < 3; i++) { for (unsigned int i = 0; i < 3; i++) {
glActiveTexture(texturePosition); glActiveTexture(texturePosition);
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) { if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture); glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->SpecularTexture[i]->UVRepeat)); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->SpecularTexture[i]->UVRepeat));
} else { } else {
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f))); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
} }
texturePosition++; texturePosition++;
} }
//Bind 5 Incandescence textures //Bind 5 Incandescence textures
UniformName = "GlowUVRepeat"; UVRepeatName = "GlowUVRepeat";
for (unsigned int i = 0; i < 3; i++) { for (unsigned int i = 0; i < 3; i++) {
glActiveTexture(texturePosition); glActiveTexture(texturePosition);
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) { if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture); glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->IncandescenceTexture[i]->UVRepeat)); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->IncandescenceTexture[i]->UVRepeat));
} else { } else {
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f))); glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UVRepeatName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
} }
texturePosition++; texturePosition++;
} }
+2 -2
View File
@@ -96,10 +96,10 @@ PNG::~PNG()
void PNG::pngErrorFunction(png_structp png_ptr, png_const_charp error_msg) void PNG::pngErrorFunction(png_structp png_ptr, png_const_charp error_msg)
{ {
LOG_WARNING("%s", error_msg); LOG_WARNING("libpng error: %s", error_msg);
} }
void PNG::pngWarningFunction(png_structp png_ptr, png_const_charp warning_msg) void PNG::pngWarningFunction(png_structp png_ptr, png_const_charp warning_msg)
{ {
LOG_WARNING("%s", warning_msg); LOG_WARNING("libpng warning: %s", warning_msg);
} }
+1 -1
View File
@@ -287,7 +287,7 @@ void RawModelCustom::ReadMaterialTextureProperties(RawModelCustom::TextureProper
} }
texture.TexturePath = "Textures/"; texture.TexturePath = "Textures/";
texture.TexturePath += (fileData + offset); texture.TexturePath += (fileData + offset);
texture.TexturePath += ".png"; texture.TexturePath += ".dds";
offset += nameLength; offset += nameLength;
if (offset + sizeof(glm::vec2) > fileByteSize) { if (offset + sizeof(glm::vec2) > fileByteSize) {
throw Resource::FailedLoadingException("Reading Material texture UVTiling failed"); throw Resource::FailedLoadingException("Reading Material texture UVTiling failed");
+58 -9
View File
@@ -2,11 +2,21 @@
Texture::Texture(std::string path) Texture::Texture(std::string path)
{ {
PNG* img = ResourceManager::Load<PNG, true>(path); //TODO: Make this threaded. Catch exeptions in all other load places. std::string ext = boost::filesystem::path(path).extension().string();
Image* img;
if (ext == ".png") {
img = ResourceManager::Load<PNG, true>(path);
m_Type = TextureType::cPNG;
} else if (ext == ".dds") {
img = ResourceManager::Load<DDS, true>(path);
m_Type = TextureType::cDDS;
} else {
m_Type = TextureType::cInvalid;
throw Resource::FailedLoadingException("Texture extension is not .png nor .dds");
}
this->Width = img->Width; this->Width = img->Width;
this->Height = img->Height; this->Height = img->Height;
this->Data = img->Data;
GLint format; GLint format;
switch (img->Format) { switch (img->Format) {
@@ -17,20 +27,59 @@ Texture::Texture(std::string path)
format = GL_RGBA; format = GL_RGBA;
break; break;
} }
//Master hade PNG release here...
// Construct the OpenGL texture // Construct the OpenGL texture
glGenTextures(1, &m_Texture); glGenTextures(1, &m_Texture);
glBindTexture(GL_TEXTURE_2D, m_Texture); glBindTexture(GL_TEXTURE_2D, m_Texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, format, img->Width, img->Height, 0, format, GL_UNSIGNED_BYTE, img->Data);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
GLERROR("Texture load"); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
if (!img->Compressed) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
unsigned int w = img->Width;
unsigned int h = img->Width;
unsigned char* data = img->Data;
for (int mipLevel = 0; mipLevel < 1 + img->MipMapLevels; mipLevel++) {
if (img->Compressed) {
//LOG_DEBUG("mipLevel: %i", mipLevel);
//LOG_DEBUG("w: %i", w);
//LOG_DEBUG("h: %i", h);
ResourceManager::Release("PNG", path); std::size_t bpe = 16;
std::size_t numBlocksWide = std::max<std::size_t>(1, (w + 3) / 4);
std::size_t numBlocksHigh = std::max<std::size_t>(1, (h + 3) / 4);
std::size_t rowBytes = numBlocksWide * bpe;
std::size_t numRows = numBlocksHigh;
std::size_t numBytes = rowBytes * numBlocksHigh;
//LOG_DEBUG("numBytes: %i", numBytes);
glCompressedTexImage2D(GL_TEXTURE_2D, mipLevel, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, w, h, 0, numBytes, data);
data += numBytes;
} else {
glTexImage2D(GL_TEXTURE_2D, mipLevel, format, img->Width, img->Height, 0, format, GL_UNSIGNED_BYTE, img->Data);
}
w = w >> 1;
h = h >> 1;
}
//LOG_DEBUG("REMAINDER: %i", img->ByteSize - (data - img->Data));
// Generate mipmaps if the image file doesn't contain them
if (img->MipMapLevels == 0) {
glGenerateMipmap(GL_TEXTURE_2D);
}
if (ext == ".png") {
ResourceManager::Release("PNG", path);
} else if (ext == ".dds") {
ResourceManager::Release("DDS", path);
}
if (GLERROR("Texture load")) {
throw Resource::FailedLoadingException("GL texture generation failed");
}
} }
Texture::~Texture() Texture::~Texture()
+2 -1
View File
@@ -54,8 +54,9 @@ Game::Game(int argc, char* argv[])
ResourceManager::RegisterType<Model>("Model"); ResourceManager::RegisterType<Model>("Model");
ResourceManager::RegisterType<RawModel>("RawModel"); ResourceManager::RegisterType<RawModel>("RawModel");
ResourceManager::RegisterType<Texture>("Texture"); ResourceManager::RegisterType<Texture>("Texture");
ResourceManager::RegisterType<TextureSprite>("TextureSprite");
ResourceManager::RegisterType<PNG>("PNG"); ResourceManager::RegisterType<PNG>("PNG");
ResourceManager::RegisterType<TextureSprite>("TextureSprite");
ResourceManager::RegisterType<DDS>("DDS");
ResourceManager::RegisterType<ShaderProgram>("ShaderProgram"); ResourceManager::RegisterType<ShaderProgram>("ShaderProgram");
ResourceManager::RegisterType<EntityFile>("EntityFile"); ResourceManager::RegisterType<EntityFile>("EntityFile");
ResourceManager::RegisterType<EntityXMLFile>("EntityXMLFile"); ResourceManager::RegisterType<EntityXMLFile>("EntityXMLFile");
+138
View File
@@ -0,0 +1,138 @@
#include "Systems/HealthPickupSystem.h"
HealthPickupSystem::HealthPickupSystem(SystemParams params)
: System(params)
{
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &HealthPickupSystem::OnTriggerTouch);
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &HealthPickupSystem::OnTriggerLeave);
}
void HealthPickupSystem::Update(double dt)
{
for (auto it = m_ETriggerTouchVector.begin(); it != m_ETriggerTouchVector.end(); ++it)
{
auto& somePickup = *it;
//set the double timer value (value 3)
somePickup.DecreaseThisRespawnTimer -= dt;
if (somePickup.DecreaseThisRespawnTimer < 0.0) {
LOG_INFO("loading healthpickup xml");
//spawn and delete the vector item
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/HealthPickup.xml");
EntityFileParser parser(entityFile);
EntityID healthPickupID = parser.MergeEntities(m_World);
LOG_INFO("finished loading healthpickup xml");
//let the world know a pickup has spawned (graphics effects, etc)
Events::PickupSpawned ePickupSpawned;
ePickupSpawned.Pickup = EntityWrapper(m_World, healthPickupID);
m_EventBroker->Publish(ePickupSpawned);
LOG_INFO("event published");
//set values from the old entity to the new entity
auto& newHealthPickupEntity = EntityWrapper(m_World, healthPickupID);
LOG_INFO("healthpickup id %i", healthPickupID);
newHealthPickupEntity["Transform"]["Position"] = somePickup.Pos;
newHealthPickupEntity["HealthPickup"]["HealthGain"] = somePickup.HealthGain;
newHealthPickupEntity["HealthPickup"]["RespawnTimer"] = somePickup.RespawnTimer;
m_World->SetParent(newHealthPickupEntity.ID, somePickup.parentID);
LOG_INFO("healthpickup parented to %i", somePickup.parentID);
//erase the current element (somePickup)
m_ETriggerTouchVector.erase(it);
break;
}
}
//still touching AmmoPickupAtMaxHealthAmmo?
for (auto& it = m_PickupAtMaximum.begin(); it != m_PickupAtMaximum.end(); ++it) {
if (!it->player.Valid()) {
LOG_INFO("player no longer valid, erasing maxPickup");
m_PickupAtMaximum.erase(it);
break;
}
if ((double)it->player["Health"]["Health"] < (double)it->player["Health"]["MaxHealth"]) {
LOG_INFO("maxhealth found in pickupmax.. yada yada");
DoPickup(it->player, it->pickup, it->trigger);
m_PickupAtMaximum.erase(it);
break;
}
}
}
bool HealthPickupSystem::OnTriggerTouch(Events::TriggerTouch& e)
{
LOG_INFO("OnTriggerTouch");
if (!e.Trigger.HasComponent("HealthPickup")) {
return false;
}
LOG_INFO("touch start");
//cant pick up healthpacks if you are already at MaxHealth
if ((double)e.Entity["Health"]["Health"] >= (double)e.Entity["Health"]["MaxHealth"]) {
LOG_INFO("triggertouch enter at maxhealth");
//push back a copy of the entitys data, rather than e.trigger. since the server might delete e.trigger before client can use it
m_PickupAtMaximum.push_back({ e.Entity,{ (glm::vec3)e.Trigger["Transform"]["Position"] ,e.Trigger["HealthPickup"]["HealthGain"],
e.Trigger["HealthPickup"]["RespawnTimer"],e.Trigger["HealthPickup"]["RespawnTimer"], m_World->GetParent(e.Trigger.ID) } , e.Trigger });
return false;
}
LOG_INFO("touch doing pickup");
DoPickup(e.Entity, e.Trigger);
return true;
}
bool HealthPickupSystem::OnTriggerLeave(Events::TriggerLeave& e) {
//triggerleave erases possible m_PickupAtMaximum
for (auto& it = m_PickupAtMaximum.begin(); it != m_PickupAtMaximum.end(); ++it) {
if (it->trigger.ID == e.Trigger.ID && it->player.ID == e.Entity.ID) {
LOG_INFO("trigger leave - erasing max");
m_PickupAtMaximum.erase(it);
break;
}
}
return true;
}
void HealthPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) {
double healthGiven = 0.01*(double)trigger["HealthPickup"]["HealthGain"] * (double)player["Health"]["MaxHealth"];
LOG_INFO("do pickup start");
//personEntered = e.Entity, thingEntered = e.Trigger
//only the server will increase the players hp and set it in the next delta
if (player.ID != LocalPlayer.ID && ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false)) {
Events::PlayerHealthPickup ePlayerHealthPickup;
ePlayerHealthPickup.HealthAmount = healthGiven;
ePlayerHealthPickup.Player = player;
m_EventBroker->Publish(ePlayerHealthPickup);
LOG_INFO("do pickup event published");
}
//copy position, healthgain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
//we need to copy all values since each value can be different for each healthPickup
m_ETriggerTouchVector.push_back({ (glm::vec3)trigger["Transform"]["Position"] ,trigger["HealthPickup"]["HealthGain"],
trigger["HealthPickup"]["RespawnTimer"],trigger["HealthPickup"]["RespawnTimer"], m_World->GetParent(trigger.ID) });
LOG_INFO("pickup set id to %i", trigger.ID);
//delete the healthpickup
m_World->DeleteEntity(trigger.ID);
}
//to be used with at-max-health-pickup
void HealthPickupSystem::DoPickup(EntityWrapper &player, NewHealthPickup &triggerCopy, EntityWrapper &trigger) {
double healthGiven = 0.01*triggerCopy.HealthGain * (double)player["Health"]["MaxHealth"];
LOG_INFO("do pickup start");
//only the server will increase the players hp and set it in the next delta
if (player.ID != LocalPlayer.ID && ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false)) {
Events::PlayerHealthPickup ePlayerHealthPickup;
ePlayerHealthPickup.HealthAmount = healthGiven;
ePlayerHealthPickup.Player = player;
m_EventBroker->Publish(ePlayerHealthPickup);
LOG_INFO("do pickup event published");
}
m_ETriggerTouchVector.push_back(triggerCopy);
//LOG_INFO("pickup set id to %i", trigger.ID);
//delete the healthpickup
if (trigger.Valid()) {
m_World->DeleteEntity(trigger.ID);
}
}
+2 -2
View File
@@ -25,9 +25,9 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
//if player has the boost from a defender, subtract the damage taken by StrengthOfEffect amount //if player has the boost from a defender, subtract the damage taken by StrengthOfEffect amount
auto playerBoostDefenderEntity = e.Victim.FirstChildByName("BoostDefender"); auto playerBoostDefenderEntity = e.Victim.FirstChildByName("BoostDefender");
if (playerBoostDefenderEntity.Valid()) { if (playerBoostDefenderEntity.Valid()) {
e.Damage -= (double)playerBoostDefenderEntity["BoostDefender"]["StrengthOfEffect"]; e.Damage -= (const double&)playerBoostDefenderEntity["BoostDefender"]["StrengthOfEffect"];
} }
if (health > 0) { if (health > 0 && e.Damage > 0) {
health -= e.Damage; health -= e.Damage;
if (health <= 0.0) { if (health <= 0.0) {
Events::PlayerDeath ePlayerDeath; Events::PlayerDeath ePlayerDeath;
@@ -2,7 +2,7 @@
using boost::unit_test_framework::test_suite; using boost::unit_test_framework::test_suite;
using boost::unit_test_framework::test_case; using boost::unit_test_framework::test_case;
#include "PickupSpawnTest.h" #include "HealthPickupTest.h"
BOOST_AUTO_TEST_SUITE(PickupSpawnTestSuite) BOOST_AUTO_TEST_SUITE(PickupSpawnTestSuite)
@@ -41,7 +41,7 @@ PickupSpawnTest::PickupSpawnTest(int runTestNumber)
// Create system pipeline // Create system pipeline
m_SystemPipeline = new SystemPipeline(m_World, m_EventBroker, false, false); m_SystemPipeline = new SystemPipeline(m_World, m_EventBroker, false, false);
m_SystemPipeline->AddSystem<HealthSystem>(0); m_SystemPipeline->AddSystem<HealthSystem>(0);
m_SystemPipeline->AddSystem<PickupSpawnSystem>(1); m_SystemPipeline->AddSystem<HealthPickupSystem>(1);
//must register components (Components.xsd), else you cant create entities. Easiest done by loading a test xsd file //must register components (Components.xsd), else you cant create entities. Easiest done by loading a test xsd file
auto file = ResourceManager::Load<EntityXMLFile>("Schema/Entities/HealthPickup.xml"); auto file = ResourceManager::Load<EntityXMLFile>("Schema/Entities/HealthPickup.xml");
@@ -31,7 +31,7 @@
#include "Collision/CollisionSystem.h" #include "Collision/CollisionSystem.h"
#include "Core/EntityXMLFileWriter.h" #include "Core/EntityXMLFileWriter.h"
#include "Game/Systems/HealthSystem.h" #include "Game/Systems/HealthSystem.h"
#include "Game/Systems/PickupSpawnSystem.h" #include "Game/Systems/HealthPickupSystem.h"
#include "Core/ResourceManager.h" #include "Core/ResourceManager.h"
@@ -56,9 +56,9 @@ private:
EntityID m_PlayerID, m_HealthPickupID; EntityID m_PlayerID, m_HealthPickupID;
int m_RunTestNumber; int m_RunTestNumber;
EventRelay<PickupSpawnSystem, Events::PlayerHealthPickup> m_HP; EventRelay<HealthPickupSystem, Events::PlayerHealthPickup> m_HP;
bool OnHealthPickup(Events::PlayerHealthPickup& e); bool OnHealthPickup(Events::PlayerHealthPickup& e);
EventRelay<PickupSpawnSystem, Events::PickupSpawned> m_PS; EventRelay<HealthPickupSystem, Events::PickupSpawned> m_PS;
bool OnPickupSpawned(Events::PickupSpawned& e); bool OnPickupSpawned(Events::PickupSpawned& e);
bool m_TestStage1Success = false; bool m_TestStage1Success = false;