108 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			108 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|   | // #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Fonts.gdshaderinc" | ||
|  | 
 | ||
|  | const int _space_ = 32; | ||
|  | const int _0_ = 48; | ||
|  | const int _1_ = 49; | ||
|  | const int _2_ = 50; | ||
|  | const int _3_ = 51; | ||
|  | const int _4_ = 52; | ||
|  | const int _5_ = 53; | ||
|  | const int _6_ = 54; | ||
|  | const int _7_ = 55; | ||
|  | const int _8_ = 56; | ||
|  | const int _9_ = 57; | ||
|  | const int _colon_ = 58; | ||
|  | const int _semicolon_ = 59; | ||
|  | const int _smaller_ = 60; | ||
|  | const int _equals_ = 61; | ||
|  | const int _bigger_ = 62; | ||
|  | const int _questionMark_ = 63; | ||
|  | const int _at_ = 64; | ||
|  | const int _A_ = 65; | ||
|  | const int _B_ = 66; | ||
|  | const int _C_ = 67; | ||
|  | const int _D_ = 68; | ||
|  | const int _E_ = 69; | ||
|  | const int _F_ = 70; | ||
|  | const int _G_ = 71; | ||
|  | const int _H_ = 72; | ||
|  | const int _I_ = 73; | ||
|  | const int _J_ = 74; | ||
|  | const int _K_ = 75; | ||
|  | const int _L_ = 76; | ||
|  | const int _M_ = 77; | ||
|  | const int _N_ = 78; | ||
|  | const int _O_ = 79; | ||
|  | const int _P_ = 80; | ||
|  | const int _Q_ = 81; | ||
|  | const int _R_ = 82; | ||
|  | const int _S_ = 83; | ||
|  | const int _T_ = 84; | ||
|  | const int _U_ = 85; | ||
|  | const int _V_ = 86; | ||
|  | const int _W_ = 87; | ||
|  | const int _X_ = 88; | ||
|  | const int _Y_ = 89; | ||
|  | const int _Z_ = 90; | ||
|  | const int _squareBracketsOpen_ = 91; | ||
|  | const int _backSlash_ = 92; | ||
|  | const int _squareBracketsClose_ = 93; | ||
|  | const int _triangle_ = 94; | ||
|  | const int ___ = 95; | ||
|  | const int _apostroph_ = 96; | ||
|  | const int _a_ = 97; | ||
|  | const int _b_ = 98; | ||
|  | const int _c_ = 99; | ||
|  | const int _d_ = 100; | ||
|  | const int _e_ = 101; | ||
|  | const int _f_ = 102; | ||
|  | const int _g_ = 103; | ||
|  | const int _h_ = 104; | ||
|  | const int _i_ = 105; | ||
|  | const int _j_ = 106; | ||
|  | const int _k_ = 107; | ||
|  | const int _l_ = 108; | ||
|  | const int _m_ = 109; | ||
|  | const int _n_ = 110; | ||
|  | const int _o_ = 111; | ||
|  | const int _p_ = 112; | ||
|  | const int _q_ = 113; | ||
|  | const int _r_ = 114; | ||
|  | const int _s_ = 115; | ||
|  | const int _t_ = 116; | ||
|  | const int _u_ = 117; | ||
|  | const int _v_ = 118; | ||
|  | const int _w_ = 119; | ||
|  | const int _x_ = 120; | ||
|  | const int _y_ = 121; | ||
|  | const int _z_ = 122; | ||
|  | const int _curlyBracketsOpen_ = 123; | ||
|  | const int _stroke_ = 124; | ||
|  | const int _curlyBracketsClose_ = 125; | ||
|  | const int _tilde_ = 126; | ||
|  | 
 | ||
|  | vec3 renderMonoFontAsciiChar( sampler2D fontTable16x16, vec2 uv, int asciiCode ) | ||
|  | { | ||
|  |   int fontTableIndex = asciiCode - 32; | ||
|  |   int fontTableX = fontTableIndex % 16; | ||
|  |   int fontTableY = fontTableIndex / 16; | ||
|  | 
 | ||
|  |   vec2 fontTableUV = ( vec2( fontTableX, fontTableY ) + uv ) / 16.0;  | ||
|  |    | ||
|  |   return textureLod( fontTable, fontTableUV, 0 ); | ||
|  | } | ||
|  | 
 | ||
|  | vec3 renderMonoFontAsciiWord( sampler2D fontTable16x16, vec2 uv, int[] word ) | ||
|  | {  | ||
|  |   int wordLength = word.length(); | ||
|  |   float wordU = uv.x * wordLength; | ||
|  |    | ||
|  |   int characterIndex = int( floor( wordU ) ); | ||
|  |   int character = word[ characterIndex ]; | ||
|  | 
 | ||
|  |   float characterU = wordU - float( characterIndex ); | ||
|  | 
 | ||
|  |   return renderMonoFontAsciiChar( fontTable16x16, vec2( characterU, uv.y ), character ); | ||
|  | } | ||
|  | 
 |