Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
493d6769
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 搜索 >>
提交
493d6769
编写于
5月 17, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CanvasRenderer: Initialise ClearRect
CanvasRenderer: Min of ClearRect with ClipRect
上级
530f8707
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
17 deletion
+39
-17
build/three.js
build/three.js
+1
-1
src/core/Rectangle.js
src/core/Rectangle.js
+34
-14
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+4
-2
未找到文件。
build/three.js
浏览文件 @
493d6769
此差异已折叠。
点击以展开。
src/core/Rectangle.js
浏览文件 @
493d6769
...
...
@@ -9,17 +9,7 @@ THREE.Rectangle = function (x1, y1, x2, y2) {
_width
=
_x2
-
_x1
,
_height
=
_y2
-
_y1
,
_isEmpty
=
false
;
this
.
set
=
function
(
x1
,
y1
,
x2
,
y2
)
{
_isEmpty
=
false
;
_x1
=
x1
;
_y1
=
y1
;
_x2
=
x2
;
_y2
=
y2
;
this
.
resize
();
}
this
.
resize
=
function
()
{
function
resize
()
{
_width
=
_x2
-
_x1
;
_height
=
_y2
-
_y1
;
...
...
@@ -65,6 +55,16 @@ THREE.Rectangle = function (x1, y1, x2, y2) {
return
_y2
;
}
this
.
set
=
function
(
x1
,
y1
,
x2
,
y2
)
{
_isEmpty
=
false
;
_x1
=
x1
;
_y1
=
y1
;
_x2
=
x2
;
_y2
=
y2
;
resize
();
}
this
.
addPoint
=
function
(
x
,
y
)
{
if
(
_isEmpty
)
{
...
...
@@ -78,7 +78,7 @@ THREE.Rectangle = function (x1, y1, x2, y2) {
_y2
=
Math
.
max
(
_y2
,
y
);
}
this
.
resize
();
resize
();
}
this
.
addRectangle
=
function
(
r
)
{
...
...
@@ -94,14 +94,34 @@ THREE.Rectangle = function (x1, y1, x2, y2) {
_y2
=
Math
.
max
(
_y2
,
r
.
getY2
());
}
this
.
resize
();
resize
();
}
this
.
inflate
=
function
(
v
)
{
_x1
-=
v
;
_y1
-=
v
;
_x2
+=
v
;
_y2
+=
v
;
resize
();
}
this
.
minSelf
=
function
(
r
)
{
_x1
=
Math
.
max
(
_x1
,
r
.
getX1
());
_y1
=
Math
.
max
(
_y1
,
r
.
getY1
());
_x2
=
Math
.
min
(
_x2
,
r
.
getX2
());
_y2
=
Math
.
min
(
_y2
,
r
.
getY2
());
resize
();
}
/*
this.containsPoint = function (x, y) {
return x > _x1 && x < _x2 && y > _y1 && y < _y2;
}
*/
this
.
instersects
=
function
(
r
)
{
return
Math
.
min
(
_x2
,
r
.
getX2
())
-
Math
.
max
(
_x1
,
r
.
getX1
())
>
0
&&
Math
.
min
(
_y2
,
r
.
getY2
())
-
Math
.
max
(
_y1
,
r
.
getY1
())
>
0
;
...
...
@@ -114,7 +134,7 @@ THREE.Rectangle = function (x1, y1, x2, y2) {
_x1
=
0
;
_y1
=
0
;
_x2
=
0
,
_y2
=
0
;
this
.
resize
();
resize
();
}
this
.
toString
=
function
()
{
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
493d6769
...
...
@@ -9,7 +9,7 @@ THREE.CanvasRenderer = function () {
var
_viewport
=
document
.
createElement
(
"
canvas
"
),
_context
=
_viewport
.
getContext
(
"
2d
"
),
_clipRect
=
new
THREE
.
Rectangle
(),
_clearRect
=
new
THREE
.
Rectangle
(),
_clearRect
=
new
THREE
.
Rectangle
(
0
,
0
,
0
,
0
),
_bboxRect
=
new
THREE
.
Rectangle
();
this
.
setSize
=
function
(
width
,
height
)
{
...
...
@@ -31,7 +31,9 @@ THREE.CanvasRenderer = function () {
v1x
,
v1y
,
v2x
,
v2y
,
v3x
,
v3y
,
v4x
,
v4y
,
size
;
_context
.
clearRect
(
_clearRect
.
getX
()
-
1
,
_clearRect
.
getY
()
-
1
,
_clearRect
.
getWidth
()
+
2
,
_clearRect
.
getHeight
()
+
2
);
_clearRect
.
inflate
(
1
);
_clearRect
.
minSelf
(
_clipRect
);
_context
.
clearRect
(
_clearRect
.
getX
(),
_clearRect
.
getY
(),
_clearRect
.
getWidth
(),
_clearRect
.
getHeight
());
_clearRect
.
empty
();
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录