diff --git a/assets b/assets
index bf5fd580..9b2fa74a 160000
--- a/assets
+++ b/assets
@@ -1 +1 @@
-Subproject commit bf5fd580e03cf8cb67ad2627e6cf53af6e5346f9
+Subproject commit 9b2fa74a6d535d512c13429997385f7aa3fb50f5
diff --git a/include/Engine/Rendering/DrawFinalPass.h b/include/Engine/Rendering/DrawFinalPass.h
index acb5cd13..74f505fe 100644
--- a/include/Engine/Rendering/DrawFinalPass.h
+++ b/include/Engine/Rendering/DrawFinalPass.h
@@ -41,6 +41,7 @@ private:
Texture* m_WhiteTexture;
Texture* m_BlackTexture;
Texture* m_NeutralNormalTexture;
+ Texture* m_GreyTexture;
FrameBuffer m_FinalPassFrameBuffer;
GLuint m_BloomTexture;
diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h
index d5a2d880..2cb2169c 100644
--- a/include/Engine/Rendering/ModelJob.h
+++ b/include/Engine/Rendering/ModelJob.h
@@ -22,10 +22,26 @@ struct ModelJob : RenderJob
{
Model = model;
TextureID = (matGroup.Texture) ? matGroup.Texture->ResourceID : 0;
- DiffuseTexture = matGroup.Texture.get();
- NormalTexture = matGroup.NormalMap.get();
- SpecularTexture = matGroup.SpecularMap.get();
- IncandescenceTexture = matGroup.IncandescenceMap.get();
+ if (modelComponent["DiffuseTexture"]) {
+ DiffuseTexture = matGroup.Texture.get();
+ } else {
+ DiffuseTexture = nullptr;
+ }
+ if (modelComponent["NormalMap"]) {
+ NormalTexture = matGroup.NormalMap.get();
+ } else {
+ NormalTexture = nullptr;
+ }
+ if (modelComponent["SpecularMap"]) {
+ SpecularTexture = matGroup.SpecularMap.get();
+ } else {
+ SpecularTexture = nullptr;
+ }
+ if (modelComponent["GlowMap"]) {
+ IncandescenceTexture = matGroup.IncandescenceMap.get();
+ } else {
+ IncandescenceTexture = nullptr;
+ }
DiffuseColor = matGroup.DiffuseColor;
SpecularColor = matGroup.SpecularColor;
IncandescenceColor = matGroup.IncandescenceColor;
diff --git a/resources/Schema/Components/Model.xml b/resources/Schema/Components/Model.xml
index b25c8828..4b77dacb 100644
--- a/resources/Schema/Components/Model.xml
+++ b/resources/Schema/Components/Model.xml
@@ -4,4 +4,8 @@
false
true
+ true
+ true
+ true
+ true
\ No newline at end of file
diff --git a/resources/Schema/Components/Model.xsd b/resources/Schema/Components/Model.xsd
index 0ea04d72..178d8b31 100644
--- a/resources/Schema/Components/Model.xsd
+++ b/resources/Schema/Components/Model.xsd
@@ -21,6 +21,18 @@
Wether the model is visible or not
+
+ Whether the model should use the Diffuse texture or not
+
+
+ Whether the model should use the Normalmap or not
+
+
+ Whether the model should use the Specularmap or not
+
+
+ Whether the model should use the Glowmap or not
+
diff --git a/resources/Schema/Entities/EditorTestWorld.xml b/resources/Schema/Entities/EditorTestWorld.xml
index 5649a630..9565e2d4 100755
--- a/resources/Schema/Entities/EditorTestWorld.xml
+++ b/resources/Schema/Entities/EditorTestWorld.xml
@@ -6,7 +6,7 @@
-
+
Models/Core/UnitCube.mesh
@@ -18,69 +18,51 @@
-
-
-
- An error
-
-
-
-
-
-
-
-
-
-
- An error
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+ 0.80000001192092896
+
Models/DirectionalLightWidget.mesh
+
+ 1.0499999523162842
+
+
-
+
-
+
Models/Assault.mesh
-
+
+
-
+
- Models/SecondaryWeapon.fbx
+ Models/SecondaryWeapon.mesh
@@ -91,17 +73,219 @@
-
+
+
+
+
+
+
+
+
+
+
+
+ Run
+
+ 1
+
+
+ models/AssaultAnimated.mesh
+
+
+
+
+
+
+
+
+
+
+ Walk
+
+ 1
+
+
+ models/AssaultAnimated.mesh
+
+
+
+
+
+
+
+ Models/Core/UnitSphere.mesh
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
- Models/Core/UnitSphere.mesh
+ Models/Log.mesh
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Models/NormalMapSphere.mesh
+
+
+
+
+
+
+
+
+
+
+ Models/SpecularMapSphere.mesh
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ Models/Core/UnitSphere.mesh
+
+
+
+ 3
+ 1.1399998664855957
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Models/IncandescenceMapSphere.mesh
+
+
+
+
+
+
+
+
+
+
+ models/NormSpecIncdMapSphere.mesh
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ Models/Core/UnitSphere.mesh
+
+
+
+ 3
+ 1.1399998664855957
+
+
+
+
+
+
+
+
+
+
+
+ Models/Core/UnitSphere.mesh
+
+
+
+ 5.0100002288818359
+ 0.69999998807907104
+
+
+
+
+
+
+
+
+
+
+
+ Models/Core/UnitSphere.mesh
+
+
+
+ 4
+ 0.80000001192092896
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/Schema/Entities/PointLightWithModel.xml b/resources/Schema/Entities/PointLightWithModel.xml
new file mode 100644
index 00000000..17ca950c
--- /dev/null
+++ b/resources/Schema/Entities/PointLightWithModel.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Models/Core/UnitSphere.mesh
+
+
+
+ 3
+ 1.1399998664855957
+
+
+
+
+
+
+
+
+
diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl
index 7d27ca04..de672dd1 100644
--- a/resources/Shaders/ForwardPlus.frag.glsl
+++ b/resources/Shaders/ForwardPlus.frag.glsl
@@ -10,7 +10,8 @@ uniform vec4 FillColor;
uniform float FillPercentage;
layout (binding = 0) uniform sampler2D DiffuseTexture;
layout (binding = 1) uniform sampler2D NormalMapTexture;
-layout (binding = 2) uniform sampler2D GlowMapTexture;
+layout (binding = 2) uniform sampler2D SpecularMapTexture;
+layout (binding = 3) uniform sampler2D GlowMapTexture;
#define TILE_SIZE 16
@@ -116,6 +117,7 @@ void main()
{
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate);
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate);
+ vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate);
vec4 position = V * M * vec4(Input.Position, 1.0);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, NormalMapTexture);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
@@ -149,7 +151,7 @@ void main()
}
- vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + totalLighting.Specular) * diffuseTexel * Color;
+ vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp
index a284a773..3aff3ae8 100644
--- a/src/Engine/Rendering/DrawFinalPass.cpp
+++ b/src/Engine/Rendering/DrawFinalPass.cpp
@@ -14,6 +14,7 @@ void DrawFinalPass::InitializeTextures()
m_WhiteTexture = ResourceManager::Load("Textures/Core/White.png");
m_BlackTexture = ResourceManager::Load("Textures/Core/Black.png");
m_NeutralNormalTexture = ResourceManager::Load("Textures/Core/NeutralNormalMap.png");
+ m_GreyTexture = ResourceManager::Load("Textures/Core/Grey.png");
}
void DrawFinalPass::InitializeFrameBuffers()
@@ -240,6 +241,13 @@ void DrawFinalPass::BindModelTextures(std::shared_ptr& job)
}
glActiveTexture(GL_TEXTURE2);
+ if (job->SpecularTexture != nullptr) {
+ glBindTexture(GL_TEXTURE_2D, job->SpecularTexture->m_Texture);
+ } else {
+ glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
+ }
+
+ glActiveTexture(GL_TEXTURE3);
if (job->IncandescenceTexture != nullptr) {
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture->m_Texture);
} else {