Browse Source

Added configurable Z bias to Text3D effect.
Default Text effect color changed to opaque black.

Lasse Öörni 12 years ago
parent
commit
dbd7687c56

+ 3 - 0
Docs/LuaScriptAPI.dox

@@ -4388,6 +4388,7 @@ Methods:<br>
 - void SetWordwrap(bool enable)
 - void SetWordwrap(bool enable)
 - void SetTextEffect(TextEffect textEffect)
 - void SetTextEffect(TextEffect textEffect)
 - void SetEffectColor(const Color& effectColor)
 - void SetEffectColor(const Color& effectColor)
+- void SetEffectDepthBias(float bias)
 - void SetWidth(int width)
 - void SetWidth(int width)
 - void SetColor(const Color& color)
 - void SetColor(const Color& color)
 - void SetColor(Corner corner, const Color& color)
 - void SetColor(Corner corner, const Color& color)
@@ -4404,6 +4405,7 @@ Methods:<br>
 - bool GetWordwrap() const
 - bool GetWordwrap() const
 - TextEffect GetTextEffect() const
 - TextEffect GetTextEffect() const
 - const Color& GetEffectColor() const
 - const Color& GetEffectColor() const
+- float GetEffectDepthBias() const
 - int GetWidth() const
 - int GetWidth() const
 - int GetRowHeight() const
 - int GetRowHeight() const
 - unsigned GetNumRows() const
 - unsigned GetNumRows() const
@@ -4428,6 +4430,7 @@ Properties:<br>
 - bool wordwrap
 - bool wordwrap
 - TextEffect textEffect
 - TextEffect textEffect
 - Color& effectColor
 - Color& effectColor
+- float effectDepthBias
 - int width
 - int width
 - int rowHeight (readonly)
 - int rowHeight (readonly)
 - unsigned numRows (readonly)
 - unsigned numRows (readonly)

+ 1 - 0
Docs/ScriptAPI.dox

@@ -5053,6 +5053,7 @@ Properties:<br>
 - bool wordwrap
 - bool wordwrap
 - TextEffect textEffect
 - TextEffect textEffect
 - Color effectColor
 - Color effectColor
+- float effectDepthBias
 - int width
 - int width
 - Color color (writeonly)
 - Color color (writeonly)
 - Color[] colors
 - Color[] colors

+ 1 - 0
Docs/Urho3D.dox

@@ -146,6 +146,7 @@ V1.3
 - A set of sample applications implemented in C++, AngelScript and Lua.
 - A set of sample applications implemented in C++, AngelScript and Lua.
 - Automatic node/component handle member variable serialization for AngelScript script objects.
 - Automatic node/component handle member variable serialization for AngelScript script objects.
 - New %UI theme.
 - New %UI theme.
+- Shadow & stroke effects in Text & Text3D.
 - Boolean shader uniforms.
 - Boolean shader uniforms.
 - Quick menu in the editor.
 - Quick menu in the editor.
 - %Material editor and preview in the editor.
 - %Material editor and preview in the editor.

+ 1 - 0
Readme.txt

@@ -397,6 +397,7 @@ V1.3    - Lua scripting support.
         - Automatic Node/component handle member variable serialization for
         - Automatic Node/component handle member variable serialization for
           AngelScript script objects.
           AngelScript script objects.
         - New UI theme.
         - New UI theme.
+        - Shadow & stroke effects in Text & Text3D.
         - Boolean shader uniforms.
         - Boolean shader uniforms.
         - Quick menu in the editor.
         - Quick menu in the editor.
         - Material editor and preview in the editor.
         - Material editor and preview in the editor.

+ 2 - 0
Source/Engine/Script/UIAPI.cpp

@@ -375,6 +375,8 @@ static void RegisterText3D(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Text3D", "TextEffect get_textEffect() const", asMETHOD(Text3D, GetTextEffect), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "TextEffect get_textEffect() const", asMETHOD(Text3D, GetTextEffect), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "void set_effectColor(const Color&in)", asMETHOD(Text3D, SetEffectColor), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "void set_effectColor(const Color&in)", asMETHOD(Text3D, SetEffectColor), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "const Color& get_effectColor() const", asMETHOD(Text3D, GetEffectColor), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "const Color& get_effectColor() const", asMETHOD(Text3D, GetEffectColor), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Text3D", "void set_effectDepthBias(float)", asMETHOD(Text3D, SetEffectDepthBias), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Text3D", "float get_effectDepthBias() const", asMETHOD(Text3D, GetEffectDepthBias), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "void set_width(int)", asMETHOD(Text3D, SetWidth), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "void set_width(int)", asMETHOD(Text3D, SetWidth), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "int get_width() const", asMETHOD(Text3D, GetWidth), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "int get_width() const", asMETHOD(Text3D, GetWidth), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "void set_color(const Color&in)", asMETHODPR(Text3D, SetColor, (const Color&), void), asCALL_THISCALL);
     engine->RegisterObjectMethod("Text3D", "void set_color(const Color&in)", asMETHODPR(Text3D, SetColor, (const Color&), void), asCALL_THISCALL);

+ 78 - 40
Source/Engine/UI/Text.cpp

@@ -59,7 +59,8 @@ Text::Text(Context* context) :
     selectionColor_(Color::TRANSPARENT),
     selectionColor_(Color::TRANSPARENT),
     hoverColor_(Color::TRANSPARENT),
     hoverColor_(Color::TRANSPARENT),
     textEffect_(TE_NONE),
     textEffect_(TE_NONE),
-    effectColor_(Color::TRANSPARENT),
+    effectColor_(Color::BLACK),
+    effectDepthBias_(0.0f),
     rowHeight_(0)
     rowHeight_(0)
 {
 {
     // By default Text does not derive opacity from parent elements
     // By default Text does not derive opacity from parent elements
@@ -85,7 +86,7 @@ void Text::RegisterObject(Context* context)
     REF_ACCESSOR_ATTRIBUTE(Text, VAR_COLOR, "Selection Color", GetSelectionColor, SetSelectionColor, Color, Color::TRANSPARENT, AM_FILE);
     REF_ACCESSOR_ATTRIBUTE(Text, VAR_COLOR, "Selection Color", GetSelectionColor, SetSelectionColor, Color, Color::TRANSPARENT, AM_FILE);
     REF_ACCESSOR_ATTRIBUTE(Text, VAR_COLOR, "Hover Color", GetHoverColor, SetHoverColor, Color, Color::TRANSPARENT, AM_FILE);
     REF_ACCESSOR_ATTRIBUTE(Text, VAR_COLOR, "Hover Color", GetHoverColor, SetHoverColor, Color, Color::TRANSPARENT, AM_FILE);
     ENUM_ATTRIBUTE(Text, "Text Effect", textEffect_, textEffects, TE_NONE, AM_FILE);
     ENUM_ATTRIBUTE(Text, "Text Effect", textEffect_, textEffects, TE_NONE, AM_FILE);
-    REF_ACCESSOR_ATTRIBUTE(Text, VAR_COLOR, "Effect Color", GetEffectColor, SetEffectColor, Color, Color::TRANSPARENT, AM_FILE);
+    REF_ACCESSOR_ATTRIBUTE(Text, VAR_COLOR, "Effect Color", GetEffectColor, SetEffectColor, Color, Color::BLACK, AM_FILE);
 
 
     // Change the default value for UseDerivedOpacity
     // Change the default value for UseDerivedOpacity
     context->GetAttribute<Text>("Use Derived Opacity")->defaultValue_ = false;
     context->GetAttribute<Text>("Use Derived Opacity")->defaultValue_ = false;
@@ -198,24 +199,28 @@ void Text::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData,
 
 
                 const PODVector<GlyphLocation>& pageGlyphLocation = pageGlyphLocations[n];
                 const PODVector<GlyphLocation>& pageGlyphLocation = pageGlyphLocations[n];
 
 
-                if (textEffect_ == TE_NONE)
-                    ConstructBatch(pageBatch, pageGlyphLocation, 0, 0);
-                else if (textEffect_ == TE_SHADOW)
+                switch (textEffect_)
                 {
                 {
-                    ConstructBatch(pageBatch, pageGlyphLocation, 1, 1, &effectColor_);
+                case TE_NONE:
                     ConstructBatch(pageBatch, pageGlyphLocation, 0, 0);
                     ConstructBatch(pageBatch, pageGlyphLocation, 0, 0);
-                }
-                else if (textEffect_ == TE_STROKE)
-                {
-                    ConstructBatch(pageBatch, pageGlyphLocation, -1, -1, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, 0, -1, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, 1, -1, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, -1, 0, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, 1, 0, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, -1, 1, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, 0, 1, &effectColor_);
-                    ConstructBatch(pageBatch, pageGlyphLocation, 1, 1, &effectColor_);
+                    break;
+                    
+                case TE_SHADOW:
+                    ConstructBatch(pageBatch, pageGlyphLocation, 1, 1, &effectColor_, effectDepthBias_);
                     ConstructBatch(pageBatch, pageGlyphLocation, 0, 0);
                     ConstructBatch(pageBatch, pageGlyphLocation, 0, 0);
+                    break;
+                    
+                case TE_STROKE:
+                    ConstructBatch(pageBatch, pageGlyphLocation, -1, -1, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, 0, -1, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, 1, -1, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, -1, 0, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, 1, 0, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, -1, 1, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, 0, 1, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, 1, 1, &effectColor_, effectDepthBias_);
+                    ConstructBatch(pageBatch, pageGlyphLocation, 0, 0);
+                    break;
                 }
                 }
 
 
                 batches.Push(pageBatch);
                 batches.Push(pageBatch);
@@ -223,30 +228,34 @@ void Text::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData,
         }
         }
         else
         else
         {
         {
-            // If only one texture page, construct the UI batch directly            
+            // If only one texture page, construct the UI batch directly
             int x = GetRowStartPosition(0);
             int x = GetRowStartPosition(0);
             int y = 0;
             int y = 0;
 
 
             UIBatch batch(this, BLEND_ALPHA, currentScissor, face->textures_[0], &vertexData);
             UIBatch batch(this, BLEND_ALPHA, currentScissor, face->textures_[0], &vertexData);
 
 
-            if (textEffect_ == TE_NONE)
-                ConstructBatch(batch, face, x, y);
-            else if (textEffect_ == TE_SHADOW)
+            switch (textEffect_)
             {
             {
-                ConstructBatch(batch, face, x + 1, y + 1, &effectColor_);
+            case TE_NONE:
                 ConstructBatch(batch, face, x, y);
                 ConstructBatch(batch, face, x, y);
-            }
-            else if (textEffect_ == TE_STROKE)
-            {
-                ConstructBatch(batch, face, x - 1, y - 1, &effectColor_);
-                ConstructBatch(batch, face, x, y - 1, &effectColor_);
-                ConstructBatch(batch, face, x + 1, y - 1, &effectColor_);
-                ConstructBatch(batch, face, x - 1, y, &effectColor_);
-                ConstructBatch(batch, face, x + 1, y, &effectColor_);
-                ConstructBatch(batch, face, x - 1, y + 1, &effectColor_);
-                ConstructBatch(batch, face, x, y + 1, &effectColor_);
-                ConstructBatch(batch, face, x + 1, y + 1, &effectColor_);
+                break;
+                
+            case TE_SHADOW:
+                ConstructBatch(batch, face, x + 1, y + 1, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x, y);
+                break;
+                
+            case TE_STROKE:
+                ConstructBatch(batch, face, x - 1, y - 1, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x, y - 1, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x + 1, y - 1, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x - 1, y, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x + 1, y, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x - 1, y + 1, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x, y + 1, &effectColor_, effectDepthBias_);
+                ConstructBatch(batch, face, x + 1, y + 1, &effectColor_, effectDepthBias_);
                 ConstructBatch(batch, face, x, y);
                 ConstructBatch(batch, face, x, y);
+                break;
             }
             }
 
 
             UIBatch::AddOrMerge(batch, batches);
             UIBatch::AddOrMerge(batch, batches);
@@ -360,6 +369,11 @@ void Text::SetEffectColor(const Color& effectColor)
     effectColor_ = effectColor;
     effectColor_ = effectColor;
 }
 }
 
 
+void Text::SetEffectDepthBias(float bias)
+{
+    effectDepthBias_ = bias;
+}
+
 void Text::SetFontAttr(ResourceRef value)
 void Text::SetFontAttr(ResourceRef value)
 {
 {
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     ResourceCache* cache = GetSubsystem<ResourceCache>();
@@ -628,23 +642,40 @@ int Text::GetRowStartPosition(unsigned rowIndex) const
     return ret;
     return ret;
 }
 }
 
 
-void Text::ConstructBatch(UIBatch& pageBatch, const PODVector<GlyphLocation>& pageGlyphLocation, int x, int y, Color* color)
+void Text::ConstructBatch(UIBatch& pageBatch, const PODVector<GlyphLocation>& pageGlyphLocation, int x, int y, Color* color,
+    float depthBias)
 {
 {
+    unsigned startDataSize = pageBatch.vertexData_->Size();
+    
     for (unsigned i = 0; i < pageGlyphLocation.Size(); ++i)
     for (unsigned i = 0; i < pageGlyphLocation.Size(); ++i)
     {
     {
         const GlyphLocation& glyphLocation = pageGlyphLocation[i];
         const GlyphLocation& glyphLocation = pageGlyphLocation[i];
         const FontGlyph& glyph = *glyphLocation.glyph_;
         const FontGlyph& glyph = *glyphLocation.glyph_;
-        if (color == 0)
-            pageBatch.AddQuad(x + glyphLocation.x_ + glyph.offsetX_, y + glyphLocation.y_ + glyph.offsetY_, glyph.width_, glyph.height_, glyph.x_, glyph.y_);
+        if (!color)
+        {
+            pageBatch.AddQuad(x + glyphLocation.x_ + glyph.offsetX_, y + glyphLocation.y_ + glyph.offsetY_, glyph.width_,
+                glyph.height_, glyph.x_, glyph.y_);
+        }
         else
         else
-            pageBatch.AddQuad(x + glyphLocation.x_ + glyph.offsetX_, y + glyphLocation.y_ + glyph.offsetY_, glyph.width_, glyph.height_, glyph.x_, glyph.y_, 0, 0, color);
+        {
+            pageBatch.AddQuad(x + glyphLocation.x_ + glyph.offsetX_, y + glyphLocation.y_ + glyph.offsetY_, glyph.width_,
+                glyph.height_, glyph.x_, glyph.y_, 0, 0, color);
+        }
+    }
+
+    if (depthBias != 0.0f)
+    {
+        unsigned dataSize = pageBatch.vertexData_->Size();
+        for (unsigned i = startDataSize; i < dataSize; i += UI_VERTEX_SIZE)
+            pageBatch.vertexData_->At(i + 2) += depthBias;
     }
     }
 }
 }
 
 
-void Text::ConstructBatch(UIBatch& batch, const FontFace* face, int x, int y, Color* color)
+void Text::ConstructBatch(UIBatch& batch, const FontFace* face, int x, int y, Color* color, float depthBias)
 {
 {
     unsigned rowIndex = 0;
     unsigned rowIndex = 0;
-
+    unsigned startDataSize = batch.vertexData_->Size();
+    
     for (unsigned i = 0; i < printText_.Size(); ++i)
     for (unsigned i = 0; i < printText_.Size(); ++i)
     {
     {
         unsigned c = printText_[i];
         unsigned c = printText_[i];
@@ -655,7 +686,7 @@ void Text::ConstructBatch(UIBatch& batch, const FontFace* face, int x, int y, Co
             if (!p)
             if (!p)
                 continue;
                 continue;
 
 
-            if (color == 0)
+            if (!color)
                 batch.AddQuad(x + p->offsetX_, y + p->offsetY_, p->width_, p->height_, p->x_, p->y_);
                 batch.AddQuad(x + p->offsetX_, y + p->offsetY_, p->width_, p->height_, p->x_, p->y_);
             else
             else
                 batch.AddQuad(x + p->offsetX_, y + p->offsetY_, p->width_, p->height_, p->x_, p->y_, 0, 0, color);
                 batch.AddQuad(x + p->offsetX_, y + p->offsetY_, p->width_, p->height_, p->x_, p->y_, 0, 0, color);
@@ -670,6 +701,13 @@ void Text::ConstructBatch(UIBatch& batch, const FontFace* face, int x, int y, Co
             y += rowHeight_;
             y += rowHeight_;
         }
         }
     }
     }
+    
+    if (depthBias != 0.0f)
+    {
+        unsigned dataSize = batch.vertexData_->Size();
+        for (unsigned i = startDataSize; i < dataSize; i += UI_VERTEX_SIZE)
+            batch.vertexData_->At(i + 2) += depthBias;
+    }
 }
 }
 
 
 }
 }

+ 8 - 2
Source/Engine/UI/Text.h

@@ -138,6 +138,10 @@ public:
     /// Return size of each character.
     /// Return size of each character.
     const PODVector<IntVector2>& GetCharSizes() const { return charSizes_; }
     const PODVector<IntVector2>& GetCharSizes() const { return charSizes_; }
 
 
+    /// Set text effect Z bias. Zero by default, adjusted only in 3D mode.
+    void SetEffectDepthBias(float bias);
+    /// Return effect Z bias.
+    float GetEffectDepthBias() const { return effectDepthBias_; }
     /// Set font attribute.
     /// Set font attribute.
     void SetFontAttr(ResourceRef value);
     void SetFontAttr(ResourceRef value);
     /// Return font attribute.
     /// Return font attribute.
@@ -153,9 +157,9 @@ protected:
     /// Return row start X position.
     /// Return row start X position.
     int GetRowStartPosition(unsigned rowIndex) const;
     int GetRowStartPosition(unsigned rowIndex) const;
     /// Contruct batch.
     /// Contruct batch.
-    void ConstructBatch(UIBatch& pageBatch, const PODVector<GlyphLocation>& pageGlyphLocation, int x, int y, Color* color = 0);
+    void ConstructBatch(UIBatch& pageBatch, const PODVector<GlyphLocation>& pageGlyphLocation, int x, int y, Color* color = 0, float depthBias = 0.0f);
     /// Contruct batch.
     /// Contruct batch.
-    void ConstructBatch(UIBatch& batch, const FontFace* face, int x, int y, Color* color = 0);
+    void ConstructBatch(UIBatch& batch, const FontFace* face, int x, int y, Color* color = 0, float depthBias = 0.0f);
 
 
     /// Font.
     /// Font.
     SharedPtr<Font> font_;
     SharedPtr<Font> font_;
@@ -185,6 +189,8 @@ protected:
     TextEffect textEffect_;
     TextEffect textEffect_;
     /// Effect color.
     /// Effect color.
     Color effectColor_;
     Color effectColor_;
+    /// Text effect Z bias.
+    float effectDepthBias_;
     /// Row height.
     /// Row height.
     int rowHeight_;
     int rowHeight_;
     /// Row widths.
     /// Row widths.

+ 21 - 2
Source/Engine/UI/Text3D.cpp

@@ -43,6 +43,7 @@ extern const char* textEffects[];
 extern const char* GEOMETRY_CATEGORY;
 extern const char* GEOMETRY_CATEGORY;
 
 
 static const float TEXT_SCALING = 1.0f / 128.0f;
 static const float TEXT_SCALING = 1.0f / 128.0f;
+static const float DEFAULT_EFFECT_DEPTH_BIAS = 0.1f;
 
 
 Text3D::Text3D(Context* context) :
 Text3D::Text3D(Context* context) :
     Drawable(context, DRAWABLE_GEOMETRY),
     Drawable(context, DRAWABLE_GEOMETRY),
@@ -53,6 +54,7 @@ Text3D::Text3D(Context* context) :
     textDirty_(true),
     textDirty_(true),
     geometryDirty_(true)
     geometryDirty_(true)
 {
 {
+    text_.SetEffectDepthBias(DEFAULT_EFFECT_DEPTH_BIAS);
 }
 }
 
 
 Text3D::~Text3D()
 Text3D::~Text3D()
@@ -71,8 +73,9 @@ void Text3D::RegisterObject(Context* context)
     ENUM_ATTRIBUTE(Text3D, "Text Alignment", text_.textAlignment_, horizontalAlignments, HA_LEFT, AM_DEFAULT);
     ENUM_ATTRIBUTE(Text3D, "Text Alignment", text_.textAlignment_, horizontalAlignments, HA_LEFT, AM_DEFAULT);
     ATTRIBUTE(Text3D, VAR_FLOAT, "Row Spacing", text_.rowSpacing_, 1.0f, AM_DEFAULT);
     ATTRIBUTE(Text3D, VAR_FLOAT, "Row Spacing", text_.rowSpacing_, 1.0f, AM_DEFAULT);
     ATTRIBUTE(Text3D, VAR_BOOL, "Word Wrap", text_.wordWrap_, false, AM_DEFAULT);
     ATTRIBUTE(Text3D, VAR_BOOL, "Word Wrap", text_.wordWrap_, false, AM_DEFAULT);
-    ENUM_ATTRIBUTE(Text3D, "Text Effect", text_.textEffect_, textEffects, TE_NONE, AM_FILE);
-    REF_ACCESSOR_ATTRIBUTE(Text3D, VAR_COLOR, "Effect Color", GetEffectColor, SetEffectColor, Color, Color::TRANSPARENT, AM_FILE);
+    ENUM_ATTRIBUTE(Text3D, "Text Effect", text_.textEffect_, textEffects, TE_NONE, AM_DEFAULT);
+    REF_ACCESSOR_ATTRIBUTE(Text3D, VAR_COLOR, "Effect Color", GetEffectColor, SetEffectColor, Color, Color::BLACK, AM_DEFAULT);
+    ATTRIBUTE(Text3D, VAR_FLOAT, "Effect Depth Bias", text_.effectDepthBias_, DEFAULT_EFFECT_DEPTH_BIAS, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(Text3D, VAR_INT, "Width", GetWidth, SetWidth, int, 0, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(Text3D, VAR_INT, "Width", GetWidth, SetWidth, int, 0, AM_DEFAULT);
     ENUM_ACCESSOR_ATTRIBUTE(Text3D, "Horiz Alignment", GetHorizontalAlignment, SetHorizontalAlignment, HorizontalAlignment, horizontalAlignments, HA_LEFT, AM_DEFAULT);
     ENUM_ACCESSOR_ATTRIBUTE(Text3D, "Horiz Alignment", GetHorizontalAlignment, SetHorizontalAlignment, HorizontalAlignment, horizontalAlignments, HA_LEFT, AM_DEFAULT);
     ENUM_ACCESSOR_ATTRIBUTE(Text3D, "Vert Alignment", GetVerticalAlignment, SetVerticalAlignment, VerticalAlignment, verticalAlignments, VA_TOP, AM_DEFAULT);
     ENUM_ACCESSOR_ATTRIBUTE(Text3D, "Vert Alignment", GetVerticalAlignment, SetVerticalAlignment, VerticalAlignment, verticalAlignments, VA_TOP, AM_DEFAULT);
@@ -230,11 +233,22 @@ void Text3D::SetWordwrap(bool enable)
 void Text3D::SetTextEffect(TextEffect textEffect)
 void Text3D::SetTextEffect(TextEffect textEffect)
 {
 {
     text_.SetTextEffect(textEffect);
     text_.SetTextEffect(textEffect);
+    
+    MarkTextDirty();
 }
 }
 
 
 void Text3D::SetEffectColor(const Color& effectColor)
 void Text3D::SetEffectColor(const Color& effectColor)
 {
 {
     text_.SetEffectColor(effectColor);
     text_.SetEffectColor(effectColor);
+    
+    MarkTextDirty();
+}
+
+void Text3D::SetEffectDepthBias(float bias)
+{
+    text_.SetEffectDepthBias(bias);
+    
+    MarkTextDirty();
 }
 }
 
 
 void Text3D::SetWidth(int width)
 void Text3D::SetWidth(int width)
@@ -332,6 +346,11 @@ const Color& Text3D::GetEffectColor() const
     return text_.GetEffectColor();
     return text_.GetEffectColor();
 }
 }
 
 
+float Text3D::GetEffectDepthBias() const
+{
+    return text_.GetEffectDepthBias();
+}
+
 int Text3D::GetWidth() const
 int Text3D::GetWidth() const
 {
 {
     return text_.GetWidth();
     return text_.GetWidth();

+ 4 - 0
Source/Engine/UI/Text3D.h

@@ -78,6 +78,8 @@ public:
     void SetTextEffect(TextEffect textEffect);
     void SetTextEffect(TextEffect textEffect);
     /// Set effect color.
     /// Set effect color.
     void SetEffectColor(const Color& effectColor);
     void SetEffectColor(const Color& effectColor);
+    /// Set effect Z bias.
+    void SetEffectDepthBias(float bias);
     /// Set text width. Only has effect in word wrap mode.
     /// Set text width. Only has effect in word wrap mode.
     void SetWidth(int width);
     void SetWidth(int width);
     /// Set color on all corners.
     /// Set color on all corners.
@@ -111,6 +113,8 @@ public:
     TextEffect GetTextEffect() const;
     TextEffect GetTextEffect() const;
     /// Return effect color.
     /// Return effect color.
     const Color& GetEffectColor() const;
     const Color& GetEffectColor() const;
+    /// Return effect depth bias.
+    float GetEffectDepthBias() const;
     /// Return text width.
     /// Return text width.
     int GetWidth() const;
     int GetWidth() const;
     /// Return row height.
     /// Return row height.

+ 3 - 0
Source/Extras/LuaScript/pkgs/UI/Text3D.pkg

@@ -21,6 +21,7 @@ class Text3D : public Drawable
     void SetWordwrap(bool enable);
     void SetWordwrap(bool enable);
     void SetTextEffect(TextEffect textEffect);
     void SetTextEffect(TextEffect textEffect);
     void SetEffectColor(const Color& effectColor);
     void SetEffectColor(const Color& effectColor);
+    void SetEffectDepthBias(float bias);
     void SetWidth(int width);
     void SetWidth(int width);
     void SetColor(const Color& color);
     void SetColor(const Color& color);
     void SetColor(Corner corner, const Color& color);
     void SetColor(Corner corner, const Color& color);
@@ -38,6 +39,7 @@ class Text3D : public Drawable
     bool GetWordwrap() const;
     bool GetWordwrap() const;
     TextEffect GetTextEffect() const;
     TextEffect GetTextEffect() const;
     const Color& GetEffectColor() const;
     const Color& GetEffectColor() const;
+    float GetEffectDepthBias() const;
     int GetWidth() const;
     int GetWidth() const;
     int GetRowHeight() const;
     int GetRowHeight() const;
     unsigned GetNumRows() const;
     unsigned GetNumRows() const;
@@ -62,6 +64,7 @@ class Text3D : public Drawable
     tolua_property__get_set bool wordwrap;
     tolua_property__get_set bool wordwrap;
     tolua_property__get_set TextEffect textEffect;
     tolua_property__get_set TextEffect textEffect;
     tolua_property__get_set Color& effectColor;
     tolua_property__get_set Color& effectColor;
+    tolua_property__get_set float effectDepthBias;
     tolua_property__get_set int width;
     tolua_property__get_set int width;
     tolua_property__get_set Color& color; // Write only property.
     tolua_property__get_set Color& color; // Write only property.
     tolua_readonly tolua_property__get_set int rowHeight;
     tolua_readonly tolua_property__get_set int rowHeight;