Exemplo n.º 1
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_ANIMATION_HEADER);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_ANIMATION_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_ANIMATION_HEADER.ToString();

            version = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(16);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);
            byte[] hierarchyNameArray = br.ReadBytes(16);
            hierarchy_name = System.Text.ASCIIEncoding.ASCII.GetString(hierarchyNameArray);
            num_frames     = br.ReadInt32();
            frame_rate     = br.ReadInt32();

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Name: " + name);
                Console.Out.WriteLine("\t Hierarchy Name: " + hierarchy_name);
                Console.Out.WriteLine("\t Number Of Frames: " + num_frames);
                Console.Out.WriteLine("\t Frame Rate: " + frame_rate);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_TEXTURE);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_TEXTURE;
            HeaderName = ChunkHeader.W3D_CHUNK_TEXTURE.ToString();
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_HLOD_PROXY_ARRAY);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_HLOD_PROXY_ARRAY;
            HeaderName = ChunkHeader.W3D_CHUNK_HLOD_PROXY_ARRAY.ToString();
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS;
            HeaderName = ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS.ToString();

            int NumTexCoords = chunkLength / 8;

            object[] uv = new object[2];
            tex_coord_data = new object[NumTexCoords][];

            for (int i = 0; i < NumTexCoords; i++)
            {
                uv[0] = br.ReadSingle();
                uv[1] = br.ReadSingle();

                tex_coord_data[i] = uv;

                if (dbg)
                {
                    Console.Out.WriteLine("\t Tex Coord #" + i);
                    Console.Out.WriteLine("\t U: " + uv[0] + " V: " + uv[1]);
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_PRELIT_LIGHTMAP_MULTI_PASS);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_PRELIT_LIGHTMAP_MULTI_PASS;
            HeaderName = ChunkHeader.W3D_CHUNK_PRELIT_LIGHTMAP_MULTI_PASS.ToString();
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_COMPRESSED_BIT_CHANNEL);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_COMPRESSED_BIT_CHANNEL;
            HeaderName = ChunkHeader.W3D_CHUNK_COMPRESSED_BIT_CHANNEL.ToString();

            long beginPos = br.BaseStream.Position;
            default_val = 0;
            last_frame = br.ReadInt16();
            first_frame = br.ReadInt16();
            pivot = br.ReadInt16();
            flags = br.ReadInt16();
            default_val = br.ReadByte();

            if (dbg)
            {
                Console.Out.WriteLine("\t First Frame: " + first_frame);
                Console.Out.WriteLine("\t Last Frame: " + last_frame);
                Console.Out.WriteLine("\t Flags: " + flags);
                Console.Out.WriteLine("\t Pivot: " + pivot);
                Console.Out.WriteLine("\t Default Value: " + default_val);
            }

            //Skip over unkown structure.
            br.BaseStream.Position = beginPos + chunkLength;
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_AABTREE_NODES);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_AABTREE_NODES;
            HeaderName = ChunkHeader.W3D_CHUNK_AABTREE_NODES.ToString();

            num_nodes = chunkLength / 32;
            node_info = new object[NumNodes][];

            for (int i = 0; i < NumNodes; i++)
            {
                object[] info = new object[4];

                Vector3 Min = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
                Vector3 Max = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());

                int Poly0 = br.ReadInt32();
                int PolyCount = br.ReadInt32();

                if (dbg)
                {
                    Console.Out.WriteLine("\t\t Node " + i + " Min: " + Min);
                    Console.Out.WriteLine("\t\t Node " + i + " Max: " + Min);
                    Console.Out.WriteLine("\t\t Node " + i + " Poly0: " + Poly0);
                    Console.Out.WriteLine("\t\t Node " + i + " PolyCount: " + PolyCount);
                }

                info[0] = Min;
                info[1] = Max;
                info[2] = Poly0;
                info[3] = PolyCount;
                node_info[i] = info;
            }
        }
Exemplo n.º 8
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|-| " + ChunkHeader.W3D_CHUNK_BOX);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_BOX;
            HeaderName = ChunkHeader.W3D_CHUNK_BOX.ToString();

            version    = br.ReadInt32();
            attributes = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(chunkLength - 35);
            name    = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);
            rgb     = Color.FromArgb(br.ReadByte(), br.ReadByte(), br.ReadByte());
            center  = new Vector3((double)br.ReadSingle(), (double)br.ReadSingle(), (double)br.ReadSingle());
            extents = new Vector3((double)br.ReadSingle(), (double)br.ReadSingle(), (double)br.ReadSingle());

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Attributes: " + attributes);
                Console.Out.WriteLine("\t Name: " + name);
                Console.Out.WriteLine("\t RGB: " + rgb);
                Console.Out.WriteLine("\t center: " + center);
                Console.Out.WriteLine("\t extents: " + extents);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|-|" + ChunkHeader.W3D_CHUNK_HIERARCHY);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_BOX;
            HeaderName = ChunkHeader.W3D_CHUNK_BOX.ToString();
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|-----|" + ChunkHeader.W3D_CHUNK_DEFORM_DATA);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_DEFORM_DATA;
            HeaderName = ChunkHeader.W3D_CHUNK_DEFORM_DATA.ToString();

            for (int i = 0; i < chunkLength / 28; i++)
            {
                vertex_index = br.ReadInt32();
                position = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());

                int R = br.ReadByte();
                int G = br.ReadByte();
                int B = br.ReadByte();
                int A = br.ReadByte();

                color = Color.FromArgb(A, R, G, B);

                //reserved
                for (int i2 = 0; i2 < 2; i2++)
                {
                    reserved[i2] = br.ReadInt32();
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_HMODEL_HEADER);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_HMODEL_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_HMODEL_HEADER.ToString();

            version = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(16);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);
            byte[] hierarchyNameArray = br.ReadBytes(16);
            hierarchy_name = System.Text.ASCIIEncoding.ASCII.GetString(hierarchyNameArray);
            num_connections = br.ReadInt16();

            //Not sure what the rest of the structure is, so iterate over the remaining bytes.
            br.ReadBytes(chunkLength - 38);

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Name: " + name);
                Console.Out.WriteLine("\t Hierarchy Name: " + hierarchy_name);
                Console.Out.WriteLine("\t Number Of Connections: " + num_connections);
            }
        }
Exemplo n.º 12
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_HIERARCHY_HEADER);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_HIERARCHY_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_HIERARCHY_HEADER.ToString();

            version = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(16);
            name      = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);
            numPivots = br.ReadInt32();
            float x = br.ReadUInt32();
            float y = br.ReadUInt32();
            float z = br.ReadUInt32();

            center = new Vector3(x, y, z);

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Name: " + name);
                Console.Out.WriteLine("\t NumPivots: " + numPivots);
                Console.Out.WriteLine("\t Center: (" + center.X + ", " + center.Y + ", " + center.Z + ")");
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS;
            HeaderName = ChunkHeader.W3D_CHUNK_STAGE_TEXCOORDS.ToString();

            int NumTexCoords = chunkLength / 8;
            object[] uv = new object[2];
            tex_coord_data = new object[NumTexCoords][];

            for (int i = 0; i < NumTexCoords; i++)
            {
                uv[0] = br.ReadSingle();
                uv[1] = br.ReadSingle();

                tex_coord_data[i] = uv;

                if (dbg)
                {
                    Console.Out.WriteLine("\t Tex Coord #" + i);
                    Console.Out.WriteLine("\t U: " + uv[0] + " V: " + uv[1]);
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_COMPRESSED_BIT_CHANNEL);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_COMPRESSED_BIT_CHANNEL;
            HeaderName = ChunkHeader.W3D_CHUNK_COMPRESSED_BIT_CHANNEL.ToString();

            long beginPos = br.BaseStream.Position;

            default_val = 0;
            last_frame  = br.ReadInt16();
            first_frame = br.ReadInt16();
            pivot       = br.ReadInt16();
            flags       = br.ReadInt16();
            default_val = br.ReadByte();

            if (dbg)
            {
                Console.Out.WriteLine("\t First Frame: " + first_frame);
                Console.Out.WriteLine("\t Last Frame: " + last_frame);
                Console.Out.WriteLine("\t Flags: " + flags);
                Console.Out.WriteLine("\t Pivot: " + pivot);
                Console.Out.WriteLine("\t Default Value: " + default_val);
            }

            //Skip over unkown structure.
            br.BaseStream.Position = beginPos + chunkLength;
        }
Exemplo n.º 15
0
        public string Duplicate(string id)
        {
            var lId2      = _nrwl.AcquireWriterLock($"{nameof(ChunkMap)}.{id}");
            var lId       = _nrwl.AcquireReaderLock($"{nameof(Chunk)}.{id}");
            var mapSearch = _maps.Find(x => x.ID == id).ToList();

            if (!mapSearch.Any())
            {
                _nrwl.ReleaseLock($"{nameof(ChunkMap)}.{id}", lId2);
                _nrwl.ReleaseLock($"{nameof(Chunk)}.{id}", lId);
                throw new MdbfsElementNotFoundException();
            } //not found

            var map  = mapSearch.First();
            var nMap = new ChunkMap {
                ChunksIDs = new List <string>(), Length = map.Length, Removed = false
            };
            var chunksSearch = _chunks.Find(Builders <Chunk> .Filter.Where(x => map.ChunksIDs.Contains(x.ID)));
            var nChunks      = chunksSearch.ToEnumerable().Select(ch => new Chunk {
                Bytes = ch.Bytes
            }).ToList();

            _chunks.InsertMany(nChunks);
            nChunks.ForEach(x => nMap.ChunksIDs.Add(x.ID));
            _maps.InsertOne(nMap);
            _nrwl.ReleaseLock($"{nameof(ChunkMap)}.{id}", lId2);
            _nrwl.ReleaseLock($"{nameof(Chunk)}.{id}", lId);
            return(nMap.ID);
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_VERTEX_INFLUENCES);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_VERTEX_INFLUENCES;
            HeaderName = ChunkHeader.W3D_CHUNK_VERTEX_INFLUENCES.ToString();

            int NumVertexInfluences = chunkLength / 8;

            BoneIds = new float[NumVertexInfluences];

            for (int i = 0; i < NumVertexInfluences; i++)
            {
                BoneIds[i] = br.ReadInt16();
                for (int i2 = 0; i2 < 6; i2++)
                {
                    br.ReadByte();
                }

                if (dbg)
                {
                    Console.Out.WriteLine("\t   Vertex Influence{" + i + "} Bone Id: " + BoneIds[i]);
                }
            }
        }
Exemplo n.º 17
0
    public static void renderAll()
    {
        if (chunkMap == null)
        {
            chunkMap = GameObject.Find("EnviromentController").GetComponent <ChunkMap>();
        }

        GameObject.Destroy(chunkMap.tempChunk);
        chunkMap.tempChunk = null;
        tempGrid           = null;

        List <GameObject>[] chunks = chunkMap.chunks;
        Block[,,] blockGrid = chunkMap.blockGrid;

        List <Mesh>[] meshes = getMeshes(chunks, blockGrid);

        for (int i = 0; i < chunks.Length; i++)
        {
            for (int j = 0; j < meshes[i].Count; j++)
            {
                if (chunks[i].Count < j + 1)
                {
                    GameObject newChunk = (GameObject)GameObject.Instantiate(chunkMap.chunkbases[i], Vector3.zero, Quaternion.identity);
                    newChunk.transform.SetParent(GameObject.Find("ChunkParent").transform);
                    chunks[i].Add(newChunk);
                }

                MeshFilter meshfilter = chunks[i][j].GetComponent <MeshFilter>();
                meshfilter.mesh = meshes[i][j];
                MeshCollider meshcollider = chunks[i][j].GetComponent <MeshCollider>();
                meshcollider.sharedMesh = meshes[i][j];
                meshes[i][j].RecalculateNormals();
            }
        }
    }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|-| " + ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION;
            HeaderName = ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION.ToString();
        }
Exemplo n.º 19
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_VERTEX_SHADE_INDICES);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_VERTEX_SHADE_INDICES;
            HeaderName = ChunkHeader.W3D_CHUNK_VERTEX_SHADE_INDICES.ToString();

            int NumVertexShades = chunkLength / 4;

            vertexShadeIndices = new int[NumVertexShades + 2];

            for (int i = 0; i < NumVertexShades; i++)
            {
                vertexShadeIndices[i] = br.ReadInt32();

                if (dbg)
                {
                    Console.Out.WriteLine("\t Vertex Iternation #" + i);
                    Console.Out.WriteLine("\t Index Value: " + vertexShadeIndices[i]);
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_HLOD_SUB_OBJECT);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_HLOD_SUB_OBJECT;
            HeaderName = ChunkHeader.W3D_CHUNK_HLOD_SUB_OBJECT.ToString();

            int  NumChars           = chunkLength - 4;
            long correctEndPosition = br.BaseStream.Position + chunkLength;

            boneIndex = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(NumChars);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);

            if (br.BaseStream.Position > correctEndPosition)
            {
                br.BaseStream.Position = correctEndPosition;
            }

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Name: " + Name.Trim());
                Console.Out.WriteLine("\t\t Bone Index: " + boneIndex);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION_CHANNEL);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION_CHANNEL;
            HeaderName = ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION_CHANNEL.ToString();

            long beginPos = br.BaseStream.Position;
            last_frame = br.ReadInt16();
            first_frame = br.ReadInt16();
            pivot = br.ReadInt16();
            channel_type = br.ReadInt16();
            vector_length = br.ReadInt32();

            if (dbg)
            {
                Console.Out.WriteLine("\t First Frame: " + first_frame);
                Console.Out.WriteLine("\t Last Frame: " + last_frame);
                Console.Out.WriteLine("\t Channel Type: " + channel_type);
                Console.Out.WriteLine("\t Pivot ID: " + pivot);
                Console.Out.WriteLine("\t Vector Length: " + vector_length);
            }

            //Skip over unkown structure.
            br.BaseStream.Position = beginPos + chunkLength;
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES.ToString();

            key_frame_count = br.ReadInt32();
            random          = br.ReadSingle();

            int[] reserved = new int[2];
            for (int i = 0; i < 2; i++)
            {
                reserved[i] = br.ReadInt32();
            }

            if (dbg)
            {
                Console.Out.WriteLine("\t  Key Frame Count: " + key_frame_count);
                Console.Out.WriteLine("\t  Random: " + random);
            }

            if (key_frame_count == 0)
            {
                time        = new float[1];
                frame_index = new float[1];

                frame_index[0] = br.ReadSingle();
                time[0]        = br.ReadSingle();

                if (dbg)
                {
                    Console.Out.WriteLine("\t  ********** Frame KeyFrame 0 **********");
                    Console.Out.WriteLine("\t  Time: " + time[0]);
                    Console.Out.WriteLine("\t  Frame (sub-texture Index): " + frame_index[0]);
                }
            }
            else
            {
                int Count = (chunkLength - 16) / 8;
                time        = new float[Count];
                frame_index = new float[Count];

                for (int i = 0; i < Count; i++)
                {
                    frame_index[i] = br.ReadSingle();
                    time[i]        = br.ReadSingle();

                    if (dbg)
                    {
                        Console.Out.WriteLine("\t  ********** Frame KeyFrame " + i + "**********");
                        Console.Out.WriteLine("\t  Time: " + time[i]);
                        Console.Out.WriteLine("\t  Frame (sub-texture Index): " + frame_index[i]);
                    }
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_HIERARCHY_HEADER);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_HIERARCHY_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_HIERARCHY_HEADER.ToString();

            version = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(16);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);
            numPivots = br.ReadInt32();
            float x = br.ReadUInt32();
            float y = br.ReadUInt32();
            float z = br.ReadUInt32();

            center = new Vector3(x, y, z);

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Name: " + name);
                Console.Out.WriteLine("\t NumPivots: " + numPivots);
                Console.Out.WriteLine("\t Center: (" + center.X + ", " + center.Y + ", " + center.Z + ")");
            }
        }
Exemplo n.º 24
0
 public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
 {
     if (dbg)
     {
         Console.Out.WriteLine("***** W3D_CHUNK_ROOT_CHUNK ***** ");
     }
 }
Exemplo n.º 25
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_HMODEL_HEADER);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_HMODEL_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_HMODEL_HEADER.ToString();

            version = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(16);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);
            byte[] hierarchyNameArray = br.ReadBytes(16);
            hierarchy_name  = System.Text.ASCIIEncoding.ASCII.GetString(hierarchyNameArray);
            num_connections = br.ReadInt16();

            //Not sure what the rest of the structure is, so iterate over the remaining bytes.
            br.ReadBytes(chunkLength - 38);

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Name: " + name);
                Console.Out.WriteLine("\t Hierarchy Name: " + hierarchy_name);
                Console.Out.WriteLine("\t Number Of Connections: " + num_connections);
            }
        }
Exemplo n.º 26
0
 protected override void OnUpdate()
 {
     Entities.WithAll <Chunk>().ForEach((Entity e, ref Chunk chunk) =>
     {
         if (chunk.isMapDirty == 1)
         {
             chunk.isMapDirty = 0;
             if (World.EntityManager.HasComponent <ChunkMap>(e))
             {
                 ChunkMap builder = World.EntityManager.GetComponentData <ChunkMap>(e);
                 builder.dirty    = 1;
                 if (Bootstrap.instance && Bootstrap.instance.isBiomeMaps)
                 {
                     builder.isBiome = 1;
                 }
                 World.EntityManager.SetComponentData(e, builder);
             }
             else
             {
                 ChunkMap newMap = new ChunkMap {
                     dirty = 1
                 };
                 if (Bootstrap.instance && Bootstrap.instance.isBiomeMaps)
                 {
                     newMap.isBiome = 1;
                 }
                 newMap.Initialize((int)chunk.Value.voxelDimensions.x, (int)chunk.Value.voxelDimensions.z);
                 newMap.highestHeight = (int)chunk.Value.voxelDimensions.y;
                 newMap.chunkPosition = chunk.Value.chunkPosition;
                 World.EntityManager.AddComponentData(e, newMap);
             }
         }
     });
 }
Exemplo n.º 27
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_HLOD_HEADER);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_HLOD_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_HLOD_HEADER.ToString();

            version  = br.ReadInt32();
            lodCount = br.ReadInt32();
            byte[] w3dNameArray = br.ReadBytes(16);
            w3dName = System.Text.ASCIIEncoding.ASCII.GetString(w3dNameArray);
            byte[] hierarchyNameArray = br.ReadBytes(16);
            hierarchyName = System.Text.ASCIIEncoding.ASCII.GetString(w3dNameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t LOD Count: " + lodCount);
                Console.Out.WriteLine("\t Name: " + w3dName);
                Console.Out.WriteLine("\t Hierachy Name: " + hierarchyName);
            }
        }
Exemplo n.º 28
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_DCG);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_DCG;
            HeaderName = ChunkHeader.W3D_CHUNK_DCG.ToString();

            int NumColors = chunkLength / 4;

            dcg_colors = new Color[NumColors];

            for (int i = 0; i < NumColors; i++)
            {
                int R = br.ReadByte();
                int G = br.ReadByte();
                int B = br.ReadByte();
                int A = br.ReadByte();

                Color dcgColor = Color.FromArgb(A, R, G, B);
                dcg_colors[i] = dcgColor;

                if (dbg)
                {
                    Console.Out.WriteLine("\t\t dcg[" + i + "]: " + dcgColor);
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_VERTEX_NORMALS);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_VERTEX_NORMALS;
            HeaderName = ChunkHeader.W3D_CHUNK_VERTEX_NORMALS.ToString();

            int NumVertices = chunkLength / 12;

            vertex_normals_data = new Vector3[NumVertices];

            for (int i = 0; i < NumVertices; i++)
            {
                Vector3 vertex_normal = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
                vertex_normals_data[i] = vertex_normal;

                if (dbg)
                {
                    Console.Out.WriteLine("\t Vertex Normal #" + i);
                    Console.Out.WriteLine("\t Vector: " + vertex_normal);
                }
            }
        }
Exemplo n.º 30
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION_CHANNEL);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION_CHANNEL;
            HeaderName = ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION_CHANNEL.ToString();

            long beginPos = br.BaseStream.Position;

            last_frame    = br.ReadInt16();
            first_frame   = br.ReadInt16();
            pivot         = br.ReadInt16();
            channel_type  = br.ReadInt16();
            vector_length = br.ReadInt32();

            if (dbg)
            {
                Console.Out.WriteLine("\t First Frame: " + first_frame);
                Console.Out.WriteLine("\t Last Frame: " + last_frame);
                Console.Out.WriteLine("\t Channel Type: " + channel_type);
                Console.Out.WriteLine("\t Pivot ID: " + pivot);
                Console.Out.WriteLine("\t Vector Length: " + vector_length);
            }

            //Skip over unkown structure.
            br.BaseStream.Position = beginPos + chunkLength;
        }
Exemplo n.º 31
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|-----|" + ChunkHeader.W3D_CHUNK_DEFORM_DATA);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_DEFORM_DATA;
            HeaderName = ChunkHeader.W3D_CHUNK_DEFORM_DATA.ToString();

            for (int i = 0; i < chunkLength / 28; i++)
            {
                vertex_index = br.ReadInt32();
                position     = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());

                int R = br.ReadByte();
                int G = br.ReadByte();
                int B = br.ReadByte();
                int A = br.ReadByte();

                color = Color.FromArgb(A, R, G, B);

                //reserved
                for (int i2 = 0; i2 < 2; i2++)
                {
                    reserved[i2] = br.ReadInt32();
                }
            }
        }
Exemplo n.º 32
0
        /// <summary>
        ///     Looks for chunk map at given world position.
        /// </summary>
        /// <param name="worldPosition">The world position.</param>
        /// <returns>The chunk map (can be null when doesn't exist).</returns>
        public ChunkMap FindChunkMap(Vector3Int worldPosition)
        {
            // Convert worldPosition to chunk map offset
            var offset = ChunkMap.WorldToMapOffset(worldPosition);

            return(_chunkMaps.TryGetValue(offset, out var map) ? map : null);
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_EMITTER_LINE_PROPERTIES);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_EMITTER_LINE_PROPERTIES;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER_LINE_PROPERTIES.ToString();

            flags = br.ReadInt32();
            sub_division_level  = br.ReadInt32();
            noise_amplitude     = br.ReadSingle();
            merge_abort_factor  = br.ReadSingle();
            texture_tile_factor = br.ReadSingle();
            u_per_sec           = br.ReadSingle();
            v_per_sec           = br.ReadSingle();

            int[] reserved = new int[9];
            for (int i = 0; i < 9; i++)
            {
                reserved[i] = br.ReadInt32();
            }

            if (dbg)
            {
                Console.Out.WriteLine("\t  Flags: " + flags);
                Console.Out.WriteLine("\t  Sub Division Level: " + sub_division_level);
                Console.Out.WriteLine("\t  Noise Amplitude: " + noise_amplitude);
                Console.Out.WriteLine("\t  Merge Abort Factor: " + merge_abort_factor);
                Console.Out.WriteLine("\t  Texture Tile Factor: " + texture_tile_factor);
                Console.Out.WriteLine("\t  U Per Second: " + u_per_sec);
                Console.Out.WriteLine("\t  V Per Second: " + v_per_sec);
            }
        }
Exemplo n.º 34
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_PIVOTS);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_PIVOTS;
            HeaderName = ChunkHeader.W3D_CHUNK_PIVOTS.ToString();

            int NumPivots = chunkLength / 60;

            pivot_data = new object[NumPivots][];

            for (int i = 0; i < NumPivots; i++)
            {
                byte[] pivotNameArray = br.ReadBytes(16);
                String PivotName      = System.Text.ASCIIEncoding.ASCII.GetString(pivotNameArray);
                int    ParentID       = br.ReadInt32();

                Vector3 translation = new Vector3();
                translation.X = br.ReadSingle();
                translation.Y = br.ReadSingle();
                translation.Z = br.ReadSingle();

                Vector3 eularAngle = new Vector3();
                eularAngle.X = br.ReadSingle();
                eularAngle.Y = br.ReadSingle();
                eularAngle.Z = br.ReadSingle();

                float[] rotation = new float[4];
                rotation[0] = br.ReadSingle();
                rotation[1] = br.ReadSingle();
                rotation[2] = br.ReadSingle();
                rotation[3] = br.ReadSingle();

                Object[] pivotValues = new Object[5];
                pivotValues[0] = PivotName;
                pivotValues[1] = ParentID;
                pivotValues[2] = translation;
                pivotValues[3] = eularAngle;
                pivotValues[4] = rotation;

                pivot_data[i] = pivotValues;

                if (dbg)
                {
                    Console.Out.WriteLine("\t Pivot #" + i + " Name: " + PivotName);
                    Console.Out.WriteLine("\t Parent ID: " + ParentID);
                    Console.Out.WriteLine("\t Translation: (" + translation.X + ", "
                                          + translation.Y + ", " + translation.Z + ")");
                    Console.Out.WriteLine("\t Eular Angles: (" + eularAngle.X + ", "
                                          + eularAngle.Y + ", " + eularAngle.Z + ")");
                    Console.Out.WriteLine("\t Rotation: (" + rotation[0] + ", "
                                          + rotation[1] + ", " + rotation[2] + ", " + rotation[3]
                                          + ")");
                }
            }
        }
Exemplo n.º 35
0
 void Start()
 {
     eventSys            = EventSystem.current;
     chunkMap            = GameObject.Find("EnviromentController").GetComponent <ChunkMap>();
     objectsPutThisClick = new List <List <Vector3> >();
     rotation            = 0;
     guidance            = GameObject.Find("EnviromentGuider");
 }
Exemplo n.º 36
0
        public VoxelChunk GetVoxelChunkAtWorldLocation(Vector3 worldLocation)
        {
            VoxelChunk returnChunk = null;

            ChunkMap.TryGetValue(GetChunkID(worldLocation), out returnChunk);

            return(returnChunk);
        }
Exemplo n.º 37
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_HLOD_AGGREGATE_ARRAY);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_HLOD_AGGREGATE_ARRAY;
            HeaderName = ChunkHeader.W3D_CHUNK_HLOD_AGGREGATE_ARRAY.ToString();
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|-| " + ChunkHeader.W3D_CHUNK_EMITTER);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_EMITTER;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER.ToString();
        }
Exemplo n.º 39
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_TEXTURES);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_TEXTURES;
            HeaderName = ChunkHeader.W3D_CHUNK_TEXTURES.ToString();
        }
Exemplo n.º 40
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|-| " + ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION;
            HeaderName = ChunkHeader.W3D_CHUNK_COMPRESSED_ANIMATION.ToString();
        }
Exemplo n.º 41
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_EMITTER_INFO);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_EMITTER_INFO;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER_INFO.ToString();

            byte[] tex_name_array = br.ReadBytes(chunkLength - 72);
            texture_name    = System.Text.ASCIIEncoding.ASCII.GetString(tex_name_array);
            start_size      = br.ReadSingle();
            end_size        = br.ReadSingle();
            life_time       = br.ReadSingle();
            emission_rate   = br.ReadSingle();
            max_emissions   = br.ReadSingle();
            velocity_random = br.ReadSingle();
            position_random = br.ReadSingle();
            fade_time       = br.ReadSingle();
            gravity         = br.ReadSingle();
            elasticity      = br.ReadSingle();

            velocity   = new Vector3();
            velocity.X = br.ReadSingle();
            velocity.Y = br.ReadSingle();
            velocity.Z = br.ReadSingle();

            acceleration   = new Vector3();
            acceleration.X = br.ReadSingle();
            acceleration.Y = br.ReadSingle();
            acceleration.Z = br.ReadSingle();

            start_color = Color.FromArgb(br.ReadByte(), br.ReadByte(), br.ReadByte(), br.ReadByte());
            end_color   = Color.FromArgb(br.ReadByte(), br.ReadByte(), br.ReadByte(), br.ReadByte());

            if (dbg)
            {
                Console.Out.WriteLine("\t Texture Name: " + texture_name);
                Console.Out.WriteLine("\t Start Size: " + start_size);
                Console.Out.WriteLine("\t End Size: " + end_size);
                Console.Out.WriteLine("\t Lifetime: " + life_time);
                Console.Out.WriteLine("\t Emission Rate: " + emission_rate);
                Console.Out.WriteLine("\t Max Emissions: " + max_emissions);
                Console.Out.WriteLine("\t Velocity Random: " + velocity_random);
                Console.Out.WriteLine("\t Position Random: " + position_random);
                Console.Out.WriteLine("\t Fade Time: " + fade_time);
                Console.Out.WriteLine("\t Gravity: " + gravity);
                Console.Out.WriteLine("\t Elasticity: " + elasticity);
                Console.Out.WriteLine("\t Velocity: " + velocity);
                Console.Out.WriteLine("\t Acceleration: " + acceleration);
                Console.Out.WriteLine("\t Start Color: " + start_color);
                Console.Out.WriteLine("\t End Color: " + end_color);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_EMITTER_ROTATION_KEYFRAMES);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_EMITTER_ROTATION_KEYFRAMES;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER_ROTATION_KEYFRAMES.ToString();

            key_frame_count = br.ReadInt32();
            random = br.ReadSingle();
            orientation_random = br.ReadSingle();
            int reserved = br.ReadInt32();
            rotational_velocity_keyframe_data = new object[key_frame_count][];

            if(dbg){
                Console.Out.WriteLine("\t  Key Frame Count: "+key_frame_count);
                Console.Out.WriteLine("\t  Random: "+random);
                Console.Out.WriteLine("\t  Orientation Random: "+orientation_random);
            }

            float[] rotation = new float[key_frame_count];
            float[] time = new float[key_frame_count];
            object[] tmp = new object[2];

            if (key_frame_count == 0){

                time[0] = br.ReadSingle();
                rotation[0] = br.ReadSingle();

                tmp[0] = time;
                tmp[1] = rotation;
                rotational_velocity_keyframe_data[0] = tmp;

                if(dbg){
                    Console.Out.WriteLine("\t  ********** Rotational Velocity KeyFrame 0 **********");
                    Console.Out.WriteLine("\t  Time: "+time);
                    Console.Out.WriteLine("\t  Rotation Velocity: "+rotation);
                }

            }else{
                for (int i = 0; i < key_frame_count; i++) {
                    time[i] = br.ReadSingle();
                    rotation[i] = br.ReadSingle();

                    tmp[0] = time;
                    tmp[1] = rotation;
                    rotational_velocity_keyframe_data[i] = tmp;

                    if(dbg){
                        Console.Out.WriteLine("\t  ********** Rotational Velocity KeyFrame "+i+"**********");
                        Console.Out.WriteLine("\t  Time: "+time);
                        Console.Out.WriteLine("\t  Rotation Velocity: "+rotation);
                    }
                }
            }
        }
Exemplo n.º 43
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_PIVOTS);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_PIVOTS;
            HeaderName = ChunkHeader.W3D_CHUNK_PIVOTS.ToString();

            int NumPivots = chunkLength / 60;
            pivot_data = new object[NumPivots][];

            for (int i = 0; i < NumPivots ; i++)
            {
                byte[] pivotNameArray = br.ReadBytes(16);
                String PivotName = System.Text.ASCIIEncoding.ASCII.GetString(pivotNameArray);
                int ParentID = br.ReadInt32();

                Vector3 translation = new Vector3();
                translation.X = br.ReadSingle();
                translation.Y = br.ReadSingle();
                translation.Z = br.ReadSingle();

                Vector3 eularAngle = new Vector3();
                eularAngle.X = br.ReadSingle();
                eularAngle.Y = br.ReadSingle();
                eularAngle.Z = br.ReadSingle();

                float[] rotation = new float[4];
                rotation[0] = br.ReadSingle();
                rotation[1] = br.ReadSingle();
                rotation[2] = br.ReadSingle();
                rotation[3] = br.ReadSingle();

                Object[] pivotValues = new Object[5];
                pivotValues[0] = PivotName;
                pivotValues[1] = ParentID;
                pivotValues[2] = translation;
                pivotValues[3] = eularAngle;
                pivotValues[4] = rotation;

                pivot_data[i] = pivotValues;

                if (dbg)
                {
                    Console.Out.WriteLine("\t Pivot #" + i + " Name: " + PivotName);
                    Console.Out.WriteLine("\t Parent ID: " + ParentID);
                    Console.Out.WriteLine("\t Translation: (" + translation.X + ", "
                        + translation.Y + ", " + translation.Z + ")");
                    Console.Out.WriteLine("\t Eular Angles: (" + eularAngle.X + ", "
                            + eularAngle.Y + ", " + eularAngle.Z + ")");
                    Console.Out.WriteLine("\t Rotation: (" + rotation[0] + ", "
                            + rotation[1] + ", " + rotation[2] + ", " + rotation[3]
                            + ")");
                }
            }
        }
Exemplo n.º 44
0
        public List <LiquidPrimitive> GetAllLiquidPrimitives()
        {
            List <LiquidPrimitive> toReturn = new List <LiquidPrimitive>();

            foreach (VoxelChunk chunk in ChunkMap.Select(chunks => chunks.Value))
            {
                toReturn.AddRange(chunk.Liquids.Values);
            }

            return(toReturn);
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES.ToString();

            key_frame_count = br.ReadInt32();
            random = br.ReadSingle();

            int[] reserved = new int[2];
            for (int i = 0; i < 2; i++) {
                reserved[i] = br.ReadInt32();
            }

            if(dbg){
                Console.Out.WriteLine("\t  Key Frame Count: " + key_frame_count);
                Console.Out.WriteLine("\t  Random: "+random);
            }

            if (key_frame_count == 0)
            {

                time = new float[1];
                frame_index = new float[1];

                frame_index[0] = br.ReadSingle();
                time[0] = br.ReadSingle();

                if(dbg){
                    Console.Out.WriteLine("\t  ********** Frame KeyFrame 0 **********");
                    Console.Out.WriteLine("\t  Time: "+time[0]);
                    Console.Out.WriteLine("\t  Frame (sub-texture Index): " + frame_index[0]);
                }

            }else{
                int Count = (chunkLength - 16) / 8;
                time = new float[Count];
                frame_index = new float[Count];

                for (int i = 0; i < Count; i++) {
                    frame_index[i] = br.ReadSingle();
                    time[i] = br.ReadSingle();

                    if(dbg){
                        Console.Out.WriteLine("\t  ********** Frame KeyFrame "+i+"**********");
                        Console.Out.WriteLine("\t  Time: "+time[i]);
                        Console.Out.WriteLine("\t  Frame (sub-texture Index): " + frame_index[i]);
                    }
                }
            }
        }
Exemplo n.º 46
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|-|" + ChunkHeader.W3D_CHUNK_DEFORM);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_DEFORM;
            HeaderName = ChunkHeader.W3D_CHUNK_DEFORM.ToString();

            set_count = br.ReadInt32();
            alpha_passes = br.ReadInt32();

            //reserved
            br.ReadBytes(chunkLength - 8);
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_VERTEX_MAPPER_ARGS1);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_VERTEX_MAPPER_ARGS1;
            HeaderName = ChunkHeader.W3D_CHUNK_VERTEX_MAPPER_ARGS1.ToString();

            mapper_args = br.ReadChars(chunkLength).ToString();

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Stage1 Mapper Args: " + mapper_args);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_TEXTURE_REPLACER_INFO);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_TEXTURE_REPLACER_INFO;
            HeaderName = ChunkHeader.W3D_CHUNK_TEXTURE_REPLACER_INFO.ToString();

            replaced_textures_count = br.ReadInt32();

            if (dbg)
            {
                Console.Out.WriteLine("\t Replaced Textures Count: " + replaced_textures_count);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_VERTEX_MATERIAL_NAME);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_VERTEX_MATERIAL_NAME;
            HeaderName = ChunkHeader.W3D_CHUNK_VERTEX_MATERIAL_NAME.ToString();

            byte[] MaterialNameArray = br.ReadBytes(chunkLength);
            material_name = System.Text.ASCIIEncoding.ASCII.GetString(MaterialNameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Material Name: " + MaterialName);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_MESH_USER_TEXT);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_MESH_USER_TEXT;
            HeaderName = ChunkHeader.W3D_CHUNK_MESH_USER_TEXT.ToString();

            byte[] nameArray = br.ReadBytes(chunkLength);
            user_text = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Mesh User Text: " + UserText.Trim());
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_DAZZLE_NAME);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_DAZZLE_NAME;
            HeaderName = ChunkHeader.W3D_CHUNK_DAZZLE_NAME.ToString();

            byte[] nameArray = br.ReadBytes(chunkLength);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t Dazzle Name: " + Name.Trim());
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_TRANSFORM_NODE);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_TRANSFORM_NODE;
            HeaderName = ChunkHeader.W3D_CHUNK_TRANSFORM_NODE.ToString();

            byte[] nameArray = br.ReadBytes(chunkLength);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Transform Node W3D FileName: " + name.Trim());
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_VERTEX_MAPPER_ARGS0);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_VERTEX_MAPPER_ARGS0;
            HeaderName = ChunkHeader.W3D_CHUNK_VERTEX_MAPPER_ARGS0.ToString();

            byte[] MapperArgsArray = br.ReadBytes(chunkLength);
            mapper_args = System.Text.ASCIIEncoding.ASCII.GetString(MapperArgsArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Stage0 Mapper Args: " + mapper_args);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_TEXTURE_NAME);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_TEXTURE_NAME;
            HeaderName = ChunkHeader.W3D_CHUNK_TEXTURE_NAME.ToString();

            byte[] textureNameArray = br.ReadBytes(chunkLength);
            texture_name = System.Text.ASCIIEncoding.ASCII.GetString(textureNameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Texture Name: " + texture_name);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_EMITTER_BLUR_TIME_KEYFRAMES);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_EMITTER_BLUR_TIME_KEYFRAMES;
            HeaderName = ChunkHeader.W3D_CHUNK_EMITTER_BLUR_TIME_KEYFRAMES.ToString();

            key_frame_count = br.ReadInt32();
            random = br.ReadSingle();
            reserved = br.ReadInt32();

            if(dbg){
                Console.Out.WriteLine("\t  Key Frame Count: " + key_frame_count);
                Console.Out.WriteLine("\t  Random: "+random);
            }

            if (key_frame_count == 0)
            {

                time = new float[1];
                blur_time = new float[1];

                time[0] = br.ReadSingle();
                blur_time[0] = br.ReadSingle();

                if(dbg){
                    Console.Out.WriteLine("\t  ********** Blur Time KeyFrame 0 **********");
                    Console.Out.WriteLine("\t  Time: "+time);
                    Console.Out.WriteLine("\t  Blur Time: "+blur_time);
                }

            }else{
                time = new float[key_frame_count];
                blur_time = new float[key_frame_count];

                for (int i = 0; i < key_frame_count; i++)
                {
                    time[i] = br.ReadSingle();
                    blur_time[i] = br.ReadSingle();

                    if(dbg){
                        Console.Out.WriteLine("\t  ********** Blur Time KeyFrame "+i+"**********");
                        Console.Out.WriteLine("\t  Time: "+time);
                        Console.Out.WriteLine("\t  Blur Time: "+blur_time);
                    }
                }
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_HLOD_SUB_OBJECT_ARRAY_HEADER);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_HLOD_SUB_OBJECT_ARRAY_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_HLOD_SUB_OBJECT_ARRAY_HEADER.ToString();

            model_count = br.ReadInt32();
            max_screen_size = br.ReadSingle();

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Model Count: " + model_count);
                Console.Out.WriteLine("\t\t Max Screen Size: " + max_screen_size);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--|" + ChunkHeader.W3D_CHUNK_DEFORM_SET);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_DEFORM_SET;
            HeaderName = ChunkHeader.W3D_CHUNK_DEFORM_SET.ToString();

            for (int i = 0; i < chunkLength / 12; i++)
            {
                keyframe_count = br.ReadInt32();
                flags = br.ReadInt32();

                //reserved
                br.ReadInt32();
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_AGGREGATE_HEADER);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_AGGREGATE_HEADER;
            HeaderName = ChunkHeader.W3D_CHUNK_AGGREGATE_HEADER.ToString();

            version = br.ReadInt32();
            byte[] nameArray = br.ReadBytes(16);
            name = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t Version: " + version);
                Console.Out.WriteLine("\t Name: " + name);
            }
        }
Exemplo n.º 59
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_NODE);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_NODE;
            HeaderName = ChunkHeader.W3D_CHUNK_NODE.ToString();

            byte[] renderObjNameArray = br.ReadBytes(chunkLength - 2);
            render_object_name = System.Text.ASCIIEncoding.ASCII.GetString(renderObjNameArray);
            pivot_id = br.ReadInt16();

            if (dbg)
            {
                Console.Out.WriteLine("\t Render Object Name: " + render_object_name);
                Console.Out.WriteLine("\t Pivot Id: " + pivot_id);
            }
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg) Console.Out.WriteLine("|----| " + ChunkHeader.W3D_CHUNK_TEXTURE_INFO);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_TEXTURE_INFO;
            HeaderName = ChunkHeader.W3D_CHUNK_TEXTURE_INFO.ToString();

            attributes = br.ReadInt32();
            frame_count = br.ReadInt32();
            frame_rate = br.ReadSingle();

            if (dbg)
            {
                Console.Out.WriteLine("\t\t   Attributes: " + attributes);
                Console.Out.WriteLine("\t\t   Frame Count: " + frame_count);
                Console.Out.WriteLine("\t\t   Frame Rate: " + frame_rate);
            }
        }