当前位置:网站首页>Three. JS development: drawing of thick lines
Three. JS development: drawing of thick lines
2022-06-29 20:17:00 【On Geographic Information Technology】
Three.js The development of , When drawing lines , Use THREE.Line perhaps THREE.LineSegments When drawing lines , It is found that setting the width of the line in the material does not work , In the Three.js Document discovery of , Above way , The corresponding is webgl in gl.LINE_STRIP perhaps gl.LINES, This is when some browsers render , It doesn't work , therefore ,Three.js Extended a method of drawing thick lines , The specific use method is as follows :
The relevant class libraries are placed in Three.js Bag example in , First quote the corresponding js file
<script src="three/examples/js/lines/LineSegments2.js"></script>
<script src="three/examples/js/lines/Line2.js"></script>
<script src="three/examples/js/lines/LineMaterial.js"></script>
<script src="three/examples/js/lines/LineSegmentsGeometry.js"></script>
<script src="three/examples/js/lines/LineGeometry.js"></script>
// Initializes the type of a line
let linegeometry = new THREE.LineGeometry();
linegeometry.setPositions(' Coordinate points of one-dimensional array type , Every time 3 In groups ');
// Initialize the material of the line
let matLine = new THREE.LineMaterial({
// Color width and other attribute settings , You can render lines through vertices , You can also set uniform colors
color: 0x0000ff,
linewidth: 2,
vertexColors: false
});
// The resolution of the material must be set , The line width not displayed is incorrect
matLine.resolution.set(window.innerWidth, window.innerHeight);
// Add a line object ,Line2 perhaps LineSegments2 Fine
//let buildoutline = new THREE.Line2(
let buildoutline = new THREE.LineSegments2(linegeometry,matLine);
// Scene add line
scene.add(buildoutline);
The effect is as follows :
Quotes :
https://github.com/mrdoob/three.js/blob/master/examples/webgl_lines_fat.html
https://threejs.org/docs/index.html?q=line#api/en/objects/Line

边栏推荐
- How to use filters in jfinal to monitor Druid for SQL execution?
- 剑指 Offer 59 - I. 滑动窗口的最大值
- 第二章(物理层)
- Community interview -- jumpserver open source fortress in the eyes of an it newcomer
- How to use filters in jfinal to monitor Druid for SQL execution?
- 4-1 port scanning technology
- Linux安装MySQL8
- [notes] take notes again -- learn by doing Verilog HDL – 008
- 偶然发现了另一种跨域方式,不知道有没有人这么玩过
- Understanding of software test logic coverage
猜你喜欢

Bigder:自动化测试工程师

ASP. Net core creates razor page and uploads multiple files (buffer mode) (Continued)

liunx指令

Comparable比较器写法&ClassCastExcption类转换异常

Flume configuration 2 - ganglia for monitoring

Detailed description of gaussdb (DWS) complex and diverse resource load management methods
![[compilation principle] type check](/img/fc/458871e2df4e0384f65e09faa909d7.png)
[compilation principle] type check

Flume配置1——基础案例

Linux安装MySQL8

Tiger painter mengxiangshun's digital collection is on sale in limited quantities and comes with Maotai in the year of the tiger
随机推荐
freemarker模板框架生成图片
Following the crowd hurts you
Etcd database source code analysis - put process of server
【编译原理】语义分析
Linux Installation mysql8
Linux安装MySQL5
A keepalived high availability accident made me learn it again!
What is a database? Database detailed notes! Take you into the database ~ you want to know everything here!
Koa 源码剖析
通过MeterSphere和DataEase实现项目Bug处理进展实时跟进
[buuctf.reverse] 142_ [SUCTF2019]babyunic
剑指 Offer 41. 数据流中的中位数
PHP implementation extracts non repeated integers (programming topics can be the fastest familiar functions)
【摸鱼神器】UI库秒变低代码工具——表单篇(一)设计
Software engineering - principles, methods and Applications
[USB flash disk test] in order to transfer the data at the bottom of the pressure box, I bought a 2T USB flash disk, and the test result is only 47g~
Spark存储体系底层架构剖析-Spark商业环境实战
How to solve the problem of insufficient memory space in Apple iPhone upgrade system?
PowerShell command outputs only a list of directories
[boutique] detailed explanation of Pinia