Added implicit FloatN <-> VectorN conversions
このコミットが含まれているのは:
1 親
20762e0089
コミット
7a87cf1841
5ファイル変更
+41
-1241
検索条件に一致するファイルはありません
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
@@ -142,6 +143,18 @@ namespace ComputeSharp
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Float2"/> instance.</param>
|
||||
public static implicit operator Float2(float x) => new(x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float2"/> value to a <see cref="Vector2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float2"/> value to cast.</param>
|
||||
public static unsafe implicit operator Vector2(Float2 xy) => *(Vector2*)&xy;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Vector2"/> value to a <see cref="Float2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Vector2"/> value to cast.</param>
|
||||
public static unsafe implicit operator Float2(Vector2 xy) => *(Float2*)&xy;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float2"/> value to a <see cref="Double2"/> one.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
@@ -563,6 +564,18 @@ namespace ComputeSharp
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Float3"/> instance.</param>
|
||||
public static implicit operator Float3(float x) => new(x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float3"/> value to a <see cref="Vector3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float3"/> value to cast.</param>
|
||||
public static unsafe implicit operator Vector3(Float3 xyz) => *(Vector3*)&xyz;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Vector3"/> value to a <see cref="Float3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Vector3"/> value to cast.</param>
|
||||
public static unsafe implicit operator Float3(Vector3 xyz) => *(Float3*)&xyz;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float3"/> value to a <see cref="Double3"/> one.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
@@ -3968,6 +3969,18 @@ namespace ComputeSharp
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Float4"/> instance.</param>
|
||||
public static implicit operator Float4(float x) => new(x, x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float4"/> value to a <see cref="Vector4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float4"/> value to cast.</param>
|
||||
public static unsafe implicit operator Vector4(Float4 xyzw) => *(Vector4*)&xyzw;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Vector4"/> value to a <see cref="Float4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Vector4"/> value to cast.</param>
|
||||
public static unsafe implicit operator Float4(Vector4 xyzw) => *(Float4*)&xyzw;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float4"/> value to a <see cref="Double4"/> one.
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -12,7 +13,7 @@
|
||||
|
||||
<!--The source generator cannot contain package references or project references, so instead we're just
|
||||
manually linking the source files from ComputeSharp.Core in here. We only need them to extract metadata
|
||||
and to match members based on full name, so the types being in the generator assembly are not an issue.-->
|
||||
and to match members based on full name, so the types being in the generator assembly are not an issue.-->
|
||||
<ItemGroup>
|
||||
<Compile Include="..\ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" Link="Core\Attributes\AutoConstructorAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Attributes\ShaderMethodAttribute.cs" Link="Core\Attributes\ShaderMethodAttribute.cs" />
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする