private unsafe Chunk HandleModd(ChunkHeader *header) { var modd = new ModdChunk(header); DoodadDefinitions = modd.Definitions; return(modd); }
private unsafe Chunk HandleModn(ChunkHeader *header) { var modn = new StringReferenceChunk(header); DoodadReferences = modn.Strings; return(modn); }
private unsafe Chunk HandleMcnk(ChunkHeader *header) { var chunk = new MapChunk(header); MapChunks.Add(chunk); return(chunk); }
private unsafe Chunk HandleMopy(ChunkHeader *header) { var mopy = new MopyChunk(header); TriangleFlags = mopy.TriangleFlags; return(mopy); }
private unsafe Chunk HandleMods(ChunkHeader *header) { var mods = new ModsChunk(header); DoodadSets = mods.DoodadSets; return(mods); }
internal unsafe ModfChunk(ChunkHeader *header) : base(header) { var begin = (byte *)ChunkHeader.ChunkBegin(header); var end = begin + header->Size; Definitions = new List <IModelDefinition>(header->Size / sizeof(ModfEntry)); for (var entry = (ModfEntry *)begin; entry < end; entry++) { Definitions.Add(new RootModelDefinition { Id = entry->uniqueId, ReferenceIndex = entry->mwidEntry, Position = new Vector3( MapOriginOffset - entry->position.Z, MapOriginOffset - entry->position.X, entry->position.Y ), Rotation = entry->rotation, Scale = 1.0f, ExtraDoodadSetIndex = entry->doodadSet, Flags = entry->flags }); } }
private unsafe Chunk HandleMovt(ChunkHeader *header) { var movt = new MovtChunk(header); Vertices = movt.Vertices; return(movt); }
internal unsafe StringReferenceChunk(ChunkHeader *header) : base(header) { var begin = (byte *)ChunkHeader.ChunkBegin(header); var end = begin + header->Size; var curBegin = begin; var cur = begin; Strings = new List <StringReference>(); while (cur < end) { if (*cur == 0) { var length = (int)(cur - curBegin); if (length > 0) { Strings.Add(new StringReference { String = Marshal.PtrToStringAnsi((IntPtr)curBegin, length), Offset = (int)(curBegin - begin) }); } curBegin = cur + 1; } cur++; } }
private unsafe Chunk HandleMovi(ChunkHeader *header) { var movi = new MoviChunk(header); Triangles = movi.Triangles; return(movi); }
private unsafe Chunk HandleMliq(ChunkHeader *header) { var mliq = new MliqChunk(header); Liquid = mliq; return(mliq); }
internal unsafe MohdChunk(ChunkHeader *header) : base(header) { var mohd = (Mohd *)(header + 1); Bounds = mohd->bounds; GroupCount = mohd->groupCount; DoodadCount = mohd->doodadCount; }
internal unsafe void ParseOptionalData(ChunkHeader *header) { header->ValidateMagic("MCNK"); var cur = (byte *)header + sizeof(ChunkHeader); Chunks = Chunks.Concat(ChunkCollector.CreateChunks(cur, cur + header->Size, CreateChunks)); }
private unsafe Chunk HandleMogp(ChunkHeader *header) { _mogp = new MogpChunk(header); TriangleFlags = _mogp.TriangleFlags; Vertices = _mogp.Vertices; Triangles = _mogp.Triangles; Liquid = _mogp.Liquid; return(_mogp); }
public NoiseMetaInfo(ArchetypeChunkCalculationIndicator *archetypeChunkCalculationIndicator, ArchetypeChunkNoiseMetaInfo *archetypeChunkNoiseMetaInfo, ChunkHeader *chunkHeader, int archetypeChunkNoiseMetaInfoSize, int baseIndex) : this() { _archetypeChunkCalculationIndicator = archetypeChunkCalculationIndicator; _archetypeChunkNoiseMetaInfo = archetypeChunkNoiseMetaInfo; _chunkHeader = chunkHeader; _archetypeChunkNoiseMetaInfoSize = archetypeChunkNoiseMetaInfoSize; _baseIndex = baseIndex; }
internal unsafe MogpChunk(ChunkHeader *header) : base(header) { var mogp = (Mogp *)(header + 1); LiquidType = mogp->liquidType; GroupFlags = mogp->flags; var p = (byte *)mogp; Chunks = ChunkCollector.CreateChunks(p + sizeof(Mogp), p + header->Size, CreateChunk); }
private static unsafe MverChunk HandleMver(ChunkHeader *header) { var mver = new MverChunk(header); if (mver.Version != Version) { throw new AdtVersionException(Version, mver.Version); } return(mver); }
internal unsafe OffsetChunk(ChunkHeader *header) : base(header) { Offsets = new int[header->Size / sizeof(int)]; var cur = (int *)ChunkHeader.ChunkBegin(header); for (var i = 0; i < Offsets.Length; i++) { Offsets[i] = *cur++; } }
internal unsafe MapChunk(ChunkHeader *header) : base(header) { header->ValidateMagic("MCNK"); var cur = (byte *)header + sizeof(ChunkHeader); ParseMcnkHeader(cur); Chunks = ChunkCollector.CreateChunks(cur + sizeof(McnkHeader), cur + header->Size, CreateChunks); }
private unsafe Chunk CreateChunk(ChunkHeader *header) { switch (header->Magic) { case "MOGP": return(HandleMogp(header)); default: return(new Chunk(header)); } }
internal unsafe Mh2oChunk(ChunkHeader *header) : base(header) { var begin = (byte *)ChunkHeader.ChunkBegin(header); var currentChunk = (SMLiquidChunk *)begin; Liquids = new List <ChunkLiquid>(Adt.McnksPerAdt); for (int i = 0; i < Adt.McnksPerAdt; i++) { Liquids.Add(new ChunkLiquid(begin, currentChunk++)); } }
internal unsafe MliqChunk(ChunkHeader *header) : base(header) { var mliq = (Mliq *)ChunkHeader.ChunkBegin(header); Position = mliq->position; var entries = (HeightMapEntry *)(mliq + 1); var columns = mliq->vertexColumns; var rows = mliq->vertexRows; ParseHeightMap(entries, columns, rows); var flags = (byte *)(entries + columns * rows); ParseExistsTable(flags, columns - 1, rows - 1); }
private void addChunk() { var mem = (AtomicSafetyHandleNode *)Unity.Collections.LowLevel.Unsafe.UnsafeUtility.Malloc( (int)esz * kHandlesPerChunk + sizeof(ChunkHeader), 0, Unity.Collections.Allocator.Persistent); var h = (ChunkHeader *)((ulong)mem + esz * kHandlesPerChunk); h->m_chunk = h->m_curChunk = mem; h->m_nextChunk = m_headChunk; m_headChunk = h; }
internal unsafe McvtChunk(ChunkHeader *header) : base(header) { header->ValidateMagic("MCVT"); HeightMap = new float[NonDetailVertices, NonDetailVertices]; var values = (float *)((byte *)header + sizeof(ChunkHeader)); for (int r = 0; r < NonDetailVertices; r++) { for (int c = 0; c < NonDetailVertices; c++) { HeightMap[r, c] = values[r * ColumnsPerRow + c]; } } }
private unsafe Chunk CreateChunk(ChunkHeader *header) { switch (header->Magic) { case "MVER": return(HandleMver(header)); case "MH2O": return(HandleMh2o(header)); case "MCNK": return(HandleMcnk(header)); default: return(new Chunk(header)); } }
private unsafe Chunk ExtendChunk(ChunkHeader *header) { if (header->Size == 0) { return(null); } switch (header->Magic) { case "MVER": HandleMver(header); return(null); case "MH2O": return(null); case "MCNK": MapChunks[_mcnkCounter++].ParseOptionalData(header); return(null); case "MWID": return(new OffsetChunk(header)); case "MMID": return(new OffsetChunk(header)); case "MMDX": return(HandleMmdx(header)); case "MWMO": return(HandleMwmo(header)); case "MDDF": return(HandleMddf(header)); case "MODF": return(HandleModf(header)); default: return(new Chunk(header)); } }
private unsafe Chunk CreateChunk(ChunkHeader *header) { switch (header->Magic) { case "MOPY": return(HandleMopy(header)); case "MOVI": return(HandleMovi(header)); case "MOVT": return(HandleMovt(header)); case "MLIQ": return(HandleMliq(header)); default: return(new Chunk(header)); } }
private unsafe Chunk CreateChunk(ChunkHeader *header) { switch (header->Magic) { case "MPHD": var mphd = new MphdChunk(header); Flags = mphd.Flags; return(mphd); case "MAIN": _main = new MainChunk(header); return(_main); case "MWMO": return(new StringReferenceChunk(header)); case "MODF": return(new ModfChunk(header)); default: return(new Chunk(header)); } }
private unsafe Chunk CreateChunk(ChunkHeader *header) { switch (header->Magic) { case "MVER": return(HandleMver(header)); case "MOHD": return(_mohd = new MohdChunk(header)); case "MODS": return(HandleMods(header)); case "MODN": return(HandleModn(header)); case "MODD": return(HandleModd(header)); default: return(new Chunk(header)); } }
private unsafe Chunk CreateChunks(ChunkHeader *header) { switch (header->Magic) { case "MCVT": var mcvt = new McvtChunk(header); HeightMap = mcvt.HeightMap; _bounds.Maximum.Z += HeightMap.Cast <float>().Max(); return(mcvt); case "MCRD": var mcrd = new OffsetChunk(header); DoodadReferences = mcrd.Offsets; return(mcrd); case "MCRW": var mcrw = new OffsetChunk(header); WmoReferences = mcrw.Offsets; return(mcrw); default: return(new Chunk(header)); } }
internal unsafe ModsChunk(ChunkHeader *header) : base(header) { ParseSets((Mods *)ChunkHeader.ChunkBegin(header), header->Size / sizeof(Mods)); }