Exemple #1
0
 private void Read(BinaryReader reader)
 {
     Header      = RwNodeFactory.GetNode <RwWorldHeader>(this, reader);
     Materials   = RwNodeFactory.GetNode <RwMaterialListNode>(this, reader);
     PlaneSector = RwNodeFactory.GetNode <RwPlaneSector>(this, reader);
     Extension   = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
 }
Exemple #2
0
 /// <summary>
 /// Constructor only to be called in <see cref="RwNodeFactory"/>.
 /// </summary>
 internal RwTextureNativeNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
     : base(header)
 {
     mStructNode       = RwNodeFactory.GetNode <RwTextureNativeStructNode>(this, reader);
     mName             = RwNodeFactory.GetNode <RwStringNode>(this, reader);
     mMaskName         = RwNodeFactory.GetNode <RwStringNode>(this, reader);
     mRasterStructNode = RwNodeFactory.GetNode <RwRasterStructNode>(this, reader);
     mExtensionNode    = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
 }
Exemple #3
0
        /// <summary>
        /// Initializer only to be called in <see cref="RwNodeFactory"/>.
        /// </summary>
        internal RwUVAnimationDictionary(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            mStructNode   = RwNodeFactory.GetNode <RWUVAnimationDictionaryStructNode>(this, reader);
            _uvAnimations = new List <RwNode>(mStructNode.UvAnimationCount);

            for (int i = 0; i < mStructNode.UvAnimationCount; i++)
            {
                _uvAnimations.Add(RwNodeFactory.GetNode(this, reader));
            }
        }
Exemple #4
0
        internal RwPlaneSector(RwNodeFactory.RwNodeHeader header, BinaryReader reader) : base(header)
        {
            var endPosition = reader.BaseStream.Position + header.Size;

            Header = RwNodeFactory.GetNode <RwPlaneSectorHeader>(this, reader);

            while (reader.BaseStream.Position < endPosition)
            {
                RwNodeFactory.GetNode(this, reader);
            }
        }
        internal RwGeometryListNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            mStructNode   = RwNodeFactory.GetNode <RwGeometryListStructNode>(this, reader);
            mGeometryList = new List <RwGeometryNode>(mStructNode.GeometryCount);

            for (int i = 0; i < mStructNode.GeometryCount; i++)
            {
                mGeometryList.Add(RwNodeFactory.GetNode <RwGeometryNode>(this, reader));
            }
        }
Exemple #6
0
        internal RwMaterialListNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            mStructNode = RwNodeFactory.GetNode <RwMaterialListStructNode>(this, reader);
            mMaterials  = new List <RwMaterial>(mStructNode.MaterialCount);

            for (int i = 0; i < mStructNode.MaterialCount; i++)
            {
                mMaterials.Add(RwNodeFactory.GetNode <RwMaterial>(this, reader));
            }
        }
        internal RwExtensionNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            Children = new List <RwNode>();

            long end = reader.BaseStream.Position + header.Size;

            while (reader.BaseStream.Position != end)
            {
                RwNodeFactory.GetNode(this, reader);
            }
        }
Exemple #8
0
        protected internal override void ReadBody(BinaryReader reader)
        {
            mAnimationNodes = new List <RwNode>();

            var node = RwNodeFactory.GetNode(this, reader);

            while (node.Id != RwNodeId.RmdAnimationTerminatorNode)
            {
                mAnimationNodes.Add(node);
                node = RwNodeFactory.GetNode(this, reader);
            }
        }
Exemple #9
0
        /// <summary>
        /// Constructor only to be called in <see cref="RwNodeFactory.GetNode(RwNode, BinaryReader)"/>.
        /// </summary>
        internal RwTextureDictionaryNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            mStructNode = RwNodeFactory.GetNode <RwTextureDictionaryStructNode>(this, reader);
            mTextures   = new List <RwTextureNativeNode>(mStructNode.TextureCount);

            for (int i = 0; i < mStructNode.TextureCount; i++)
            {
                mTextures.Add(RwNodeFactory.GetNode <RwTextureNativeNode>(this, reader));
            }

            mExtensionNode = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
        }
        internal RwFrameListNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            mStruct         = RwNodeFactory.GetNode <RwFrameListStructNode>(this, reader);
            mExtensionNodes = new List <RwExtensionNode>(Count);

            for (int i = 0; i < Count; i++)
            {
                var extensionNode = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);

                mStruct.FrameList[i].HAnimFrameExtensionNode = extensionNode.FindChild <RwHAnimFrameExtensionNode>(RwNodeId.RwHAnimFrameExtensionNode);

                mExtensionNodes.Add(extensionNode);
            }
        }
Exemple #11
0
        /// <summary>
        /// Constructor only to be called in <see cref="RwNodeFactory"/>.
        /// </summary>
        internal RwClumpNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
            : base(header)
        {
            mStructNode  = RwNodeFactory.GetNode <RwClumpStructNode>(this, reader);
            FrameList    = RwNodeFactory.GetNode <RwFrameListNode>(this, reader);
            GeometryList = RwNodeFactory.GetNode <RwGeometryListNode>(this, reader);
            Atomics      = new List <RwAtomicNode>(mStructNode.AtomicCount);

            for (int i = 0; i < mStructNode.AtomicCount; i++)
            {
                Atomics.Add(RwNodeFactory.GetNode <RwAtomicNode>(this, reader));
            }

            if (RwNodeFactory.PeekNode(reader) == RwNodeId.RwExtensionNode)
            {
                mExtensionNodeNode = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
            }
            else
            {
                mExtensionNodeNode = new RwExtensionNode(this);
            }
        }
Exemple #12
0
 internal RwAtomicSector(RwNodeFactory.RwNodeHeader header, BinaryReader reader) : base(header)
 {
     Header    = RwNodeFactory.GetNode <RwAtomicSectorHeader>(this, reader);
     Extension = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
 }
 /// <summary>
 /// Initializer only to be called by <see cref="RwNodeFactory"/>.
 /// </summary>
 internal RwRasterStructNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
     : base(header)
 {
     mRasterInfoStructNode = RwNodeFactory.GetNode <RwRasterInfoStructNode>(this, reader);
     mRasterDataStructNode = RwNodeFactory.GetNode <RwRasterDataStructNode>(this, reader);
 }
Exemple #14
0
 /// <summary>
 /// Initializer only to be called in <see cref="RwNodeFactory"/>.
 /// </summary>
 internal RwAtomicNode(RwNodeFactory.RwNodeHeader header, BinaryReader reader)
     : base(header)
 {
     mStructNode    = RwNodeFactory.GetNode <RwAtomicStructNode>(this, reader);
     mExtensionNode = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
 }
Exemple #15
0
        /// <summary>
        /// Read the <see cref="RmdScene"/> from a <see cref="Stream"/> using a <see cref="BinaryReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="BinaryReader"/> attached to a <see cref="Stream"/> containing <see cref="RmdScene"/> data.</param>
        protected internal override void ReadBody(BinaryReader reader)
        {
            List <RwNode> unfilteredNodes = new List <RwNode>();

            // Initial pass, read all nodes into a list and filter the animation set count, texture dictionary, scenes and attach frame list out.
            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                RwNode node = RwNodeFactory.GetNode(this, reader);

                switch (node.Id)
                {
                case RwNodeId.RmdAnimationCountNode:
                    // skip this node as its entirely redundant
                    break;

                case RwNodeId.RwTextureDictionaryNode:
                    mTextureDictionary = (RwTextureDictionaryNode)node;
                    break;

                case RwNodeId.RwClumpNode:
                    mClumps.Add((RwClumpNode)node);
                    break;

                case RwNodeId.RmdNodeLinkListNode:
                    // Retrieve the list of frame links from the node and skip the node itself
                    mNodeLinks = (RmdNodeLinkListNode)node;
                    break;

                case RwNodeId.RmdAuthor:
                    // pass through
                    break;

                default:
                    unfilteredNodes.Add(node);
                    break;
                }
            }

            // Second pass, sort the remaining nodes into misc nodes and animation sets
            for (int i = 0; i < unfilteredNodes.Count; i++)
            {
                switch (unfilteredNodes[i].Id)
                {
                case RwNodeId.RwAnimationNode:
                case RwNodeId.RwUVAnimationDictionaryNode:
                case RwNodeId.RmdAnimationPlaceholderNode:
                case RwNodeId.RmdAnimationInstanceNode:
                case RwNodeId.RmdAnimationTerminatorNode:
                case RwNodeId.RmdTransformOverrideNode:
                case RwNodeId.RmdVisibilityAnimNode:
                case RwNodeId.RmdParticleAnimationNode:
                    // Read an animation set, this function will increment the loop iterator variable
                    mAnimations.Add(CreateAnimationSet(unfilteredNodes, ref i));
                    break;

                default:
                    mMiscNodes.Add(unfilteredNodes[i]);
                    break;
                }
            }
        }