コード例 #1
0
ファイル: RWClumpStruct.cs プロジェクト: TGEnigma/Amicitia
 internal RWSceneStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _drawCallCount = reader.ReadInt32();
     _lightCount = reader.ReadInt32(); 
     _cameraCount = reader.ReadInt32();
 }
コード例 #2
0
        internal RWSceneNodeBoneMetadata(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
                : base(header)
        {
            int version = reader.ReadInt32();

            if (version != VERSION)
            {
                throw new NotImplementedException("Unexpected version for RWHierarchyAnimPlugin");
            }

            _nameID = reader.ReadInt32();
            int numNodes = reader.ReadInt32();

            if (numNodes == 0)
                return;

            RWRootBoneFlags flags = (RWRootBoneFlags)reader.ReadUInt32();
            int keyFrameSize = reader.ReadInt32();
            List< RWBoneHierarchyNode> hierarchyNodes = new List<RWBoneHierarchyNode>(numNodes);

            for (int i = 0; i < numNodes; i++)
            {
                hierarchyNodes.Add(new RWBoneHierarchyNode(reader));
            }

            _rootInfo = new RWRootBoneInfo(flags, hierarchyNodes);
        }
コード例 #3
0
 internal RWMaterialListStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
         : base(header)
 {
     _matCount = reader.ReadInt32();
     _matReferences = new int[_matCount];
     for (int i = 0; i < _matCount; i++)
         _matReferences[i] = reader.ReadInt32();
 }
コード例 #4
0
ファイル: RWAtomicStruct.cs プロジェクト: TGEnigma/Amicitia
 internal RWDrawCallStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _frameIndex = reader.ReadInt32();
     _geometryIndex = reader.ReadInt32();
     _flag1 = reader.ReadInt32();
     _flag2 = reader.ReadInt32();
 }
コード例 #5
0
ファイル: RWExtension.cs プロジェクト: TGEnigma/Amicitia
 internal RWExtension(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     long end = reader.BaseStream.Position + header.Size;
     while (reader.BaseStream.Position != end)
     {
         RWNodeFactory.GetNode(this, reader);
     }
 }
コード例 #6
0
ファイル: RWGeometryList.cs プロジェクト: TGEnigma/Amicitia
        internal RWMeshList(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
                : base(header)
        {
            _struct = RWNodeFactory.GetNode<RWGeometryListStruct>(this, reader);
            _geometryList = new List<RWMesh>(_struct.GeometryCount);

            for (int i = 0; i < _struct.GeometryCount; i++)
            {
                _geometryList.Add(RWNodeFactory.GetNode<RWMesh>(this, reader));
            }
        }
コード例 #7
0
        /// <summary>
        /// Initializer only to be called in <see cref="RWNodeFactory"/>.
        /// </summary>
        internal RWUVAnimationDictionary(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
            : base(header)
        {
            _struct = RWNodeFactory.GetNode<RWUVAnimationDictionaryStruct>(this, reader);
            _uvAnimations = new List<RWNode>(_struct.UVAnimationCount);

            for (int i = 0; i < _struct.UVAnimationCount; i++)
            {
                _uvAnimations.Add(RWNodeFactory.GetNode(this, reader));
            }
        }
コード例 #8
0
ファイル: RWMaterialStruct.cs プロジェクト: TGEnigma/Amicitia
 internal RWMaterialStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
         : base(header)
 {
     int unused1 = reader.ReadInt32();
     _color = Color.FromArgb(reader.ReadInt32());
     int unused2 = reader.ReadInt32();
     _isTextured = reader.ReadInt32();
     _ambient = reader.ReadSingle();
     _specular = reader.ReadSingle();
     _diffuse = reader.ReadSingle();
 }
コード例 #9
0
        internal RWSceneNodeListStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
                : base(header)
        {
            int frameCount = reader.ReadInt32();
            _sceneNodes = new List<RWSceneNode>(frameCount);

            for (int i = 0; i < frameCount; i++)
            {
                _sceneNodes.Add(new RWSceneNode(reader, _sceneNodes));
            }
        }
コード例 #10
0
ファイル: RWMaterialList.cs プロジェクト: TGEnigma/Amicitia
        internal RWMaterialList(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
            : base(header)
        {
            _struct = RWNodeFactory.GetNode<RWMaterialListStruct>(this, reader);
            _materials = new RWMaterial[_struct.MaterialCount];

            for (int i = 0; i < _materials.Length; i++)
            {
                _materials[i] = RWNodeFactory.GetNode<RWMaterial>(this, reader);
            }
        }
コード例 #11
0
ファイル: RMDFrameLinkList.cs プロジェクト: TGEnigma/Amicitia
        /// <summary>
        /// Initializer only to be called in <see cref="RWNodeFactory"/>.
        /// </summary>
        internal RMDFrameLinkList(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
            : base(header)
        {
            short numAttachFrames = reader.ReadInt16();

            _frameLinks = new List<RMDNodeLink>(numAttachFrames);

            for (int i = 0; i < numAttachFrames; i++)
            {
                _frameLinks.Add(new RMDNodeLink(reader));
            }
        }
コード例 #12
0
ファイル: RMDAnimationSet.cs プロジェクト: TGEnigma/Amicitia
        /// <summary>
        /// Initializer only to be called in <see cref="RWNodeFactory"/>.
        /// </summary>
        internal RMDAnimationSet(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
            : base(header)
        {
            _animationNodes = new List<RWNode>();

            var node = RWNodeFactory.GetNode(this, reader);
            while (node.Type != RWNodeType.RMDAnimationSetTerminator)
            {
                _animationNodes.Add(node);
                node = RWNodeFactory.GetNode(this, reader);
            }
        }
コード例 #13
0
ファイル: RWFrameList.cs プロジェクト: TGEnigma/Amicitia
        internal RWSceneNodeList(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
                : base(header)
        {
            _struct = RWNodeFactory.GetNode<RWSceneNodeListStruct>(this, reader);
            _extensionNodes = new List<RWExtension>(_struct.SceneNodeCount);

            for (int i = 0; i < _struct.SceneNodeCount; i++)
            {
                _extensionNodes.Add(RWNodeFactory.GetNode<RWExtension>(this, reader));

                if (_extensionNodes[i].Children != null && _extensionNodes[i].Children.Count > 0)
                {
                    _struct.SceneNodes[i].BoneMetadata = _extensionNodes[i].Children[0] as RWSceneNodeBoneMetadata;
                }
            }
        }
コード例 #14
0
 internal RWTextureNativeStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _platformID = (RWPlatformID)reader.ReadUInt32();
     _flags = reader.ReadUInt32();
 }
コード例 #15
0
        // init with factory node info & binary reader
        internal RWMeshMaterialSplitData(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
            : base(header)
        {
            _primType = (RWPrimitiveType)reader.ReadUInt32();
            int numSplits = reader.ReadInt32();
            _numPrimitives = reader.ReadInt32();

            _splits = new RWMeshMaterialSplit[numSplits];
            for (int i = 0; i < numSplits; i++)
            {
                _splits[i] = new RWMeshMaterialSplit(reader);
            }
        }
コード例 #16
0
 internal RWUVAnimationDictionaryStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _numUVAnims = reader.ReadInt32();
 }
コード例 #17
0
ファイル: RWGeometryStruct.cs プロジェクト: TGEnigma/Amicitia
        internal RWMeshStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
        : base(header)
        {
            _geoFlags = (RWGeometryFlags)reader.ReadUInt16();
            byte numTexCoord = reader.ReadByte();
            _nativeFlag = (RWGeometryNativeFlag)reader.ReadByte();
            int numTris = reader.ReadInt32();
            int numVerts = reader.ReadInt32();
            int numMorphTargets = reader.ReadInt32();

            if (numMorphTargets != SUPPORTED_MORPH_COUNT)
            {
                throw new NotImplementedException("More than 1 morph target are not implemented");
            }

            if (_geoFlags.HasFlagUnchecked(RWGeometryFlags.HasColors))
            {
                _clrArray = reader.ReadColorArray(numVerts);
            }

            if (_geoFlags.HasFlagUnchecked(RWGeometryFlags.HasTexCoord1) ||
               (_geoFlags.HasFlagUnchecked(RWGeometryFlags.HasTexCoord2)))
            {
                _texCoordSets = new Vector2[numTexCoord][];

                for (int i = 0; i < numTexCoord; i++)
                {
                    _texCoordSets[i] = reader.ReadVector2Array(numVerts);
                }
            }

            _triArray = new RWTriangle[numTris];
            for (int i = 0; i < numTris; i++)
            {
                _triArray[i] = new RWTriangle(reader);
            }

            _bSphere = new RWBoundingSphere(reader);

            if (_geoFlags.HasFlagUnchecked(RWGeometryFlags.HasVertices))
            {
                _posArray = reader.ReadVector3Array(numVerts);
            }

            if (_geoFlags.HasFlagUnchecked(RWGeometryFlags.HasNormals))
            {
                _nrmArray = reader.ReadVector3Array(numVerts);
            }
        }
コード例 #18
0
ファイル: RWString.cs プロジェクト: TGEnigma/Amicitia
 /// <summary>
 /// Initializer only to be called in <see cref="RWNodeFactory"/>.
 /// </summary>
 internal RWString(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
         : base(header)
 {
     Value = reader.ReadCString((int)Size);
 }
コード例 #19
0
        /// <summary>
        /// Constructor only to be called in <see cref="RWNodeFactory.GetNode(RWNode, BinaryReader)"/>.
        /// </summary>
        internal RWTextureDictionary(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
            : base(header)
        {
            _struct = RWNodeFactory.GetNode<RWTextureDictionaryStruct>(this, reader);
            _textures = new List<RWTextureNative>(_struct.TextureCount);

            for (int i = 0; i < _struct.TextureCount; i++)
            {
                _textures.Add(RWNodeFactory.GetNode<RWTextureNative>(this, reader));
            }

            _extension = RWNodeFactory.GetNode<RWExtension>(this, reader);
        }
コード例 #20
0
 /// <summary>
 /// Initializer only to be called in <see cref="RWNodeFactory.GetNode(RWNode, BinaryReader)"/>
 /// </summary>
 internal RWTextureReference(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _struct = RWNodeFactory.GetNode<RWTextureReferenceStruct>(this, reader);
     _refTexName = RWNodeFactory.GetNode<RWString>(this, reader);
     _refTexMaskName = RWNodeFactory.GetNode<RWString>(this, reader);
     _extension = RWNodeFactory.GetNode<RWExtension>(this, reader);
 }
コード例 #21
0
ファイル: RWNode.cs プロジェクト: TGEnigma/Amicitia
        /// <summary>
        /// Initializer only to be called by <see cref="RWNodeFactory"/>.
        /// </summary>
        internal RWNode(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
        {
            _type = header.Type;
            _size = header.Size;
            _rawVersion = header.Version;
            Parent = header.Parent;
            _data = reader.ReadBytes((int)_size);

            switch (_type)
            {
                case RWNodeType.RMDParticleList:
                    reader.AlignPosition(16);
                    break;
            }
        }
コード例 #22
0
ファイル: RWNode.cs プロジェクト: TGEnigma/Amicitia
 /// <summary>
 /// Initializer only to be called by <see cref="RWNodeFactory"/>.
 /// </summary>
 internal RWNode(RWNodeFactory.RWNodeInfo header)
 {
     _type = header.Type;
     _size = header.Size;
     _rawVersion = header.Version;
     Parent = header.Parent;
 }
コード例 #23
0
ファイル: RWRaster.cs プロジェクト: TGEnigma/Amicitia
 /// <summary>
 /// Initializer only to be called by <see cref="RWNodeFactory"/>.
 /// </summary>
 internal RWRaster(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _rasterInfo = RWNodeFactory.GetNode<RWRasterInfo>(this, reader);
     _rasterData = RWNodeFactory.GetNode<RWRasterData>(this, reader);
 }
コード例 #24
0
 /// <summary>
 /// Initializer only to be called in <see cref="RWNodeFactory"/>.
 /// </summary>
 internal RMDAnimationSetCount(RWNodeFactory.RWNodeInfo header, BinaryReader reader) 
     : base(header)
 {
     _animationSetCount = reader.ReadInt16();
 }
コード例 #25
0
 /// <summary>
 /// Initializer only to be called in <see cref="RWNodeFactory"/>.
 /// </summary>
 internal RMDAnimationSetPlaceholder(RWNodeFactory.RWNodeInfo header) : base(header) { }
コード例 #26
0
ファイル: RWMesh.cs プロジェクト: TGEnigma/Amicitia
        /****************************************************************************************/
        /* TODO: add the skin plugin and mesh strip plugin here instead of the extension itself */
        /****************************************************************************************/

        #endregion

        /// <summary>
        /// Initializer only to be called <see cref="RWNodeFactory"/>
        /// </summary>
        internal RWMesh(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
                : base(header)
        {
            _struct = RWNodeFactory.GetNode<RWMeshStruct>(this, reader);
            _materialList = RWNodeFactory.GetNode<RWMaterialList>(this, reader);
            _extension = RWNodeFactory.GetNode<RWExtension>(this, reader);
        }
コード例 #27
0
ファイル: RWSkinPlugin.cs プロジェクト: TGEnigma/Amicitia
        // TODO:
        //
        // 1. Figure out how the bone remap indices work
        // They seem to be tied to the used bone indices somehow
        // Maybe building up an hierarchy as the same indices appear multiple times
        // Indices that aren't in the used bone indices are set to 0xFF
        //
        // 2. Figure out the BoneRLE
        // First byte is the hierarchy index of the affected bone
        // Second byte seems to be something like how many bones it shares weights with on the same material split?
        // 
        // 3. Figure out the inverse matrices
        // I can currently just copy and paste the one from the original file
        // But knowing how to calculate it would be a lot easier

        internal RWSkinPlugin(RWNodeFactory.RWNodeInfo header, BinaryReader reader, RWMesh rwGeometry)
            : base(header)
        {
            int numVertices = rwGeometry.VertexCount;

            m_numBones = reader.ReadByte();
            m_numUsedBones = reader.ReadByte();
            m_numWeightPerVertex = reader.ReadByte();
            m_unused = reader.ReadByte();

            m_usedBoneIndices = reader.ReadBytes(m_numUsedBones);

            m_skinBoneIndices = new byte[numVertices][];
            for (int i = 0; i < numVertices; i++)
            {
                m_skinBoneIndices[i] = reader.ReadBytes(4);
            }

            m_skinBoneWeights = new float[numVertices][];
            for (int i = 0; i < numVertices; i++)
            {
                m_skinBoneWeights[i] = reader.ReadFloatArray(4);
            }

            m_inverseBoneMatrices = new Matrix4x4[m_numBones];
            for (int i = 0; i < BoneCount; i++)
            {
                Matrix4x4 mtx = Matrix4x4.Identity;

                mtx.M11 = reader.ReadSingle(); mtx.M12 = reader.ReadSingle(); mtx.M13 = reader.ReadSingle(); reader.BaseStream.Position += 4;
                mtx.M21 = reader.ReadSingle(); mtx.M22 = reader.ReadSingle(); mtx.M23 = reader.ReadSingle(); reader.BaseStream.Position += 4;
                mtx.M31 = reader.ReadSingle(); mtx.M32 = reader.ReadSingle(); mtx.M33 = reader.ReadSingle(); reader.BaseStream.Position += 4;
                mtx.M41 = reader.ReadSingle(); mtx.M42 = reader.ReadSingle(); mtx.M43 = reader.ReadSingle(); reader.BaseStream.Position += 4;

                m_inverseBoneMatrices[i] = mtx;
            }

            m_boneLimit = reader.ReadInt32();
            m_numMaterialSplit = reader.ReadInt32();
            m_materialSplitNumUsedBones = reader.ReadInt32();

            if (m_numMaterialSplit < 1)
                return;

            m_boneRemapIndices = reader.ReadBytes(m_numBones);

            m_materialSplitSkinInfo = new MaterialSplitSkinInfo[m_numMaterialSplit];
            for (int i = 0; i < m_numMaterialSplit; i++)
                m_materialSplitSkinInfo[i] = new MaterialSplitSkinInfo { UsedBonesStartIndex = reader.ReadByte(), NumUsedBones = reader.ReadByte() };

            m_materialSplitUsedBoneInfo = new MaterialSplitUsedBoneInfo[m_materialSplitNumUsedBones];
            for (int i = 0; i < m_materialSplitNumUsedBones; i++)
                m_materialSplitUsedBoneInfo[i] = new MaterialSplitUsedBoneInfo { UsedBoneHierarchyIndex = reader.ReadByte(), Unknown = reader.ReadByte() };

            PrintInfo();
        }
コード例 #28
0
 internal RWTextureDictionaryStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
         : base(header)
 {
     TextureCount = reader.ReadUInt16();
     DeviceID = (RWDeviceID)reader.ReadUInt16();
 }
コード例 #29
0
 internal RWGeometryListStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
         : base(header)
 {
     _geometryCount = reader.ReadInt32();
 }
コード例 #30
0
 internal RWTextureReferenceStruct(RWNodeFactory.RWNodeInfo header, BinaryReader reader)
     : base(header)
 {
     _flags = reader.ReadUInt32();
 }