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;
}
});
}
}
}
onupdateobject = function (userObject, deltatime) {
var pt = userObject.getPosition();
$("#txtLabel").text("좌표: (" + pt.x.toFixed(6) + ", " + pt.y.toFixed(6) + ", " + pt.z.toFixed(1) + ")");
}
createCube3DLayer2 = function ()
{
flyCubeLayer = cmworld.addCube3DLayer("fly", "http://demo.cmworld.net/cube3d/cbr_vector/{z}/{y}/{x}/{y}_{x}_{f}.cbr", 0, 16, -10, 10000, 4194304, "vector", "cbr");
flyCubeLayer.renderFrame = true;
flyCubeLayer.renderOnlyFrame = false;
// 사용자 객체를 만들자
var geo = new THREE.SphereGeometry(1);
var material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
var mesh = new THREE.Mesh(geo, material);
flycenter = new CMWORLD.UserObject("fly", mesh, new THREE.Vector3(127.02992490492944, 37.49314254229226, 10), onupdateobject );
userLayer.add(flycenter);
//flyCubeLayer.addTargetCamera("camera", 16, 200);
flyCubeLayer.addTargetObject("fly", flycenter, 16, 10);
/*
지표 = 0
하늘 = 1
바다 = -2
땅속 = 21 ~ 26
*/
}
makeClipbox = function ()
{
var localgeo = new THREE.BoxGeometry(100, 100, 100);
var localmesh = new THREE.Mesh(localgeo, new THREE.MeshPhongMaterial({ color: 0xffffff, opacity: 0.2, transparent: true }));
cmworld.clipBox.localMesh = localmesh;
cmworld.clipBox.setLocalPosition(37.498077610324195, 127.0274561940137, 62.15379375000016);
cmworld.clipBox.needLocalClipboxUpdate = true;
cmworld.rootScene.add(cmworld.clipBox.localMesh);
cmworld.clipBox.localClipboxEnabled = true;
}
checkFly = function ()
{
if (flypass == undefined)
{
var pathpoints = [];
pathpoints.push(new THREE.Vector3(127.02992490492944, 37.49314254229226, 20)),
pathpoints.push(new THREE.Vector3(127.02945098278445, 37.49412820422488, 40)),
pathpoints.push(new THREE.Vector3(127.02945098278445, 37.49412820422488, 80)),
pathpoints.push(new THREE.Vector3(127.02789657061916, 37.497385165373416, 20)),
pathpoints.push(new THREE.Vector3(127.02713379383667, 37.49716289011995, 40)),
pathpoints.push(new THREE.Vector3(127.0281612963301, 37.49503707804059, 50)),
pathpoints.push(new THREE.Vector3(127.0290934000677, 37.4931661423123, 30)),
pathpoints.push(new THREE.Vector3(127.02992490492944, 37.49314254229226, 20)),
flypass = new THREE.CatmullRomCurve3(pathpoints);
}
}
checkAnimate = function ()
{
if (animatepass == undefined)
{
var pathpoints = [];
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 62.15379375000016)),
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 30)),
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 0)),
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 50)),
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 100)),
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 17.770679811947048)),
pathpoints.push(new THREE.Vector3(127.02419248142476, 37.49716467964495, 12.214464443735778)),
pathpoints.push(new THREE.Vector3(127.0228035873738, 37.49983570161439, 12.821062065660954)),
pathpoints.push(new THREE.Vector3(127.028660924021, 37.50111859808611, 36.06227322015911)),
pathpoints.push(new THREE.Vector3(127.03020520787288, 37.496981317930754, 28.27079238090664)),
pathpoints.push(new THREE.Vector3(127.02899277466136, 37.4960762939164, 18.820372722111642)),
pathpoints.push(new THREE.Vector3(127.02726693707825, 37.494954961783975, 16.878087333403528)),
pathpoints.push(new THREE.Vector3(127.02611874148117, 37.49615467408969, 15.145359858870506)),
pathpoints.push(new THREE.Vector3(127.02608512216023, 37.49859802318132, 16.248056579381227)),
pathpoints.push(new THREE.Vector3(127.02700778314758, 37.49820433203146, 17.17902781162411)),
pathpoints.push(new THREE.Vector3(127.0274561940137, 37.498077610324195, 17.770679811947048)),
animatepass = new THREE.CatmullRomCurve3(pathpoints);
}
}