Skip to content

[REve] Update to RenderCore release from github, deploy it as builtin tarball #11936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added builtins/rendercore/RenderCore.tar.gz
Binary file not shown.
11 changes: 11 additions & 0 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,17 @@ if(webgui)
endif()
install(DIRECTORY ${CMAKE_BINARY_DIR}/ui5/distribution/ DESTINATION ${CMAKE_INSTALL_OPENUI5DIR}/distribution/ COMPONENT libraries FILES_MATCHING PATTERN "*")
endif()
ExternalProject_Add(
RENDERCORE
URL ${CMAKE_SOURCE_DIR}/builtins/rendercore/RenderCore.tar.gz
URL_HASH SHA256=a0b1cc0d4e8d739b113ace87e33de77572cf019772899549cb082088943513e1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
SOURCE_DIR ${CMAKE_BINARY_DIR}/ui5/eve7/rcore
TIMEOUT 600
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/ui5/eve7/rcore/ DESTINATION ${CMAKE_INSTALL_OPENUI5DIR}/eve7/rcore/ COMPONENT libraries FILES_MATCHING PATTERN "*")
endif()

#------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions graf3d/eve7/inc/ROOT/REveCalo.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public:

virtual ~REveCaloViz();

bool RequiresExtraSelectionData() const override { return true; };
virtual REveElement* ForwardSelection();
virtual REveElement* ForwardEdit();

Expand Down
8 changes: 6 additions & 2 deletions graf3d/eve7/inc/ROOT/REveDataCollection.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class REveDataCollection : public REveElement
{
private:
REveDataItemList* fItemList{nullptr};
int fLayer{0};

public:
typedef std::vector<int> Ids_t;
Expand All @@ -138,8 +139,11 @@ public:


TClass *GetItemClass() const { return fItemClass; }
void SetItemClass(TClass *cls) { fItemClass = cls;
}
void SetItemClass(TClass *cls) { fItemClass = cls;}

int GetLayer() const { return fLayer; }
void SetLayer(int i) { fLayer = i; }

REveDataItemList* GetItemList() {return fItemList;}

void SetFilterExpr(const char* filter);
Expand Down
1 change: 0 additions & 1 deletion graf3d/eve7/inc/ROOT/REveDataProxyBuilderBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ protected:
private:
REveDataCollection *m_collection{nullptr};

float m_layer{0.};
bool m_haveWindow{false};
bool m_modelsChanged{false};
};
Expand Down
2 changes: 1 addition & 1 deletion graf3d/eve7/inc/ROOT/REveDigitSet.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public:
void NewShapePicked(int shapeId, Int_t selectionId, bool multi);


bool RequiresExtraSelectionData() const override { return true; };
bool RequiresExtraSelectionData() const override { return GetAlwaysSecSelect(); };
void FillExtraSelectionData(nlohmann::json& j, const std::set<int>& secondary_idcs) const override;

Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
Expand Down
5 changes: 5 additions & 0 deletions graf3d/eve7/inc/ROOT/REveManager.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ protected:

Logger fLogger;
REveServerStatus fServerStatus;
bool fIsRCore{false};

void WindowConnect(unsigned connid);
void WindowData(unsigned connid, const std::string &arg);
Expand Down Expand Up @@ -253,6 +254,9 @@ public:
static void ExecuteInMainThread(std::function<void()> func);
static void QuitRoot();

static void ErrorHandler(Int_t level, Bool_t abort, const char *location,
const char *msg);


// Access to internals, needed for low-level control in advanced
// applications.
Expand All @@ -266,6 +270,7 @@ public:
void Show(const RWebDisplayArgs &args = "");

void GetServerStatus(REveServerStatus&);
bool IsRCore() const { return fIsRCore; }
};

R__EXTERN REveManager* gEve;
Expand Down
5 changes: 4 additions & 1 deletion graf3d/eve7/inc/ROOT/REvePointSet.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <ROOT/REveElement.hxx>
#include <ROOT/REveProjectionBases.hxx>
#include <ROOT/REveVector.hxx>
#include <ROOT/REveSecondarySelectable.hxx>

#include <TAttMarker.h>
#include <TAttBBox.h>
Expand All @@ -34,7 +35,8 @@ namespace Experimental {
class REvePointSet : public REveElement,
public REveProjectable,
public TAttMarker,
public TAttBBox
public TAttBBox,
public REveSecondarySelectable
{
friend class REvePointSetArray;

Expand All @@ -45,6 +47,7 @@ protected:
std::vector<REveVector> fPoints;
int fCapacity{0};
int fSize{0};
int fTexX{0}, fTexY{0};

public:
REvePointSet(const std::string& name="", const std::string& title="", Int_t n_points = 0);
Expand Down
4 changes: 4 additions & 0 deletions graf3d/eve7/inc/ROOT/REveRenderData.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public:

const std::string GetRnrFunc() const { return fRnrFunc; }

void ResizeV(int s) { fVertexBuffer.resize(s); }

int SizeV() const { return fVertexBuffer.size(); }
int SizeN() const { return fNormalBuffer.size(); }
int SizeI() const { return fIndexBuffer.size(); }
Expand All @@ -98,6 +100,8 @@ public:
int GetBinarySize() { return (SizeV() + SizeN() + SizeT()) * sizeof(float) + SizeI() * sizeof(int); }

int Write(char *msg, int maxlen);

static void CalcTextureSize(int nel, int align, int &sx, int &sy);
};

} // namespace Experimental
Expand Down
13 changes: 7 additions & 6 deletions graf3d/eve7/inc/ROOT/REveSelection.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ protected:
Color_t fHiddenEdgeColor; ///<!

std::vector<int> fPickToSelect; ///<!
Bool_t fActive{kFALSE}; ///<!
Bool_t fIsMaster{kFALSE}; ///<!
bool fActive{true}; ///<!
bool fIsMaster{false}; ///<!
bool fIsHighlight{false}; ///<!

SelMap_t fMap; ///<!

Expand Down Expand Up @@ -120,14 +121,14 @@ public:
void SetVisibleEdgeColorRGB(UChar_t r, UChar_t g, UChar_t b);
void SetHiddenEdgeColorRGB(UChar_t r, UChar_t g, UChar_t b);

void SetHighlightMode();

const std::vector<int>& RefPickToSelect() const { return fPickToSelect; }
void ClearPickToSelect() { fPickToSelect.clear(); }
void AddPickToSelect(int ps) { fPickToSelect.push_back(ps); }

Bool_t GetIsMaster() const { return fIsMaster; }
void SetIsMaster(Bool_t m) { fIsMaster = m; }
bool GetIsMaster() const { return fIsMaster; }
void SetIsMaster(bool m) { fIsMaster = m; }
bool GetIsHighlight() const { return fIsHighlight; }
void SetIsHighlight(bool m) { fIsHighlight = m; }

std::shared_ptr<Deviator> GetDeviator() const { return fDeviator; }
void SetDeviator(std::shared_ptr<Deviator> d) { fDeviator = d; }
Expand Down
3 changes: 1 addition & 2 deletions graf3d/eve7/src/REveCalo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1393,13 +1393,12 @@ void REveCalo2D::MakeRPhiCell(Float_t phiMin, Float_t phiMax,
pnts[4] = r2*Cos(phiMax); pnts[5] = r2*Sin(phiMax);
pnts[6] = r1*Cos(phiMax); pnts[7] = r1*Sin(phiMax);

Float_t x, y, z;
for (Int_t i = 0; i < 4; ++i)
{
pntsOut[i*3] = pnts[2*i];
pntsOut[i*3+1] = pnts[2*i+1];
pntsOut[i*3+2] = 0.f;
fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
fManager->GetProjection()->ProjectPoint(pntsOut[3*i], pntsOut[3*i+1], pntsOut[3*i + 2], fDepth);
}
}

Expand Down
2 changes: 1 addition & 1 deletion graf3d/eve7/src/REveDataProxyBuilderBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void REveDataProxyBuilderBase::Build()
{
REveProjectionManager *pmgr = projectedProduct->GetManager();
Float_t oldDepth = pmgr->GetCurrentDepth();
pmgr->SetCurrentDepth(m_layer);
pmgr->SetCurrentDepth(m_collection->GetLayer());
Int_t cnt = 0;
REveElement *projectedProductAsElement = projectedProduct->GetProjectedAsElement();
// printf("projectedProduct children %d, product children %d\n", projectedProductAsElement->NumChildren(), product->NumChildren());
Expand Down
2 changes: 1 addition & 1 deletion graf3d/eve7/src/REveDigitSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ int REveDigitSet::GetShapeIdxFromAtomIdx(int iAtomIdx) const
}
}

printf("REveDigitSet::GetShapeIdxFromAtomIdx:: Atom with idx %d dose not have a visible shape \n", iAtomIdx);
printf("REveDigitSet::GetShapeIdxFromAtomIdx:: Atom with idx %d does not have a visible shape \n", iAtomIdx);
return -1;
}

Expand Down
38 changes: 32 additions & 6 deletions graf3d/eve7/src/REveManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ REveManager::REveManager()
fSelectionList->IncDenyDestroy();
fWorld->AddElement(fSelectionList);
fSelection = new REveSelection("Global Selection", "", kRed, kViolet);
fSelection->SetIsMaster(true);
fSelection->IncDenyDestroy();
fSelectionList->AddElement(fSelection);
fHighlight = new REveSelection("Global Highlight", "", kGreen, kCyan);
fHighlight->SetHighlightMode();
fHighlight->SetIsMaster(true);
fHighlight->SetIsHighlight(true);
fHighlight->IncDenyDestroy();
fSelectionList->AddElement(fHighlight);

Expand Down Expand Up @@ -142,13 +144,16 @@ REveManager::REveManager()
fWebWindow->UseServerThreads();
fWebWindow->SetDefaultPage("file:rootui5sys/eve7/index.html");

const char *gl_viewer = gEnv->GetValue("WebEve.GLViewer", "Three");
const char *gl_viewer = gEnv->GetValue("WebEve.GLViewer", "RCore");
const char *gl_dblclick = gEnv->GetValue("WebEve.DblClick", "Off");
Int_t htimeout = gEnv->GetValue("WebEve.HTimeout", 250);
Int_t table_row_height = gEnv->GetValue("WebEve.TableRowHeight", 0);
fWebWindow->SetUserArgs(Form("{ GLViewer: \"%s\", DblClick: \"%s\", HTimeout: %d, TableRowHeight: %d }", gl_viewer,
gl_dblclick, htimeout, table_row_height));

if (strcmp(gl_viewer, "RCore") == 0)
fIsRCore = true;

// this is call-back, invoked when message received via websocket
fWebWindow->SetCallBacks([this](unsigned connid) { WindowConnect(connid); },
[this](unsigned connid, const std::string &arg) { WindowData(connid, arg); },
Expand All @@ -158,6 +163,10 @@ REveManager::REveManager()
fWebWindow->SetMaxQueueLength(30); // number of allowed entries in the window queue

fMIRExecThread = std::thread{[this] { MIRExecThread(); }};

// activate interpreter error report
gInterpreter->ReportDiagnosticsToErrorHandler();
SetErrorHandler(ErrorHandler);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -939,20 +948,25 @@ void REveManager::PublishChanges()
jobj["content"] = "EndChanges";

if (!gEveLogEntries.empty()) {

constexpr static int numLevels = static_cast<int>(ELogLevel::kDebug) + 1;
constexpr static std::array<const char *, numLevels> sTag{
{"{unset-error-level please report}", "FATAL", "Error", "Warning", "Info", "Debug"}};
{"{unset-error-level please report}", "FATAL", "Error", "Warning", "Info", "Debug"}};

jobj["log"] = nlohmann::json::array();
std::stringstream strm;
for (auto entry : gEveLogEntries) {
nlohmann::json item = {};
item["lvl"] = entry.fLevel;
int cappedLevel = std::min(static_cast<int>(entry.fLevel), numLevels - 1);
strm << sTag[cappedLevel];
strm << "Server " << sTag[cappedLevel] << ":";

if (!entry.fLocation.fFuncName.empty())
strm << " " << entry.fLocation.fFuncName;
strm << " " << entry.fMessage;
item["msg"] = strm.str();
jobj["log"].push_back(item);
strm.clear();
}
jobj["log"] = strm.str();
gEveLogEntries.clear();
}

Expand Down Expand Up @@ -1112,6 +1126,18 @@ REveManager::ChangeGuard::~ChangeGuard()
gEve->EndChange();
}

// Error handler streams error-level messages to client log
void REveManager::ErrorHandler(Int_t level, Bool_t abort, const char * location, const char *msg)
{
if (level >= kError)
{
RLogEntry entry(ELogLevel::kError, REveLog());
entry.fMessage = msg;
gEveLogEntries.emplace_back(entry);
}
::DefaultErrorHandler(level, abort, location, msg);
}

/** \class REveManager::RExceptionHandler
\ingroup REve
Exception handler for Eve exceptions.
Expand Down
33 changes: 29 additions & 4 deletions graf3d/eve7/src/REvePointSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ REveProjectionManager class.

REvePointSet::REvePointSet(const std::string& name, const std::string& title, Int_t n_points) :
REveElement(name, title),
REveProjectable(),
TAttMarker(),
TAttBBox()
TAttBBox(),
REveSecondarySelectable()
{
fMarkerStyle = 20;

Expand All @@ -65,8 +67,11 @@ REvePointSet::REvePointSet(const REvePointSet& e) :
REveElement(e),
REveProjectable(e),
TAttMarker(e),
TAttBBox(e)
TAttBBox(e),
REveSecondarySelectable()
{
fAlwaysSecSelect = e.GetAlwaysSecSelect();
ClonePoints(e);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -208,10 +213,19 @@ TClass* REvePointSet::ProjectedClass(const REveProjection*) const

Int_t REvePointSet::WriteCoreJson(nlohmann::json& j, Int_t rnr_offset)
{
if (gEve->IsRCore())
REveRenderData::CalcTextureSize(fSize, 1, fTexX, fTexY);

Int_t ret = REveElement::WriteCoreJson(j, rnr_offset);

if (gEve->IsRCore()) {
j["fSize"] = fSize;
j["fTexX"] = fTexX;
j["fTexY"] = fTexY;
}
j["fMarkerSize"] = GetMarkerSize();
j["fMarkerColor"] = GetMarkerColor();
j["fSecondarySelect"] = fAlwaysSecSelect;

return ret;
}
Expand All @@ -223,8 +237,17 @@ void REvePointSet::BuildRenderData()
{
if (fSize > 0)
{
fRenderData = std::make_unique<REveRenderData>("makeHit", 3*fSize);
fRenderData->PushV(&fPoints[0].fX, 3*fSize);
if (gEve->IsRCore()) {
fRenderData = std::make_unique<REveRenderData>("makeHit", 4*fTexX*fTexY);
for (int i = 0; i < fSize; ++i) {
fRenderData->PushV(&fPoints[i].fX, 3);
fRenderData->PushV(0);
}
fRenderData->ResizeV(4*fTexX*fTexY);
} else {
fRenderData = std::make_unique<REveRenderData>("makeHit", 3*fSize);
fRenderData->PushV(&fPoints[0].fX, 3*fSize);
}
}
}

Expand Down Expand Up @@ -544,6 +567,8 @@ void REvePointSetProjected::UpdateProjection()
REvePointSet &ps = * dynamic_cast<REvePointSet*>(fProjectable);
REveTrans *tr = ps.PtrMainTrans(kFALSE);

fAlwaysSecSelect = ps.GetAlwaysSecSelect();

// XXXX rewrite

Int_t n = ps.GetSize();
Expand Down
18 changes: 18 additions & 0 deletions graf3d/eve7/src/REveRenderData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,21 @@ void REveRenderData::SetMatrix(const double *arr)
fMatrix.push_back(arr[i]);
}
}

/////////////////////////////////////////////////////////////////////////////////////////
/// Calculate texture dimensions to hold nel elements with given alignment on x axis.
/// Static function.
///
/// Implementation could be improved -- now it simply goes for near-square-root(size)
/// dimensions that satisfy the alignment requirement.

void REveRenderData::CalcTextureSize(int nel, int align, int &sx, int &sy)
{
if (nel <= 0) { sx = sy = 0; return; }

sx = (int) std::ceil(std::sqrt(nel));
int rx = sx % align;
if (rx > 0) sx += align - rx;
sy = nel / sx;
if (nel % sx > 0) sy += 1;
}
Loading