public static Texture2D FromFile(string Pth, TexFilterMode FilterMode = TexFilterMode.Linear, TexWrapMode WrapMode = TexWrapMode.ClampToEdge, bool GenerateMipmap = true, bool UseSRGBA = false) { if (!File.Exists(Pth)) { throw new FileNotFoundException("Texture file not found", Pth); } return(FromBitmap(new Bitmap(Pth), FilterMode, WrapMode, GenerateMipmap, UseSRGBA)); }
public TexDesc(BinaryReader reader) { Source = new NiRef <NiSourceTexture>(reader); ClampMode = (TexClampMode)reader.ReadUInt32(); FilterMode = (TexFilterMode)reader.ReadUInt32(); UVSetIndex = reader.ReadUInt32(); PS2L = reader.ReadInt16(); PS2K = reader.ReadInt16(); }
public TexDesc(NiFile niFile) { source = new Ref <NiSourceTexture>(niFile); clampMode = (TexClampMode)niFile.Reader.ReadInt32(); filterMode = (TexFilterMode)niFile.Reader.ReadInt32(); UVSet = niFile.Reader.ReadInt32(); PS2L = niFile.Reader.ReadInt16(); PS2K = niFile.Reader.ReadInt16(); unknown1 = niFile.Reader.ReadInt16(); }
public Texture2D(TexFilterMode FilterMode = TexFilterMode.Nearest, TexWrapMode WrapMode = TexWrapMode.ClampToEdge, bool UseSRGBA = false) { this.UseSRGBA = UseSRGBA; TextureHandle = TextureHandleNotCreated; GL.CreateTextures(Target, 1, out ID); Bind(); SetParam(TexParam.WrapS, WrapMode); SetParam(TexParam.WrapT, WrapMode); SetFilterMode(FilterMode, FilterMode); }
/* * Sets the texture filter mode of the specified texture slot. This * specifies the way the texure will look when it's minified or magnified. * \param[in] slot The type of texture slot to set the filter mode for. * \param[in] mode The new texture filter mode for the specified texture * slot. */ public void SetTexFilterMode(TexType slot, TexFilterMode mode) { if (texing_prop != null) { if (!texing_prop.HasTexture((int)slot)) { throw new Exception("The texture at the specified index does not exist."); } var td = texing_prop.GetTexture((int)slot); td.filterMode = mode; texing_prop.SetTexture((int)slot, td); } //Just silently fail for now. Not sure where this data may or may not be stored in the old style texture properties. }
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; }
public NiTextureEffect(NIFReader file, BinaryReader reader) : base(file, reader) { ModelProjectionMatrix = reader.ReadMatrix33(); ModelProjectionTransform = reader.Read <Vector3>(); TextureFiltering = (TexFilterMode)reader.ReadUInt32(); TextureClamping = (TexClampMode)reader.ReadUInt32(); EffectType = (EffectType)reader.ReadUInt32(); CoordGenType = (CoordGenType)reader.ReadUInt32(); SourceTexture = new NiRef <NiSourceTexture>(reader); ClippingPlane = reader.ReadBoolean(); ModelPlane = reader.Read <Plane>(); PS2L = reader.ReadInt16(); PS2K = reader.ReadInt16(); }
public static Texture2D FromBitmap(Bitmap BMap, TexFilterMode FilterMode = TexFilterMode.Linear, TexWrapMode WrapMode = TexWrapMode.ClampToEdge, bool GenerateMipmap = true, bool UseSRGBA = false) { Texture2D Tex = new Texture2D(FilterMode, WrapMode, UseSRGBA); Tex.LoadDataFromBitmap(BMap); if (GenerateMipmap) { Tex.GenerateMipmap(); } Tex.Unbind(); return(Tex); }
public NiTextureEffect(NiFile niFile) : base(niFile) { modelProjectionMatrix = niFile.Reader.ReadMatrix(); modelProjectionTransform = niFile.Reader.ReadVector3(); textureFiltering = (TexFilterMode)niFile.Reader.ReadInt32(); textureClamping = (TexClampMode)niFile.Reader.ReadInt32(); textureType = (EffectType)niFile.Reader.ReadInt32(); coordinateGenerationType = (CoordGenType)niFile.Reader.ReadInt32(); sourceTexture = niFile.Reader.ReadInt32(); clippingPlane = niFile.Reader.ReadByte(); unknownVector = niFile.Reader.ReadVector3(); unknownFloat = niFile.Reader.ReadSingle(); PS2L = niFile.Reader.ReadInt16(); PS2K = niFile.Reader.ReadInt16(); unknownShort = niFile.Reader.ReadInt16(); }
//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; } }
public RenderTexture(int W, int H, bool Depth = true, bool DoubleBuffered = false, TexFilterMode FilterMode = TexFilterMode.Linear) { HasDepth = Depth; IsDoubleBuffered = DoubleBuffered; FrameBuffer = new FrameBuffer(); if (Depth) { DepthBuffer = new RenderBuffer(RenderBufferStorage.DepthComponent, W, H); FrameBuffer.BindRenderBuffer(DepthBuffer, FramebufferAttachment.DepthAttachment); } NewBuffer = new Texture2D(FilterMode, W, H); if (IsDoubleBuffered) { OldBuffer = new Texture2D(FilterMode, W, H); } FrameBuffer.BindTexture(NewBuffer, FramebufferAttachment.ColorAttachment0); FrameBuffer.DrawBuffer(DrawBufferMode.ColorAttachment0); Bind(); Unbind(); }
public void SetParam(TexParam Param, TexFilterMode WrapMode) { SetParam(Param, (int)WrapMode); }
public void SetFilterMode(TexFilterMode Mag = TexFilterMode.Nearest, TexFilterMode Min = TexFilterMode.Nearest) { SetParam(TexParam.MagFilter, Mag); SetParam(TexParam.MinFilter, Min); }
public Texture2D(TexFilterMode FilterMode, int W, int H, TexWrapMode WrapMode = TexWrapMode.ClampToEdge, bool UseSRGBA = false) : this(FilterMode, WrapMode, UseSRGBA) { LoadData(W, H, IntPtr.Zero); }