Esempio n. 1
0
        public override void Reset()
        {
            base.Reset();

            Add(render3DContainer = new Render3DContainer
            {
                RelativeSizeAxes = Axes.Both,
                BackgroundColour = Color4.White.Scale(0.01f),
                Children         = new Drawable3D[]
                {
                    new Sprite3D
                    {
                        Colour       = Color4.HotPink,
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 0.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Right, MathHelper.PiOver2)
                    },
                    particleSystem = new ParticleSystem()
                    {
                        EmissionRate        = 300.0f,
                        MaximumParticles    = 1000,
                        Texture             = testTexture,
                        BlendingMode        = BlendingMode.Mixture,
                        Position            = new Vector3(0.0f, 0.0f, 0.0f),
                        Rotation            = Quaternion.FromAxisAngle(Vector3.Right, -MathHelper.PiOver2), // Facing up
                        VelocityInitializer = new ConeVelocityInitializer {
                            Angle = MathHelper.Pi * 0.4f, MinimumVelocity = 1.0f, MaximumVelocity = 3.0f
                        },
                        RotationInitializer = new RotationInitializer {
                            Minimum = 0.0f, Maximum = MathHelper.Pi
                        },
                        SizeInitializer = new SizeInitializer {
                            MaximumUniform = 0.6f, MinimumUniform = 0.4f
                        },
                        ColourInitializer = new ColourInitializer(Color4.AliceBlue.WithAlpha(0.6f)),
                        ParticleUpdaters  = new Updater[]
                        {
                            new ConstantRotationSpeed(),
                            new VelocityDecay(),
                        },
                        ComputedProperties = new ComputedProperty[]
                        {
                            new AlphaFade(),
                            new SizeFade {
                                Easing = EasingTypes.None, End = 1.0f, Start = 0.2f
                            }
                        },
                        TransparencyGroup = 3
                    },
                    cameraBoom = new Node
                    {
                        Children = new Drawable3D[]
                        {
                            new Camera()
                            {
                                Position = new Vector3(0.0f, 0.0f, 5.0f)
                            }
                        }
                    }
                }
            });

            cameraRotation = new Vector3(-20.0f, -45.0f, 0.0f);
            UpdateCamera();

            animation = Scheduler.AddDelayed(() =>
            {
                double phase            = Time.Current / 1000.0 * 2.0f;
                particleSystem.Position = new Vector3((float)Math.Cos(phase), 0.0f, (float)Math.Sin(phase)) * 2.0f;
            }, 10.0, true);
        }
Esempio n. 2
0
File: Test3D.cs Progetto: guusw/fx2
        public override void Reset()
        {
            base.Reset();

            Sprite3D billboardRoot;

            Add(render3DContainer = new Render3DContainer
            {
                RelativeSizeAxes = Axes.Both,
                BackgroundColour = Color4.White.Scale(0.01f),
                Children         = new Drawable3D[]
                {
                    testSprite = new Sprite3D
                    {
                        Colour       = Color4.Blue, // Z
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 0.0f, 2.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Up, MathHelper.Pi)
                    },
                    testSprite1 = new Sprite3D
                    {
                        Colour       = Color4.Green, // Y
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 2.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Right, MathHelper.PiOver2)
                    },
                    new Sprite3D
                    {
                        Colour       = Color4.Red, // X
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(2.0f, 0.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Up, -MathHelper.PiOver2)
                    },
                    billboardRoot = new Sprite3D // Billboard
                    {
                        Colour       = Color4.Orange,
                        Rectangle    = new RectangleF(-0.25f, -0.25f, 0.5f, 0.5f),
                        Texture      = testTexture,
                        Billboard    = true,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 0.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Up, -MathHelper.PiOver2),
                        Children     = new Drawable3D[]
                        {
                            new Sprite3D                      // Child Billboard
                            {
                                Colour       = Color4.Orange, // X
                                Texture      = testTexture,
                                Billboard    = true,
                                BlendingMode = BlendingMode.Mixture,
                                Position     = new Vector3(0.0f, 1.0f, 0.0f),
                                Rotation     = Quaternion.FromAxisAngle(Vector3.Up, -MathHelper.PiOver2)
                            },
                        }
                    },
                    cameraBoom = new Node
                    {
                        Children = new Drawable3D[]
                        {
                            new Camera()
                            {
                                Position = new Vector3(0.0f, 0.0f, 5.0f)
                            }
                        }
                    }
                }
            });

            testSprite1.FadeColour(Color4.LimeGreen, 1000, EasingTypes.InCubic);
            testSprite1.Loop();

            animation = Scheduler.AddDelayed(() =>
            {
                testSprite.Rotation    *= Quaternion.FromAxisAngle(Vector3.Forward, MathHelper.Pi * 0.001f);
                billboardRoot.Rotation *= Quaternion.FromAxisAngle(Vector3.Right, MathHelper.Pi * 0.002f);
            }, 10.0, true);
        }