three实现三维网格山峰效果代码

代码语言:html

所属分类:三维

代码描述:three实现三维网格山峰效果代码

代码标签: three 三维 网格 山峰

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">

<style>
    body{
  overflow: hidden;
  margin: 0;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.139.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.143.js"></script>
<!-- partial -->
  <script type="module" >


let scene = new THREE.Scene();
let camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 1000);
camera.position.set(0, 10, 10).setLength(30);
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 THREE.OrbitControls(camera, renderer.domElement);

let grid = new THREE.GridHelper(45, 5, "yellow", "yellow");
grid.position.y = 0.5;
scene.add(grid);


let g = new THREE.PlaneGeometry(45, 45, 100, 100);
g.rotateX(-Math.PI * 0.5);
let m = new THREE.MeshBasicMaterial({.........完整代码请登录后点击上方下载按钮下载查看

网友评论0