Skip to content

Instantly share code, notes, and snippets.

View realvictorprm's full-sized avatar
😼
Fighting the bugs!

Victor Peter Rouven Müller realvictorprm

😼
Fighting the bugs!
  • VPR Mueller Software Solutions
  • Switzerland
  • 05:46 (UTC +02:00)
  • X @realvictorprm
View GitHub Profile
@realvictorprm
realvictorprm / SurfaceExtraction.fs
Last active July 20, 2017 20:08
Surface extraction algorithms in F#, currently contains only Surface Nets
/// <summary>
/// Precalculated values which are power of two. Exponent begins with zero!
/// </summary>
let PowerOfTwo = [| for i in 0..20 -> int (System.Math.Pow(2., float i)) |]
let toBoolean<'T> (v:'T) = System.Convert.ToBoolean(v)
// size = 12
// This maps a edge index to a vertex pair
// 12 edges = 12 vertex pairs
let cubeEdgesSurfacenets =
// Wrong function
[SuppressUnmanagedCodeSecurity]
[DllImport("glfw3", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "glfwCreateWindowSurface")]
public static extern VkResult CreateWindowSurface(IntPtr instance, GLFWwindow window, IntPtr allocator, out long surface);
// Working function
[<SuppressUnmanagedCodeSecurity>]
[<DllImport("glfw3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwCreateWindowSurface")>]
extern VkResult CreateWindowSurface(uint64 instance, nativeint window, nativeint allocator, unativeint& surface);
@realvictorprm
realvictorprm / Fable.Import.Pixi.fs
Last active November 6, 2017 04:37
F# Bindings for Pixi.js v4.x
namespace Fable.Import
open System
open System.Text.RegularExpressions
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import.JS
open Fable.Import.Browser
module rec Cherry =