示例#1
0
 public Skybox(ShaderProgram program, string filename, bool giveID)
     : base(program, filename, giveID)
 {
 }
示例#2
0
        public ButtonBackup(ShaderProgram program, string text, Color4 colour,
                            int x, int y, int width, int height, int windowWidth, int windowHeight,
                            Matrix4 projection, Func <Task> execDelegate,
                            LayoutAlign layoutAlign = LayoutAlign.TopRight, string fontLocation = "arial")
            : base(program)
        {
            LayoutAlign  = layoutAlign;
            WindowWidth  = windowWidth;
            WindowHeight = windowHeight;
            switch (LayoutAlign)
            {
            case LayoutAlign.TopRight:
                X      = x;
                Y      = WindowHeight - y;
                Width  = width;
                Height = -height;
                break;

            case LayoutAlign.TopLeft:
                X      = WindowWidth - x;
                Y      = WindowHeight - y;
                Width  = width;
                Height = -height;
                break;

            case LayoutAlign.BottomRight:
                X      = x;
                Y      = y;
                Width  = width;
                Height = -height;
                break;

            case LayoutAlign.BottomLeft:
                X      = WindowWidth - x;
                Y      = y;
                Width  = width;
                Height = -height;
                break;

            default:
                X      = x;
                Y      = y;
                Width  = width;
                Height = height;
                break;
            }
            // Create model, then populate button positional data to that model data.
            Vertices = new Vertex[] {
                new Vertex(// Top left
                    new Vector3(X, Y, 0.0f),
                    colour,
                    new Vector2(0.0f, 0.0f)),
                new Vertex(// Top right
                    new Vector3(X + Width, Y, 0.0f),
                    colour,
                    new Vector2(1.0f, 0.0f)),
                new Vertex(// Bottom right
                    new Vector3(X + Width, Y + Height, 0.0f),
                    colour,
                    new Vector2(1.0f, 1.0f)),
                new Vertex(// Bottom left
                    new Vector3(X, Y + Height, 0.0f),
                    colour,
                    new Vector2(0.0f, 1.0f))
            };
            Indices = new int[]
            {
                0, 1, 2,
                0, 3, 2
            };
            Text             = text;
            State            = ButtonState.NotPressed;
            ProjectionMatrix = projection;
            ExecDelegate     = execDelegate;
            // Configure text
            LabelDrawing = new QFontDrawing();
            var builderConfig = new QFontBuilderConfiguration(true)
            {
                ShadowConfig =
                {
                    BlurRadius = 2,
                    BlurPasses = 1,
                    Type       = ShadowType.Blurred
                },
                TextGenerationRenderHint = TextGenerationRenderHint.ClearTypeGridFit,
                Characters = CharacterSet.General | CharacterSet.Japanese | CharacterSet.Thai | CharacterSet.Cyrillic
            };

            LabelFont = new QFont(@"Resources\Fonts\" + fontLocation + ".ttf", 12, builderConfig);
            // Buffer text.
            LabelDrawing.DrawingPrimitives.Clear();
            LabelDrawing.Print(LabelFont, Text,
                               new Vector3(X + (Width / 2), Y, 0.0f),
                               new SizeF(Width, Height), QFontAlignment.Centre, new QFontRenderOptions()
            {
                WordWrap = false
            });
            LabelDrawing.RefreshBuffers();
        }
示例#3
0
 public AModel(ShaderProgram program)
     : this(program, Vector3.Zero, Vector3.Zero, Vector3.One)
 {
 }