void RenderResults(RenderMode renderMode, simengine.MatrixTransforms transforms, simengine.CameraEntity currentCamera) { _timeAttenuationHandle.SetValue(new xna.Vector4(100 * (float)Math.Cos(_appTime * (1.0f / SCAN_INTERVAL)), 0, 0, 1)); // render impact points as a quad xna.Matrix inverseViewRotation = currentCamera.ViewMatrix; inverseViewRotation.M41 = inverseViewRotation.M42 = inverseViewRotation.M43 = 0; xna.Matrix.Invert(ref inverseViewRotation, out inverseViewRotation); xna.Matrix localTransform = xna.Matrix.CreateFromAxisAngle(new xna.Vector3(1, 0, 0), (float)-Math.PI / 2) * inverseViewRotation; simengine.SimulationEngine.GlobalInstance.Device.DepthStencilState = xnagrfx.DepthStencilState.DepthRead; for (int i = 0; i < _lastResults.ImpactPoints.Count; i++) { xna.Vector3 pos = new xna.Vector3(_lastResults.ImpactPoints[i].Position.X, _lastResults.ImpactPoints[i].Position.Y, _lastResults.ImpactPoints[i].Position.Z); xna.Vector3 resultDir = pos - Position; resultDir.Normalize(); localTransform.Translation = pos - .02f * resultDir; transforms.World = localTransform; base.Render(renderMode, transforms, Meshes[0]); } simengine.SimulationEngine.GlobalInstance.Device.DepthStencilState = xnagrfx.DepthStencilState.Default; }
/// <summary> /// Frame render /// </summary> public override void Render(RenderMode renderMode, simengine.MatrixTransforms transforms, simengine.CameraEntity currentCamera) { if ((int)(Flags & simengine.VisualEntityProperties.DisableRendering) > 0) { return; } if (_lastResults != null) { RenderResults(renderMode, transforms, currentCamera); } }