private void ProcessNonSharedGeometryData(Dictionary <uint, List <Triangle> > groupedTriangles, BinaryReader reader, uint driver, uint primitiveType, uint primitiveHeaderPointer, uint nextPrimitivePointer, uint polygonIndex, uint dataCount) { var primitivePosition = reader.BaseStream.Position; ProcessGeometryPrimitiveHeader(reader, primitiveHeaderPointer, polygonIndex, out var vertTop, out var normTop, out var coordTop, out var dataTop); reader.BaseStream.Seek(_offset + dataTop + polygonIndex, SeekOrigin.Begin); for (var j = 0; j < dataCount; j++) { var packetStructure = TMDHelper.CreateHMDPacketStructure(driver, primitiveType, reader); //var offset = reader.BaseStream.Position; if (packetStructure != null) { TMDHelper.AddTrianglesToGroup(groupedTriangles, packetStructure, index => { var position = reader.BaseStream.Position; reader.BaseStream.Seek(_offset + vertTop + index * 8, SeekOrigin.Begin); var x = reader.ReadInt16(); var y = reader.ReadInt16(); var z = reader.ReadInt16(); var pad = reader.ReadInt16(); var vertex = new Vector3(x, y, z); reader.BaseStream.Seek(position, SeekOrigin.Begin); return(vertex); }, index => { var position = reader.BaseStream.Position; reader.BaseStream.Seek(_offset + normTop + index * 8, SeekOrigin.Begin); var nx = TMDHelper.ConvertNormal(reader.ReadInt16()); var ny = TMDHelper.ConvertNormal(reader.ReadInt16()); var nz = TMDHelper.ConvertNormal(reader.ReadInt16()); var pad = FInt.Create(reader.ReadInt16()); var normal = new Vector3 { X = nx, Y = ny, Z = nz }; reader.BaseStream.Seek(position, SeekOrigin.Begin); return(normal); } ); } } reader.BaseStream.Seek(primitivePosition, SeekOrigin.Begin); }
public static FInt operator >>(FInt one, int Amount) { return(FInt.Create(one.RawValue >> Amount, false)); }