Removed unnecessary code
このコミットが含まれているのは:
1 親
05b9f22cea
コミット
d084d7bc24
6ファイル変更
+1
-166
検索条件に一致するファイルはありません
@@ -1,62 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DirectX12GameEngine.Core
|
||||
{
|
||||
public class AsyncDictionary<TKey, TValue>
|
||||
{
|
||||
private readonly Dictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>();
|
||||
|
||||
public event EventHandler<DictionaryChangedEventArgs<TKey, TValue>> ItemAdded;
|
||||
|
||||
public void Add(TKey key, TValue value)
|
||||
{
|
||||
dictionary.Add(key, value);
|
||||
ItemAdded?.Invoke(this, new DictionaryChangedEventArgs<TKey, TValue>(key, value));
|
||||
}
|
||||
|
||||
public bool ContainsKey(TKey key) => dictionary.ContainsKey(key);
|
||||
|
||||
public bool ContainsValue(TValue value) => dictionary.ContainsValue(value);
|
||||
|
||||
public async Task<TValue> GetValueAsync(TKey key)
|
||||
{
|
||||
if (!dictionary.TryGetValue(key, out TValue value))
|
||||
{
|
||||
TaskCompletionSource<TValue> tcs = new TaskCompletionSource<TValue>();
|
||||
|
||||
void OnItemAdded(object s, DictionaryChangedEventArgs<TKey, TValue> e)
|
||||
{
|
||||
if (e.Item.Key.Equals(key))
|
||||
{
|
||||
tcs.TrySetResult(e.Item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
ItemAdded += OnItemAdded;
|
||||
value = await tcs.Task;
|
||||
ItemAdded -= OnItemAdded;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public Task<TValue> this[TKey key] => GetValueAsync(key);
|
||||
}
|
||||
|
||||
public class DictionaryChangedEventArgs<TKey, TValue> : EventArgs
|
||||
{
|
||||
public DictionaryChangedEventArgs(TKey key, TValue value)
|
||||
: this(new KeyValuePair<TKey, TValue>(key, value))
|
||||
{
|
||||
}
|
||||
|
||||
public DictionaryChangedEventArgs(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
|
||||
public KeyValuePair<TKey, TValue> Item { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DirectX12GameEngine.Core
|
||||
{
|
||||
public static class DisposableExtensions
|
||||
{
|
||||
public static T DisposeBy<T>(this T item, ICollector collector) where T : IDisposable
|
||||
{
|
||||
collector.Disposables.Add(item);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DirectX12GameEngine.Core
|
||||
{
|
||||
public interface ICollector
|
||||
{
|
||||
ICollection<IDisposable> Disposables { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DirectX12GameEngine.Core
|
||||
{
|
||||
public interface IIdentifiable
|
||||
{
|
||||
Guid Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace DirectX12GameEngine.Core
|
||||
{
|
||||
public static class QuaternionExtensions
|
||||
{
|
||||
public static Vector3 ToEuler(in Quaternion rotation)
|
||||
{
|
||||
Vector3 rotationEuler;
|
||||
|
||||
float xx = rotation.X * rotation.X;
|
||||
float yy = rotation.Y * rotation.Y;
|
||||
float zz = rotation.Z * rotation.Z;
|
||||
float xy = rotation.X * rotation.Y;
|
||||
float zw = rotation.Z * rotation.W;
|
||||
float zx = rotation.Z * rotation.X;
|
||||
float yw = rotation.Y * rotation.W;
|
||||
float yz = rotation.Y * rotation.Z;
|
||||
float xw = rotation.X * rotation.W;
|
||||
|
||||
rotationEuler.Y = (float)Math.Asin(2.0f * (yw - zx));
|
||||
double test = Math.Cos(rotationEuler.Y);
|
||||
|
||||
if (test > 1e-6f)
|
||||
{
|
||||
rotationEuler.Z = (float)Math.Atan2(2.0f * (xy + zw), 1.0f - (2.0f * (yy + zz)));
|
||||
rotationEuler.X = (float)Math.Atan2(2.0f * (yz + xw), 1.0f - (2.0f * (yy + xx)));
|
||||
}
|
||||
else
|
||||
{
|
||||
rotationEuler.Z = (float)Math.Atan2(2.0f * (zw - xy), 2.0f * (zx + yw));
|
||||
rotationEuler.X = 0.0f;
|
||||
}
|
||||
|
||||
return rotationEuler;
|
||||
}
|
||||
|
||||
public static Quaternion ToQuaternion(in Vector3 value)
|
||||
{
|
||||
Quaternion rotation;
|
||||
|
||||
var halfAngles = value * 0.5f;
|
||||
|
||||
var fSinX = (float)Math.Sin(halfAngles.X);
|
||||
var fCosX = (float)Math.Cos(halfAngles.X);
|
||||
var fSinY = (float)Math.Sin(halfAngles.Y);
|
||||
var fCosY = (float)Math.Cos(halfAngles.Y);
|
||||
var fSinZ = (float)Math.Sin(halfAngles.Z);
|
||||
var fCosZ = (float)Math.Cos(halfAngles.Z);
|
||||
|
||||
var fCosXY = fCosX * fCosY;
|
||||
var fSinXY = fSinX * fSinY;
|
||||
|
||||
rotation.X = fSinX * fCosY * fCosZ - fSinZ * fSinY * fCosX;
|
||||
rotation.Y = fSinY * fCosX * fCosZ + fSinZ * fSinX * fCosY;
|
||||
rotation.Z = fSinZ * fCosXY - fSinXY * fCosZ;
|
||||
rotation.W = fCosZ * fCosXY + fSinXY * fSinZ;
|
||||
|
||||
return rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using DirectX12GameEngine.Core;
|
||||
using SharpDX.Direct3D;
|
||||
using SharpDX.Direct3D12;
|
||||
|
||||
namespace DirectX12GameEngine.Graphics
|
||||
{
|
||||
public sealed class GraphicsDevice : IDisposable, ICollector
|
||||
public sealed class GraphicsDevice : IDisposable
|
||||
{
|
||||
private readonly AutoResetEvent fenceEvent = new AutoResetEvent(false);
|
||||
private SharpDX.Direct3D11.Device? nativeDirect3D11Device;
|
||||
@@ -53,8 +52,6 @@ namespace DirectX12GameEngine.Graphics
|
||||
|
||||
public CommandList CopyCommandList { get; }
|
||||
|
||||
public ICollection<IDisposable> Disposables { get; } = new List<IDisposable>();
|
||||
|
||||
public FeatureLevel FeatureLevel { get; }
|
||||
|
||||
public GraphicsPresenter? Presenter { get; set; }
|
||||
@@ -163,11 +160,6 @@ namespace DirectX12GameEngine.Graphics
|
||||
NativeDirectFence.Dispose();
|
||||
NativeDirectFence.Dispose();
|
||||
|
||||
foreach (IDisposable disposable in Disposables)
|
||||
{
|
||||
disposable.Dispose();
|
||||
}
|
||||
|
||||
nativeDirect3D11Device?.Dispose();
|
||||
|
||||
NativeDevice.Dispose();
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする