three实现逼真带纹理三维橘子效果代码

代码语言:html

所属分类:三维

代码描述:three实现逼真带纹理三维橘子效果代码

代码标签: three 逼真 纹理 三维 橘子

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  <script type="importmap">
  {
    "imports": {
      "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/158/three.module.js",
      "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/158/jsm/"
    }
  }
</script>
  
  
  
<style>
body{
  overflow: hidden;
  margin: 0;
}
</style>


  
</head>

<body>
  
  
      <script type="module">
import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { SimplexNoise } from "three/addons/math/SimplexNoise.js";
import { mergeVertices } from "three/addons/utils/BufferGeometryUtils.js";

console.clear();
//window.CP.PenTimer.MAX_TIME_IN_LOOP_WO_EXIT = 6000;

let simplex = new SimplexNoise();

let scene = new THREE.Scene();
scene.background = new THREE.Color(0x220000)
let camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 1000);
camera.position.set(0, 5, 3).setLength(10);
let renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setSize(innerWidth, innerHeight);
document.body.appendChild(renderer.domElement);

window.addEventListener("resize", (event) => {
  camera.aspect = innerWidth / innerHeight;
  camera.updateProjectionMatrix();
  renderer.setSize(innerWidth, innerHeight);
});

let controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;

// https://www.blockadelabs.com/
let texLoader = new THREE.TextureLoader();
texLoader.load(
  "//repo.bfw.wiki/bfwrepo/image/5ed629466cc42.png", envMap => {
    envMap.colorSpace = THR.........完整代码请登录后点击上方下载按钮下载查看

网友评论0