public Editor() { _tools = new Tools(this); _manager = new RenderManager(); if (_editorCamera == null) { _editorCamera = new Camera(); _editorCamera.CameraType = CameraType.Orthogonal; _editorCamera.Position = new Vector3(0, 0, 200); _editorCamera.LookAt = new Vector3(0, 0, 0); _editorCamera.ZNear = 0; _editorCamera.ZFar = 10000; _editorCamera.Up = new Vector3(0, 1, 0); _editorCamera.Fov = 1.0f; } if (_guiCamera == null) { _guiCamera = new Camera(); _guiCamera.CameraType = CameraType.HUD; _guiCamera.Position = new Vector3(0, 0, 200); _guiCamera.LookAt = new Vector3(0, 0, 0); _guiCamera.ZNear = 0; _guiCamera.ZFar = 10000; _guiCamera.Up = new Vector3(0, 1, 0); } _guiFont = new TokGL.Font(Plugins.LoadResourceStream("ArialWhite.png"), Plugins.LoadResourceStream("ArialWhite.info")); _spriteBatch = new SpriteBatch(); _lineBatch = new LineBatch(); }
public override void DrawContent(LineBatch lineBatch, SpriteBatch spriteBatch) { base.DrawContent(lineBatch, spriteBatch); lineBatch.Add(_spriteDef.P1, _spriteDef.P2, Color.Green); lineBatch.Add(_spriteDef.P3); lineBatch.Add(_spriteDef.P4); lineBatch.Add(_spriteDef.P1); }
public override void DrawGui(LineBatch lineBatch, SpriteBatch spriteBatch) { var ray = Camera.GetWorldRay(MousePos); var plane = new Plane(new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(0, 1, 0)); float? distance; ray.Intersects(ref plane, out distance); if (distance != null) { var pos = ray.Position + Vector3.Multiply(ray.Direction, distance.Value); spriteBatch.AddText(GuiFont, 250, 0, string.Format("X={0:n2} Y={1:n2}", pos.X, pos.Y), Color.White, HorizontalAlignment.Left, VerticalAlignment.Top); } }
public override void DrawContent(LineBatch lineBatch, SpriteBatch spriteBatch) { if (_mat != null) { spriteBatch.AddSprite(_mat, 0, 0, 0, 0, _mat[TextureUnit.Texture0].Width, _mat[TextureUnit.Texture0].Height); lineBatch.AddBox(0, 0, _mat[TextureUnit.Texture0].Width, _mat[TextureUnit.Texture0].Height, Color.Red); } else { lineBatch.Add(new Vector2(-100, -100), new Vector2(100, 100), Color.Red); lineBatch.Add(new Vector2(100, -100), new Vector2(-100, 100), Color.Red); } }
protected override void OnDrawGui(LineBatch lineBatch) { Color c = Selected ? Color.Orange : Color.White; switch (_handleType) { case HandleType.Box: lineBatch.AddBox(ScreenPos.X - _length / 2.0f, ScreenPos.Y - _length / 2.0f, _length, _length, c); break; case Editors.HandleType.Cross: lineBatch.Add(new Vector2(ScreenPos.X, ScreenPos.Y - _length), new Vector2(ScreenPos.X, ScreenPos.Y + _length), c); lineBatch.Add(new Vector2(ScreenPos.X - _length, ScreenPos.Y), new Vector2(ScreenPos.X + _length, ScreenPos.Y), c); break; } }
public override void DrawContent(LineBatch lineBatch, SpriteBatch spriteBatch) { _lineBatch = lineBatch; _spriteBatch = spriteBatch; if (_scene != null) RenderGameObject(_scene, Matrix4.Identity); }
public virtual void Draw(LineBatch lineBatch, SpriteBatch spriteBatch) { }
protected virtual void OnDrawWorld(LineBatch lineBatch) { }
protected virtual void OnDrawGui(LineBatch lineBatch) { }
public void DrawWorld(LineBatch lineBatch) { if (_visible) { foreach (var child in _children) { child.DrawWorld(lineBatch); } OnDrawWorld(lineBatch); } }