Initialization
초기화 하기 위해서는 onConfiguration | onBefore | onInit 함수들이 필요 합니다.
let option = {
event : {
// 초기화가 완료 된 후 콜백 함수
onInit : onInit,
// 전 처리 하는 콜백 함수
onBefore : onBefore,
// 초기 환경설정을 변경하는 콜백 함수
onConfiguration : onConfiguration,
}
}
vizcore.Init(option);
onConfiguration
초기 환경설정을 변경하고 싶다면, onConfiguration에서 적용하여 사용할 수 있습니다.
let onConfiguration = () => {
// VIZCore 경로 설정
vizcore.Configuration.Default.Path = "./VIZCore3D/";
// WebAssembly 경로 설정
vizcore.Configuration.Default.WebAssembly.Path = "./VIZCore3D/lib/shdcore/shdcore.wasm";
};
onBefore
VIZCore3D를 실행하기 전에 작업을 하고 싶다면, onBefore에서 작업할 수 있습니다.
let onBefore = () => {
// 전 처리 작업시 사용
};
onInit
VIZCore3D를 실행 시 작업을 하고 싶다면, onInit에서 작업할 수 있습니다.
let onInit = ()=>{
// ContextMenu 사용
let context = new vizcore.ContextMenu(view, vizcore, VIZCore);
// Add Event Handler : Progress Event (로딩 이벤트)
vizcore.Model.OnStreamProgressChangedEvent(function(e){
// console.log("Total : ", e.data.total, "Current : ", e.data.current, "Percentage : ", e.data.percentage);
});
// Add Event Handler : Object Selected Event (모델 선택 이벤트)
vizcore.Object3D.OnObject3DSelected(onSelectEvent);
// View Info 확인
let OnViewDrawInfo = function (event) {
// console.log(event.data);
}
vizcore.View.OnViewDrawInfoEvent(OnViewDrawInfo);
// 분할 VIZW 모델 파일 열기
// vizcore.Model.OpenHeader("./VIZCore3D/Model/toycar/vizw/toycar_wh.vizw", "Sample", onModelLoadingCompleted);
// 단일 VIZW 모델 파일 열기
// vizcore.Model.Open("./VIZCore3D/Model/toycar.vizw");
};
Last modified: 23 January 2025