public GpuSmitsBVHNode(byte[] chunk) { var chunks = new[] { Int32Single.Create(chunk), //0,1,2,3 Int32Single.Create(chunk, 4), Int32Single.Create(chunk, 8), Int32Single.Create(chunk, 12), Int32Single.Create(chunk, 16), Int32Single.Create(chunk, 20), Int32Single.Create(chunk, 24), Int32Single.Create(chunk, 28) }; var chunks2 = new[] { Int32Single.Create(chunk), //0,1,2,3 Int32Single.Create(chunk, 4), Int32Single.Create(chunk, 8), Int32Single.Create(chunk, 12), Int32Single.Create(chunk, 16), Int32Single.Create(chunk, 20), Int32Single.Create(chunk, 24), Int32Single.Create(chunk, 28) }; bbox = new AABBInfo(new Point(chunks[0], chunks[1], chunks[2]), new Point(chunks[3], chunks[4], chunks[5])); primitive = (uint)((float)chunks[6]); skipIndex = (uint)((float)chunks[7]); }
public void Deserialize(byte[] data, int offset = 0) { var chunks = new[] { BitConverter.ToSingle(data, offset), BitConverter.ToSingle(data, offset + 4), BitConverter.ToSingle(data, offset + 8), BitConverter.ToSingle(data, offset + 12), BitConverter.ToSingle(data, offset + 16), BitConverter.ToSingle(data, offset + 20), BitConverter.ToSingle(data, offset + 24), BitConverter.ToSingle(data, offset + 28) }; bbox = new AABBInfo(new Point(chunks[0], chunks[1], chunks[2]), new Point(chunks[3], chunks[4], chunks[5])); primitive = (uint)((float)chunks[6]); skipIndex = (uint)((float)chunks[7]); }