示例#1
0
        private static void GetModel_Rod_Klinth(Model3DGroup geometries, WeaponHandleDNA dna, WeaponHandleDNA finalDNA, WeaponMaterialCache materials)
        {
            GeometryModel3D geometry = new GeometryModel3D();

            var color = WeaponMaterialCache.GetKlinth(dna.MaterialsForCustomizable);

            finalDNA.MaterialsForCustomizable = color.Item3;

            geometry.Material     = color.Item1;
            geometry.BackMaterial = color.Item1;

            //NOTE: The dimensions shouldn't be randomized.  This should look like a manufactured, almost mass produced product.
            // Also, being a crystal, it needs to appear solid

            List <TubeRingBase> rings = new List <TubeRingBase>();

            rings.Add(new TubeRingPoint(0, false));
            rings.Add(new TubeRingRegularPolygon(.2, false, .75, .75, false));
            rings.Add(new TubeRingRegularPolygon(.3, false, 1, 1, false));
            rings.Add(new TubeRingRegularPolygon(.5, false, .9, .9, false));
            rings.Add(new TubeRingRegularPolygon(1, false, .8, .8, false));
            rings.Add(new TubeRingRegularPolygon(15, false, .8, .8, false));
            rings.Add(new TubeRingRegularPolygon(1, false, .9, .9, false));
            rings.Add(new TubeRingRegularPolygon(.5, false, 1, 1, false));
            rings.Add(new TubeRingRegularPolygon(.3, false, .75, .75, false));
            rings.Add(new TubeRingPoint(.2, false));

            rings = TubeRingBase.FitNewSize(rings, dna.Radius, dna.Radius, dna.Length);

            geometry.Geometry = UtilityWPF.GetMultiRingedTube(5, rings, false, true, new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 90)));      // the tube builds along z, but this class wants along x

            geometries.Children.Add(geometry);
        }
示例#2
0
        private static Model3DGroup GetModel_Klinth(WeaponSpikeBallDNA dna, WeaponSpikeBallDNA finalDNA, WeaponMaterialCache materials)
        {
            Model3DGroup retVal = new Model3DGroup();

            var from = dna.KeyValues;
            var to   = finalDNA.KeyValues;

            double spikeLength = WeaponDNA.GetKeyValue("spikeLength", from, to, StaticRandom.NextPercent(dna.Radius * 1.1d, .05));
            double ballRadius  = dna.Radius;

            double spikeRadius = WeaponDNA.GetKeyValue("spikeRadius", from, to, StaticRandom.NextPercent(dna.Radius * .2, .1));

            var color = WeaponMaterialCache.GetKlinth(dna.MaterialsForCustomizable);

            finalDNA.MaterialsForCustomizable = color.Item3;

            GeometryModel3D geometry;

            #region Ball

            geometry = new GeometryModel3D();

            geometry.Material     = color.Item1;
            geometry.BackMaterial = color.Item1;

            Icosidodecahedron ball = UtilityWPF.GetIcosidodecahedron(ballRadius);

            geometry.Geometry = UtilityWPF.GetMeshFromTriangles_IndependentFaces(ball.AllTriangles);

            retVal.Children.Add(geometry);

            #endregion

            #region Spikes

            // Put a spike through the center of each pentagon
            foreach (Vector3D spikeLocation in ball.PentagonPolys.Select(o => Math3D.GetCenter(o.Select(p => ball.AllPoints[p]))))
            {
                geometry = new GeometryModel3D();

                geometry.Material     = color.Item2;
                geometry.BackMaterial = color.Item2;

                RotateTransform3D transform = new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRotation(new Vector3D(0, 0, 1), spikeLocation)));       // the tube builds along z

                List <TubeRingBase> rings = new List <TubeRingBase>();

                double spikeLengthMid = spikeLength * .8d;

                rings.Add(new TubeRingRegularPolygon(0, false, spikeRadius, spikeRadius, false));
                rings.Add(new TubeRingRegularPolygon(spikeLengthMid, false, spikeRadius, spikeRadius, false));
                rings.Add(new TubeRingDome(spikeLength - spikeLengthMid, false, 3));

                geometry.Geometry = UtilityWPF.GetMultiRingedTube(9, rings, false, false, transform);

                retVal.Children.Add(geometry);
            }

            #endregion

            return(retVal);
        }