Skip to content

Instantly share code, notes, and snippets.

View syoyo's full-sized avatar
💗
ray tracing

Syoyo Fujita syoyo

💗
ray tracing
View GitHub Profile
function cnd(d)
{
var A1 = 0.31938153;
var A2 = -0.356563782;
var A3 = 1.781477937;
var A4 = -1.821255978;
var A5 = 1.330274429;
var RSQRT2PI = 0.3989422804;
var K = 1.0 / (1.0 + 0.2316419 * Math.abs(d));
int buf[1024];
int a;
int b;
void
func()
{
a = buf[3];
b = buf[4];
int buf[1024];
int a;
int b;
void
func()
{
a = buf[3];
b = buf[4];
00000000 <LC_SEGMENT.>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: e8 00 00 00 00 call 0x9
9: 5b pop %ebx
a: 8b 8b 20 00 00 00 mov 0x20(%ebx),%ecx
10: 8b 83 28 00 00 00 mov 0x28(%ebx),%eax
16: 8b 51 0c mov 0xc(%ecx),%edx
19: 89 10 mov %edx,(%eax)
float a = 2.0f;
float b = 3.0f;
void
func()
{
a = b;
}
int
from pyparsing import *
def buildVar(s, l, t):
return [["id", t[0][0]]]
def buildExpr(s, l, t):
e = t[0]
$ python main.py
input = (4+3)*7+9
AST = [['add', ['mul', ['add', ['id', '4'], ['id', '3']], ['id', '7']], ['id', '9']]]
eval = 58
input = (4+3)*a
(4+3)*a
^
Expected end of text (at char 5), (line:1, col:6)
//
// Simple ambient occlusion renderer with ActionScript3
//
// Compile: $ mxmlc AmbientOcclusion.as
//
package {
import flash.display.*;
import flash.text.*;
import flash.utils.getTimer;
var IMAGE_WIDTH = 128
var IMAGE_HEIGHT = 128
var NSUBSAMPLES = 2
var NAO_SAMPLES = 4
function vec(x, y, z)
{
this.x = x;
this.y = y;
this.z = z;
_isect:
pushq %rbp
movq %rsp, %rbp
andq $-32, %rsp
subq $40, %rsp
movq 96(%rbp), %rax
movq 104(%rbp), %r10
vmovapd (%rcx), %ymm0
movq 40(%rbp), %rcx
vmovapd (%r8), %ymm1