public override void Render(Time time) { if (!loaded) return; var e = Loader.UpdateLoad(); if (e != null) { Message.Show("File loading Error", e.Message); dispose(); return; } if (Loader.ItemsRemainingToLoad != 0) return; video.Update(); video.EnableRenderTarget(); video.ClearColorDepth(0, 0, 0, 1); rasterizerState.Enable(); depthStencilState.Enable(); samplerState.Enable(0); blendState.Enable(); viewPort.Size = FrameSize; viewPort.Apply(); camera.Apply(); font.DrawStart(camera); font.Draw(string.Format("RFPS: {0} - UFPS: {1}", time.FPS, uTime.FPS), new Vector2(), new Vector4(1), .5f, true, true); #if !XNA video.Present(); #endif }
public void Play(Time time) { foreach (var o in Objects) { o.Animate(CurrentFrame); } CurrentFrame += Model.FPS * time.Delta * PlaySpeed; if (CurrentFrame > Model.FrameEnd) CurrentFrame = Model.FrameStart + (CurrentFrame - Model.FrameEnd); if (CurrentFrame < Model.FrameStart) CurrentFrame = Model.FrameEnd + (CurrentFrame - Model.FrameStart); }
protected override void update(Time time) { if (!loaded) return; input.Update(); for (int i = 0; i != 256; ++i) { #if WIN32 || WINRT if (keyboard.Key(i).Down) System.Diagnostics.Debug.WriteLine(i); #else if (keyboard.Key(i).Down) Console.WriteLine(i); #endif } }
protected override void render(Time time) { if (!loaded) return; video.Update(); var e = Loader.UpdateLoad(); if (e != null) { Message.Show("Error", e.Message); dispose(); loaded = false; return; } if (Loader.ItemsRemainingToLoad != 0) return; input.Update(); video.EnableRenderTarget(); rasterizerState.Enable(); samplerState.Enable(0); blendState.Enable(); depthStencilState.Enable(); video.ClearColorDepth(0, .3f, .3f, 1); viewPort.Apply(); camera.Apply(); QuickDraw3ColorUVMaterial.Camera = camera.TransformMatrix; material.Diffuse = texture; material.Enable(); material.Apply(); qd.StartTriangles(); qd.Color(1, 1, 1, 1); qd.UV(0, 0); qd.Pos(-1, -1, 0); qd.UV(0, 1); qd.Pos(-1, 1, 0); qd.UV(1, 1); qd.Pos(1, 1, 0); qd.UV(0, 0); qd.Pos(-1, -1, 0); qd.UV(1, 1); qd.Pos(1, 1, 0); qd.UV(1, 0); qd.Pos(1, -1, 0); qd.End(); #if !XNA video.Present(); #endif }
protected override void update(Time time) { if (!loaded) return; #if WIN32 || WINRT || OSX if (keyboard.ArrowUp.On) camera.Zoom(1 * time.Delta, 1); if (keyboard.ArrowDown.On) camera.Zoom(-1 * time.Delta, 1); if (!mouse.Left.On) camera.RotateAroundLookLocationWorld(0, 1 * time.Delta, 0); else camera.RotateAroundLookLocation(mouse.Velocity.Y * 1 * time.Delta, mouse.Velocity.X * 1 * time.Delta, 0); #elif XNA if (gamePad.A.On) camera.Zoom(1 * time.Delta, 1); if (gamePad.B.On) camera.Zoom(-1 * time.Delta, 1); if (gamePad.LeftStick.Length() <= .1f) camera.RotateAroundLookLocationWorld(0, 1 * time.Delta, 0); else camera.RotateAroundLookLocation(-gamePad.LeftStick.Y * 1 * time.Delta, -gamePad.LeftStick.X * 1 * time.Delta, 0); if (gamePad.Back.Up) Exit(); #endif }
public virtual void Update(Time time) { }
public virtual void Render(Time time) { }
protected override void render(Time time) { if (!loaded) return; var e = Loader.UpdateLoad(); if (e != null) { Message.Show("Error", e.Message); dispose(); loaded = false; } if (Loader.ItemsRemainingToLoad != 0) return; video.Update(); video.EnableRenderTarget(); rasterizerState.Enable(); samplerState.Enable(0); blendState.Enable(); depthStencilState.Enable(); video.ClearColorDepth(0, .3f, .3f, 1); viewPort.Size = FrameSize; viewPort.Apply(); camera.Apply(); DiffuseTextureMaterial.Camera = camera.TransformMatrix; DiffuseTextureMaterial.LightDirection = -camera.Position.Normalize(); DiffuseTextureMaterial.LightColor = new Vector4(1); DiffuseTextureMaterial.BufferLayout.Enable(); // spheres renderMode = 0; var mesh = sphereModel.Meshes[0]; mesh.VertexBuffer.Enable(mesh.IndexBuffer); nextSphere = 0; foreach (var sphere in spheres) { mesh.Material.Apply(mesh); mesh.VertexBuffer.Draw(); } // floor box renderMode = 1; mesh = boxModel.Meshes[0]; mesh.VertexBuffer.Enable(mesh.IndexBuffer); mesh.Material.Apply(mesh); mesh.VertexBuffer.Draw(); // monkey renderMode = 2; mesh = monkeyModel.Meshes[0]; mesh.VertexBuffer.Enable(mesh.IndexBuffer); mesh.Material.Apply(mesh); mesh.VertexBuffer.Draw(); // ray cast /*var rayOrg = new JVector(0, 5, 0); var rayDir = new JVector(.3f, -1, 0); JVector normal; float fraction; collisionSystem.Raycast(floorBox, rayOrg, rayDir, out normal, out fraction); QuickDraw3ColorMaterial.Camera = camera.TransformMatrix; material.Enable(); material.Apply(); qd.StartLines(); qd.Color(0, 1, 0, 1); qd.Pos(rayOrg.X, rayOrg.Y, rayOrg.Z); var rayDirScale = rayDir * 50; qd.Pos(rayOrg.X+rayDirScale.X, rayOrg.Y+rayDirScale.Y, rayOrg.Z+rayDirScale.Z); qd.Color(1, 0, 0, 1); rayOrg = rayOrg + (rayDir * fraction); qd.Pos(rayOrg.X, rayOrg.Y, rayOrg.Z); normal *= 10; qd.Pos(rayOrg.X+normal.X, rayOrg.Y+normal.Y, rayOrg.Z+normal.Z); qd.End();*/ video.Present(); }
protected override void update(Time time) { if (!loaded) return; world.Step(time.Delta, true); camera.RotateAroundLookLocationWorld(0, 1 * time.Delta, 0); }
public override void Render(Time time) { if (!loaded) return; video.Update(); var e = Loader.UpdateLoad(); if (e != null) { Message.Show("File loading Error", e.Message); dispose(); return; } if (Loader.ItemsRemainingToLoad != 0) return; video.EnableRenderTarget(); rasterizerState.Enable(); depthStencilState.Enable(); blendState.Enable(); samplerState.Enable(0); video.ClearColorDepth(0, .3f, .3f, 1); viewPort.Size = video.BackBufferSize; viewPort.Apply(); camera.Apply(); DiffuseTextureMaterial.Camera = camera.TransformMatrix; DiffuseTextureMaterial.LightDirection = -camera.Position.Normalize(); DiffuseTextureMaterial.LightColor = new Vector4(1); model.Render(); ui.Render(); video.Present(); }
public override void Update(Time time) { if (!loaded) return; input.Update(); ui.Update(); camera.RotateAroundLookLocationWorld(0, 1 * time.Delta, 0); #if XNA && !SILVERLIGHT if (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).Buttons.Back == Microsoft.Xna.Framework.Input.ButtonState.Pressed) Exit(); #endif }
public override void Update(Time time) { if (!loaded) return; uTime = time; camera.RotateAroundLookLocationWorld(new Reign.Core.Vector3(.25f, .5f, .75f) * time.Delta); }
public override void Render(Time time) { if (!inited) return; video.Update(); var e = Loader.UpdateLoad(); if (e != null) { Message.Show("Loading Error", e.Message); dispose(); return; } if (Loader.ItemsRemainingToLoad != 0) return; if (!loaded) { loaded = true; return; } rasterizerState.Enable(); depthState.Enable(); blendState.Enable(); samplerState.Enable(0); video.EnableRenderTarget(); video.ClearColorDepth(0, .5f, .5f, 1); viewPort.Apply(); camera.Apply(); //DiffuseSolidColorMaterial.Camera = camera.TransformMatrix; //DiffuseSolidColorMaterial.LightColor = new Vector4(1); //DiffuseSolidColorMaterial.LightDirection = -new Vector3(1, .5f, .3f).Normalize(); DiffuseTextureMaterial.Camera = camera.TransformMatrix; DiffuseTextureMaterial.LightColor = new Vector4(1); DiffuseTextureMaterial.LightDirection = -new Vector3(1, .5f, .3f).Normalize(); model.Render(); instanceModel.PlaySpeed = 5; instanceModel.Render(); qdMaterial.Enable(); QuickDraw3ColorMaterial.Camera = camera.TransformMatrix; qdMaterial.Apply(); qd.StartLines(); foreach (var o in instanceModel.Objects) { var armObj = o as InstanceObjectArmature; if (armObj == null) continue; //var arm = armObj.Armature; foreach (var bone in armObj.Bones) { //if (bone.Parent == null) continue; qd.Color(1, 0, 0, 1); qd.Pos(bone.Position); qd.Pos(bone.Position + bone.RotationMatrix.X); qd.Color(0, 1, 0, 1); qd.Pos(bone.Position); qd.Pos(bone.Position + bone.RotationMatrix.Y); qd.Color(0, 0, 1, 1); qd.Pos(bone.Position); qd.Pos(bone.Position + bone.RotationMatrix.Z); } } qd.End(); /*qdMaterial.Enable(); QuickDraw3ColorMaterial.Camera = camera.TransformMatrix; qdMaterial.Apply(); qd.StartLines(); foreach (var o in model.Objects) { var armObj = o as ObjectArmature; if (armObj == null) continue; var arm = armObj.Armature; foreach (var bone in arm.Bones) { //if (bone.Parent == null) continue; qd.Color(1, 0, 0, 1); qd.Pos(bone.Position); qd.Pos(bone.Position + bone.Rotation.X); qd.Color(0, 1, 0, 1); qd.Pos(bone.Position); qd.Pos(bone.Position + bone.Rotation.Y); qd.Color(0, 0, 1, 1); qd.Pos(bone.Position); qd.Pos(bone.Position + bone.Rotation.Z); } } qd.End();*/ video.Present(); }
public override void Update(Time time) { if (!loaded) return; //camera.RotateAroundLookPositionWorld(0, time.Delta, 0); //rot += time.Delta; instanceModel.Play(time); }