Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="capacity"></param>
        /// <param name="anchor"></param>
        public CtrlLabel(int capacity, GUIAnchorStyles anchor)
            : base(anchor)
        {
            if (capacity < 0)
            {
                throw new ArgumentException("capacity");
            }

            this.Size = new GUISize(20, 20);

            var model = new GlyphsModel(capacity);

            this.labelModel = model;
            var vs    = new VertexShader(vert);
            var fs    = new FragmentShader(frag);
            var codes = new ShaderArray(vs, fs);
            var map   = new AttributeMap();

            map.Add(inPosition, GlyphsModel.position);
            map.Add(inSTR, GlyphsModel.STR);
            var blend         = new BlendSwitch(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.OneMinusSourceAlpha);
            var methodBuilder = new RenderMethodBuilder(codes, map, blend);

            this.RenderUnit = new ModernRenderUnit(model, methodBuilder);

            this.Initialize();
        }
Пример #2
0
        private TextBillboardNode(int width, int height, GlyphsModel model, RenderMethodBuilder renderUnitBuilder, GlyphServer glyphServer = null)
            : base(model, renderUnitBuilder)
        {
            if (width <= 0)
            {
                width = 1;
            }
            if (height <= 0)
            {
                height = 1;
            }

            this._width        = width;
            this._height       = height;
            this.widthByHeight = (float)width / (float)height;
            this.heightByWidth = (float)height / (float)width;

            this.textModel = model;

            if (glyphServer == null)
            {
                this.glyphServer = GlyphServer.DefaultServer;
            }
            else
            {
                this.glyphServer = glyphServer;
            }
        }