// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); //animate the camera _camAngle = _camAngle + 50.0f * M.Pi / 180.0f * DeltaTime; //setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); //animate the cube1 _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), -1 * 5 * M.Sin(3 * TimeSinceStart)); //animate cube2 _cubeTransform2.Scale = _cubeTransform2.Scale + new float3(0, 0.01f * M.Sin(TimeSinceStart), 0); _cubeTransform2.Rotation = _cubeTransform2.Rotation + new float3(0, 0, 0.05f); //color cubeShader2.Effect.SetEffectParam("DiffuseColor", new float3(0, M.Sin(3 * TimeSinceStart), 0)); _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the cubes for (int i = 0; i < 5; i++) { _cubes[i].GetTransform().Translation = new float3((i * 2) * 10, 2 * M.Sin((2 * TimeSinceStart) + i), M.Cos(2 * TimeSinceStart)); _cubes[i].GetTransform().Rotation = new float3(0, 5 * M.Sin((2 * TimeSinceStart) + i), 0); _cubes[i].GetTransform().Scale = new float3(0.5f * M.Cos(TimeSinceStart + (i * M.PiOver4)) + 0.5f, 0.5f * M.Cos(TimeSinceStart + (i * M.PiOver4)) + 0.5f, 0.5f * M.Cos(TimeSinceStart + (i * M.PiOver4)) + 0.5f); } // Animate the camera angle _camAngle = _camAngle + 15.0f * M.Pi / 180.0f * DeltaTime; // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 100) * float4x4.CreateRotationY(_camAngle); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rerndered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); /* foreach (var _time in _cubeAnimation) * { * _time.Rotation.x = 1 * M.Sin(1 * TimeSinceStart); * _time.Rotation.z = 3 * M.Sin(1 * TimeSinceStart); * _time.Rotation.y = 2 * M.Sin(1 * TimeSinceStart); * } * * foreach (var _time in _cubeAnimation) * { * // _time.Translation.x -= 1.5f * M.Sin(10 * TimeSinceStart); * // _time.Translation.z += 1.0f * M.Sin(6 * TimeSinceStart); * * } */ // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 375.0f * DeltaTime; // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 200) * float4x4.CreateRotationY(_camAngle); _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the cubes for (int i = 0; i < 5; i++) { _cubes[i].GetTransform().Translation = new float3((i - 2) * 15, 15 * M.Sin((3 * TimeSinceStart) + (i * M.Pi / 4)), 0); _cubes[i].GetTransform().Rotation = new float3(0, 3 * TimeSinceStart, 0); _cubes[i].GetTransform().Scale = new float3(0.4f * M.Sin(TimeSinceStart + (i * M.Pi / 4)) + 0.6f, 0.4f * M.Sin(TimeSinceStart + (i * M.Pi / 4)) + 0.6f, 0.4f * M.Sin(TimeSinceStart + (i * M.Pi / 4)) + 0.6f); _cubes[i].GetMaterial().Diffuse = new MatChannelContainer { Color = new float3(1 - (i / 4.0f), 0.5f * M.Sin(3 * TimeSinceStart) + 0.5f, i / 4.0f) }; } // Animate the camera angle _camAngle = _camAngle + 10.0f * M.Pi / 180.0f * DeltaTime; // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 100) * float4x4.CreateRotationY(_camAngle); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rerndered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { Diagnostics.Log(TimeSinceStart); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Animate the cube Amplitude Geschwindigkeit _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); //neu _cubeTransform1.Translation = new float3(0, 10 * M.Sin(1 * TimeSinceStart), 15); //neu _cubeTransform2.Translation = new float3(5, 3 * M.Sin(7 * TimeSinceStart), 0); // Setup the camera ändert Position der Kamera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 20.0f * M.Pi / 180.0f * DeltaTime; //Drehung von 90° pro Sekunde (bei 90*M.Pi/180), egal wie mit vielen Frames die Animation läuft // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Animate the cube _cube1Transform.Translation = new float3(0, 2 * M.Sin(1.75f * TimeSinceStart), 0); _cube2Transform.Scale = new float3(0.5f * M.Sin(4 * TimeSinceStart) + 1, 1, 1); _cube3Transform.Translation = new float3(-20, 5, 5 * M.Sin(1.5f * TimeSinceStart)); _cube3Transform.Rotation = new float3(0, 0, (-M.Pi / 4 * TimeSinceStart)); cube3Shader.Effect = SimpleMeshes.MakeShaderEffect(new float3(0.5f * M.Sin(2 * TimeSinceStart) + 0.5f, 0.09f, 0.3f), new float3(1, 1, 1), 4); // Render the scene on the current render context _sceneRenderer.Render(RC); Diagnostics.Log(Time.DeltaTime); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); float2 speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } _yawCube1 += Keyboard.ADAxis * 0.1f; _pitchCube1 += Keyboard.WSAxis * 0.1f; _yawCube2 += Keyboard.LeftRightAxis * 0.1f; _pitchCube2 += Keyboard.UpDownAxis * 0.1f; // Setup matrices var aspectRatio = Width / (float)Height; var projection = float4x4.CreatePerspectiveFieldOfView(3.141592f * 0.25f, aspectRatio, 0.01f, 20); var view = float4x4.CreateTranslation(0, 0, 3) * float4x4.CreateRotationY(_alpha) * float4x4.CreateRotationX(_beta); // First cube var cube1Model = ModelXForm(new float3(0, 0, 0), new float3(_pitchCube1, _yawCube1, 0), new float3(0, 0, 0)); _xform = projection * view * cube1Model * float4x4.CreateScale(0.5f, 0.5f, 0.5f); RC.SetShaderParam(_xformParam, _xform); RC.Render(_mesh); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { Console.WriteLine("hallo"); Diagnostics.Log(TimeSinceStart); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle //_camAngle = _camAngle + 90.0f * M.Pi/180.0f * DeltaTime ; // Animate the cube 1 _cubeTransform.Translation = new float3(0, 6 * M.Sin(2 * TimeSinceStart) + 10, 0); _cubeTransform.Rotation = _cubeTransform.Rotation + new float3(0.05f * Time.DeltaTime, 0, 0); /* muss mit Time.DeltaTime multipiziert werden, damit auf jedem System die Animation gleich schnell abgespielt wird*/ _cubeTransform.Scale = new float3(1 * M.Sin(1 * TimeSinceStart), 1, 1 * M.Sin(4 * TimeSinceStart)); // Animation Quader 2 _quaderTransform.Translation = new float3(6 * M.Cos(10 * TimeSinceStart), -10, 0); _quaderTransform.Rotation = _quaderTransform.Rotation + new float3(0, 0.7f * Time.DeltaTime, 0.7f * Time.DeltaTime); //Animation Cube 3 _wuerfelDreiTransform.Translation = new float3(15, 2 * M.Sin(6 * TimeSinceStart), 15 * M.Sin(1 * TimeSinceStart)); _wuerfelDreiShader.Effect = SimpleMeshes.MakeShaderEffect(new float3(1, M.Sin(3 * TimeSinceStart), 0), new float3(1, 1, 1), 4); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); _cubeTransform.Rotation = _cubeTransform.Rotation + new float3(0, 0.0001f * Time.DeltaTime, 0); //Zeitschwankung durch Frameratenabhängikeit (einsehen?) //Diagnostics.Debug("DeltaTime: " + Time.DeltaTime); Diagnostics.Debug("Keyboard <-> axis:" + Keyboard.LeftRightAxis); _cubeTransform.Rotation = new float3(0, 90 * (3.141592f / 360.0f) * Time.TimeSinceStart, 0); Diagnostics.Debug("Keyboard <-> axis: " + Keyboard.LeftRightAxis); //Ausschlag des Würfels nach links und rechts _cubeTransform.Translation.x = 5 * M.Sin(2 * Time.TimeSinceStart); // Zeitausgabe auf der Console seit dem Start _cubeShader.SurfaceInput.Albedo = new float4(0.5f + 0.5f * M.Sin(2 * Time.TimeSinceStart), 0, 0, 1); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the content // Back clipping happens at 2000 (Anything further away from the camera than 2000 world units gets clipped, polygons will be cut) //var projection = float4x4.CreatePerspectiveFieldOfView(M.PiOver4, aspectRatio, 1, 20000); //RC.Projection = projection; Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); float2 speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } // Setup matrices var aspectRatio = Width / (float)Height; RC.Projection = float4x4.CreatePerspectiveFieldOfView(3.141592f * 0.25f, aspectRatio, 0.01f, 20); float4x4 view = float4x4.CreateTranslation(0, 0, 8) * float4x4.CreateRotationY(_alpha) * float4x4.CreateRotationX(_beta) * float4x4.CreateTranslation(0, -2f, 0); RC.ModelView = view; // TODO: Render the Root!! new RenderVisitor { rc = RC }.TraverseChildren(_root); // _root.Accept(new RenderVisitor {rc = RC}); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); // Animate the cube _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); _cube1Transform.Translation = new float3(2, 1 * M.Sin(4 * TimeSinceStart), 0); _cube2Transform.Translation = new float3(4, 2 * M.Sin(2 * TimeSinceStart), 0); _cube3Transform.Translation = new float3(6, 3 * M.Sin(1 * TimeSinceStart), 0); _cube4Transform.Translation = new float3(8, 4 * M.Sin(5 * TimeSinceStart), 0); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Animate the cube //ort _cubeTransform.Translation = new float3(0, 1 * M.Sin(2 * TimeSinceStart), 0); _cubeTransform2.Translation = new float3(0, 5 * M.Cos(2 * TimeSinceStart), 10); _cubeTransform3.Translation = new float3(0, 5 * M.Sin(2 * TimeSinceStart), 20); //skale _cubeTransform.Scale = new float3(1, M.Cos(2 * TimeSinceStart), 1); //Rotation _cubeTransform.Rotation = new float3(M.Cos(2 * TimeSinceStart), 1, 1); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); float gegenstandx = _baseTransform.Rotation.x; gegenstandx += 1.5f * DeltaTime * Keyboard.UpDownAxis; float gegenstandy = _baseTransform.Rotation.y; gegenstandy += 1.5f * DeltaTime * Keyboard.LeftRightAxis; _baseTransform.Rotation = new float3(gegenstandx, gegenstandy, 0); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 40) * float4x4.CreateRotationX(-(float)Math.Atan(15.0 / 40.0)); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animation cube //_cubeTransform.Translation = new float3(0, 10.0f * M.Sin(5 * TimeSinceStart), 0); //_cubeTransform.Rotation = new float3(4.5f * Time.DeltaTime, 0, 0); _cubeTransform.Scale = new float3(1, 1 - (M.Sin(3.5f * TimeSinceStart)), 1); // Animation cube2 _cube2Transform.Translation = new float3(10.0f * M.Sin(5 * TimeSinceStart), 0, 0); _cube2Transform.Rotation = new float3(0, 0, 1.5f * M.Sin(5 * TimeSinceStart)); // Animation cube3 _cube3Transform.Translation = new float3(-10.0f * M.Sin(5 * TimeSinceStart), 0, 20); _cube3Transform.Rotation = new float3(0, 0, -1.5f * M.Sin(5 * TimeSinceStart)); // Animate the camera angle _camAngle = _camAngle + 12.0f * M.Pi / 180.0f * DeltaTime; // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); foreach (var item in _scene.Children.Select((value, i) => new { i, value })) { var transformComponent = item.value.GetComponent <TransformComponent>(); transformComponent.Translation = new float3( transformComponent.Translation.x, 5 * M.Sin(4 * TimeSinceStart + item.i * 1), transformComponent.Translation.z ); float scaleValue = 0.3f * M.Sin(2 * TimeSinceStart + item.i * 1) + 1; transformComponent.Scale = new float3(scaleValue, scaleValue, scaleValue); } // Setup the camera _camAngle += 90.0f * M.Pi / 180.0f * DeltaTime; RC.View = float4x4.CreateTranslation(0, 0, 60) * float4x4.CreateRotationY(_camAngle); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }
// is called once a frame public override void RenderAFrame() { RC.Clear(ClearFlags.Color | ClearFlags.Depth); if (Input.Instance.IsButton(MouseButtons.Left)) { _pc.Pick(Input.Instance.GetMousePos()); } RC.SetShader(_spColor); var mtxCam = float4x4.LookAt(0, 200, 500, 0, 0, 0, 0, 1, 0); //Teapot RC.Model = float4x4.CreateTranslation(150, -50, 0); RC.View = mtxCam; RC.SetShaderParam(_colorParam, new float4(0.5f, 0.8f, 0, 1)); RC.Render(_meshTea); _pc.AddPickableObject(_meshTea, "Teapot", RC.Model, mtxCam); //Cube RC.Model = float4x4.CreateTranslation(-150, 0, 0) * float4x4.Scale(0.6f); RC.View = mtxCam; RC.SetShaderParam(_colorParam, new float4(0.8f, 0.5f, 0, 1)); RC.Render(_meshCube); _pc.AddPickableObject(_meshCube, "Cube", RC.Model, mtxCam); if (_pc.PickResults.Count > 0) { System.Console.WriteLine(_pc.PickResults[0].id); _pc.ClearResults(); } Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the back buffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); RC.Viewport(0, 0, Width, Height); var speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } // Create the camera matrix and set it as the current ModelView transformation var mtxRot = float4x4.CreateRotationX(_beta) * float4x4.CreateRotationY(_alpha); var mtxCam = float4x4.LookAt(0, 0, -3, 0, 0, 0, 0, 1, 0); RC.View = mtxCam * mtxRot; _renderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); RC.ClearColor = new float4(250 / 255 * M.Sin(3 * TimeSinceStart) + 1, 1 * M.Sin(3 * TimeSinceStart) + 1, 10 / 255 * M.Sin(3 * TimeSinceStart) + 1, 0); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); _cubeTransform2.Rotation = new float3(5 * TimeSinceStart, 0, 0); _cubeTransform3.Rotation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); _cubeTransform4.Translation = new float3(50 * M.Sin(3 * TimeSinceStart) - 70, 0, 0); _cubeTransform5.Rotation = new float3(0, TimeSinceStart, 0); _cubeTransform5.Scale = new float3(5 * M.Sin(3 * TimeSinceStart) + 1, 1 * M.Sin(3 * TimeSinceStart) + 1, 5 * M.Sin(3 * TimeSinceStart) + 1); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); //cubeShader = new float4(1, 0, 0, 1); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
public override void RenderAFrame() { RC.Clear(ClearFlags.Color | ClearFlags.Depth); PullUserInput(); if (runDemoAnimation) { DemoRotation(demoActionInterval, 1f); } RC.Render(_lfgmesh); //RC.Render(_FuseeMesh); // swap buffers Present(); if (_ShaderChange) { ShaderChanger(_ShaderType); } if (demoMode) { demoRunTime += Time.Instance.DeltaTime; } // If demo time is done quit the app if (demoTimeOut != 0.0 && demoRunTime > demoTimeOut) { CloseGameWindow(); } }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Animate the cube for (int i = 0; i < _count; i++) { int rotationDirection = -1; if (i % 2 == 0) { rotationDirection = 1; //if index is even then rotation direction is positive, if it's odd then direction is negative } float amplitude = 10 * M.Sin((float)i / (_count - 1) * 2 * M.Pi); //makes line of cubes swing as sine float scale = (float)1 / 20 * M.Max(_cubeTransform[i].Translation.y, -1 * _cubeTransform[i].Translation.y) + 1; //substitute for M.Abs (which doesn't seem to exist) _cubeTransform[i].Scale.y = scale; _cubeTransform[i].Scale.z = scale; _cubeTransform[i].Translation.y = amplitude * M.Sin(3 * TimeSinceStart); _cubeTransform[i].Rotation.x += rotationDirection * 90.0f * M.Pi / 180.0f * DeltaTime; } // Animate the camera angle (45 deg per second) _camAngle += 45.0f * M.Pi / 180.0f * DeltaTime; // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { float2 speed = Mouse.Velocity; float lr = Keyboard.LeftRightAxis; float ud = Keyboard.UpDownAxis; if (Mouse.LeftButton) { _alpha += speed.x * 0.0001f; } else { if (lr != 0) { _alpha += _alpha * 0.001f; } if (ud != 0) { _alpha += _alpha * 0.001f; } } _mouse = Mouse.Position; // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); //_alpha += 0.01f; RC.SetShaderParam(_mouseParam, _mouse); RC.SetShaderParam(_alphaParam, _alpha); RC.Render(_mesh); // Swap buffers: Show the contents of the backbuffer (containing the currently rerndered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Animate the cube _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); _cubeTransform.Rotation = new float3(2 * TimeSinceStart, TimeSinceStart / 3, 0); _cube2Transform.Scale = new float3(TimeSinceStart / 2, 2, 3); _cube2Transform.Rotation = new float3(0, 6 * TimeSinceStart, TimeSinceStart / 2); _cube3Transform.Translation = new float3(0, 7 * M.Sin(3 * TimeSinceStart), 0); _cube3Transform.Rotation = new float3(0, 2 * TimeSinceStart, TimeSinceStart / 2); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); _sceneRenderer.Render(RC); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(0.8f); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { Diagnostics.Log(TimeSinceStart); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Animate the cube _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); // Animate Würfel1 _cubeTransform1.Rotation = new float3(0, 4 * M.Sin(6 * TimeSinceStart), 0); //Animate Würfel2 _cubeTransform2.Scale = new float3(M.Sin(TimeSinceStart) + 3, M.Sin(TimeSinceStart) + 5, M.Sin(TimeSinceStart) + 1); // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Movement float2 speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } ControlEyes(); ControlWeels(); ControlNeck(); ControlLight(); ControlShininess(_wuggy, 0.05f * Mouse.WheelVel); // Setup matrices float4x4 view = float4x4.CreateTranslation(0, 0, 5) * float4x4.CreateRotationY(_alpha) * float4x4.CreateRotationX(_beta) * float4x4.CreateTranslation(0, -0.5f, 0); _renderer.View = view; _renderer.Traverse(_wuggy.Children); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); //EPILEPSIE-GEFAHR! RC.ClearColor = new float4(RC.ClearColor.r, RC.ClearColor.g + gCi, RC.ClearColor.b, RC.ClearColor.a); if (RC.ClearColor.g >= 1 || RC.ClearColor.g >= 0) { gCi = -gCi; } //camera postition RC.View = float4x4.CreateTranslation(0, 0, 200) * float4x4.CreateRotationY(_camAngle); //_cubeTransform.Translation = new float3(0, 5 * M.Sin(3 *TimeSinceStart), 0); _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); float2 speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } arrows.x -= Keyboard.LeftRightAxis * 0.1f; arrows.y -= Keyboard.UpDownAxis * 0.1f; wasd.x -= Keyboard.ADAxis * 0.1f; wasd.y -= Keyboard.WSAxis * 0.1f; // Setup matrices var aspectRatio = Width / (float)Height; RC.Projection = float4x4.CreatePerspectiveFieldOfView(3.141592f * 0.25f, aspectRatio, 0.01f, 20); float4x4 view = float4x4.CreateTranslation(0, 0, 8) * float4x4.CreateRotationY(_alpha) * float4x4.CreateRotationX(_beta) * float4x4.CreateTranslation(0, -2f, 0); FindSceneOb(_root, "leftupperleg").Rot = new float3(arrows.x, arrows.y, 0); FindSceneOb(_root, "leftknee").Rot = new float3(wasd.x, wasd.y, 0); FindSceneOb(_root, "rightshoulder").Rot = new float3(wasd.x, wasd.y, 0); FindSceneOb(_root, "rightellbow").Rot = new float3(arrows.x, arrows.y, 0); RenderSceneOb(_root, view); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); float2 speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } _wheelBigL.Rotation += new float3(-0.05f * Keyboard.WSAxis, 0, 0); // Setup matrices var aspectRatio = Width / (float)Height; RC.Projection = float4x4.CreatePerspectiveFieldOfView(3.141592f * 0.25f, aspectRatio, 0.01f, 20); float4x4 view = float4x4.CreateTranslation(0, 0, 5) * float4x4.CreateRotationY(_alpha) * float4x4.CreateRotationX(_beta) * float4x4.CreateTranslation(0, -0.5f, 0); _renderer.View = view; _renderer.Traverse(_wuggy.Children); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { SetProjectionAndViewport(); // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Animate the camera angle _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime; // Animate the cube cTransform[0].Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0); for (int i = 1; i < maxIndex; i++) { var scale = cTransform[i].Scale; if (scale.y > 0.2) { scale = new float3(scale.x, scale.y - 0.3f * DeltaTime, scale.z); } else { scale.y = 1; } cTransform[i].Scale = scale; } // Setup the camera RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle); _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer. Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); RC.Viewport(0, 0, Width, Height); var speed = Mouse.Velocity + Touch.GetVelocity(TouchPoints.Touchpoint_0); if (Mouse.LeftButton || Touch.GetTouchActive(TouchPoints.Touchpoint_0)) { _alpha -= speed.x * 0.0001f; _beta -= speed.y * 0.0001f; } // Create the camera matrix and set it as the current View transformation. var mtxRot = float4x4.CreateRotationX(_beta) * float4x4.CreateRotationY(_alpha); var mtxCam = float4x4.LookAt(0, 0, -80, 0, 0, 0, 0, 1, 0); RC.View = mtxCam * mtxRot * ModelXForm(new float3(-55, -8, 0), float3.Zero); _renderer.Render(RC); Present(); }
// RenderAFrame is called once a frame public override void RenderAFrame() { // Clear the backbuffer RC.Clear(ClearFlags.Color | ClearFlags.Depth); // Setup the camera if (Mouse.LeftButton) { _mouseSpeed = Mouse.Velocity.x * 0.00001f; _camAngle -= _mouseSpeed; } else { _camAngle -= _mouseSpeed; _mouseSpeed = _mouseSpeed * 0.8f; } RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle); //Move the Robot _bodyTransform.Rotation = new float3(0, _bodyTransform.Rotation.y + Keyboard.LeftRightAxis * Time.DeltaTime, 0); _upperArmTransform.Rotation = new float3(_upperArmTransform.Rotation.x + Keyboard.UpDownAxis * Time.DeltaTime, 0, 0); _foreArmTransform.Rotation = new float3(_foreArmTransform.Rotation.x + Keyboard.WSAxis * Time.DeltaTime, 0, 0); _GreifArm1Transform.Rotation = new float3(0, 0, _GreifArm1Transform.Rotation.z + Keyboard.ADAxis * Time.DeltaTime); _GreifArm2Transform.Rotation = new float3(0, 0, _GreifArm2Transform.Rotation.z - Keyboard.ADAxis * Time.DeltaTime); // Render the scene on the current render context _sceneRenderer.Render(RC); // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer. Present(); }