/// <summary> /// Creates a billboard in 3D world. Its size is described by Width\Height(in pixels). /// </summary> /// <param name="textureSource"></param> /// <param name="width"></param> /// <param name="height"></param> /// <returns></returns> public static TextBillboardNode Create(ITextureSource textureSource, int width, int height) { var vs = new VertexShader(vertexCode);// this vertex shader has no vertex attributes. var fs = new FragmentShader(fragmentCode); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); var builder = new RenderMethodBuilder(provider, map); var node = new TextBillboardNode(textureSource, width, height, new TextBillboard(), builder); node.Initialize(); return(node); }
/// <summary> /// Creates a billboard in 3D world. Its size is described by Width\Height(in pixels). /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <param name="capacity">Maximum characters count.</param> /// <param name="glyphServer"></param> /// <returns></returns> public static TextBillboardNode Create(int width, int height, int capacity, GlyphServer glyphServer = null) { var vs = new VertexShader(vertexCode);// this vertex shader has no vertex attributes. var fs = new FragmentShader(fragmentCode); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add(inPosition, GlyphsModel.position); map.Add(inSTR, GlyphsModel.STR); var blendState = new BlendFuncSwitch(BlendSrcFactor.SrcAlpha, BlendDestFactor.OneMinusSrcAlpha); var builder = new RenderMethodBuilder(provider, map, blendState); var node = new TextBillboardNode(width, height, new GlyphsModel(capacity), builder, glyphServer); node.Initialize(); node.blend = blendState; return node; }