private int AddStartOrEndPoint(int pointIndex, PenWorkspace ws, Buffer <CCVector2> positionBuffer, bool ccw) { int xyCount = ws.XYBuffer.Index; if (positionBuffer != null) { for (int i = 0; i < ws.OutlineIndexBuffer.Index; i++) { positionBuffer.SetNext(ws.XYBuffer[ws.OutlineIndexBuffer[i]]); } } if (_strokeType == StrokeType.Outline) { return(0); } int baseIndex = _vertexBufferIndex; _vertexBufferIndex += xyCount; for (int i = 0; i < xyCount; i++) { _positionData[baseIndex + i] = ws.XYBuffer[i]; } for (int i = 0; i < ws.IndexBuffer.Index; i++) { _indexData[_indexBufferIndex++] = (short)(baseIndex + ws.IndexBuffer[i]); } if (_colorData != null) { for (int i = 0; i < xyCount; i++) { _colorData[baseIndex + i] = _pen.ColorAt(ws.UVBuffer[i], ws.PathLengthScale); } } if (_textureData != null) { int texWidth = _pen.Brush.Texture.XNATexture.Width; int texHeight = _pen.Brush.Texture.XNATexture.Height; for (int i = baseIndex; i < _vertexBufferIndex; i++) { CCVector2 pos = _positionData[i]; _textureData[i] = new CCVector2(pos.X / texWidth, pos.Y / texHeight); } } _jointCCW[pointIndex] = ccw; return(xyCount); }
private void AddEndPoint (CCVector2 a, CCVector2 b, Pen pen, PenWorkspace ws) { pen.ComputeEndPoint(a, b, ws); AddVertex(ws.XYBuffer[0], pen.ColorAt(ws.UVBuffer[0], ws.PathLengthScale), pen); AddVertex(ws.XYBuffer[1], pen.ColorAt(ws.UVBuffer[1], ws.PathLengthScale), pen); }
/// <summary> /// Immediatley renders a <see cref="DrawCache"/> object. /// </summary> /// <param name="cache">A <see cref="DrawCache"/> object.</param> /// <remarks>Any previous unflushed geometry will be rendered first.</remarks> //public void DrawCache (DrawCache cache) //{ // if (_sortMode != DrawSortMode.Immediate) // SetRenderState(); // FlushBuffer(); // cache.Render(_device, _defaultTexture); //} //private void SetRenderState () //{ // _device.BlendState = (_blendState != null) // ? _blendState : BlendState.AlphaBlend; // _device.DepthStencilState = (_depthStencilState != null) // ? _depthStencilState : DepthStencilState.None; // _device.RasterizerState = (_rasterizerState != null) // ? _rasterizerState : RasterizerState.CullCounterClockwise; // _device.SamplerStates[0] = (_samplerState != null) // ? _samplerState : SamplerState.PointWrap; // _standardEffect.Projection = Matrix.CreateOrthographicOffCenter(0, _device.Viewport.Width, _device.Viewport.Height, 0, -1, 1); // _standardEffect.World = _transform; // _standardEffect.CurrentTechnique.Passes[0].Apply(); // if (_effect != null) // _effect.CurrentTechnique.Passes[0].Apply(); //} private void AddMiteredJoint (ref JoinSample js, Pen pen, PenWorkspace ws) { InsetOutsetCount vioCount = pen.ComputeMiter(ref js, ws); AddVertex(ws.XYInsetBuffer[0], pen.ColorAt(ws.UVInsetBuffer[0], ws.PathLengthScale), pen); AddVertex(ws.XYOutsetBuffer[0], pen.ColorAt(ws.UVOutsetBuffer[0], ws.PathLengthScale), pen); }