Example #1
0
        internal static Node ParseNode(byte[] buffer, int globalOffset, int offset)
        {
            NodeType type = (NodeType)BitConverter.ToInt32(buffer, offset + 4);

            Node node = null;

            switch (type)
            {
            case NodeType.NullNode:
                node = new NullNode();
                break;

            case NodeType.NodeGroup:
                node = new NodeGroupNode();
                break;

            case NodeType.FaceData:
                node = new FaceDataNode();
                break;

            case NodeType.MeshVertices:
                node = new MeshVerticesNode();
                break;

            case NodeType.NodeReference:
                node = new NodeReferenceNode();
                break;

            case NodeType.VertexNormals:
                node = new VertexNormalsNode();
                break;

            case NodeType.TextureCoordinates:
                node = new TextureCoordinatesNode();
                break;

            case NodeType.Texture:
                node = new TextureNode();
                break;

            case NodeType.FaceGrouping:
                node = new FaceGroupingNode();
                break;

            case NodeType.Hardpoint:
                node = new HardpointNode();
                break;

            case NodeType.RotationScale:
                node = new RotationScaleNode();
                break;

            case NodeType.NodeSwitch:
                node = new NodeSwitchNode();
                break;

            case NodeType.MeshDescriptor:
                node = new MeshDescriptorNode();
                break;

            case NodeType.TextureAlpha:
                node = new TextureAlphaNode();
                break;

            case NodeType.EngineGlow:
                node = new EngineGlowNode();
                break;
            }

            if (node == null)
            {
                throw new InvalidDataException("invalid node found: " + type);
            }

            node.Parse(buffer, globalOffset, offset);

            return(node);
        }
Example #2
0
        internal static Node ParseNode(byte[] buffer, int globalOffset, int offset)
        {
            NodeType type = (NodeType)BitConverter.ToInt32(buffer, offset + 4);

            Node node = null;

            switch (type)
            {
                case NodeType.NullNode:
                    node = new NullNode();
                    break;
                case NodeType.NodeGroup:
                    node = new NodeGroupNode();
                    break;
                case NodeType.FaceData:
                    node = new FaceDataNode();
                    break;
                case NodeType.MeshVertices:
                    node = new MeshVerticesNode();
                    break;
                case NodeType.NodeReference:
                    node = new NodeReferenceNode();
                    break;
                case NodeType.VertexNormals:
                    node = new VertexNormalsNode();
                    break;
                case NodeType.TextureCoordinates:
                    node = new TextureCoordinatesNode();
                    break;
                case NodeType.Texture:
                    node = new TextureNode();
                    break;
                case NodeType.FaceGrouping:
                    node = new FaceGroupingNode();
                    break;
                case NodeType.Hardpoint:
                    node = new HardpointNode();
                    break;
                case NodeType.RotationScale:
                    node = new RotationScaleNode();
                    break;
                case NodeType.NodeSwitch:
                    node = new NodeSwitchNode();
                    break;
                case NodeType.MeshDescriptor:
                    node = new MeshDescriptorNode();
                    break;
                case NodeType.TextureAlpha:
                    node = new TextureAlphaNode();
                    break;
                case NodeType.EngineGlow:
                    node = new EngineGlowNode();
                    break;
            }

            if (node == null)
            {
                throw new InvalidDataException("invalid node found: " + type);
            }

            node.Parse(buffer, globalOffset, offset);

            return node;
        }