Compare commits
No commits in common. "38a360793aeea4a52c558b1ee574b1f9539766b2" and "8237a46989e589514914b802b81d939db9131407" have entirely different histories.
38a360793a
...
8237a46989
|
@ -245,7 +245,7 @@ public partial class Mission : Node3D
|
|||
var rawRot = brush.angle;
|
||||
var rot = new Vector3(rawRot.Y, rawRot.Z, rawRot.X) * 360 / ushort.MaxValue;
|
||||
var scale = scaleProp == null ? Vector3.One : scaleProp.scale.ToGodotVec3(false);
|
||||
var model = Timing.TimeStage("Get Models", () => { return _modelLoader.Load(_campaignName, modelName); });
|
||||
var model = Timing.TimeStage("Load Models", () => { return _modelLoader.Load(_campaignName, modelName); });
|
||||
if (model != null)
|
||||
{
|
||||
model.Position = pos;
|
||||
|
|
|
@ -23,18 +23,18 @@ public class ModelLoader
|
|||
{
|
||||
if (_cache.TryGetValue((campaignName, modelName), out var fmModel))
|
||||
{
|
||||
return fmModel?.Duplicate() as MeshInstance3D;
|
||||
return fmModel == null ? fmModel : fmModel.Duplicate() as MeshInstance3D;
|
||||
}
|
||||
else if (_cache.TryGetValue(("", modelName), out var omModel))
|
||||
{
|
||||
return omModel?.Duplicate() as MeshInstance3D;
|
||||
return omModel == null ? omModel : omModel.Duplicate() as MeshInstance3D;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't care if this is null actually, we'll still cache that it's null lol
|
||||
var model = Timing.TimeStage("Load Models", () => { return LoadModel(_pathManager, ref campaignName, modelName); });
|
||||
var model = LoadModel(_pathManager, ref campaignName, modelName);
|
||||
_cache[(campaignName, modelName)] = model;
|
||||
return model;
|
||||
return model == null ? model : model.Duplicate() as MeshInstance3D;
|
||||
}
|
||||
|
||||
public static MeshInstance3D LoadModel(ResourcePathManager pathManager, ref string campaignName, string modelName)
|
||||
|
|
|
@ -14,9 +14,16 @@ public partial class TextureLoader
|
|||
|
||||
var width = gifImage.Width;
|
||||
var height = gifImage.Height;
|
||||
var bytes = new byte[width * height * 4];
|
||||
gifImage.CopyPixelDataTo(bytes);
|
||||
var image = Image.CreateFromData(width, height, false, Image.Format.Rgba8, bytes);
|
||||
var image = Image.CreateEmpty(width, height, false, Image.Format.Rgba8);
|
||||
for (var y = 0; y < height; y++)
|
||||
{
|
||||
for (var x = 0; x < width; x++)
|
||||
{
|
||||
var pixel = gifImage[x, y].ToVector4();
|
||||
image.SetPixel(x, y, new Color(pixel.X, pixel.Y, pixel.Z, pixel.W));
|
||||
}
|
||||
}
|
||||
|
||||
return ImageTexture.CreateFromImage(image);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue