Exemplo n.º 1
0
        public override void Update(GameTime gt, PloobsEngine.SceneControl.IObject ent, IList <PloobsEngine.Light.ILight> lights)
        {
            base.Update(gt, ent, lights);

            PhysxFluidObject PhysxFluidObject = ent.PhysicObject as PhysxFluidObject;
            FluidMOdel       FluidMOdel       = ent.Modelo as FluidMOdel;

            if (!PhysxFluidObject.Fluid.ParticleWriteData.NumberOfParticles.HasValue)
            {
                return;
            }

            Phyx.Vector3[] pos = PhysxFluidObject.Fluid.ParticleWriteData.PositionBuffer.GetData <Phyx.Vector3>();

            int j = 0;

            for (int i = 0; i < PhysxFluidObject.Fluid.ParticleWriteData.NumberOfParticles * 6; i += 6)
            {
                FluidMOdel.billboardVertices[i].Position     = pos[j].AsXNA();
                FluidMOdel.billboardVertices[i + 1].Position = pos[j].AsXNA();
                FluidMOdel.billboardVertices[i + 2].Position = pos[j].AsXNA();

                FluidMOdel.billboardVertices[i + 3].Position = pos[j].AsXNA();
                FluidMOdel.billboardVertices[i + 4].Position = pos[j].AsXNA();
                FluidMOdel.billboardVertices[i + 5].Position = pos[j].AsXNA();
                j++;
            }

            FluidMOdel.UpdateVertices(pos.Count());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Normal Draw Function.
        /// </summary>
        /// <param name="gt">The gt.</param>
        /// <param name="obj">The obj.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights">The lights.</param>
        /// <param name="render">The render.</param>
        public void Drawn(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
        {
            PhysxFluidObject       PhysxFluidObject       = obj.PhysicObject as PhysxFluidObject;
            InstancedBilboardModel InstancedBilboardModel = obj.Modelo as InstancedBilboardModel;

            if (!PhysxFluidObject.Fluid.ParticleWriteData.NumberOfParticles.HasValue)
            {
                return;
            }

            Phyx.Vector3[]     pos  = PhysxFluidObject.Fluid.ParticleWriteData.PositionBuffer.GetData <Phyx.Vector3>();
            BilboardInstance[] inst = new Modelo.BilboardInstance[PhysxFluidObject.Fluid.ParticleWriteData.NumberOfParticles.Value];
            for (int i = 0; i < PhysxFluidObject.Fluid.ParticleWriteData.NumberOfParticles; i++)
            {
                inst[i]          = BilboardInstance[i];
                inst[i].Position = pos[i].AsXNA();
            }

            InstancedBilboardModel.SetBilboardInstances(inst);

            shader.iDraw(gt, obj, render, cam, lights);
        }