Beispiel #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);
 }
Beispiel #2
0
 /// <summary>
 /// Initialize a new <see cref="RwTextureDictionaryNode"/> instance with an <see cref="IList{T}"/> of texture nodes.
 /// </summary>
 /// <param name="textures"><see cref="IList{T}"/>containing texture nodes to initialize the dictionary with.</param>
 public RwTextureDictionaryNode(IList <RwTextureNativeNode> textures)
     : base(RwNodeId.RwTextureDictionaryNode)
 {
     Textures       = textures.ToList();
     mExtensionNode = new RwExtensionNode(this);
     mStructNode    = new RwTextureDictionaryStructNode(this);
 }
Beispiel #3
0
 /// <summary>
 /// Initialize a new empty <see cref="RwTextureDictionaryNode"/> instance.
 /// </summary>
 public RwTextureDictionaryNode()
     : base(RwNodeId.RwTextureDictionaryNode)
 {
     mStructNode    = new RwTextureDictionaryStructNode(this);
     mTextures      = new List <RwTextureNativeNode>();
     mExtensionNode = new RwExtensionNode(this);
 }
Beispiel #4
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);
 }
Beispiel #5
0
 public RwClumpNode(RwNode parent)
     : base(RwNodeId.RwClumpNode, parent)
 {
     Atomics            = new List <RwAtomicNode>();
     FrameList          = new RwFrameListNode(this);
     GeometryList       = new RwGeometryListNode(this);
     mExtensionNodeNode = new RwExtensionNode(this);
     mStructNode        = new RwClumpStructNode(this);
 }
Beispiel #6
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);
        }
Beispiel #7
0
        public RwTextureDictionaryNode(Stream stream, bool leaveOpen)
            : base(RwNodeId.RwTextureDictionaryNode)
        {
            var node = Load(stream, leaveOpen) as RwTextureDictionaryNode;

            if (node == null)
            {
                throw new System.Exception();
            }

            mStructNode    = node.mStructNode;
            mTextures      = node.mTextures;
            mExtensionNode = node.mExtensionNode;
        }
Beispiel #8
0
        /// <summary>
        /// Initializes an <see cref="RwTextureNativeNode"/> instance using a name, width, height, palette, indices and a PS2 pixel format to encode to.
        /// </summary>
        /// <param name="name">Name of the texture used for material references.</param>
        /// <param name="width">Width of the texture.</param>
        /// <param name="height">Height of the texture.</param>
        /// <param name="palette">Texture palette data.</param>
        /// <param name="indices">Texture pixel indices into the palette.</param>
        /// <param name="pixelFormat">PS2 Pixel format to encode the bitmap to.</param>
        public RwTextureNativeNode(string name, int width, int height, Color[] palette, byte[] indices, PS2PixelFormat pixelFormat)
            : base(RwNodeId.RwTextureNativeNode)
        {
            if (width % 2 != 0 || height % 2 != 0)
            {
                throw new ArgumentException(EXCEPTION_NOT_POW2);
            }

            if (width > 1024 || width > 1024)
            {
                throw new ArgumentException(EXCEPTION_DIMENSION_TOO_BIG);
            }

            mStructNode       = new RwTextureNativeStructNode(this);
            mName             = new RwStringNode(name, this);
            mMaskName         = new RwStringNode(string.Empty, this);
            mRasterStructNode = new RwRasterStructNode(width, height, palette, indices, pixelFormat, this);
            mExtensionNode    = new RwExtensionNode(this, new RwSkyMipMapValueNode());
        }
Beispiel #9
0
        /// <summary>
        /// Initializes an <see cref="RwTextureNativeNode"/> instance using a bitmap, name and a PS2 pixel format to encode to.
        /// </summary>
        /// <param name="name">Name of the texture used for material references.</param>
        /// <param name="bitmap">Source bitmap used to encode.</param>
        /// <param name="pixelFormat">PS2 Pixel format to encode the bitmap to.</param>
        public RwTextureNativeNode(string name, Bitmap bitmap, PS2PixelFormat pixelFormat)
            : base(RwNodeId.RwTextureNativeNode)
        {
            if (bitmap.Width % 2 != 0 || bitmap.Height % 2 != 0)
            {
                throw new ArgumentException(EXCEPTION_NOT_POW2);
            }

            if (bitmap.Width > 1024 || bitmap.Width > 1024)
            {
                throw new ArgumentException(EXCEPTION_DIMENSION_TOO_BIG);
            }

            mStructNode       = new RwTextureNativeStructNode(this);
            mName             = new RwStringNode(name, this);
            mMaskName         = new RwStringNode(string.Empty, this);
            mRasterStructNode = new RwRasterStructNode(bitmap, pixelFormat, this);
            mExtensionNode    = new RwExtensionNode(this, new RwSkyMipMapValueNode());
        }
Beispiel #10
0
        public RwTextureNativeNode(Stream stream, bool leaveOpen = false)
            : base(RwNodeId.RwTextureNativeNode)
        {
            var node = (RwTextureNativeNode)Load(stream, leaveOpen);

            mStructNode        = node.mStructNode;
            mStructNode.Parent = this;

            mName        = node.mName;
            mName.Parent = this;

            mMaskName        = node.mMaskName;
            mMaskName.Parent = this;

            mRasterStructNode        = node.mRasterStructNode;
            mRasterStructNode.Parent = this;

            mExtensionNode        = node.mExtensionNode;
            mExtensionNode.Parent = this;
        }
Beispiel #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);
            }
        }
Beispiel #12
0
        public RwClumpNode(Stream stream, bool leaveOpen = false)
            : base(RwNodeId.RwClumpNode)
        {
            var node = (RwClumpNode)RwNode.Load(stream, leaveOpen);

            mStructNode        = node.mStructNode;
            mStructNode.Parent = this;

            FrameList        = node.FrameList;
            FrameList.Parent = this;

            GeometryList        = node.GeometryList;
            GeometryList.Parent = this;

            Atomics = node.Atomics;
            foreach (var atomicNode in Atomics)
            {
                atomicNode.Parent = this;
            }

            mExtensionNodeNode        = node.mExtensionNodeNode;
            mExtensionNodeNode.Parent = this;
        }
Beispiel #13
0
 internal RwAtomicSector(RwNodeFactory.RwNodeHeader header, BinaryReader reader) : base(header)
 {
     Header    = RwNodeFactory.GetNode <RwAtomicSectorHeader>(this, reader);
     Extension = RwNodeFactory.GetNode <RwExtensionNode>(this, reader);
 }
Beispiel #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);
 }
Beispiel #15
0
 public RwAtomicNode(RwNode parent, int frameIndex, int geometryIndex, int flag1 = 0, int flag2 = 0)
     : base(RwNodeId.RwAtomicNode, parent)
 {
     mStructNode    = new RwAtomicStructNode(frameIndex, geometryIndex, flag1, flag2, this);
     mExtensionNode = new RwExtensionNode(this);
 }
Beispiel #16
0
 /// <summary>
 /// Initialize a new empty <see cref="RwAtomicNode"/> instance.
 /// </summary>
 public RwAtomicNode()
     : base(RwNodeId.RwAtomicNode)
 {
     mStructNode    = new RwAtomicStructNode(0, 0, 0, 0, this);
     mExtensionNode = new RwExtensionNode(this);
 }