public Base3DParticleInstance(Game game, Vector3 position, Vector3 scale, Vector4 extras, Base3DParticleInstancer instancer)
            : this(game, position, scale, instancer)
        {
            MyExtras = extras;

            this.Update(null);
        }
        public Base3DParticleInstance(Game game, Vector3 position, Vector3 scale, Base3DParticleInstancer instancer)
            : this(game)
        {

            rnd = new Random(DateTime.Now.Millisecond);
            Position = position;
            Scale = scale;

            Instancer = instancer;
            Instancer.instanceTransformMatrices.Add(this, new InstanceVertex() { TransformMatrix = World, Extras = MyExtras });
            Instancer.Instances.Add(myID, this);

            this.Update(null);
        }
예제 #3
0
        public Base3DParticleInstance(Game game, Vector3 position, Vector3 scale, Base3DParticleInstancer instancer)
            : this(game)
        {
            rnd      = new Random(DateTime.Now.Millisecond);
            Position = position;
            Scale    = scale;

            Instancer = instancer;
            Instancer.instanceTransformMatrices.Add(this, new InstanceVertex()
            {
                TransformMatrix = World, Extras = MyExtras
            });
            Instancer.Instances.Add(myID, this);

            this.Update(null);
        }
예제 #4
0
        public Base3DParticleInstance(Game game, Vector3 position, Vector3 scale, Vector4 extras, Base3DParticleInstancer instancer)
            : this(game, position, scale, instancer)
        {
            MyExtras = extras;

            this.Update(null);
        }
예제 #5
0
 public Base3DParticleInstance(Game game, Vector3 position, Vector3 scale, Base3DParticleInstancer instancer, Quaternion orientation) : this(game, position, scale, instancer)
 {
     Orientation = orientation;
     this.Update(null);
 }
예제 #6
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

            camera = new Base3DCamera(this, .1f, 20000);

            floor = new BaseDeferredObject(this, "Models/plane");
            floor.TextureMaterials.Add("Textures/FloorColor");
            floor.NormalMaterials.Add("Textures/FloorNormal");
            floor.Position = new Vector3(0, -.75f, -10);
            Components.Add(floor);

            box = new BaseDeferredObject(this, "Models/Box");
            box.TextureMaterials.Add("Textures/BoxColor");
            box.NormalMaterials.Add("Textures/BoxNormal");
            box.Position = new Vector3(0, 0, -10);
            Components.Add(box);

            box1 = new BaseDeferredObject(this, "Models/Box");
            box1.TextureMaterials.Add("Textures/BoxColor01");
            box1.NormalMaterials.Add("Textures/BoxNormal01");
            box1.Position = new Vector3(0, 2.25f, -10);
            Components.Add(box1);

            box2 = new BaseDeferredObject(this, "Models/Box");
            box2.TextureMaterials.Add("Textures/BoxColor02");
            box2.NormalMaterials.Add("Textures/BoxNormal02");
            box2.Position = new Vector3(0, 4.5f, -10);
            Components.Add(box2);

            snowInstancer = new Base3DParticleInstancer(this, "Shaders/Particles/FallingWeatherParticleInstance");
            snowInstancer.TextureMaterials.Add("Textures/Particles/snow");
            snowInstancer.Position = new Vector3(0, -1, 0);
            //instancer2.Size = Vector2.One * .1f;
            Components.Add(snowInstancer);

            float sqr = 100;
            for (int a = 0; a < 100000; a++)
            {
                float x = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());
                float y = MathHelper.Lerp(0, sqr / 2, (float)rnd.NextDouble());
                float z = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());

                particles.Add(new Base3DParticleInstance(this, new Vector3(x, y, z), Vector3.One, snowInstancer));
            }

            tailInstancer = new Base3DParticleInstancer(this, "Shaders/Particles/Trail");
            tailInstancer.TextureMaterials.Add("Textures/Particles/bling2");
            tailInstancer.Color = Color.White;
            tailInstancer.Rotate(Vector3.Forward, (float)Math.PI / 2);
            Components.Add(tailInstancer);

            for (int a = 0; a < 1000; a++)
            {
                float y = MathHelper.Lerp(0, sqr / 2, (float)rnd.NextDouble());
                float x = MathHelper.Lerp(0, .2f, (float)rnd.NextDouble());
                float z = MathHelper.Lerp(0, .2f, (float)rnd.NextDouble());

                System.Threading.Thread.Sleep(1);
                particles.Add(new Base3DParticleInstance(this, new Vector3(x, y, z), Vector3.One * 1f, tailInstancer));
            }

            smokeInstancer = new Base3DParticleInstancer(this, "Shaders/Particles/RisingSmokeInstanced");
            smokeInstancer.TextureMaterials.Add("Textures/Particles/smoke");
            Components.Add(smokeInstancer);

            for (int s = 0; s < 100; s++)
            {
                float x = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());
                float z = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());

                PlaceRisingsmoke(new Vector3(x, -.75f, z), 5);
            }

            SunPosition = new Vector3(0, 300, 200);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));
        }
 public Base3DParticleInstance(Game game, Vector3 position, Vector3 scale, Base3DParticleInstancer instancer,Quaternion orientation) : this(game, position, scale, instancer)
 {
     Orientation = orientation;
     this.Update(null);
 }