Skip to content

Instantly share code, notes, and snippets.

View sknightq's full-sized avatar

Sknight Qian sknightq

View GitHub Profile
@sknightq
sknightq / mapbox-3d.tsx
Last active February 24, 2023 09:46 — forked from danvk/sprite-custom-layer.tsx
Mapbox custom layer which renders multiple models in a THREE.js scene
import * as THREE from 'three'
import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
import { setPosition } from '@/components/Mapbox/utils'
import MapboxGL, { LngLatLike, MercatorCoordinate } from 'mapbox-gl'
import { LayerConfig, ModelTransform } from './types'
import { FeatureCollection } from 'geojson'
import { Object3D } from 'three'
function transform(layerConfig: LayerConfig, modelConfig: { position: LngLatLike; altitude: number }, center: mapboxgl.MercatorCoordinate): THREE.Matrix4 {
const { modelScale, modelRotate } = layerConfig
@sknightq
sknightq / cloudSettings
Last active March 29, 2019 07:19
public vscode settings
{"lastUpload":"2019-03-20T11:14:19.906Z","extensionVersion":"v3.2.7"}