Skip to content

Instantly share code, notes, and snippets.

View jesterKing's full-sized avatar

Nathan Letwory jesterKing

View GitHub Profile
@jesterKing
jesterKing / Plugin.cs
Created March 30, 2020 15:15
RhinoRenderCycles.rhp
/**
Copyright 2014-2017 Robert McNeel and Associates
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@jesterKing
jesterKing / Plugin.cs
Last active September 20, 2019 04:27
Cycles as Rhino Render plug-in code.
/**
Copyright 2014-2019 Robert McNeel and Associates
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
int ShootRayOnCollection(ON_3dPoint point, ON_3dVector direction,
const ON_SimpleArray<const ON_Geometry*>* pConstGeometryArray,
ON_SimpleArray<ON_3dPoint>* pPoints, int maxReflections)
{
int rc = 0;
// Currently only supports surfaces and breps with untrimmed faces.
// Add support for meshes and trimmed breps
int count = pConstGeometryArray?pConstGeometryArray->Count():0;
@jesterKing
jesterKing / MaterialTextureEvaluatorCommand.cs
Last active June 19, 2018 10:50
Bitmap texture evaluator, Rhino 5, C#
using System;
using System.Collections.Generic;
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;
namespace MaterialTextureEvaluator
{
@jesterKing
jesterKing / GhFsharpTest.fs
Last active June 12, 2019 07:09
F# sample component for testing on Mac Rhino Grasshopper (v6, aka WIP)
namespace GhFsharpTest
open Grasshopper.Kernel
open Grasshopper.Kernel.Types
type Priority() =
inherit GH_AssemblyPriority()
override u.PriorityLoad() =
GH_LoadingInstruction.Proceed
@jesterKing
jesterKing / Nathan.cs
Created June 21, 2017 12:03
MemoryBitmapTexture implementation and test command.
using System;
using System.Runtime.InteropServices;
using Rhino.Render;
using Rhino.Geometry;
using Rhino.UI;
using Rhino.DocObjects;
using Rhino.Commands;
using Rhino;
using System.Drawing;
using Rhino.Display;
@jesterKing
jesterKing / common.fs
Created June 1, 2016 21:56
Grasshopper F# sample code. Note that the code in this gist isn't complete - it probably won't compile. But it should show the basic idea of what goes in a F# component for Grasshopper.
namespace CommonStuff
open Microsoft.FSharp.Reflection
open System
open System.Text
open System.Collections.Generic
open System.Linq
open System.Drawing
open System.Windows.Forms