Formatting pass

pull/14/head
cosmonaut 2022-02-22 21:14:32 -08:00
parent a0c57c7a59
commit 8973b3e658
93 changed files with 5236 additions and 5080 deletions

14
.editorconfig Normal file
View File

@ -0,0 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
[*.cs]
csharp_space_after_cast = true
charset = utf-8-bom
max_line_length = 100

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
using MoonWorks.Math;

View File

@ -1,4 +1,4 @@
using System;
using System;
using MoonWorks.Math;
namespace MoonWorks.Audio

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace MoonWorks.Audio
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
using MoonWorks.Math;

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Audio
namespace MoonWorks.Audio
{
public enum SoundState
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
namespace MoonWorks.Audio

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace MoonWorks.Audio
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
namespace MoonWorks.Audio
@ -20,7 +20,8 @@ namespace MoonWorks.Audio
string filePath,
bool is3D = false,
bool loop = false
) {
)
{
var fileHandle = FAudio.stb_vorbis_open_filename(filePath, out var error, IntPtr.Zero);
if (error != 0)
{
@ -59,7 +60,8 @@ namespace MoonWorks.Audio
out uint bufferOffset,
out uint bufferLength,
out bool reachedEnd
) {
)
{
buffer = this.buffer;
/* NOTE: this function returns samples per channel, not total samples */

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace MoonWorks
{

View File

@ -46,7 +46,8 @@ namespace MoonWorks
PresentMode presentMode,
int targetTimestep = 60,
bool debugMode = false
) {
)
{
timestep = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / targetTimestep);
gameTimer = Stopwatch.StartNew();

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
public struct BufferBinding
{

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
using MoonWorks.Math;
using MoonWorks.Window;
@ -36,7 +36,8 @@ namespace MoonWorks.Graphics
Framebuffer framebuffer,
in Rect renderArea,
in DepthStencilValue depthStencilClearValue
) {
)
{
Refresh.Refresh_BeginRenderPass(
Device.Handle,
Handle,
@ -65,7 +66,8 @@ namespace MoonWorks.Graphics
in Rect renderArea,
in DepthStencilValue depthStencilClearValue,
params Vector4[] clearColors
) {
)
{
Refresh.Vec4* colors = stackalloc Refresh.Vec4[clearColors.Length];
for (var i = 0; i < clearColors.Length; i++)
@ -105,7 +107,8 @@ namespace MoonWorks.Graphics
Framebuffer framebuffer,
in Rect renderArea,
params Vector4[] clearColors
) {
)
{
Refresh.Vec4* colors = stackalloc Refresh.Vec4[clearColors.Length];
for (var i = 0; i < clearColors.Length; i++)
@ -143,7 +146,8 @@ namespace MoonWorks.Graphics
RenderPass renderPass,
Framebuffer framebuffer,
in Rect renderArea
) {
)
{
Refresh.Refresh_BeginRenderPass(
Device.Handle,
Handle,
@ -162,7 +166,8 @@ namespace MoonWorks.Graphics
/// <param name="computePipeline">The compute pipeline to bind.</param>
public void BindComputePipeline(
ComputePipeline computePipeline
) {
)
{
Refresh.Refresh_BindComputePipeline(
Device.Handle,
Handle,
@ -176,7 +181,8 @@ namespace MoonWorks.Graphics
/// <param name="buffers">A set of buffers to bind.</param>
public unsafe void BindComputeBuffers(
params Buffer[] buffers
) {
)
{
var bufferPtrs = stackalloc IntPtr[buffers.Length];
for (var i = 0; i < buffers.Length; i += 1)
@ -197,7 +203,8 @@ namespace MoonWorks.Graphics
/// <param name="textures">A set of textures to bind.</param>
public unsafe void BindComputeTextures(
params Texture[] textures
) {
)
{
var texturePtrs = stackalloc IntPtr[textures.Length];
for (var i = 0; i < textures.Length; i += 1)
@ -224,7 +231,8 @@ namespace MoonWorks.Graphics
uint groupCountY,
uint groupCountZ,
uint computeParamOffset
) {
)
{
Refresh.Refresh_DispatchCompute(
Device.Handle,
Handle,
@ -241,7 +249,8 @@ namespace MoonWorks.Graphics
/// <param name="graphicsPipeline">The graphics pipeline to bind.</param>
public void BindGraphicsPipeline(
GraphicsPipeline graphicsPipeline
) {
)
{
Refresh.Refresh_BindGraphicsPipeline(
Device.Handle,
Handle,
@ -257,7 +266,8 @@ namespace MoonWorks.Graphics
public unsafe void BindVertexBuffers(
uint firstBinding,
params BufferBinding[] bufferBindings
) {
)
{
var bufferPtrs = stackalloc IntPtr[bufferBindings.Length];
var offsets = stackalloc ulong[bufferBindings.Length];
@ -283,7 +293,8 @@ namespace MoonWorks.Graphics
/// <param name="buffers">The buffers to bind.</param>
public unsafe void BindVertexBuffers(
params Buffer[] buffers
) {
)
{
var bufferPtrs = stackalloc IntPtr[buffers.Length];
var offsets = stackalloc ulong[buffers.Length];
@ -313,7 +324,8 @@ namespace MoonWorks.Graphics
Buffer indexBuffer,
IndexElementSize indexElementSize,
uint offset = 0
) {
)
{
Refresh.Refresh_BindIndexBuffer(
Device.Handle,
Handle,
@ -331,7 +343,8 @@ namespace MoonWorks.Graphics
public unsafe void BindVertexSamplers(
TextureSamplerBinding[] textureSamplerBindings,
int length
) {
)
{
var texturePtrs = stackalloc IntPtr[textureSamplerBindings.Length];
var samplerPtrs = stackalloc IntPtr[textureSamplerBindings.Length];
@ -355,7 +368,8 @@ namespace MoonWorks.Graphics
/// <param name="textureSamplerBindings">The texture-sampler pairs to bind.</param>
public unsafe void BindVertexSamplers(
params TextureSamplerBinding[] textureSamplerBindings
) {
)
{
BindVertexSamplers(textureSamplerBindings, textureSamplerBindings.Length);
}
@ -367,7 +381,8 @@ namespace MoonWorks.Graphics
public unsafe void BindFragmentSamplers(
TextureSamplerBinding[] textureSamplerBindings,
int length
) {
)
{
var texturePtrs = stackalloc IntPtr[textureSamplerBindings.Length];
var samplerPtrs = stackalloc IntPtr[textureSamplerBindings.Length];
@ -391,7 +406,8 @@ namespace MoonWorks.Graphics
/// <param name="textureSamplerBindings">An array of texture-sampler pairs to bind.</param>
public unsafe void BindFragmentSamplers(
params TextureSamplerBinding[] textureSamplerBindings
) {
)
{
BindFragmentSamplers(textureSamplerBindings, textureSamplerBindings.Length);
}
@ -465,7 +481,8 @@ namespace MoonWorks.Graphics
ClearOptionsFlags clearOptions,
in DepthStencilValue depthStencilClearValue,
params Vector4[] clearColors
) {
)
{
Refresh.Vec4* colors = stackalloc Refresh.Vec4[clearColors.Length];
for (var i = 0; i < clearColors.Length; i++)
{
@ -506,7 +523,8 @@ namespace MoonWorks.Graphics
uint instanceCount,
uint vertexParamOffset,
uint fragmentParamOffset
) {
)
{
Refresh.Refresh_DrawInstancedPrimitives(
Device.Handle,
Handle,
@ -533,7 +551,8 @@ namespace MoonWorks.Graphics
uint primitiveCount,
uint vertexParamOffset,
uint fragmentParamOffset
) {
)
{
Refresh.Refresh_DrawIndexedPrimitives(
Device.Handle,
Handle,
@ -557,7 +576,8 @@ namespace MoonWorks.Graphics
uint primitiveCount,
uint vertexParamOffset,
uint fragmentParamOffset
) {
)
{
Refresh.Refresh_DrawPrimitives(
Device.Handle,
Handle,
@ -591,7 +611,8 @@ namespace MoonWorks.Graphics
in Rect destinationRectangle,
Filter filter,
OSWindow window
) {
)
{
var refreshRect = destinationRectangle.ToRefresh();
var refreshTextureSlice = new Refresh.TextureSlice
{
@ -629,7 +650,8 @@ namespace MoonWorks.Graphics
in Rect destinationRectangle,
Filter filter,
OSWindow window
) {
)
{
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
var refreshRect = destinationRectangle.ToRefresh();
@ -653,7 +675,8 @@ namespace MoonWorks.Graphics
in TextureSlice textureSlice,
Filter filter,
OSWindow window
) {
)
{
Refresh.Refresh_QueuePresent(
Device.Handle,
Handle,
@ -674,7 +697,8 @@ namespace MoonWorks.Graphics
Texture texture,
Filter filter,
OSWindow window
) {
)
{
var refreshTextureSlice = new Refresh.TextureSlice
{
texture = texture.Handle,
@ -713,7 +737,8 @@ namespace MoonWorks.Graphics
IntPtr dataPtr,
uint bufferOffsetInBytes,
uint dataLengthInBytes
) {
)
{
Refresh.Refresh_SetBufferData(
Device.Handle,
Handle,
@ -849,7 +874,8 @@ namespace MoonWorks.Graphics
in TextureSlice sourceTextureSlice,
in TextureSlice destinationTextureSlice,
Filter filter
) {
)
{
var sourceRefreshTextureSlice = sourceTextureSlice.ToRefreshTextureSlice();
var destRefreshTextureSlice = destinationTextureSlice.ToRefreshTextureSlice();
@ -871,7 +897,8 @@ namespace MoonWorks.Graphics
public void CopyTextureToBuffer(
in TextureSlice textureSlice,
Buffer buffer
) {
)
{
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
Refresh.Refresh_CopyTextureToBuffer(

View File

@ -18,7 +18,8 @@ namespace MoonWorks.Graphics
Refresh.PresentMode presentMode,
bool debugMode,
int initialCommandBufferPoolSize = 4
) {
)
{
var presentationParameters = new Refresh.PresentationParameters
{
deviceWindowHandle = deviceWindowHandle,

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
using RefreshCS;

View File

@ -15,7 +15,8 @@ namespace MoonWorks.Graphics
ShaderStageState computeShaderState,
uint bufferBindingCount,
uint imageBindingCount
) : base(device) {
) : base(device)
{
var computePipelineLayoutCreateInfo = new Refresh.ComputePipelineLayoutCreateInfo
{
bufferBindingCount = bufferBindingCount,

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using RefreshCS;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
using RefreshCS;

View File

@ -32,7 +32,8 @@ namespace MoonWorks.Graphics
bool canBeSampled,
SampleCount sampleCount = SampleCount.One,
uint levelCount = 1
) {
)
{
TextureUsageFlags flags = 0;
if (
@ -40,7 +41,8 @@ namespace MoonWorks.Graphics
format == TextureFormat.D32 ||
format == TextureFormat.D16S8 ||
format == TextureFormat.D32S8
) {
)
{
flags |= TextureUsageFlags.DepthStencilTarget;
}
else

View File

@ -1,4 +1,4 @@
using System;
using System;
using RefreshCS;
namespace MoonWorks.Graphics

View File

@ -82,7 +82,8 @@ namespace MoonWorks.Graphics
TextureUsageFlags usageFlags,
SampleCount sampleCount = SampleCount.One,
uint levelCount = 1
) {
)
{
var textureCreateInfo = new TextureCreateInfo
{
Width = width,
@ -118,7 +119,8 @@ namespace MoonWorks.Graphics
TextureUsageFlags usageFlags,
SampleCount sampleCount = SampleCount.One,
uint levelCount = 1
) {
)
{
var textureCreateInfo = new TextureCreateInfo
{
Width = width,
@ -150,7 +152,8 @@ namespace MoonWorks.Graphics
TextureUsageFlags usageFlags,
SampleCount sampleCount = SampleCount.One,
uint levelCount = 1
) {
)
{
var textureCreateInfo = new TextureCreateInfo
{
Width = size,

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Describes how the graphics pipeline will blend colors.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Determines how data is written to and read from the depth/stencil buffer.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
public struct GraphicsPipelineCreateInfo
{

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Describes how many samplers will be used in each shader stage.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Specifies how many samples should be used in rasterization.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Specifies how the rasterizer should be configured for a graphics pipeline.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Specifies how the graphics pipeline will make use of a shader.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Specifies how to interpet vertex data in a buffer to be passed to the vertex shader.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
/// <summary>
/// Describes the dimensions of viewports and scissor areas.

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Graphics
namespace MoonWorks.Graphics
{
public struct BlendConstants
{

View File

@ -1,4 +1,4 @@
namespace MoonWorks
namespace MoonWorks
{
public static class Conversions
{

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Input
namespace MoonWorks.Input
{
public class ButtonState
{

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Input
namespace MoonWorks.Input
{
internal enum ButtonStatus
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using MoonWorks.Math;
using SDL2;

View File

@ -1,4 +1,4 @@
using SDL2;
using SDL2;
using System;
using System.Collections.Generic;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using SDL2;

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Input
namespace MoonWorks.Input
{
// Enum values are equivalent to the SDL Scancode value.
public enum Keycode : int

View File

@ -1,4 +1,4 @@
using System;
using System;
using RefreshCS;
namespace MoonWorks

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -597,7 +597,8 @@ namespace MoonWorks.Math
ref Plane b,
ref Plane c,
out Vector3 result
) {
)
{
/* Formula used
* d1 ( N2 * N3 ) + d2 ( N3 * N1 ) + d3 ( N1 * N2 )
* P = -------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -474,7 +474,8 @@ namespace MoonWorks.Math
ref BoundingSphere original,
ref BoundingSphere additional,
out BoundingSphere result
) {
)
{
Vector3 ocenterToaCenter = Vector3.Subtract(additional.Center, original.Center);
float distance = ocenterToaCenter.Length();

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -98,7 +98,8 @@ namespace MoonWorks.Math
float value3,
float amount1,
float amount2
) {
)
{
return value1 + (value2 - value1) * amount1 + (value3 - value1) * amount2;
}
@ -117,7 +118,8 @@ namespace MoonWorks.Math
float value3,
float value4,
float amount
) {
)
{
/* Using formula from http://www.mvps.org/directx/articles/catmull/
* Internally using doubles not to lose precision.
*/
@ -184,7 +186,8 @@ namespace MoonWorks.Math
float value2,
float tangent2,
float amount
) {
)
{
/* All transformed to double not to lose precision
* Otherwise, for high numbers of param:amount the result is NaN instead
* of Infinity.

View File

@ -1,4 +1,4 @@
/* MoonWorks - Game Development Framework
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
*/

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -316,7 +316,8 @@ namespace MoonWorks.Math
float m21, float m22, float m23, float m24,
float m31, float m32, float m33, float m34,
float m41, float m42, float m43, float m44
) {
)
{
M11 = m11;
M12 = m12;
M13 = m13;
@ -350,7 +351,8 @@ namespace MoonWorks.Math
out Vector3 scale,
out Quaternion rotation,
out Vector3 translation
) {
)
{
translation.X = M41;
translation.Y = M42;
translation.Z = M43;
@ -555,7 +557,8 @@ namespace MoonWorks.Math
Vector3 cameraPosition,
Vector3 cameraUpVector,
Nullable<Vector3> cameraForwardVector
) {
)
{
Matrix4x4 result;
// Delegate to the other overload of the function to do the work
@ -584,7 +587,8 @@ namespace MoonWorks.Math
ref Vector3 cameraUpVector,
Vector3? cameraForwardVector,
out Matrix4x4 result
) {
)
{
Vector3 vector;
Vector3 vector2;
Vector3 vector3;
@ -642,7 +646,8 @@ namespace MoonWorks.Math
Vector3 rotateAxis,
Nullable<Vector3> cameraForwardVector,
Nullable<Vector3> objectForwardVector
) {
)
{
Matrix4x4 result;
CreateConstrainedBillboard(
ref objectPosition,
@ -671,7 +676,8 @@ namespace MoonWorks.Math
Vector3? cameraForwardVector,
Vector3? objectForwardVector,
out Matrix4x4 result
) {
)
{
float num;
Vector3 vector;
Vector3 vector2;
@ -777,7 +783,8 @@ namespace MoonWorks.Math
ref Vector3 axis,
float angle,
out Matrix4x4 result
) {
)
{
float x = axis.X;
float y = axis.Y;
float z = axis.Z;
@ -883,7 +890,8 @@ namespace MoonWorks.Math
float pitch,
float roll,
out Matrix4x4 result
) {
)
{
Quaternion quaternion;
Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll, out quaternion);
CreateFromQuaternion(ref quaternion, out result);
@ -900,7 +908,8 @@ namespace MoonWorks.Math
Vector3 cameraPosition,
Vector3 cameraTarget,
Vector3 cameraUpVector
) {
)
{
Matrix4x4 matrix;
CreateLookAt(ref cameraPosition, ref cameraTarget, ref cameraUpVector, out matrix);
return matrix;
@ -918,7 +927,8 @@ namespace MoonWorks.Math
ref Vector3 cameraTarget,
ref Vector3 cameraUpVector,
out Matrix4x4 result
) {
)
{
Vector3 vectorA = Vector3.Normalize(cameraPosition - cameraTarget);
Vector3 vectorB = Vector3.Normalize(Vector3.Cross(cameraUpVector, vectorA));
Vector3 vectorC = Vector3.Cross(vectorA, vectorB);
@ -953,7 +963,8 @@ namespace MoonWorks.Math
float height,
float zNearPlane,
float zFarPlane
) {
)
{
Matrix4x4 matrix;
CreateOrthographic(width, height, zNearPlane, zFarPlane, out matrix);
return matrix;
@ -973,7 +984,8 @@ namespace MoonWorks.Math
float zNearPlane,
float zFarPlane,
out Matrix4x4 result
) {
)
{
result.M11 = 2f / width;
result.M12 = result.M13 = result.M14 = 0f;
result.M22 = 2f / height;
@ -1002,7 +1014,8 @@ namespace MoonWorks.Math
float top,
float zNearPlane,
float zFarPlane
) {
)
{
Matrix4x4 matrix;
CreateOrthographicOffCenter(
left,
@ -1034,7 +1047,8 @@ namespace MoonWorks.Math
float zNearPlane,
float zFarPlane,
out Matrix4x4 result
) {
)
{
result.M11 = (float) (2.0 / ((double) right - (double) left));
result.M12 = 0.0f;
result.M13 = 0.0f;
@ -1075,7 +1089,8 @@ namespace MoonWorks.Math
float height,
float nearPlaneDistance,
float farPlaneDistance
) {
)
{
Matrix4x4 matrix;
CreatePerspective(width, height, nearPlaneDistance, farPlaneDistance, out matrix);
return matrix;
@ -1095,7 +1110,8 @@ namespace MoonWorks.Math
float nearPlaneDistance,
float farPlaneDistance,
out Matrix4x4 result
) {
)
{
if (nearPlaneDistance <= 0f)
{
throw new ArgumentException("nearPlaneDistance <= 0");
@ -1135,7 +1151,8 @@ namespace MoonWorks.Math
float aspectRatio,
float nearPlaneDistance,
float farPlaneDistance
) {
)
{
Matrix4x4 result;
CreatePerspectiveFieldOfView(
fieldOfView,
@ -1161,7 +1178,8 @@ namespace MoonWorks.Math
float nearPlaneDistance,
float farPlaneDistance,
out Matrix4x4 result
) {
)
{
if ((fieldOfView <= 0f) || (fieldOfView >= 3.141593f))
{
throw new ArgumentException("fieldOfView <= 0 or >= PI");
@ -1210,7 +1228,8 @@ namespace MoonWorks.Math
float top,
float nearPlaneDistance,
float farPlaneDistance
) {
)
{
Matrix4x4 result;
CreatePerspectiveOffCenter(
left,
@ -1242,7 +1261,8 @@ namespace MoonWorks.Math
float nearPlaneDistance,
float farPlaneDistance,
out Matrix4x4 result
) {
)
{
if (nearPlaneDistance <= 0f)
{
throw new ArgumentException("nearPlaneDistance <= 0");
@ -1408,7 +1428,8 @@ namespace MoonWorks.Math
float yScale,
float zScale,
out Matrix4x4 result
) {
)
{
result.M11 = xScale;
result.M12 = 0;
result.M13 = 0;
@ -1527,7 +1548,8 @@ namespace MoonWorks.Math
float xPosition,
float yPosition,
float zPosition
) {
)
{
Matrix4x4 result;
CreateTranslation(xPosition, yPosition, zPosition, out result);
return result;
@ -1582,7 +1604,8 @@ namespace MoonWorks.Math
float yPosition,
float zPosition,
out Matrix4x4 result
) {
)
{
result.M11 = 1;
result.M12 = 0;
result.M13 = 0;
@ -1672,7 +1695,8 @@ namespace MoonWorks.Math
ref Vector3 forward,
ref Vector3 up,
out Matrix4x4 result
) {
)
{
Vector3 x, y, z;
Vector3.Normalize(ref forward, out z);
Vector3.Cross(ref forward, ref up, out x);
@ -2069,7 +2093,8 @@ namespace MoonWorks.Math
ref Matrix4x4 matrix2,
float amount,
out Matrix4x4 result
) {
)
{
result.M11 = matrix1.M11 + ((matrix2.M11 - matrix1.M11) * amount);
result.M12 = matrix1.M12 + ((matrix2.M12 - matrix1.M12) * amount);
result.M13 = matrix1.M13 + ((matrix2.M13 - matrix1.M13) * amount);
@ -2097,7 +2122,8 @@ namespace MoonWorks.Math
public static Matrix4x4 Multiply(
Matrix4x4 matrix1,
Matrix4x4 matrix2
) {
)
{
float m11 = (
(matrix1.M11 * matrix2.M11) +
(matrix1.M12 * matrix2.M21) +
@ -2548,7 +2574,8 @@ namespace MoonWorks.Math
ref Matrix4x4 value,
ref Quaternion rotation,
out Matrix4x4 result
) {
)
{
Matrix4x4 rotMatrix = CreateFromQuaternion(rotation);
Multiply(ref value, ref rotMatrix, out result);
}

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -233,7 +233,8 @@ namespace MoonWorks.Math
ref Plane plane,
ref Matrix4x4 matrix,
out Plane result
) {
)
{
/* See "Transforming Normals" in
* http://www.glprogramming.com/red/appendixf.html
* for an explanation of how this works.
@ -277,7 +278,8 @@ namespace MoonWorks.Math
ref Plane plane,
ref Quaternion rotation,
out Plane result
) {
)
{
Vector3.Transform(
ref plane.Normal,
ref rotation,

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -266,7 +266,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion1,
ref Quaternion quaternion2,
out Quaternion result
) {
)
{
result.X = quaternion1.X + quaternion2.X;
result.Y = quaternion1.Y + quaternion2.Y;
result.Z = quaternion1.Z + quaternion2.Z;
@ -296,7 +297,8 @@ namespace MoonWorks.Math
ref Quaternion value1,
ref Quaternion value2,
out Quaternion result
) {
)
{
float x1 = value1.X;
float y1 = value1.Y;
float z1 = value1.Z;
@ -359,7 +361,8 @@ namespace MoonWorks.Math
ref Vector3 axis,
float angle,
out Quaternion result
) {
)
{
float half = angle * 0.5f;
float sin = (float) System.Math.Sin((double) half);
float cos = (float) System.Math.Cos((double) half);
@ -499,7 +502,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion1,
ref Quaternion quaternion2,
out Quaternion result
) {
)
{
float x = quaternion1.X;
float y = quaternion1.Y;
float z = quaternion1.Z;
@ -551,7 +555,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion1,
ref Quaternion quaternion2,
out float result
) {
)
{
result = (
(quaternion1.X * quaternion2.X) +
(quaternion1.Y * quaternion2.Y) +
@ -603,7 +608,8 @@ namespace MoonWorks.Math
Quaternion quaternion1,
Quaternion quaternion2,
float amount
) {
)
{
Quaternion quaternion;
Lerp(ref quaternion1, ref quaternion2, amount, out quaternion);
return quaternion;
@ -621,7 +627,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion2,
float amount,
out Quaternion result
) {
)
{
float num = amount;
float num2 = 1f - num;
float num5 = (
@ -668,7 +675,8 @@ namespace MoonWorks.Math
Quaternion quaternion1,
Quaternion quaternion2,
float amount
) {
)
{
Quaternion quaternion;
Slerp(ref quaternion1, ref quaternion2, amount, out quaternion);
return quaternion;
@ -686,7 +694,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion2,
float amount,
out Quaternion result
) {
)
{
float num2;
float num3;
float num = amount;
@ -743,7 +752,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion1,
ref Quaternion quaternion2,
out Quaternion result
) {
)
{
result.X = quaternion1.X - quaternion2.X;
result.Y = quaternion1.Y - quaternion2.Y;
result.Z = quaternion1.Z - quaternion2.Z;
@ -786,7 +796,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion1,
ref Quaternion quaternion2,
out Quaternion result
) {
)
{
float x = quaternion1.X;
float y = quaternion1.Y;
float z = quaternion1.Z;
@ -815,7 +826,8 @@ namespace MoonWorks.Math
ref Quaternion quaternion1,
float scaleFactor,
out Quaternion result
) {
)
{
result.X = quaternion1.X * scaleFactor;
result.Y = quaternion1.Y * scaleFactor;
result.Z = quaternion1.Z * scaleFactor;

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -396,7 +396,8 @@ namespace MoonWorks.Math
ref Rectangle value1,
ref Rectangle value2,
out Rectangle result
) {
)
{
if (value1.Intersects(value2))
{
int right_side = System.Math.Min(

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -264,7 +264,8 @@ namespace MoonWorks.Math
Vector2 value3,
float amount1,
float amount2
) {
)
{
return new Vector2(
MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2),
MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2)
@ -287,7 +288,8 @@ namespace MoonWorks.Math
float amount1,
float amount2,
out Vector2 result
) {
)
{
result.X = MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
result.Y = MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
}
@ -307,7 +309,8 @@ namespace MoonWorks.Math
Vector2 value3,
Vector2 value4,
float amount
) {
)
{
return new Vector2(
MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount),
MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount)
@ -330,7 +333,8 @@ namespace MoonWorks.Math
ref Vector2 value4,
float amount,
out Vector2 result
) {
)
{
result.X = MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
}
@ -362,7 +366,8 @@ namespace MoonWorks.Math
ref Vector2 min,
ref Vector2 max,
out Vector2 result
) {
)
{
result.X = MathHelper.Clamp(value1.X, min.X, max.X);
result.Y = MathHelper.Clamp(value1.Y, min.Y, max.Y);
}
@ -413,7 +418,8 @@ namespace MoonWorks.Math
ref Vector2 value1,
ref Vector2 value2,
out float result
) {
)
{
float v1 = value1.X - value2.X, v2 = value1.Y - value2.Y;
result = (v1 * v1) + (v2 * v2);
}
@ -507,7 +513,8 @@ namespace MoonWorks.Math
Vector2 value2,
Vector2 tangent2,
float amount
) {
)
{
Vector2 result = new Vector2();
Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
return result;
@ -529,7 +536,8 @@ namespace MoonWorks.Math
ref Vector2 tangent2,
float amount,
out Vector2 result
) {
)
{
result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
}
@ -561,7 +569,8 @@ namespace MoonWorks.Math
ref Vector2 value2,
float amount,
out Vector2 result
) {
)
{
result.X = MathHelper.Lerp(value1.X, value2.X, amount);
result.Y = MathHelper.Lerp(value1.Y, value2.Y, amount);
}
@ -773,7 +782,8 @@ namespace MoonWorks.Math
ref Vector2 value2,
float amount,
out Vector2 result
) {
)
{
result.X = MathHelper.SmoothStep(value1.X, value2.X, amount);
result.Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount);
}
@ -827,7 +837,8 @@ namespace MoonWorks.Math
ref Vector2 position,
ref Matrix4x4 matrix,
out Vector2 result
) {
)
{
float x = (position.X * matrix.M11) + (position.Y * matrix.M21) + matrix.M41;
float y = (position.X * matrix.M12) + (position.Y * matrix.M22) + matrix.M42;
result.X = x;
@ -856,7 +867,8 @@ namespace MoonWorks.Math
ref Vector2 value,
ref Quaternion rotation,
out Vector2 result
) {
)
{
float x = 2 * -(rotation.Z * value.Y);
float y = 2 * (rotation.Z * value.X);
float z = 2 * (rotation.X * value.Y - rotation.Y * value.X);
@ -875,7 +887,8 @@ namespace MoonWorks.Math
Vector2[] sourceArray,
ref Matrix4x4 matrix,
Vector2[] destinationArray
) {
)
{
Transform(sourceArray, 0, ref matrix, destinationArray, 0, sourceArray.Length);
}
@ -895,7 +908,8 @@ namespace MoonWorks.Math
Vector2[] destinationArray,
int destinationIndex,
int length
) {
)
{
for (int x = 0; x < length; x += 1)
{
Vector2 position = sourceArray[sourceIndex + x];
@ -918,7 +932,8 @@ namespace MoonWorks.Math
Vector2[] sourceArray,
ref Quaternion rotation,
Vector2[] destinationArray
) {
)
{
Transform(
sourceArray,
0,
@ -945,7 +960,8 @@ namespace MoonWorks.Math
Vector2[] destinationArray,
int destinationIndex,
int length
) {
)
{
for (int i = 0; i < length; i += 1)
{
Vector2 position = sourceArray[sourceIndex + i];
@ -979,7 +995,8 @@ namespace MoonWorks.Math
ref Vector2 normal,
ref Matrix4x4 matrix,
out Vector2 result
) {
)
{
float x = (normal.X * matrix.M11) + (normal.Y * matrix.M21);
float y = (normal.X * matrix.M12) + (normal.Y * matrix.M22);
result.X = x;
@ -996,7 +1013,8 @@ namespace MoonWorks.Math
Vector2[] sourceArray,
ref Matrix4x4 matrix,
Vector2[] destinationArray
) {
)
{
TransformNormal(
sourceArray,
0,
@ -1023,7 +1041,8 @@ namespace MoonWorks.Math
Vector2[] destinationArray,
int destinationIndex,
int length
) {
)
{
for (int i = 0; i < length; i += 1)
{
Vector2 position = sourceArray[sourceIndex + i];

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -383,7 +383,8 @@ namespace MoonWorks.Math
Vector3 value3,
float amount1,
float amount2
) {
)
{
return new Vector3(
MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2),
MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2),
@ -407,7 +408,8 @@ namespace MoonWorks.Math
float amount1,
float amount2,
out Vector3 result
) {
)
{
result.X = MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
result.Y = MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
result.Z = MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2);
@ -428,7 +430,8 @@ namespace MoonWorks.Math
Vector3 value3,
Vector3 value4,
float amount
) {
)
{
return new Vector3(
MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount),
MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount),
@ -452,7 +455,8 @@ namespace MoonWorks.Math
ref Vector3 value4,
float amount,
out Vector3 result
) {
)
{
result.X = MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
result.Z = MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount);
@ -486,7 +490,8 @@ namespace MoonWorks.Math
ref Vector3 min,
ref Vector3 max,
out Vector3 result
) {
)
{
result.X = MathHelper.Clamp(value1.X, min.X, max.X);
result.Y = MathHelper.Clamp(value1.Y, min.Y, max.Y);
result.Z = MathHelper.Clamp(value1.Z, min.Z, max.Z);
@ -501,7 +506,8 @@ namespace MoonWorks.Math
public static Vector3 ClampMagnitude(
Vector3 value,
float maxLength
) {
)
{
return (value.LengthSquared() > maxLength * maxLength) ? (Vector3.Normalize(value) * maxLength) : value;
}
@ -583,7 +589,8 @@ namespace MoonWorks.Math
ref Vector3 value1,
ref Vector3 value2,
out float result
) {
)
{
result = (
(value1.X - value2.X) * (value1.X - value2.X) +
(value1.Y - value2.Y) * (value1.Y - value2.Y) +
@ -688,7 +695,8 @@ namespace MoonWorks.Math
Vector3 value2,
Vector3 tangent2,
float amount
) {
)
{
Vector3 result = new Vector3();
Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
return result;
@ -710,7 +718,8 @@ namespace MoonWorks.Math
ref Vector3 tangent2,
float amount,
out Vector3 result
) {
)
{
result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount);
@ -744,7 +753,8 @@ namespace MoonWorks.Math
ref Vector3 value2,
float amount,
out Vector3 result
) {
)
{
result.X = MathHelper.Lerp(value1.X, value2.X, amount);
result.Y = MathHelper.Lerp(value1.Y, value2.Y, amount);
result.Z = MathHelper.Lerp(value1.Z, value2.Z, amount);
@ -992,7 +1002,8 @@ namespace MoonWorks.Math
ref Vector3 value2,
float amount,
out Vector3 result
) {
)
{
result.X = MathHelper.SmoothStep(value1.X, value2.X, amount);
result.Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount);
result.Z = MathHelper.SmoothStep(value1.Z, value2.Z, amount);
@ -1047,7 +1058,8 @@ namespace MoonWorks.Math
ref Vector3 position,
ref Matrix4x4 matrix,
out Vector3 result
) {
)
{
float x = (
(position.X * matrix.M11) +
(position.Y * matrix.M21) +
@ -1081,7 +1093,8 @@ namespace MoonWorks.Math
Vector3[] sourceArray,
ref Matrix4x4 matrix,
Vector3[] destinationArray
) {
)
{
Debug.Assert(
destinationArray.Length >= sourceArray.Length,
"The destination array is smaller than the source array."
@ -1121,7 +1134,8 @@ namespace MoonWorks.Math
Vector3[] destinationArray,
int destinationIndex,
int length
) {
)
{
Debug.Assert(
sourceArray.Length - sourceIndex >= length,
"The source array is too small for the given sourceIndex and length."
@ -1173,7 +1187,8 @@ namespace MoonWorks.Math
ref Vector3 value,
ref Quaternion rotation,
out Vector3 result
) {
)
{
float x = 2 * (rotation.Y * value.Z - rotation.Z * value.Y);
float y = 2 * (rotation.Z * value.X - rotation.X * value.Z);
float z = 2 * (rotation.X * value.Y - rotation.Y * value.X);
@ -1193,7 +1208,8 @@ namespace MoonWorks.Math
Vector3[] sourceArray,
ref Quaternion rotation,
Vector3[] destinationArray
) {
)
{
Debug.Assert(
destinationArray.Length >= sourceArray.Length,
"The destination array is smaller than the source array."
@ -1236,7 +1252,8 @@ namespace MoonWorks.Math
Vector3[] destinationArray,
int destinationIndex,
int length
) {
)
{
Debug.Assert(
sourceArray.Length - sourceIndex >= length,
"The source array is too small for the given sourceIndex and length."
@ -1289,7 +1306,8 @@ namespace MoonWorks.Math
ref Vector3 normal,
ref Matrix4x4 matrix,
out Vector3 result
) {
)
{
float x = (normal.X * matrix.M11) + (normal.Y * matrix.M21) + (normal.Z * matrix.M31);
float y = (normal.X * matrix.M12) + (normal.Y * matrix.M22) + (normal.Z * matrix.M32);
float z = (normal.X * matrix.M13) + (normal.Y * matrix.M23) + (normal.Z * matrix.M33);
@ -1308,7 +1326,8 @@ namespace MoonWorks.Math
Vector3[] sourceArray,
ref Matrix4x4 matrix,
Vector3[] destinationArray
) {
)
{
Debug.Assert(
destinationArray.Length >= sourceArray.Length,
"The destination array is smaller than the source array."
@ -1339,7 +1358,8 @@ namespace MoonWorks.Math
Vector3[] destinationArray,
int destinationIndex,
int length
) {
)
{
if (sourceArray == null)
{
throw new ArgumentNullException("sourceArray");

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -344,7 +344,8 @@ namespace MoonWorks.Math
Vector4 value3,
float amount1,
float amount2
) {
)
{
return new Vector4(
MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2),
MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2),
@ -369,7 +370,8 @@ namespace MoonWorks.Math
float amount1,
float amount2,
out Vector4 result
) {
)
{
result.X = MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
result.Y = MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
result.Z = MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2);
@ -391,7 +393,8 @@ namespace MoonWorks.Math
Vector4 value3,
Vector4 value4,
float amount
) {
)
{
return new Vector4(
MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount),
MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount),
@ -416,7 +419,8 @@ namespace MoonWorks.Math
ref Vector4 value4,
float amount,
out Vector4 result
) {
)
{
result.X = MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
result.Z = MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount);
@ -452,7 +456,8 @@ namespace MoonWorks.Math
ref Vector4 min,
ref Vector4 max,
out Vector4 result
) {
)
{
result.X = MathHelper.Clamp(value1.X, min.X, max.X);
result.Y = MathHelper.Clamp(value1.Y, min.Y, max.Y);
result.Z = MathHelper.Clamp(value1.Z, min.Z, max.Z);
@ -507,7 +512,8 @@ namespace MoonWorks.Math
ref Vector4 value1,
ref Vector4 value2,
out float result
) {
)
{
result = (
(value1.W - value2.W) * (value1.W - value2.W) +
(value1.X - value2.X) * (value1.X - value2.X) +
@ -572,7 +578,8 @@ namespace MoonWorks.Math
ref Vector4 value1,
ref Vector4 value2,
out Vector4 result
) {
)
{
result.W = value1.W / value2.W;
result.X = value1.X / value2.X;
result.Y = value1.Y / value2.Y;
@ -626,7 +633,8 @@ namespace MoonWorks.Math
Vector4 value2,
Vector4 tangent2,
float amount
) {
)
{
return new Vector4(
MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount),
MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount),
@ -651,7 +659,8 @@ namespace MoonWorks.Math
ref Vector4 tangent2,
float amount,
out Vector4 result
) {
)
{
result.W = MathHelper.Hermite(value1.W, tangent1.W, value2.W, tangent2.W, amount);
result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
@ -687,7 +696,8 @@ namespace MoonWorks.Math
ref Vector4 value2,
float amount,
out Vector4 result
) {
)
{
result.X = MathHelper.Lerp(value1.X, value2.X, amount);
result.Y = MathHelper.Lerp(value1.Y, value2.Y, amount);
result.Z = MathHelper.Lerp(value1.Z, value2.Z, amount);
@ -905,7 +915,8 @@ namespace MoonWorks.Math
ref Vector4 value2,
float amount,
out Vector4 result
) {
)
{
result.X = MathHelper.SmoothStep(value1.X, value2.X, amount);
result.Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount);
result.Z = MathHelper.SmoothStep(value1.Z, value2.Z, amount);
@ -1081,7 +1092,8 @@ namespace MoonWorks.Math
Vector4[] sourceArray,
ref Matrix4x4 matrix,
Vector4[] destinationArray
) {
)
{
if (sourceArray == null)
{
throw new ArgumentNullException("sourceArray");
@ -1122,7 +1134,8 @@ namespace MoonWorks.Math
Vector4[] destinationArray,
int destinationIndex,
int length
) {
)
{
if (sourceArray == null)
{
throw new ArgumentNullException("sourceArray");
@ -1202,7 +1215,8 @@ namespace MoonWorks.Math
ref Vector2 value,
ref Quaternion rotation,
out Vector4 result
) {
)
{
double xx = rotation.X + rotation.X;
double yy = rotation.Y + rotation.Y;
double zz = rotation.Z + rotation.Z;
@ -1240,7 +1254,8 @@ namespace MoonWorks.Math
ref Vector3 value,
ref Quaternion rotation,
out Vector4 result
) {
)
{
double xx = rotation.X + rotation.X;
double yy = rotation.Y + rotation.Y;
double zz = rotation.Z + rotation.Z;
@ -1281,7 +1296,8 @@ namespace MoonWorks.Math
ref Vector4 value,
ref Quaternion rotation,
out Vector4 result
) {
)
{
double xx = rotation.X + rotation.X;
double yy = rotation.Y + rotation.Y;
double zz = rotation.Z + rotation.Z;
@ -1322,7 +1338,8 @@ namespace MoonWorks.Math
Vector4[] sourceArray,
ref Quaternion rotation,
Vector4[] destinationArray
) {
)
{
if (sourceArray == null)
{
throw new ArgumentException("sourceArray");
@ -1363,7 +1380,8 @@ namespace MoonWorks.Math
Vector4[] destinationArray,
int destinationIndex,
int length
) {
)
{
if (sourceArray == null)
{
throw new ArgumentException("sourceArray");

View File

@ -1,4 +1,4 @@
#region License
#region License
/* MoonWorks - Game Development Framework
* Copyright 2021 Evan Hemsley
@ -67,7 +67,8 @@ namespace MoonWorks
string libraryName,
Assembly assembly,
DllImportSearchPath? dllImportSearchPath
) {
)
{
string mappedName;
if (!mapDictionary.TryGetValue(libraryName, out mappedName))
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using SDL2;
namespace MoonWorks.Window

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Window
namespace MoonWorks.Window
{
public enum ScreenMode
{

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Window
namespace MoonWorks.Window
{
public struct WindowCreateInfo
{