Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d8c9d466
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d8c9d466
编写于
10月 31, 2020
作者:
M
Mr.doob
提交者:
GitHub
10月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20593 from Mugen87/dev3
LineMaterial: Add dash offset.
上级
cf0b35d6
e2c5134b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
2 deletion
+46
-2
examples/js/lines/LineMaterial.js
examples/js/lines/LineMaterial.js
+22
-1
examples/jsm/lines/LineMaterial.d.ts
examples/jsm/lines/LineMaterial.d.ts
+2
-0
examples/jsm/lines/LineMaterial.js
examples/jsm/lines/LineMaterial.js
+22
-1
未找到文件。
examples/js/lines/LineMaterial.js
浏览文件 @
d8c9d466
...
...
@@ -5,6 +5,7 @@
* dashed: <boolean>,
* dashScale: <float>,
* dashSize: <float>,
* dashOffset: <float>,
* gapSize: <float>,
* resolution: <Vector2>, // to be set by renderer
* }
...
...
@@ -16,6 +17,7 @@ THREE.UniformsLib.line = {
resolution
:
{
value
:
new
THREE
.
Vector2
(
1
,
1
)
},
dashScale
:
{
value
:
1
},
dashSize
:
{
value
:
1
},
dashOffset
:
{
value
:
0
},
gapSize
:
{
value
:
1
},
// todo FIX - maybe change to totalSize
opacity
:
{
value
:
1
}
...
...
@@ -184,6 +186,7 @@ THREE.ShaderLib[ 'line' ] = {
#ifdef USE_DASH
uniform float dashSize;
uniform float dashOffset;
uniform float gapSize;
#endif
...
...
@@ -206,7 +209,7 @@ THREE.ShaderLib[ 'line' ] = {
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
if ( mod( vLineDistance
+ dashOffset
, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
#endif
...
...
@@ -327,6 +330,24 @@ THREE.LineMaterial = function ( parameters ) {
},
dashOffset
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
uniforms
.
dashOffset
.
value
;
},
set
:
function
(
value
)
{
this
.
uniforms
.
dashOffset
.
value
=
value
;
}
},
gapSize
:
{
enumerable
:
true
,
...
...
examples/jsm/lines/LineMaterial.d.ts
浏览文件 @
d8c9d466
...
...
@@ -10,6 +10,7 @@ export interface LineMaterialParameters extends MaterialParameters {
dashed
?:
boolean
;
dashScale
?:
number
;
dashSize
?:
number
;
dashOffset
?:
number
;
gapSize
?:
number
;
linewidth
?:
number
;
resolution
?:
Vector2
;
...
...
@@ -22,6 +23,7 @@ export class LineMaterial extends ShaderMaterial {
dashed
:
boolean
;
dashScale
:
number
;
dashSize
:
number
;
dashOffset
:
number
;
gapSize
:
number
;
opacity
:
number
;
readonly
isLineMaterial
:
true
;
...
...
examples/jsm/lines/LineMaterial.js
浏览文件 @
d8c9d466
...
...
@@ -13,6 +13,7 @@ import {
* dashed: <boolean>,
* dashScale: <float>,
* dashSize: <float>,
* dashOffset: <float>,
* gapSize: <float>,
* resolution: <Vector2>, // to be set by renderer
* }
...
...
@@ -24,6 +25,7 @@ UniformsLib.line = {
resolution
:
{
value
:
new
Vector2
(
1
,
1
)
},
dashScale
:
{
value
:
1
},
dashSize
:
{
value
:
1
},
dashOffset
:
{
value
:
0
},
gapSize
:
{
value
:
1
},
// todo FIX - maybe change to totalSize
opacity
:
{
value
:
1
}
...
...
@@ -192,6 +194,7 @@ ShaderLib[ 'line' ] = {
#ifdef USE_DASH
uniform float dashSize;
uniform float dashOffset;
uniform float gapSize;
#endif
...
...
@@ -214,7 +217,7 @@ ShaderLib[ 'line' ] = {
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
if ( mod( vLineDistance
+ dashOffset
, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
#endif
...
...
@@ -335,6 +338,24 @@ var LineMaterial = function ( parameters ) {
},
dashOffset
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
uniforms
.
dashOffset
.
value
;
},
set
:
function
(
value
)
{
this
.
uniforms
.
dashOffset
.
value
=
value
;
}
},
gapSize
:
{
enumerable
:
true
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录