Skip to content

Instantly share code, notes, and snippets.

View thatcosmonaut's full-sized avatar

Evan Hemsley thatcosmonaut

View GitHub Profile
using System.Numerics;
namespace Encompass.Collections
{
public static class BitSet1024Builder
{
public static BitSet1024 Zeroes()
{
return new BitSet1024(Vector256Builder.Zeroes(), Vector256Builder.Zeroes(), Vector256Builder.Zeroes(), Vector256Builder.Zeroes());
}
Process: dotnet [34191]
Path: /usr/local/share/dotnet/dotnet
Identifier: dotnet
Version: 0
Code Type: X86-64 (Native)
Parent Process: Code Helper (Renderer) [22771]
Responsible: dotnet [34191]
User ID: 501
Date/Time: 2020-01-25 10:13:35.690 -0800
Process: mono-sgen64 [61545]
Path: /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
Identifier: mono-sgen64
Version: 0
Code Type: X86-64 (Native)
Parent Process: Code Helper (Renderer) [40361]
Responsible: mono-sgen64 [61545]
User ID: 501
Date/Time: 2020-02-02 18:15:10.853 -0800
@thatcosmonaut
thatcosmonaut / Resolution.cs
Last active February 9, 2020 03:40
Resolution-independent rendering for FNA
//////////////////////////////////////////////////////////////////////////
////License: The MIT License (MIT)
////Copyright (c) 2010 David Amador (http://www.david-amador.com)
////
////Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
////
////The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
////
////THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIAB
@thatcosmonaut
thatcosmonaut / init
Last active February 28, 2020 02:34
public SamuraiGunnGame()
{
_graphicsDeviceManager = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsFixedTimeStep = Config.FORCE_FIXED_TIMESTEP;
_virtualDimensions = new Microsoft.Xna.Framework.Rectangle(0, 0, s_virtual_width, s_virtual_height);
_graphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.FORCE_VSYNC;
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace SamuraiGunn2
{
/// <summary>
/// The main class.
/// </summary>
public static class Program
@thatcosmonaut
thatcosmonaut / QuaternionLookAt.cs
Last active March 24, 2020 23:02
a LookAt helper method
// assumes that the input vectors are normalized and orthogonal
public static Quaternion LookAt(in Vector3 forward, in Vector3 up)
{
var right = Vector3.Cross(up, forward);
Quaternion quaternion;
quaternion.W = (float)Math.Sqrt(1.0f + right.X + up.Y + forward.Z) * 0.5f;
var w4_recip = 1.0f / (4.0f * quaternion.W);
quaternion.X = (forward.Y - up.Z) * w4_recip;
quaternion.Y = (right.Z - forward.X) * w4_recip;
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
CPU Family: 0x6
/* SongOgg.cs - An FAudio OGG wrapper.
Copyright (c) 2020 Evan Hemsley
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
@thatcosmonaut
thatcosmonaut / EffectContainer.cs
Last active June 19, 2020 07:06
FNA shader effect example
using Microsoft.Xna.Framework.Graphics;
using MyGame.IO;
namespace MyGame.Containers
{
public sealed class EffectContainer
{
public Effect SoftLightEffect { get; }
public EffectContainer(GraphicsDevice graphicsDevice)