3D 입체격자를 사용하여 지상뿐만이 아니라 지하의 구조물등을 표현할 수 있게 되었습니다.
JS SCRIPT
setClipState = function (obj, enabled)
{
if (obj)
{
if (obj instanceof THREE.Object3D)
{
obj.traverse(function (child)
{
if (child instanceof THREE.Mesh)
{
var mat = child.material;
mat["clipping"] = enabled;
if (enabled == true)
{
mat["clippingPlanes"] = cmworld.clipBox.localPlanes;
mat["clipIntersection"] = cmworld.clipBox.clipIntersection;
}
else
{
mat["clippingPlanes"] = cmworld.clipBox.hidePlanes;
mat["clipIntersection"] = cmworld.clipBox.clipIntersection;
}
mat.needsUpdate = true;
child.needsUpdate = true;
}
});
}
}
}
createCube3DLayer = function ()
{
undergroundCubeLayer = cmworld.addCube3DLayer("underground", "http://demo.cmworld.net/cube3d/cbr/{z}/{y}/{x}/{y}_{x}_{f}.cbr", 0, 14, -10, 10000, 4194304, "raster", "cbr");
undergroundCubeLayer.renderFrame = true;
undergroundCubeLayer.renderOnlyFrame = false;
undergroundCubeLayer.pointColors[21] = new THREE.Color(0x6fBF44);
undergroundCubeLayer.pointColors[22] = new THREE.Color(0x54272A);
undergroundCubeLayer.pointColors[23] = new THREE.Color(0x578700);
undergroundCubeLayer.pointColors[24] = new THREE.Color(0xB97536);
undergroundCubeLayer.pointColors[25] = new THREE.Color(0xBF9C86);
undergroundCubeLayer.pointColors[26] = new THREE.Color(0x6C5E5B);
// 사용자 객체를 만들자
var geo = new THREE.SphereGeometry(0.01);
var material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
var mesh = new THREE.Mesh(geo, material);
mesh.frustumCulled = false;
clippingcenter = new CMWORLD.UserObject("center", mesh, new THREE.Vector3(127.06125831338251, 37.4740406463569, 60), null);
userLayer.add(clippingcenter);
//undergroundCubeLayer.addTargetCamera("camera", 14, 100);
undergroundCubeLayer.addTargetObject("center", clippingcenter, 14, 200);
undergroundTarget = undergroundCubeLayer.targetObject["center"];
/*
지표 = 0
하늘 = 1
바다 = -2
땅속 = 21 ~ 26
*/
}