当前位置:网站首页>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

边栏推荐
- Zotero journal automatic matching update influence factor
- 剑指 Offer 66. 构建乘积数组
- 0/1 score planning topic
- There is no small green triangle on the method in idea
- Koa 源码剖析
- ASP.Net Core创建Razor页面上传多个文件(缓冲方式)(续)
- .NetCore统一认证授权学习——第一次授权(2)
- 软件工程—原理、方法与应用
- 苹果iPhone手机升级系统内存空间变小不够如何解决?
- Introduction to the latest version 24.1.0.360 update of CorelDRAW
猜你喜欢

Sentinel的快速入门,三分钟带你体验流量控制

Flume配置4——自定义Source+Sink

Win7 easy connect 提示:选路连接失败,可能当前连接网络异常,请稍后重试

How to set a pod to run on a specified node

苹果iPhone手机升级系统内存空间变小不够如何解决?

【编译原理】语义分析

Etcd database source code analysis - put process of server

Linux Installation mysql8

mapbox-gl开发教程(十二):加载面图层数据

18. `bs对象.节点名.next_sibling` previous_sibling 获取兄弟节点
随机推荐
Several policies of Shenzhen Futian District to support investment attraction in 2022
[notes] take notes again -- learn by doing Verilog HDL – 014
Sword finger offer 59 - ii Maximum value of the queue
Zotero期刊自動匹配更新影響因子
一次 Keepalived 高可用的事故,让我重学了一遍它!
Application of twelve factors (4)
Measures to support the development of advanced manufacturing industry in Futian District of Shenzhen in 2022
Flume configuration 2 - ganglia for monitoring
剑指 Offer 41. 数据流中的中位数
如何设置 Pod 到指定节点运行
Finally, Amazon~
Ovirt database modify delete node
There is no small green triangle on the method in idea
.NetCore统一认证授权学习——第一次授权(2)
Flume配置4——自定義Source+Sink
Software engineering - principles, methods and Applications
Win7 easy connect 提示:选路连接失败,可能当前连接网络异常,请稍后重试
偶然发现了另一种跨域方式,不知道有没有人这么玩过
并查集(Union-Find)
[compilation principle] semantic analysis