@@ -25,7 +25,7 @@ var TextureTintPipeline = new Class({
2525 topology : gl . TRIANGLES ,
2626 vertShader : ShaderSourceVS ,
2727 fragShader : ShaderSourceFS ,
28- vertexCapacity : 6 * 10000 ,
28+ vertexCapacity : 6 * 2000 ,
2929
3030 vertexSize :
3131 Float32Array . BYTES_PER_ELEMENT * 2 +
@@ -59,7 +59,7 @@ var TextureTintPipeline = new Class({
5959
6060 this . vertexViewF32 = new Float32Array ( this . vertexData ) ;
6161 this . vertexViewU32 = new Uint32Array ( this . vertexData ) ;
62- this . maxQuads = 10000 ;
62+ this . maxQuads = 2000 ;
6363 this . mvpInit ( ) ;
6464 } ,
6565
@@ -676,7 +676,7 @@ var TextureTintPipeline = new Class({
676676 var cameraScrollY = camera . scrollY * bitmapText . scrollFactorY ;
677677 var fontData = bitmapText . fontData ;
678678 var lineHeight = fontData . lineHeight ;
679- var scale = ( bitmapText . fontSize / bitmapText . fontData . size ) ;
679+ var scale = ( bitmapText . fontSize / fontData . size ) ;
680680 var chars = fontData . chars ;
681681 var alpha = bitmapText . alpha ;
682682 var tint0 = getTint ( bitmapText . _tintTL , alpha ) ;
@@ -734,8 +734,6 @@ var TextureTintPipeline = new Class({
734734 var mvd = src * cmb + srd * cmd ;
735735 var mve = sre * cma + srf * cmc + cme ;
736736 var mvf = sre * cmb + srf * cmd + cmf ;
737- var crop = ( bitmapText . cropWidth > 0 || bitmapText . cropHeight > 0 ) ;
738- var uta , utb , utc , utd , ute , utf ;
739737 var vertexOffset = 0 ;
740738
741739 renderer . setTexture2D ( texture , 0 ) ;
@@ -766,44 +764,36 @@ var TextureTintPipeline = new Class({
766764 glyphW = glyph . width ;
767765 glyphH = glyph . height ;
768766
769- x = ( indexCount + glyph . xOffset + xAdvance ) - scrollX ;
770- y = ( glyph . yOffset + yAdvance ) - scrollY ;
767+ x = ( indexCount + glyph . xOffset + xAdvance ) * scale ;
768+ y = ( glyph . yOffset + yAdvance ) * scale ;
771769
772770 if ( lastGlyph !== null )
773771 {
774772 var kerningOffset = glyph . kerning [ lastCharCode ] ;
775773 x += ( kerningOffset !== undefined ) ? kerningOffset : 0 ;
776774 }
777775
778- uta = scale ;
779- utb = 0 ;
780- utc = 0 ;
781- utd = scale ;
782- ute = x * scale ;
783- utf = y * scale ;
784-
785- sra = uta * mva + utb * mvc ;
786- srb = uta * mvb + utb * mvd ;
787- src = utc * mva + utd * mvc ;
788- srd = utc * mvb + utd * mvd ;
789- sre = ute * mva + utf * mvc + mve ;
790- srf = ute * mvb + utf * mvd + mvf ;
791-
792776 xAdvance += glyph . xAdvance ;
793777 indexCount += 1 ;
794778 lastGlyph = glyph ;
795779 lastCharCode = charCode ;
796780
797- xw = glyphW ;
798- yh = glyphH ;
799- tx0 = sre ;
800- ty0 = srf ;
801- tx1 = yh * src + sre ;
802- ty1 = yh * srd + srf ;
803- tx2 = xw * sra + yh * src + sre ;
804- ty2 = xw * srb + yh * srd + srf ;
805- tx3 = xw * sra + sre ;
806- ty3 = xw * srb + srf ;
781+ // Nothing to render or a space? Then skip to the next glyph
782+ if ( glyphW === 0 || glyphH === 0 || charCode === 32 )
783+ {
784+ continue ;
785+ }
786+
787+ xw = x + glyphW * scale ;
788+ yh = y + glyphH * scale ;
789+ tx0 = x * mva + y * mvc + mve ;
790+ ty0 = x * mvb + y * mvd + mvf ;
791+ tx1 = x * mva + yh * mvc + mve ;
792+ ty1 = x * mvb + yh * mvd + mvf ;
793+ tx2 = xw * mva + yh * mvc + mve ;
794+ ty2 = xw * mvb + yh * mvd + mvf ;
795+ tx3 = xw * mva + y * mvc + mve ;
796+ ty3 = xw * mvb + y * mvd + mvf ;
807797
808798 umin = glyphX / textureWidth ;
809799 umax = ( glyphX + glyphW ) / textureWidth ;
@@ -813,8 +803,7 @@ var TextureTintPipeline = new Class({
813803 if ( ( tx0 < cameraX || tx0 > cameraWidth || ty0 < cameraY || ty0 > cameraHeight ) &&
814804 ( tx1 < cameraX || tx1 > cameraWidth || ty1 < cameraY || ty1 > cameraHeight ) &&
815805 ( tx2 < cameraX || tx2 > cameraWidth || ty2 < cameraY || ty2 > cameraHeight ) &&
816- ( tx3 < cameraX || tx3 > cameraWidth || ty3 < cameraY || ty3 > cameraHeight ) ||
817- ( glyphW === 0 || glyphH === 0 || charCode === 32 ) )
806+ ( tx3 < cameraX || tx3 > cameraWidth || ty3 < cameraY || ty3 > cameraHeight ) )
818807 {
819808 continue ;
820809 }
@@ -998,6 +987,17 @@ var TextureTintPipeline = new Class({
998987 x += ( kerningOffset !== undefined ) ? kerningOffset : 0 ;
999988 }
1000989
990+ xAdvance += glyph . xAdvance ;
991+ indexCount += 1 ;
992+ lastGlyph = glyph ;
993+ lastCharCode = charCode ;
994+
995+ // Nothing to render or a space? Then skip to the next glyph
996+ if ( glyphW === 0 || glyphH === 0 || charCode === 32 )
997+ {
998+ continue ;
999+ }
1000+
10011001 if ( displayCallback )
10021002 {
10031003 var output = displayCallback ( {
@@ -1117,11 +1117,6 @@ var TextureTintPipeline = new Class({
11171117 vertexViewF32 [ vertexOffset + 27 ] = umax ;
11181118 vertexViewF32 [ vertexOffset + 28 ] = vmin ;
11191119 vertexViewU32 [ vertexOffset + 29 ] = tint3 ;
1120-
1121- xAdvance += glyph . xAdvance ;
1122- indexCount += 1 ;
1123- lastGlyph = glyph ;
1124- lastCharCode = charCode ;
11251120
11261121 this . vertexCount += 6 ;
11271122 }
0 commit comments