Skip to content

Instantly share code, notes, and snippets.

View jameskane05's full-sized avatar

James Kane jameskane05

View GitHub Profile
import React, { useMemo, useRef } from 'react';
import { extend, useFrame } from '@react-three/fiber';
import * as THREE from 'three';
import { shaderMaterial } from '@react-three/drei';
const vertexShader = `
#define PI 3.1415926535897932384626433832795
uniform float uTime;
uniform float uBigWavesElevation;
update() {
let transientPointerFoundThisFrame = false;
for (let input of this.engine.xr.session.inputSources) {
if (input.targetRayMode !== 'transient-pointer') continue;
// If we made it this far, we're dealing w/ a transient-pointer
transientPointerFoundThisFrame = true;
// Get the pose from the session from using the targetRaySpace and the currentRefSpace
@jameskane05
jameskane05 / gltf-model-plus.js
Last active August 25, 2020 01:02
Cubemap attempt within gltf-model-plus.js
import nextTick from "../utils/next-tick";
import { mapMaterials, convertStandardMaterial } from "../utils/material-utils";
import SketchfabZipWorker from "../workers/sketchfab-zip.worker.js";
import { getCustomGLTFParserURLResolver } from "../utils/media-url-utils";
import { promisifyWorker } from "../utils/promisify-worker.js";
import { MeshBVH, acceleratedRaycast } from "three-mesh-bvh";
import { disposeNode, cloneObject3D } from "../utils/three-utils";
import HubsTextureLoader from "../loaders/HubsTextureLoader";
import HubsBasisTextureLoader from "../loaders/HubsBasisTextureLoader";
import { createDefaultEnvironmentMap } from "./environment-map";