The tutorial demonstrates how three.js model for geometry can be created and displayed.
In geom_threejs.cxx one uses RGeomDescription class from geometry viewer, which produces JSON data with all necessary information. Then RWebWindow is started and this information provided. In client.html one uses build function to create Object3D with geometry Then such object placed in three.js scene and rendered. Also simple animation is implemented
std::shared_ptr<ROOT::RWebWindow> window;
void ProcessData(unsigned connid, const std::string &arg)
{
if (arg == "get") {
window->Send(connid, base64.
Data());
} else if (arg == "halt") {
window->TerminateROOT();
}
}
void geom_threejs()
{
std::string fdir = __FILE__;
auto pos = fdir.find(
"geom_threejs.cxx");
if (pos > 0)
fdir.resize(pos);
else
fdir =
gROOT->GetTutorialsDir() + std::string(
"/visualisation/webgui/geom/");
window->SetDefaultPage("file:" + fdir + "geom_threejs.html");
window->SetDataCallBack(ProcessData);
window->SetGeometry(800, 600);
window->Show();
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
externTGeoManager * gGeoManager
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
static TString Encode(const char *data)
Transform data into a null terminated base64 string.
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
const char * Data() const
- Author
- Sergey Linev
Definition in file geom_threejs.cxx.