• three.js生成网络地面


               
            //初始化配置three
            var scene ,camera,renderer scene = new THREE.Scene(); var ambient = new THREE.AmbientLight(0xffffff); scene.add(ambient); var width = res.windowWidth; // 窗口宽度 var height = res.windowHeight; // 高度 var k = width / height; // 窗口宽高比 var s = 20000; // 三维场景显示范围控制系数,系数越大,显示的范围越大 // 创建相机对象(正射投影) camera = new THREE.PerspectiveCamera(-90, k, 1, s); // camera.position.set(0, 2000, 0); // 设置相机位置 renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(width, height); // 设置渲染区域尺寸 renderer.setClearColor(0xffffff, 1); // 设置背景颜色 const element = document.getElementById('three') element.appendChild(renderer.domElement);

    生成网格

            for (var i=0;i<=30;i++){
                    let padding = 100
                    var material = new THREE.LineBasicMaterial({
                        color: 0x000000,
                        opacity:i % 3 === 0 ? 0.6 : 0.2,
                        transparent: true
                    });
                    
                    let rowGeometry = new THREE.Geometry();
                    
                    const lineLong = padding*30;
                    rowGeometry.vertices.push(
                        new THREE.Vector3( padding*i ,lineLong  , 0 ),
                        new THREE.Vector3( padding * i,0, 0 )
                
                    );
                    let colGeometry = new THREE.Geometry();
                    
                    colGeometry.vertices.push(
                        new THREE.Vector3( lineLong, padding*i , 0 ),
                        new THREE.Vector3( 0,  padding*i , 0 )
                       
                    );
                    let rowLine = new THREE.Line( rowGeometry, material );
                    let colLine = new THREE.Line( colGeometry, material );
     
                    scene.add( rowLine);
                    scene.add( colLine);
                }
  • 相关阅读:
    UI Automation
    TextBlock can't be find in DataTemplate when use Coded UI Test
    windows Phone本地化
    需要反射时使用dynamic
    npm发包流程
    mockjs介绍
    oracle job不自动执行,手动可以执行
    第一章 线性结构顺序存储结构
    Java连接MySQL数据库
    阿里云服务器部署Java开发环境JDK和mysql
  • 原文地址:https://www.cnblogs.com/huzhuhua/p/15620227.html
Copyright © 2020-2023  润新知