Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
9410acc9
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
9410acc9
编写于
1月 16, 2014
作者:
C
Christopher Probst
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#4289 Move isPowerOfTwo to THREE.Math and update all references
上级
bf3a221f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
11 addition
and
27 deletion
+11
-27
examples/js/Mirror.js
examples/js/Mirror.js
+1
-5
examples/js/WaterShader.js
examples/js/WaterShader.js
+1
-4
examples/js/loaders/MTLLoader.js
examples/js/loaders/MTLLoader.js
+1
-7
src/math/Math.js
src/math/Math.js
+5
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+3
-10
未找到文件。
examples/js/Mirror.js
浏览文件 @
9410acc9
...
...
@@ -57,10 +57,6 @@ THREE.Mirror = function ( renderer, camera, options ) {
this
.
name
=
'
mirror_
'
+
this
.
id
;
function
isPowerOfTwo
(
value
)
{
return
(
value
&
(
value
-
1
)
)
===
0
;
};
options
=
options
||
{};
this
.
matrixNeedsUpdate
=
true
;
...
...
@@ -133,7 +129,7 @@ THREE.Mirror = function ( renderer, camera, options ) {
this
.
material
.
uniforms
.
mirrorColor
.
value
=
mirrorColor
;
this
.
material
.
uniforms
.
textureMatrix
.
value
=
this
.
textureMatrix
;
if
(
!
isPowerOfTwo
(
width
)
||
!
isPowerOfTwo
(
height
)
)
{
if
(
!
THREE
.
Math
.
isPowerOfTwo
(
width
)
||
!
THREE
.
Math
.
isPowerOfTwo
(
height
)
)
{
this
.
texture
.
generateMipmaps
=
false
;
this
.
tempTexture
.
generateMipmaps
=
false
;
...
...
examples/js/WaterShader.js
浏览文件 @
9410acc9
...
...
@@ -107,9 +107,6 @@ THREE.Water = function ( renderer, camera, scene, options ) {
THREE
.
Object3D
.
call
(
this
);
this
.
name
=
'
water_
'
+
this
.
id
;
function
isPowerOfTwo
(
value
)
{
return
(
value
&
(
value
-
1
)
)
===
0
;
};
function
optionalParameter
(
value
,
defaultValue
)
{
return
value
!==
undefined
?
value
:
defaultValue
;
};
...
...
@@ -177,7 +174,7 @@ THREE.Water = function ( renderer, camera, scene, options ) {
this
.
material
.
uniforms
.
eye
.
value
=
this
.
eye
;
if
(
!
isPowerOfTwo
(
width
)
||
!
isPowerOfTwo
(
height
)
)
if
(
!
THREE
.
Math
.
isPowerOfTwo
(
width
)
||
!
THREE
.
Math
.
isPowerOfTwo
(
height
)
)
{
this
.
texture
.
generateMipmaps
=
false
;
this
.
tempTexture
.
generateMipmaps
=
false
;
...
...
examples/js/loaders/MTLLoader.js
浏览文件 @
9410acc9
...
...
@@ -395,7 +395,7 @@ THREE.MTLLoader.MaterialCreator.prototype = {
THREE
.
MTLLoader
.
ensurePowerOfTwo_
=
function
(
image
)
{
if
(
!
THREE
.
M
TLLoader
.
isPowerOfTwo_
(
image
.
width
)
||
!
THREE
.
MTLLoader
.
isPowerOfTwo_
(
image
.
height
)
)
{
if
(
!
THREE
.
M
ath
.
isPowerOfTwo_
(
image
.
width
)
||
!
THREE
.
Math
.
isPowerOfTwo_
(
image
.
height
)
)
{
var
canvas
=
document
.
createElement
(
"
canvas
"
);
canvas
.
width
=
THREE
.
MTLLoader
.
nextHighestPowerOfTwo_
(
image
.
width
);
...
...
@@ -411,12 +411,6 @@ THREE.MTLLoader.ensurePowerOfTwo_ = function ( image ) {
};
THREE
.
MTLLoader
.
isPowerOfTwo_
=
function
(
x
)
{
return
(
x
&
(
x
-
1
)
)
===
0
;
};
THREE
.
MTLLoader
.
nextHighestPowerOfTwo_
=
function
(
x
)
{
--
x
;
...
...
src/math/Math.js
浏览文件 @
9410acc9
...
...
@@ -152,6 +152,10 @@ THREE.Math = {
};
}()
}(),
isPowerOfTwo
:
function
(
value
)
{
return
(
value
&
(
value
-
1
)
)
===
0
&&
value
!==
0
;
}
};
src/renderers/WebGLRenderer.js
浏览文件 @
9410acc9
...
...
@@ -5822,13 +5822,6 @@ THREE.WebGLRenderer = function ( parameters ) {
// Textures
function
isPowerOfTwo
(
value
)
{
return
(
value
&
(
value
-
1
)
)
===
0
;
};
function
setTextureParameters
(
textureType
,
texture
,
isImagePowerOfTwo
)
{
if
(
isImagePowerOfTwo
)
{
...
...
@@ -5886,7 +5879,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl
.
pixelStorei
(
_gl
.
UNPACK_ALIGNMENT
,
texture
.
unpackAlignment
);
var
image
=
texture
.
image
,
isImagePowerOfTwo
=
isPowerOfTwo
(
image
.
width
)
&&
isPowerOfTwo
(
image
.
height
),
isImagePowerOfTwo
=
THREE
.
Math
.
isPowerOfTwo
(
image
.
width
)
&&
THREE
.
Math
.
isPowerOfTwo
(
image
.
height
),
glFormat
=
paramThreeToGL
(
texture
.
format
),
glType
=
paramThreeToGL
(
texture
.
type
);
...
...
@@ -6036,7 +6029,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var
image
=
cubeImage
[
0
],
isImagePowerOfTwo
=
isPowerOfTwo
(
image
.
width
)
&&
isPowerOfTwo
(
image
.
height
),
isImagePowerOfTwo
=
THREE
.
Math
.
isPowerOfTwo
(
image
.
width
)
&&
THREE
.
Math
.
isPowerOfTwo
(
image
.
height
),
glFormat
=
paramThreeToGL
(
texture
.
format
),
glType
=
paramThreeToGL
(
texture
.
type
);
...
...
@@ -6149,7 +6142,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// Setup texture, create render and frame buffers
var
isTargetPowerOfTwo
=
isPowerOfTwo
(
renderTarget
.
width
)
&&
isPowerOfTwo
(
renderTarget
.
height
),
var
isTargetPowerOfTwo
=
THREE
.
Math
.
isPowerOfTwo
(
renderTarget
.
width
)
&&
THREE
.
Math
.
isPowerOfTwo
(
renderTarget
.
height
),
glFormat
=
paramThreeToGL
(
renderTarget
.
format
),
glType
=
paramThreeToGL
(
renderTarget
.
type
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录