代码拉取完成,页面将自动刷新
// tests/misc_uv_tests.js
import * as THREE from 'three';
const {
document,
window,
requestAnimationFrame,
cancelAnimationFrame,
Event,
core
} = THREE.DHTML;
import {
UVsDebug
} from 'three/examples/jsm/utils/UVsDebug.js';
Page({
data: {
tests: []
},
onUnload() {
// cancelAnimationFrame(requestId, this.canvas)
this.worker && this.worker.terminate()
if(this.canvas) this.canvas = null
},
webgl_touch(e) {
const web_e = (window.platform=="devtools"?Event:Event0).fix(e)
//window.dispatchEvent(web_e)
//document.dispatchEvent(web_e)
this.canvas.dispatchEvent(web_e)
},
onLoad() {
// const canvas3d = this.canvas = document.createElementAsync("canvas", "webgl")
var that = this
function test(name, geometry) {
/* const d = document.createElement( 'div' );
d.innerHTML = '<h3>' + name + '</h3>';
d.appendChild( UVsDebug( geometry ) );
document.body.appendChild( d );
*/
var canvas = UVsDebug(geometry)
const result = canvas.mini_element.toDataURL()
const key = `tests[${that.data.tests.length}]`
const data = {}
data[key] = {
name,
result
}
that.setData(data)
}
const points = [];
for (let i = 0; i < 10; i++) {
points.push(new THREE.Vector2(Math.sin(i * 0.2) * 15 + 50, (i - 5) * 2));
}
//
test('new THREE.PlaneGeometry( 100, 100, 4, 4 )', new THREE.PlaneGeometry(100, 100, 4, 4));
test('new THREE.SphereGeometry( 75, 12, 6 )', new THREE.SphereGeometry(75, 12, 6));
test('new THREE.IcosahedronGeometry( 30, 1 )', new THREE.IcosahedronGeometry(30, 1));
test('new THREE.OctahedronGeometry( 30, 2 )', new THREE.OctahedronGeometry(30, 2));
test('new THREE.CylinderGeometry( 25, 75, 100, 10, 5 )', new THREE.CylinderGeometry(25, 75, 100, 10, 5));
test('new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 )', new THREE.BoxGeometry(100, 100, 100, 4, 4, 4));
test('new THREE.LatheGeometry( points, 8 )', new THREE.LatheGeometry(points, 8));
test('new THREE.TorusGeometry( 50, 20, 8, 8 )', new THREE.TorusGeometry(50, 20, 8, 8));
test('new THREE.TorusKnotGeometry( 50, 10, 12, 6 )', new THREE.TorusKnotGeometry(50, 10, 12, 6));
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。