Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a32d47ed
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,发现更多精彩内容 >>
提交
a32d47ed
编写于
7月 10, 2018
作者:
D
Don McCurdy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fbx2three: Restore ImageUtils, move getDataURL method.
上级
5350a3cb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
87 addition
and
69 deletion
+87
-69
src/Three.Legacy.js
src/Three.Legacy.js
+23
-26
src/Three.js
src/Three.js
+1
-0
src/extras/ImageUtils.js
src/extras/ImageUtils.js
+59
-0
src/textures/Texture.js
src/textures/Texture.js
+3
-42
utils/converters/fbx2three.js
utils/converters/fbx2three.js
+1
-1
未找到文件。
src/Three.Legacy.js
浏览文件 @
a32d47ed
...
...
@@ -73,6 +73,7 @@ import { WebGLRenderer } from './renderers/WebGLRenderer.js';
import
{
WebGLRenderTarget
}
from
'
./renderers/WebGLRenderTarget.js
'
;
import
{
WebGLShadowMap
}
from
'
./renderers/webgl/WebGLShadowMap.js
'
;
import
{
WebVRManager
}
from
'
./renderers/webvr/WebVRManager.js
'
;
import
{
ImageUtils
}
from
'
./extras/ImageUtils.js
'
;
import
{
Shape
}
from
'
./extras/core/Shape.js
'
;
import
{
CubeCamera
}
from
'
./cameras/CubeCamera.js
'
;
...
...
@@ -1757,51 +1758,47 @@ export var GeometryUtils = {
};
export
var
ImageUtils
=
{
ImageUtils
.
crossOrigin
=
undefined
;
crossOrigin
:
undefined
,
ImageUtils
.
loadTexture
=
function
(
url
,
mapping
,
onLoad
,
onError
)
{
loadTexture
:
function
(
url
,
mapping
,
onLoad
,
onError
)
{
console
.
warn
(
'
THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.
'
);
console
.
warn
(
'
THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.
'
);
var
loader
=
new
TextureLoader
();
loader
.
setCrossOrigin
(
this
.
crossOrigin
);
var
loader
=
new
TextureLoader
();
loader
.
setCrossOrigin
(
this
.
crossOrigin
);
var
texture
=
loader
.
load
(
url
,
onLoad
,
undefined
,
onError
);
var
texture
=
loader
.
load
(
url
,
onLoad
,
undefined
,
onError
)
;
if
(
mapping
)
texture
.
mapping
=
mapping
;
if
(
mapping
)
texture
.
mapping
=
mapping
;
return
texture
;
return
texture
;
},
loadTextureCube
:
function
(
urls
,
mapping
,
onLoad
,
onError
)
{
};
console
.
warn
(
'
THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.
'
);
ImageUtils
.
loadTextureCube
=
function
(
urls
,
mapping
,
onLoad
,
onError
)
{
var
loader
=
new
CubeTextureLoader
();
loader
.
setCrossOrigin
(
this
.
crossOrigin
);
console
.
warn
(
'
THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.
'
);
var
texture
=
loader
.
load
(
urls
,
onLoad
,
undefined
,
onError
);
var
loader
=
new
CubeTextureLoader
();
loader
.
setCrossOrigin
(
this
.
crossOrigin
);
if
(
mapping
)
texture
.
mapping
=
mapping
;
var
texture
=
loader
.
load
(
urls
,
onLoad
,
undefined
,
onError
)
;
return
texture
;
if
(
mapping
)
texture
.
mapping
=
mapping
;
},
return
texture
;
loadCompressedTexture
:
function
()
{
};
console
.
error
(
'
THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.
'
);
ImageUtils
.
loadCompressedTexture
=
function
()
{
},
console
.
error
(
'
THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.
'
);
loadCompressedTextureCube
:
function
()
{
};
console
.
error
(
'
THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.
'
);
ImageUtils
.
loadCompressedTextureCube
=
function
()
{
}
console
.
error
(
'
THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.
'
);
};
...
...
src/Three.js
浏览文件 @
a32d47ed
...
...
@@ -145,6 +145,7 @@ export { ShapePath } from './extras/core/ShapePath.js';
export
{
Font
}
from
'
./extras/core/Font.js
'
;
export
{
CurvePath
}
from
'
./extras/core/CurvePath.js
'
;
export
{
Curve
}
from
'
./extras/core/Curve.js
'
;
export
{
ImageUtils
}
from
'
./extras/ImageUtils.js
'
;
export
{
ShapeUtils
}
from
'
./extras/ShapeUtils.js
'
;
export
{
WebGLUtils
}
from
'
./renderers/webgl/WebGLUtils.js
'
;
export
*
from
'
./constants.js
'
;
...
...
src/extras/ImageUtils.js
0 → 100644
浏览文件 @
a32d47ed
/**
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
* @author szimek / https://github.com/szimek/
*/
var
ImageUtils
=
{
getDataURL
:
function
(
image
)
{
var
canvas
;
if
(
image
instanceof
HTMLCanvasElement
)
{
canvas
=
image
;
}
else
{
if
(
typeof
OffscreenCanvas
!==
'
undefined
'
)
{
canvas
=
new
OffscreenCanvas
(
image
.
width
,
image
.
height
);
}
else
{
canvas
=
document
.
createElementNS
(
'
http://www.w3.org/1999/xhtml
'
,
'
canvas
'
);
canvas
.
width
=
image
.
width
;
canvas
.
height
=
image
.
height
;
}
var
context
=
canvas
.
getContext
(
'
2d
'
);
if
(
image
instanceof
ImageData
)
{
context
.
putImageData
(
image
,
0
,
0
);
}
else
{
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
);
}
}
if
(
canvas
.
width
>
2048
||
canvas
.
height
>
2048
)
{
return
canvas
.
toDataURL
(
'
image/jpeg
'
,
0.6
);
}
else
{
return
canvas
.
toDataURL
(
'
image/png
'
);
}
}
};
export
{
ImageUtils
};
src/textures/Texture.js
浏览文件 @
a32d47ed
...
...
@@ -10,6 +10,7 @@ import { MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearEnco
import
{
_Math
}
from
'
../math/Math.js
'
;
import
{
Vector2
}
from
'
../math/Vector2.js
'
;
import
{
Matrix3
}
from
'
../math/Matrix3.js
'
;
import
{
ImageUtils
}
from
'
../extras/ImageUtils.js
'
;
var
textureId
=
0
;
...
...
@@ -183,7 +184,7 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
for
(
var
i
=
0
,
l
=
image
.
length
;
i
<
l
;
i
++
)
{
url
.
push
(
this
.
_getDataURL
(
image
)
);
url
.
push
(
ImageUtils
.
getDataURL
(
image
[
i
]
)
);
}
...
...
@@ -191,7 +192,7 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
// process single image
url
=
this
.
_
getDataURL
(
image
);
url
=
ImageUtils
.
getDataURL
(
image
);
}
...
...
@@ -216,46 +217,6 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
},
_getDataURL
:
function
(
image
)
{
var
canvas
;
if
(
image
instanceof
HTMLCanvasElement
)
{
canvas
=
image
;
}
else
{
canvas
=
document
.
createElementNS
(
'
http://www.w3.org/1999/xhtml
'
,
'
canvas
'
);
canvas
.
width
=
image
.
width
;
canvas
.
height
=
image
.
height
;
var
context
=
canvas
.
getContext
(
'
2d
'
);
if
(
image
instanceof
ImageData
)
{
context
.
putImageData
(
image
,
0
,
0
);
}
else
{
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
);
}
}
if
(
canvas
.
width
>
2048
||
canvas
.
height
>
2048
)
{
return
canvas
.
toDataURL
(
'
image/jpeg
'
,
0.6
);
}
else
{
return
canvas
.
toDataURL
(
'
image/png
'
);
}
},
dispose
:
function
()
{
this
.
dispatchEvent
(
{
type
:
'
dispose
'
}
);
...
...
utils/converters/fbx2three.js
浏览文件 @
a32d47ed
...
...
@@ -52,7 +52,7 @@ THREE.ImageLoader.prototype.load = function ( url, onLoad ) {
};
// Convert image buffer to data URL.
THREE
.
Texture
.
prototype
.
_
getDataURL
=
function
(
image
)
{
THREE
.
ImageUtils
.
getDataURL
=
function
(
image
)
{
if
(
!
(
image
instanceof
Buffer
)
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录