diff --git a/include/Engine/Rendering/PickingPass.h b/include/Engine/Rendering/PickingPass.h
index 2ce2e78d..d7a340f1 100644
--- a/include/Engine/Rendering/PickingPass.h
+++ b/include/Engine/Rendering/PickingPass.h
@@ -40,7 +40,7 @@ private:
const IRenderer* m_Renderer;
ShaderProgram* m_PickingProgram;
- ShaderProgram* m_PickingSkinnedProgram;
+ ShaderProgram* m_PickingSkinnedProgram;
Camera* m_Camera;
struct PickingInfo
diff --git a/include/Engine/Rendering/SpriteJob.h b/include/Engine/Rendering/SpriteJob.h
index 3bb43a1c..4fe19dca 100644
--- a/include/Engine/Rendering/SpriteJob.h
+++ b/include/Engine/Rendering/SpriteJob.h
@@ -40,7 +40,8 @@ struct SpriteJob : RenderJob
Depth = viewpos.z;
}
World = world;
-
+ Pickable = world->HasComponent(cSprite.EntityID, "Button");
+
FillColor = fillColor;
FillPercentage = fillPercentage;
};
@@ -60,6 +61,7 @@ struct SpriteJob : RenderJob
unsigned int StartIndex = 0;
unsigned int EndIndex = 0;
World* World;
+ bool Pickable;
glm::vec4 FillColor = glm::vec4(0);
float FillPercentage = 0.0;
diff --git a/resources/Schema/Entities/Button.xml b/resources/Schema/Entities/Button.xml
new file mode 100644
index 00000000..21f64334
--- /dev/null
+++ b/resources/Schema/Entities/Button.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+
+ Play
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml
index 40951468..30fb915b 100644
--- a/resources/Schema/Entities/QualityAssurance.xml
+++ b/resources/Schema/Entities/QualityAssurance.xml
@@ -40,7 +40,7 @@
-
+
@@ -105,7 +105,7 @@
-
+
@@ -180,7 +180,7 @@
-
+
@@ -225,7 +225,7 @@
-
+
@@ -289,7 +289,7 @@
-
+
@@ -321,7 +321,7 @@
-
+
@@ -671,7 +671,7 @@
-
+
@@ -718,7 +718,7 @@
-
+
@@ -778,7 +778,7 @@
-
+
@@ -825,7 +825,7 @@
-
+
@@ -871,7 +871,7 @@
-
+
@@ -918,7 +918,7 @@
-
+
@@ -965,7 +965,7 @@
-
+
@@ -1027,7 +1027,7 @@
Models/Core/UnitCube.mesh
-
+
true
@@ -1077,7 +1077,7 @@
Models/Core/UnitCube.mesh
-
+
true
@@ -1167,7 +1167,7 @@
Models/Core/UnitCube.mesh
-
+
true
@@ -1217,7 +1217,7 @@
Models/Core/UnitCube.mesh
-
+
true
@@ -1379,7 +1379,7 @@
-
+
@@ -1388,7 +1388,7 @@
true
- 0.75205058136495551
+ 2.5166344949826396
3.7999999523162842
true
@@ -1435,7 +1435,7 @@
-
+
@@ -1444,7 +1444,7 @@
- 1.2019563319790627
+ 0.35000808291962926
Models/Characters/Assault/AssaultTPose.mesh
@@ -1487,7 +1487,7 @@
-
+
@@ -1498,7 +1498,7 @@
true
- 0.68540211563899389
+ 0.35000808291962926
true
@@ -1543,7 +1543,7 @@
-
+
@@ -1553,7 +1553,7 @@
true
- 0.95150063648635763
+ 9.4833086749886775
10
3
@@ -1601,7 +1601,7 @@
-
+
@@ -1611,7 +1611,7 @@
true
- 1.3515288978624223
+ 4.0667207575903603
true
5
true
@@ -1678,10 +1678,10 @@
+
Models/Core/UnitCube.mesh
-
@@ -1792,7 +1792,7 @@
true
- 1.3682019578975679
+ 2.5166344949826396
3.7999999523162842
true
@@ -1836,12 +1836,12 @@
+
Models/AssaultAnimated.mesh
-
@@ -2095,7 +2095,7 @@
Textures/Core/UnitHexagon.png
-
+
@@ -2107,7 +2107,7 @@
1
-
+
Textures/Core/UnitHexagon_Rotated.png
@@ -2145,6 +2145,315 @@
+
+
+
+
+
+
+
+
+
+
+
+ Models/Widgets/Camera.mesh
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/ErrorTexture.png
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Play
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Host
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Connect
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Settings
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Quit
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+ Textures/Core/ErrorTexture.png
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Resolution
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Option2
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Butts
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Menu test area
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/Schema/Entities/TestMenu.xml b/resources/Schema/Entities/TestMenu.xml
new file mode 100644
index 00000000..73678601
--- /dev/null
+++ b/resources/Schema/Entities/TestMenu.xml
@@ -0,0 +1,299 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Models/Widgets/Camera.mesh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/ErrorTexture.png
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Play
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Host
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Connect
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Settings
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Quit
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+ Textures/Core/ErrorTexture.png
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Resolution
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Option2
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Textures/Core/White.png
+
+
+
+
+
+
+
+
+
+
+ Butts
+ Fonts/DroidSans.ttf,64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp
index c98fb1f5..fd95ecee 100644
--- a/src/Engine/Rendering/DrawFinalPass.cpp
+++ b/src/Engine/Rendering/DrawFinalPass.cpp
@@ -689,9 +689,6 @@ void DrawFinalPass::DrawSprites(std::list>&jobs, Rend
glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex*sizeof(unsigned int)));
}
}
-
-
-
// m_SpriteProgram->Unbind();
}
diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp
index ecd0a4b8..a979eb0e 100644
--- a/src/Engine/Rendering/PickingPass.cpp
+++ b/src/Engine/Rendering/PickingPass.cpp
@@ -234,6 +234,52 @@ void PickingPass::Draw(RenderScene& scene)
}
}
+ for (auto& job : scene.Jobs.SpriteJob) {
+ auto spriteJob = std::dynamic_pointer_cast(job);
+ if (!spriteJob->Pickable) {
+ continue;
+ }
+ RenderState jobState;
+
+ if (spriteJob) {
+ if (spriteJob->Depth == 0) {
+ jobState.Disable(GL_DEPTH_TEST);
+ }
+ int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
+
+ PickingInfo pickInfo;
+ pickInfo.Entity = spriteJob->Entity;
+ pickInfo.World = spriteJob->World;
+ pickInfo.Camera = scene.Camera;
+
+ auto color = m_EntityColors.find(std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera));
+ if (color != m_EntityColors.end()) {
+ pickColor[0] = color->second[0];
+ pickColor[1] = color->second[1];
+ } else {
+ m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]);
+ if (m_ColorCounter[0] > 255) {
+ m_ColorCounter[0] = 0;
+ m_ColorCounter[1] += 1;
+ } else {
+ m_ColorCounter[0] += 1;
+ }
+ }
+
+ m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
+
+ m_PickingProgram->Bind();
+ glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->Matrix));
+ glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
+ glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
+ glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
+
+ glBindVertexArray(spriteJob->Model->VAO);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, spriteJob->Model->ElementBuffer);
+ glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex * sizeof(unsigned int)));
+ }
+ }
+
/* for (auto &job : scene.Jobs.TransparentShieldedObjects) {
auto modelJob = std::dynamic_pointer_cast(job);
@@ -306,8 +352,6 @@ void PickingPass::Draw(RenderScene& scene)
delete state;
}
-
-
void PickingPass::ClearPicking()
{
m_PickingColorsToEntity.clear();