WebGL での 3D データ表示
さらに,以前作成した Web サーバ を利用して WebGL での表示に.
bool test (void)
{
Vd2A pts ;
{
pts.push_back(Vd2( 0, 0)) ;
pts.push_back(Vd2( 70, 0)) ;
pts.push_back(Vd2( 90, 50)) ;
pts.push_back(Vd2(100,100)) ;
pts.push_back(Vd2( 50,100)) ;
pts.push_back(Vd2( 30, 70)) ;
pts.push_back(Vd2( 40, 30)) ;
pts.push_back(Vd2( 0, 0)) ;
}
vv_PLF vvplf ;
{
Vd3A v3a = ::ToVd3A(pts) ;
Vd4A v4a = ::ToVd4A(v3a) ;
PLF plf_l(PLF::line,v4a) ;
PLF plf_f(PLF::face,v4a) ;
v_PLF v_plf ;
v_plf.push_back(plf_l) ;
v_plf.push_back(plf_f) ;
vvplf.push_back(v_plf) ;
}
{
tstring tmp_path = ::Get_i_Tools_tmp_date() ;
tstring out_name = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T("__.htm") ;
tstring outtname = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T("_t.htm") ;
tstring outnname = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T("_n.htm") ;
{
GonsA gnsa = ::PLF_ToGonsA(vvplf) ;
::GonsA_ToWGL(gnsa,out_name.c_str()) ;
gnsa = ::GonsA_Triangulation(gnsa) ;
::GonsA_ToWGL(gnsa,outtname.c_str()) ;
gnsa = ::GonsA_CalcNormal (gnsa) ;
::GonsA_ToWGL(gnsa,outnname.c_str()) ;
}
{
::start_web_server(tmp_path) ;
}
}
tstring g3_d_exe = ::get_g3_d_exe() ;
if (!g3_d_exe.empty()) {
tstring tmp_path = ::Get_i_Tools_tmp_date() ;
tstring ipl_name = ::Path_AddLastSP(tmp_path) + ::Now_Format(_T("%H%M%S")) + _T(".ipl") ;
::To_ipl (vvplf,ipl_name.c_str()) ;
::start_g3_d(ipl_name.c_str()) ;
}
return true ;
}