public override ByteArray Write() { ByteArray header = new ByteArray(); int attrib = WriteLight(header); ByteArray data = new ByteArray(); data.WriteUInt16(attrib); data.WriteBytes(header.ToArray()); data.WriteUInt24(color); data.WriteFloat(multiplier); return data; }
public override ByteArray Write() { ByteArray header = new ByteArray(); int attrib = Write3D(header); ByteArray data = new ByteArray(); data.WriteUInt16(attrib); data.WriteBytes(header.ToArray()); data.WriteFloats(transform); data.WriteFloat(fov); WriteTags(data); return data; }
public override ByteArray Write() { ByteArray header = new ByteArray(); int attrib = 0x0000; if (doubleSided) attrib |= 1; if (!receiveLights) attrib |= 2; if (!receiveShadows) attrib |= 4; if (!receiveFog) attrib |= 8; if (!repeat) attrib |= 16; if (alpha != 1) { attrib |= 32; header.WriteFloat(alpha); } if (blendMode != 0) { attrib |= 64; header.WriteByte(blendMode); } ByteArray data = new ByteArray(); data.WriteUInt16(attrib); data.WriteBytes(header.ToArray()); data.WriteByte(techniques.Count); foreach (TechBase tech in techniques) { ByteArray techData = tech.Write(); data.WriteUInt16(tech.type); data.WriteUInt16((int)techData.Length); data.WriteBytes(techData.ToArray()); } return data; }
private byte[] GetBody() { ByteArray bytes = new ByteArray(); // Write Packets Data for (int i = 0; i < _objects.Count; i++) { SEAObject asset = _objects[i]; ByteArray data = new ByteArray(); byte[] buffer = asset.Write().ToArray(); data.WriteByte(asset.Flag); data.WriteTypeCode(asset.Type); if (asset.Named) data.WriteUTF8(asset.Name); if (asset.Compressed) buffer = Compression.Compress(buffer, compressAlgorithm); data.WriteBytes(buffer); bytes.WriteBytesObject(data.ToArray()); } return bytes.ToArray(); }
public byte[] Build() { // Body byte[] body = GetBody(); // Write Bytes ByteArray bytes = new ByteArray(); // Write MAGIC bytes.WriteUTFBytes("SEA"); // Write SIGNATURE bytes.WriteUTFBytes("S3D"); // Write Version bytes.WriteUInt24(version); // Write Protect Method bytes.WriteByte(0); // Write Compress Method bytes.WriteByte(SEA3DWriter.CompressionID(compressAlgorithm)); // Write File Count bytes.WriteUInt32((uint)_objects.Count); // Write Body bytes.WriteBytes(body); // Write Final bytes.WriteUInt24(0x5EA3D1); return bytes.ToArray(); }
public override ByteArray Write() { ByteArray header = new ByteArray(); int attrib = Write3D(header); if (materials.Count > 0) { attrib |= 256; header.WriteByte(materials.Count); if (materials.Count == 1) { header.WriteUInt32((uint)materials[0]); } else { for (int i = 0; i < materials.Count; i++) { header.WriteUInt32((uint)(materials[i] + 1)); } } } if (modifiers.Count > 0) { attrib |= 512; header.WriteByte(modifiers.Count); for (int i = 0; i < modifiers.Count; i++) { header.WriteUInt32(modifiers[i]); } } ByteArray data = new ByteArray(); data.WriteUInt16(attrib); data.WriteBytes(header.ToArray()); data.WriteFloats(transform); data.WriteUInt32((uint)geometry); WriteTags(data); return data; }