Example #1
0
        internal static W3dEmitterRotationHeader Parse(BinaryReader reader)
        {
            var result = new W3dEmitterRotationHeader
            {
                KeyframeCount     = reader.ReadUInt32(),
                Random            = reader.ReadSingle(),
                OrientationRandom = reader.ReadSingle()
            };

            reader.ReadBytes(sizeof(uint)); // Pad

            return(result);
        }
Example #2
0
        internal static W3dEmitterRotationKeyframes Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dEmitterRotationKeyframes
                {
                    Header = W3dEmitterRotationHeader.Parse(reader)
                };

                // Certain enb w3d's break without this check. (example: astro00.w3d)
                if (reader.BaseStream.Position < context.CurrentEndPosition)
                {
                    var remaining = (int)context.CurrentEndPosition - (int)reader.BaseStream.Position;
                    var KeyframeCount = remaining / 8;
                    result.Keyframes = new W3dEmitterRotationKeyframe[KeyframeCount];
                    for (var i = 0; i < result.Keyframes.Length; i++)
                    {
                        result.Keyframes[i] = W3dEmitterRotationKeyframe.Parse(reader);
                    }
                }

                return result;
            }));
        }