コード例 #1
0
        /// <summary>
        /// Updates !!!
        /// </summary>
        /// <param name="gt">The gt.</param>
        /// <param name="camera">The camera.</param>
        protected override void Update(Microsoft.Xna.Framework.GameTime gt, Cameras.ICamera camera)
        {
            Emiter.Position = follower.PhysicObject.Position;
            Emiter.Velocity = follower.PhysicObject.Velocity;
            Emiter.Forward  = follower.PhysicObject.FaceVector;

            Listener.Position = camera.Position;
            Listener.Up       = camera.Up;

            SoundEngineInstance.Apply3D(Listener, Emiter);
        }
コード例 #2
0
        /// <summary>
        /// Draw
        /// </summary>
        /// <param name="gt">gametime</param>
        /// <param name="obj">the obj</param>
        /// <param name="render">The render.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights"></param>
        protected override void Draw(GameTime gt, IObject obj, RenderHelper render, Cameras.ICamera cam, IList <Light.ILight> lights)
        {
            effect.View       = cam.View;
            effect.Projection = cam.Projection;

            for (int i = 0; i < obj.Modelo.MeshNumber; i++)
            {
                BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);
                for (int j = 0; j < bi.Count(); j++)
                {
                    effect.Texture = obj.Modelo.getTexture(Modelo.TextureType.DIFFUSE, i, j);
                    effect.World   = bi[j].ModelLocalTransformation * obj.WorldMatrix;
                    render.RenderBatch(bi[j], effect);
                }
            }
        }
コード例 #3
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)
        {
            if (rasterizerState != null && rasterizerState != render.PeekRasterizerState())
            {
                rasterStateFlag = true;
                render.PushRasterizerState(rasterizerState);
            }

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

            if (rasterStateFlag)
            {
                render.PopRasterizerState();
                rasterStateFlag = false;
            }
        }
コード例 #4
0
        public override void PosDrawPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, SceneControl.RenderHelper render, Cameras.ICamera cam, IList <Light.ILight> lights)
        {
            SimpleTree tree = (obj.Modelo as TreeModel).Tree;

            tree.DrawLeaves(obj.WorldMatrix, cam.View, cam.Projection, false);
            render.ResyncStates();
            render.SetSamplerStates(ginfo.SamplerState);
        }
コード例 #5
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, RenderHelper render, Cameras.ICamera cam)
        {
            effect.Texture    = obj.Modelo.getTexture(Modelo.TextureType.DIFFUSE);
            effect.View       = cam.View;
            effect.Projection = cam.Projection;

            for (int i = 0; i < obj.Modelo.MeshNumber; i++)
            {
                BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);
                for (int j = 0; j < bi.Count(); j++)
                {
                    effect.World = bi[j].ModelLocalTransformation;
                    effect.CurrentTechnique.Passes[0].Apply();
                    render.RenderBatch(ref bi[j]);
                }
            }
        }
コード例 #6
0
 /// <summary>
 /// Draw
 /// </summary>
 /// <param name="gt">gametime</param>
 /// <param name="obj">the obj</param>
 /// <param name="render">The render.</param>
 /// <param name="cam">The cam.</param>
 /// <param name="lights"></param>
 protected override void Draw(GameTime gt, IObject obj, RenderHelper render, Cameras.ICamera cam, IList <Light.ILight> lights)
 {
     base.Draw(gt, obj, render, cam, lights);
     draw(cam, gt, render, obj, lights);
 }
コード例 #7
0
        public void Drawn(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
        {
            if (SamplePositions != null)
            {
                for (int i = 0; i < SamplePositions.Count(); i++)
                {
                    render.SetSamplerState(SamplerState[i], SamplePositions[i]);
                    samplers[SamplePositions[i]] = SamplerState[i];
                }
            }

            if (BlendState != null)
            {
                render.PushBlendState(BlendState);
            }
            if (RasterizerState != null)
            {
                render.PushRasterizerState(RasterizerState);
            }
            material.Drawn(gt, obj, cam, lights, render);

            if (RasterizerState != null)
            {
                render.PopRasterizerState();
            }
            if (BlendState != null)
            {
                render.PopBlendState();
            }

            if (SamplePositions != null)
            {
                for (int i = 0; i < SamplePositions.Count(); i++)
                {
                    render.SetSamplerState(samplers[SamplePositions[i]], SamplePositions[i]);
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// Pos drawn Function.
 /// Called after all objects are Draw
 /// </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 PosDrawnPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
 {
     shader.PosDrawPhase(gt, obj, render, cam, lights);
 }
コード例 #9
0
 /// <summary>
 /// Draws the specified gt.
 /// </summary>
 /// <param name="gt">The gt.</param>
 /// <param name="obj">The obj.</param>
 /// <param name="render">The render.</param>
 /// <param name="cam">The cam.</param>
 /// <param name="lights">The lights.</param>
 protected override void Draw(GameTime gt, SceneControl.IObject obj, SceneControl.RenderHelper render, Cameras.ICamera cam, System.Collections.Generic.IList <Light.ILight> lights)
 {
 }
コード例 #10
0
 protected override void DebugDrawn(SceneControl.RenderHelper render, GameTime gt, Cameras.ICamera cam)
 {
 }
コード例 #11
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)
        {
            PhysxClothObject PhysxClothObject = obj.PhysicObject as PhysxClothObject;
            ClothModel       ClothModel       = obj.Modelo as ClothModel;

            StillDesign.PhysX.MathPrimitives.Vector3[] pos  = PhysxClothObject.Cloth.GetMeshData().PositionsStream.GetData <StillDesign.PhysX.MathPrimitives.Vector3>();
            StillDesign.PhysX.MathPrimitives.Vector3[] norm = PhysxClothObject.Cloth.GetMeshData().NormalsStream.GetData <StillDesign.PhysX.MathPrimitives.Vector3>();

            for (int i = 0; i < ClothModel.BatchInformation.NumVertices; i++)
            {
                ClothModel.vertexPositionNormalTexture[i].Position = pos[i].AsXNA();
                ClothModel.vertexPositionNormalTexture[i].Normal   = norm[i].AsXNA();
            }

            ClothModel.BatchInformation.VertexBuffer.SetData <VertexPositionNormalTexture>(ClothModel.vertexPositionNormalTexture);

            if (rasterizerState != null && rasterizerState != render.PeekRasterizerState())
            {
                rasterStateFlag = true;
                render.PushRasterizerState(rasterizerState);
            }

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

            if (rasterStateFlag)
            {
                render.PopRasterizerState();
                rasterStateFlag = false;
            }
        }
コード例 #12
0
        /// <summary>
        /// Normal Drawn 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)
        {
            WorldMatrix.SetValue(obj.PhysicObject.WorldMatrix);
            ViewMatrix.SetValue(cam.View);
            ProjectionMatrix.SetValue(cam.Projection);

            TerrainShader.CurrentTechnique = TerrainShader.Techniques["Technique1"];
            TerrainShader.CurrentTechnique.Passes[0].Apply();

            QuadTerrain.DrawTerrain(TerrainShader, render.device);

            render.ResyncStates();
        }
コード例 #13
0
 /// <summary>
 /// Updates .
 /// </summary>
 /// <param name="gt">The gt.</param>
 /// <param name="camera">The camera.</param>
 protected override void Update(Microsoft.Xna.Framework.GameTime gt, Cameras.ICamera camera)
 {
     Listener.Position = camera.Position;
     Listener.Up       = camera.Up;
     SoundEngineInstance.Apply3D(Listener, Emiter);
 }
コード例 #14
0
 public void PreDrawnPhase(Microsoft.Xna.Framework.GameTime gt, IWorld mundo, IObject obj, Cameras.ICamera cam, IList <ILight> lights, RenderHelper render)
 {
 }
コード例 #15
0
 protected override void DebugDrawn(SceneControl.RenderHelper render, GameTime gt, Cameras.ICamera cam)
 {
     throw new System.NotImplementedException();
 }
コード例 #16
0
 public void Drawn(Microsoft.Xna.Framework.GameTime gt, IObject obj, Cameras.ICamera cam, IList <ILight> lights, RenderHelper render)
 {
     shader.Draw(gt, obj, render, cam, lights);
 }
コード例 #17
0
 /// <summary>
 /// Pre drawn Function.
 /// Called before all the objects are draw
 /// </summary>
 /// <param name="gt">The gt.</param>
 /// <param name="mundo">The mundo.</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 PreDrawnPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IWorld mundo, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
 {
 }
コード例 #18
0
        protected override void Draw(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, SceneControl.RenderHelper render, Cameras.ICamera cam, IList <Light.ILight> lights)
        {
            SimpleTree tree = (obj.Modelo as TreeModel).Tree;

            tree.DrawTrunk(obj.WorldMatrix, cam.View, cam.Projection, true);
            tree.DrawLeaves(obj.WorldMatrix, cam.View, cam.Projection, true);
            render.ResyncStates();
        }
コード例 #19
0
        /// <summary>
        /// Normal Drawn 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)
        {
            if (isupdated == false)
            {
                QuadTerrain.UpdateTerrain(cam.Position, cam.BoundingFrustum, LOD);
            }

            WorldMatrix.SetValue(obj.PhysicObject.WorldMatrix);
            ViewMatrix.SetValue(cam.View);
            ProjectionMatrix.SetValue(cam.Projection);

            TerrainShader.CurrentTechnique = TerrainShader.Techniques["Technique2"];
            TerrainShader.CurrentTechnique.Passes[0].Apply();

            QuadTerrain.DrawTerrain(TerrainShader, render.device);

            render.ResyncStates();
            isupdated = false;
            render.SetSamplerStates(ginfo.SamplerState, 6);
        }
コード例 #20
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);
        }
コード例 #21
0
        protected override void DebugDrawn(SceneControl.RenderHelper render, GameTime gt, Cameras.ICamera cam)
        {
            if (BasicEffect == null)
            {
                BasicEffect = new BasicEffect(render.device);
                BasicEffect.VertexColorEnabled = true;
                BasicEffect.TextureEnabled     = false;
            }

            //if (_fetchedResults == false)
            {
                DebugRenderable RenderBuffer = Scene.GetDebugRenderable();
                if (RenderBuffer == null || (RenderBuffer.TriangleCount == 0 && RenderBuffer.LineCount == 0))
                {
                    return;
                }

                Color c = Color.Red;
                if (RenderBuffer.TriangleCount > 0)
                {
                    VertexPositionColor1 = new VertexPositionColor[RenderBuffer.TriangleCount * 3];
                    for (int i = 0, j = 0; i < RenderBuffer.TriangleCount; i += 3, j++)
                    {
                        VertexPositionColor1[i].Color    = c;
                        VertexPositionColor1[i].Position = RenderBuffer.GetDebugTriangles()[j].Point0.AsXNA();

                        VertexPositionColor1[i + 1].Color    = c;
                        VertexPositionColor1[i + 1].Position = RenderBuffer.GetDebugTriangles()[j].Point1.AsXNA();

                        VertexPositionColor1[i + 2].Color    = c;
                        VertexPositionColor1[i + 2].Position = RenderBuffer.GetDebugTriangles()[j].Point2.AsXNA();
                    }
                }

                if (RenderBuffer.LineCount > 0)
                {
                    VertexPositionColor2 = new VertexPositionColor[RenderBuffer.LineCount * 2];
                    for (int i = 0, j = 0; i < RenderBuffer.LineCount; i += 2, j++)
                    {
                        VertexPositionColor2[i].Color    = c;
                        VertexPositionColor2[i].Position = RenderBuffer.GetDebugLines()[j].Point0.AsXNA();

                        VertexPositionColor2[i + 1].Color    = c;
                        VertexPositionColor2[i + 1].Position = RenderBuffer.GetDebugLines()[j].Point1.AsXNA();
                    }
                }
            }

            BasicEffect.View       = cam.View;
            BasicEffect.Projection = cam.Projection;
            BasicEffect.World      = Matrix.Identity;

            if (VertexPositionColor2 != null)
            {
                render.RenderUserPrimitive <VertexPositionColor>(BasicEffect, PrimitiveType.LineList, VertexPositionColor2, 0, VertexPositionColor2.Length / 2);
            }

            if (VertexPositionColor1 != null)
            {
                render.RenderUserPrimitive <VertexPositionColor>(BasicEffect, PrimitiveType.TriangleList, VertexPositionColor1, 0, VertexPositionColor1.Length / 3);
            }
        }