This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicTextureCache { | |
constructor() { | |
this.textures = {}; | |
} | |
loadTextures(url, columns, rows) { | |
if (!this.textures.hasOwnProperty(url)) { | |
this.textures[url] = new Promise((resolve, reject) => { let image = new Image(); | |
let textures = []; | |
image.src = url; | |
image.onload = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WL.registerComponent('gun', {}, { | |
start: function () { | |
this.input = this.object.getComponent('input'); | |
this.initialized = false; | |
WL.onXRSessionStart.push((session) => { | |
if (this.initialized) return; | |
session.addEventListener('select', (e) => { | |
if(!this.active) return; | |
if (e.inputSource.handedness === this.input.handedness) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>From KenShape To WebXR</title> | |
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> | |
</head> | |
<body> | |
<a-scene> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"component-parameter-enum": { | |
"body": "${1:name}: {type: WL.Type.Enum, values: ['A','B'], default: 'A'}$0", | |
"description": "adds a component parameter of type enum", | |
"scope": "javascript", | |
"prefix": "wl:param:enum" | |
}, | |
"component-parameter-float": { | |
"body": "${1:name}: {type: WL.Type.Float, default: ${2:1.0}}$0", | |
"description": "adds a component parameter of type float", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform float speed; | |
uniform float stepsize; | |
// Default settings in OBS | |
// speed: 4.0 | |
// stepsize: 2.0 | |
float rand(float co){ | |
return frac(sin(dot(float2(co,co) ,float2(12.9898,78.233))) * 43758.5453); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from 'three'; | |
import { VRButton } from 'three/examples/jsm/webxr/VRButton' | |
var scene = new THREE.Scene(); | |
var camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 10 ); | |
camera.position.set( 0, 1.6, 0 ); | |
var renderer = new THREE.WebGLRenderer(); | |
renderer.xr.enabled = true; | |
renderer.outputEncoding = THREE.sRGBEncoding; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates a prefab at the given path. | |
// If a prefab already exists it asks if you want to replace it | |
using UnityEngine; | |
using UnityEditor; | |
public class CreateNewPrefab : EditorWindow | |
{ | |
[MenuItem("Prefab/Create New Prefab")] | |
static void CreatePrefab() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Babylon Mesh Component Template */ | |
module PROJECT { | |
export class Shoot extends BABYLON.MeshComponent { | |
distance: number; | |
public constructor(owner: BABYLON.AbstractMesh, scene: BABYLON.Scene, tick: boolean = true, propertyBag: any = {}) { | |
super(owner, scene, tick, propertyBag); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div // weight of 1 | |
#post span // weight of 100 + 1 = 101 | |
<div id="post"><span style="color: #ff0000">Post Text</span></div> // weight of 1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform float speed; | |
uniform float amount; | |
uniform float noiseLevel; | |
float rand(float co){ | |
return frac(sin(dot(float2(co,co) ,float2(12.9898,78.233))) * 43758.5453); | |
} | |
float4 mainImage(VertData v_in) : TARGET | |
{ |
NewerOlder