Example #1
0
        void Awake()
        {
            ImageStream = new MemoryStream();
            camera      = CoreEngine.gEngine.MainCamera;
            width       = camera.Width;
            height      = camera.Height;

            renderBuffer   = new RenderBuffer(camera, 4, false);
            renderBufferId = renderBuffer.RenderBufferDraw;
            renderTex      = renderBuffer.RenderTexture;
            imageBitmap    = new Bitmap(width, height);

            //postprocessing testing
            ppSh = new PostProcessing(camera);
            ShaderManager shdrm = ShaderManager.GetInstance;

            shdrm.LoadShader("FormPP");
            shaderPP = shdrm.GetShader("FormPP");
            shaderPP.ApplyShader();
            shaderPP.SetUniform(0, "texture_diffuse");
        }
Example #2
0
        internal TextRenderer()
        {
            lib = new Library();

            try
            {
                using (Stream file = File.OpenRead(font))
                {
                    face = new Face(lib, ReadFont(file), 0);
                }
            }
            catch (Exception)
            {
                string defPath  = "Toys.Resourses.Fonts.reddelicious.ttf";
                var    assembly = IntrospectionExtensions.GetTypeInfo(typeof(ShaderManager)).Assembly;
                face = new Face(lib, ReadFont(assembly.GetManifestResourceStream(defPath)), 0);
            }

            face.SetPixelSizes(0, (uint)size);
            //projection = Matrix4.CreateOrthographicOffCenter(0, 800, 0, 600, 0f, -0.01f);
            ShaderManager shdmMgmt = ShaderManager.GetInstance;

            shdmMgmt.LoadShader("text");
            shdr = shdmMgmt.GetShader("text");
            shdr.ApplyShader();
            shdr.SetUniform((int)TextureType.Diffuse, "text");

            foreach (var uniform in shdr.GetUniforms)
            {
                if (uniform.Name == "projection")
                {
                    projUniform = uniform;
                }
                else if (uniform.Name == "textColor")
                {
                    colorUniform = uniform;
                }
            }
            charmap = Texture2D.CreateCharMap(mapSize, mapSize);
        }