A utility for loading texture in ThreeJS. Will upload to GPU as soon as the texture is loaded, ensuring that it won't cause jank later in your application.
Example:
const loadTexture = require('./loadTexture');
// Returns a THREE.Texture object
var ffmpeg = require('ffmpeg.js/ffmpeg-mp4.js') | |
document.querySelector('button').addEventListener('click', (evt) => { | |
document.querySelector('[camera]').setAttribute('animation', { | |
property: 'rotation', | |
to: '0 360 0', | |
dur: 10000, | |
easing: 'linear' | |
}) |
// This requires the WIP branch at https://github.com/vuejs/vue-loader/tree/next | |
const path = require('path') | |
const { VueLoaderPlugin } = require('vue-loader') | |
module.exports = { | |
mode: 'development', | |
entry: path.resolve(__dirname, './main.js'), | |
output: { | |
path: path.resolve(__dirname, 'dist') |
// https://discourse.threejs.org/t/functions-to-calculate-the-visible-width-height-at-a-given-z-depth-from-a-perspective-camera/269 | |
function visibleHeightAtDepth(depth, camera) { | |
// compensate for cameras not positioned at z=0 | |
const cameraOffset = camera.position.z; | |
if ( depth < cameraOffset ) depth -= cameraOffset; | |
else depth += cameraOffset; | |
// vertical fov in radians | |
const vFOV = camera.fov * Math.PI / 180; | |
// Math.abs to ensure the result is always positive |
// Here is a simple class that contains loading methods. | |
// Nothing fancy, but the idea is simply to return a Promise | |
import { loadImg } from './load'; | |
class Sprite { | |
/* | |
@Example | |
import Sprite from './Sprite'; |
import redis | |
import cv2 | |
import numpy as np | |
import time | |
import io | |
from PIL import Image | |
r = redis.StrictRedis.from_url('redis://:[email protected]:6379/1') | |
img_path ="image" |
<html> | |
<head> | |
<body onload="onLoad()"> | |
<div id="container"> | |
<div id="show-background">Show background as magenta<input id="show-background-toggle" type="checkbox" checked></div> | |
<canvas id="canvas" width=640px height=480px></canvas> | |
</div> | |
</body> | |
</head> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"> </script> |
// Adapted from @delucis | |
// https://github.com/delucis/pellicola/blob/735bd7487bdc597ac7272e4ddce9473c15f68d09/lib/frame-maker.js#L99-L134 | |
const canvasSketch = require('canvas-sketch'); | |
const settings = { | |
dimensions: [ 512, 512 ], | |
duration: 3, | |
animate: true, | |
fps: 24 |
# Note: You really should not use this. | |
# You can easily convert your app | |
# to use Quart by using async+await | |
# and then use loop.create_task(bot.start(...)) | |
# before using app.run. | |
from threading import Thread | |
from flask import Flask | |
from functools import partial | |
from discord.ext import commands |
// Created by @kunofellasleep on 2019/05/20. | |
//Modules | |
const Diagnostics = require('Diagnostics'); | |
const Materials = require('Materials'); | |
const Textures = require('Textures'); | |
const CameraInfo = require('CameraInfo'); | |
const Shaders = require('Shaders'); | |
const R = require('Reactive'); |