protected override void InternalUpdate(IAssetManager2D assetManager, RenderPassState renderPassState) { base.InternalUpdate(assetManager, renderPassState); if (!_isUpdatesAllowes) { return; } var currentRenderPassData = (LineRenderPassData)CurrentRenderPassData; var x = _fromX + (_toX - _fromX) * _animatedFraction; var y = InterpolateLinear(x, _fromX, _fromY, _toX, _toY); var indexToSet = currentRenderPassData.PointsCount() - 1; currentRenderPassData.XValues.Set(indexToSet, x); currentRenderPassData.YValues.Set(indexToSet, y); var xCoord = currentRenderPassData.XCoordinateCalculator.GetCoordinate(x); var yCoord = currentRenderPassData.YCoordinateCalculator.GetCoordinate(y); currentRenderPassData.XCoords.Set(indexToSet, xCoord); currentRenderPassData.YCoords.Set(indexToSet, yCoord); }
public void AddQuad(String pass, Quad zQuad) { if (!passState.ContainsKey (pass)) passState [pass] = new RenderPassState (); if (passState[pass].currentPrimitiveType != Type.PRIM_QUADS || passState[pass].nPrimsInBuffer >= VERT_BUFFER_SIZE / (uint)Type.PRIM_QUADS || passState[pass].currentTexture != zQuad.tex || passState[pass].currentBlendMode != zQuad.blend) { if (passState[pass].nPrimsInBuffer > 0) _enqueue_batch (pass); //Set up for new type passState[pass].currentPrimitiveType = Type.PRIM_QUADS; passState[pass].currentBlendMode = zQuad.blend; passState[pass].currentTexture = zQuad.tex; } uint offset = passState[pass].nPrimsInBuffer * (uint)Type.PRIM_QUADS; for (uint i = 0; i < 4; ++i) { passState[pass].vertBuffer[i + offset].Position.X = zQuad.v[i].Position.X; passState[pass].vertBuffer[i + offset].Position.Y = zQuad.v[i].Position.Y; passState[pass].vertBuffer[i + offset].Position.Z = zQuad.v[i].Position.Z; passState[pass].vertBuffer[i + offset].Colour = zQuad.v[i].Colour; passState[pass].vertBuffer[i + offset].UV.X = zQuad.v[i].UV.X; passState[pass].vertBuffer[i + offset].UV.Y = zQuad.v[i].UV.Y; } passState[pass].nPrimsInBuffer++; }
public void AddTriple(String pass, Triple zTriple) { if (!passState.ContainsKey (pass)) passState [pass] = new RenderPassState (); if (passState[pass].currentPrimitiveType != Type.PRIM_TRIPLES || passState[pass].nPrimsInBuffer >= VERT_BUFFER_SIZE / (uint)Type.PRIM_TRIPLES || passState[pass].currentTexture != zTriple.tex || passState[pass].currentBlendMode != zTriple.blend) { if (passState[pass].nPrimsInBuffer > 0) _enqueue_batch (pass); passState[pass].currentPrimitiveType = Type.PRIM_TRIPLES; passState[pass].currentBlendMode = zTriple.blend; passState[pass].currentTexture = zTriple.tex; } uint offset = passState[pass].nPrimsInBuffer * (uint)Type.PRIM_TRIPLES; for (uint i = 0; i < 3; ++i) { passState[pass].vertBuffer[i + offset].Position.X = zTriple.v[i].Position.X; passState[pass].vertBuffer[i + offset].Position.Y = zTriple.v[i].Position.Y; passState[pass].vertBuffer[i + offset].Position.Z = zTriple.v[i].Position.Z; passState[pass].vertBuffer[i + offset].Colour = zTriple.v[i].Colour; passState[pass].vertBuffer[i + offset].UV.X = zTriple.v[i].UV.X; passState[pass].vertBuffer[i + offset].UV.Y = zTriple.v[i].UV.Y; } passState[pass].nPrimsInBuffer++; }
public void AddLine(String pass, Vector3 a, Vector3 b, Rgba32 zColour) { if (!passState.ContainsKey (pass)) passState [pass] = new RenderPassState (); // If the array does not hold lines, or it is full // or the texture has changed, or the blend mode if (passState[pass].currentPrimitiveType != Type.PRIM_LINES || passState[pass].nPrimsInBuffer >= VERT_BUFFER_SIZE / (uint)Type.PRIM_LINES || passState[pass].currentTexture != null || passState[pass].currentBlendMode != BlendMode.Default) { if (passState[pass].nPrimsInBuffer > 0) _enqueue_batch (pass); passState[pass].currentPrimitiveType = Type.PRIM_LINES; passState[pass].currentBlendMode = BlendMode.Default; passState[pass].currentTexture = null; } uint i = passState[pass].nPrimsInBuffer * (uint)Type.PRIM_LINES; passState[pass].vertBuffer[i].Position = a; passState[pass].vertBuffer[i + 1].Position = b; passState[pass].vertBuffer[i].Colour = passState[pass].vertBuffer[i + 1].Colour = zColour; passState[pass].vertBuffer[i].UV.X = passState[pass].vertBuffer[i + 1].UV.X = passState[pass].vertBuffer[i].UV.Y = passState[pass].vertBuffer[i + 1].UV.Y = 0.0f; passState[pass].nPrimsInBuffer++; }