/// <summary> /// Write a PrmEntry with specified Binary Writer. /// </summary> /// <param name="bw">Binary Writer to use.</param> public void Write(DhBinaryWriter bw) { // Write Hash. bw.WriteU16(Hash); // Write NameLength. bw.WriteU16(NameLength); // Write Name. bw.WriteStr(Name); // Write ValueLength. bw.WriteU32(ValueLength); // Check Type. switch (Type) { case PrmType.BYTE: // Write Value as a byte. bw.Write((byte)Value); break; case PrmType.SHORT: // Write Value as a short. bw.WriteS16((short)Value); break; case PrmType.INT: // Write Value as a int. bw.WriteS32((int)Value); break; case PrmType.FLOAT: // Write Value as a float. bw.WriteF32((float)Value); break; case PrmType.RGBA: // Write Value as a Clr4. bw.WriteClr4((Clr4)Value); break; case PrmType.VECTOR3: // Write Value as a Vector3. bw.WriteVec3((Vec3)Value); break; default: throw new NotImplementedException("PRM parameter entry type is unknown!"); } }
/// <summary> /// Write a single shader with specified Binary Writer. /// </summary> /// <param name="bw">Binary Writer to use.</param> public void Write(DhBinaryWriter bw) { // Write Dynamic Lighting Flag. bw.Write(UseDynamicLighting ? 1 : 0); // Write Unknown 2. bw.Write(Unknown2); // Write Unknown 3. bw.Write(Unknown3); // Write Tint. bw.WriteClr4(Tint); // Write Unknown 4. (Padding) bw.Write(Unknown4); // Write Material Indices. bw.WriteS16s(MaterialIndices); // Write Unknown 5. (Indices?) bw.WriteS16s(Unknown5); }