public Chart2DSpriteContainer(SpriteSet<UVColorVertexData> sprites, FontGeometry fontGeo,
            VertexSurface<FastChart2DBarVertex> fastBarSurface = null)
        {
            this.line = (Sprite2DGeometry)sprites["line"].Geometry;
            this.point = (Sprite2DGeometry)sprites["point"].Geometry;

            this.surface = sprites.Surface;

            this.quadUV = sprites["quad"].Geometry.UV;

            this.font = fontGeo;

            this.ThinLineWidth = 0.015f;
            this.ThickLineWidth = 0.03f;
            this.SmallPointSize = 0.03f;
            this.LargePointSize = 0.1f;
            this.Color = Color.DeepPink;

            if (fastBarSurface != null)
            {
                this.fastBarSurface = fastBarSurface;
                this.fastBarSurface.AddSettings(sprites.Surface.Settings);
                this.fastBarSurface.AddSettings(
                    new Vector2Uniform("uv01", this.quadUV.TopLeft),
                    new Vector2Uniform("uv11", this.quadUV.TopRight),
                    new Vector2Uniform("uv00", this.quadUV.BottomLeft),
                    new Vector2Uniform("uv10", this.quadUV.BottomRight)
                    );
            }
        }
示例#2
0
        public GeometryManager(SurfaceManager surfaces)
        {
            this.surfaces = surfaces;

            ConsoleBackground = new PrimitiveGeometry(surfaces.ConsoleBackground);
            ConsoleFont       = new FontGeometry(surfaces.ConsoleFontSurface, surfaces.ConsoleFont);
        }
        public Chart2DSpriteContainer(SpriteSet <UVColorVertexData> sprites, FontGeometry fontGeo,
                                      VertexSurface <FastChart2DBarVertex> fastBarSurface = null)
        {
            this.line  = (Sprite2DGeometry)sprites["line"].Geometry;
            this.point = (Sprite2DGeometry)sprites["point"].Geometry;

            this.surface = sprites.Surface;

            this.quadUV = sprites["quad"].Geometry.UV;

            this.font = fontGeo;

            this.ThinLineWidth  = 0.015f;
            this.ThickLineWidth = 0.03f;
            this.SmallPointSize = 0.03f;
            this.LargePointSize = 0.1f;
            this.Color          = Color.DeepPink;

            if (fastBarSurface != null)
            {
                this.fastBarSurface = fastBarSurface;
                this.fastBarSurface.AddSettings(sprites.Surface.Settings);
                this.fastBarSurface.AddSettings(
                    new Vector2Uniform("uv01", this.quadUV.TopLeft),
                    new Vector2Uniform("uv11", this.quadUV.TopRight),
                    new Vector2Uniform("uv00", this.quadUV.BottomLeft),
                    new Vector2Uniform("uv10", this.quadUV.BottomRight)
                    );
            }
        }
示例#4
0
        public GeometryManager(SurfaceManager surfaces)
        {
            this.Primitives = new PrimitiveGeometry(surfaces.Primitives);

            var font = Font.FromJsonFile("data/fonts/inconsolata.json");

            this.Text = new FontGeometry(surfaces.Text, font)
            {
                SizeCoefficient = new Vector2(1, -1)
            };
        }
示例#5
0
 // Methods
 public ParagraphList(FontGeometry fontGeo, Vector2 position, Color colour, int paragraphOffsetX = 10, int textHeight = 24, int textMargin = 4)
 {
     // Set all values
     this.Text             = new List <Paragraph>();
     this.FontGeometrie    = fontGeo;
     this.Position         = position;
     this.Colour           = colour;
     this.ParagraphOffsetX = paragraphOffsetX;
     this.TextHeight       = textHeight;
     this.TextMargin       = textMargin;
 }
示例#6
0
        public GeometryManager()
        {
            var surfaces = SurfaceManager.Instance;

            this.Primitives = new PrimitiveGeometry(surfaces.Primitives);
            this.GameText   = new FontGeometry(surfaces.GameText, surfaces.MonoFont)
            {
                SizeCoefficient = new Vector2(1, -1)
            };
            this.HudText = new FontGeometry(surfaces.HudText, surfaces.MonoFont)
            {
                SizeCoefficient = new Vector2(1, -1)
            };
        }
示例#7
0
 public ParticleEmitterText2D(string text, Vector2 position, int emitterLifeTime, FontGeometry geo)
     : base(text, new Vector3(position), emitterLifeTime, geo)
 {
     this.Velocity = RandomVector2.Zero;
     this.Acceleration = RandomVector2.Zero;
 }
示例#8
0
        public Graphics(Audio audio)
        {
            // Save a pointer to the audio class, for convenience
            this.Audio = audio;

            // Load Shader Programs.
            ShaderProgram uvShader     = new ShaderProgram(VertexShader.FromFile("data/shaders/uvcolor_vs.glsl"), FragmentShader.FromFile("data/shaders/uvcolor_fs.glsl"));
            ShaderProgram objShader    = new ShaderProgram(VertexShader.FromFile("data/shaders/obj_vs.glsl"), FragmentShader.FromFile("data/shaders/obj_fs.glsl"));
            ShaderProgram objShaderHax = new ShaderProgram(VertexShader.FromFile("data/shaders/obj_vs_hax.glsl"), FragmentShader.FromFile("data/shaders/obj_fs.glsl"));

            this.wallShader = objShader;

            // Create matrix uniforms used for rendering.
            this.view2D       = new Matrix4Uniform("viewMatrix");
            this.projection2D = new Matrix4Uniform("projectionMatrix");
            this.view3D       = new Matrix4Uniform("viewMatrix");
            this.projection3D = new Matrix4Uniform("projectionMatrix");

            this.createColorMatrices();
            this.WallColorUniform = new Matrix4Uniform("mixColor", this.Blue);

            this.lightDirection = new Vector3(-1f, -0.5f, -0.4f);
            this.lightDirection.Normalize();

            // Create the surfaces
            #region Font Surface
            Texture t = new Texture("data/fonts/freshman.png");

            this.FontSurface = new IndexedSurface <UVColorVertexData>();
            this.FontSurface.AddSettings(
                this.view2D,
                this.projection2D,
                new TextureUniform("diffuseTexture", t),
                SurfaceBlendSetting.Alpha,
                SurfaceDepthMaskSetting.DontMask
                );

            this.FontSurface.SetShaderProgram(uvShader);

            // the following line loads the json file
            this.FontGeometry = new FontGeometry(this.FontSurface, amulware.Graphics.Font.FromJsonFile("data/fonts/freshman_monospaced_numbers.json"));
            // this.FontGeometry.SizeCoefficient = new Vector2(1, -1); // FLIP IT

            this.MenuFontGeometry = this.FontGeometry;
            #endregion

            #region 3D font Surface
            t = new Texture("data/fonts/freshman.png");

            this.FontSurface3D = new IndexedSurface <UVColorVertexData>();
            this.FontSurface3D.AddSettings(
                this.view3D,
                this.projection3D,
                new TextureUniform("diffuseTexture", t),
                SurfaceBlendSetting.Alpha,
                SurfaceDepthMaskSetting.DontMask
                );

            this.FontSurface3D.SetShaderProgram(uvShader);

            // the following line loads the json file
            this.FontGeometry3D = new FontGeometry(this.FontSurface3D, amulware.Graphics.Font.FromJsonFile("data/fonts/freshman_monospaced_numbers.json"));
            this.FontGeometry3D.SizeCoefficient = new Vector2(1, -1); // FLIP IT
            #endregion

            #region PacmanSurface
            MeshData m = new MeshData("data/models/Pacman.obj");
            t = new Texture("data/sprites/PacmanTexture.png");
            this.pacManModel = new Matrix4Uniform("modelMatrix", Matrix4.Identity);

            this.PacmanSurface = m.ToIndexedSurface <NormalUVColorVertexData>(NormalUVColorVertexData.FromMesh);
            this.PacmanSurface.AddSettings(
                this.pacManModel,
                this.view3D,
                this.projection3D,
                new TextureUniform("diffuseTexture", t),
                new Vector3Uniform("lightDirection", this.lightDirection),
                new FloatUniform("ambientIntensity", 0.3f),
                new FloatUniform("diffuseIntensity", 0.8f),
                new Matrix4Uniform("mixColor", Matrix4.Identity)
                );
            this.PacmanSurface.SetShaderProgram(objShader);
            #endregion

            #region PacmanMouthSurface (must be placed directly after the 'PacmanSurface')
            m = new MeshData("data/models/Pacman_mouth.obj");
            this.PacManMouthTopTexture     = new Texture("data/sprites/OrbTexture.png"); // 't' is the same texture as pacman, 't-top' is a plain white pixel (as used for the orbs).
            this.PacManMouthBottomTexture  = t;
            this.PacManMouthTextureUniform = new TextureUniform("diffuseTexture", t);
            this.PacManMouthColorUniform   = new Matrix4Uniform("mixColor", Matrix4.Identity);

            this.PacmanMouthSurface = m.ToIndexedSurface <NormalUVColorVertexData>(NormalUVColorVertexData.FromMesh);
            this.PacmanMouthSurface.AddSettings(
                this.pacManModel,
                this.view3D,
                this.projection3D,
                this.PacManMouthTextureUniform,
                new Vector3Uniform("lightDirection", this.lightDirection),
                new FloatUniform("ambientIntensity", 0.3f),
                new FloatUniform("diffuseIntensity", 0.8f),
                this.PacManMouthColorUniform
                );
            this.PacmanMouthSurface.SetShaderProgram(objShaderHax);
            #endregion

            #region GhostSurface
            m = new MeshData("data/models/Ghost.obj");
            t = new Texture("data/sprites/GhostTexture.png");
            this.GhostColorUniform = new Matrix4Uniform("mixColor", this.Red);
            this.ghostModel        = new Matrix4Uniform("modelMatrix", Matrix4.Identity);

            this.GhostSurface = m.ToIndexedSurface <NormalUVColorVertexData>(NormalUVColorVertexData.FromMesh);
            this.GhostSurface.AddSettings(
                this.ghostModel,
                this.view3D,
                this.projection3D,
                new TextureUniform("diffuseTexture", t),
                new Vector3Uniform("lightDirection", this.lightDirection),
                new FloatUniform("ambientIntensity", 0.3f),
                new FloatUniform("diffuseIntensity", 0.8f),
                this.GhostColorUniform
                );
            this.GhostSurface.SetShaderProgram(objShader);
            #endregion

            #region OrbSurface
            m             = new MeshData("data/models/Orb.obj");
            t             = new Texture("data/sprites/OrbTexture.png");
            this.orbModel = new Matrix4Uniform("modelMatrix", Matrix4.Identity);

            this.OrbSurface = m.ToIndexedSurface <NormalUVColorVertexData>(NormalUVColorVertexData.FromMesh);
            this.OrbSurface.AddSettings(
                this.orbModel,
                this.view3D,
                this.projection3D,
                new TextureUniform("diffuseTexture", t),
                new Vector3Uniform("lightDirection", this.lightDirection),
                new FloatUniform("ambientIntensity", 0.3f),
                new FloatUniform("diffuseIntensity", 0.8f),
                new Matrix4Uniform("mixColor", Matrix4.Identity)
                );
            this.OrbSurface.SetShaderProgram(objShader);
            #endregion
        }
示例#9
0
        public override void Initialize(Vector3 position, Vector3 velocity, Vector3 acceleration, float lifeTime, PercentageArray <Color> colorPs, PercentageArray <float> scalePs, PercentageArray <float> alphas, FontGeometry geo)
        {
            base.Initialize(position, velocity, acceleration, lifeTime, colorPs, scalePs, alphas, geo);

            this.position.Z     = 0;
            this.velocity.Z     = 0;
            this.acceleration.Z = 0;
        }
示例#10
0
 private void createFonts()
 {
     FreshmanFont = new FontGeometry(surfaces.FreshmanFontSurface, surfaces.FreshmanFont);
     ConsolasFont = new FontGeometry(surfaces.ConsolasFontSurface, surfaces.ConsolasFont);
 }