Fixed perspective projection issues. devel/vulkan
authorAngelos Gkountis <a.gkountis@samsung.com>
Wed, 13 Jun 2018 15:03:35 +0000 (16:03 +0100)
committerAngelos Gkountis <a.gkountis@samsung.com>
Wed, 13 Jun 2018 15:03:35 +0000 (16:03 +0100)
> Changed the projection correction matrix to correctly negate the Z axis to match DALi's coordinate system.
> Changed the front face winding order to match the Z axis inversion.

Change-Id: I8dfe7efa35e96ea9465085429b6b40f34781c259

dali/internal/update/graphics/graphics-algorithms.cpp

index d253c59..fc0903f 100644 (file)
@@ -32,6 +32,7 @@
 #include <dali/internal/update/rendering/scene-graph-geometry.h>
 #include <dali/internal/update/rendering/scene-graph-property-buffer.h>
 #include <dali/internal/update/rendering/scene-graph-shader.h>
+#include "../../../graphics-api/graphics-api-types.h"
 
 namespace Dali
 {
@@ -43,7 +44,10 @@ namespace
 {
 
 static constexpr float CLIP_MATRIX_DATA[] = {
-  1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 1.0f
+  1.0f, 0.0f, 0.0f, 0.0f,
+  0.0f, -1.0f, 0.0f, 0.0f,
+  0.0f, 0.0f, -0.5f, 0.0f,
+  0.0f, 0.0f, 0.5f, 1.0f
 };
 static const Matrix CLIP_MATRIX(CLIP_MATRIX_DATA);
 
@@ -371,9 +375,9 @@ bool PrepareGraphicsPipeline( Graphics::API::Controller& controller,
 
                 // rasterization
               .SetRasterizationState(RasterizationState()
-                                       .SetCullMode(CullMode::NONE)
+                                       .SetCullMode(CullMode::BACK)
                                        .SetPolygonMode(PolygonMode::FILL)
-                                       .SetFrontFace(FrontFace::CLOCKWISE)));
+                                       .SetFrontFace(FrontFace::COUNTER_CLOCKWISE)));
 
     // bind pipeline to the renderer
     renderer->BindPipeline(std::move(pipeline));