Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
3b545059
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,发现更多精彩内容 >>
提交
3b545059
编写于
12月 17, 2010
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
差异文件
Synced with mrdoob's branch.
上级
39c7e8da
fca3aec6
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
493 addition
and
432 deletion
+493
-432
build/Three.js
build/Three.js
+127
-127
build/ThreeDebug.js
build/ThreeDebug.js
+128
-128
build/ThreeExtras.js
build/ThreeExtras.js
+160
-160
examples/webglrenderer2_sandbox.html
examples/webglrenderer2_sandbox.html
+1
-0
src/renderers/Projector.js
src/renderers/Projector.js
+51
-1
src/renderers/WebGLRenderer2.js
src/renderers/WebGLRenderer2.js
+16
-16
src/renderers/renderables/RenderableObject.js
src/renderers/renderables/RenderableObject.js
+10
-0
未找到文件。
build/Three.js
浏览文件 @
3b545059
此差异已折叠。
点击以展开。
build/ThreeDebug.js
浏览文件 @
3b545059
此差异已折叠。
点击以展开。
build/ThreeExtras.js
浏览文件 @
3b545059
此差异已折叠。
点击以展开。
examples/webglrenderer2_sandbox.html
浏览文件 @
3b545059
...
...
@@ -90,6 +90,7 @@
<script
type=
"text/javascript"
src=
"../src/renderers/SVGRenderer.js"
></script>
<script
type=
"text/javascript"
src=
"../src/renderers/WebGLRenderer.js"
></script>
<script
type=
"text/javascript"
src=
"../src/renderers/WebGLRenderer2.js"
></script>
<script
type=
"text/javascript"
src=
"../src/renderers/renderables/RenderableObject.js"
></script>
<script
type=
"text/javascript"
src=
"../src/renderers/renderables/RenderableFace3.js"
></script>
<script
type=
"text/javascript"
src=
"../src/renderers/renderables/RenderableParticle.js"
></script>
<script
type=
"text/javascript"
src=
"../src/renderers/renderables/RenderableLine.js"
></script>
...
...
src/renderers/Projector.js
浏览文件 @
3b545059
...
...
@@ -7,6 +7,7 @@
THREE
.
Projector
=
function
()
{
var
_renderList
=
null
,
_object
,
_objectCount
,
_objectPool
=
[],
_face3
,
_face32
,
_face3Count
,
_face3Pool
=
[],
_line
,
_lineCount
,
_linePool
=
[],
_particle
,
_particleCount
,
_particlePool
=
[],
...
...
@@ -20,6 +21,46 @@ THREE.Projector = function() {
_face3VertexNormals
;
this
.
projectObjects
=
function
(
scene
,
camera
)
{
var
o
,
ol
,
objects
,
object
;
_renderList
=
[];
_objectCount
=
0
;
_projScreenMatrix
.
multiply
(
camera
.
projectionMatrix
,
camera
.
matrix
);
objects
=
scene
.
objects
;
for
(
o
=
0
,
ol
=
objects
.
length
;
o
<
ol
;
o
++
)
{
object
=
objects
[
o
];
if
(
object
.
visible
===
false
)
continue
;
_object
=
_objectPool
[
_objectCount
]
=
_objectPool
[
_objectCount
]
||
new
THREE
.
RenderableObject
();
_vector4
.
copy
(
object
.
position
);
_projScreenMatrix
.
multiplyVector4
(
_vector4
);
// _vector4.multiplyScalar( 1 / _vector4.w );
_object
.
object
=
object
;
_object
.
z
=
_vector4
.
z
;
_renderList
.
push
(
_object
);
_objectCount
++
;
}
_renderList
.
sort
(
painterSort
);
return
_renderList
;
};
// TODO: Rename to projectElements? Test also using it with projectObjects to speed up sorting?
this
.
projectScene
=
function
(
scene
,
camera
)
{
var
o
,
ol
,
v
,
vl
,
f
,
fl
,
n
,
nl
,
objects
,
object
,
...
...
@@ -39,6 +80,9 @@ THREE.Projector = function() {
for
(
o
=
0
,
ol
=
objects
.
length
;
o
<
ol
;
o
++
)
{
object
=
objects
[
o
];
if
(
object
.
visible
===
false
)
continue
;
object
.
autoUpdateMatrix
&&
object
.
updateMatrix
();
objectMatrix
=
object
.
matrix
;
...
...
@@ -313,7 +357,7 @@ THREE.Projector = function() {
}
_renderList
.
sort
(
function
(
a
,
b
)
{
return
b
.
z
-
a
.
z
;
}
);
_renderList
.
sort
(
painterSort
);
return
_renderList
;
...
...
@@ -400,4 +444,10 @@ THREE.Projector = function() {
}
function
painterSort
(
a
,
b
)
{
return
b
.
z
-
a
.
z
;
}
};
src/renderers/WebGLRenderer2.js
浏览文件 @
3b545059
...
...
@@ -4,7 +4,10 @@
THREE
.
WebGLRenderer2
=
function
()
{
var
_canvas
=
document
.
createElement
(
'
canvas
'
),
var
_renderList
=
null
,
_projector
=
new
THREE
.
Projector
(),
_canvas
=
document
.
createElement
(
'
canvas
'
),
_gl
,
_currentProgram
,
_modelViewMatrix
=
new
THREE
.
Matrix4
(),
_viewMatrixArray
=
new
Float32Array
(
16
),
...
...
@@ -70,18 +73,27 @@ THREE.WebGLRenderer2 = function () {
_viewMatrixArray
.
set
(
camera
.
matrix
.
flatten
()
);
_projectionMatrixArray
.
set
(
camera
.
projectionMatrix
.
flatten
()
);
/*
for ( o = 0, ol = scene.objects.length; o < ol; o++ ) {
object = scene.objects[ o ];
if
(
object
.
visible
)
{
renderObject( object );
renderObject
(
object
);
}
*/
}
_renderList
=
_projector
.
projectObjects
(
scene
,
camera
);
for
(
o
=
0
,
ol
=
_renderList
.
length
;
o
<
ol
;
o
++
)
{
object
=
_renderList
[
o
];
renderObject
(
object
.
object
);
}
function
renderObject
(
object
)
{
var
geometry
,
material
,
m
,
nl
,
...
...
@@ -281,18 +293,6 @@ THREE.WebGLRenderer2 = function () {
}
else
if
(
face
instanceof
THREE
.
Face4
)
{
group
=
Math
.
floor
(
vertexIndex
/
65535
);
if
(
!
vertices
)
{
vertices
=
[];
faces
=
[];
normals
=
[];
lines
=
[];
uvs
=
[];
}
v1
=
geometry
.
vertices
[
face
.
a
].
position
;
v2
=
geometry
.
vertices
[
face
.
b
].
position
;
v3
=
geometry
.
vertices
[
face
.
c
].
position
;
...
...
src/renderers/renderables/RenderableObject.js
0 → 100644
浏览文件 @
3b545059
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
RenderableObject
=
function
()
{
this
.
object
=
null
;
this
.
z
=
null
;
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录