Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
dd089570
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,体验更适合开发者的 AI 搜索 >>
提交
dd089570
编写于
5月 15, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added Texture.DEFAULT_IMAGE. Different solution for #4559.
上级
d1454b25
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
28 deletion
+31
-28
examples/js/loaders/ColladaLoader.js
examples/js/loaders/ColladaLoader.js
+1
-1
examples/js/loaders/MTLLoader.js
examples/js/loaders/MTLLoader.js
+1
-3
examples/js/loaders/SceneLoader.js
examples/js/loaders/SceneLoader.js
+1
-1
examples/webgl_animation_cloth.html
examples/webgl_animation_cloth.html
+3
-6
src/extras/ImageUtils.js
src/extras/ImageUtils.js
+4
-3
src/extras/renderers/plugins/SpritePlugin.js
src/extras/renderers/plugins/SpritePlugin.js
+1
-10
src/loaders/Loader.js
src/loaders/Loader.js
+1
-1
src/textures/Texture.js
src/textures/Texture.js
+19
-3
未找到文件。
examples/js/loaders/ColladaLoader.js
浏览文件 @
dd089570
...
...
@@ -3491,7 +3491,7 @@ THREE.ColladaLoader = function () {
}
else
{
texture
=
new
THREE
.
Texture
(
new
Image
()
);
texture
=
new
THREE
.
Texture
();
loader
=
new
THREE
.
ImageLoader
();
loader
.
load
(
url
,
function
(
image
)
{
...
...
examples/js/loaders/MTLLoader.js
浏览文件 @
dd089570
...
...
@@ -369,12 +369,10 @@ THREE.MTLLoader.MaterialCreator.prototype = {
if
(
loader
!==
null
)
{
texture
=
loader
.
load
(
url
,
onLoad
);
texture
.
mapping
=
mapping
;
}
else
{
texture
=
new
THREE
.
Texture
(
new
Image
()
);
texture
.
mapping
=
mapping
;
texture
=
new
THREE
.
Texture
();
loader
=
new
THREE
.
ImageLoader
();
loader
.
crossOrigin
=
this
.
crossOrigin
;
...
...
examples/js/loaders/SceneLoader.js
浏览文件 @
dd089570
...
...
@@ -983,7 +983,7 @@ THREE.SceneLoader.prototype = {
}
else
{
texture
=
new
THREE
.
Texture
(
new
Image
()
);
texture
=
new
THREE
.
Texture
();
loader
=
new
THREE
.
ImageLoader
();
loader
.
load
(
fullUrl
,
function
(
image
)
{
...
...
examples/webgl_animation_cloth.html
浏览文件 @
dd089570
...
...
@@ -231,15 +231,12 @@
// ground
var
initColor
=
new
THREE
.
Color
(
0x497f13
);
var
initTexture
=
THREE
.
ImageUtils
.
generateDataTexture
(
1
,
1
,
initColor
);
var
groundMaterial
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
,
specular
:
0x111111
,
map
:
initTexture
}
);
var
groundTexture
=
THREE
.
ImageUtils
.
loadTexture
(
"
textures/terrain/grasslight-big.jpg
"
,
undefined
,
function
()
{
groundMaterial
.
map
=
groundTexture
}
);
var
groundTexture
=
THREE
.
ImageUtils
.
loadTexture
(
"
textures/terrain/grasslight-big.jpg
"
);
groundTexture
.
wrapS
=
groundTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
groundTexture
.
repeat
.
set
(
25
,
25
);
groundTexture
.
anisotropy
=
16
;
var
groundMaterial
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
,
specular
:
0x111111
,
map
:
groundTexture
}
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
20000
,
20000
),
groundMaterial
);
mesh
.
position
.
y
=
-
250
;
...
...
src/extras/ImageUtils.js
浏览文件 @
dd089570
...
...
@@ -13,10 +13,12 @@ THREE.ImageUtils = {
var
loader
=
new
THREE
.
ImageLoader
();
loader
.
crossOrigin
=
this
.
crossOrigin
;
var
texture
=
new
THREE
.
Texture
(
undefined
,
mapping
);
var
texture
=
new
THREE
.
Texture
();
texture
.
mapping
=
mapping
;
var
image
=
loader
.
load
(
url
,
function
(
)
{
loader
.
load
(
url
,
function
(
image
)
{
texture
.
image
=
image
;
texture
.
needsUpdate
=
true
;
if
(
onLoad
)
onLoad
(
texture
);
...
...
@@ -27,7 +29,6 @@ THREE.ImageUtils = {
}
);
texture
.
image
=
image
;
texture
.
sourceFile
=
url
;
return
texture
;
...
...
src/extras/renderers/plugins/SpritePlugin.js
浏览文件 @
dd089570
...
...
@@ -66,16 +66,7 @@ THREE.SpritePlugin = function () {
alphaTest
:
_gl
.
getUniformLocation
(
program
,
'
alphaTest
'
)
};
var
canvas
=
document
.
createElement
(
'
canvas
'
);
canvas
.
width
=
8
;
canvas
.
height
=
8
;
var
context
=
canvas
.
getContext
(
'
2d
'
);
context
.
fillStyle
=
'
#ffffff
'
;
context
.
fillRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
_texture
=
new
THREE
.
Texture
(
canvas
);
_texture
.
needsUpdate
=
true
;
_texture
=
new
THREE
.
Texture
();
};
...
...
src/loaders/Loader.js
浏览文件 @
dd089570
...
...
@@ -126,7 +126,7 @@ THREE.Loader.prototype = {
}
else
{
texture
=
new
THREE
.
Texture
(
document
.
createElement
(
'
canvas
'
)
);
texture
=
new
THREE
.
Texture
();
loader
=
scope
.
imageLoader
;
loader
.
crossOrigin
=
scope
.
crossOrigin
;
...
...
src/textures/Texture.js
浏览文件 @
dd089570
...
...
@@ -11,10 +11,10 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, f
this
.
name
=
''
;
this
.
image
=
image
;
this
.
image
=
image
!==
undefined
?
image
:
THREE
.
Texture
.
DEFAULT_IMAGE
;
this
.
mipmaps
=
[];
this
.
mapping
=
mapping
!==
undefined
?
mapping
:
new
THREE
.
UVMapping
()
;
this
.
mapping
=
mapping
!==
undefined
?
mapping
:
THREE
.
Texture
.
DEFAULT_MAPPING
;
this
.
wrapS
=
wrapS
!==
undefined
?
wrapS
:
THREE
.
ClampToEdgeWrapping
;
this
.
wrapT
=
wrapT
!==
undefined
?
wrapT
:
THREE
.
ClampToEdgeWrapping
;
...
...
@@ -35,11 +35,27 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, f
this
.
flipY
=
true
;
this
.
unpackAlignment
=
4
;
// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
this
.
_needsUpdate
=
fals
e
;
this
.
_needsUpdate
=
tru
e
;
this
.
onUpdate
=
null
;
};
THREE
.
Texture
.
DEFAULT_IMAGE
=
(
function
()
{
var
canvas
=
document
.
createElement
(
'
canvas
'
);
canvas
.
width
=
8
;
canvas
.
height
=
8
;
var
context
=
canvas
.
getContext
(
'
2d
'
);
context
.
fillStyle
=
'
#ff0000
'
;
context
.
fillRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
return
canvas
;
}()
);
THREE
.
Texture
.
DEFAULT_MAPPING
=
new
THREE
.
UVMapping
();
THREE
.
Texture
.
prototype
=
{
constructor
:
THREE
.
Texture
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录