// get Clamp_Mode private uint GetTextureClampMode(NiFile file, NiTriShape shape) { uint flags = 3U; if (file.GetVersion() > 335544325U) { if (shape.GetBSProperty(0) != -1) { if (file.GetBlockAtIndex(shape.GetBSProperty(0)).GetType() == typeof(BSLightingShaderProperty)) { BSLightingShaderProperty lightingShaderProperty = (BSLightingShaderProperty)file.GetBlockAtIndex(shape.GetBSProperty(0)); flags = lightingShaderProperty.GetTextureClampMode(); } else { BSEffectShaderProperty effectShaderProperty = (BSEffectShaderProperty)file.GetBlockAtIndex(shape.GetBSProperty(0)); flags = effectShaderProperty.GetTextureClampMode(); } } } return flags; }
private string[] GetMeshTextures(NiFile file, NiTriShape shape) { string[] strArray = new string[2]; if ((file.GetVersion() > 335544325U) && (file.GetUserVersion() > 11U)) { if (shape.GetBSProperty(0) != -1) { if (file.GetBlockAtIndex(shape.GetBSProperty(0)).GetType() == typeof(BSLightingShaderProperty)) { BSLightingShaderProperty lightingShaderProperty = (BSLightingShaderProperty)file.GetBlockAtIndex(shape.GetBSProperty(0)); BSShaderTextureSet shaderTextureSet = (BSShaderTextureSet)file.GetBlockAtIndex(lightingShaderProperty.GetTextureSet()); strArray[0] = shaderTextureSet.GetTexture(0).ToLower(); strArray[1] = shaderTextureSet.GetTexture(1).ToLower(); } else { BSEffectShaderProperty effectShaderProperty = (BSEffectShaderProperty)file.GetBlockAtIndex(shape.GetBSProperty(0)); strArray[0] = effectShaderProperty.GetSourceTexture().ToLower(); strArray[1] = "textures\\default_n.dds"; } } else { strArray[0] = "textures\\defaultdiffuse.dds"; strArray[1] = "textures\\default_n.dds"; } } else { NiTexturingProperty texturingProperty = (NiTexturingProperty)null; for (int index = 0; (long)index < (long)shape.GetNumProperties(); ++index) { NiProperty niProperty = (NiProperty)file.GetBlockAtIndex(shape.GetProperty(index)); if (niProperty.GetType() == typeof(BSShaderPPLightingProperty)) { BSShaderPPLightingProperty lightingShaderProperty = (BSShaderPPLightingProperty)file.GetBlockAtIndex(shape.GetProperty(index)); BSShaderTextureSet shaderTextureSet = (BSShaderTextureSet)file.GetBlockAtIndex(lightingShaderProperty.GetTextureSet()); strArray[0] = shaderTextureSet.GetTexture(0).ToLower(); strArray[1] = shaderTextureSet.GetTexture(1).ToLower(); break; } if (niProperty.GetType() == typeof(NiTexturingProperty)) { texturingProperty = (NiTexturingProperty)niProperty; string str1 = "textures\\defaultdiffuse.dds"; string str2 = "textures\\default_n.dds"; if (texturingProperty != null && texturingProperty.HasBaseTexture()) { TexDesc baseTextureDesc = texturingProperty.GetBaseTextureDesc(); NiSourceTexture niSourceTexture = (NiSourceTexture)null; if (baseTextureDesc.source != -1) niSourceTexture = (NiSourceTexture)file.GetBlockAtIndex(baseTextureDesc.source); else if (texturingProperty.HasDetailTexture()) { TexDesc detailTexture = texturingProperty.GetDetailTexture(); if (detailTexture.source != -1) niSourceTexture = (NiSourceTexture)file.GetBlockAtIndex(detailTexture.source); } if (this.skyblivionTexPath) { str1 = niSourceTexture.GetFileName().ToLower().Replace("textures", "textures\\tes4"); str2 = str1.Replace(".dds", "_n.dds"); } else { str1 = niSourceTexture.GetFileName().ToLower(); str2 = str1.Replace(".dds", "_n.dds"); } } strArray[0] = str1.ToLower(); strArray[1] = str2.ToLower(); break; } strArray[0] = "textures\\defaultdiffuse.dds"; strArray[1] = "textures\\default_n.dds"; } } if (strArray[0].Contains("textures\\")) { strArray[0] = strArray[0].Remove(0, strArray[0].IndexOf("textures\\")); } if (strArray[1].Contains("textures\\")) { strArray[1] = strArray[1].Remove(0, strArray[1].IndexOf("textures\\")); } return strArray; }