Skip to content

Instantly share code, notes, and snippets.

@Pentan
Pentan / arraybench.swift
Created September 10, 2018 16:22
Swift Array with Dispatch concurrent performance somparison
import Foundation
print("array bench")
print(" -o : output rendered image as \"result.ppm\"")
print(" -w Number : render image width")
print(" -h Number : render image height")
print(" -p Number : number of points")
print("----------")
var width = 4096
precision mediump float;
#extension GL_OES_standard_derivatives : enable
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#define PI 3.141592653589793
//#define PI2 6.283185307179586
#define PI05 1.570796326795
#define PI 3.1415926535898
#define kNumVertX 15.0
#define kNumVertY 15.0
//#define kNumVertZ
#define kScale 0.2
#define kTranslate vec3(-1.5)
vec3 hash3(vec3 v) {
/*
Blender Advent Calendar 2015
http://www.adventar.org/calendars/833
day 16
http://c5h12.hatenablog.com/entry/2015/12/16/150540
by Pentan
Shader code is distributed under MIT license.
Plasmagica and It's logo are part of SHOW BY ROCK!! (c)SANRIO.
http://showbyrock.com/
*/
@Pentan
Pentan / feel_like_debris.glsl
Last active December 9, 2015 07:56
http://www.vertexshaderart.com/art/HW98dGDbChYw2FjpS に投稿したものに日本語でコメントをつけたもの
#define PI05 1.570796326795
#define PI 3.1415926535898
// 適当なハッシュ関数.よくあるやつですが投稿したバージョンではカッコの位置を間違えているので注意
vec3 hash3(vec3 v) {
return fract(sin(v) * vec3(43758.5453123, 12345.6789012,76543.2109876));
}
// 回転関連
vec3 rotX(vec3 p, float rad) {
@Pentan
Pentan / gpuprng.glsl
Created March 1, 2015 18:24
The mysterious random number generator that was used in Toshiya Hachisuka's seminar at Tokyo Demo Fest 2015.
/*
The mysterious random number generator that was used in Toshiya Hachisuka's seminar at Tokyo Demo Fest 2015.
He said that don't know detail of this algorithm.
http://www.ci.i.u-tokyo.ac.jp/~hachisuka/tdf2015.pdf
origin (404) http://gpgpu.org/forums/viewtopic.php?t=2591&sid=17051481b9f78fb49fba5b98a5e0f1f3
*/
#ifdef GL_ES
precision mediump float;
#endif
@Pentan
Pentan / nakawari.py
Last active August 29, 2015 14:01
Strange shapekey utility W.I.P.
bl_info = {
"name": "Nakawari Shapekey Utilities",
"author": "Pentan",
"version": (0, 1),
"blender": (2, 70, 0),
"location": "Object > Nakawari",
"description": "This addon makes Nakawari shapekeys for 2D hand drawn like motions.",
"warning": "experimental",
"wiki_url": "",
"category": "Animation"}
@Pentan
Pentan / keyconf_html.py
Last active November 24, 2018 06:54
Dump Blender key config as HTML.
import bpy
from bpy_extras import keyconfig_utils
import sys
# Dump Blender keyconfig as HTML.
# How to use
# 1. Open this file in Blender's Text Editor.
# 2. Do "Run Script".
# 3. New Text "keyconfigs.html" will be added.
# save it somewhere and open in web browser (recommends Safari, Chrome or Firefox).
@Pentan
Pentan / Armature2Mesh.py
Created August 24, 2012 20:29
Blender's script to create Envelope display type Armature like mesh.
import bpy
import math
import mathutils
from mathutils import Vector
from mathutils import Matrix
for selobj in bpy.context.selected_objects:
#print("{} is {}".format(selobj.name, selobj.type))
if selobj.type == 'ARMATURE':
arm = selobj.data
@Pentan
Pentan / ao_gcd.c
Created August 7, 2012 06:32
aobench (http://code.google.com/p/aobench/) with Grand Central Dispatch.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <Block.h>
#include <dispatch/dispatch.h>
//