Minor tweaks to #716

This commit is contained in:
Wojtek Figat
2022-06-14 19:56:58 +02:00
parent 8eb59703bd
commit 7c923198e0
5 changed files with 9 additions and 10 deletions

View File

@@ -867,7 +867,7 @@ namespace FlaxEditor.Surface.Archetypes
{ {
TypeID = 39, TypeID = 39,
Title = "View Size", Title = "View Size",
Description = "The size of the view.", Description = "The size of the view. The draw rectangle size in GUI materials.",
Flags = NodeFlags.MaterialGraph, Flags = NodeFlags.MaterialGraph,
Size = new Float2(150, 40), Size = new Float2(150, 40),
Elements = new[] Elements = new[]

View File

@@ -47,8 +47,7 @@ void GUIMaterialShader::Bind(BindParameters& params)
// Setup material constants // Setup material constants
{ {
const auto viewProjectionMatrix = customData->ViewProjection; Matrix::Transpose(customData->ViewProjection, materialData->ViewProjectionMatrix);
Matrix::Transpose(viewProjectionMatrix, materialData->ViewProjectionMatrix);
Matrix::Transpose(Matrix::Identity, materialData->WorldMatrix); Matrix::Transpose(Matrix::Identity, materialData->WorldMatrix);
Matrix::Transpose(Matrix::Identity, materialData->ViewMatrix); Matrix::Transpose(Matrix::Identity, materialData->ViewMatrix);
materialData->ViewPos = Float3::Zero; materialData->ViewPos = Float3::Zero;

View File

@@ -562,7 +562,6 @@ void CachedPSO::Dispose()
class Render2DService : public EngineService class Render2DService : public EngineService
{ {
public: public:
Render2DService() Render2DService()
: EngineService(TEXT("Render2D"), 10) : EngineService(TEXT("Render2D"), 10)
{ {
@@ -1130,7 +1129,7 @@ void DrawBatch(int32 startIndex, int32 count)
break; break;
#if !BUILD_RELEASE #if !BUILD_RELEASE
default: default:
CRASH; CRASH;
#endif #endif
} }

View File

@@ -28,7 +28,7 @@ class TextureBase;
/// </summary> /// </summary>
API_CLASS(Static) class FLAXENGINE_API Render2D API_CLASS(Static) class FLAXENGINE_API Render2D
{ {
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Render2D); DECLARE_SCRIPTING_TYPE_NO_SPAWN(Render2D);
/// <summary> /// <summary>
/// The rendering features and options flags. /// The rendering features and options flags.
@@ -46,7 +46,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Render2D);
VertexSnapping = 1, VertexSnapping = 1,
}; };
public:
struct CustomData struct CustomData
{ {
Matrix ViewProjection; Matrix ViewProjection;
@@ -54,7 +53,6 @@ public:
}; };
public: public:
/// <summary> /// <summary>
/// Checks if interface is during rendering phrase (Draw calls may be performed without failing). /// Checks if interface is during rendering phrase (Draw calls may be performed without failing).
/// </summary> /// </summary>
@@ -122,7 +120,6 @@ public:
static void EndFrame(); static void EndFrame();
public: public:
/// <summary> /// <summary>
/// Pushes transformation layer. /// Pushes transformation layer.
/// </summary> /// </summary>
@@ -176,7 +173,6 @@ public:
API_FUNCTION() static void PopTint(); API_FUNCTION() static void PopTint();
public: public:
/// <summary> /// <summary>
/// Draws a text. /// Draws a text.
/// </summary> /// </summary>

View File

@@ -488,6 +488,11 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
{ {
value = Value(VariantType::Float2, box->ID == 0 ? TEXT("ViewSize.xy") : TEXT("ViewSize.zw")); value = Value(VariantType::Float2, box->ID == 0 ? TEXT("ViewSize.xy") : TEXT("ViewSize.zw"));
} }
else
{
// Fallback to Screen Size
value = Value(VariantType::Float2, box->ID == 0 ? TEXT("ScreenSize.xy") : TEXT("ScreenSize.zw"));
}
break; break;
} }
default: default: