/// <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); }
/// <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); } } }
/// <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; } }
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); }
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]); } } }
/// <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); }
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]); } } }
/// <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); }
/// <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) { }
protected override void DebugDrawn(SceneControl.RenderHelper render, GameTime gt, Cameras.ICamera cam) { }
/// <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; } }
/// <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(); }
/// <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); }
public void PreDrawnPhase(Microsoft.Xna.Framework.GameTime gt, IWorld mundo, IObject obj, Cameras.ICamera cam, IList <ILight> lights, RenderHelper render) { }
protected override void DebugDrawn(SceneControl.RenderHelper render, GameTime gt, Cameras.ICamera cam) { throw new System.NotImplementedException(); }
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); }
/// <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) { }
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(); }
/// <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); }
/// <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); }
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); } }