public override void Write(NiHeader header, BinaryWriter writer) { List <int> blockReferences = header.GetBlockReferences(); if (blockReferences.Count > 0) { if (this.collisionObject != -1) { this.collisionObject = blockReferences[this.collisionObject]; } } base.Write(header, writer); writer.Write(this.flags); if ((header.GetUserVersion() >= 11U) && (header.GetUserVersion2() >= 26U)) { writer.Write(this.flags2); } Utils.WriteVector3(writer, this.translation); Utils.WriteMatrix33(writer, this.rotation); writer.Write(this.scale); if ((header.GetVersion() <= 335544325U) || (header.GetUserVersion() <= 11U)) { writer.Write((uint)this.properties.Count); for (int index = 0; (long)index < this.properties.Count; ++index) { if (blockReferences.Count > 0) { this.properties[index] = blockReferences[this.properties[index]]; } writer.Write(this.properties[index]); } } writer.Write(this.collisionObject); }
public override uint GetSize(NiHeader header) { uint size = base.GetSize(header) + 58U; if ((header.GetUserVersion() >= 11U) && (header.GetUserVersion2() >= 26U)) { size += 2; } if ((header.GetVersion() <= 335544325U) || (header.GetUserVersion() <= 11U)) { size += 4 + 4 * (uint)this.properties.Count; } return(size); }
public override uint GetSize(NiHeader header) { if (!((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21))) { return(base.GetSize(header) + 56U); } else if ((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21)) { return(base.GetSize(header) + 36U); } else { return(base.GetSize(header) + 32U); } }
public override uint GetSize(NiHeader header) { if (header.GetUserVersion2() == 100 || header.GetUserVersion2() == 130) { return(base.GetSize(header) + 28U); } else { if (header.GetVersion() > 335544325U) { if (header.GetUserVersion() == 12) { return(base.GetSize(header) + 25U + this.numMaterials * (uint)this.materialNames.Count + this.numMaterials * (uint)this.materialExtraData.Count); } else { return(base.GetSize(header) + 17U + this.numMaterials * (uint)this.materialNames.Count + this.numMaterials * (uint)this.materialExtraData.Count); } } else { if (this.hasShader) { return(base.GetSize(header) + 13U + (uint)this.shaderName.Length); } else { return(base.GetSize(header) + 9U); } } } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.unknownInt = reader.ReadInt32(); this.numVertices = reader.ReadUInt16(); this.keepFlags = reader.ReadByte(); this.compressFlags = reader.ReadByte(); this.hasVertices = Utils.ReadBool(reader); if (this.hasVertices) { for (int index = 0; index < (int)this.numVertices; ++index) { this.vertices.Add(Utils.ReadVector3(reader)); } } this.numUVSets = reader.ReadByte(); this.extraVectorFlags = reader.ReadByte(); if (header.GetUserVersion() == 12U) { this.skyrimMaterial = reader.ReadUInt32(); } this.hasNormals = Utils.ReadBool(reader); if (this.hasNormals) { for (int index = 0; index < (int)this.numVertices; ++index) { this.normals.Add(Utils.ReadVector3(reader)); } if ((this.extraVectorFlags & 16) == 16) { for (int index = 0; index < (int)this.numVertices; ++index) { this.tangents.Add(Utils.ReadVector3(reader)); } for (int index = 0; index < (int)this.numVertices; ++index) { this.bitangents.Add(Utils.ReadVector3(reader)); } } } this.center = Utils.ReadVector3(reader); this.radius = reader.ReadSingle(); this.hasVertexColors = Utils.ReadBool(reader); if (this.hasVertexColors) { for (int index = 0; index < (int)this.numVertices; ++index) { this.vertexColors.Add(Utils.ReadColor4(reader)); } } if (((int)this.numUVSets & 1) == 1) { for (int index = 0; index < (int)this.numVertices; ++index) { this.uvCoords.Add(Utils.ReadUVCoord(reader)); } } this.consistencyFlags = reader.ReadUInt16(); this.additionalData = reader.ReadInt32(); }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.data = reader.ReadInt32(); this.skinInstance = reader.ReadInt32(); if (header.GetVersion() > 335544325U) { this.numMaterials = reader.ReadUInt32(); for (int index = 0; (long)index < (long)this.numMaterials; ++index) { this.materialNames.Add(reader.ReadUInt32()); } for (int index = 0; (long)index < (long)this.numMaterials; ++index) { this.materialExtraData.Add(reader.ReadInt32()); } this.activeMaterial = reader.ReadInt32(); this.dirtyFlag = Utils.ReadBool(reader); if (header.GetUserVersion() == 12) { this.bsProperties[0] = reader.ReadInt32(); this.bsProperties[1] = reader.ReadInt32(); } } else { this.hasShader = Utils.ReadBool(reader); if (!this.hasShader) { return; } this.shaderName = Utils.ReadSizedString(reader); this.unknownInt = reader.ReadInt32(); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); if (!((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21))) { this.ambientColor = Utils.ReadColor3(reader); this.diffuseColor = Utils.ReadColor3(reader); } this.specularColor = Utils.ReadColor3(reader); this.emissiveColor = Utils.ReadColor3(reader); this.glossiness = reader.ReadSingle(); this.alpha = reader.ReadSingle(); if ((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21)) { this.emitMulti = reader.ReadSingle(); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); if (!((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21))) { this.ambientColor = Utils.ReadColor3(reader); this.diffuseColor = Utils.ReadColor3(reader); } this.specularColor = Utils.ReadColor3(reader); this.emissiveColor = Utils.ReadColor3(reader); this.glossiness = reader.ReadSingle(); this.alpha = reader.ReadSingle(); if ((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21)) { this.emitMulti = reader.ReadSingle(); } }
public override void Write(NiHeader header, BinaryWriter writer) { base.Write(header, writer); if (!((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21))) { Utils.WriteColor3(writer, this.ambientColor); Utils.WriteColor3(writer, this.diffuseColor); } Utils.WriteColor3(writer, this.specularColor); Utils.WriteColor3(writer, this.emissiveColor); writer.Write(this.glossiness); writer.Write(this.alpha); if ((header.GetVersion() == 335675399U) && (header.GetUserVersion() >= 11) && (header.GetUserVersion2() > 21)) { writer.Write(this.emitMulti); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.multiBound = reader.ReadInt32(); if (header.GetUserVersion() >= 12) { this.cullMode = reader.ReadUInt32(); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.multiBound = reader.ReadInt32(); if (header.GetUserVersion() >= 12) { this.cullMode = reader.ReadUInt32(); } }
public override uint GetSize(NiHeader header) { uint num = 236; if (header.GetUserVersion() <= 11) { num += 2; } return(base.GetSize(header) + num + (4 * numConstraints)); }
public override uint GetSize(NiHeader header) { if (header.GetUserVersion() == 12U) { return((uint)((int)(base.GetSize(header) + 39U) + (this.hasVertices ? 12 * (int)this.numVertices : 0) + (this.hasNormals ? 12 * (int)this.numVertices : 0) + (!this.hasNormals || (int)this.extraVectorFlags == 0 ? 0 : 12 * (int)this.numVertices) + (!this.hasNormals || (int)this.extraVectorFlags == 0 ? 0 : 12 * (int)this.numVertices) + (this.hasVertexColors ? 16 * (int)this.numVertices : 0) + (((int)this.numUVSets & 1) == 1 ? 8 * (int)this.numVertices : 0))); } else { return((uint)((int)(base.GetSize(header) + 35U) + (this.hasVertices ? 12 * (int)this.numVertices : 0) + (this.hasNormals ? 12 * (int)this.numVertices : 0) + (!this.hasNormals || (int)this.extraVectorFlags == 0 ? 0 : 12 * (int)this.numVertices) + (!this.hasNormals || (int)this.extraVectorFlags == 0 ? 0 : 12 * (int)this.numVertices) + (this.hasVertexColors ? 16 * (int)this.numVertices : 0) + (((int)this.numUVSets & 1) == 1 ? 8 * (int)this.numVertices : 0))); } }
public override uint GetSize(NiHeader header) { if (header.GetUserVersion() >= 12) { return(base.GetSize(header) + 8U); } else { return(base.GetSize(header) + 4U); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.flags = reader.ReadUInt16(); if ((header.GetUserVersion() >= 11U) && (header.GetUserVersion2() >= 26U)) { this.flags2 = reader.ReadUInt16(); } this.translation = Utils.ReadVector3(reader); this.rotation = Utils.ReadMatrix33(reader); this.scale = reader.ReadSingle(); if ((header.GetVersion() <= 335544325U) || (header.GetUserVersion() <= 11U)) { this.numProperties = reader.ReadUInt32(); for (int index = 0; (long)index < (long)this.numProperties; ++index) { this.properties.Add(reader.ReadInt32()); } } this.collisionObject = reader.ReadInt32(); }
public override void Write(NiHeader header, BinaryWriter writer) { List <int> blockReferences = header.GetBlockReferences(); if (blockReferences.Count > 0) { if (this.multiBound != -1) { this.multiBound = blockReferences[this.multiBound]; } } base.Write(header, writer); writer.Write(this.multiBound); if (header.GetUserVersion() >= 12) { writer.Write(this.cullMode); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.stuff = reader.ReadBytes(236); this.numConstraints = reader.ReadUInt32(); for (int index = 0; index < numConstraints; index++) { this.constraints.Add(reader.ReadInt32()); } if (header.GetUserVersion() <= 11) { this.unknownInt9 = reader.ReadInt32(); } else { this.unknownInt91 = reader.ReadUInt16(); } }
public override void Write(NiHeader header, BinaryWriter writer) { List <int> blockReferences = header.GetBlockReferences(); base.Write(header, writer); writer.Write(this.stuff); writer.Write(this.numConstraints); for (int index = 0; index < numConstraints; index++) { if (blockReferences.Count > 0) { this.constraints[index] = blockReferences[this.constraints[index]]; } writer.Write(this.constraints[index]); } if (header.GetUserVersion() <= 11) { writer.Write(this.unknownInt9); } else { writer.Write(this.unknownInt91); } }
public override void Write(NiHeader header, BinaryWriter writer) { base.Write(header, writer); writer.Write(this.unknownInt); writer.Write(this.numVertices); writer.Write(this.keepFlags); writer.Write(this.compressFlags); Utils.WriteBool(writer, this.hasVertices); if (this.hasVertices) { for (int index = 0; index < this.vertices.Count; ++index) { Utils.WriteVector3(writer, this.vertices[index]); } } writer.Write(this.numUVSets); writer.Write(this.extraVectorFlags); if (header.GetUserVersion() == 12U) { writer.Write(this.skyrimMaterial); } Utils.WriteBool(writer, this.hasNormals); if (this.hasNormals) { if (this.normals.Count == 0) { for (int index = 0; index < (int)this.numVertices; ++index) { this.normals.Add(new Vector3(0.0f, 0.0f, 0.0f)); } } for (int index = 0; index < this.normals.Count; ++index) { Utils.WriteVector3(writer, this.normals[index]); } if ((int)this.extraVectorFlags == 16) { if (this.tangents.Count == 0) { for (int index = 0; index < (int)this.numVertices; ++index) { this.tangents.Add(new Vector3(0.0f, 0.0f, 0.0f)); } } if (this.bitangents.Count == 0) { for (int index = 0; index < (int)this.numVertices; ++index) { this.bitangents.Add(new Vector3(0.0f, 0.0f, 0.0f)); } } for (int index = 0; index < this.tangents.Count; ++index) { Utils.WriteVector3(writer, this.tangents[index]); } for (int index = 0; index < this.bitangents.Count; ++index) { Utils.WriteVector3(writer, this.bitangents[index]); } } } Utils.WriteVector3(writer, this.center); writer.Write(this.radius); Utils.WriteBool(writer, this.hasVertexColors); if (this.hasVertexColors) { for (int index = 0; index < this.vertexColors.Count; ++index) { Utils.WriteColor4(writer, this.vertexColors[index]); } } if (((int)this.numUVSets & 1) == 1) { for (int index = 0; index < this.uvCoords.Count; ++index) { Utils.WriteUVCoord(writer, this.uvCoords[index]); } } writer.Write(this.consistencyFlags); writer.Write(this.additionalData); }
public override void Write(NiHeader header, BinaryWriter writer) { List <int> blockReferences = header.GetBlockReferences(); if (blockReferences.Count > 0) { if (this.skinInstance != -1) { this.skinInstance = blockReferences[this.skinInstance]; } if (this.bsProperties[0] != -1) { this.bsProperties[0] = blockReferences[this.bsProperties[0]]; } if (this.bsProperties[1] != -1) { this.bsProperties[1] = blockReferences[this.bsProperties[1]]; } } base.Write(header, writer); /*if (header.GetUserVersion2() == 100 || header.GetUserVersion2() == 130) * { * Utils.WriteVector3(writer, this.center); * writer.Write(this.radius); * writer.Write(this.skinInstance); * writer.Write(this.bsProperties[0]); * writer.Write(this.bsProperties[1]); * } * else*/ { writer.Write(this.data); writer.Write(this.skinInstance); if (header.GetVersion() > 335544325U) { writer.Write(this.numMaterials); for (int index = 0; (long)index < (long)this.numMaterials; ++index) { writer.Write(this.materialNames[index]); } for (int index = 0; (long)index < (long)this.numMaterials; ++index) { writer.Write(this.materialExtraData[index]); } writer.Write(this.activeMaterial); Utils.WriteBool(writer, this.dirtyFlag); if (header.GetUserVersion() == 12) { writer.Write(this.bsProperties[0]); writer.Write(this.bsProperties[1]); } } else { Utils.WriteBool(writer, this.hasShader); if (!this.hasShader) { return; } Utils.WriteSizedString(writer, this.shaderName); writer.Write(this.unknownInt); } } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.flags = reader.ReadUInt16(); if ((header.GetUserVersion() >= 11U) && (header.GetUserVersion2() >= 26U)) this.flags2 = reader.ReadUInt16(); this.translation = Utils.ReadVector3(reader); this.rotation = Utils.ReadMatrix33(reader); this.scale = reader.ReadSingle(); if ((header.GetVersion() <= 335544325U) || (header.GetUserVersion() <= 11U)) { this.numProperties = reader.ReadUInt32(); for (int index = 0; (long)index < (long)this.numProperties; ++index) this.properties.Add(reader.ReadInt32()); } else { } this.collisionObject = reader.ReadInt32(); }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.data = reader.ReadInt32(); this.skinInstance = reader.ReadInt32(); if (header.GetVersion() > 335544325U) { this.numMaterials = reader.ReadUInt32(); for (int index = 0; (long)index < (long)this.numMaterials; ++index) this.materialNames.Add(reader.ReadUInt32()); for (int index = 0; (long)index < (long)this.numMaterials; ++index) this.materialExtraData.Add(reader.ReadInt32()); this.activeMaterial = reader.ReadInt32(); this.dirtyFlag = Utils.ReadBool(reader); if (header.GetUserVersion() == 12) { this.bsProperties[0] = reader.ReadInt32(); this.bsProperties[1] = reader.ReadInt32(); } } else { this.hasShader = Utils.ReadBool(reader); if (!this.hasShader) return; this.shaderName = Utils.ReadSizedString(reader); this.unknownInt = reader.ReadInt32(); } }
public override void Read(NiHeader header, BinaryReader reader) { base.Read(header, reader); this.unknownInt = reader.ReadInt32(); this.numVertices = reader.ReadUInt16(); this.keepFlags = reader.ReadByte(); this.compressFlags = reader.ReadByte(); this.hasVertices = Utils.ReadBool(reader); if (this.hasVertices) { for (int index = 0; index < (int)this.numVertices; ++index) this.vertices.Add(Utils.ReadVector3(reader)); } this.bsNumUVSets = reader.ReadUInt16(); if (header.GetUserVersion() == 12U) this.skyrimMaterial = reader.ReadUInt32(); this.hasNormals = Utils.ReadBool(reader); if (this.hasNormals) { for (int index = 0; index < (int)this.numVertices; ++index) this.normals.Add(Utils.ReadVector3(reader)); if ((int)this.bsNumUVSets >= 4096) { for (int index = 0; index < (int)this.numVertices; ++index) this.tangents.Add(Utils.ReadVector3(reader)); for (int index = 0; index < (int)this.numVertices; ++index) this.bitangents.Add(Utils.ReadVector3(reader)); } } this.center = Utils.ReadVector3(reader); this.radius = reader.ReadSingle(); this.hasVertexColors = Utils.ReadBool(reader); if (this.hasVertexColors) { for (int index = 0; index < (int)this.numVertices; ++index) this.vertexColors.Add(Utils.ReadColor4(reader)); } if (((int)this.bsNumUVSets & 1) == 1) { for (int index = 0; index < (int)this.numVertices; ++index) this.uvCoords.Add(Utils.ReadUVCoord(reader)); } this.consistencyFlags = reader.ReadUInt16(); this.additionalData = reader.ReadInt32(); }