mirror of
https://github.com/4sval/FModel.git
synced 2026-09-10 10:36:28 -05:00
This commit is contained in:
Submodule CUE4Parse updated: 57e63513ca...2f5fbe8a85
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Objects;
|
||||
@@ -8,10 +9,11 @@ namespace FModel.Creator.Bases.FN;
|
||||
|
||||
public class BaseOfferDisplayData : UCreator
|
||||
{
|
||||
private BaseMaterialInstance[] _offerImages;
|
||||
private readonly List<BaseMaterialInstance> _offerImages;
|
||||
|
||||
public BaseOfferDisplayData(UObject uObject, EIconStyle style) : base(uObject, style)
|
||||
{
|
||||
_offerImages = new List<BaseMaterialInstance>();
|
||||
}
|
||||
|
||||
public override void ParseForInfo()
|
||||
@@ -19,24 +21,23 @@ public class BaseOfferDisplayData : UCreator
|
||||
if (!Object.TryGetValue(out FStructFallback[] contextualPresentations, "ContextualPresentations"))
|
||||
return;
|
||||
|
||||
_offerImages = new BaseMaterialInstance[contextualPresentations.Length];
|
||||
for (var i = 0; i < _offerImages.Length; i++)
|
||||
for (var i = 0; i < contextualPresentations.Length; i++)
|
||||
{
|
||||
if (!contextualPresentations[i].TryGetValue(out FSoftObjectPath material, "Material") ||
|
||||
!material.TryLoad(out UMaterialInterface presentation)) continue;
|
||||
|
||||
var offerImage = new BaseMaterialInstance(presentation, Style);
|
||||
offerImage.ParseForInfo();
|
||||
_offerImages[i] = offerImage;
|
||||
_offerImages.Add(offerImage);
|
||||
}
|
||||
}
|
||||
|
||||
public override SKBitmap[] Draw()
|
||||
{
|
||||
var ret = new SKBitmap[_offerImages.Length];
|
||||
var ret = new SKBitmap[_offerImages.Count];
|
||||
for (var i = 0; i < ret.Length; i++)
|
||||
{
|
||||
ret[i] = _offerImages[i].Draw()[0];
|
||||
ret[i] = _offerImages[i]?.Draw()[0];
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -92,7 +92,19 @@ public class Texture : IDisposable
|
||||
Height = bitmap.Height;
|
||||
Bind(TextureUnit.Texture0);
|
||||
|
||||
GL.TexImage2D(_target, 0, texture2D.SRGB ? PixelInternalFormat.Srgb : PixelInternalFormat.Rgb, Width, Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, bitmap.Bytes);
|
||||
var internalFormat = Format switch
|
||||
{
|
||||
EPixelFormat.PF_G8 => PixelInternalFormat.R8,
|
||||
_ => texture2D.SRGB ? PixelInternalFormat.Srgb : PixelInternalFormat.Rgb
|
||||
};
|
||||
|
||||
var pixelFormat = Format switch
|
||||
{
|
||||
EPixelFormat.PF_G8 => PixelFormat.Red,
|
||||
_ => PixelFormat.Rgba
|
||||
};
|
||||
|
||||
GL.TexImage2D(_target, 0, internalFormat, Width, Height, 0, pixelFormat, PixelType.UnsignedByte, bitmap.Bytes);
|
||||
GL.TexParameter(_target, TextureParameterName.TextureMinFilter, (int) TextureMinFilter.LinearMipmapLinear);
|
||||
GL.TexParameter(_target, TextureParameterName.TextureMagFilter, (int) TextureMagFilter.Linear);
|
||||
GL.TexParameter(_target, TextureParameterName.TextureBaseLevel, 0);
|
||||
|
||||
Reference in New Issue
Block a user