public static void WriteNumberSequence(EndianAwareBinaryWriter writer, NumberSequence sequence) { writer.WriteInt32(sequence.Keypoints.Length); for (var i = 0; i < sequence.Keypoints.Length; i++) { writer.WriteSingle(sequence.Keypoints[i].Time); writer.WriteSingle(sequence.Keypoints[i].Value); writer.WriteSingle(sequence.Keypoints[i].Envelope); } }
public static void WriteColorSequence(EndianAwareBinaryWriter writer, ColorSequence sequence) { writer.WriteInt32(sequence.Keypoints.Length); for (var i = 0; i < sequence.Keypoints.Length; i++) { writer.WriteSingle(sequence.Keypoints[i].Time); writer.WriteSingle(sequence.Keypoints[i].Value.R); writer.WriteSingle(sequence.Keypoints[i].Value.G); writer.WriteSingle(sequence.Keypoints[i].Value.B); } }
public static void WritePhysicalProperties(EndianAwareBinaryWriter writer, PhysicalProperties value) { writer.WriteByte((byte)(value.Enabled ? 1 : 0)); if (value.Enabled) { writer.WriteSingle(value.Density); writer.WriteSingle(value.Friction); writer.WriteSingle(value.Elasticity); writer.WriteSingle(value.FrictionWeight); writer.WriteSingle(value.ElasticityWeight); } }
public static void WriteCFrameArray(EndianAwareBinaryWriter writer, CFrame[] values) { // Write matrix values for (int i = 0; i < values.Length; i++) { var specialMatrixType = GetSpecialMatrixType(values[i]); if (specialMatrixType != 0) { writer.WriteByte(specialMatrixType); } else { writer.WriteByte(0); writer.WriteSingle(values[i].Matrix.M00); writer.WriteSingle(values[i].Matrix.M01); writer.WriteSingle(values[i].Matrix.M02); writer.WriteSingle(values[i].Matrix.M10); writer.WriteSingle(values[i].Matrix.M11); writer.WriteSingle(values[i].Matrix.M12); writer.WriteSingle(values[i].Matrix.M20); writer.WriteSingle(values[i].Matrix.M21); writer.WriteSingle(values[i].Matrix.M22); } } // Write position values // TODO This could be made more efficient by creating a streaming method for writing interleaved arrays var xValues = new float[values.Length]; var yValues = new float[values.Length]; var zValues = new float[values.Length]; for (var i = 0; i < values.Length; i++) { xValues[i] = values[i].Position.X; yValues[i] = values[i].Position.Y; zValues[i] = values[i].Position.Z; } WriteFloatArray(writer, xValues); WriteFloatArray(writer, yValues); WriteFloatArray(writer, zValues); }
private static void WriteVector3(EndianAwareBinaryWriter writer, Vector3 val) { writer.WriteSingle(val.X); writer.WriteSingle(val.Y); writer.WriteSingle(val.Z); }
public static void WriteNumberRange(EndianAwareBinaryWriter writer, NumberRange range) { writer.WriteSingle(range.Min); writer.WriteSingle(range.Max); }