Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
be75f8a5
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,发现更多精彩内容 >>
提交
be75f8a5
编写于
10月 21, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplified ExtrudeGeometry UV code.
上级
c4664318
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
354 deletion
+22
-354
examples/index.html
examples/index.html
+0
-1
examples/js/utils/UVsDebug.js
examples/js/utils/UVsDebug.js
+0
-80
examples/misc_uv_tests.html
examples/misc_uv_tests.html
+1
-52
examples/webgl_geometry_extrude_uvs2.html
examples/webgl_geometry_extrude_uvs2.html
+0
-195
src/extras/geometries/ExtrudeGeometry.js
src/extras/geometries/ExtrudeGeometry.js
+20
-25
src/extras/geometries/ShapeGeometry.js
src/extras/geometries/ShapeGeometry.js
+1
-1
未找到文件。
examples/index.html
浏览文件 @
be75f8a5
...
...
@@ -136,7 +136,6 @@
"
webgl_geometry_extrude_shapes
"
,
"
webgl_geometry_extrude_shapes2
"
,
"
webgl_geometry_extrude_splines
"
,
"
webgl_geometry_extrude_uvs2
"
,
"
webgl_geometry_hierarchy
"
,
"
webgl_geometry_hierarchy2
"
,
"
webgl_geometry_large_mesh
"
,
...
...
examples/js/utils/UVs
Utils
.js
→
examples/js/utils/UVs
Debug
.js
浏览文件 @
be75f8a5
/*
* @author gyuque / http://github.com/gyuque
* Cylinder Mapping for ExtrudeGeometry
*/
THREE
.
UVsUtils
=
{
};
THREE
.
UVsUtils
.
CylinderUVGenerator
=
function
()
{
this
.
uRepeat
=
1
;
this
.
targetGeometry
=
null
;
this
.
lengthCache
=
null
;
};
THREE
.
UVsUtils
.
CylinderUVGenerator
.
prototype
=
{
generateTopUV
:
THREE
.
ExtrudeGeometry
.
WorldUVGenerator
.
generateTopUV
,
generateBottomUV
:
THREE
.
ExtrudeGeometry
.
WorldUVGenerator
.
generateBottomUV
,
generateSideWallUV
:
function
(
geometry
,
extrudedShape
,
wallContour
,
extrudeOptions
,
indexA
,
indexB
,
indexC
,
indexD
,
stepIndex
,
stepsLength
,
contourIndex1
,
contourIndex2
)
{
// first call
if
(
this
.
targetGeometry
!==
geometry
)
{
this
.
prepare
(
geometry
,
wallContour
);
}
// generate uv
var
u_list
=
this
.
lengthCache
;
var
v1
=
stepIndex
/
stepsLength
;
var
v2
=
(
stepIndex
+
1
)
/
stepsLength
;
var
u1
=
u_list
[
contourIndex1
];
var
u2
=
u_list
[
contourIndex2
];
if
(
u1
<
u2
)
{
u1
+=
1.0
;}
u1
*=
this
.
uRepeat
;
u2
*=
this
.
uRepeat
;
return
[
new
THREE
.
Vector2
(
u1
,
v1
),
new
THREE
.
Vector2
(
u2
,
v1
),
new
THREE
.
Vector2
(
u2
,
v2
),
new
THREE
.
Vector2
(
u1
,
v2
)
];
},
prepare
:
function
(
geometry
,
wallContour
)
{
var
p1
,
p2
;
var
u_list
=
[];
var
lengthSum
=
0
;
var
len
=
wallContour
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
p1
=
wallContour
[
i
];
p2
=
wallContour
[
(
i
+
1
)
%
len
];
var
dx
=
p1
.
x
-
p2
.
x
;
var
dy
=
p1
.
y
-
p2
.
y
;
var
segmentLength
=
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
u_list
.
push
(
lengthSum
);
lengthSum
+=
segmentLength
;
}
this
.
normalizeArray
(
u_list
,
lengthSum
);
this
.
targetGeometry
=
geometry
;
this
.
lengthCache
=
u_list
;
},
normalizeArray
:
function
(
ls
,
v
)
{
var
len
=
ls
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
ls
[
i
]
/=
v
;
}
return
ls
;
}
};
/*
* @author zz85 / http://github.com/zz85
* @author WestLangley / http://github.com/WestLangley
...
...
examples/misc_uv_tests.html
浏览文件 @
be75f8a5
...
...
@@ -6,7 +6,7 @@
</head>
<body>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/utils/UVs
Utils
.js"
></script>
<script
src=
"js/utils/UVs
Debug
.js"
></script>
<script>
/*
* This is to help debug UVs problems in geometry,
...
...
@@ -42,57 +42,6 @@
test
(
'
new THREE.LatheGeometry( points, 8 )
'
,
new
THREE
.
LatheGeometry
(
points
,
8
));
test
(
'
new THREE.TorusGeometry( 50, 20, 8, 8 )
'
,
new
THREE
.
TorusGeometry
(
50
,
20
,
8
,
8
));
test
(
'
new THREE.TorusKnotGeometry( 50, 10, 12, 6 )
'
,
new
THREE
.
TorusKnotGeometry
(
50
,
10
,
12
,
6
));
/*
Not sure how UVs for ExtrudeGeometry are done currently...
*/
var
pts
=
[],
starPoints
=
5
,
l
;
for
(
i
=
0
;
i
<
starPoints
*
2
;
i
++
)
{
if
(
i
%
2
==
1
)
{
l
=
5
;
}
else
{
l
=
10
;
}
var
a
=
i
/
starPoints
*
Math
.
PI
;
pts
.
push
(
new
THREE
.
Vector2
(
Math
.
cos
(
a
)
*
l
,
Math
.
sin
(
a
)
*
l
));
}
var
starShape
=
new
THREE
.
Shape
(
pts
);
var
extrudeSettings
=
{
amount
:
200
,
bevelEnabled
:
true
,
bevelSegments
:
2
,
steps
:
10
};
test
(
'
new THREE.ExtrudeGeometry(starShape, extrudeSettings);
'
,
new
THREE
.
ExtrudeGeometry
(
starShape
,
extrudeSettings
));
var
uvGenerator
=
new
THREE
.
UVsUtils
.
CylinderUVGenerator
();
testShape
=
setupShape
(
8
,
3
);
holeShape
=
setupShape
(
8
,
2
);
testShape
.
holes
.
push
(
holeShape
);
function
setupShape
(
n
,
r
)
{
// Make shape
var
sh
=
new
THREE
.
Shape
();
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
method
=
i
?
'
lineTo
'
:
'
moveTo
'
;
var
a
=
(
i
/
n
)
*
Math
.
PI
*
2
;
var
x
=
Math
.
cos
(
a
)
*
r
;
var
y
=
Math
.
sin
(
a
)
*
r
;
sh
[
method
](
x
,
y
);
}
return
sh
;
}
var
exoption
=
{
bevelEnabled
:
true
,
bevelSize
:
1
,
amount
:
3
,
extrudeMaterial
:
0
,
material
:
1
,
uvGenerator
:
uvGenerator
};
var
geom
=
testShape
.
extrude
(
exoption
);
test
(
'
new THREE.ExtrudeGeometry with CylinderUVGenerator;
'
,
geom
);
</script>
</body>
</html>
examples/webgl_geometry_extrude_uvs2.html
已删除
100644 → 0
浏览文件 @
c4664318
<!DOCTYPE html>
<html
lang=
"en"
id=
"html-el"
>
<head>
<title>
three.js webgl - UV mapped ExtrudeGeometry
</title>
<script
type=
"text/javascript"
src=
"../build/three.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/utils/UVsUtils.js"
></script>
<script
type=
"text/javascript"
>
(
function
(){
'
use strict
'
;
var
tex
;
var
testShape
;
var
holeShape
;
var
testMesh
=
null
;
var
WIDTH
=
640
;
var
HEIGHT
=
480
;
var
targetCanvas
;
var
uvGenerator
;
var
scene
,
renderer
,
camera
;
var
rX
=
0
;
var
rY
=
0
;
window
.
launch
=
function
()
{
camera
=
new
THREE
.
PerspectiveCamera
(
30
,
WIDTH
/
HEIGHT
,
1
,
10000
);
camera
.
position
.
z
=
20
;
scene
=
new
THREE
.
Scene
();
/** Custom UV mapper **/
uvGenerator
=
new
THREE
.
UVsUtils
.
CylinderUVGenerator
();
testShape
=
setupShape
(
8
,
3
);
holeShape
=
setupShape
(
8
,
2
);
testShape
.
holes
.
push
(
holeShape
);
tex
=
setupTexture
(
TestTextureData
);
renewMesh
();
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
WIDTH
,
HEIGHT
);
// show canvas
targetCanvas
=
renderer
.
domElement
;
/// Don't add it
//targetCanvas.width = WIDTH;
//targetCanvas.height = HEIGHT;
document
.
getElementById
(
'
canvas-container
'
).
appendChild
(
targetCanvas
);
setupAnimation
();
render
();
};
function
setupAnimation
(
n
)
{
new
AnimationController
(
document
.
getElementById
(
'
html-el
'
),
function
(
x
,
y
)
{
rX
=
x
;
rY
=
y
;
render
();
});
}
function
updateRotation
()
{
rX
=
(
rX
+
3600
)
%
360
;
rY
=
(
rY
+
3600
)
%
360
;
testMesh
.
rotation
.
set
(
THREE
.
Math
.
degToRad
(
rY
),
0
,
THREE
.
Math
.
degToRad
(
rX
)
);
}
function
render
()
{
if
(
testMesh
)
{
var
rx
=
pickRepeatSetting
();
if
(
uvGenerator
.
uRepeat
!=
rx
)
{
uvGenerator
.
uRepeat
=
rx
;
renewMesh
();
}
updateRotation
();
renderer
.
render
(
scene
,
camera
);
}
}
function
pickRepeatSetting
()
{
var
radios
=
document
.
getElementById
(
'
repeat-setting
'
).
repeat
;
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
if
(
radios
[
i
].
checked
)
{
return
radios
[
i
].
value
-
0
;
}
}
return
1
;
}
function
setupShape
(
n
,
r
)
{
// Make shape
var
sh
=
new
THREE
.
Shape
();
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
method
=
i
?
'
lineTo
'
:
'
moveTo
'
;
var
a
=
(
i
/
n
)
*
Math
.
PI
*
2
;
var
x
=
Math
.
cos
(
a
)
*
r
;
var
y
=
Math
.
sin
(
a
)
*
r
;
sh
[
method
](
x
,
y
);
}
return
sh
;
}
function
setupGeometry
(
shape
)
{
// Make extruded geometory
var
exoption
=
{
bevelEnabled
:
true
,
bevelSize
:
1
,
amount
:
3
,
extrudeMaterial
:
0
,
material
:
1
,
uvGenerator
:
uvGenerator
};
var
geom
=
shape
.
extrude
(
exoption
);
return
geom
;
}
function
setupTexture
(
dat
)
{
var
img
=
new
Image
();
var
t
=
new
THREE
.
Texture
(
img
);
t
.
wrapS
=
THREE
.
RepeatWrapping
;
img
.
onload
=
function
()
{
t
.
needsUpdate
=
true
;
render
();
};
img
.
src
=
dat
;
return
t
;
}
function
setupMesh
(
geom
,
side_texture
)
{
var
materials
=
[
new
THREE
.
MeshBasicMaterial
(
{
map
:
side_texture
}
),
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x447766
}
)
];
var
mesh
=
new
THREE
.
Mesh
(
geom
,
new
THREE
.
MeshFaceMaterial
(
materials
));
scene
.
add
(
mesh
);
return
mesh
;
}
function
renewMesh
()
{
if
(
testMesh
)
{
scene
.
remove
(
testMesh
);
}
testMesh
=
setupMesh
(
setupGeometry
(
testShape
)
,
tex
);
testMesh
.
position
.
set
(
0
,
0
,
-
30
);
}
function
AnimationController
(
target
,
callback
)
{
var
_this
=
this
;
this
.
callback
=
callback
;
target
.
addEventListener
(
'
mousemove
'
,
function
(
e
)
{
_this
.
onMouseMove
(
e
);
},
false
);
}
AnimationController
.
prototype
=
{
onMouseMove
:
function
(
e
)
{
this
.
callback
(
e
.
clientX
,
e
.
clientY
);
}
};
var
TestTextureData
=
'
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAAXNSR0IArs4c6QAAADBQTFRFB1B5B1iEA16QAGCPAGaWE2WXJHJMJntSLoJVKopbQX+fMJBgLZlnbZuyZaiGgrCY0v66KwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wEEBE0NIvLSa4AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAa7ElEQVR42u1cTWwbR5YuUuIlQAA2qb4YEMCm3JcBDEhyeBlgAdsJLwECsJus41xlEiImN0eCCeQmk2AjvlFssDDJZmcvAXS1SbAx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YJT13uXVyztg3Nq66dWZxaOVnNbVvkwefX0gJw7mX9h/YfG6dvGB7Lz9/sPfpT4QD1/oPKCM0N7/7YFn7gnDAC2fYrMmMtuGLDdqGZ8YnCgl/TUsg8eYFrTC+oLyP1R7CVUoDi+SHtP8ALvw5FMZymfUf2Hzh/pqW4Eu88R/4mJ+v9x9Qu+Dkq42T33svkx+TrpR/wC8pXl588j3/6GR5/hFvfQNfUG/9Jbn4i/zDy4sfoSTpJwFfOi3cwe9hQMvffO9yb/Hyx7T/wLfJBfUfODnPCnp/8z3HlRd/gQlAM/iY/6H+A4uXwT+2/8DRxT+4/8CXP/+D+w+8/HHVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf2DVf+D/V/+B/wT15JbOMyhx1QAAAABJRU5ErkJggg==
'
;
})();
</script>
</head>
<body
onload=
"launch()"
>
<div>
<form
id=
"repeat-setting"
>
U repeat:
<label><input
type=
"radio"
value=
"1"
name=
"repeat"
checked=
"checked"
>
1x
</label>
<label><input
type=
"radio"
value=
"2"
name=
"repeat"
>
2x
</label>
<label><input
type=
"radio"
value=
"3"
name=
"repeat"
>
3x
</label>
</form>
</div>
<div
id=
"canvas-container"
></div>
</body>
</html>
src/extras/geometries/ExtrudeGeometry.js
浏览文件 @
be75f8a5
...
...
@@ -495,7 +495,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
for
(
i
=
0
;
i
<
flen
;
i
++
)
{
face
=
faces
[
i
];
f3
(
face
[
2
]
+
offset
,
face
[
1
]
+
offset
,
face
[
0
]
+
offset
,
true
);
f3
(
face
[
2
]
+
offset
,
face
[
1
]
+
offset
,
face
[
0
]
+
offset
);
}
...
...
@@ -507,7 +507,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
for
(
i
=
0
;
i
<
flen
;
i
++
)
{
face
=
faces
[
i
];
f3
(
face
[
0
]
+
offset
,
face
[
1
]
+
offset
,
face
[
2
]
+
offset
,
false
);
f3
(
face
[
0
]
+
offset
,
face
[
1
]
+
offset
,
face
[
2
]
+
offset
);
}
...
...
@@ -518,7 +518,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
for
(
i
=
0
;
i
<
flen
;
i
++
)
{
face
=
faces
[
i
];
f3
(
face
[
2
],
face
[
1
],
face
[
0
]
,
true
);
f3
(
face
[
2
],
face
[
1
],
face
[
0
]
);
}
...
...
@@ -527,7 +527,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
for
(
i
=
0
;
i
<
flen
;
i
++
)
{
face
=
faces
[
i
];
f3
(
face
[
0
]
+
vlen
*
steps
,
face
[
1
]
+
vlen
*
steps
,
face
[
2
]
+
vlen
*
steps
,
false
);
f3
(
face
[
0
]
+
vlen
*
steps
,
face
[
1
]
+
vlen
*
steps
,
face
[
2
]
+
vlen
*
steps
);
}
}
...
...
@@ -593,7 +593,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
}
function
f3
(
a
,
b
,
c
,
isBottom
)
{
function
f3
(
a
,
b
,
c
)
{
a
+=
shapesOffset
;
b
+=
shapesOffset
;
...
...
@@ -602,7 +602,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
// normal, color, material
scope
.
faces
.
push
(
new
THREE
.
Face3
(
a
,
b
,
c
,
null
,
null
,
material
)
);
var
uvs
=
isBottom
?
uvgen
.
generateBottomUV
(
scope
,
shape
,
options
,
a
,
b
,
c
)
:
uvgen
.
generateTopUV
(
scope
,
shape
,
options
,
a
,
b
,
c
);
var
uvs
=
uvgen
.
generateTopUV
(
scope
,
a
,
b
,
c
);
scope
.
faceVertexUvs
[
0
].
push
(
uvs
);
...
...
@@ -618,8 +618,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
scope
.
faces
.
push
(
new
THREE
.
Face3
(
a
,
b
,
d
,
null
,
null
,
extrudeMaterial
)
);
scope
.
faces
.
push
(
new
THREE
.
Face3
(
b
,
c
,
d
,
null
,
null
,
extrudeMaterial
)
);
var
uvs
=
uvgen
.
generateSideWallUV
(
scope
,
shape
,
wallContour
,
options
,
a
,
b
,
c
,
d
,
stepIndex
,
stepsLength
,
contourIndex1
,
contourIndex2
);
var
uvs
=
uvgen
.
generateSideWallUV
(
scope
,
a
,
b
,
c
,
d
);
scope
.
faceVertexUvs
[
0
].
push
(
[
uvs
[
0
],
uvs
[
1
],
uvs
[
3
]
]
);
scope
.
faceVertexUvs
[
0
].
push
(
[
uvs
[
1
],
uvs
[
2
],
uvs
[
3
]
]
);
...
...
@@ -630,11 +629,13 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
THREE
.
ExtrudeGeometry
.
WorldUVGenerator
=
{
generateTopUV
:
function
(
geometry
,
extrudedShape
,
extrudeOptions
,
indexA
,
indexB
,
indexC
)
{
var
a
=
geometry
.
vertices
[
indexA
];
var
b
=
geometry
.
vertices
[
indexB
];
var
c
=
geometry
.
vertices
[
indexC
];
generateTopUV
:
function
(
geometry
,
indexA
,
indexB
,
indexC
)
{
var
vertices
=
geometry
.
vertices
;
var
a
=
vertices
[
indexA
];
var
b
=
vertices
[
indexB
];
var
c
=
vertices
[
indexC
];
return
[
new
THREE
.
Vector2
(
a
.
x
,
a
.
y
),
...
...
@@ -644,20 +645,14 @@ THREE.ExtrudeGeometry.WorldUVGenerator = {
},
generateBottomUV
:
function
(
geometry
,
extrudedShape
,
extrudeOptions
,
indexA
,
indexB
,
indexC
)
{
return
this
.
generateTopUV
(
geometry
,
extrudedShape
,
extrudeOptions
,
indexA
,
indexB
,
indexC
);
},
generateSideWallUV
:
function
(
geometry
,
indexA
,
indexB
,
indexC
,
indexD
)
{
generateSideWallUV
:
function
(
geometry
,
extrudedShape
,
wallContour
,
extrudeOptions
,
indexA
,
indexB
,
indexC
,
indexD
,
stepIndex
,
stepsLength
,
contourIndex1
,
contourIndex2
)
{
var
vertices
=
geometry
.
vertices
;
var
a
=
geometry
.
vertices
[
indexA
];
var
b
=
geometry
.
vertices
[
indexB
];
var
c
=
geometry
.
vertices
[
indexC
];
var
d
=
geometry
.
vertices
[
indexD
];
var
a
=
vertices
[
indexA
];
var
b
=
vertices
[
indexB
];
var
c
=
vertices
[
indexC
];
var
d
=
vertices
[
indexD
];
if
(
Math
.
abs
(
a
.
y
-
b
.
y
)
<
0.01
)
{
return
[
...
...
src/extras/geometries/ShapeGeometry.js
浏览文件 @
be75f8a5
...
...
@@ -126,7 +126,7 @@ THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) {
var
c
=
face
[
2
]
+
shapesOffset
;
this
.
faces
.
push
(
new
THREE
.
Face3
(
a
,
b
,
c
,
null
,
null
,
material
)
);
this
.
faceVertexUvs
[
0
].
push
(
uvgen
.
generate
BottomUV
(
this
,
shape
,
option
s
,
a
,
b
,
c
)
);
this
.
faceVertexUvs
[
0
].
push
(
uvgen
.
generate
TopUV
(
thi
s
,
a
,
b
,
c
)
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录