Example #1
0
        protected virtual void writeParticle(int idx, SSParticle p)
        {
            _lives [idx] = p.life;
            writeDataIfNeeded(ref _positions, idx, new SSAttributeVec3(p.pos));
            writeDataIfNeeded(ref _orientationsXY, idx, new SSAttributeVec2(p.orientation.Xy));
            writeDataIfNeeded(ref _orientationsZ, idx, new SSAttributeFloat(p.orientation.Z));
            writeDataIfNeeded(ref _masterScales, idx, new SSAttributeFloat(p.masterScale));
            writeDataIfNeeded(ref _componentScalesXY, idx, new SSAttributeVec2(p.componentScale.Xy));
            writeDataIfNeeded(ref _componentScalesZ, idx, new SSAttributeFloat(p.componentScale.Z));
            writeDataIfNeeded(ref _colors, idx, new SSAttributeColor(Color4Helper.ToUInt32(p.color)));

            //writeDataIfNeeded(ref m_spriteIndices, idx, new SSAttributeByte(p.SpriteIndex));
            writeDataIfNeeded(ref _spriteOffsetsU, idx, new SSAttributeFloat(p.spriteRect.X));
            writeDataIfNeeded(ref _spriteOffsetsV, idx, new SSAttributeFloat(p.spriteRect.Y));
            writeDataIfNeeded(ref _spriteSizesU, idx, new SSAttributeFloat(p.spriteRect.Width));
            writeDataIfNeeded(ref _spriteSizesV, idx, new SSAttributeFloat(p.spriteRect.Height));

            writeDataIfNeeded(ref _velocities, idx, p.vel);
            writeDataIfNeeded(ref _angularVelocities, idx, p.angularVelocity);
            writeDataIfNeeded(ref _masses, idx, p.mass);
            writeDataIfNeeded(ref _rotationalInnertias, idx, p.rotationalInnertia);
            writeDataIfNeeded(ref _drags, idx, p.drag);
            writeDataIfNeeded(ref _rotationalDrags, idx, p.rotationalDrag);
            writeDataIfNeeded(ref _viewDepths, idx, p.viewDepth);
            writeDataIfNeeded(ref _effectorMasksHigh, idx, (byte)((p.effectorMask & 0xFF00) >> 8));
            writeDataIfNeeded(ref _effectorMasksLow, idx, (byte)(p.effectorMask & 0xFF));
        }
Example #2
0
            protected override void writeParticle(int idx, SSParticle p)
            {
                #if false
                // attempt of only writing things that are relevant; skipping the rest
                _lives [idx] = p.life;
                writeDataIfNeeded(ref _positions, idx, new SSAttributeVec3(p.pos));
                writeDataIfNeeded(ref _viewDepths, idx, p.viewDepth);
                writeDataIfNeeded(ref _effectorMasksHigh, idx, (ushort)((p.effectorMask & 0xFF00) >> 8));
                writeDataIfNeeded(ref _effectorMasksLow, idx, (ushort)(p.effectorMask & 0xFF));
                writeDataIfNeeded(ref _colors, idx, new SSAttributeColor(Color4Helper.ToUInt32(p.color)));
                #else
                // for some reason the above doesn't work, so lets just do things slightly less efficiently for now
                base.writeParticle(idx, p);
                #endif

                var ts         = (STrailsSegment)p;
                var innerColor = Color4Helper.ToUInt32(ts.cylInnerColor);
                writeDataIfNeeded(ref _cylInnerColors, idx, new SSAttributeColor(innerColor));
                writeDataIfNeeded(ref _innerColorRatios, idx, new SSAttributeFloat(ts.innerColorRatio));
                writeDataIfNeeded(ref _outerColorRatios, idx, new SSAttributeFloat(ts.outerColorRatio));
                writeDataIfNeeded(ref _cylAxes, idx, new SSAttributeVec3(ts.cylAxis));
                writeDataIfNeeded(ref _prevJointAxes, idx, new SSAttributeVec3(ts.prevJointAxis));
                writeDataIfNeeded(ref _nextJointAxes, idx, new SSAttributeVec3(ts.nextJointAxis));
                writeDataIfNeeded(ref _cylLengths, idx, new SSAttributeFloat(ts.cylLendth));
                writeDataIfNeeded(ref _cylWidths, idx, new SSAttributeFloat(ts.cylWidth));
                writeDataIfNeeded(ref _nextSegmentData, idx, ts.nextSegmentIdx);
                writeDataIfNeeded(ref _prevSegmentData, idx, ts.prevSegmentIdx);
            }
Example #3
0
 public SSVertex_PosColor(Vector3 pos, Color4 color)
 {
     Position = pos;
     Color    = Color4Helper.ToUInt32(color);
 }