Browse Source

Fixed shader used by Text3D generated materials.

Lasse Öörni 12 years ago
parent
commit
0594ff6013
2 changed files with 29 additions and 6 deletions
  1. 21 4
      Source/Engine/UI/Text3D.cpp
  2. 8 2
      Source/Engine/UI/Text3D.h

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

@@ -366,9 +366,24 @@ unsigned Text3D::GetNumRows() const
     return text_.GetNumRows();
 }
 
-const PODVector<int>& Text3D::GetRowWidths() const
+unsigned Text3D::GetNumChars() const
 {
-    return text_.GetRowWidths();
+    return text_.GetNumChars();
+}
+
+int Text3D::GetRowWidth(unsigned index) const
+{
+    return text_.GetRowWidth(index);
+}
+
+IntVector2 Text3D::GetCharPosition(unsigned index)
+{
+    return text_.GetCharPosition(index);
+}
+
+IntVector2 Text3D::GetCharSize(unsigned index)
+{
+    return text_.GetCharSize(index);
 }
 
 const Color& Text3D::GetColor(Corner corner) const
@@ -504,8 +519,10 @@ void Text3D::UpdateTextMaterials(bool forceUpdate)
                 Material* material = new Material(context_);
                 Technique* tech = new Technique(context_);
                 Pass* pass = tech->CreatePass(PASS_ALPHA);
-                pass->SetVertexShader("Basic_DiffVCol");
-                pass->SetPixelShader("Basic_AlphaVCol");
+                pass->SetVertexShader("Basic");
+                pass->SetVertexShaderDefines("DIFFMAP VERTEXCOLOR");
+                pass->SetPixelShader("Basic");
+                pass->SetPixelShaderDefines("ALPHAMAP VERTEXCOLOR");
                 pass->SetBlendMode(BLEND_ALPHA);
                 pass->SetDepthWrite(false);
                 material->SetTechnique(0, tech);

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

@@ -121,8 +121,14 @@ public:
     int GetRowHeight() const;
     /// Return number of rows.
     unsigned GetNumRows() const;
-    /// Return width of each row.
-    const PODVector<int>& GetRowWidths() const;
+    /// Return number of characters.
+    unsigned GetNumChars() const;
+    /// Return width of row by index.
+    int GetRowWidth(unsigned index) const;
+    /// Return position of character by index relative to the text element origin.
+    IntVector2 GetCharPosition(unsigned index);
+    /// Return size of character by index.
+    IntVector2 GetCharSize(unsigned index);
     /// Return corner color.
     const Color& GetColor(Corner corner) const;
     /// Return opacity.