Commits

Jason McKesson committed 1684841

glutil: Font system partially works.

Comments (0)

Files changed (7)

glutil/Test/pixel_test.cpp

 		"#version 330\n"
 		"\n"
 		"layout(location = 0) in vec4 position;\n"
-		"layout(location = 1) in vec4 color;\n"
+		"layout(location = 1) in vec4 texCoord;\n"
 		"\n"
-		"smooth out vec4 theColor;\n"
+		"smooth out vec2 glyphCoord;\n"
 		"\n"
 		"uniform mat4 cameraToClipMatrix;\n"
 		"\n"
 		"void main()\n"
 		"{\n"
 		"	gl_Position = cameraToClipMatrix * position;\n"
-		"	theColor = color;\n"
+		"	glyphCoord = texCoord.st;\n"
 		"}\n"
 		);
 
 	const std::string fragmentShader(
 		"#version 330\n"
 		"\n"
-		"smooth in vec4 theColor;\n"
+		"smooth in vec2 glyphCoord;\n"
 		"out vec4 outputColor;\n"
+		"uniform sampler2D glyphTex;"
 		"\n"
 		"void main()\n"
 		"{\n"
-		"	outputColor = theColor;\n"
+		"	outputColor = texture(glyphTex, glyphCoord).rrrr;\n"
 		"}\n"
 		);
 
 	gl::DeleteShader(fragShader);
 
 	g_cameraToClipMatrixUnif = gl::GetUniformLocation(g_program, "cameraToClipMatrix");
+	GLint samplerUnif = gl::GetUniformLocation(g_program, "glyphTex");
+	gl::UseProgram(g_program);
+	gl::Uniform1i(samplerUnif, 0);
+	gl::UseProgram(0);
 }
 
 GLuint g_dataBufferObject;
 void InitializeVertexData()
 {
 	const GLfloat vertexData[] = {
-		 90.0f,	 80.0f,	0.0f, 1.0f,
-		0.0f, 0.0f, 0.0f, 1.0f,
-		 90.0f,	 16.0f,	0.0f, 1.0f,
-		0.0f, 1.0f, 0.0f, 1.0f,
-		410.0f,	 80.0f,	0.0f, 1.0f,
-		0.0f, 0.0f, 0.0f, 1.0f,
-		410.0f,	 16.0f,	0.0f, 1.0f,
-		0.0f, 0.0f, 0.0f, 1.0f,
+		256.0f,	256.0f,	0.0f, 1.0f,
+		0.796875f, 0.0078125f, 0.0f, 1.0f,
+		256.0f,	247.0f,	0.0f, 1.0f,
+		0.796875f, 0.078125f, 0.0f, 1.0f,
+		263.0f,	256.0f,	0.0f, 1.0f,
+		0.82421875f, 0.0078125f, 0.0f, 1.0f,
+		263.0f,	247.0f,	0.0f, 1.0f,
+		0.82421875f, 0.078125f, 0.0f, 1.0f,
 	};
 
 	gl::GenBuffers(1, &g_dataBufferObject);
 }
 
 //Called after the window and OpenGL are initialized. Called exactly once, before the main loop.
+glutil::Font *g_pFont = NULL;
+
 void init()
 {
 	InitializeProgram();
 	InitializeVertexData();
+
+	g_pFont = glutil::CreateFont(glutil::FONT_SIZE_MEDIUM);
 }
 
 glm::ivec2 g_windowSize(500, 500);
 	gl::Clear(gl::GL_COLOR_BUFFER_BIT);
 
 	gl::UseProgram(g_program);
+	gl::ActiveTexture(gl::GL_TEXTURE0);
+	gl::BindTexture(gl::GL_TEXTURE_2D, g_pFont->GetTexture());
 
 	glutil::MatrixStack persMatrix;
 	persMatrix.PixelPerfectOrtho(g_windowSize, glm::vec2(-1.0f, 1.0f), false);
 	gl::DrawArrays(gl::GL_TRIANGLE_STRIP, 0, 4);
 
 	gl::BindVertexArray(0);
+	gl::BindTexture(gl::GL_TEXTURE_2D, 0);
 	gl::UseProgram(0);
 
 	glfwSwapBuffers();
 
 //Called whenever the window is resized. The new window size is given, in pixels.
 //This is an opportunity to call glViewport or glScissor to keep up with the change in size.
-void reshape (int w, int h)
+void GLFWCALL reshape(int w, int h)
 {
 	gl::Viewport(0, 0, (GLsizei) w, (GLsizei) h);
+}
 
+int GLFWCALL close_cb()
+{
+	delete g_pFont;
+	g_pFont = NULL;
+
+	return gl::GL_TRUE;
 }
 
 int main(int argc, char** argv)
 	init();
 
 	glfwSetWindowSizeCallback(reshape);
+	glfwSetWindowCloseCallback(close_cb);
 
 	//Main loop
 	while(true)
 	{
 		display();
 
-		if(glfwGetKey(GLFW_KEY_ESC) || !glfwGetWindowParam(GLFW_OPENED))
+		if(glfwGetKey(GLFW_KEY_ESC))
+		{
+			close_cb();
+			glfwCloseWindow();
+		}
+
+		if(!glfwGetWindowParam(GLFW_OPENED))
 			break;
 
 		glfwSleep(0.010);

glutil/glutil.doxy

 \ingroup module_glutil
 **/
 
+/**
+\defgroup module_glutil_font Basic Font System
+
+\brief Classes for basic font rendering.
+
+\ingroup module_glutil
+**/
+
 
 /**
 \defgroup module_glutil_exceptions Utility Exceptions

glutil/include/glutil/Font.h

+
+#ifndef FONT_UTIL_H
+#define FONT_UTIL_H
+
+/**
+\file
+\brief Contains the \ref module_glutil_font "basic font rendering system" classes and functions.
+**/
+
+#include <glm/glm.hpp>
+
+namespace glutil
+{
+	///\addtogroup module_glutil_font
+	///@{
+
+	namespace detail
+	{
+		class FontImpl;
+	}
+
+	class Font;
+
+	enum FontSizes
+	{
+		FONT_SIZE_SMALL,
+		FONT_SIZE_MEDIUM,
+		FONT_SIZE_LARGE,
+		FONT_SIZE_GIANT,
+	};
+
+	Font *CreateFont(FontSizes eSize);
+
+	//Deletion of this object must happen while OpenGL is still active.
+	class Font
+	{
+	public:
+		~Font();
+
+		GLuint GetTexture() const;
+
+	private:
+		detail::FontImpl *m_pImpl;
+
+		explicit Font(detail::FontImpl *pImpl);
+
+		friend Font *CreateFont(FontSizes eSize);
+
+		//Prevent copying
+		Font(const Font &);
+		Font &operator=(const Font &);
+	};
+
+	///@}
+}
+
+#endif //FONT_UTIL_H

glutil/include/glutil/glutil.h

 #include "WindowPos.h"
 #include "MousePoles.h"
 #include "MatrixStack.h"
+#include "Font.h"
 
 
 /**

glutil/source/Font.cpp

+
+#include <vector>
+#include <glload/gl_all.hpp>
+#include <glload/gll.hpp>
+#include "glutil/Font.h"
+#include "ftData.h"
+
+
+namespace glutil
+{
+	namespace detail
+	{
+		GLenum CalcInternalFormat()
+		{
+			return gl::GL_R8;
+		}
+
+		GLenum CalcFormat()
+		{
+			return gl::GL_RED;
+		}
+
+		class FontImpl
+		{
+		public:
+			FontImpl(const TypefaceMetrics &metrics, const Glyph *glyphs, const unsigned char* imageData)
+				: m_metrics(metrics)
+				, m_glyphs(glyphs)
+				, m_texture(0)
+			{
+				gl::GenTextures(1, &m_texture);
+
+				gl::PixelStorei(gl::GL_UNPACK_SWAP_BYTES, gl::GL_FALSE);
+				gl::PixelStorei(gl::GL_UNPACK_LSB_FIRST, gl::GL_FALSE);
+				gl::PixelStorei(gl::GL_UNPACK_ROW_LENGTH, 0);
+				gl::PixelStorei(gl::GL_UNPACK_SKIP_ROWS, 0);
+				gl::PixelStorei(gl::GL_UNPACK_SKIP_PIXELS, 0);
+				gl::PixelStorei(gl::GL_UNPACK_IMAGE_HEIGHT, 0);
+				gl::PixelStorei(gl::GL_UNPACK_SKIP_IMAGES, 0);
+				gl::PixelStorei(gl::GL_UNPACK_ALIGNMENT, 1);
+
+/*
+				if(glext_EXT_direct_state_access)
+				{
+					if(glext_ARB_texture_storage)
+					{
+						gl::TextureStorage2DEXT(m_texture, gl::GL_TEXTURE_2D, 1, CalcInternalFormat(),
+							m_metrics.imageWidth, m_metrics.imageHeight);
+					}
+					else
+					{
+						gl::TextureImage2DEXT(m_texture, gl::GL_TEXTURE_2D, 0, CalcInternalFormat(),
+							m_metrics.imageWidth, m_metrics.imageHeight, 0, CalcFormat(),
+							gl::GL_UNSIGNED_BYTE, NULL);
+						gl::TextureParameteriEXT(m_texture, gl::GL_TEXTURE_2D,
+							gl::GL_TEXTURE_BASE_LEVEL, 0);
+						gl::TextureParameteriEXT(m_texture, gl::GL_TEXTURE_2D,
+							gl::GL_TEXTURE_MAX_LEVEL, 0);
+					}
+
+					gl::TextureSubImage2DEXT(m_texture, gl::GL_TEXTURE_2D, 0, 0, 0,
+						m_metrics.imageWidth, m_metrics.imageHeight, CalcFormat(),
+						gl::GL_UNSIGNED_BYTE, imageData);
+				}
+				else
+*/
+				{
+					gl::BindTexture(gl::GL_TEXTURE_2D, m_texture);
+
+					if(glext_ARB_texture_storage)
+					{
+						gl::TexStorage2D(gl::GL_TEXTURE_2D, 1, CalcInternalFormat(),
+							m_metrics.imageWidth, m_metrics.imageHeight);
+					}
+					else
+					{
+						gl::TexImage2D(gl::GL_TEXTURE_2D, 0, CalcInternalFormat(),
+							m_metrics.imageWidth, m_metrics.imageHeight, 0, CalcFormat(),
+							gl::GL_UNSIGNED_BYTE, NULL);
+						gl::TexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_BASE_LEVEL, 0);
+						gl::TexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MAX_LEVEL, 0);
+					}
+
+					gl::TexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MAG_FILTER, gl::GL_NEAREST);
+					gl::TexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MIN_FILTER, gl::GL_NEAREST);
+
+					gl::TexSubImage2D(gl::GL_TEXTURE_2D, 0, 0, 0,
+						m_metrics.imageWidth, m_metrics.imageHeight, CalcFormat(),
+						gl::GL_UNSIGNED_BYTE, imageData);
+
+					gl::BindTexture(gl::GL_TEXTURE_2D, 0);
+				}
+			}
+
+			~FontImpl()
+			{
+				gl::DeleteTextures(1, &m_texture);
+				m_texture = 0;
+			}
+
+		
+			GLuint GetTexture() const {return m_texture;}
+		private:
+			TypefaceMetrics m_metrics;
+			const Glyph *m_glyphs;
+			GLuint m_texture;
+		};
+	}
+
+	Font *CreateFont( FontSizes eSize )
+	{
+		detail::FontImpl *pImpl = NULL;
+		switch(eSize)
+		{
+		case FONT_SIZE_SMALL:
+			pImpl = new detail::FontImpl(detail::small_Typeface, detail::small_Glyphs, detail::small_Image);
+			break;
+		case FONT_SIZE_MEDIUM:
+			pImpl = new detail::FontImpl(detail::medium_Typeface, detail::medium_Glyphs, detail::medium_Image);
+			break;
+		case FONT_SIZE_LARGE:
+			pImpl = new detail::FontImpl(detail::large_Typeface, detail::large_Glyphs, detail::large_Image);
+			break;
+		case FONT_SIZE_GIANT:
+			pImpl = new detail::FontImpl(detail::giant_Typeface, detail::giant_Glyphs, detail::giant_Image);
+			break;
+		}
+
+		return new Font(pImpl);
+	}
+
+	Font::Font( detail::FontImpl *pImpl )
+		: m_pImpl(pImpl)
+	{}
+
+	Font::~Font()
+	{
+		delete m_pImpl;
+	}
+
+	GLuint Font::GetTexture() const
+	{
+		return m_pImpl->GetTexture();
+	}
+}
+

glutil/source/ftData.cpp

+
+#include "ftData.h"
+
+namespace glutil
+{
+	namespace detail
+	{
+
+
+		const TypefaceMetrics small_Typeface =
+		{
+			128,
+			128,
+			5,
+			10,
+			9,
+			3,
+		};
+
+		const Glyph small_Glyphs[] =
+		{
+			{
+				33,
+				1,
+				7,
+				3,
+				7,
+				0.0078125f,
+				0.0625f,
+				0.03125f,
+				0.0078125f,
+			},
+			{
+				34,
+				0,
+				7,
+				4,
+				3,
+				0.0390625f,
+				0.03125f,
+				0.0703125f,
+				0.0078125f,
+			},
+			{
+				35,
+				0,
+				7,
+				5,
+				7,
+				0.078125f,
+				0.0625f,
+				0.1171875f,
+				0.0078125f,
+			},
+			{
+				36,
+				0,
+				7,
+				4,
+				7,
+				0.125f,
+				0.0625f,
+				0.15625f,
+				0.0078125f,
+			},
+			{
+				37,
+				0,
+				7,
+				5,
+				7,
+				0.1640625f,
+				0.0625f,
+				0.203125f,
+				0.0078125f,
+			},
+			{
+				38,
+				0,
+				7,
+				6,
+				8,
+				0.2109375f,
+				0.0703125f,
+				0.2578125f,
+				0.0078125f,
+			},
+			{
+				39,
+				1,
+				7,
+				2,
+				3,
+				0.265625f,
+				0.03125f,
+				0.28125f,
+				0.0078125f,
+			},
+			{
+				40,
+				1,
+				7,
+				4,
+				10,
+				0.2890625f,
+				0.0859375f,
+				0.3203125f,
+				0.0078125f,
+			},
+			{
+				41,
+				0,
+				8,
+				4,
+				10,
+				0.328125f,
+				0.0859375f,
+				0.359375f,
+				0.0078125f,
+			},
+			{
+				42,
+				0,
+				6,
+				5,
+				5,
+				0.3671875f,
+				0.046875f,
+				0.40625f,
+				0.0078125f,
+			},
+			{
+				43,
+				0,
+				5,
+				5,
+				4,
+				0.4140625f,
+				0.0390625f,
+				0.453125f,
+				0.0078125f,
+			},
+			{
+				44,
+				1,
+				1,
+				2,
+				3,
+				0.4609375f,
+				0.03125f,
+				0.4765625f,
+				0.0078125f,
+			},
+			{
+				45,
+				0,
+				4,
+				5,
+				1,
+				0.484375f,
+				0.015625f,
+				0.5234375f,
+				0.0078125f,
+			},
+			{
+				46,
+				1,
+				1,
+				2,
+				1,
+				0.53125f,
+				0.015625f,
+				0.546875f,
+				0.0078125f,
+			},
+			{
+				47,
+				0,
+				8,
+				5,
+				9,
+				0.5546875f,
+				0.078125f,
+				0.59375f,
+				0.0078125f,
+			},
+			{
+				48,
+				0,
+				7,
+				4,
+				7,
+				0.6015625f,
+				0.0625f,
+				0.6328125f,
+				0.0078125f,
+			},
+			{
+				49,
+				0,
+				7,
+				3,
+				7,
+				0.640625f,
+				0.0625f,
+				0.6640625f,
+				0.0078125f,
+			},
+			{
+				50,
+				0,
+				7,
+				5,
+				7,
+				0.671875f,
+				0.0625f,
+				0.7109375f,
+				0.0078125f,
+			},
+			{
+				51,
+				0,
+				7,
+				5,
+				7,
+				0.71875f,
+				0.0625f,
+				0.7578125f,
+				0.0078125f,
+			},
+			{
+				52,
+				0,
+				7,
+				5,
+				7,
+				0.765625f,
+				0.0625f,
+				0.8046875f,
+				0.0078125f,
+			},
+			{
+				53,
+				0,
+				7,
+				5,
+				7,
+				0.8125f,
+				0.0625f,
+				0.8515625f,
+				0.0078125f,
+			},
+			{
+				54,
+				1,
+				7,
+				4,
+				7,
+				0.859375f,
+				0.0625f,
+				0.890625f,
+				0.0078125f,
+			},
+			{
+				55,
+				0,
+				7,
+				4,
+				7,
+				0.8984375f,
+				0.0625f,
+				0.9296875f,
+				0.0078125f,
+			},
+			{
+				56,
+				0,
+				7,
+				4,
+				7,
+				0.9375f,
+				0.0625f,
+				0.96875f,
+				0.0078125f,
+			},
+			{
+				57,
+				1,
+				7,
+				4,
+				7,
+				0.0078125f,
+				0.1484375f,
+				0.0390625f,
+				0.09375f,
+			},
+			{
+				58,
+				1,
+				5,
+				2,
+				5,
+				0.046875f,
+				0.1328125f,
+				0.0625f,
+				0.09375f,
+			},
+			{
+				59,
+				1,
+				4,
+				2,
+				6,
+				0.0703125f,
+				0.140625f,
+				0.0859375f,
+				0.09375f,
+			},
+			{
+				60,
+				1,
+				7,
+				5,
+				7,
+				0.09375f,
+				0.1484375f,
+				0.1328125f,
+				0.09375f,
+			},
+			{
+				61,
+				0,
+				5,
+				5,
+				3,
+				0.140625f,
+				0.1171875f,
+				0.1796875f,
+				0.09375f,
+			},
+			{
+				62,
+				1,
+				7,
+				4,
+				7,
+				0.1875f,
+				0.1484375f,
+				0.21875f,
+				0.09375f,
+			},
+			{
+				63,
+				0,
+				7,
+				4,
+				7,
+				0.2265625f,
+				0.1484375f,
+				0.2578125f,
+				0.09375f,
+			},
+			{
+				64,
+				0,
+				7,
+				5,
+				7,
+				0.265625f,
+				0.1484375f,
+				0.3046875f,
+				0.09375f,
+			},
+			{
+				65,
+				0,
+				7,
+				5,
+				7,
+				0.3125f,
+				0.1484375f,
+				0.3515625f,
+				0.09375f,
+			},
+			{
+				66,
+				0,
+				7,
+				5,
+				7,
+				0.359375f,
+				0.1484375f,
+				0.3984375f,
+				0.09375f,
+			},
+			{
+				67,
+				0,
+				7,
+				5,
+				7,
+				0.40625f,
+				0.1484375f,
+				0.4453125f,
+				0.09375f,
+			},
+			{
+				68,
+				0,
+				7,
+				4,
+				7,
+				0.453125f,
+				0.1484375f,
+				0.484375f,
+				0.09375f,
+			},
+			{
+				69,
+				0,
+				7,
+				5,
+				7,
+				0.4921875f,
+				0.1484375f,
+				0.53125f,
+				0.09375f,
+			},
+			{
+				70,
+				1,
+				7,
+				4,
+				7,
+				0.5390625f,
+				0.1484375f,
+				0.5703125f,
+				0.09375f,
+			},
+			{
+				71,
+				0,
+				7,
+				5,
+				7,
+				0.578125f,
+				0.1484375f,
+				0.6171875f,
+				0.09375f,
+			},
+			{
+				72,
+				0,
+				7,
+				4,
+				7,
+				0.625f,
+				0.1484375f,
+				0.65625f,
+				0.09375f,
+			},
+			{
+				73,
+				0,
+				7,
+				5,
+				7,
+				0.6640625f,
+				0.1484375f,
+				0.703125f,
+				0.09375f,
+			},
+			{
+				74,
+				0,
+				7,
+				5,
+				7,
+				0.7109375f,
+				0.1484375f,
+				0.75f,
+				0.09375f,
+			},
+			{
+				75,
+				0,
+				8,
+				5,
+				8,
+				0.7578125f,
+				0.15625f,
+				0.796875f,
+				0.09375f,
+			},
+			{
+				76,
+				1,
+				7,
+				4,
+				7,
+				0.8046875f,
+				0.1484375f,
+				0.8359375f,
+				0.09375f,
+			},
+			{
+				77,
+				0,
+				7,
+				4,
+				7,
+				0.84375f,
+				0.1484375f,
+				0.875f,
+				0.09375f,
+			},
+			{
+				78,
+				0,
+				7,
+				4,
+				7,
+				0.8828125f,
+				0.1484375f,
+				0.9140625f,
+				0.09375f,
+			},
+			{
+				79,
+				0,
+				7,
+				5,
+				7,
+				0.921875f,
+				0.1484375f,
+				0.9609375f,
+				0.09375f,
+			},
+			{
+				80,
+				0,
+				7,
+				5,
+				7,
+				0.0078125f,
+				0.21875f,
+				0.046875f,
+				0.1640625f,
+			},
+			{
+				81,
+				0,
+				7,
+				5,
+				9,
+				0.0546875f,
+				0.234375f,
+				0.09375f,
+				0.1640625f,
+			},
+			{
+				82,
+				0,
+				7,
+				5,
+				7,
+				0.1015625f,
+				0.21875f,
+				0.140625f,
+				0.1640625f,
+			},
+			{
+				83,
+				0,
+				7,
+				6,
+				7,
+				0.1484375f,
+				0.21875f,
+				0.1953125f,
+				0.1640625f,
+			},
+			{
+				84,
+				0,
+				7,
+				5,
+				7,
+				0.203125f,
+				0.21875f,
+				0.2421875f,
+				0.1640625f,
+			},
+			{
+				85,
+				0,
+				7,
+				4,
+				7,
+				0.25f,
+				0.21875f,
+				0.28125f,
+				0.1640625f,
+			},
+			{
+				86,
+				0,
+				7,
+				5,
+				7,
+				0.2890625f,
+				0.21875f,
+				0.328125f,
+				0.1640625f,
+			},
+			{
+				87,
+				0,
+				7,
+				5,
+				7,
+				0.3359375f,
+				0.21875f,
+				0.375f,
+				0.1640625f,
+			},
+			{
+				88,
+				0,
+				7,
+				5,
+				7,
+				0.3828125f,
+				0.21875f,
+				0.421875f,
+				0.1640625f,
+			},
+			{
+				89,
+				0,
+				7,
+				5,
+				7,
+				0.4296875f,
+				0.21875f,
+				0.46875f,
+				0.1640625f,
+			},
+			{
+				90,
+				1,
+				7,
+				5,
+				7,
+				0.4765625f,
+				0.21875f,
+				0.515625f,
+				0.1640625f,
+			},
+			{
+				91,
+				1,
+				7,
+				4,
+				8,
+				0.5234375f,
+				0.2265625f,
+				0.5546875f,
+				0.1640625f,
+			},
+			{
+				92,
+				0,
+				8,
+				5,
+				9,
+				0.5625f,
+				0.234375f,
+				0.6015625f,
+				0.1640625f,
+			},
+			{
+				93,
+				0,
+				7,
+				4,
+				8,
+				0.609375f,
+				0.2265625f,
+				0.640625f,
+				0.1640625f,
+			},
+			{
+				94,
+				0,
+				7,
+				5,
+				3,
+				0.6484375f,
+				0.1875f,
+				0.6875f,
+				0.1640625f,
+			},
+			{
+				95,
+				0,
+				0,
+				5,
+				1,
+				0.6953125f,
+				0.171875f,
+				0.734375f,
+				0.1640625f,
+			},
+			{
+				96,
+				1,
+				8,
+				3,
+				3,
+				0.7421875f,
+				0.1875f,
+				0.765625f,
+				0.1640625f,
+			},
+			{
+				97,
+				0,
+				5,
+				4,
+				5,
+				0.7734375f,
+				0.203125f,
+				0.8046875f,
+				0.1640625f,
+			},
+			{
+				98,
+				0,
+				7,
+				4,
+				7,
+				0.8125f,
+				0.21875f,
+				0.84375f,
+				0.1640625f,
+			},
+			{
+				99,
+				0,
+				5,
+				5,
+				5,
+				0.8515625f,
+				0.203125f,
+				0.890625f,
+				0.1640625f,
+			},
+			{
+				100,
+				0,
+				7,
+				4,
+				7,
+				0.8984375f,
+				0.21875f,
+				0.9296875f,
+				0.1640625f,
+			},
+			{
+				101,
+				1,
+				5,
+				4,
+				5,
+				0.9375f,
+				0.203125f,
+				0.96875f,
+				0.1640625f,
+			},
+			{
+				102,
+				0,
+				7,
+				5,
+				7,
+				0.0078125f,
+				0.296875f,
+				0.046875f,
+				0.2421875f,
+			},
+			{
+				103,
+				1,
+				5,
+				5,
+				7,
+				0.0546875f,
+				0.296875f,
+				0.09375f,
+				0.2421875f,
+			},
+			{
+				104,
+				1,
+				7,
+				4,
+				7,
+				0.1015625f,
+				0.296875f,
+				0.1328125f,
+				0.2421875f,
+			},
+			{
+				105,
+				0,
+				7,
+				4,
+				7,
+				0.140625f,
+				0.296875f,
+				0.171875f,
+				0.2421875f,
+			},
+			{
+				106,
+				0,
+				7,
+				4,
+				9,
+				0.1796875f,
+				0.3125f,
+				0.2109375f,
+				0.2421875f,
+			},
+			{
+				107,
+				1,
+				7,
+				5,
+				7,
+				0.21875f,
+				0.296875f,
+				0.2578125f,
+				0.2421875f,
+			},
+			{
+				108,
+				0,
+				7,
+				5,
+				7,
+				0.265625f,
+				0.296875f,
+				0.3046875f,
+				0.2421875f,
+			},
+			{
+				109,
+				0,
+				5,
+				5,
+				5,
+				0.3125f,
+				0.28125f,
+				0.3515625f,
+				0.2421875f,
+			},
+			{
+				110,
+				1,
+				5,
+				4,
+				5,
+				0.359375f,
+				0.28125f,
+				0.390625f,
+				0.2421875f,
+			},
+			{
+				111,
+				0,
+				5,
+				4,
+				5,
+				0.3984375f,
+				0.28125f,
+				0.4296875f,
+				0.2421875f,
+			},
+			{
+				112,
+				0,
+				5,
+				4,
+				7,
+				0.4375f,
+				0.296875f,
+				0.46875f,
+				0.2421875f,
+			},
+			{
+				113,
+				0,
+				5,
+				4,
+				7,
+				0.4765625f,
+				0.296875f,
+				0.5078125f,
+				0.2421875f,
+			},
+			{
+				114,
+				1,
+				5,
+				4,
+				5,
+				0.515625f,
+				0.28125f,
+				0.546875f,
+				0.2421875f,
+			},
+			{
+				115,
+				0,
+				5,
+				4,
+				5,
+				0.5546875f,
+				0.28125f,
+				0.5859375f,
+				0.2421875f,
+			},
+			{
+				116,
+				1,
+				7,
+				4,
+				7,
+				0.59375f,
+				0.296875f,
+				0.625f,
+				0.2421875f,
+			},
+			{
+				117,
+				0,
+				5,
+				4,
+				5,
+				0.6328125f,
+				0.28125f,
+				0.6640625f,
+				0.2421875f,
+			},
+			{
+				118,
+				0,
+				5,
+				5,
+				5,
+				0.671875f,
+				0.28125f,
+				0.7109375f,
+				0.2421875f,
+			},
+			{
+				119,
+				0,
+				5,
+				5,
+				5,
+				0.71875f,
+				0.28125f,
+				0.7578125f,
+				0.2421875f,
+			},
+			{
+				120,
+				0,
+				5,
+				5,
+				5,
+				0.765625f,
+				0.28125f,
+				0.8046875f,
+				0.2421875f,
+			},
+			{
+				161,
+				1,
+				7,
+				2,
+				7,
+				0.8125f,
+				0.296875f,
+				0.828125f,
+				0.2421875f,
+			},
+			{
+				162,
+				0,
+				7,
+				5,
+				9,
+				0.8359375f,
+				0.3125f,
+				0.875f,
+				0.2421875f,
+			},
+			{
+				163,
+				0,
+				7,
+				5,
+				7,
+				0.8828125f,
+				0.296875f,
+				0.921875f,
+				0.2421875f,
+			},
+			{
+				164,
+				0,
+				7,
+				5,
+				6,
+				0.9296875f,
+				0.2890625f,
+				0.96875f,
+				0.2421875f,
+			},
+			{
+				165,
+				0,
+				7,
+				5,
+				7,
+				0.0078125f,
+				0.375f,
+				0.046875f,
+				0.3203125f,
+			},
+			{
+				166,
+				2,
+				7,
+				1,
+				9,
+				0.0546875f,
+				0.390625f,
+				0.0625f,
+				0.3203125f,
+			},
+			{
+				167,
+				0,
+				7,
+				4,
+				8,
+				0.0703125f,
+				0.3828125f,
+				0.1015625f,
+				0.3203125f,
+			},
+			{
+				168,
+				1,
+				7,
+				3,
+				1,
+				0.109375f,
+				0.328125f,
+				0.1328125f,
+				0.3203125f,
+			},
+			{
+				169,
+				0,
+				6,
+				5,
+				6,
+				0.140625f,
+				0.3671875f,
+				0.1796875f,
+				0.3203125f,
+			},
+			{
+				170,
+				0,
+				7,
+				5,
+				6,
+				0.1875f,
+				0.3671875f,
+				0.2265625f,
+				0.3203125f,
+			},
+			{
+				171,
+				1,
+				5,
+				4,
+				5,
+				0.234375f,
+				0.359375f,
+				0.265625f,
+				0.3203125f,
+			},
+			{
+				172,
+				0,
+				4,
+				4,
+				3,
+				0.2734375f,
+				0.34375f,
+				0.3046875f,
+				0.3203125f,
+			},
+			{
+				174,
+				0,
+				6,
+				5,
+				6,
+				0.3125f,
+				0.3671875f,
+				0.3515625f,
+				0.3203125f,
+			},
+			{
+				175,
+				1,
+				7,
+				3,
+				1,
+				0.359375f,
+				0.328125f,
+				0.3828125f,
+				0.3203125f,
+			},
+			{
+				176,
+				1,
+				7,
+				3,
+				3,
+				0.390625f,
+				0.34375f,
+				0.4140625f,
+				0.3203125f,
+			},
+			{
+				177,
+				0,
+				6,
+				5,
+				6,
+				0.421875f,
+				0.3671875f,
+				0.4609375f,
+				0.3203125f,
+			},
+			{
+				178,
+				1,
+				7,
+				3,
+				5,
+				0.46875f,
+				0.359375f,
+				0.4921875f,
+				0.3203125f,
+			},
+			{
+				179,
+				1,
+				7,
+				3,
+				5,
+				0.5f,
+				0.359375f,
+				0.5234375f,
+				0.3203125f,
+			},
+			{
+				180,
+				2,
+				8,
+				2,
+				3,
+				0.53125f,
+				0.34375f,
+				0.546875f,
+				0.3203125f,
+			},
+			{
+				181,
+				-1,
+				5,
+				7,
+				7,
+				0.5546875f,
+				0.375f,
+				0.609375f,
+				0.3203125f,
+			},
+			{
+				182,
+				0,
+				7,
+				4,
+				8,
+				0.6171875f,
+				0.3828125f,
+				0.6484375f,
+				0.3203125f,
+			},
+			{
+				183,
+				1,
+				4,
+				2,
+				1,
+				0.65625f,
+				0.328125f,
+				0.671875f,
+				0.3203125f,
+			},
+			{
+				184,
+				1,
+				0,
+				3,
+				2,
+				0.6796875f,
+				0.3359375f,
+				0.703125f,
+				0.3203125f,
+			},
+			{
+				185,
+				1,
+				7,
+				2,
+				4,
+				0.7109375f,
+				0.3515625f,
+				0.7265625f,
+				0.3203125f,
+			},
+			{
+				186,
+				0,
+				7,
+				5,
+				5,
+				0.734375f,
+				0.359375f,
+				0.7734375f,
+				0.3203125f,
+			},
+			{
+				187,
+				1,
+				5,
+				4,
+				5,
+				0.78125f,
+				0.359375f,
+				0.8125f,
+				0.3203125f,
+			},
+			{
+				188,
+				0,
+				7,
+				6,
+				8,
+				0.8203125f,
+				0.3828125f,
+				0.8671875f,
+				0.3203125f,
+			},
+			{
+				189,
+				0,
+				7,
+				6,
+				8,
+				0.875f,
+				0.3828125f,
+				0.921875f,
+				0.3203125f,
+			},
+			{
+				190,
+				0,
+				7,
+				6,
+				8,
+				0.9296875f,
+				0.3828125f,
+				0.9765625f,
+				0.3203125f,
+			},
+			{
+				191,
+				1,
+				7,
+				4,
+				7,
+				0.0078125f,
+				0.453125f,
+				0.0390625f,
+				0.3984375f,
+			},
+			{
+				192,
+				0,
+				9,
+				5,
+				9,
+				0.046875f,
+				0.46875f,
+				0.0859375f,
+				0.3984375f,
+			},
+			{
+				193,
+				0,
+				9,
+				5,
+				9,
+				0.09375f,
+				0.46875f,
+				0.1328125f,
+				0.3984375f,
+			},
+			{
+				194,
+				0,
+				9,
+				5,
+				9,
+				0.140625f,
+				0.46875f,
+				0.1796875f,
+				0.3984375f,
+			},
+			{
+				195,
+				0,
+				9,
+				5,
+				9,
+				0.1875f,
+				0.46875f,
+				0.2265625f,
+				0.3984375f,
+			},
+			{
+				196,
+				0,
+				8,
+				5,
+				8,
+				0.234375f,
+				0.4609375f,
+				0.2734375f,
+				0.3984375f,
+			},
+			{
+				197,
+				0,
+				9,
+				5,
+				9,
+				0.28125f,
+				0.46875f,
+				0.3203125f,
+				0.3984375f,
+			},
+			{
+				198,
+				-1,
+				7,
+				6,
+				7,
+				0.328125f,
+				0.453125f,
+				0.375f,
+				0.3984375f,
+			},
+			{
+				199,
+				0,
+				7,
+				5,
+				9,
+				0.3828125f,
+				0.46875f,
+				0.421875f,
+				0.3984375f,
+			},
+			{
+				200,
+				0,
+				9,
+				5,
+				9,
+				0.4296875f,
+				0.46875f,
+				0.46875f,
+				0.3984375f,
+			},
+			{
+				201,
+				0,
+				9,
+				5,
+				9,
+				0.4765625f,
+				0.46875f,
+				0.515625f,
+				0.3984375f,
+			},
+			{
+				202,
+				0,
+				9,
+				5,
+				9,
+				0.5234375f,
+				0.46875f,
+				0.5625f,
+				0.3984375f,
+			},
+			{
+				203,
+				0,
+				8,
+				5,
+				8,
+				0.5703125f,
+				0.4609375f,
+				0.609375f,
+				0.3984375f,
+			},
+			{
+				204,
+				0,
+				9,
+				5,
+				9,
+				0.6171875f,
+				0.46875f,
+				0.65625f,
+				0.3984375f,
+			},
+			{
+				205,
+				0,
+				9,
+				5,
+				9,
+				0.6640625f,
+				0.46875f,
+				0.703125f,
+				0.3984375f,
+			},
+			{
+				206,
+				0,
+				9,
+				5,
+				9,
+				0.7109375f,
+				0.46875f,
+				0.75f,
+				0.3984375f,
+			},
+			{
+				207,
+				0,
+				8,
+				5,
+				8,
+				0.7578125f,
+				0.4609375f,
+				0.796875f,
+				0.3984375f,
+			},
+			{
+				208,
+				0,
+				7,
+				5,
+				7,
+				0.8046875f,
+				0.453125f,
+				0.84375f,
+				0.3984375f,
+			},
+			{
+				209,
+				0,
+				9,
+				4,
+				9,
+				0.8515625f,
+				0.46875f,
+				0.8828125f,
+				0.3984375f,
+			},
+			{
+				210,
+				0,
+				9,
+				5,
+				9,
+				0.890625f,
+				0.46875f,
+				0.9296875f,
+				0.3984375f,
+			},
+			{
+				211,
+				0,
+				9,
+				5,
+				9,
+				0.9375f,
+				0.46875f,
+				0.9765625f,
+				0.3984375f,
+			},
+			{
+				212,
+				0,
+				9,
+				5,
+				9,
+				0.0078125f,
+				0.546875f,
+				0.046875f,
+				0.4765625f,
+			},
+			{
+				213,
+				0,
+				9,
+				5,
+				9,
+				0.0546875f,
+				0.546875f,
+				0.09375f,
+				0.4765625f,
+			},
+			{
+				214,
+				0,
+				8,
+				5,
+				8,
+				0.1015625f,
+				0.5390625f,
+				0.140625f,
+				0.4765625f,
+			},
+			{
+				215,
+				0,
+				6,
+				5,
+				5,
+				0.1484375f,
+				0.515625f,
+				0.1875f,
+				0.4765625f,
+			},
+			{
+				216,
+				0,
+				8,
+				5,
+				9,
+				0.1953125f,
+				0.546875f,
+				0.234375f,
+				0.4765625f,
+			},
+			{
+				217,
+				0,
+				9,
+				4,
+				9,
+				0.2421875f,
+				0.546875f,
+				0.2734375f,
+				0.4765625f,
+			},
+			{
+				218,
+				0,
+				9,
+				4,
+				9,
+				0.28125f,
+				0.546875f,
+				0.3125f,
+				0.4765625f,
+			},
+			{
+				219,
+				0,
+				9,
+				4,
+				9,
+				0.3203125f,
+				0.546875f,
+				0.3515625f,
+				0.4765625f,
+			},
+			{
+				220,
+				0,
+				9,
+				4,
+				9,
+				0.359375f,
+				0.546875f,
+				0.390625f,
+				0.4765625f,
+			},
+			{
+				221,
+				0,
+				9,
+				5,
+				9,
+				0.3984375f,
+				0.546875f,
+				0.4375f,
+				0.4765625f,
+			},
+			{
+				222,
+				0,
+				7,
+				5,
+				7,
+				0.4453125f,
+				0.53125f,
+				0.484375f,
+				0.4765625f,
+			},
+			{
+				223,
+				0,
+				7,
+				4,
+				7,
+				0.4921875f,
+				0.53125f,
+				0.5234375f,
+				0.4765625f,
+			},
+			{
+				224,
+				0,
+				8,
+				4,
+				8,
+				0.53125f,
+				0.5390625f,
+				0.5625f,
+				0.4765625f,
+			},
+			{
+				225,
+				0,
+				8,
+				4,
+				8,
+				0.5703125f,
+				0.5390625f,
+				0.6015625f,
+				0.4765625f,
+			},
+			{
+				226,
+				0,
+				7,
+				4,
+				7,
+				0.609375f,
+				0.53125f,
+				0.640625f,
+				0.4765625f,
+			},
+			{
+				227,
+				0,
+				7,
+				4,
+				7,
+				0.6484375f,
+				0.53125f,
+				0.6796875f,
+				0.4765625f,
+			},
+			{
+				228,
+				0,
+				7,
+				4,
+				7,
+				0.6875f,
+				0.53125f,
+				0.71875f,
+				0.4765625f,
+			},
+			{
+				229,
+				0,
+				8,
+				4,
+				8,
+				0.7265625f,
+				0.5390625f,
+				0.7578125f,
+				0.4765625f,
+			},
+			{
+				230,
+				0,
+				5,
+				5,
+				5,
+				0.765625f,
+				0.515625f,
+				0.8046875f,
+				0.4765625f,
+			},
+			{
+				231,
+				0,
+				5,
+				5,
+				7,
+				0.8125f,
+				0.53125f,
+				0.8515625f,
+				0.4765625f,
+			},
+			{
+				232,
+				1,
+				8,
+				4,
+				8,
+				0.859375f,
+				0.5390625f,
+				0.890625f,
+				0.4765625f,
+			},
+			{
+				233,
+				1,
+				8,
+				4,
+				8,
+				0.8984375f,
+				0.5390625f,
+				0.9296875f,
+				0.4765625f,
+			},
+			{
+				234,
+				1,
+				7,
+				4,
+				7,
+				0.9375f,
+				0.53125f,
+				0.96875f,
+				0.4765625f,
+			},
+			{
+				235,
+				1,
+				7,
+				4,
+				7,
+				0.0078125f,
+				0.609375f,
+				0.0390625f,
+				0.5546875f,
+			},
+			{
+				236,
+				0,
+				8,
+				4,
+				8,
+				0.046875f,
+				0.6171875f,
+				0.078125f,
+				0.5546875f,
+			},
+			{
+				237,
+				0,
+				8,
+				4,
+				8,
+				0.0859375f,
+				0.6171875f,
+				0.1171875f,
+				0.5546875f,
+			},
+			{
+				238,
+				0,
+				7,
+				4,
+				7,
+				0.125f,
+				0.609375f,
+				0.15625f,
+				0.5546875f,
+			},
+			{
+				239,
+				0,
+				7,
+				4,
+				7,
+				0.1640625f,
+				0.609375f,
+				0.1953125f,
+				0.5546875f,
+			},
+			{
+				240,
+				0,
+				8,
+				4,
+				8,
+				0.203125f,
+				0.6171875f,
+				0.234375f,
+				0.5546875f,
+			},
+			{
+				241,
+				1,
+				7,