hilo3d 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/README_ZH.md +1 -1
- package/build/Hilo3d.js +3 -3
- package/build/Hilo3d.single.js +2 -2
- package/build/math.single.js +2 -2
- package/examples/js/NormalTangentHelper.js +54 -54
- package/examples/js/OrbitControls.js +291 -291
- package/examples/js/ltcTexture.json +3 -3
- package/examples/js/postProcess.js +295 -295
- package/examples/js/stats.js +66 -66
- package/examples/js/vconsole.min.js +7 -0
- package/package.json +1 -1
- package/types/index.d.ts +2 -2
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
(function(){
|
|
2
|
-
var NormalTangentHelper = {
|
|
3
|
-
create(mesh, size) {
|
|
4
|
-
if (!size) {
|
|
5
|
-
size = 1;
|
|
6
|
-
}
|
|
7
|
-
var node = new Hilo3d.Node();
|
|
8
|
-
var geometry = mesh.geometry;
|
|
9
|
-
var normals = geometry._normals;
|
|
10
|
-
var tangents = geometry._tangents;
|
|
11
|
-
var vertices = geometry.vertices;
|
|
12
|
-
|
|
13
|
-
var colors = [
|
|
14
|
-
[0, 0, 1],
|
|
15
|
-
[1, 0, 0]
|
|
16
|
-
];
|
|
17
|
-
[normals, tangents].forEach(function(info, index) {
|
|
18
|
-
if(info){
|
|
19
|
-
var color = colors[index];
|
|
20
|
-
var point1 = new Hilo3d.Vector3();
|
|
21
|
-
var point2 = new Hilo3d.Vector3();
|
|
22
|
-
var infoGeometry = new Hilo3d.Geometry({
|
|
23
|
-
mode: Hilo3d.constants.LINES
|
|
24
|
-
});
|
|
25
|
-
for (var i = 0; i < info.count; i++) {
|
|
26
|
-
infoGeometry.addLine(
|
|
27
|
-
point1.copy(vertices.get(i)).elements,
|
|
28
|
-
point2.copy(vertices.get(i)).scaleAndAdd(size, info.get(i)).elements
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var infoMesh = new Hilo3d.Mesh({
|
|
33
|
-
geometry: infoGeometry,
|
|
34
|
-
material: new Hilo3d.BasicMaterial({
|
|
35
|
-
lightType: 'NONE',
|
|
36
|
-
diffuse: new Hilo3d.Color(color[0], color[1], color[2])
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
node.addChild(infoMesh);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
node.matrix = mesh.matrix;
|
|
44
|
-
return node;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
if(typeof module !== 'undefined'){
|
|
49
|
-
module.exports = NormalTangentHelper;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if(typeof window !== 'undefined'){
|
|
53
|
-
window.NormalTangentHelper = NormalTangentHelper;
|
|
54
|
-
}
|
|
1
|
+
(function(){
|
|
2
|
+
var NormalTangentHelper = {
|
|
3
|
+
create(mesh, size) {
|
|
4
|
+
if (!size) {
|
|
5
|
+
size = 1;
|
|
6
|
+
}
|
|
7
|
+
var node = new Hilo3d.Node();
|
|
8
|
+
var geometry = mesh.geometry;
|
|
9
|
+
var normals = geometry._normals;
|
|
10
|
+
var tangents = geometry._tangents;
|
|
11
|
+
var vertices = geometry.vertices;
|
|
12
|
+
|
|
13
|
+
var colors = [
|
|
14
|
+
[0, 0, 1],
|
|
15
|
+
[1, 0, 0]
|
|
16
|
+
];
|
|
17
|
+
[normals, tangents].forEach(function(info, index) {
|
|
18
|
+
if(info){
|
|
19
|
+
var color = colors[index];
|
|
20
|
+
var point1 = new Hilo3d.Vector3();
|
|
21
|
+
var point2 = new Hilo3d.Vector3();
|
|
22
|
+
var infoGeometry = new Hilo3d.Geometry({
|
|
23
|
+
mode: Hilo3d.constants.LINES
|
|
24
|
+
});
|
|
25
|
+
for (var i = 0; i < info.count; i++) {
|
|
26
|
+
infoGeometry.addLine(
|
|
27
|
+
point1.copy(vertices.get(i)).elements,
|
|
28
|
+
point2.copy(vertices.get(i)).scaleAndAdd(size, info.get(i)).elements
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var infoMesh = new Hilo3d.Mesh({
|
|
33
|
+
geometry: infoGeometry,
|
|
34
|
+
material: new Hilo3d.BasicMaterial({
|
|
35
|
+
lightType: 'NONE',
|
|
36
|
+
diffuse: new Hilo3d.Color(color[0], color[1], color[2])
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
node.addChild(infoMesh);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
node.matrix = mesh.matrix;
|
|
44
|
+
return node;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if(typeof module !== 'undefined'){
|
|
49
|
+
module.exports = NormalTangentHelper;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if(typeof window !== 'undefined'){
|
|
53
|
+
window.NormalTangentHelper = NormalTangentHelper;
|
|
54
|
+
}
|
|
55
55
|
})();
|