public void UpdateAxisLine() { _axisBottom.Position = _position - _rotAxis * _radius * 1.4f; _axisTop.Position = _position + _rotAxis * _radius * 1.4f; _axisLine.Clear(); _axisLine.AddPoint(_axisBottom); _axisLine.AddPoint(_axisTop); _axisLine.Configure(_renderer); }
public void UpdateVelocityLineAndBall() { _velLine.Clear(); _velOrigin.Position = _position; _velBallPos = _position + (2.2f * _radius) * _velDir; _velTip.Position = _velBallPos; _velBall.Position = _velBallPos; _velBallRadius = _radius * 0.2f; _velBall.Scale = new Vector3(_velBallRadius); _velLine.AddPoint(_velOrigin); _velLine.AddPoint(_velTip); _velLine.Configure(_renderer); }
public void Load() { InitRenderer(); _resourceManager.Configure(_renderer); _curve = new Curve("curve", 2); _curve.Material = _resourceManager.GetMaterial("lineMaterial"); _curve.Configure(_renderer); _points = new Points("points", 5); _points.Material = _resourceManager.GetMaterial("pointMaterial"); _points.Configure(_renderer); }
public void MouseDown(ControllerMouseButton button, int x, int y) { float adjustedX = (2.0f * (float)x / (float)_width) - 1; float adjustedY = (2.0f * (float)(_height - y) / (float)_height) - 1; var mousePoint = new Vector3(adjustedX, adjustedY, 0); _curve.AddPoint(new Vertex(mousePoint, new Vector3(), new Vector3())); //_points.AddPoint(new Vertex(mousePoint, new Vector3(), new Vector3())); if (_isFirstTime) { _curve.Configure(_renderer); //_points.Configure(_renderer); _isFirstTime = false; } else { _curve.Update(_renderer); //_points.Update(_renderer); } }
public CelestialBody(UniverseSimulatorController controller, Vector3 position, ShapeNode shape, IScene scene, IMaterial axisMaterial, IRenderer renderer, ShapeNode velShape, IMaterial velMaterial) { _controller = controller; _shape = shape; _defaultMaterial = shape.Shape.Material; _scene = scene; _renderer = renderer; _radius = 20; _mass = 100; _position = position; _velLength = 1; _velDir = Vector3.UnitX; _velocity = _velDir * _velLength; _rotAxis = Vector3.UnitZ; _angularRot = 0; _angularVel = 0; _hasGravity = false; _isLightSource = false; _isLightInScene = false; _name = "No name"; _nextPosition = _position; _nextVelocity = _velocity; _shapeToCelestialBodyMap.Add(_shape, this); _shape.Scale = new Vector3(_radius); _shape.Position = _position; _shape.Rotation = TextureCorrection; _lightUp = new PointLight(Color4.Yellow); _lightDown = new PointLight(Color4.Yellow); _lightLeft = new PointLight(Color4.Yellow); _lightRight = new PointLight(Color4.Yellow); _lightFront = new PointLight(Color4.Yellow); _lightBack = new PointLight(Color4.Yellow); //_lightCenter = new PointLight(Color4.Yellow); _axisLine = new Curve("axis" + _axisCounter++, 4); _axisLine.Material = axisMaterial; _axisBottom = new Vertex(_position - _rotAxis * _radius * 1.4f, DummyVector3, DummyVector3); _axisTop = new Vertex(_position + _rotAxis * _radius * 1.4f, DummyVector3, DummyVector3); _axisLine.AddPoint(_axisBottom); _axisLine.AddPoint(_axisTop); _axisLine.Configure(_renderer); _axisAlignmentRot = TextureCorrection; _aroundAxisRot = Quaternion.Identity; //velocity ball and line _velBall = velShape; _velOrigin = new Vertex(); _velTip = new Vertex(); _velLine = new Curve("velLine" + _velLineCounter++, 2); _velLine.Material = velMaterial; UpdateVelocityLineAndBall(); }