Exemple #1
0
        public override void SetTexture(string name)
        {
            var tex = GLTextureAdmin.GetTextureByName(name);

            foreach (var pol in Polygons)
            {
                pol.Texture = tex;
            }
        }
Exemple #2
0
        public void ChangeTexture(string name, string newName)
        {
            var tex = GLTextureAdmin.GetTextureByName(newName);

            foreach (var pol in Polygons)
            {
                if (pol.Texture.Name == name)
                {
                    pol.Texture = tex;
                }
            }
        }
Exemple #3
0
        public void GenerateRingPolygon()
        {
            Ring = new GLObject();

            GLTexture ringTexture = null;

            if (RingTextureName != null)
            {
                ringTexture = GLTextureAdmin.GetTextureByName(RingTextureName);
            }

            var angleStep = 360.0 / (double)Slices;

            var c = new GLPoint(0, 0, 0);

            for (double i = 0; i <= 360; i += angleStep)
            {
                double ax = (Radius + 1) * Math.Cos(i * Math.PI / 180.0) + c.X;
                double az = (Radius + 1) * Math.Sin(i * Math.PI / 180.0) + c.Z;

                double bx = (Radius + 1 + RingSize) * Math.Cos(i * Math.PI / 180.0) + c.X;
                double bz = (Radius + 1 + RingSize) * Math.Sin(i * Math.PI / 180.0) + c.Z;

                double cx = (Radius + 1 + RingSize) * Math.Cos((i + angleStep) * Math.PI / 180.0) + c.X;
                double cz = (Radius + 1 + RingSize) * Math.Sin((i + angleStep) * Math.PI / 180.0) + c.Z;

                double dx = (Radius + 1) * Math.Cos((i + angleStep) * Math.PI / 180.0) + c.X;
                double dz = (Radius + 1) * Math.Sin((i + angleStep) * Math.PI / 180.0) + c.Z;

                var polygon = new GLPolygon();
                polygon.FillColor = RingFillColor;
                polygon.Texture   = ringTexture;

                polygon.Points.Add(new GLPoint(ax, c.Y, az));
                polygon.Points.Add(new GLPoint(bx, c.Y, bz));
                polygon.Points.Add(new GLPoint(cx, c.Y, cz));
                polygon.Points.Add(new GLPoint(dx, c.Y, dz));

                Ring.Polygons.Add(polygon);
            }
        }
Exemple #4
0
        public void LoadFromXmlElement(XmlElement element)
        {
            Points = new List <GLPoint>();

            var allPoints = element.SelectNodes("point");

            if (allPoints != null)
            {
                foreach (XmlElement pointElement in allPoints)
                {
                    var p = new GLPoint();
                    p.LoadFromXmlElement(pointElement);
                    Points.Add(p);
                }
            }

            if (element.HasAttribute("texture"))
            {
                Name    = element.GetAttribute("texture");
                Texture = GLTextureAdmin.GetTextureByName(Name);
            }
        }
Exemple #5
0
 public override void SetTexture(string name)
 {
     Texture = GLTextureAdmin.GetTextureByName(name);
 }
Exemple #6
0
 public GLPlanet(string name, string textureName)
     : this()
 {
     Name    = name;
     Texture = GLTextureAdmin.GetTextureByName(textureName);
 }
Exemple #7
0
 public void Dispose()
 {
     GLTextureAdmin.UnLoadGLTextures();
 }