Skip to content

Instantly share code, notes, and snippets.

@leonard7e
leonard7e / simple_interpreter.rs
Last active March 19, 2021 20:17
A minimal interpreter written in rust.
use std::cell::RefCell;
use std::rc::Rc;
fn add_node(a1: &f32, a2: &f32, result: &mut f32) {
*result = a1+a2;
}
fn mul_node(a1: &f32, a2: &f32, result: &mut f32) {
*result = a1*a2;
}
@leonard7e
leonard7e / sprite_sheet.osl
Created April 18, 2020 14:33
OSL - Shader for creating sprite sheet
shader SpriteSheet(
string Basename = "",
string Extension = "",
int Rows = 1,
int NImages = 1,
int Zeros = 5,
vector UV = 0,
output color C = 0
)
#!/bin/bash
# Dont forget to add this line into $SRCDIR/CMakeLists.txt
# add_definitions (-D_GLIBCXX_USE_CXX11_ABI=0)
# in section …
# Platform-specific settings.
SRCDIR=appleseed-static
# What about this?
@leonard7e
leonard7e / gist:36e5fefc3b56c843e2c9790c22c8b29c
Created September 12, 2017 22:57
Message Programming Playground 2
trait Evaluieren <Msg> {
fn evaluieren(self: &mut Self, Msg) -> &mut Self;
}
macro_rules! eval_redirect {
(
$E: ty,
$M: ty,
$target: ident
// ---
// The Evaluator trait
trait Evaluator <Msg> {
fn evaluate(self: &mut Self, Msg) -> &mut Self;
}
macro_rules! eval_redirect {
(
$E: ty,