Setup entry point + integrated moonworks stuff
This commit is contained in:
.idea/.idea.Nerfed/.idea
Libraries
Nerfed.Runtime
Assert.cs
Audio
AudioBuffer.csAudioDataOgg.csAudioDataQoa.csAudioDataStreamable.csAudioDataWav.csAudioDevice.csAudioEmitter.csAudioListener.csAudioResource.csFilterType.csFormat.csIPoolable.csPersistentVoice.csReverbEffect.csSoundSequence.csSoundState.csSourceVoice.csSourceVoicePool.csStreamingVoice.csSubmixVoice.csTransientVoice.csUpdatingSourceVoice.csVoice.cs
Engine.csFrameLimiterSettings.csGraphics
Color.csCommandBuffer.csCommandBufferPool.csComputePass.csComputePassPool.csCopyPass.csCopyPassPool.csEmbeddedShadersSpirV.csFencePool.cs
Font
GraphicsDevice.csGraphicsResource.csIEmbeddedShaders.csIVertexType.csImageUtils.csPackedVector
Alpha8.csBgr565.csBgra4444.csBgra5551.csByte4.csHalfSingle.csHalfTypeHelper.csHalfVector2.csHalfVector4.csIPackedVector.csNormalizedByte2.csNormalizedByte4.csNormalizedShort2.csNormalizedShort4.csRg32.csRgba1010102.csRgba64.csShort2.csShort4.cs
RefreshResource.csRefreshTypes.csRenderPass.csRenderPassPool.csResourceUploader.csResources
Buffer.csComputePipeline.csFence.csGraphicsPipeline.csSampler.csShader.csTexture.csTransferBuffer.cs
StockShaders
Input
Interop
Log.csNerfed.Runtime.csprojProfiler.csProgram.csStorage
Util
Video
Window
55
Nerfed.Runtime/Interop/Conversions.cs
Normal file
55
Nerfed.Runtime/Interop/Conversions.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Nerfed.Runtime.Graphics;
|
||||
using Nerfed.Runtime.Graphics.PackedVector;
|
||||
|
||||
namespace Nerfed.Runtime;
|
||||
|
||||
/// <summary>
|
||||
/// Conversion utilities for interop.
|
||||
/// </summary>
|
||||
public static class Conversions
|
||||
{
|
||||
private readonly static Dictionary<VertexElementFormat, uint> Sizes = new Dictionary<VertexElementFormat, uint>
|
||||
{
|
||||
{ VertexElementFormat.Byte4, (uint) Marshal.SizeOf<Byte4>() },
|
||||
{ VertexElementFormat.Color, (uint) Marshal.SizeOf<Color>() },
|
||||
{ VertexElementFormat.Float, (uint) Marshal.SizeOf<float>() },
|
||||
{ VertexElementFormat.HalfVector2, (uint) Marshal.SizeOf<HalfVector2>() },
|
||||
{ VertexElementFormat.HalfVector4, (uint) Marshal.SizeOf<HalfVector4>() },
|
||||
{ VertexElementFormat.NormalizedShort2, (uint) Marshal.SizeOf<NormalizedShort2>() },
|
||||
{ VertexElementFormat.NormalizedShort4, (uint) Marshal.SizeOf<NormalizedShort4>() },
|
||||
{ VertexElementFormat.Short2, (uint) Marshal.SizeOf<Short2>() },
|
||||
{ VertexElementFormat.Short4, (uint) Marshal.SizeOf<Short4>() },
|
||||
{ VertexElementFormat.Uint, (uint) Marshal.SizeOf<uint>() },
|
||||
{ VertexElementFormat.Vector2, (uint) Marshal.SizeOf<Vector2>() },
|
||||
{ VertexElementFormat.Vector3, (uint) Marshal.SizeOf<Vector3>() },
|
||||
{ VertexElementFormat.Vector4, (uint) Marshal.SizeOf<Vector4>() }
|
||||
};
|
||||
|
||||
public static byte BoolToByte(bool b)
|
||||
{
|
||||
return (byte) (b ? 1 : 0);
|
||||
}
|
||||
|
||||
public static bool ByteToBool(byte b)
|
||||
{
|
||||
return b != 0;
|
||||
}
|
||||
|
||||
public static int BoolToInt(bool b)
|
||||
{
|
||||
return b ? 1 : 0;
|
||||
}
|
||||
|
||||
public static bool IntToBool(int b)
|
||||
{
|
||||
return b != 0;
|
||||
}
|
||||
|
||||
public static uint VertexElementFormatSize(VertexElementFormat format)
|
||||
{
|
||||
return Sizes[format];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user