Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
bc5e51d4
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,发现更多精彩内容 >>
提交
bc5e51d4
编写于
8月 14, 2019
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/dev' into dev33
上级
e2538746
5d68fa63
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
9 deletion
+32
-9
docs/api/en/core/Raycaster.html
docs/api/en/core/Raycaster.html
+8
-0
examples/js/shaders/TranslucentShader.js
examples/js/shaders/TranslucentShader.js
+3
-2
examples/jsm/shaders/TranslucentShader.js
examples/jsm/shaders/TranslucentShader.js
+3
-2
src/core/Raycaster.d.ts
src/core/Raycaster.d.ts
+6
-0
src/core/Raycaster.js
src/core/Raycaster.js
+3
-2
src/objects/Sprite.js
src/objects/Sprite.js
+9
-3
未找到文件。
docs/api/en/core/Raycaster.html
浏览文件 @
bc5e51d4
...
...
@@ -103,6 +103,14 @@
This value shouldn't be negative and should be smaller than the far property.
</p>
<h3>
[property:Camera camera]
</h3>
<p>
The camera to use when raycasting against view-dependent objects such as billboarded objects like [page:Sprites]. This field
can be set manually or is set when calling "setFromCamera".
Defaults to null.
</p>
<h3>
[property:Object params]
</h3>
<p>
An object with the following properties:
...
...
examples/js/shaders/TranslucentShader.js
浏览文件 @
bc5e51d4
...
...
@@ -61,6 +61,7 @@ THREE.TranslucentShader = {
].
join
(
"
\n
"
),
fragmentShader
:
[
"
#define USE_UV
"
,
"
#define USE_MAP
"
,
"
#define PHONG
"
,
"
#define TRANSLUCENT
"
,
...
...
@@ -137,7 +138,7 @@ THREE.TranslucentShader = {
"
RE_Direct( directLight, geometry, material, reflectedLight );
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
MAP
)
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
UV
)
"
,
"
RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);
"
,
"
#endif
"
,
"
}
"
,
...
...
@@ -159,7 +160,7 @@ THREE.TranslucentShader = {
"
RE_Direct( directLight, geometry, material, reflectedLight );
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
MAP
)
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
UV
)
"
,
"
RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);
"
,
"
#endif
"
,
"
}
"
,
...
...
examples/jsm/shaders/TranslucentShader.js
浏览文件 @
bc5e51d4
...
...
@@ -68,6 +68,7 @@ var TranslucentShader = {
].
join
(
"
\n
"
),
fragmentShader
:
[
"
#define USE_UV
"
,
"
#define USE_MAP
"
,
"
#define PHONG
"
,
"
#define TRANSLUCENT
"
,
...
...
@@ -144,7 +145,7 @@ var TranslucentShader = {
"
RE_Direct( directLight, geometry, material, reflectedLight );
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
MAP
)
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
UV
)
"
,
"
RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);
"
,
"
#endif
"
,
"
}
"
,
...
...
@@ -166,7 +167,7 @@ var TranslucentShader = {
"
RE_Direct( directLight, geometry, material, reflectedLight );
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
MAP
)
"
,
"
#if defined( TRANSLUCENT ) && defined( USE_
UV
)
"
,
"
RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);
"
,
"
#endif
"
,
"
}
"
,
...
...
src/core/Raycaster.d.ts
浏览文件 @
bc5e51d4
...
...
@@ -55,6 +55,12 @@ export class Raycaster {
*/
far
:
number
;
/**
* The camera to use when raycasting against view-dependent objects such as billboarded objects like Sprites. This field
* can be set manually or is set when calling "setFromCamera".
*/
camera
:
Camera
;
params
:
RaycasterParameters
;
/**
...
...
src/core/Raycaster.js
浏览文件 @
bc5e51d4
...
...
@@ -13,6 +13,7 @@ function Raycaster( origin, direction, near, far ) {
this
.
near
=
near
||
0
;
this
.
far
=
far
||
Infinity
;
this
.
camera
=
null
;
this
.
params
=
{
Mesh
:
{},
...
...
@@ -79,13 +80,13 @@ Object.assign( Raycaster.prototype, {
this
.
ray
.
origin
.
setFromMatrixPosition
(
camera
.
matrixWorld
);
this
.
ray
.
direction
.
set
(
coords
.
x
,
coords
.
y
,
0.5
).
unproject
(
camera
).
sub
(
this
.
ray
.
origin
).
normalize
();
this
.
_
camera
=
camera
;
this
.
camera
=
camera
;
}
else
if
(
(
camera
&&
camera
.
isOrthographicCamera
)
)
{
this
.
ray
.
origin
.
set
(
coords
.
x
,
coords
.
y
,
(
camera
.
near
+
camera
.
far
)
/
(
camera
.
near
-
camera
.
far
)
).
unproject
(
camera
);
// set origin in plane of camera
this
.
ray
.
direction
.
set
(
0
,
0
,
-
1
).
transformDirection
(
camera
.
matrixWorld
);
this
.
_
camera
=
camera
;
this
.
camera
=
camera
;
}
else
{
...
...
src/objects/Sprite.js
浏览文件 @
bc5e51d4
...
...
@@ -71,14 +71,20 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
raycast
:
function
(
raycaster
,
intersects
)
{
if
(
raycaster
.
camera
===
null
)
{
console
.
error
(
'
THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.
'
);
}
_worldScale
.
setFromMatrixScale
(
this
.
matrixWorld
);
_viewWorldMatrix
.
copy
(
raycaster
.
_
camera
.
matrixWorld
);
this
.
modelViewMatrix
.
multiplyMatrices
(
raycaster
.
_
camera
.
matrixWorldInverse
,
this
.
matrixWorld
);
_viewWorldMatrix
.
copy
(
raycaster
.
camera
.
matrixWorld
);
this
.
modelViewMatrix
.
multiplyMatrices
(
raycaster
.
camera
.
matrixWorldInverse
,
this
.
matrixWorld
);
_mvPosition
.
setFromMatrixPosition
(
this
.
modelViewMatrix
);
if
(
raycaster
.
_
camera
.
isPerspectiveCamera
&&
this
.
material
.
sizeAttenuation
===
false
)
{
if
(
raycaster
.
camera
.
isPerspectiveCamera
&&
this
.
material
.
sizeAttenuation
===
false
)
{
_worldScale
.
multiplyScalar
(
-
_mvPosition
.
z
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录