muffin v7.5.5
This commit is contained in:
parent
a8f2c1df37
commit
6266f9e6b7
110 changed files with 14907 additions and 6073 deletions
64
Auspex/Auspex.Vfx.Internal/ActorBoundVfx.cs
Normal file
64
Auspex/Auspex.Vfx.Internal/ActorBoundVfx.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using Auspex.Vfx.Native;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
|
||||
namespace Auspex.Vfx.Internal;
|
||||
|
||||
public sealed class ActorBoundVfx : IDisposable
|
||||
{
|
||||
internal IGameObject target;
|
||||
|
||||
internal IGameObject source;
|
||||
|
||||
internal Vector3 scale;
|
||||
|
||||
internal Vector4 color;
|
||||
|
||||
internal unsafe VfxData* data;
|
||||
|
||||
public static ActorBoundVfx Create(string path, IGameObject target, IGameObject source, Vector3 scale, Vector4 color)
|
||||
{
|
||||
return new ActorBoundVfx(path, target, source, scale, color);
|
||||
}
|
||||
|
||||
private unsafe ActorBoundVfx(string path, IGameObject target, IGameObject source, Vector3 scale, Vector4 color)
|
||||
{
|
||||
this.target = target;
|
||||
this.source = source;
|
||||
this.scale = scale;
|
||||
this.color = color;
|
||||
data = CreateGameObjectVfxInternal(path, target, source, scale, color);
|
||||
}
|
||||
|
||||
public unsafe void Dispose()
|
||||
{
|
||||
if (data != null && data->Instance != null)
|
||||
{
|
||||
VfxNativeBridge.DestroyVfx(data);
|
||||
}
|
||||
data = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private unsafe static VfxData* CreateGameObjectVfxInternal(string path, IGameObject target, IGameObject source, Vector3 scale, Vector4 color)
|
||||
{
|
||||
fixed (byte* bytes = Encoding.UTF8.GetBytes(path + "\0"))
|
||||
{
|
||||
VfxData* intPtr = VfxNativeBridge.CreateGameObjectVfxInternal(bytes, target.Address, source.Address, 1f, 0, 0, 1);
|
||||
intPtr->Instance->Scale = scale;
|
||||
intPtr->Instance->Color = color;
|
||||
return intPtr;
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void UpdateColor(Vector4 color)
|
||||
{
|
||||
if (!(this.color == color))
|
||||
{
|
||||
this.color = color;
|
||||
VfxNativeBridge.UpdateVfxColor(data->Instance, color.X, color.Y, color.Z, color.W);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue