Skip to content

Instantly share code, notes, and snippets.

Avatar

kev zettler kevzettler

View GitHub Profile
@kevzettler
kevzettler / react-regl-interfaces.js
Created Sep 1, 2018
React-regl resource interfaces
View react-regl-interfaces.js
//The following examples demonstrate the current and potential interfaces for rendering a texture
//1 Current external resource initilization
// Needs a reference to the `regl` object to create `regl.texture`
// results in some weird handshake where `Regl` component needs to initialize and pass `regl` object around
class ThreeDThing extends React.Component{
constructor(){
super(props)
this.state.reglRef = null
}
@kevzettler
kevzettler / replace_img_src_with_imports.js
Last active Mar 25, 2018
How to convert html image src into webpack modules. Script to extract html img src attributes and convert to ES6 imports
View replace_img_src_with_imports.js
const fs = require('fs')
const path = require('path');
let replacingFilePath = process.argv[2];
if(!replacingFilePath){
throw "invalid file path to replace"
}
let relativeImageDirPath = path.relative(path.dirname(replacingFilePath), `${__dirname}/../src/images`);
@kevzettler
kevzettler / index.js
Last active Dec 19, 2017
requirebin sketch
View index.js
const regl = require('regl')()
const mat4 = require('gl-matrix').mat4
const vec3 = require('gl-matrix').vec3;
const quat = require('gl-matrix').quat;
const makePrimitiveQuad = require('primitive-quad');
var canvas = document.createElement("canvas");
var textCtx = canvas.getContext("2d");
const playerNameCanvas = makeTextCanvas('player name', 200, 50);
@kevzettler
kevzettler / child-CharacterView.js
Created Oct 20, 2017
maptDispatchToProps parent child
View child-CharacterView.js
import React, { Component } from 'react'
import PropTypes from 'prop-types';
import { connect } from 'react-redux'
import { fetchAssetBinary } from '../../assets/actions.js';
import { sceneTick } from '../../scene/actions';
import reglInit from 'regl';
import { mat4 } from 'gl-matrix';
import { selectPlayerAnim, selectItemAssetNames, memoMissingAssets } from '../../scene/selectors.js';
View ik2fk.sh
Kevs-MacBook-Pro:qubicle kev$ blender ./add-idle-anim-MERGED.blend --python `ik2fk`
Read new prefs: /Users/kev/Library/Application Support/Blender/2.78/config/userpref.blend
found bundled python: /Applications/Blender.app/Contents/MacOS/../Resources/2.78/python
HELLO KEV
read blend: /Users/kev/code/robotbones/assets/models/mechsniper/blender/qubicle/./add-idle-anim-MERGED.blend
WARNING! More UV layers than 8 allowed, 1 last ones won't be available for render, shaders, etc.
WARNING! More UV layers than 8 allowed, 1 last ones won't be available for render, shaders, etc.
reloading addon: convert-ik-to-fk 1498342349.0 1506111905.0 /Users/kev/Library/Application Support/Blender/2.78/scripts/addons/convert-ik-to-fk.py
Modules Installed from '/Users/kev/.nvm/versions/node/v7.9.0/lib/node_modules/blender-iks-to-fks/convert-ik-to-fk.py' into '/Users/kev/Library/Application Support/Blender/2.78/scripts/addons' ()
Info: Modules Installed from '/Users/kev/.nvm/versions/node/v7.9.0/lib/node_modules/blender-iks-to-fks/conv
@kevzettler
kevzettler / index.js
Created Sep 22, 2017
requirebin sketch
View index.js
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const uiRoot = document.createElement('div');
uiRoot.id = 'ui-root';
document.body.appendChild(uiRoot);
const Loop = require('fixed-game-loop');
View assetAction.js
import {
REQUEST_ASSET_BINARY,
RECEIVE_ASSET_BINARY
} from './constants';
export const requestAssetBinary = (path) => ({
type: REQUEST_ASSET_BINARY,
path
});
View gist:cf6db218853df665900e1e8c5f77b35d
const traffic_light = [<
off -> red => green => yellow => red;
[red yellow green] ~> off;
>];
View gist:fa83e4cc039e0f570db964c524b6959e
const traffic_light = [<
off -> red => green => yellow => red;
[red yellow green] ~> off;
>];
View gist:fca1a6a6d911eaf87bf9a6a4f1b8cfa4
const traffic_light = [<
off -> red => green => yellow => red;
[red yellow green] ~> off;
>];
You can’t perform that action at this time.