Esempio n. 1
0
 /// <summary>
 /// Initializes the texture dictionary and lists of the <see cref="RmdScene"/>.
 /// </summary>
 private void InitializeMembers()
 {
     mTextureDictionary = null;
     mClumps            = new List <RwClumpNode>();
     mNodeLinks         = new RmdNodeLinkListNode();
     mAnimations        = new List <RmdAnimation>();
     mMiscNodes         = new List <RwNode>();
 }
 internal RwTextureDictionaryStructNode(RwTextureDictionaryNode texDictionaryNode)
     : base(RwNodeId.RwStructNode, texDictionaryNode)
 {
     TextureCount = (ushort)texDictionaryNode.TextureCount;
     DeviceId     = texDictionaryNode.DeviceId;
 }
Esempio n. 3
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;
                }
            }
        }