Compare commits

..

1 Commits

Author SHA1 Message Date
Teejoon cc5943fcee WIP fix? 2016-02-26 18:36:49 +01:00
70 changed files with 873 additions and 1701 deletions
@@ -24,7 +24,6 @@ public:
private:
Octree<EntityAABB>* m_Octree;
std::vector<EntityAABB> m_OctreeResult;
std::unordered_map<EntityWrapper, glm::vec3> m_PrevPositions;
};
#endif
-6
View File
@@ -29,22 +29,16 @@ struct EntityWrapper
EntityWrapper Parent();
EntityWrapper FirstChildByName(const std::string& name);
EntityWrapper FirstParentWithComponent(const std::string& componentType);
EntityWrapper Clone(EntityWrapper parent = EntityWrapper::Invalid);
std::vector<EntityWrapper> ChildrenWithComponent(const std::string& componentType);
void DeleteChildren();
bool IsChildOf(EntityWrapper potentialParent);
bool Valid() const;
ComponentWrapper operator[](const char* componentName);
ComponentWrapper operator[](const std::string& componentName);
bool operator==(const EntityWrapper& e) const;
bool operator!=(const EntityWrapper& e) const;
explicit operator EntityID() const;
private:
EntityWrapper firstChildByNameRecursive(const std::string& name, EntityID parent);
EntityWrapper cloneRecursive(EntityWrapper entity, EntityWrapper parent);
void childrenWithComponentRecursive(const std::string& componentType, EntityWrapper& entity, std::vector<EntityWrapper>& childrenWithComponent);
};
namespace std
+1 -1
View File
@@ -68,7 +68,7 @@ protected:
const std::string m_ComponentType;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) = 0;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) = 0;
};
class ImpureSystem : public virtual System
+1 -1
View File
@@ -40,7 +40,7 @@ public:
// Change the parent of an entity
void SetParent(EntityID entity, EntityID parent);
// Get children of an entity
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> GetDirectChildren(EntityID entity);
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> GetChildren(EntityID entity);
// Get all component pools
const std::unordered_map<std::string, ComponentPool*>& GetComponentPools() const { return m_ComponentPools; }
// Get the entity children map
-8
View File
@@ -73,12 +73,6 @@ public:
// Called when the user means to rename an entity.
typedef std::function<void(EntityWrapper, const std::string&)> OnEntityChangeName_t;
void SetEntityChangeNameCallback(OnEntityChangeName_t f) { m_OnEntityChangeName = f; }
// Called when the user pastes an entity previously "copied"
// @param EntityWrapper The entity to copy
// @param EntityWrapper The entity to parent the new copy to
// @return The new copy of the entity
typedef std::function<EntityWrapper(EntityWrapper, EntityWrapper)> OnEntityPaste_t;
void SetEntityPasteCallback(OnEntityPaste_t f) { m_OnEntityPaste = f; }
// Called when the user means to attach a new component to an entity.
typedef std::function<void(EntityWrapper, const std::string&)> OnComponentAttach_t;
void SetComponentAttachCallback(OnComponentAttach_t f) { m_OnComponentAttach = f; }
@@ -117,7 +111,6 @@ private:
std::string m_DroppedFile = "";
bool m_Paused = false;
bool m_MouseLocked = false;
EntityWrapper m_CopyTarget = EntityWrapper::Invalid;
// Callbacks
OnEntitySelectedCallback_t m_OnEntitySelected = nullptr;
@@ -131,7 +124,6 @@ private:
OnComponentDelete_t m_OnComponentDelete = nullptr;
OnWidgetMode_t m_OnWidgetMode = nullptr;
OnWidgetSpace_t m_OnWidgetSpace = nullptr;
OnEntityPaste_t m_OnEntityPaste = nullptr;
// Events
EventRelay<EditorGUI, Events::KeyDown> m_EKeyDown;
-1
View File
@@ -56,7 +56,6 @@ private:
void OnEntityDelete(EntityWrapper entity);
void OnEntityChangeParent(EntityWrapper entity, EntityWrapper parent);
void OnEntityChangeName(EntityWrapper entity, const std::string& name);
EntityWrapper OnEntityPaste(EntityWrapper entityToCopy, EntityWrapper parent);
void OnComponentAttach(EntityWrapper entity, const std::string& componentType);
void OnComponentDelete(EntityWrapper entity, const std::string& componentType);
void OnWidgetSpace(EditorGUI::WidgetSpace widgetSpace);
-1
View File
@@ -19,7 +19,6 @@
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Core/ConfigFile.h"
#include "Core/EPlayerDeath.h"
#include "Input/EInputCommand.h"
#include "Core/EPlayerDamage.h"
#include "../Game/Events/EDoubleJump.h"
+12 -8
View File
@@ -29,27 +29,31 @@ public:
//Getters
//Return the blurred result of the texture that was sent into draw
GLuint GaussianTexture() const {
if (m_Quality == 0) {
GLuint GaussianTexture() const {
if (m_Quality == 0) {
return m_BlackTexture->m_Texture;
} else {
}
else {
return m_GaussianTexture_vert;
}
}
}
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
Texture* m_BlackTexture;
Model* m_ScreenQuad;
const IRenderer* m_Renderer;
ConfigFile* m_Config;
//const LightCullingPass* m_LightCullingPass
int m_Iterations;
int m_Quality = 0;
int m_Iterations = 7;
int m_Quality = 3;
GLuint m_GaussianTexture_horiz = 0;
GLuint m_GaussianTexture_vert = 0;
GLuint m_GaussianTexture_horiz;
GLuint m_GaussianTexture_vert;
FrameBuffer m_GaussianFrameBuffer_horiz;
FrameBuffer m_GaussianFrameBuffer_vert;
+5 -9
View File
@@ -15,7 +15,7 @@
class DrawFinalPass
{
public:
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass, GLuint* depthBuffer);
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass);
~DrawFinalPass() { }
void InitializeTextures();
void InitializeFrameBuffers();
@@ -35,14 +35,15 @@ public:
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
void DrawModelRenderQueues(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 DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void MergeLayers();
void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
@@ -55,16 +56,13 @@ private:
Texture* m_GreyTexture;
Texture* m_ErrorTexture;
Model* m_ScreenQuad;
FrameBuffer m_MergeFrameBuffer;
FrameBuffer m_FinalPassFrameBuffer;
FrameBuffer m_FinalPassFrameBufferLowRes;
GLuint m_BloomTexture;
GLuint m_SceneTexture;
GLuint m_BloomTextureLowRes;
GLuint m_SceneTextureLowRes;
GLuint* m_DepthBuffer;
GLuint m_DepthBuffer;
GLuint m_DepthBufferLowRes;
GLuint m_CubeMapTexture;
@@ -76,8 +74,6 @@ private:
const CubeMapPass* m_CubeMapPass;
const SSAOPass* m_SSAOPass;
ShaderProgram* m_MergeProgram;
ShaderProgram* m_ForwardPlusProgram;
ShaderProgram* m_ExplosionEffectProgram;
ShaderProgram* m_ExplosionEffectSplatMapProgram;
-1
View File
@@ -11,7 +11,6 @@
#include "RenderQueue.h"
#include "Model.h"
#include "../Core/World.h" //So temp
#include "Util/CommonFunctions.h"
struct PickData
+3 -1
View File
@@ -28,13 +28,15 @@ public:
const ShaderProgram& PickingProgram() const { return *m_PickingProgram; }
//const std::unordered_map<glm::ivec2, EntityID>& PickingColorsToEntity() const { return m_PickingColorsToEntity; }
GLuint PickingTexture() const { return m_PickingTexture; }
GLuint* DepthBuffer() { return &m_DepthBuffer; }
GLuint DepthBuffer() const { return m_DepthBuffer; }
const FrameBuffer& PickingBuffer() const { return m_PickingBuffer; }
PickData Pick(glm::vec2 screenCoord);
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
EventBroker* m_EventBroker;
const IRenderer* m_Renderer;
-2
View File
@@ -24,8 +24,6 @@ public:
bool StencilFunc(GLenum func, GLint ref, GLuint mask);
bool StencilMask(GLuint mask);
bool DepthMask(GLboolean flag);
bool DepthFunc(GLenum func);
bool AlphaFunc(GLenum func, GLclampf thresholder);
private:
std::vector<std::function<void(void)>> m_ResetFunctions;
+7 -5
View File
@@ -28,7 +28,7 @@ public:
if (m_Quality == 0) {
return m_WhiteTexture->m_Texture;
} else {
return m_Gaussian_vert;
return m_GaussianTexture_vert;
}
}
@@ -46,6 +46,8 @@ private:
void InitializeShaderProgram();
void InitializeBuffer();
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
//void blurHorizontal(GLuint depthBuffer);
//void blurVertical(GLuint depthBuffer);
@@ -66,14 +68,14 @@ private:
Texture* m_WhiteTexture;
GLuint m_SSAOTexture = 0;
GLuint m_SSAOTexture;
FrameBuffer m_SSAOFramBuffer;
GLuint m_SSAOViewSpaceZTexture = 0;
GLuint m_SSAOViewSpaceZTexture;
FrameBuffer m_SSAOViewSpaceZFramBuffer;
GLuint m_Gaussian_horiz = 0;
GLuint m_Gaussian_vert = 0;
GLuint m_GaussianTexture_horiz;
GLuint m_GaussianTexture_vert;
FrameBuffer m_GaussianFrameBuffer_horiz;
FrameBuffer m_GaussianFrameBuffer_vert;
@@ -9,10 +9,6 @@
namespace CommonFunctions
{
Texture* LoadTexture(std::string path, bool threaded);
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
void GenerateMultiSampleTexture(GLuint* texture, int numSamples, glm::vec2 dimensions, GLint internalFormat);
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps);
void DeleteTexture(GLuint* texture);
};
#endif
@@ -1,33 +1,37 @@
#ifndef AssaultWeaponBehaviour_h__
#define AssaultWeaponBehaviour_h__
#include "Sound/EPlaySoundOnEntity.h"
#include "Collision/Collision.h"
#include "Rendering/AnimationSystem.h"
#include "Core/ConfigFile.h"
#include "WeaponBehaviour.h"
#include "../SpawnerSystem.h"
#include "Core/EPlayerDamage.h"
#include "Core/EShoot.h"
class AssaultWeaponBehaviour : public WeaponBehaviour<AssaultWeaponBehaviour>
class AssaultWeaponBehaviour : public WeaponBehaviour
{
public:
AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: WeaponBehaviour(systemParams, "AssaultWeapon", renderer, collisionOctree)
{ }
AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity);
virtual void Fire() override;
virtual void CeaseFire() override;
virtual void Reload() override;
protected:
virtual void OnPrimaryFire(WeaponInfo& wi) override;
virtual void OnCeasePrimaryFire(WeaponInfo& wi) override;
virtual void OnReload(WeaponInfo& wi) override;
virtual void Update(double dt) override;
private:
EntityWrapper m_FirstPersonModel;
EntityWrapper m_ThirdPersonModel;
// State
bool m_Firing = false;
bool m_Reloading = false;
double m_ReloadTimer = 0.0;
EntityWrapper m_FirstPersonReloadImpersonator;
EntityWrapper m_ThirdPersonReloadImpersonator;
double m_TimeSinceLastFire = 0.0;
EntityWrapper m_FirstPersonReloadImpostor;
EventRelay<WeaponBehaviour, Events::AnimationComplete> m_EAnimationComplete;
bool OnAnimationComplete(Events::AnimationComplete& e);
bool hasAmmo();
void fireRound();
@@ -43,5 +47,3 @@ private:
bool shoot(double damage);
void showHitMarker();
};
#endif
@@ -1,38 +0,0 @@
#include "WeaponBehaviour.h"
#include "Collision/Collision.h"
#include "Core/EPlayerDamage.h"
#include "Rendering/ESetCamera.h"
class DefenderWeaponBehaviour : public WeaponBehaviour<DefenderWeaponBehaviour>
{
public:
DefenderWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: System(systemParams)
, WeaponBehaviour(systemParams, "DefenderWeapon", renderer, collisionOctree)
, m_RandomEngine(m_RandomDevice())
{
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &DefenderWeaponBehaviour::OnSetCamera);
}
void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override;
void UpdateWeapon(WeaponInfo& wi, double dt) override;
void OnPrimaryFire(WeaponInfo& wi) override;
void OnCeasePrimaryFire(WeaponInfo& wi) override;
bool OnInputCommand(WeaponInfo& wi, const Events::InputCommand& e) override;
private:
std::random_device m_RandomDevice;
std::mt19937 m_RandomEngine;
EntityWrapper m_CurrentCamera;
EventRelay<DefenderWeaponBehaviour, Events::SetCamera> m_ESetCamera;
bool OnSetCamera(const Events::SetCamera& e);
// Weapon functions
void fireShell(WeaponInfo& wi);
void dealDamage(WeaponInfo& wi, glm::vec3 direction, double damage);
// Utility
float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
Camera cameraFromEntity(EntityWrapper camera);
};
+13 -160
View File
@@ -5,177 +5,30 @@
#include "Rendering/IRenderer.h"
#include "Core/Octree.h"
#include "Collision/EntityAABB.h"
#include "Input/EInputCommand.h"
#include "Systems/SpawnerSystem.h"
template <typename ETYPE>
class WeaponBehaviour : public PureSystem
class WeaponBehaviour : public System
{
friend class WeaponSystem;
public:
WeaponBehaviour(SystemParams params, std::string componentType, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
: System(params)
, PureSystem(componentType)
WeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper player)
: System(systemParams)
, m_Renderer(renderer)
, m_CollisionOctree(collisionOctree)
{
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponBehaviour::_OnInputCommand)
}
, m_Player(player)
{ }
virtual ~WeaponBehaviour() = default;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
{
auto weapon = getActiveWeapon(entity);
if (!weapon) {
return;
} else {
UpdateWeapon(*weapon, dt);
}
}
WeaponBehaviour(const WeaponBehaviour&) = delete;
WeaponBehaviour& operator=(const WeaponBehaviour &) = delete;
virtual void Fire() = 0;
virtual void CeaseFire() { }
virtual void Reload() { }
virtual void Update(double dt) { }
protected:
struct WeaponInfo
{
std::string WeaponComponent;
EntityWrapper Player;
EntityWrapper WeaponEntity;
EntityWrapper FirstPersonEntity;
EntityWrapper ThirdPersonEntity;
ComponentWrapper GetComponent() { return WeaponEntity[WeaponComponent]; }
};
IRenderer* m_Renderer;
Octree<EntityAABB>* m_CollisionOctree;
std::unordered_map<EntityWrapper, WeaponInfo> m_ActiveWeapons;
virtual void UpdateWeapon(WeaponInfo& wi, double dt) { }
virtual void OnPrimaryFire(WeaponInfo& wi) { }
virtual void OnCeasePrimaryFire(WeaponInfo& wi) { }
virtual void OnReload(WeaponInfo& wi) { }
virtual bool OnInputCommand(WeaponInfo& wi, const Events::InputCommand& e) { return false; }
private:
EventRelay<ETYPE, Events::InputCommand> m_EInputCommand;
bool _OnInputCommand(const Events::InputCommand& e)
{
EntityWrapper player = e.Player;
if (e.PlayerID == -1) {
player = LocalPlayer;
}
// Make sure the player is alive
if (!player.Valid()) {
return false;
}
// Make sure the player has this weapon
auto weapon = getWeaponComponent(player);
if (!weapon) {
return false;
}
// Weapon selection
if (e.Command == "SelectWeapon") {
if (static_cast<ComponentInfo::EnumType>(e.Value) == static_cast<ComponentInfo::EnumType>((*weapon)["Slot"])) {
selectWeapon(player);
}
}
// Only handle weapon actions if the weapon is active
auto activeWeapon = getActiveWeapon(player);
if (!activeWeapon) {
return false;
}
// Fire
if (e.Command == "PrimaryFire") {
if (e.Value > 0) {
OnPrimaryFire(*activeWeapon);
} else {
OnCeasePrimaryFire(*activeWeapon);
}
}
// Reload
if (e.Command == "Reload" && e.Value != 0) {
OnReload(*activeWeapon);
}
return OnInputCommand(*activeWeapon, e);
}
boost::optional<ComponentWrapper> getWeaponComponent(EntityWrapper player)
{
if (!player.HasComponent(m_ComponentType)) {
return boost::none;
}
return player[m_ComponentType];
}
boost::optional<WeaponInfo&> getActiveWeapon(EntityWrapper player)
{
auto it = m_ActiveWeapons.find(player);
if (it == m_ActiveWeapons.end()) {
return boost::none;
}
WeaponInfo& activeWeapon = it->second;
if (!activeWeapon.FirstPersonEntity.Valid() && !activeWeapon.ThirdPersonEntity.Valid()) {
return boost::none;
}
return activeWeapon;
}
void selectWeapon(EntityWrapper player)
{
// Find the weapon attachments matching the weapon type
std::vector<EntityWrapper> weaponAttachments = player.ChildrenWithComponent("WeaponAttachment");
EntityWrapper firstPersonAttachment;
EntityWrapper thirdPersonAttachment;
for (auto& attachment : weaponAttachments) {
ComponentWrapper cWeaponAttachment = attachment["WeaponAttachment"];
if ((std::string&)cWeaponAttachment["Weapon"] == m_ComponentType) {
ComponentWrapper::SubscriptProxy person = cWeaponAttachment["Person"];
if ((ComponentInfo::EnumType)person == person.Enum("FirstPerson")) {
firstPersonAttachment = attachment;
} else if ((ComponentInfo::EnumType)person == person.Enum("ThirdPerson")) {
thirdPersonAttachment = attachment;
}
}
}
if (!firstPersonAttachment.Valid() && !thirdPersonAttachment.Valid()) {
LOG_WARNING("No weapon attachment found for %s of player #%i", m_ComponentType.c_str(), player.ID);
return;
}
// Purge other weapon entities
for (auto& attachment : weaponAttachments) {
//if (attachment == firstPersonAttachment || attachment == thirdPersonAttachment) {
// continue;
//}
attachment.DeleteChildren();
}
// Spawn the weapon(s)
EntityWrapper firstPersonWeapon;
EntityWrapper thirdPersonWeapon;
if (firstPersonAttachment.Valid()) {
firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment);
}
if (thirdPersonAttachment.Valid()) {
thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment);
}
m_ActiveWeapons[player].WeaponComponent = m_ComponentType;
m_ActiveWeapons[player].Player = player;
m_ActiveWeapons[player].WeaponEntity = player;
m_ActiveWeapons[player].FirstPersonEntity = firstPersonWeapon;
m_ActiveWeapons[player].ThirdPersonEntity = thirdPersonWeapon;
}
EntityWrapper m_Player;
};
#endif
-2
View File
@@ -46,6 +46,4 @@
<xs:include schemaLocation="Components/Page.xsd"/>
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
<xs:include schemaLocation="Components/Button.xsd"/>
<xs:include schemaLocation="Components/WeaponAttachment.xsd"/>
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
</xs:schema>
@@ -8,5 +8,4 @@
<RPM>120</RPM>
<ViewPunch>0.01</ViewPunch>
<ReloadTime>2</ReloadTime>
<Slot><Primary/></Slot>
</AssaultWeapon>
@@ -2,7 +2,6 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:include schemaLocation="../Types/WeaponSlotEnum.xsd"/>
<xs:element name="AssaultWeapon">
<xs:complexType>
@@ -29,7 +28,6 @@
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Time it takes to reload the weapon in seconds</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Slot" type="WeaponSlotEnum" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<DefenderWeapon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DefenderWeapon.xsd">
<MagazineAmmo>8</MagazineAmmo>
<MagazineSize>8</MagazineSize>
<Ammo>64</Ammo>
<MaxAmmo>64</MaxAmmo>
<BaseDamage>90</BaseDamage>
<SpreadAngle>0.174533</SpreadAngle> <!-- 0.174533 = 10 degrees -->
<NumPellets>10</NumPellets>
<RPM>120</RPM>
<ViewPunch>0.01</ViewPunch>
<ReloadTime>0.5</ReloadTime>
<Slot><Primary/></Slot>
<IsFiring>false</IsFiring>
<TimeSinceLastFire>0</TimeSinceLastFire>
</DefenderWeapon>
@@ -1,44 +0,0 @@
<?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:include schemaLocation="../Types/WeaponSlotEnum.xsd"/>
<xs:element name="DefenderWeapon">
<xs:complexType>
<xs:all>
<xs:element name="MagazineAmmo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Ammo currently loaded into the magazine</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MagazineSize" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Max number of rounds in a magazine</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Ammo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Current ammo carried</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MaxAmmo" type="t:int" minOccurs="0">
<xs:annotation><xs:documentation>Maximum ammo able to be carried</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="BaseDamage" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Damage dealt if all shotgun pellets hit</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="SpreadAngle" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>Spread angle in radians</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="NumPellets" type="t:int" minOccurs="0"/>
<xs:element name="RPM" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ViewPunch" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>View punch in radians for each shell fired</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Time it takes to load ONE SHELL into the weapon in seconds</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Slot" type="WeaponSlotEnum" minOccurs="0"/>
<xs:element name="IsFiring" type="t:bool" minOccurs="0"/>
<xs:element name="TimeSinceLastFire" type="t:double" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+1
View File
@@ -2,6 +2,7 @@
<Physics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Physics.xsd">
<Velocity X="0" Y="0" Z="0"/>
<Gravity>true</Gravity>
<PrevOrigin X="-9876.5" Y="-9876.5" Z="-9876.5"/>
<IsOnGround>false</IsOnGround>
<VerticalStepHeight>0.33</VerticalStepHeight>
</Physics>
+1
View File
@@ -13,6 +13,7 @@
<xs:annotation><xs:documentation>m/s^2</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Gravity" type="t:bool" minOccurs="0"/>
<xs:element name="PrevOrigin" type="t:Vector" minOccurs="0"/>
<xs:element name="IsOnGround" type="t:bool" minOccurs="0"/>
<xs:element name="VerticalStepHeight" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The largest height of a "stair-step" that can be walked over</xs:documentation></xs:annotation>
-1
View File
@@ -3,5 +3,4 @@
<MovementSpeed>3</MovementSpeed>
<CrouchSpeed>1.5</CrouchSpeed>
<CurrentWishDirection X="0" Y="0" Z="0"/>
<CurrentWeapon></CurrentWeapon>
</Player>
-1
View File
@@ -12,7 +12,6 @@
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
<xs:element name="CurrentWishDirection" type="t:Vector" minOccurs="0"/>
<xs:element name="CurrentWeapon" type="t:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Trigger xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Trigger.xsd">
</Trigger>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="Weapon">
<xs:complexType>
<xs:all>
<xs:element name="MagSize" type="t:int" minOccurs="0"/>
<xs:element name="MaxAmmo" type="t:int" minOccurs="0"/>
<xs:element name="CurrentAmmoInMag" type="t:int" minOccurs="0"/>
<xs:element name="CurrentAmmo" type="t:int" minOccurs="0"/>
<xs:element name="RPM" type="t:double" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<WeaponAttachment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="WeaponAttachment.xsd">
<Weapon></Weapon>
<Person><FirstPerson/></Person>
</WeaponAttachment>
@@ -1,28 +0,0 @@
<?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:complexType name="PersonEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="FirstPerson" type="t:int" fixed="0" minOccurs="0"/>
<xs:element name="ThirdPerson" type="t:int" fixed="1" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="WeaponAttachment">
<xs:annotation><xs:documentation>Combine with a spawner to define a weapon attachment point</xs:documentation></xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="Weapon" type="t:string" minOccurs="0">
<xs:annotation><xs:documentation>The weapon component type this attachment refers to</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Person" type="PersonEnum" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.12043038" Y="-0.244988307" Z="-0.181454808"/>
<Orientation X="0.010404544" Y="-0.00268173823" Z="0.0428441577"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.163429111" Y="1.0235405" Z="-0.215489209"/>
<Orientation X="-0.0631071255" Y="-0.0576644838" Z="0.118255548"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Shield" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Shield">
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Shield/>
<c:Transform>
<Scale X="1.11800003" Y="0.0320000015" Z="1.9180001"/>
<Orientation X="-1.57079995" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="VisibleSide">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="0" B="1" G="0" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="0.0179871861"/>
<Scale X="1.01900005" Y="0.0120000001" Z="1.91000009"/>
<Orientation X="-1.57079995" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0480000004" Z="-0.183000013"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.120430306" Y="0.775375426" Z="1.36542225"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00191565475" Y="0.0324025005" Z="-0.2021029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0490000024" Y="0.0520000011" Z="-0.063000001"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0480000004" Z="-0.183000013"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/DefenderGunRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.120430306" Y="0.775375426" Z="1.36542225"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00191565475" Y="0.0324025005" Z="-0.2021029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0490000024" Y="0.0520000011" Z="-0.063000001"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0320000015" Z="-0.165000007"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.162026152" Y="1.05794585" Z="-0.380744517"/>
<Orientation X="-0.0628969446" Y="-0.0509683639" Z="0.118739031"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.000284185546" Y="0.0318552479" Z="-0.193328083"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0320000015" Z="-0.165000007"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/DefenderGunRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.162026152" Y="1.05794585" Z="-0.380744517"/>
<Orientation X="-0.0628969446" Y="-0.0509683639" Z="0.118739031"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.000284185546" Y="0.0318552479" Z="-0.193328083"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+252 -1
View File
@@ -10,7 +10,7 @@
<Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/PlayerRed.xml</EntityFile>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
@@ -118,6 +118,257 @@
</Entity>
</Children>
</Entity>
<Entity name="Player">
<Components>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<RPM>600</RPM>
</c:AssaultWeapon>
<c:Collidable/>
<c:DashAbility/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
</c:Player>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="0" Y="0.0288832653" Z="2.64837074"/>
</c:Transform>
</Components>
<Children>
<Entity name="Camera">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="1.27700007" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="PlayerName">
<Components>
<c:Text>
<Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/>
</c:Text>
<c:Transform>
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CameraModel">
<Components>
<c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="HUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="HealthBar">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0" B="1" G="0" R="0"/>
</c:Fill>
<c:HealthHUD/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
</c:Model>
<c:Transform>
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
<Orientation X="0" Y="0.594000041" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Crosshair">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.200000003"/>
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Hands">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>1.9569972344146196</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:Model>
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0.120748013" Y="-0.228470564" Z="-0.151475638"/>
<Orientation X="0.010404693" Y="-0.00268176314" Z="0.0428441502"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/WeaponReloadEffect.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ThirdPersonCamera">
<Components>
<c:Camera/>
<c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
<Orientation X="5.95600033" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="PlayerModel">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>1.8055945618467364</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:AnimationOffset>
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="ThirdPersonWeaponModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0.158578917" Y="1.02878916" Z="-0.215411991"/>
<Orientation X="-0.0626687407" Y="-0.0361274257" Z="0.120101407"/>
</c:Transform>
</Components>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="AABBStanding">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.427450985" B="1" G="1" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
<Scale X="1" Y="1.60000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AABBCrouching">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.745098054" B="1" G="0" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+132 -73
View File
@@ -7,30 +7,24 @@
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<Slot>
<Secondary/>
</Slot>
<RPM>600</RPM>
</c:AssaultWeapon>
<c:Collidable/>
<c:DefenderWeapon>
<TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
</c:DefenderWeapon>
<c:DashAbility/>
<c:Health/>
<c:Physics>
<PrevOrigin X="0" Y="0.772000015" Z="0"/>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Transform>
<Position X="-1.42731023" Y="0.0288832653" Z="3.63052702"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
@@ -310,8 +304,7 @@
</Children>
</Entity>
</Children>
</Entity>
<Entity name="KillFeed">
</Entity> <Entity name="KillFeed">
<Components>
<c:KillFeed/>
<c:Transform>
@@ -371,7 +364,7 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.67172915251515519</Time1>
<Time1>0.97725610639912475</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
@@ -383,29 +376,100 @@
<c:Transform/>
</Components>
<Children>
<Entity name="PrimaryAttachment">
<Entity name="WeaponModel">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.12043038" Y="-0.244988307" Z="-0.181454808"/>
<Orientation X="0.010404544" Y="-0.00268173823" Z="0.0428441577"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
</Components>
<Children/>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -429,6 +493,7 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.87583812735846323</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
@@ -437,7 +502,6 @@
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
@@ -446,35 +510,41 @@
<c:Transform/>
</Components>
<Children>
<Entity name="PrimaryAttachment">
<Entity name="ThirdPersonWeaponModel">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.163429111" Y="1.0235405" Z="-0.215489209"/>
<Orientation X="-0.0631071255" Y="-0.0576644838" Z="0.118255548"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
</Components>
<Children/>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -540,17 +610,6 @@
</Components>
<Children/>
</Entity>
<Entity name="ShieldAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderShield.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.859000027" Z="-0.976999998"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+135 -75
View File
@@ -7,30 +7,24 @@
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<Slot>
<Secondary/>
</Slot>
<RPM>600</RPM>
</c:AssaultWeapon>
<c:Collidable/>
<c:DefenderWeapon>
<TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
</c:DefenderWeapon>
<c:DashAbility/>
<c:Health/>
<c:Physics>
<PrevOrigin X="0" Y="0.772000015" Z="0"/>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="0" Y="0.0288832653" Z="3.63052702"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
@@ -371,7 +365,7 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.67172915251515519</Time1>
<Time1>1.2667383999985162</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
@@ -383,29 +377,100 @@
<c:Transform/>
</Components>
<Children>
<Entity name="PrimaryAttachment">
<Entity name="WeaponModel">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponViewRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.120430425" Y="-0.242105931" Z="-0.181454822"/>
<Orientation X="0.010404665" Y="-0.00268179877" Z="0.0428443067"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
</Components>
<Children/>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectViewRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:AmmunitionHUD/>
<c:Transform>
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>360</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -429,6 +494,7 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.26532318661337229</Time1>
<Speed1>1</Speed1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
@@ -437,7 +503,6 @@
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
@@ -446,35 +511,41 @@
<c:Transform/>
</Components>
<Children>
<Entity name="PrimaryAttachment">
<Entity name="ThirdPersonWeaponModel">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorldRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.159282878" Y="1.0300566" Z="-0.216084003"/>
<Orientation X="-0.0626799241" Y="-0.0390551724" Z="0.119761385"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
</Components>
<Children/>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorldRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -513,20 +584,20 @@
<Color A="1" B="0" G="1" R="0"/>
</c:Text>
<c:Transform>
<Position X="0.100000001" Y="1.50176644" Z="-0.248000011"/>
<Position X="0.100000001" Y="1.50199997" Z="-0.248000011"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Indicator">
<Entity>
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
<DepthSort>false</DepthSort>
<GlowMap></GlowMap>
<Color A="1" B="1" G="0.309803933" R="0"/>
<Color A="1" B="0" G="0" R="1"/>
</c:Sprite>
<c:HiddenForLocalPlayer/>
<c:SpriteIndicator>
@@ -534,23 +605,12 @@
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
</c:SpriteIndicator>
<c:Transform>
<Position X="0" Y="1.84019077" Z="0"/>
<Position X="0" Y="1.84000003" Z="0"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ShieldAttachment">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderShield.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.859000027" Z="-0.976999998"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
-2
View File
@@ -50,8 +50,6 @@
<xs:element ref="c:Menu" minOccurs="0"/>
<xs:element ref="c:Page" minOccurs="0"/>
<xs:element ref="c:Button" minOccurs="0"/>
<xs:element ref="c:WeaponAttachment" minOccurs="0"/>
<xs:element ref="c:DefenderWeapon" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:complexType name="WeaponSlotEnum" mixed="true">
<xs:complexContent>
<xs:extension base="t:enum">
<xs:choice>
<xs:element name="Primary" type="t:int" fixed="1" minOccurs="0"/>
<xs:element name="Secondary" type="t:int" fixed="2" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
-27
View File
@@ -1,27 +0,0 @@
#version 430
layout (binding = 1) uniform sampler2D DepthStencilTexture;
layout (binding = 2) uniform sampler2D SceneTexture;
layout (binding = 3) uniform sampler2D BloomTexture;
in VertexData{
vec2 TextureCoordinate;
}Input;
out vec4 sceneColor;
out vec4 bloomColor;
void main()
{
float texel = texelFetch(DepthStencilTexture, ivec2(gl_FragCoord.xy / 8.0f), 0).g;
if(texel >= 0.9f)
{
discard;
}
sceneColor = vec4(texture2D(SceneTexture, Input.TextureCoordinate).rgb * texel, 1.0f);
bloomColor = vec4(texture2D(BloomTexture, Input.TextureCoordinate).rgb * texel, 1.0f);
//sceneColor = texel;
//bloomColor = vec4(1,0.5,0.7,1);
}
+43 -45
View File
@@ -16,51 +16,51 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
EntityAABB& boxA = *boundingBox;
bool everHitTheGround = false;
auto prevPosIt = m_PrevPositions.find(entity);
if (prevPosIt != m_PrevPositions.end()) {
glm::vec3 size = boxA.Size();
float diameter = std::min(size.x, size.z);
glm::vec3 prevOrigin = prevPosIt->second;
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
//If the entity has moved farther than the size of its box, we need to handle it specially.
if (rayLength > diameter) {
Ray ray(prevOrigin, toCurrentPos);
m_OctreeResult.clear();
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
for (auto& boxB : m_OctreeResult) {
if (boxA.Entity == boxB.Entity) {
glm::vec3 size = boxA.Size();
float diameter = std::min(size.x, size.z);
glm::vec3 prevOrigin = (glm::vec3)cPhysics["PrevOrigin"];
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
//If the entity has moved farther than the size of its box, we need to handle it specially.
bool traceCollision = rayLength > diameter;
//hack solution: If prevOrigin is less than -9000 in all dimensions,
//then it means it is not set, i.e. this is the first collision check for the entity.
if (traceCollision && glm::any(glm::greaterThan((glm::vec3)cPhysics["PrevOrigin"], glm::vec3(-9000.f)))) {
Ray ray(prevOrigin, toCurrentPos);
m_OctreeResult.clear();
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
for (auto& boxB : m_OctreeResult) {
if (boxA.Entity == boxB.Entity) {
continue;
}
bool hit;
float dist;
if (boxB.Entity.HasComponent("Model")) {
RawModel* model;
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
try {
model = ResourceManager::Load<RawModel, true>(res);
} catch (const std::exception&) {
continue;
}
bool hit;
float dist;
if (boxB.Entity.HasComponent("Model")) {
RawModel* model;
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
try {
model = ResourceManager::Load<RawModel, true>(res);
} catch (const std::exception&) {
continue;
}
float u, v;
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
} else {
hit = Collision::RayVsAABB(ray, boxB, dist);
}
if (hit && dist < rayLength) {
//Set the entity to where it was colliding, minus the maximum box size.
//TODO: Perhaps this should be done slightly more properly.
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
glm::vec3 resolve = newOriginPos - boxA.Origin();
(glm::vec3&)cTransform["Position"] += resolve;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolve.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
}
break;
float u, v;
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
} else {
hit = Collision::RayVsAABB(ray, boxB, dist);
}
if (hit && dist < rayLength) {
//Set the entity to where it was colliding, minus the maximum box size.
//TODO: Perhaps this should be done slightly more properly.
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
glm::vec3 resolve = newOriginPos - boxA.Origin();
(glm::vec3&)cTransform["Position"] += resolve;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolve.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
}
break;
}
}
}
@@ -90,7 +90,6 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
(glm::vec3&)cTransform["Position"] += resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
cPhysics["Velocity"] = inOutVelocity;
if (isOnGround) {
everHitTheGround = true;
@@ -100,7 +99,6 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
} else if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
//Enter here if boxB has no Model.
(glm::vec3&)cTransform["Position"] += resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolutionVector.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
@@ -114,5 +112,5 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
(bool)cPhysics["IsOnGround"] = false;
}
m_PrevPositions[entity] = boxA.Origin();
(glm::vec3&)cPhysics["PrevOrigin"] = boxA.Origin();
}
+1 -79
View File
@@ -51,40 +51,6 @@ EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& compone
return EntityWrapper::Invalid;
}
EntityWrapper EntityWrapper::Clone(EntityWrapper parent /*= Invalid*/)
{
if (!Valid()) {
return EntityWrapper::Invalid;
}
EntityWrapper clone = cloneRecursive(*this, EntityWrapper::Invalid);
this->World->SetParent(clone.ID, parent.ID);
return clone;
}
std::vector<EntityWrapper> EntityWrapper::ChildrenWithComponent(const std::string& componentType)
{
std::vector<EntityWrapper> childrenWithComponent;
childrenWithComponentRecursive(componentType, *this, childrenWithComponent);
return childrenWithComponent;
}
void EntityWrapper::DeleteChildren()
{
auto itPair = this->World->GetDirectChildren(this->ID);
if (itPair.first == itPair.second) {
return;
}
std::vector<EntityID> entitiesToDelete;
for (auto it = itPair.first; it != itPair.second; it++) {
entitiesToDelete.push_back(it->second);
}
for (auto& e : entitiesToDelete) {
this->World->DeleteEntity(e);
}
}
bool EntityWrapper::IsChildOf(EntityWrapper potentialParent)
{
EntityWrapper entity = *this;
@@ -124,11 +90,6 @@ ComponentWrapper EntityWrapper::operator[](const char* componentName)
}
}
ComponentWrapper EntityWrapper::operator[](const std::string& componentName)
{
return this->operator[](componentName.c_str());
}
bool EntityWrapper::operator==(const EntityWrapper& e) const
{
return (this->ID == e.ID) && (this->World == e.World);
@@ -150,7 +111,7 @@ EntityWrapper EntityWrapper::firstChildByNameRecursive(const std::string& name,
return EntityWrapper::Invalid;
}
auto itPair = this->World->GetDirectChildren(parent);
auto itPair = this->World->GetChildren(parent);
if (itPair.first == itPair.second) {
return EntityWrapper::Invalid;
}
@@ -170,42 +131,3 @@ EntityWrapper EntityWrapper::firstChildByNameRecursive(const std::string& name,
return EntityWrapper::Invalid;
}
EntityWrapper EntityWrapper::cloneRecursive(EntityWrapper entity, EntityWrapper parent)
{
EntityWrapper clone = EntityWrapper(entity.World, entity.World->CreateEntity(parent.ID));
entity.World->SetName(clone.ID, entity.Name());
// Clone components
for (auto& kv : entity.World->GetComponentPools()) {
if (kv.second->KnowsEntity(entity.ID)) {
ComponentWrapper c1 = kv.second->GetByEntity(entity.ID);
ComponentWrapper c2 = entity.World->AttachComponent(clone.ID, kv.first);
c1.Copy(c2);
}
}
// Clone children
auto children = entity.World->GetDirectChildren(entity.ID);
for (auto it = children.first; it != children.second; ++it) {
EntityWrapper child(entity.World, it->second);
cloneRecursive(child, clone);
}
return clone;
}
void EntityWrapper::childrenWithComponentRecursive(const std::string& componentType, EntityWrapper& entity, std::vector<EntityWrapper>& childrenWithComponent)
{
auto itPair = this->World->GetDirectChildren(entity.ID);
if (itPair.first == itPair.second) {
return;
}
for (auto it = itPair.first; it != itPair.second; ++it) {
EntityWrapper child = EntityWrapper(entity.World, it->second);
if (child.HasComponent(componentType)) {
childrenWithComponent.push_back(child);
}
childrenWithComponentRecursive(componentType, child, childrenWithComponent);
}
}
+2 -2
View File
@@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int
va_end(args);
if (logLevel == LOG_LEVEL_ERROR) {
//std::cerr << file << ":" << line << " " << func << std::endl;
//std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
std::cerr << file << ":" << line << " " << func << std::endl;
std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} else {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
}
+1 -1
View File
@@ -127,7 +127,7 @@ void World::SetParent(EntityID entity, EntityID parent)
m_EntityChildren.insert(std::make_pair(parent, entity));
}
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> World::GetDirectChildren(EntityID entity)
const std::pair<std::unordered_multimap<EntityID, EntityID>::const_iterator, std::unordered_multimap<EntityID, EntityID>::const_iterator> World::GetChildren(EntityID entity)
{
return m_EntityChildren.equal_range(entity);
}
-13
View File
@@ -598,19 +598,6 @@ bool EditorGUI::OnKeyDown(const Events::KeyDown& e)
entityImport(m_World);
}
if (e.ModCtrl && e.KeyCode == GLFW_KEY_C) {
m_CopyTarget = m_CurrentSelection;
}
if (e.ModCtrl && e.KeyCode == GLFW_KEY_V) {
if (m_OnEntityPaste != nullptr) {
EntityWrapper copy = m_OnEntityPaste(m_CopyTarget, m_CurrentSelection);
if (copy != EntityWrapper::Invalid) {
SelectEntity(copy);
}
}
}
if (e.KeyCode == GLFW_KEY_DELETE) {
if (m_CurrentSelection.Valid()) {
entityDelete(m_CurrentSelection);
-6
View File
@@ -28,7 +28,6 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
m_EditorGUI->SetEntityDeleteCallback(std::bind(&EditorSystem::OnEntityDelete, this, std::placeholders::_1));
m_EditorGUI->SetEntityChangeParentCallback(std::bind(&EditorSystem::OnEntityChangeParent, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetEntityChangeNameCallback(std::bind(&EditorSystem::OnEntityChangeName, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetEntityPasteCallback(std::bind(&EditorSystem::OnEntityPaste, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetComponentAttachCallback(std::bind(&EditorSystem::OnComponentAttach, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetComponentDeleteCallback(std::bind(&EditorSystem::OnComponentDelete, this, std::placeholders::_1, std::placeholders::_2));
m_EditorGUI->SetWidgetModeCallback(std::bind(&EditorSystem::setWidgetMode, this, std::placeholders::_1));
@@ -161,11 +160,6 @@ void EditorSystem::OnEntityChangeName(EntityWrapper entity, const std::string& n
}
}
EntityWrapper EditorSystem::OnEntityPaste(EntityWrapper entityToCopy, EntityWrapper parent)
{
return entityToCopy.Clone(parent);
}
void EditorSystem::OnComponentAttach(EntityWrapper entity, const std::string& componentType)
{
if (entity.Valid()) {
+2 -8
View File
@@ -261,14 +261,8 @@ void Client::parseEntityDeletion(Packet & packet)
if (m_ServerIDToClientID.find(entityToDelete) != m_ServerIDToClientID.end()) {
EntityID localEntity = m_ServerIDToClientID.at(entityToDelete);
if (m_World->ValidEntity(localEntity)) {
if (m_World->HasComponent(localEntity,"Player")) {
Events::PlayerDeath e;
e.Player = EntityWrapper(m_World, localEntity);
m_EventBroker->Publish(e);
} else {
m_World->DeleteEntity(localEntity);
deleteFromServerClientMaps(entityToDelete, localEntity);
}
m_World->DeleteEntity(localEntity);
deleteFromServerClientMaps(entityToDelete, localEntity);
}
}
}
+3 -3
View File
@@ -186,7 +186,7 @@ void Server::addInputCommandsToPacket(Packet& packet)
void Server::addPlayersToPacket(Packet & packet, EntityID entityID)
{
auto itPair = m_World->GetDirectChildren(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++) {
@@ -234,7 +234,7 @@ void Server::addPlayersToPacket(Packet & packet, EntityID entityID)
void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
{
auto itPair = m_World->GetDirectChildren(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++) {
@@ -601,7 +601,7 @@ void Server::parsePlayerTransform(Packet& packet)
bool Server::shouldSendToClient(EntityWrapper childEntity)
{
auto children = m_World->GetDirectChildren(childEntity.ID);
auto children = m_World->GetChildren(childEntity.ID);
for (auto it = children.first; it != children.second; it++) {
EntityWrapper child(m_World, it->second);
if(child.HasComponent("CapturePoint")) {
+1 -1
View File
@@ -17,7 +17,7 @@ void CubeMapPass::LoadTextures(std::string input)
m_CubeMapTextures.push_back(img);
}
GenerateCubeMapTexture();
m_PreviusCubeMapTexture = input;
m_PreviusCubeMapTexture = input;
}
}
+27 -16
View File
@@ -24,18 +24,19 @@ void DrawBloomPass::ChangeQuality(int quality)
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
if (m_Quality == 0) {
CommonFunctions::DeleteTexture(&m_GaussianTexture_horiz);
CommonFunctions::DeleteTexture(&m_GaussianTexture_vert);
m_GaussianTexture_horiz = 0;
m_GaussianTexture_vert = 0;
glDeleteTextures(1, &m_GaussianTexture_horiz);
glDeleteTextures(1, &m_GaussianTexture_vert);
return;
}
InitializeTextures();
InitializeTextures();
InitializeBuffers();
InitializeShaderPrograms();
std::string qStr = std::to_string(m_Quality);
m_Iterations = m_Config->Get<float>("GLOW" + qStr + ".NumIterations", 0);
InitializeBuffers();
InitializeShaderPrograms();
}
void DrawBloomPass::InitializeShaderPrograms()
@@ -57,16 +58,18 @@ void DrawBloomPass::InitializeShaderPrograms()
}
}
void DrawBloomPass::InitializeBuffers()
{
CommonFunctions::GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
if (m_GaussianFrameBuffer_horiz.GetHandle() == 0) {
m_GaussianFrameBuffer_horiz.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_GaussianTexture_horiz, GL_COLOR_ATTACHMENT0)));
}
m_GaussianFrameBuffer_horiz.Generate();
CommonFunctions::GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
if (m_GaussianFrameBuffer_vert.GetHandle() == 0) {
m_GaussianFrameBuffer_vert.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_GaussianTexture_vert, GL_COLOR_ATTACHMENT0)));
}
@@ -82,11 +85,11 @@ void DrawBloomPass::ClearBuffer()
GLERROR("PRE");
m_GaussianFrameBuffer_horiz.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GaussianFrameBuffer_horiz.Unbind();
m_GaussianFrameBuffer_vert.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GaussianFrameBuffer_vert.Unbind();
GLERROR("END");
}
@@ -119,7 +122,6 @@ void DrawBloomPass::Draw(GLuint texture)
m_GaussianFrameBuffer_vert.Bind();
m_GaussianProgram_vert->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
glBindVertexArray(m_ScreenQuad->VAO);
@@ -127,19 +129,16 @@ void DrawBloomPass::Draw(GLuint texture)
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);
//horizontal pass
m_GaussianFrameBuffer_vert.Unbind();
m_GaussianFrameBuffer_horiz.Bind();
m_GaussianProgram_horiz->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_vert);
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);
m_GaussianFrameBuffer_horiz.Unbind();
}
//final vertical gaussian after the iterations are done
@@ -147,7 +146,6 @@ void DrawBloomPass::Draw(GLuint texture)
m_GaussianFrameBuffer_vert.Bind();
m_GaussianProgram_vert->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
@@ -163,8 +161,21 @@ void DrawBloomPass::OnWindowResize()
if (m_Quality == 0) {
return;
}
CommonFunctions::GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_GaussianFrameBuffer_vert.Generate();
CommonFunctions::GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_GaussianFrameBuffer_horiz.Generate();
}
void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
{
glDeleteTextures(1, texture);
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);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
+80 -125
View File
@@ -1,17 +1,15 @@
#include "Rendering/DrawFinalPass.h"
DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass, GLuint* depthBuffer)
DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass)
: m_Renderer(renderer)
, m_LightCullingPass(lightCullingPass)
, m_CubeMapPass(cubeMapPass)
, m_SSAOPass(ssaoPass)
, m_DepthBuffer(depthBuffer)
{
//TODO: Make sure that uniforms are not sent into shader if not needed.
m_ShieldPixelRate = 8;
InitializeTextures();
InitializeShaderPrograms();
InitializeFrameBuffers();
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
}
void DrawFinalPass::InitializeTextures()
@@ -25,46 +23,42 @@ void DrawFinalPass::InitializeTextures()
void DrawFinalPass::InitializeFrameBuffers()
{
CommonFunctions::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);
glGenRenderbuffers(1, &m_DepthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
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_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
CommonFunctions::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);
//GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_FLOAT, 4);
//GenerateTexture(&m_StencilTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_STENCIL, GL_STENCIL_INDEX8, GL_INT);
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(m_DepthBuffer, GL_DEPTH_STENCIL_ATTACHMENT)));
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new RenderBuffer(&m_DepthBuffer, GL_DEPTH_STENCIL_ATTACHMENT)));
//m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_StencilTexture, GL_STENCIL_ATTACHMENT)));
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0)));
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTexture, GL_COLOR_ATTACHMENT1)));
m_FinalPassFrameBuffer.Generate();
GLERROR("FBO generation");
/* glGenRenderbuffers(1, &m_DepthBufferLowRes);
glGenRenderbuffers(1, &m_DepthBufferLowRes);
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBufferLowRes);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate));
GLERROR("RenderBufferLowRes generation");*/
GLERROR("RenderBufferLowRes generation");
CommonFunctions::GenerateTexture(&m_DepthBufferLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST,
glm::vec2((int)(m_Renderer->GetViewportSize().Width / m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height / m_ShieldPixelRate)),
GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
CommonFunctions::GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), 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);
CommonFunctions::GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
//GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_FLOAT, 4);
//GenerateTexture(&m_StencilTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_STENCIL, GL_STENCIL_INDEX8, GL_INT);
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBufferLowRes, GL_DEPTH_STENCIL_ATTACHMENT)));
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new RenderBuffer(&m_DepthBufferLowRes, GL_DEPTH_STENCIL_ATTACHMENT)));
//m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_StencilTexture, GL_STENCIL_ATTACHMENT)));
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTextureLowRes, GL_COLOR_ATTACHMENT0)));
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTextureLowRes, GL_COLOR_ATTACHMENT1)));
m_FinalPassFrameBufferLowRes.Generate();
GLERROR("FBO2 generation");
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(m_DepthBuffer, GL_DEPTH_STENCIL_ATTACHMENT)));
m_MergeFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0)));
m_MergeFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTexture, GL_COLOR_ATTACHMENT1)));
m_MergeFrameBuffer.Generate();
GLERROR("FBO3 generation");
}
void DrawFinalPass::InitializeShaderPrograms()
@@ -168,26 +162,17 @@ void DrawFinalPass::InitializeShaderPrograms()
m_FillDepthBufferProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgram");
m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBuffer.vert.glsl")));
//m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
// m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
m_FillDepthBufferProgram->Compile();
m_FillDepthBufferProgram->Link();
GLERROR("Creating DepthFill program");
m_FillDepthBufferSkinnedProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgramSkinned");
m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBufferSkinned.vert.glsl")));
//m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
// m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
m_FillDepthBufferSkinnedProgram->Compile();
m_FillDepthBufferSkinnedProgram->Link();
GLERROR("Creating DepthFill program");
m_MergeProgram = ResourceManager::Load<ShaderProgram>("#MergeProgram");
m_MergeProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/DrawScreenQuad.vert.glsl")));
m_MergeProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/MergeProgram.frag.glsl")));
m_MergeProgram->Compile();
m_MergeProgram->BindFragDataLocation(0, "sceneColor");
m_MergeProgram->BindFragDataLocation(1, "bloomColor");
m_MergeProgram->Link();
GLERROR("Creating merge program");
}
void DrawFinalPass::Draw(RenderScene& scene)
@@ -197,41 +182,40 @@ void DrawFinalPass::Draw(RenderScene& scene)
if (scene.ClearDepth) {
//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?
state->Enable(GL_STENCIL_TEST);
glClearStencil(0x00);
glClear(GL_STENCIL_BUFFER_BIT);
//Draw Opaque shielded objects
state->Disable(GL_STENCIL_TEST);
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
GLERROR("OpaqueObjects");
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
GLERROR("Shielded Opaque object");
//DrawStencilState* stencilState = new DrawStencilState(m_FinalPassFrameBuffer.GetHandle());
//Draw shields to stencil pass
state->Enable(GL_STENCIL_TEST);
state->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state->StencilFunc(GL_ALWAYS, 1, 0xFF);
state->StencilMask(0xFF);
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
GLERROR("StencilPass");
//Fill depth buffer
state->StencilMask(0x00);
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
GLERROR("OpaqueObjects");
state->BlendFunc(GL_ONE, GL_ONE);
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
GLERROR("TransparentObjects");
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawSprites(scene.Jobs.SpriteJob, scene);
GLERROR("SpriteJobs");
//state->BlendFunc(GL_ONE, GL_ONE);
//DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
//GLERROR("TransparentObjects");
//DrawStencilState* stencilState = new DrawStencilState(m_FinalPassFrameBuffer.GetHandle());
//Draw shields to stencil pass
state->StencilFunc(GL_ALWAYS, 1, 0xFF);
state->StencilMask(0xFF);
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
GLERROR("StencilPass");
////Draw Transparen Shielded objects
//DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
//GLERROR("Shielded Transparent objects");
//Draw Opaque shielded objects
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
state->StencilMask(0x00);
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
GLERROR("Shielded Opaque object");
// state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// DrawSprites(scene.Jobs.SpriteJob, scene);
// GLERROR("SpriteJobs");
//Draw Transparen Shielded objects
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
GLERROR("Shielded Transparent objects");
GLERROR("END");
delete state;
@@ -241,11 +225,6 @@ void DrawFinalPass::Draw(RenderScene& scene)
//Draw the lowres texture that will be shown behind the shield.
stateLowRes->Enable(GL_SCISSOR_TEST);
stateLowRes->Enable(GL_DEPTH_TEST);
stateLowRes->DepthMask(GL_TRUE);
stateLowRes->Enable(GL_STENCIL_TEST);
stateLowRes->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
stateLowRes->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
stateLowRes->StencilMask(0xFF);
//TODO: Viewports and scissor should be in state
glViewport(0, 0, m_Renderer->GetViewportSize().Width/m_ShieldPixelRate, m_Renderer->GetViewportSize().Height/m_ShieldPixelRate);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
@@ -257,20 +236,18 @@ void DrawFinalPass::Draw(RenderScene& scene)
stateLowRes->StencilFunc(GL_ALWAYS, 1, 0xFF);
stateLowRes->StencilMask(0x00);
DrawToDepthBuffer(scene.Jobs.OpaqueObjects, scene);
//DrawToDepthBuffer(scene.Jobs.TransparentObjects, scene);
DrawToDepthBuffer(scene.Jobs.TransparentObjects, scene);
//Draw shields to stencil pass
stateLowRes->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
stateLowRes->StencilFunc(GL_ALWAYS, 1, 0xFF);
stateLowRes->StencilMask(0xFF);
stateLowRes->DepthMask(GL_FALSE);
stateLowRes->Enable(GL_DEPTH_TEST);
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
GLERROR("StencilPass");
//glClear(GL_DEPTH_BUFFER_BIT);
stateLowRes->Enable(GL_DEPTH_TEST);
//stateLowRes->DepthMask(GL_TRUE);
stateLowRes->DepthFunc(GL_LEQUAL);
stateLowRes->StencilFunc(GL_LEQUAL, 1, 0xFF);
stateLowRes->StencilMask(0x00);
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
@@ -280,34 +257,6 @@ void DrawFinalPass::Draw(RenderScene& scene)
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
delete stateLowRes;
m_FinalPassFrameBuffer.Unbind();
m_FinalPassFrameBufferLowRes.Unbind();
state = new DrawFinalPassState(m_MergeFrameBuffer.GetHandle());
state->Disable(GL_DEPTH_TEST);
state->Enable(GL_STENCIL_TEST);
state->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state->StencilFunc(GL_LEQUAL, 1, 0xFF);
state->StencilMask(0x00);
MergeLayers();
delete state;
state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
//Draw Transparancy
state->BlendFunc(GL_ONE, GL_ONE);
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
GLERROR("TransparentObjects");
//Draw Transparen Shielded objects
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
GLERROR("Shielded Transparent objects");
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawSprites(scene.Jobs.SpriteJob, scene);
GLERROR("SpriteJobs");
GLERROR("END");
delete state;
}
@@ -324,7 +273,7 @@ void DrawFinalPass::ClearBuffer()
glClearColor(0.f, 0.f, 0.f, 0.f);
GLERROR("1");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLERROR("2");
glDisable(GL_SCISSOR_TEST);
@@ -339,7 +288,7 @@ void DrawFinalPass::ClearBuffer()
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("ViewPort,Scissor LowRes");
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_FinalPassFrameBuffer.Unbind();
GLERROR("END");
}
@@ -348,21 +297,49 @@ void DrawFinalPass::ClearBuffer()
void DrawFinalPass::OnWindowResize()
{
//InitializeFrameBuffers();
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
CommonFunctions::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);
CommonFunctions::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_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);
m_FinalPassFrameBuffer.Generate();
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBufferLowRes);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate));
CommonFunctions::GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
CommonFunctions::GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
m_FinalPassFrameBufferLowRes.Generate();
GLERROR("Error changing texture resolutions");
}
void DrawFinalPass::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);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const
{
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexStorage2D(GL_TEXTURE_2D, numMipMaps, GL_RGBA8, dimensions.x, dimensions.y);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dimensions.x, dimensions.y, format, type, texture);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
GLERROR("MipMap Texture initialization failed");
}
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
{
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
@@ -774,28 +751,6 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
// m_SpriteProgram->Unbind();
}
void DrawFinalPass::MergeLayers()
{
GLuint shaderHandle = m_MergeProgram->GetHandle();
m_MergeProgram->Bind();
GLERROR("MergeLayers 1");
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_DepthBufferLowRes);
GLERROR("MergeLayers 2");
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, m_SceneTextureLowRes);
GLERROR("MergeLayers 3");
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, m_BloomTextureLowRes);
GLERROR("MergeLayers 4");
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);
GLERROR("MergeLayers 5");
}
void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene)
{
glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality());
+5 -6
View File
@@ -8,13 +8,12 @@ DrawFinalPassState::DrawFinalPassState(GLuint frameBuffer)
Enable(GL_BLEND);
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Enable(GL_DEPTH_TEST);
DepthMask(GL_FALSE);
DepthFunc(GL_LEQUAL);
Enable(GL_CULL_FACE);
//Enable(GL_STENCIL_TEST);
//StencilFunc(GL_NOTEQUAL, 1, 0xFF);
//StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
//StencilMask(0xFF);
glDepthFunc(GL_LEQUAL);
Enable(GL_STENCIL_TEST);
StencilFunc(GL_NOTEQUAL, 1, 0xFF);
StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
StencilMask(0xFF);
ClearColor(glm::vec4(0.f, 0.f, 0.f, 0.f));
}
+16 -3
View File
@@ -19,10 +19,10 @@ PickingPass::~PickingPass()
void PickingPass::InitializeTextures()
{
CommonFunctions::GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST,
GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST,
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
}
@@ -366,7 +366,7 @@ void PickingPass::ClearPicking()
m_PickingBuffer.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_PickingBuffer.Unbind();
GLERROR("END");
}
@@ -407,3 +407,16 @@ PickData PickingPass::Pick(glm::vec2 screenCoord)
pickData.World = pickInfo.World;
return pickData;
}
void PickingPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
{
//TODO: Renderer: Make this in a sparate class
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);//TODO: Renderer: Fix the precision and Resolution
GLERROR("Texture initialization failed");
}
@@ -14,7 +14,6 @@ PickingPassState::PickingPassState(GLuint frameBuffer)
//ClearColor(clearColor);
//Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLERROR("END");
}
PickingPassState::~PickingPassState()
-20
View File
@@ -135,26 +135,6 @@ bool RenderState::DepthMask(GLboolean flag)
return !GLERROR("DepthMask");
}
bool RenderState::DepthFunc(GLenum func)
{
GLint original;
glGetIntegerv(GL_DEPTH_FUNC, &original);
m_ResetFunctions.push_back(std::bind(glDepthFunc, original));
glDepthFunc(func);
return !GLERROR("DepthFunc");
}
bool RenderState::AlphaFunc(GLenum func, GLclampf thresholder)
{
GLint originalFunc;
glGetIntegerv(GL_ALPHA_TEST_FUNC, &originalFunc);
GLint originalRef;
glGetIntegerv(GL_ALPHA_TEST_REF, &originalRef);
m_ResetFunctions.push_back(std::bind(glAlphaFunc, originalFunc, originalRef));
glAlphaFunc(func, thresholder);
return !GLERROR("AlphaFunc");
}
RenderState::~RenderState()
{
for (auto& f : boost::adaptors::reverse(m_ResetFunctions)) {
+11 -12
View File
@@ -28,9 +28,9 @@ void Renderer::glfwFrameBufferCallback(GLFWwindow* window, int width, int height
glViewport(0, 0, width, height);
Renderer* currentRenderer = m_WindowToRenderer[window];
currentRenderer->m_ViewportSize = Rectangle(width, height);
currentRenderer->m_PickingPass->OnWindowResize();
currentRenderer->m_DrawFinalPass->OnWindowResize();
currentRenderer->m_LightCullingPass->OnWindowResize();
currentRenderer->m_PickingPass->OnWindowResize();
currentRenderer->m_DrawBloomPass->OnWindowResize();
currentRenderer->m_SSAOPass->OnWindowResize();
}
@@ -136,16 +136,18 @@ void Renderer::Draw(RenderFrame& frame)
PerformanceTimer::StopTimer("Renderer-ClearBuffers");
GLERROR("ClearBuffers");
for (auto scene : frame.RenderScenes) {
PerformanceTimer::StartTimer("Renderer-PickingPass");
PerformanceTimer::StartTimer("Renderer-Depth");
m_PickingPass->Draw(*scene);
GLERROR("Drawing pickingpass");
PerformanceTimer::StopTimer("Renderer-PickingPass");
PerformanceTimer::StopTimer("Renderer-Depth");
}
PerformanceTimer::StartTimer("Renderer-AO generation");
m_SSAOPass->Draw(*m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera);
m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera);
GLuint ao = m_SSAOPass->SSAOTexture();
PerformanceTimer::StopTimer("Renderer-AO generation");
for (auto scene : frame.RenderScenes){
PerformanceTimer::StartTimer("Renderer-Depth");
PerformanceTimer::StartTimer("Renderer-Drawing PickingPass");
SortRenderJobsByDepth(*scene);
GLERROR("SortByDepth");
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Generate Frustrums");
@@ -157,8 +159,8 @@ void Renderer::Draw(RenderFrame& frame)
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Light Culling");
m_LightCullingPass->CullLights(*scene);
GLERROR("LightCulling");
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
m_DrawFinalPass->Draw(*scene);
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
GLERROR("Draw Geometry+Light");
//m_DrawScenePass->Draw(*scene);
@@ -205,11 +207,8 @@ void Renderer::Draw(RenderFrame& frame)
PerformanceTimer::StartTimer("Renderer-ImGuiRenderPass");
m_ImGuiRenderPass->Draw();
GLERROR("Imgui draw");
PerformanceTimer::StopTimer("Renderer-ImGuiRenderPass");
PerformanceTimer::StartTimer("Renderer-SwapBuffer");
glfwSwapBuffers(m_Window);
PerformanceTimer::StopTimer("Renderer-SwapBuffer");
PerformanceTimer::StopTimer("Renderer-ImGuiRenderPass");
}
PickData Renderer::Pick(glm::vec2 screenCoord)
@@ -250,9 +249,9 @@ void Renderer::InitializeRenderPasses()
m_LightCullingPass = new LightCullingPass(this);
m_CubeMapPass = new CubeMapPass(this);
m_SSAOPass = new SSAOPass(this, m_Config);
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass, m_CubeMapPass, m_SSAOPass, m_PickingPass->DepthBuffer());
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass, m_CubeMapPass, m_SSAOPass);
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
m_DrawBloomPass = new DrawBloomPass(this, m_Config);
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
}
}
+35 -30
View File
@@ -7,7 +7,6 @@ SSAOPass::SSAOPass(IRenderer* renderer, ConfigFile* config)
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
ChangeQuality(m_Config->Get<int>("SSAO.Quality", 0));
}
void SSAOPass::ChangeQuality(int quality)
@@ -19,10 +18,10 @@ void SSAOPass::ChangeQuality(int quality)
m_Quality = quality;
if (m_Quality == 0) {
CommonFunctions::DeleteTexture(&m_SSAOTexture);
CommonFunctions::DeleteTexture(&m_SSAOViewSpaceZTexture);
CommonFunctions::DeleteTexture(&m_Gaussian_horiz);
CommonFunctions::DeleteTexture(&m_Gaussian_vert);
glDeleteTextures(1, &m_SSAOTexture);
glDeleteTextures(1, &m_SSAOViewSpaceZTexture);
glDeleteTextures(1, &m_GaussianTexture_horiz);
glDeleteTextures(1, &m_GaussianTexture_vert);
return;
}
@@ -85,11 +84,11 @@ void SSAOPass::InitializeShaderProgram()
}
void SSAOPass::InitializeTexture() {
CommonFunctions::GenerateTexture(&m_SSAOTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R8, GL_RED, GL_FLOAT);
CommonFunctions::GenerateTexture(&m_SSAOViewSpaceZTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R32F, GL_RED, GL_FLOAT);
GenerateTexture(&m_SSAOTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R8, GL_RED, GL_FLOAT);
GenerateTexture(&m_SSAOViewSpaceZTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R32F, GL_RED, GL_FLOAT);
CommonFunctions::GenerateTexture(&m_Gaussian_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R8, GL_RED, GL_FLOAT);
CommonFunctions::GenerateTexture(&m_Gaussian_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R8, GL_RED, GL_FLOAT);
GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R8, GL_RGB, GL_FLOAT);
GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width >> m_TextureQuality, m_Renderer->GetViewportSize().Height >> m_TextureQuality), GL_R8, GL_RGB, GL_FLOAT);
}
void SSAOPass::InitializeBuffer()
@@ -97,26 +96,26 @@ void SSAOPass::InitializeBuffer()
if (m_SSAOFramBuffer.GetHandle() == 0) {
m_SSAOFramBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SSAOTexture, GL_COLOR_ATTACHMENT0)));
}
m_SSAOFramBuffer.Generate();
m_SSAOFramBuffer.Generate();
if (m_SSAOViewSpaceZFramBuffer.GetHandle() == 0) {
m_SSAOViewSpaceZFramBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SSAOViewSpaceZTexture, GL_COLOR_ATTACHMENT0)));
}
m_SSAOViewSpaceZFramBuffer.Generate();
m_SSAOViewSpaceZFramBuffer.Generate();
if (m_GaussianFrameBuffer_horiz.GetHandle() == 0) {
m_GaussianFrameBuffer_horiz.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_Gaussian_horiz, GL_COLOR_ATTACHMENT0)));
m_GaussianFrameBuffer_horiz.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_GaussianTexture_horiz, GL_COLOR_ATTACHMENT0)));
}
m_GaussianFrameBuffer_horiz.Generate();
m_GaussianFrameBuffer_horiz.Generate();
if (m_GaussianFrameBuffer_vert.GetHandle() == 0) {
m_GaussianFrameBuffer_vert.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_Gaussian_vert, GL_COLOR_ATTACHMENT0)));
m_GaussianFrameBuffer_vert.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_GaussianTexture_vert, GL_COLOR_ATTACHMENT0)));
}
m_GaussianFrameBuffer_vert.Generate();
m_GaussianFrameBuffer_vert.Generate();
}
@@ -125,24 +124,25 @@ void SSAOPass::ClearBuffer()
if (m_Quality == 0) {
return;
}
m_SSAOFramBuffer.Bind();
glClearColor(1.f, 1.f, 1.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_SSAOFramBuffer.Unbind();
m_SSAOViewSpaceZFramBuffer.Bind();
glClearColor(1.f, 1.f, 1.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_SSAOViewSpaceZFramBuffer.Unbind();
m_GaussianFrameBuffer_horiz.Bind();
glClearColor(1.f, 1.f, 1.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GaussianFrameBuffer_horiz.Unbind();
m_GaussianFrameBuffer_vert.Bind();
glClearColor(1.f, 1.f, 1.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GaussianFrameBuffer_vert.Unbind();
}
@@ -157,6 +157,19 @@ void SSAOPass::Setting(float radius, float bias, float contrast, float intensity
m_TextureQuality = quality;
}
void SSAOPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
{
glDeleteTextures(1, texture);
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)
{
if (m_Quality == 0) {
@@ -238,27 +251,23 @@ void SSAOPass::Draw(GLuint depthBuffer, Camera* camera)
m_GaussianFrameBuffer_vert.Bind();
m_GaussianProgram_vert->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_Gaussian_horiz);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
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);
//horizontal pass
m_GaussianFrameBuffer_vert.Unbind();
m_GaussianFrameBuffer_horiz.Bind();
m_GaussianProgram_horiz->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_Gaussian_vert);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_vert);
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);
m_GaussianFrameBuffer_horiz.Unbind();
}
//final vertical gaussian after the iterations are done
@@ -266,15 +275,12 @@ void SSAOPass::Draw(GLuint depthBuffer, Camera* camera)
m_GaussianFrameBuffer_vert.Bind();
m_GaussianProgram_vert->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_Gaussian_horiz);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
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);
m_GaussianFrameBuffer_vert.Unbind();
glViewport(0, 0, (m_Renderer->GetViewportSize().Width), (m_Renderer->GetViewportSize().Height));
}
@@ -284,5 +290,4 @@ void SSAOPass::OnWindowResize() {
}
InitializeTexture();
InitializeBuffer();
}
@@ -17,46 +17,3 @@ Texture* CommonFunctions::LoadTexture(std::string path, bool threaded)
return img;
}
void CommonFunctions::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type)
{
glDeleteTextures(1, texture);
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 CommonFunctions::GenerateMultiSampleTexture(GLuint* texture, int numSamples, glm::vec2 dimensions, GLint internalFormat)
{
glDeleteTextures(1, texture);
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, *texture);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, numSamples, internalFormat, dimensions.x, dimensions.y, false);
GLERROR("Texture initialization failed");
}
void CommonFunctions::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps)
{
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexStorage2D(GL_TEXTURE_2D, numMipMaps, GL_RGBA8, dimensions.x, dimensions.y);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, dimensions.x, dimensions.y, format, type, texture);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
GLERROR("MipMap Texture initialization failed");
}
void CommonFunctions::DeleteTexture(GLuint* texture)
{
glDeleteTextures(1, texture);
*texture = 0;
}
+2 -7
View File
@@ -31,27 +31,22 @@ glm::vec3 ScreenCoords::ToWorldPos(glm::vec2 screenCoord, float depth, float scr
ScreenCoords::PixelData ScreenCoords::ToPixelData(float x, float y, FrameBuffer* PickDataBuffer, GLuint DepthBuffer)
{
GLERROR("Pre");
PickDataBuffer->Bind();
unsigned char pdata[3];
glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pdata);
GLERROR("glReadPixels(pdata) Error");
PickDataBuffer->Unbind();
glBindFramebuffer(GL_FRAMEBUFFER, DepthBuffer);
GLERROR("glBindFramebuffer(DepthBuffer) Error");
glBindFramebuffer(GL_FRAMEBUFFER, DepthBuffer);
float depthData;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depthData);
GLERROR("glReadPixels(depthData) Error");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERROR("glBindFramebuffer(0) Error");
PixelData p;
p.Color[0] = (int)pdata[0];
p.Color[1] = (int)pdata[1];
p.Depth = depthData;
GLERROR("End");
GLERROR("ScreenCoords::ToPixelData Error");
return p;
}
+2 -6
View File
@@ -16,7 +16,7 @@
#include "Game/Systems/PickupSpawnSystem.h"
#include "Game/Systems/AmmoPickupSystem.h"
#include "Game/Systems/DamageIndicatorSystem.h"
#include "Game/Systems/Weapon/DefenderWeaponBehaviour.h"
#include "Game/Systems/Weapon/WeaponSystem.h"
#include "Rendering/AnimationSystem.h"
#include "Game/Systems/HealthHUDSystem.h"
#include "Rendering/BoneAttachmentSystem.h"
@@ -98,10 +98,6 @@ Game::Game(int argc, char* argv[])
m_NetworkClient->Connect(m_NetworkAddress, m_NetworkPort);
m_Renderer->SetWindowTitle(m_Renderer->WindowTitle() + " CLIENT");
}
} else {
// If network is disabled, pretend we're a server
m_IsClient = true;
m_IsServer = true;
}
// Create Octrees
@@ -124,7 +120,7 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<SpawnerSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PlayerSpawnSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<DefenderWeaponBehaviour>(updateOrderLevel, m_Renderer, m_OctreeCollision);
m_SystemPipeline->AddSystem<WeaponSystem>(updateOrderLevel, m_Renderer, m_OctreeCollision);
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
@@ -13,7 +13,6 @@ bool MultiplayerSnapshotFilter::FilterComponent(EntityWrapper entity, SharedComp
component.Info.Name == "Transform"
|| component.Info.Name == "Physics"
|| component.Info.Name == "AssaultWeapon"
|| component.Info.Name == "DefenderWeapon"
|| component.Info.Name == "Animation"
|| component.Info.Name == "AnimationOffset"
|| entity.Name() == "PlayerName"
+1 -1
View File
@@ -13,7 +13,7 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
}
void DamageIndicatorSystem::Update(double dt) {
if (!IsServer && LocalPlayer.Valid()) {
if (!IsServer) {
for (auto& iter = updateDamageIndicatorVector.begin(); iter != updateDamageIndicatorVector.end(); iter++) {
if (!iter->spriteEntity.Valid()) {
updateDamageIndicatorVector.erase(iter);
+1 -1
View File
@@ -36,7 +36,7 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
}
// Find any SpawnPoints existing as children of spawner
auto children = spawner.World->GetDirectChildren(spawner.ID);
auto children = spawner.World->GetChildren(spawner.ID);
std::vector<EntityWrapper> spawnPoints;
for (auto kv = children.first; kv != children.second; ++kv) {
const EntityID& child = kv->second;
@@ -1,5 +1,13 @@
#include "Systems/Weapon/AssaultWeaponBehaviour.h"
AssaultWeaponBehaviour::AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper player)
: WeaponBehaviour(systemParams, renderer, collisionOctree, player)
{
m_FirstPersonModel = m_Player.FirstChildByName("Hands");
m_ThirdPersonModel = m_Player.FirstChildByName("PlayerModel");
EVENT_SUBSCRIBE_MEMBER(m_EAnimationComplete, &AssaultWeaponBehaviour::OnAnimationComplete);
}
void AssaultWeaponBehaviour::Fire()
{
m_TimeSinceLastFire = 0.0;
@@ -28,7 +36,7 @@ void AssaultWeaponBehaviour::Reload()
return;
}
// Don't reload if we're completely out of ammo
// Don't reload if we're completly out of ammo
if (ammo == 0) {
playEmptySound();
m_TimeSinceLastFire = -0.0f; // HACK: To make empty sound play with interval
@@ -48,14 +56,14 @@ void AssaultWeaponBehaviour::Update(double dt)
{
if (m_Reloading) {
m_ReloadTimer -= dt;
// Re-enable glow on reload impostor half-way through the animation
// Re-enable glow on reload impersonator half-way through the animation
if (IsClient) {
if (m_ReloadTimer <= (double)m_Player["AssaultWeapon"]["ReloadTime"] / 2.0) {
if (m_FirstPersonReloadImpostor.Valid()) {
m_FirstPersonReloadImpostor["Model"]["GlowMap"] = true;
if (m_FirstPersonReloadImpersonator.Valid()) {
m_FirstPersonReloadImpersonator["Model"]["GlowMap"] = true;
}
if (m_ThirdPersonReloadImpostor.Valid()) {
m_ThirdPersonReloadImpostor["Model"]["GlowMap"] = true;
if (m_ThirdPersonReloadImpersonator.Valid()) {
m_ThirdPersonReloadImpersonator["Model"]["GlowMap"] = true;
}
}
}
@@ -88,6 +96,21 @@ void AssaultWeaponBehaviour::Update(double dt)
}
}
bool AssaultWeaponBehaviour::OnAnimationComplete(Events::AnimationComplete& e)
{
if (e.Entity != m_FirstPersonModel) {
return false;
}
//if (e.Name == "ShootRifle") {
// if (!m_Firing) {
// playIdleAnimation();
// }
//}
return true;
}
bool AssaultWeaponBehaviour::hasAmmo()
{
ComponentWrapper& cAssaultWeapon = m_Player["AssaultWeapon"];
@@ -154,6 +177,7 @@ void AssaultWeaponBehaviour::spawnTracer()
float AssaultWeaponBehaviour::traceRayDistance(glm::vec3 origin, glm::vec3 direction)
{
// TODO: Cast a ray and size tracer appropriately
float distance;
glm::vec3 pos;
auto entity = Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos);
@@ -191,12 +215,6 @@ void AssaultWeaponBehaviour::playEmptySound()
void AssaultWeaponBehaviour::viewPunch()
{
// Since we send absolute client orientations to server, running this server side would
// cause aim desync.
if (!IsClient) {
return;
}
EntityWrapper playerCamera = m_Player.FirstChildByName("Camera");
if (!playerCamera.Valid()) {
return;
@@ -305,8 +323,8 @@ void AssaultWeaponBehaviour::playReloadAnimation()
EntityWrapper firstPersonWeaponModel = m_Player.FirstChildByName("WeaponModel");
EntityWrapper reloadSpawner = m_Player.FirstChildByName("FirstPersonReloadSpawner");
if (IsClient) {
m_FirstPersonReloadImpostor = SpawnerSystem::Spawn(reloadSpawner, reloadSpawner);
firstPersonWeaponModel["Model"].Copy(m_FirstPersonReloadImpostor["Model"]);
m_FirstPersonReloadImpersonator = SpawnerSystem::Spawn(reloadSpawner, reloadSpawner);
firstPersonWeaponModel["Model"].Copy(m_FirstPersonReloadImpersonator["Model"]);
}
firstPersonWeaponModel["Model"]["Visible"] = false;
}
@@ -314,8 +332,8 @@ void AssaultWeaponBehaviour::playReloadAnimation()
EntityWrapper thirdPersonWeaponModel = m_Player.FirstChildByName("ThirdPersonWeaponModel");
EntityWrapper reloadSpawner = m_Player.FirstChildByName("ThirdPersonReloadSpawner");
if (IsClient) {
m_ThirdPersonReloadImpostor = SpawnerSystem::Spawn(reloadSpawner, reloadSpawner);
thirdPersonWeaponModel["Model"].Copy(m_ThirdPersonReloadImpostor["Model"]);
m_ThirdPersonReloadImpersonator = SpawnerSystem::Spawn(reloadSpawner, reloadSpawner);
thirdPersonWeaponModel["Model"].Copy(m_ThirdPersonReloadImpersonator["Model"]);
}
thirdPersonWeaponModel["Model"]["Visible"] = false;
}
@@ -353,7 +371,7 @@ bool AssaultWeaponBehaviour::shoot(double damage)
return false;
}
// Don't let us shoot ourselves in the foot somehow
// Don't let us shoot ourselves in the foot
if (victim == LocalPlayer) {
return false;
}
@@ -1,188 +0,0 @@
#include "Systems/Weapon/DefenderWeaponBehaviour.h"
void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt)
{
(double&)cWeapon["TimeSinceLastFire"] += dt;
WeaponBehaviour::UpdateComponent(entity, cWeapon, dt);
}
void DefenderWeaponBehaviour::UpdateWeapon(WeaponInfo& wi, double dt)
{
ComponentWrapper cWeapon = wi.GetComponent();
bool isFiring = cWeapon["IsFiring"];
bool cooldownPassed = (double)cWeapon["TimeSinceLastFire"] >= (60.0 / (double)cWeapon["RPM"]);
bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0;
if (isFiring && cooldownPassed && isNotShielding) {
fireShell(wi);
}
}
void DefenderWeaponBehaviour::OnPrimaryFire(WeaponInfo& wi)
{
ComponentWrapper cWeapon = wi.GetComponent();
cWeapon["IsFiring"] = true;
bool cooldownPassed = (double)cWeapon["TimeSinceLastFire"] >= (60.0 / (double)cWeapon["RPM"]);
bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0;
if (cooldownPassed && isNotShielding) {
fireShell(wi);
}
}
void DefenderWeaponBehaviour::OnCeasePrimaryFire(WeaponInfo& wi)
{
ComponentWrapper cWeapon = wi.GetComponent();
cWeapon["IsFiring"] = false;
}
bool DefenderWeaponBehaviour::OnInputCommand(WeaponInfo& wi, const Events::InputCommand& e)
{
if (e.Command == "SpecialAbility" && IsServer) {
EntityWrapper attachment = wi.Player.FirstChildByName("ShieldAttachment");
if (attachment.Valid()) {
if (e.Value > 0) {
SpawnerSystem::Spawn(attachment, attachment);
} else {
attachment.DeleteChildren();
}
}
}
return false;
}
bool DefenderWeaponBehaviour::OnSetCamera(const Events::SetCamera& e)
{
m_CurrentCamera = e.CameraEntity;
return true;
}
void DefenderWeaponBehaviour::fireShell(WeaponInfo& wi)
{
ComponentWrapper cWeapon = wi.GetComponent();
cWeapon["TimeSinceLastFire"] = 0.0;
int numPellets = cWeapon["NumPellets"];
float spreadAngle = cWeapon["SpreadAngle"];
std::uniform_real_distribution<float> randomSpreadAngle(-spreadAngle, spreadAngle);
// Calculate pellet angles
// HACK: Random for now?
// TODO: Make distribution even for each quadrant
std::vector<glm::vec2> pelletAngles;
for (int i = 0; i < numPellets; i++) {
pelletAngles.push_back(glm::vec2(randomSpreadAngle(m_RandomEngine), randomSpreadAngle(m_RandomEngine)));
LOG_DEBUG("%f %f", pelletAngles[i].x, pelletAngles[i].y);
}
double pelletDamage = (double)cWeapon["BaseDamage"] / numPellets;
// Tracers
EntityWrapper weaponModelEntity;
if (wi.Player == LocalPlayer) {
weaponModelEntity = wi.FirstPersonEntity;
} else {
weaponModelEntity = wi.ThirdPersonEntity;
}
if (weaponModelEntity.Valid()) {
EntityWrapper spawner = weaponModelEntity.FirstChildByName("WeaponMuzzle");
for (auto& angles : pelletAngles) {
glm::vec3 direction = Transform::AbsoluteOrientation(spawner) * glm::quat(glm::vec3(angles, 0.f)) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(Transform::AbsolutePosition(spawner), direction);
EntityWrapper ray = SpawnerSystem::Spawn(spawner);
((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f);
glm::vec3& orientation = ray["Transform"]["Orientation"];
orientation.x += angles.x;
orientation.y += angles.y;
glm::vec3 trajectory = direction * distance;
dealDamage(wi, direction, pelletDamage);
}
}
}
void DefenderWeaponBehaviour::dealDamage(WeaponInfo& wi, glm::vec3 direction, double damage)
{
// Only deal damage client side
if (!IsClient) {
return;
}
// Only handle shooting for the local player
if (wi.Player != LocalPlayer) {
return;
}
// Make sure the player isn't shooting from the grave
if (!wi.Player.Valid()) {
return;
}
glm::vec3 maxRange = direction * 2.f;
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
glm::vec3 cameraPosition = Transform::AbsolutePosition(camera);
if (!camera.Valid()) {
return;
}
Rectangle screenResolution = m_Renderer->GetViewportSize();
glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2);
glm::vec2 screenCoords = cameraFromEntity(m_CurrentCamera).WorldToScreen(cameraPosition + maxRange, m_Renderer->GetViewportSize());
PickData pickData = m_Renderer->Pick(centerScreen + screenCoords);
EntityWrapper victim(m_World, pickData.Entity);
if (!victim.Valid()) {
return;
}
// Don't let us shoot ourselves in the foot somehow
if (victim == LocalPlayer) {
return;
}
// Only care about players being hit
if (!victim.HasComponent("Player")) {
victim = victim.FirstParentWithComponent("Player");
}
if (!victim.Valid()) {
return;
}
// Check for friendly fire
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
return;
}
// Deal damage!
Events::PlayerDamage ePlayerDamage;
ePlayerDamage.Inflictor = wi.Player;
ePlayerDamage.Victim = victim;
ePlayerDamage.Damage = damage;
m_EventBroker->Publish(ePlayerDamage);
LOG_DEBUG("Damage: %f", damage);
}
float DefenderWeaponBehaviour::traceRayDistance(glm::vec3 origin, glm::vec3 direction)
{
float distance;
glm::vec3 pos;
auto entity = Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos);
if (entity) {
return distance;
} else {
return 100.f;
}
}
Camera DefenderWeaponBehaviour::cameraFromEntity(EntityWrapper camera)
{
ComponentWrapper cTransform = camera["Transform"];
ComponentWrapper cCamera = camera["Camera"];
Camera cam(
(float)m_Renderer->Resolution().Width / m_Renderer->Resolution().Height,
(double)cCamera["FOV"],
(double)cCamera["NearClip"],
(double)cCamera["FarClip"]
);
cam.SetPosition(cTransform["Position"]);
cam.SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
return cam;
}
@@ -13,7 +13,7 @@ WeaponSystem::WeaponSystem(SystemParams params, IRenderer* renderer, Octree<Enti
void WeaponSystem::Update(double dt)
{
// TODO: Clear inactive weapons
}
void WeaponSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt)
@@ -72,64 +72,20 @@ bool WeaponSystem::OnInputCommand(Events::InputCommand& e)
void WeaponSystem::selectWeapon(EntityWrapper player, ComponentInfo::EnumType slot)
{
std::vector<EntityWrapper> weaponAttachments = player.ChildrenWithComponent("WeaponAttachment");
// Find the weapon attachments matching the slot selected
EntityWrapper firstPersonAttachment;
EntityWrapper thirdPersonAttachment;
for (auto& attachment : weaponAttachments) {
ComponentWrapper cWeaponAttachment = attachment["WeaponAttachment"];
if ((ComponentInfo::EnumType)cWeaponAttachment["Slot"] == slot) {
ComponentWrapper::SubscriptProxy person = cWeaponAttachment["Person"];
if (person == person.Enum("FirstPerson")) {
firstPersonAttachment = attachment;
} else if (person == person.Enum("ThirdPerson")) {
thirdPersonAttachment = attachment;
}
}
}
if (firstPersonAttachment.Valid() && thirdPersonAttachment.Valid()) {
LOG_WARNING("No weapon attachment found for slot %i of player #%i", slot, player.ID);
return;
}
// TODO: Delete old weapons
// Spawn the weapon(s)
EntityWrapper firstPersonWeapon;
EntityWrapper thirdPersonWeapon;
if (firstPersonAttachment.Valid()) {
firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment);
}
if (thirdPersonAttachment.Valid()) {
firstPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment);
}
// Create the correct behaviour
if (firstPersonWeapon.Valid()) {
if (firstPersonWeapon.HasComponent("AssaultWeapon") {
}
}
// Primary
if (slot == 1) {
// TODO: if class...
nextBehaviour = std::make_shared<AssaultWeaponBehaviour>(m_SystemParams, m_Renderer, m_CollisionOctree, player);
if (m_ActiveWeapons.count(player) == 0) {
m_ActiveWeapons.insert(std::make_pair(player, std::make_shared<AssaultWeaponBehaviour>(m_SystemParams, m_Renderer, m_CollisionOctree, player)));
} else {
//m_ActiveWeapons.erase(player);
}
}
// Secondary
if (slot == 2) {
//m_ActiveWeapons[player] = std::make_shared<PistolWeaponBehaviour>();
}
if (nextBehaviour != nullptr) {
// TODO: Destroy previous behaviour and make new
if (m_ActiveWeapons.count(player) == 0) {
m_ActiveWeapons[player] = nextBehaviour;
}
}
}
bool WeaponSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
-2
View File
@@ -9,9 +9,7 @@ int main(int argc, char* argv[])
Game game(argc, argv);
while (game.Running()) {
PerformanceTimer::StartTimer("Game-Tick");
game.Tick();
PerformanceTimer::StopTimer("Game-Tick");
}
return 0;