Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3379ae32
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,发现更多精彩内容 >>
提交
3379ae32
编写于
3月 18, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev-geometry-experiment' of
https://github.com/jbaicoianu/three.js
into dev
上级
c0f243c6
df982b79
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
181 addition
and
1 deletion
+181
-1
src/core/Geometry99.js
src/core/Geometry99.js
+179
-0
src/core/IndexedGeometry2.js
src/core/IndexedGeometry2.js
+1
-1
utils/build/includes/common.json
utils/build/includes/common.json
+1
-0
未找到文件。
src/core/Geometry99.js
0 → 100644
浏览文件 @
3379ae32
THREE
.
Geometry99
=
function
(
)
{
THREE
.
BufferGeometry
.
call
(
this
);
};
THREE
.
Geometry99
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
Object
.
defineProperties
(
THREE
.
Geometry99
.
prototype
,
{
vertices
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
createVertexProxies
();
}
},
faces
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
createFaceProxies
()
}
},
faceVertexUvs
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
createUvProxies
()
}
},
// TODO - fill in additional proxies:
// - colors
// - morphColors
// - morphNormals
// - morphTargets
// - skinIndex
// - skinWeights
});
THREE
.
Geometry99
.
prototype
.
createVertexProxies
=
function
()
{
// Replace the prototype getter with a local array property
Object
.
defineProperty
(
this
,
"
vertices
"
,
{
value
:
[]
}
);
// If the attribute buffer has already been populated, set up proxy objects
this
.
populateProxyFromBuffer
(
this
.
vertices
,
"
position
"
,
THREE
.
TypedVector3
,
3
);
// Return a reference to the newly-created array
return
this
.
vertices
;
}
THREE
.
Geometry99
.
prototype
.
createFaceProxies
=
function
()
{
// Replace the prototype getter with a local array property
Object
.
defineProperty
(
this
,
"
faces
"
,
{
value
:
[]
}
);
// If the attribute buffer has already been populated, set up proxy objects
if
(
this
.
attributes
.
index
)
{
var
indexarray
=
this
.
attributes
[
'
index
'
].
array
;
var
size
=
3
;
var
attr
=
this
.
faces
;
var
normalarray
=
false
;
if
(
this
.
attributes
[
'
normal
'
])
{
normalarray
=
this
.
attributes
[
'
normal
'
].
array
;
}
for
(
var
i
=
0
,
l
=
indexarray
.
length
/
size
;
i
<
l
;
i
++
)
{
var
o
=
i
*
size
;
// Generate faceVertexNormals
var
vertexNormals
;
if
(
normalarray
)
{
vertexNormals
=
[
new
THREE
.
TypedVector3
(
normalarray
,
indexarray
[
o
]
*
3
),
new
THREE
.
TypedVector3
(
normalarray
,
indexarray
[
o
+
1
]
*
3
),
new
THREE
.
TypedVector3
(
normalarray
,
indexarray
[
o
+
2
]
*
3
),
]
}
// TODO - do BufferGeometries support face normals?
var
face
=
new
THREE
.
TypedFace3
(
indexarray
,
i
*
size
,
vertexNormals
);
attr
.
push
(
face
);
}
}
else
{
// TODO - should be able to generate Face data even for non-indexed geometries
}
// Return a reference to the newly-created array
return
this
.
faces
;
}
THREE
.
Geometry99
.
prototype
.
createUvProxies
=
function
()
{
// Replace the prototype getter with a local array property
Object
.
defineProperty
(
this
,
"
faceVertexUvs
"
,
{
value
:
[[]]
}
);
// If the attribute buffer has already been populated, set up proxy objects
if
(
this
.
attributes
.
uv
)
{
var
faces
=
this
.
faces
;
var
uvarray
=
this
.
attributes
.
uv
.
array
;
for
(
var
i
=
0
,
l
=
faces
.
length
;
i
<
l
;
i
++
)
{
var
f
=
faces
[
i
];
this
.
faceVertexUvs
[
0
][
i
]
=
[];
this
.
faceVertexUvs
[
0
][
i
][
0
]
=
new
THREE
.
TypedVector2
(
uvarray
,
f
.
a
*
2
);
this
.
faceVertexUvs
[
0
][
i
][
1
]
=
new
THREE
.
TypedVector2
(
uvarray
,
f
.
b
*
2
);
this
.
faceVertexUvs
[
0
][
i
][
2
]
=
new
THREE
.
TypedVector2
(
uvarray
,
f
.
c
*
2
);
}
}
// Return a reference to the newly-created array
return
this
.
faceVertexUvs
;
}
THREE
.
Geometry99
.
prototype
.
populateProxyFromBuffer
=
function
(
attr
,
buffername
,
proxytype
,
itemsize
,
offset
,
count
)
{
if
(
this
.
attributes
[
buffername
]
)
{
var
array
=
this
.
attributes
[
buffername
].
array
;
var
size
=
itemsize
||
this
.
attributes
[
buffername
].
itemSize
;
var
start
=
offset
||
0
;
var
count
=
count
||
(
array
.
length
/
size
-
start
);
for
(
var
i
=
start
,
l
=
start
+
count
;
i
<
l
;
i
++
)
{
attr
.
push
(
new
proxytype
(
array
,
i
*
size
)
);
}
}
}
THREE
.
TypedFace3
=
function
(
array
,
offset
,
vertexNormals
)
{
this
.
array
=
array
;
this
.
offset
=
offset
;
this
.
vertexNormals
=
vertexNormals
;
//THREE.Face3.call( this, array[offset], array[offset+1], array[offset+2] /*, normal, color, materialIndex */);
}
THREE
.
TypedFace3
.
prototype
=
Object
.
create
(
THREE
.
Face3
.
prototype
);
Object
.
defineProperties
(
THREE
.
TypedFace3
.
prototype
,
{
'
a
'
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
array
[
this
.
offset
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
]
=
v
;
}
},
'
b
'
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
array
[
this
.
offset
+
1
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
+
1
]
=
v
;
}
},
'
c
'
:
{
enumerable
:
true
,
get
:
function
()
{
return
this
.
array
[
this
.
offset
+
2
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
+
2
]
=
v
;
}
},
}
);
src/core/IndexedGeometry2.js
浏览文件 @
3379ae32
...
...
@@ -13,4 +13,4 @@ THREE.IndexedGeometry2 = function ( indices, vertices, normals, uvs ) {
};
THREE
.
IndexedGeometry2
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
\ No newline at end of file
THREE
.
IndexedGeometry2
.
prototype
=
Object
.
create
(
THREE
.
Geometry99
.
prototype
);
utils/build/includes/common.json
浏览文件 @
3379ae32
...
...
@@ -34,6 +34,7 @@
"src/core/BufferGeometryManipulator.js"
,
"src/core/Geometry.js"
,
"src/core/Geometry2.js"
,
"src/core/Geometry99.js"
,
"src/core/IndexedGeometry2.js"
,
"src/cameras/Camera.js"
,
"src/cameras/OrthographicCamera.js"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录