/*! NIFLIB_HIDDEN function. For internal use only. */ internal override void FixLinks(Dictionary <uint, NiObject> objects, List <uint> link_stack, List <NiObject> missing_link_stack, NifInfo info) { base.FixLinks(objects, link_stack, missing_link_stack, info); if (info.version <= 0x03010000) { image = FixLink <NiImage>(objects, link_stack, missing_link_stack, info); } if (info.version >= 0x04000000) { sourceTexture = FixLink <NiSourceTexture>(objects, link_stack, missing_link_stack, info); } }
/* * Retrieves the texture index of the texture wrapper that encloses the * specified NiSouceTexture, if any. * \param[in] src_tex The NiSourceTexture property to match in the search. * \return The index of the matching texture, or NO_TEXTURE if a match is * not found. */ public uint GetTextureIndex(NiSourceTexture src_tex) { for (var i = 0; i < textures.Length; ++i) { if (textures[i].src_tex == src_tex) { //Match found, return its index return(i); } } //No match was found, return NO_MATERIAL return(NO_TEXTURE); }
public NiTextureEffect() { textureFiltering = TexFilterMode.FILTER_TRILERP; maxAnisotropy = (ushort)0; textureClamping = TexClampMode.WRAP_S_WRAP_T; textureType = TextureType.TEX_ENVIRONMENT_MAP; coordinateGenerationType = CoordGenType.CG_SPHERE_MAP; image = null; sourceTexture = null; enablePlane = (byte)0; ps2L = (short)0; ps2K = (short)-75; unknownShort = (ushort)0; }
/*! * Creates a new material and adds it to the end of the array of materials * contained in this collection with an internal format matching the version * number specified. * \param[in] version The NIF version to target when creating the underlying NIF * objects that store the texture data. * \return The index of the newly created texture. */ public uint CreateTexture(uint version) { if (version < Nif.VER_3_3_0_13) { //Old image object style var image = new NiImage(); //Create texture wrapper and add it to the array textures.Add(new TextureWrapper(image)); } else { //New iamge object style var src_tex = new NiSourceTexture(); //Create texture wrapper and add it to the array textures.Add(new TextureWrapper(src_tex)); } //Return the index of the newly created texture return(textures.Length - 1); }
//Constructor public TexDesc() { unchecked { image = null; source = null; clampMode = TexClampMode.WRAP_S_WRAP_T; filterMode = TexFilterMode.FILTER_TRILERP; flags = (ushort)0; maxAnisotropy = (ushort)0; uvSet = (uint)0; ps2L = (short)0; ps2K = (short)-75; unknown1 = (ushort)0; hasTextureTransform = false; scale = 1.0, 1.0; rotation = 0.0f; transformMethod = (TransformMethod)0; } }
/*! NIFLIB_HIDDEN function. For internal use only. */ internal TextureWrapper(NiSourceTexture src) { src_tex = src; }