Exemplo n.º 1
0
		void GeneratePuffRing(float ypct, Random rn)
		{
			Vector3 sz = Vector3.Zero;
			//Only render ellipsoid and sphere exteriors
			if (Nebula.Zone.Shape is ZoneEllipsoid)
				sz = ((ZoneEllipsoid)Nebula.Zone.Shape).Size / 2; //we want radius instead of diameter
			else if (Nebula.Zone.Shape is ZoneSphere)
				sz = new Vector3(((ZoneSphere)Nebula.Zone.Shape).Radius);
			else
				return;
			var yval = ypct * sz.Y;
			int puffcount = rn.Next(Nebula.ExteriorMinBits, Nebula.ExteriorMaxBits + 1);
			double current_angle = 0;
			double delta_angle = (2 * Math.PI) / puffcount;
			for (int i = 0; i < puffcount; i++)
			{
				var puff = new ExteriorPuff();
				var y = rn.NextFloat(
					yval - (sz.Y * Nebula.ExteriorMoveBitPercent),
					yval + (sz.Y * Nebula.ExteriorMoveBitPercent)
				);
				var pos = PrimitiveMath.GetPointOnRadius(sz, y, (float)current_angle);
				puff.Position = Nebula.Zone.Position + new Vector3(pos.X, pos.Y - (sz.Y / 2), pos.Z);
				var radius = rn.NextFloat(
					Nebula.ExteriorBitRadius * (1 - Nebula.ExteriorBitRandomVariation),
					Nebula.ExteriorBitRadius * (1 + Nebula.ExteriorBitRandomVariation)
				);
				puff.Size = new Vector2(radius * 2);
				puff.Shape = Nebula.ExteriorCloudShapes.GetNext();
				Exterior.Add(puff);
				current_angle += delta_angle;
			}
		}
Exemplo n.º 2
0
        void GeneratePuffRing(float ypct, Random rn, List <VertexBillboardColor2> verts)
        {
            Vector3 sz = Vector3.Zero;

            //Only render ellipsoid and sphere exteriors
            if (Nebula.Zone.Shape is ZoneEllipsoid)
            {
                sz = ((ZoneEllipsoid)Nebula.Zone.Shape).Size / 2;                 //we want radius instead of diameter
            }
            else if (Nebula.Zone.Shape is ZoneSphere)
            {
                sz = new Vector3(((ZoneSphere)Nebula.Zone.Shape).Radius);
            }
            else
            {
                return;
            }
            var    yval          = ypct * sz.Y;
            int    puffcount     = rn.Next(Nebula.ExteriorMinBits, Nebula.ExteriorMaxBits + 1);
            double current_angle = 0;
            double delta_angle   = (2 * Math.PI) / puffcount;

            for (int i = 0; i < puffcount; i++)
            {
                var y = rn.NextFloat(
                    yval - (sz.Y * Nebula.ExteriorMoveBitPercent),
                    yval + (sz.Y * Nebula.ExteriorMoveBitPercent)
                    );
                var pos     = PrimitiveMath.GetPointOnRadius(sz, y, (float)current_angle);
                var puffPos = Nebula.Zone.Position + new Vector3(pos.X, pos.Y - (sz.Y / 2), pos.Z);
                var radius  = rn.NextFloat(
                    Nebula.ExteriorBitRadius * (1 - Nebula.ExteriorBitRandomVariation),
                    Nebula.ExteriorBitRadius * (1 + Nebula.ExteriorBitRandomVariation)
                    );
                var puffSize = new Vector2(radius * 2);
                var shape    = Nebula.ExteriorCloudShapes.GetNext();
                AddPuffQuad(verts, puffPos, puffSize, Nebula.ExteriorColor, Nebula.FogColor,
                            new Vector2(shape.Dimensions.X, shape.Dimensions.Y),
                            new Vector2(shape.Dimensions.X + shape.Dimensions.Width, shape.Dimensions.Y),
                            new Vector2(shape.Dimensions.X, shape.Dimensions.Y + shape.Dimensions.Height),
                            new Vector2(shape.Dimensions.X + shape.Dimensions.Width, shape.Dimensions.Y + shape.Dimensions.Height)
                            );
                Exterior.Add(new ExteriorPuff()
                {
                    Position = puffPos, Texture = shape.Texture
                });
                current_angle += delta_angle;
            }
        }