Merge branch 'master' into master
This commit is contained in:
commit
d625ca61a5
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdb filter=lfs diff=lfs merge=lfs -text
|
BIN
20210129/demo - wpf/D3DCompiler_47_cor3.dll
Normal file
BIN
20210129/demo - wpf/D3DCompiler_47_cor3.dll
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/PenImc_cor3.dll
Normal file
BIN
20210129/demo - wpf/PenImc_cor3.dll
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/PresentationNative_cor3.dll
Normal file
BIN
20210129/demo - wpf/PresentationNative_cor3.dll
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/RenderApp.exe
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/RenderApp.exe
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/clrcompression.dll
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/clrcompression.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/clrjit.dll
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/clrjit.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/coreclr.dll
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/coreclr.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/mscordaccore.dll
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/mscordaccore.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/vcruntime140_cor3.dll
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/vcruntime140_cor3.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
20210129/demo - wpf/wpfgfx_cor3.dll
(Stored with Git LFS)
Normal file
BIN
20210129/demo - wpf/wpfgfx_cor3.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -10,5 +10,7 @@
|
||||
|
||||
5. 运行wamp程序,浏览器输入网址:[http://localhost/demo/index.html](http://localhost/demo/index.html)
|
||||
|
||||
6. 多个网格组成的构件,可以将构件的mesh值改为数组形式,里面放入多个网格位置索引
|
||||
|
||||
# Q&A记录
|
||||
|
||||
|
@ -20,7 +20,7 @@ BIMLoader = function(json)
|
||||
var scene = new THREE.Scene();
|
||||
|
||||
json.instances.forEach(element => {
|
||||
var object = ParseInstance(element, meshes[element.mesh]);
|
||||
var object = ParseInstance(element, meshes, element.mesh);
|
||||
scene.add(object);
|
||||
});
|
||||
|
||||
@ -55,7 +55,7 @@ BIMLoader = function(json)
|
||||
return geometry;
|
||||
}
|
||||
|
||||
function ParseInstance(instanceJson, mesh)
|
||||
function ParseInstance(instanceJson, meshes, index)
|
||||
{
|
||||
var obj = new THREE.Object3D();
|
||||
|
||||
@ -77,13 +77,26 @@ BIMLoader = function(json)
|
||||
if(instanceJson.info)
|
||||
obj.userData = instanceJson.info;
|
||||
|
||||
// 边框
|
||||
var edges = new THREE.EdgesGeometry(mesh.geometry);
|
||||
var line = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({color: 0xff0000}));
|
||||
|
||||
obj.add(mesh);
|
||||
obj.add(line);
|
||||
if(Array.isArray(index))
|
||||
{
|
||||
index.forEach(element => {
|
||||
PutMesh(meshes[element], obj);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
PutMesh(meshes[index], obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function PutMesh(mesh, obj)
|
||||
{
|
||||
var edges = new THREE.EdgesGeometry(mesh.geometry);
|
||||
var line = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({color: 0xff0000}));
|
||||
|
||||
obj.add(mesh);
|
||||
obj.add(line);
|
||||
}
|
||||
}
|
@ -28,8 +28,15 @@ loader.load(
|
||||
var bimScene = BIMLoader(JSON.parse(data));
|
||||
var box = new THREE.Box3();
|
||||
box.expandByObject(bimScene);
|
||||
box.expandByScalar(10000);
|
||||
var cameraPos = new THREE.Vector3(box.min.x, box.min.y, box.max.z);
|
||||
var center = new THREE.Vector3();
|
||||
box.getCenter(center);
|
||||
var size = new THREE.Vector3();
|
||||
box.getSize(size);
|
||||
var result = size.x > size.y ? size.x : size.y;
|
||||
result = result > size.z ? result : size.z;
|
||||
var maxLength = Math.round(result);
|
||||
var radius = center.distanceTo(new THREE.Vector3(center.x + (maxLength/2), center.y + (maxLength/2), center.z + (maxLength/2)));
|
||||
var cameraPos = new THREE.Vector3(center.x + radius * Math.cos(Math.PI/18) * Math.cos(Math.PI/4), center.y - radius * Math.cos(Math.PI/18) * Math.sin(Math.PI/4), center.z + radius * Math.sin(Math.PI/18));
|
||||
camera.position.copy(cameraPos);
|
||||
controls.target = box.getCenter();
|
||||
scene.add(bimScene);
|
||||
|
Loading…
Reference in New Issue
Block a user