Skip to content

Instantly share code, notes, and snippets.

View snogglethorpe's full-sized avatar
💭
找工作

Miles Bader snogglethorpe

💭
找工作
View GitHub Profile
@snogglethorpe
snogglethorpe / ovlbug.swg
Created November 18, 2013 01:51
SWIG overload-resolution bug test case
// SWIG overload-resolution bug test case
//
// Miles Bader <[email protected]>
//
// Instructions to reproduce, on a Debian system with the "lua5.1" and
// "liblua5.1-0-dev" packages installed:
//
// Compile with:
//
@snogglethorpe
snogglethorpe / intro-path-bloom.jpg
Last active December 23, 2015 16:49
Lua intro scene for snogray renderer
intro-path-bloom.jpg
@snogglethorpe
snogglethorpe / handa-emacs-fontconfig-search-order.patch
Created September 22, 2013 04:52
handa-emacs-fontconfig-search-order.patch
commit 5cce45ee20e4dc7d6025e75ae3f3f56d3e541992
Author: Miles Bader <[email protected]>
Date: Wed Oct 10 14:09:12 2012 +0900
Handa fontconfig sorting patch
diff --git a/src/ftfont.c b/src/ftfont.c
index 10090cb..545c999 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@snogglethorpe
snogglethorpe / tex-light-20130816-0.patch
Created September 5, 2013 05:52
Patch for textured area lights in snogglethorpe/snogray [2013-08-16]
diff --git a/light/surface-light.cc b/light/surface-light.cc
index ddd3ac2..0270862 100644
--- a/light/surface-light.cc
+++ b/light/surface-light.cc
@@ -1,3 +1,5 @@
+#include "image/image.h"
+#include "util/radical-inverse.h"
// surface-light.cc -- General-purpose area light
//
// Copyright (C) 2010, 2013 Miles Bader <[email protected]>
@snogglethorpe
snogglethorpe / backtrace
Created August 6, 2013 03:51
weird elisp crash backtrace
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
insert(nil)
(while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (message "key = [%s], keyval = [%s], value = [%s]" key (symbol-name key) value) (insert (1password-make-button (symbol-name key) value)) (insert "\n") (setq --cl-var-- (cdr --cl-var--)))
(let* ((--cl-var-- 1password-passwords) (value nil) (key nil)) (while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (message "key = [%s], keyval = [%s], value = [%s]" key (symbol-name key) value) (insert (1password-make-button (symbol-name key) value)) (insert "\n") (setq --cl-var-- (cdr --cl-var--))) nil)
(catch (quote --cl-block-nil--) (let* ((--cl-var-- 1password-passwords) (value nil) (key nil)) (while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (message "key = [%s], keyval = [%s], value = [%s]" key (symbol-name key) value) (insert (1password-make-button (symbol-name key) value)) (insert "\n") (setq --cl-var-- (cdr --cl-
local tex = require 'snogray.texture'
local mat = require 'snogray.material'
local surf = require 'snogray.surface'
local xform = require 'snogray.transform'
-- local earth_color = image_tex "../textures/oera/EarthMap_2500x1250.jpg"
local earth_color = 1
local i = tex.image "../textures/pbrt/grid.exr"
local m = mat.lambert (i)
@snogglethorpe
snogglethorpe / gist:6102371
Created July 29, 2013 05:54
custom Emacs c-mode indentation hook
;; custom Emacs c-mode indentation hook
(defvar c-basic-offset) ; standard variable in c-mode
(defun miles-c-lineup-arglist-intro-indented-after-function (langelem)
"Works with: defun-block-intro, brace-list-intro,
statement-block-intro, statement-case-intro, arglist-intro."
(save-excursion
(beginning-of-line)
(backward-up-list 1)
@snogglethorpe
snogglethorpe / Image examples
Last active December 11, 2015 23:48
EXR file
Sure. Look at this gist: https://gist.github.com/4679014
It includes the same image file, in EXR, PNG, and JPEG formats.
The EXR file is the "master", and of course is encoded in linear-light, so shouldn't have gamma issues (haha!). The other files have a gamma-correction of 1 / 2.2. In the PNG, there's an explicit gAMA chunk describing this; in the JPEG file it's implicit (because of sRGB).
The PNG and jpeg files display identically with every program I've tried -- eog (gnome), "display" (imagemagick), web browsers (firefox, chrome), "geeqie" (not so common, but a nice and generally capable image display program). Most of these can't handle EXR, but "display" does, and it displays darker than the 8-bit files, similar to the way iv does.
"iv" displays the PNG file identically to the other programs, but displays the EXR and JPEG files much darker, suggesting that indeed maybe the issue is that iv is doing the wrong thing on _display_: using the correct gamma adjustment when reading jpeg files, getting