public override void render(float elapsedTime) { Device device = GuiController.Instance.D3dDevice; Control panel3d = GuiController.Instance.Panel3d; float aspectRatio = (float)panel3d.Width / (float)panel3d.Height; time += elapsedTime; // animo la pos del avion float alfa = -time *Geometry.DegreeToRadian(115.0f); avion.Position = new Vector3(80f * (float)Math.Cos(alfa), 20 - 20 * (float)Math.Sin(alfa), 80f * (float)Math.Sin(alfa)); dir_avion = new Vector3(-(float)Math.Sin(alfa), 0, (float)Math.Cos(alfa)); avion.Transform = CalcularMatriz(avion.Position, avion.Scale, dir_avion); g_LightPos = (Vector3)GuiController.Instance.Modifiers["LightLookFrom"]; device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); // dibujo la escena pp dicha device.BeginScene(); device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); // piso scene.Meshes[0].Technique = "RenderScene"; scene.Meshes[0].render(); // dibujo las sombra del avion sobre el piso effect.SetValue("matViewProj", device.Transform.View * device.Transform.Projection); effect.SetValue("g_vLightPos", new Vector4(g_LightPos.X, g_LightPos.Y, g_LightPos.Z, 1)); device.RenderState.ZBufferEnable = false; avion.Technique = "RenderShadows"; avion.render(); device.RenderState.ZBufferEnable = true; // avion avion.Technique = "RenderScene"; avion.render(); // dibujo la luz box.setPositionSize(g_LightPos, new Vector3(5, 5, 5)); box.updateValues(); box.render(); device.EndScene(); }
public Disparo(TgcMesh unModelo, Matrix matrixRot) { TestDisparo = new TgcBox(); TestDisparo.setPositionSize(unModelo.Position, unModelo.Scale); if (unModelo.AutoTransformEnable) { TestDisparo.rotateX(unModelo.Rotation.X); TestDisparo.rotateY(unModelo.Rotation.Y); TestDisparo.rotateZ(unModelo.Rotation.Z); } else { TestDisparo.AutoTransformEnable = false; TestDisparo.Transform = matrixRot; } EnJuego = true; TiempoDeVida = 4f; Duracion = 1f; Intensidad = 1; Velocidad = 300f; }