public virtual void quad(Vector2 min, Vector2 max, Vector2 pivot, Real rotation) { var item = new GLRenderable(); item.color = _state.color; item.depth = _state.depth; item.material = _state.material; item.texture = _state.texture; item.pivot = pivot; item.scale = (max - min) * _state.scale; item.position = (_state.position + min) * _state.scale; item.rotation = rotation; item.scissorRect = _clipping; item.applyScissor = !_clipping.IsNull; item.sourceRectangle = _state.source; item.effect = _effect; item.type = GLRenderableType.Quad; item.key = 0; draw(item); }
protected virtual void draw(GLRenderable item) { verifyBegin(); if (_renderableIndex == _renderableItems.Length) { Array.Resize(ref _renderableItems, _renderableItems.Length * 3 / 2); } if (item.material == null) { item.material = defaultMaterial; } if (item.texture == null) { item.texture = defaultTexture; } //HACK: item.key = item.material.getSortKey(_sortMode); item.key = item.material.id; _renderableItems[_renderableIndex++] = item; }
public void line(Vector2 start, Vector2 end, Real width, Real rotation) { if (rotation != 0) { start = start.Rotate(Vector2.Zero, rotation); end = end.Rotate(Vector2.Zero, rotation); } var diff = end - start; //var srcRect = new AxisAlignedBox(start.X, start.Y - width * 0.5f, start.X + diff.Length(), start.Y + width * 0.5f); var srcRect = new AxisAlignedBox2(start.X, start.Y, start.X + width, start.Y + diff.Length); diff.Normalize(); var _rotation = Utility.ATan2(diff.Y, diff.X) - Utility.PIOverTwo; //Draw(renderQueue, material, srcRect, AxisAlignedBox2.Null, color, rotation, new Vector2(0.5f, 0), SpriteEffects.None, depth); var item = new GLRenderable(); item.color = _state.color; item.depth = _state.depth; item.material = _state.material; item.pivot = new Vector2(0.5f, 0); item.position = (_state.position + start) * _state.scale; item.rotation = _rotation; item.scale = srcRect.Size * _state.scale; item.scissorRect = _clipping; item.applyScissor = !_clipping.IsNull; item.sourceRectangle = _state.source; item.effect = _effect; item.type = GLRenderableType.Line; item.key = 0; draw(item); }
protected abstract void ondraw(GLRenderable item);
public void draw(GLRenderable item) { checkDisposed(); ondraw(item); }