Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
02486286
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,发现更多精彩内容 >>
提交
02486286
编写于
4月 02, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deprecated setClearColorHex().
上级
60db8b66
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
203 addition
and
215 deletion
+203
-215
build/three.js
build/three.js
+27
-30
build/three.min.js
build/three.min.js
+145
-145
docs/api/renderers/WebGLRenderer.html
docs/api/renderers/WebGLRenderer.html
+4
-10
src/math/Color.js
src/math/Color.js
+11
-7
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+10
-15
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+6
-8
未找到文件。
build/three.js
浏览文件 @
02486286
...
...
@@ -261,18 +261,22 @@ THREE.Color.prototype = {
set: function ( value ) {
switch ( typeof value
) {
if ( value instanceof THREE.Color
) {
case "number":
this.setHex( value );
break;
this.copy( value );
case "string":
this.setStyle( value );
break;
} else if ( typeof value === 'number' ) {
this.setHex( value );
} else if ( typeof value === 'string' ) {
this.setStyle( value );
}
return this;
},
setHex: function ( hex ) {
...
...
@@ -13840,7 +13844,7 @@ THREE.CanvasRenderer = function ( parameters ) {
_context = _canvas.getContext( '2d' ),
_clearColor = new THREE.Color( 0x000000 ),
_clear
Opacity
= 0,
_clear
Alpha
= 0,
_contextGlobalAlpha = 1,
_contextGlobalCompositeOperation = 0,
...
...
@@ -13991,10 +13995,10 @@ THREE.CanvasRenderer = function ( parameters ) {
};
this.setClearColor = function ( color,
opacity
) {
this.setClearColor = function ( color,
alpha
) {
_clearColor.
copy
( color );
_clear
Opacity = opacity !== undefined ? opacity
: 1;
_clearColor.
set
( color );
_clear
Alpha = alpha !== undefined ? alpha
: 1;
_clearBox.set(
new THREE.Vector2( - _canvasWidthHalf, - _canvasHeightHalf ),
...
...
@@ -14003,15 +14007,10 @@ THREE.CanvasRenderer = function ( parameters ) {
};
this.setClearColorHex = function ( hex, opacity ) {
_clearColor.setHex( hex );
_clearOpacity = opacity !== undefined ? opacity : 1;
this.setClearColorHex = function ( hex, alpha ) {
_clearBox.set(
new THREE.Vector2( - _canvasWidthHalf, - _canvasHeightHalf ),
new THREE.Vector2( _canvasWidthHalf, _canvasHeightHalf )
);
console.warn( 'DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.' );
this.setClearColor( hex, alpha );
};
...
...
@@ -14030,7 +14029,7 @@ THREE.CanvasRenderer = function ( parameters ) {
_clearBox.intersect( _clipBox );
_clearBox.expandByScalar( 2 );
if ( _clear
Opacity
< 1 ) {
if ( _clear
Alpha
< 1 ) {
_context.clearRect(
_clearBox.min.x | 0,
...
...
@@ -14041,12 +14040,12 @@ THREE.CanvasRenderer = function ( parameters ) {
}
if ( _clear
Opacity
> 0 ) {
if ( _clear
Alpha
> 0 ) {
setBlending( THREE.NormalBlending );
setOpacity( 1 );
setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clear
Opacity
+ ')' );
setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clear
Alpha
+ ')' );
_context.fillRect(
_clearBox.min.x | 0,
...
...
@@ -18615,21 +18614,19 @@ THREE.WebGLRenderer = function ( parameters ) {
// Clearing
this.setClearColor
Hex = function ( hex
, alpha ) {
this.setClearColor
= function ( color
, alpha ) {
_clearColor.set
Hex( hex
);
_clearAlpha = alpha;
_clearColor.set
( color
);
_clearAlpha = alpha
!== undefined ? alpha : 1
;
_gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
};
this.setClearColor = function ( color, alpha ) {
_clearColor.copy( color );
_clearAlpha = alpha;
this.setClearColorHex = function ( hex, alpha ) {
_gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
console.warn( 'DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.' );
this.setClearColor( hex, alpha );
};
...
...
build/three.min.js
浏览文件 @
02486286
此差异已折叠。
点击以展开。
docs/api/renderers/WebGLRenderer.html
浏览文件 @
02486286
...
...
@@ -207,23 +207,18 @@
<h3>
.enableScissorTest( [page:Boolean enable] )
</h3>
<div>
Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.
</div>
<h3>
.setClearColor( [page:Color color], [page:Float alpha] )
</h3>
<div>
Sets the clear color and opacity.
</div>
<h3>
.setClearColorHex( [page:Integer hex], [page:Float alpha] )
</h3>
<div>
Sets the clear color, using hex for the color and alpha for the opacity.
</div>
<code>
// Creates a renderer with black background
<code>
// Creates a renderer with red background
var renderer = new THREE.WebGLRenderer();
renderer.setSize(200, 100);
renderer.setClearColor
Hex(0x00
0000, 1);
renderer.setClearColor
(0xff
0000, 1);
</code>
<h3>
.setClearColor( [page:Color color], [page:Float alpha] )
</h3>
<div>
Sets the clear color, using color for the color and alpha for the opacity.
</div>
<h3>
.getClearColor() [page:Color]
</h3>
<div>
Returns a [page:Color THREE.Color] instance with the current clear color.
</div>
<h3>
.getClearAlpha() [page:Float]
</h3>
<div>
Returns a [page:Float float] with the current clear alpha. Ranges from 0 to 1.
</div>
...
...
@@ -231,7 +226,6 @@
<div>
Tells the renderer to clear its color, depth or stencil drawing buffer(s).
</div>
<div>
If no parameters are passed, no buffer will be cleared.
</div>
<h3>
.addPostPlugin( plugin )
</h3>
<div>
Initialises the postprocessing plugin, and adds it to the renderPluginsPost array.
</div>
...
...
src/math/Color.js
浏览文件 @
02486286
...
...
@@ -18,18 +18,22 @@ THREE.Color.prototype = {
set
:
function
(
value
)
{
switch
(
typeof
value
)
{
if
(
value
instanceof
THREE
.
Color
)
{
case
"
number
"
:
this
.
setHex
(
value
);
break
;
this
.
copy
(
value
);
case
"
string
"
:
this
.
setStyle
(
value
);
break
;
}
else
if
(
typeof
value
===
'
number
'
)
{
this
.
setHex
(
value
);
}
else
if
(
typeof
value
===
'
string
'
)
{
this
.
setStyle
(
value
);
}
return
this
;
},
setHex
:
function
(
hex
)
{
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
02486286
...
...
@@ -22,7 +22,7 @@ THREE.CanvasRenderer = function ( parameters ) {
_context
=
_canvas
.
getContext
(
'
2d
'
),
_clearColor
=
new
THREE
.
Color
(
0x000000
),
_clear
Opacity
=
0
,
_clear
Alpha
=
0
,
_contextGlobalAlpha
=
1
,
_contextGlobalCompositeOperation
=
0
,
...
...
@@ -173,10 +173,10 @@ THREE.CanvasRenderer = function ( parameters ) {
};
this
.
setClearColor
=
function
(
color
,
opacity
)
{
this
.
setClearColor
=
function
(
color
,
alpha
)
{
_clearColor
.
copy
(
color
);
_clear
Opacity
=
opacity
!==
undefined
?
opacity
:
1
;
_clearColor
.
set
(
color
);
_clear
Alpha
=
alpha
!==
undefined
?
alpha
:
1
;
_clearBox
.
set
(
new
THREE
.
Vector2
(
-
_canvasWidthHalf
,
-
_canvasHeightHalf
),
...
...
@@ -185,15 +185,10 @@ THREE.CanvasRenderer = function ( parameters ) {
};
this
.
setClearColorHex
=
function
(
hex
,
opacity
)
{
this
.
setClearColorHex
=
function
(
hex
,
alpha
)
{
_clearColor
.
setHex
(
hex
);
_clearOpacity
=
opacity
!==
undefined
?
opacity
:
1
;
_clearBox
.
set
(
new
THREE
.
Vector2
(
-
_canvasWidthHalf
,
-
_canvasHeightHalf
),
new
THREE
.
Vector2
(
_canvasWidthHalf
,
_canvasHeightHalf
)
);
console
.
warn
(
'
DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.
'
);
this
.
setClearColor
(
hex
,
alpha
);
};
...
...
@@ -212,7 +207,7 @@ THREE.CanvasRenderer = function ( parameters ) {
_clearBox
.
intersect
(
_clipBox
);
_clearBox
.
expandByScalar
(
2
);
if
(
_clear
Opacity
<
1
)
{
if
(
_clear
Alpha
<
1
)
{
_context
.
clearRect
(
_clearBox
.
min
.
x
|
0
,
...
...
@@ -223,12 +218,12 @@ THREE.CanvasRenderer = function ( parameters ) {
}
if
(
_clear
Opacity
>
0
)
{
if
(
_clear
Alpha
>
0
)
{
setBlending
(
THREE
.
NormalBlending
);
setOpacity
(
1
);
setFillStyle
(
'
rgba(
'
+
Math
.
floor
(
_clearColor
.
r
*
255
)
+
'
,
'
+
Math
.
floor
(
_clearColor
.
g
*
255
)
+
'
,
'
+
Math
.
floor
(
_clearColor
.
b
*
255
)
+
'
,
'
+
_clear
Opacity
+
'
)
'
);
setFillStyle
(
'
rgba(
'
+
Math
.
floor
(
_clearColor
.
r
*
255
)
+
'
,
'
+
Math
.
floor
(
_clearColor
.
g
*
255
)
+
'
,
'
+
Math
.
floor
(
_clearColor
.
b
*
255
)
+
'
,
'
+
_clear
Alpha
+
'
)
'
);
_context
.
fillRect
(
_clearBox
.
min
.
x
|
0
,
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
02486286
...
...
@@ -331,21 +331,19 @@ THREE.WebGLRenderer = function ( parameters ) {
// Clearing
this
.
setClearColor
Hex
=
function
(
hex
,
alpha
)
{
this
.
setClearColor
=
function
(
color
,
alpha
)
{
_clearColor
.
set
Hex
(
hex
);
_clearAlpha
=
alpha
;
_clearColor
.
set
(
color
);
_clearAlpha
=
alpha
!==
undefined
?
alpha
:
1
;
_gl
.
clearColor
(
_clearColor
.
r
,
_clearColor
.
g
,
_clearColor
.
b
,
_clearAlpha
);
};
this
.
setClearColor
=
function
(
color
,
alpha
)
{
_clearColor
.
copy
(
color
);
_clearAlpha
=
alpha
;
this
.
setClearColorHex
=
function
(
hex
,
alpha
)
{
_gl
.
clearColor
(
_clearColor
.
r
,
_clearColor
.
g
,
_clearColor
.
b
,
_clearAlpha
);
console
.
warn
(
'
DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.
'
);
this
.
setClearColor
(
hex
,
alpha
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录