Cleanup stuff in #2019

This commit is contained in:
2024-02-18 19:48:43 +01:00
parent 45aa0e1b65
commit a2b8312fba
30 changed files with 252 additions and 1756 deletions
+16 -128
View File
@@ -15,7 +15,6 @@ struct Matrix3x3;
struct Viewport;
struct TextRange;
class Font;
class FontFallbackList;
class GPUPipelineState;
class GPUTexture;
class GPUTextureView;
@@ -34,7 +33,7 @@ API_CLASS(Static) class FLAXENGINE_API Render2D
/// <summary>
/// The rendering features and options flags.
/// </summary>
API_ENUM(Attributes = "Flags") enum class RenderingFeatures
API_ENUM(Attributes="Flags") enum class RenderingFeatures
{
/// <summary>
/// The none.
@@ -45,6 +44,11 @@ API_CLASS(Static) class FLAXENGINE_API Render2D
/// Enables automatic geometry vertices snapping to integer coordinates in screen space. Reduces aliasing and sampling artifacts. Might be disabled for 3D projection viewport or for complex UI transformations.
/// </summary>
VertexSnapping = 1,
/// <summary>
/// Enables automatic characters usage from fallback fonts.
/// </summary>
FallbackFonts = 2,
};
struct CustomData
@@ -54,7 +58,6 @@ API_CLASS(Static) class FLAXENGINE_API Render2D
};
public:
/// <summary>
/// Checks if interface is during rendering phrase (Draw calls may be performed without failing).
/// </summary>
@@ -70,10 +73,6 @@ public:
/// </summary>
API_FIELD() static RenderingFeatures Features;
API_FIELD() static bool EnableFontFallback;
API_FIELD() static FontFallbackList* FallbackFonts;
/// <summary>
/// Called when frame rendering begins by the graphics device.
/// </summary>
@@ -180,17 +179,17 @@ public:
public:
/// <summary>
/// Draws a text, with font fallbacking disabled.
/// Draws a text.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
/// <param name="color">The text color.</param>
/// <param name="location">The text location.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, const StringView& text, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr);
API_FUNCTION() static void DrawText(Font* font, const StringView& text, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text, with font fallbacking disabled.
/// Draws a text.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
@@ -198,20 +197,20 @@ public:
/// <param name="color">The text color.</param>
/// <param name="location">The text location.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr);
API_FUNCTION() static void DrawText(Font* font, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text with formatting, with font fallbacking disabled.
/// Draws a text with formatting.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, const StringView& text, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr);
API_FUNCTION() static void DrawText(Font* font, const StringView& text, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text with formatting, with font fallbacking disabled.
/// Draws a text with formatting.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
@@ -219,120 +218,7 @@ public:
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text, using custom fallback options.
/// </summary>
/// <param name="fonts">The fonts to use, ordered by priority.</param>
/// <param name="text">The text to render.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="color">The text color.</param>
/// <param name="location">The text location.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, FontFallbackList* fallbacks, const StringView& text, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text with formatting, using custom fallback options.
/// </summary>
/// <param name="fonts">The fonts to use, ordered by priority.</param>
/// <param name="text">The text to render.</param>
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text with formatting, using custom fallback options.
/// </summary>
/// <param name="fonts">The fonts to use, ordered by priority.</param>
/// <param name="text">The text to render.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, FontFallbackList* fallbacks, const StringView& text, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text with formatting, using custom fallback options.
/// </summary>
/// <param name="fonts">The fonts to use, ordered by priority.</param>
/// <param name="text">The text to render.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() static void DrawTextInternal(Font* font, FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Draws a text, follows the fallback settings defined in <see cref="Render2D" />.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
/// <param name="color">The text color.</param>
/// <param name="location">The text location.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() FORCE_INLINE static void DrawText(Font* font, const StringView& text, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr) {
if (EnableFontFallback && FallbackFonts) {
DrawTextInternal(font, FallbackFonts, text, color, location, customMaterial);
}
else {
DrawTextInternal(font, text, color, location, customMaterial);
}
}
/// <summary>
/// Draws a text, follows the fallback settings defined in <see cref="Render2D" />.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="color">The text color.</param>
/// <param name="location">The text location.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() FORCE_INLINE static void DrawText(Font* font, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, const Float2& location, MaterialBase* customMaterial = nullptr) {
if (EnableFontFallback && FallbackFonts) {
DrawTextInternal(font, FallbackFonts, text, textRange, color, location, customMaterial);
}
else {
DrawTextInternal(font, text, textRange, color, location, customMaterial);
}
}
/// <summary>
/// Draws a text with formatting, follows the fallback settings defined in <see cref="Render2D" />.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() FORCE_INLINE static void DrawText(Font* font, const StringView& text, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr) {
if (EnableFontFallback && FallbackFonts) {
DrawTextInternal(font, FallbackFonts, text, color, layout, customMaterial);
}
else {
DrawTextInternal(font, text, color, layout, customMaterial);
}
}
/// <summary>
/// Draws a text with formatting, follows the fallback settings defined in <see cref="Render2D" />.
/// </summary>
/// <param name="font">The font to use.</param>
/// <param name="text">The text to render.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="color">The text color.</param>
/// <param name="layout">The text layout properties.</param>
/// <param name="customMaterial">The custom material for font characters rendering. It must contain texture parameter named Font used to sample font texture.</param>
API_FUNCTION() FORCE_INLINE static void DrawText(Font* font, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr) {
if (EnableFontFallback && FallbackFonts) {
DrawTextInternal(font, FallbackFonts, text, textRange, color, layout, customMaterial);
}
else {
DrawTextInternal(font, text, textRange, color, layout, customMaterial);
}
}
API_FUNCTION() static void DrawText(Font* font, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Color& color, API_PARAM(Ref) const TextLayoutOptions& layout, MaterialBase* customMaterial = nullptr);
/// <summary>
/// Fills a rectangle area.
@@ -571,3 +457,5 @@ public:
/// <param name="color">The color.</param>
API_FUNCTION() static void FillTriangle(const Float2& p0, const Float2& p1, const Float2& p2, const Color& color);
};
DECLARE_ENUM_OPERATORS(Render2D::RenderingFeatures);