Skip to content

Instantly share code, notes, and snippets.

View yoavlt's full-sized avatar

Takuma Yoshida yoavlt

View GitHub Profile
define ['app/component/world'], (World) ->
class MainWindow
constructor: ->
@world = new World()
@renderer = new THREE.WebGLRenderer()
@renderer.setSize(window.innerWidth, window.innerHeight)
document.body.appendChild(@renderer.domElement)
update: ->
define ['app/component/ground'], (Ground) ->
class World
constructor: ->
@scene = new Physijs.Scene()
@scene.setGravity(new THREE.Vector3(0, -30, 0))
@init_camera()
@init_light()
ground = new Ground(new THREE.Vector3(100, 1, 100))
define ->
class Ground
constructor: (shape) ->
geometry = new THREE.CubeGeometry(shape.x, shape.y, shape.z)
material = Physijs.createMaterial(
new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture('images/rocks.jpg') }),
8, # high friction
4 # low restitution
)
material.map.wrapS = material.map.wrapT = THREE.RepeatWrapping
// 衝突検出方法の選択(デフォルトを選択)
btDefaultCollisionConfiguration *config = new btSoftBodyRigidBodyCollisionConfiguration();
btCollisionDispatcher *dispatcher = new btCollisionDispatcher(config);
// ブロードフェーズ法の設定(Dynamic AABB tree method)
btDbvtBroadphase *broadphase = new btDbvtBroadphase();
// 拘束(剛体間リンク)のソルバ設定
btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver();
@yoavlt
yoavlt / mf
Created July 3, 2013 05:10
Makefile-template
CC=clang
LDFLAGS=-lstdc++
LIBDIR=
INCDIR=
CFLAGS=-Wall -g -O3 -std=c++11
TARGETS=
SRCS=
OBJS=$(SRCS:.cpp=.o)
all: $(TARGETS) $(OBJS)
package main
import (
"fmt"
)
func _genP(slice []bool, i, n int, ch chan []bool) {
if n == i {
ch <- slice
return
import curses
import subprocess
class Window(object):
def __init__(self, x = None, y = None, width = None, height = None):
self._x = x
self._y = y
self._width = width
self._height = height
#ifndef _HMM_HPP_
#define _HMM_HPP_
#include <vector>
#include <string>
#include <list>
#include <utility>
#include <map>
template<typename T>
#!/bin/sh
exec scala "$0" "$@"
!#
println((args(0).toInt to args(1).toInt).par.map(_ + 1).reduceLeft(_ + _))
@yoavlt
yoavlt / file0.txt
Last active August 29, 2015 14:26
ネストしたデータ構造を操作するput_inとupdate_inが便利 ref: http://qiita.com/yoavlt/items/b973210605d6f771b9d1
iex> foo = %{person: %{name: "foo", age: 21}, place: "Shibuya"}
iex> put_in(foo.person.age, 30)
%{person: %{age: 30, name: "foo"}, place: "Shibuya"}
iex> foo
%{person: %{age: 21, name: "foo"}, place: "Shibuya"}