关键代码
var texture= THREE.ImageUtils.loadTexture("000874.png", null, function(t) {
});
obj.children[0].material= new THREE.MeshBasicMaterial({
map: texture,transparent: true,side:THREE.DoubleSide
})
obj.traverse(function(child)
{
if (child instanceof THREE.Mesh)
{
child.material.map = texture;
child.material.transparent = true;
child.material.alphaTest = 0.7;
child.material.depthWrite = true;
}
});
scene.add(obj);
obj.children[0].scale.set(8,8,8);
});
全部源码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>文物鉴赏</title>
<style>
*{
touch-action: none;
touch-action: pan-y;