Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
2a8abb55
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,发现更多精彩内容 >>
提交
2a8abb55
编写于
12月 10, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implemented gero3 Rectangle optimisations.
上级
5b0714c3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
62 addition
and
37 deletion
+62
-37
examples/geometry_terrain_gl.html
examples/geometry_terrain_gl.html
+2
-2
examples/js/ImprovedNoise.js
examples/js/ImprovedNoise.js
+12
-16
src/core/Rectangle.js
src/core/Rectangle.js
+45
-16
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+3
-3
未找到文件。
examples/geometry_terrain_gl.html
浏览文件 @
2a8abb55
...
@@ -114,8 +114,8 @@
...
@@ -114,8 +114,8 @@
function
generateHeight
(
width
,
height
)
{
function
generateHeight
(
width
,
height
)
{
var
size
=
width
*
height
,
data
=
new
Float32Array
(
size
),
perlin
=
new
ImprovedNoise
(),
var
size
=
width
*
height
,
data
=
new
Float32Array
(
size
),
quality
=
1
,
z
=
Math
.
random
()
*
100
;
perlin
=
new
ImprovedNoise
(),
quality
=
1
,
z
=
Math
.
random
()
*
100
;
for
(
var
i
=
0
;
i
<
size
;
i
++
)
{
for
(
var
i
=
0
;
i
<
size
;
i
++
)
{
...
...
examples/js/ImprovedNoise.js
浏览文件 @
2a8abb55
...
@@ -2,22 +2,18 @@
...
@@ -2,22 +2,18 @@
var
ImprovedNoise
=
function
()
{
var
ImprovedNoise
=
function
()
{
var
data
=
[
var
p
=
[
151
,
160
,
137
,
91
,
90
,
15
,
131
,
13
,
201
,
95
,
96
,
53
,
194
,
233
,
7
,
225
,
140
,
36
,
103
,
30
,
69
,
142
,
8
,
99
,
37
,
240
,
21
,
10
,
151
,
160
,
137
,
91
,
90
,
15
,
131
,
13
,
201
,
95
,
96
,
53
,
194
,
233
,
7
,
225
,
140
,
36
,
103
,
30
,
69
,
142
,
8
,
99
,
37
,
240
,
21
,
10
,
23
,
190
,
6
,
148
,
247
,
120
,
234
,
75
,
0
,
26
,
197
,
62
,
94
,
252
,
219
,
203
,
117
,
35
,
11
,
32
,
57
,
177
,
33
,
88
,
237
,
149
,
56
,
87
,
23
,
190
,
6
,
148
,
247
,
120
,
234
,
75
,
0
,
26
,
197
,
62
,
94
,
252
,
219
,
203
,
117
,
35
,
11
,
32
,
57
,
177
,
33
,
88
,
237
,
149
,
56
,
87
,
174
,
20
,
125
,
136
,
171
,
168
,
68
,
175
,
74
,
165
,
71
,
134
,
139
,
48
,
27
,
166
,
77
,
146
,
158
,
231
,
83
,
111
,
229
,
122
,
60
,
211
,
174
,
20
,
125
,
136
,
171
,
168
,
68
,
175
,
74
,
165
,
71
,
134
,
139
,
48
,
27
,
166
,
77
,
146
,
158
,
231
,
83
,
111
,
229
,
122
,
60
,
211
,
133
,
230
,
220
,
105
,
92
,
41
,
55
,
46
,
245
,
40
,
244
,
102
,
143
,
54
,
65
,
25
,
63
,
161
,
1
,
216
,
80
,
73
,
209
,
76
,
132
,
187
,
208
,
133
,
230
,
220
,
105
,
92
,
41
,
55
,
46
,
245
,
40
,
244
,
102
,
143
,
54
,
65
,
25
,
63
,
161
,
1
,
216
,
80
,
73
,
209
,
76
,
132
,
187
,
208
,
89
,
18
,
169
,
200
,
196
,
135
,
130
,
116
,
188
,
159
,
86
,
164
,
100
,
109
,
198
,
173
,
186
,
3
,
64
,
52
,
217
,
226
,
250
,
124
,
123
,
5
,
89
,
18
,
169
,
200
,
196
,
135
,
130
,
116
,
188
,
159
,
86
,
164
,
100
,
109
,
198
,
173
,
186
,
3
,
64
,
52
,
217
,
226
,
250
,
124
,
123
,
5
,
202
,
38
,
147
,
118
,
126
,
255
,
82
,
85
,
212
,
207
,
206
,
59
,
227
,
47
,
16
,
58
,
17
,
182
,
189
,
28
,
42
,
223
,
183
,
170
,
213
,
119
,
202
,
38
,
147
,
118
,
126
,
255
,
82
,
85
,
212
,
207
,
206
,
59
,
227
,
47
,
16
,
58
,
17
,
182
,
189
,
28
,
42
,
223
,
183
,
170
,
213
,
119
,
248
,
152
,
2
,
44
,
154
,
163
,
70
,
221
,
153
,
101
,
155
,
167
,
43
,
172
,
9
,
129
,
22
,
39
,
253
,
19
,
98
,
108
,
110
,
79
,
113
,
224
,
232
,
248
,
152
,
2
,
44
,
154
,
163
,
70
,
221
,
153
,
101
,
155
,
167
,
43
,
172
,
9
,
129
,
22
,
39
,
253
,
19
,
98
,
108
,
110
,
79
,
113
,
224
,
232
,
178
,
185
,
112
,
104
,
218
,
246
,
97
,
228
,
251
,
34
,
242
,
193
,
238
,
210
,
144
,
12
,
191
,
179
,
162
,
241
,
81
,
51
,
145
,
235
,
249
,
178
,
185
,
112
,
104
,
218
,
246
,
97
,
228
,
251
,
34
,
242
,
193
,
238
,
210
,
144
,
12
,
191
,
179
,
162
,
241
,
81
,
51
,
145
,
235
,
249
,
14
,
239
,
107
,
49
,
192
,
214
,
31
,
181
,
199
,
106
,
157
,
184
,
84
,
204
,
176
,
115
,
121
,
50
,
45
,
127
,
4
,
150
,
254
,
138
,
236
,
205
,
14
,
239
,
107
,
49
,
192
,
214
,
31
,
181
,
199
,
106
,
157
,
184
,
84
,
204
,
176
,
115
,
121
,
50
,
45
,
127
,
4
,
150
,
254
,
138
,
236
,
205
,
93
,
222
,
114
,
67
,
29
,
24
,
72
,
243
,
141
,
128
,
195
,
78
,
66
,
215
,
61
,
156
,
180
];
93
,
222
,
114
,
67
,
29
,
24
,
72
,
243
,
141
,
128
,
195
,
78
,
66
,
215
,
61
,
156
,
180
];
for
(
var
i
=
0
;
i
<
256
;
i
++
)
{
var
p
=
Int16Array
?
new
Int16Array
(
data
.
length
)
:
[];
data
.
forEach
(
function
(
v
,
i
)
{
p
[
i
]
=
v
;
}
);
for
(
var
i
=
0
;
i
<
256
;
i
++
)
{
p
[
256
+
i
]
=
p
[
i
];
p
[
256
+
i
]
=
p
[
i
];
...
...
src/core/Rectangle.js
浏览文件 @
2a8abb55
...
@@ -81,16 +81,42 @@ THREE.Rectangle = function () {
...
@@ -81,16 +81,42 @@ THREE.Rectangle = function () {
_left
=
x
;
_top
=
y
;
_left
=
x
;
_top
=
y
;
_right
=
x
;
_bottom
=
y
;
_right
=
x
;
_bottom
=
y
;
resize
();
}
else
{
}
else
{
_left
=
Math
.
min
(
_left
,
x
);
_left
=
_left
<
x
?
_left
:
x
;
//
Math.min( _left, x );
_top
=
Math
.
min
(
_top
,
y
);
_top
=
_top
<
y
?
_top
:
y
;
//
Math.min( _top, y );
_right
=
Math
.
max
(
_right
,
x
);
_right
=
_right
>
x
?
_right
:
x
;
//
Math.max( _right, x );
_bottom
=
Math
.
max
(
_bottom
,
y
);
_bottom
=
_bottom
>
y
?
_bottom
:
y
;
//
Math.max( _bottom, y );
resize
();
}
}
resize
();
};
this
.
add3Points
=
function
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
)
{
if
(
_isEmpty
)
{
_isEmpty
=
false
;
_left
=
x1
<
x2
?
(
x1
<
x3
?
x1
:
x3
)
:
(
x2
<
x3
?
x2
:
x3
);
_top
=
y1
<
y2
?
(
y1
<
y3
?
y1
:
y3
)
:
(
y2
<
y3
?
y2
:
y3
);
_right
=
x1
>
x2
?
(
x1
>
x3
?
x1
:
x3
)
:
(
x2
>
x3
?
x2
:
x3
);
_bottom
=
y1
>
y2
?
(
y1
>
y3
?
y1
:
y3
)
:
(
y2
>
y3
?
y2
:
y3
);
resize
();
}
else
{
_left
=
x1
<
x2
?
(
x1
<
x3
?
(
x1
<
_left
?
x1
:
_left
)
:
(
x3
<
_left
?
x3
:
_left
)
)
:
(
x2
<
x3
?
(
x2
<
_left
?
x2
:
_left
)
:
(
x3
<
_left
?
x3
:
_left
)
);
_top
=
y1
<
y2
?
(
y1
<
y3
?
(
y1
<
_top
?
y1
:
_top
)
:
(
y3
<
_top
?
y3
:
_top
)
)
:
(
y2
<
y3
?
(
y2
<
_top
?
y2
:
_top
)
:
(
y3
<
_top
?
y3
:
_top
)
);
_right
=
x1
>
x2
?
(
x1
>
x3
?
(
x1
>
_right
?
x1
:
_right
)
:
(
x3
>
_right
?
x3
:
_right
)
)
:
(
x2
>
x3
?
(
x2
>
_right
?
x2
:
_right
)
:
(
x3
>
_right
?
x3
:
_right
)
);
_bottom
=
y1
>
y2
?
(
y1
>
y3
?
(
y1
>
_bottom
?
y1
:
_bottom
)
:
(
y3
>
_bottom
?
y3
:
_bottom
)
)
:
(
y2
>
y3
?
(
y2
>
_bottom
?
y2
:
_bottom
)
:
(
y3
>
_bottom
?
y3
:
_bottom
)
);
resize
();
};
};
};
...
@@ -102,16 +128,18 @@ THREE.Rectangle = function () {
...
@@ -102,16 +128,18 @@ THREE.Rectangle = function () {
_left
=
r
.
getLeft
();
_top
=
r
.
getTop
();
_left
=
r
.
getLeft
();
_top
=
r
.
getTop
();
_right
=
r
.
getRight
();
_bottom
=
r
.
getBottom
();
_right
=
r
.
getRight
();
_bottom
=
r
.
getBottom
();
resize
();
}
else
{
}
else
{
_left
=
Math
.
min
(
_left
,
r
.
getLeft
()
);
_left
=
_left
<
r
.
getLeft
()
?
_left
:
r
.
getLeft
();
// Math.min(_left, r.getLeft()
);
_top
=
Math
.
min
(
_top
,
r
.
getTop
()
);
_top
=
_top
<
r
.
getTop
()
?
_top
:
r
.
getTop
();
// Math.min(_top, r.getTop()
);
_right
=
Math
.
max
(
_right
,
r
.
getRight
()
);
_right
=
_right
>
r
.
getRight
()
?
_right
:
r
.
getRight
();
// Math.max(_right, r.getRight()
);
_bottom
=
Math
.
max
(
_bottom
,
r
.
getBottom
()
);
_bottom
=
_bottom
>
r
.
getBottom
()
?
_bottom
:
r
.
getBottom
();
// Math.max(_bottom, r.getBottom()
);
}
resize
();
resize
();
}
};
};
...
@@ -126,10 +154,10 @@ THREE.Rectangle = function () {
...
@@ -126,10 +154,10 @@ THREE.Rectangle = function () {
this
.
minSelf
=
function
(
r
)
{
this
.
minSelf
=
function
(
r
)
{
_left
=
Math
.
max
(
_left
,
r
.
getLeft
()
);
_left
=
_left
>
r
.
getLeft
()
?
_left
:
r
.
getLeft
();
//
Math.max( _left, r.getLeft() );
_top
=
Math
.
max
(
_top
,
r
.
getTop
()
);
_top
=
_top
>
r
.
getTop
()
?
_top
:
r
.
getTop
();
//
Math.max( _top, r.getTop() );
_right
=
Math
.
min
(
_right
,
r
.
getRight
()
);
_right
=
_right
<
r
.
getRight
()
?
_right
:
r
.
getRight
();
//
Math.min( _right, r.getRight() );
_bottom
=
Math
.
min
(
_bottom
,
r
.
getBottom
()
);
_bottom
=
_bottom
<
r
.
getBottom
()
?
_bottom
:
r
.
getBottom
();
//
Math.min( _bottom, r.getBottom() );
resize
();
resize
();
...
@@ -147,7 +175,8 @@ THREE.Rectangle = function () {
...
@@ -147,7 +175,8 @@ THREE.Rectangle = function () {
// return this.contains( r.getLeft(), r.getTop() ) || this.contains( r.getRight(), r.getTop() ) || this.contains( r.getLeft(), r.getBottom() ) || this.contains( r.getRight(), r.getBottom() );
// return this.contains( r.getLeft(), r.getTop() ) || this.contains( r.getRight(), r.getTop() ) || this.contains( r.getLeft(), r.getBottom() ) || this.contains( r.getRight(), r.getBottom() );
return
Math
.
min
(
_right
,
r
.
getRight
()
)
-
Math
.
max
(
_left
,
r
.
getLeft
()
)
>=
0
&&
Math
.
min
(
_bottom
,
r
.
getBottom
()
)
-
Math
.
max
(
_top
,
r
.
getTop
()
)
>=
0
;
return
Math
.
min
(
_right
,
r
.
getRight
()
)
-
Math
.
max
(
_left
,
r
.
getLeft
()
)
>=
0
&&
Math
.
min
(
_bottom
,
r
.
getBottom
()
)
-
Math
.
max
(
_top
,
r
.
getTop
()
)
>=
0
;
};
};
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
2a8abb55
...
@@ -177,9 +177,9 @@ THREE.CanvasRenderer = function () {
...
@@ -177,9 +177,9 @@ THREE.CanvasRenderer = function () {
}
}
_bboxRect
.
add
Point
(
_v1
.
positionScreen
.
x
,
_v1
.
positionScreen
.
y
);
_bboxRect
.
add
3Points
(
_v1
.
positionScreen
.
x
,
_v1
.
positionScreen
.
y
,
_bboxRect
.
addPoint
(
_v2
.
positionScreen
.
x
,
_v2
.
positionScreen
.
y
);
_v2
.
positionScreen
.
x
,
_v2
.
positionScreen
.
y
,
_bboxRect
.
addPoint
(
_v3
.
positionScreen
.
x
,
_v3
.
positionScreen
.
y
);
_v3
.
positionScreen
.
x
,
_v3
.
positionScreen
.
y
);
if
(
_clipRect
.
instersects
(
_bboxRect
)
)
{
if
(
_clipRect
.
instersects
(
_bboxRect
)
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录