Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -13,7 +13,6 @@ GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
|
||||
GLOBLIBS += libG4intercoms.lib libG4global.lib
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
# include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/management/include
|
||||
@@ -23,14 +22,19 @@ CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
|
||||
CPPFLAGS += -I$(G4BASE)/intercoms/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
|
||||
CPPFLAGS += -I$(G4BASE)/tracking/include
|
||||
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
|
||||
|
||||
# Locally adjust source list before including common.gmk
|
||||
sources := src/G4ToolsSGSceneHandler.cc
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/externals/g4tools/include
|
||||
sources += src/G4ToolsSGOffscreen.cc
|
||||
|
||||
ifdef G4VIS_BUILD_TOOLSSG_X11_GLES_DRIVER
|
||||
sources += src/G4ToolsSGX11GLES.cc
|
||||
endif
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
# Category vis_toolssg History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (vis_toolssg-V11-00-15)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-28 John Allison (vis_toolssg-V11-00-14)
|
||||
- Request kernel visit when cutaway mode changes:
|
||||
- G4ToolsSGViewer.hh
|
||||
|
||||
## 2022-10-13 Guy Barrand (vis_toolssg-V11-00-13)
|
||||
- new offscreen sub-driver.
|
||||
- new files: include/G4ToolsSGOffscreen.hh, include/G4ToolsSGOffscreenViewer.hh and src/G4ToolsSGOffscreen.cc.
|
||||
- sources.cmake, GNUmakefile: G4ToolsSGOffscreen .hh and .cc files.
|
||||
- G4ToolsSGViewer.hh: handle ambient lightening.
|
||||
- G4ToolsSGViewer.hh: for "write paper", handle zb_png, zb_jpeg formats.
|
||||
- G4ToolsSGViewer.hh: correct fSGViewer->set_clear_color(). The passed "green" was... blue.
|
||||
|
||||
## 2022-09-06 Ben Morgan (vis_toolssg-V11-00-12)
|
||||
- Address dependency inconsistencies reported by geant4_module_check
|
||||
|
||||
## 2022-05-18 Guy Barrand (vis_toolssg-V11-00-11)
|
||||
- have "toolx" namespace for g4tools code related to "externals", then:
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 09th June 2022
|
||||
|
||||
#ifndef G4TOOLSSOFFSCREEN_HH
|
||||
#define G4TOOLSSOFFSCREEN_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace tools {namespace offscreen {class session;}}
|
||||
|
||||
class G4ToolsSGOffscreen: public G4VGraphicsSystem {
|
||||
typedef G4VGraphicsSystem parent;
|
||||
public:
|
||||
G4ToolsSGOffscreen();
|
||||
virtual ~G4ToolsSGOffscreen();
|
||||
protected:
|
||||
G4ToolsSGOffscreen(const G4ToolsSGOffscreen& a_from):parent(a_from){}
|
||||
G4ToolsSGOffscreen& operator=(const G4ToolsSGOffscreen&) {return *this;}
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
tools::offscreen::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,404 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 09th June 2022
|
||||
|
||||
#ifndef G4TOOLSSGOFFSCREENVIEWER_HH
|
||||
#define G4TOOLSSGOFFSCREENVIEWER_HH
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
|
||||
#include <tools/fpng>
|
||||
#include <tools/toojpeg>
|
||||
|
||||
#include <tools/offscreen/sg_viewer>
|
||||
#include <tools/tos>
|
||||
#include <tools/sto>
|
||||
|
||||
class G4ToolsSGOffscreenViewer : public G4ToolsSGViewer<tools::offscreen::session,tools::offscreen::sg_viewer> {
|
||||
typedef G4ToolsSGViewer<tools::offscreen::session,tools::offscreen::sg_viewer> parent;
|
||||
public:
|
||||
G4ToolsSGOffscreenViewer(tools::offscreen::session& a_session,G4ToolsSGSceneHandler& a_scene_handler, const G4String& a_name)
|
||||
:parent(a_session,a_scene_handler,a_name)
|
||||
,fFileName("auto")
|
||||
,fFilePrefix("auto")
|
||||
,fFileIndex(0)
|
||||
,fResetFileIndex(false)
|
||||
{
|
||||
Messenger::Create();
|
||||
}
|
||||
virtual ~G4ToolsSGOffscreenViewer() = default;
|
||||
protected:
|
||||
G4ToolsSGOffscreenViewer(const G4ToolsSGOffscreenViewer& a_from):parent(a_from){}
|
||||
G4ToolsSGOffscreenViewer& operator=(const G4ToolsSGOffscreenViewer&) {return *this;}
|
||||
public:
|
||||
virtual void Initialise() {
|
||||
if(fSGViewer) return; //done.
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::Initialize\n");
|
||||
// auto refresh true produces too much files.
|
||||
fVP.SetAutoRefresh(false);
|
||||
fDefaultVP.SetAutoRefresh(false);
|
||||
fSGViewer = new tools::offscreen::sg_viewer(fSGSession
|
||||
,fVP.GetWindowAbsoluteLocationHintX(1440)
|
||||
,fVP.GetWindowAbsoluteLocationHintY(900)
|
||||
,fVP.GetWindowSizeHintX()
|
||||
,fVP.GetWindowSizeHintY()
|
||||
,fName);
|
||||
fSGViewer->set_file_format("zb_png");
|
||||
fSGViewer->set_file_name("out.png");
|
||||
fSGViewer->set_png_writer(tools::fpng::write);
|
||||
fSGViewer->set_jpeg_writer(tools::toojpeg::write);
|
||||
fSGViewer->set_do_transparency(true);
|
||||
fSGViewer->set_top_to_bottom(false); //if using tools::fpng, tools::toojpeg.
|
||||
}
|
||||
virtual void SetView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::SetView\n");
|
||||
fVP.SetGlobalMarkerScale(1); //WARNING: for __APPLE__, the G4ToolsSGQtViewer set it to 2.
|
||||
parent::SetView();
|
||||
}
|
||||
|
||||
virtual void DrawView() {
|
||||
if (!fNeedKernelVisit) KernelVisitDecision();
|
||||
fLastVP = fVP;
|
||||
ProcessView(); // Clears store and processes scene only if necessary.
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::DrawView %s\n",fName.c_str());
|
||||
if(fSGViewer) {
|
||||
fSGSceneHandler.TouchPlotters(fSGViewer->sg());
|
||||
if(fFileName=="auto") {
|
||||
std::string prefix;
|
||||
if(fFilePrefix=="auto") {
|
||||
prefix = "g4tsg_offscreen_"+fSGViewer->file_format()+"_";
|
||||
} else {
|
||||
prefix = fFilePrefix;
|
||||
}
|
||||
std::string suffix;
|
||||
if(G4ToolsSGOffscreenViewer::GetFormatExtension(fSGViewer->file_format(),suffix)) {
|
||||
std::string file_name = prefix+tools::tos(GetFileIndex())+"."+suffix;
|
||||
fSGViewer->set_file_name(file_name);
|
||||
}
|
||||
} else {
|
||||
fSGViewer->set_file_name(fFileName);
|
||||
}
|
||||
if(fSGViewer->write_paper()) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) {
|
||||
G4cout << "File " << fSGViewer->file_name() << " produced." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ClearView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::ClearView %s\n",fName.c_str());
|
||||
}
|
||||
virtual void ShowView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::ShowView %s\n",fName.c_str());
|
||||
}
|
||||
virtual void FinishView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::FinishView %s\n",fName.c_str());
|
||||
if(fSGViewer) {
|
||||
fSGSceneHandler.TouchPlotters(fSGViewer->sg());
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetSize(unsigned int a_w,unsigned int a_h) {
|
||||
if(!fSGViewer) return;
|
||||
if(!a_w || !a_h) {
|
||||
fSGViewer->set_size(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
|
||||
} else {
|
||||
fSGViewer->set_size(a_w,a_h);
|
||||
}
|
||||
}
|
||||
|
||||
void SetFileFormat(const G4String& a_format) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_file_format(a_format);
|
||||
}
|
||||
|
||||
void SetDoTransparency(bool a_value) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_do_transparency(a_value);
|
||||
}
|
||||
|
||||
void SetFileName(const G4String& a_file,const G4String& a_prefix,bool a_reset_index) {
|
||||
fFileName = a_file;
|
||||
fFilePrefix = a_prefix;
|
||||
fResetFileIndex = a_reset_index;
|
||||
}
|
||||
|
||||
void SetGL2PSSort(const G4String& a_sort) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_opts_1(a_sort);
|
||||
}
|
||||
|
||||
void SetGL2PSOptions(const G4String& a_opts) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_opts_2(a_opts);
|
||||
}
|
||||
|
||||
class Messenger: public G4VVisCommand {
|
||||
public:
|
||||
static void Create() {static Messenger s_messenger;}
|
||||
private:
|
||||
Messenger() {
|
||||
G4UIparameter* parameter;
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_format = new G4UIcommand("/vis/tsg/offscreen/set/format", this);
|
||||
cmd_format->SetGuidance("Set file format.");
|
||||
cmd_format->SetGuidance("Available formats are:");
|
||||
cmd_format->SetGuidance("- zb_png: tools::sg offscreen zbuffer put in a png file.");
|
||||
cmd_format->SetGuidance("- zb_jpeg: tools::sg offscreen zbuffer put in a jpeg file.");
|
||||
cmd_format->SetGuidance("- zb_ps: tools::sg offscreen zbuffer put in a PostScript file.");
|
||||
cmd_format->SetGuidance("- gl2ps_eps: gl2ps producing eps");
|
||||
cmd_format->SetGuidance("- gl2ps_ps: gl2ps producing ps");
|
||||
cmd_format->SetGuidance("- gl2ps_pdf: gl2ps producing pdf");
|
||||
cmd_format->SetGuidance("- gl2ps_svg: gl2ps producing svg");
|
||||
cmd_format->SetGuidance("- gl2ps_tex: gl2ps producing tex");
|
||||
cmd_format->SetGuidance("- gl2ps_pgf: gl2ps producing pgf");
|
||||
|
||||
parameter = new G4UIparameter("format",'s',true);
|
||||
parameter->SetDefaultValue("gl2ps_eps");
|
||||
cmd_format->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_file = new G4UIcommand("/vis/tsg/offscreen/set/file", this);
|
||||
cmd_file->SetGuidance("Set file name.");
|
||||
cmd_file->SetGuidance("Default file name is \"auto\" and default format is zb_png.");
|
||||
cmd_file->SetGuidance("If file name is \"auto\", the output file name is built from");
|
||||
cmd_file->SetGuidance("a viewer index counter with the form:");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_<format>_<index>.<format extension>");
|
||||
cmd_file->SetGuidance("For example:");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_zb_png_1.png");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_zb_png_2.png");
|
||||
cmd_file->SetGuidance(" ...");
|
||||
cmd_file->SetGuidance("or if format is changed to \"gl2ps_pdf\":");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_gl2ps_pdf_3.pdf");
|
||||
cmd_file->SetGuidance("If a prefix parameter is given, the output file name is built from");
|
||||
cmd_file->SetGuidance("a global index counter with the form:");
|
||||
cmd_file->SetGuidance(" <prefix><index>.<format extension>");
|
||||
cmd_file->SetGuidance("For example:");
|
||||
cmd_file->SetGuidance(" /vis/tsg/offscreen/set/file auto my_prefix_");
|
||||
cmd_file->SetGuidance("will produce:");
|
||||
cmd_file->SetGuidance(" my_prefix_1.png");
|
||||
cmd_file->SetGuidance(" my_prefix_2.png");
|
||||
cmd_file->SetGuidance(" ...");
|
||||
cmd_file->SetGuidance("You can reset the index by specifying true as last argument:");
|
||||
cmd_file->SetGuidance(" /vis/tsg/offscreen/set/file auto other_prefix_ true");
|
||||
cmd_file->SetGuidance("will produce:");
|
||||
cmd_file->SetGuidance(" other_prefix_1.png");
|
||||
cmd_file->SetGuidance(" other_prefix_2.png");
|
||||
cmd_file->SetGuidance(" ...");
|
||||
|
||||
parameter = new G4UIparameter("file",'s',true);
|
||||
parameter->SetDefaultValue("auto");
|
||||
cmd_file->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter("prefix",'s',true);
|
||||
parameter->SetDefaultValue("auto");
|
||||
cmd_file->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter("reset_index",'b',true);
|
||||
parameter->SetDefaultValue("false");
|
||||
cmd_file->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_size = new G4UIcommand("/vis/tsg/offscreen/set/size", this);
|
||||
cmd_size->SetGuidance("Set viewer size in pixels.");
|
||||
cmd_size->SetGuidance
|
||||
("If width and/or height is set to zero, the viewer size specified with /vis/viewer/create (/vis/open) is taken.");
|
||||
cmd_size->SetGuidance(" About the picture size, note that the gl2ps files will grow with the number of primitives");
|
||||
cmd_size->SetGuidance("(gl2ps does not have a zbuffer logic). The \"zb\" files will not grow with the number of");
|
||||
cmd_size->SetGuidance("primitives, but with the size of the viewer. It should be preferred for scenes with");
|
||||
cmd_size->SetGuidance("a lot of objects to render. With zb, to have a better rendering, do not hesitate to");
|
||||
cmd_size->SetGuidance("have a large viewer size.");
|
||||
|
||||
parameter = new G4UIparameter("width",'i',false);
|
||||
parameter->SetDefaultValue("0");
|
||||
cmd_size->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter("height",'i',false);
|
||||
parameter->SetDefaultValue("0");
|
||||
cmd_size->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_do_transparency = new G4UIcmdWithABool("/vis/tsg/offscreen/set/transparency", this);
|
||||
cmd_do_transparency->SetGuidance("True/false to enable/disable rendering of transparent objects.");
|
||||
cmd_do_transparency->SetGuidance("This may be usefull if using file formats, as the gl2ps ones, unable to handle transparency.");
|
||||
cmd_do_transparency->SetParameterName("transparency-enabled",true);
|
||||
cmd_do_transparency->SetDefaultValue(true);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_gl2ps_sort = new G4UIcommand("/vis/tsg/offscreen/gl2ps/set/sort", this);
|
||||
cmd_gl2ps_sort->SetGuidance("Set gl2ps sort algorithm when creating the file.");
|
||||
|
||||
cmd_gl2ps_sort->SetGuidance("The sort argument could be:");
|
||||
cmd_gl2ps_sort->SetGuidance(" NO_SORT");
|
||||
cmd_gl2ps_sort->SetGuidance(" SIMPLE_SORT");
|
||||
cmd_gl2ps_sort->SetGuidance(" BSP_SORT");
|
||||
cmd_gl2ps_sort->SetGuidance("The default being BSP_SORT");
|
||||
|
||||
parameter = new G4UIparameter("sort",'s',true);
|
||||
parameter->SetDefaultValue("BSP_SORT");
|
||||
cmd_gl2ps_sort->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_gl2ps_opts = new G4UIcommand("/vis/tsg/offscreen/gl2ps/set/options", this);
|
||||
cmd_gl2ps_opts->SetGuidance("Set gl2ps options passed when creating the file.");
|
||||
|
||||
cmd_gl2ps_opts->SetGuidance("Options is a list of items separated by |. An item can be:");
|
||||
cmd_gl2ps_opts->SetGuidance(" NONE");
|
||||
cmd_gl2ps_opts->SetGuidance(" DRAW_BACKGROUND");
|
||||
cmd_gl2ps_opts->SetGuidance(" SIMPLE_LINE_OFFSET");
|
||||
cmd_gl2ps_opts->SetGuidance(" SILENT");
|
||||
cmd_gl2ps_opts->SetGuidance(" BEST_ROOT");
|
||||
cmd_gl2ps_opts->SetGuidance(" OCCLUSION_CULL");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_TEXT");
|
||||
cmd_gl2ps_opts->SetGuidance(" LANDSCAPE");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_PS3_SHADING");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_PIXMAP");
|
||||
cmd_gl2ps_opts->SetGuidance(" USE_CURRENT_VIEWPORT");
|
||||
cmd_gl2ps_opts->SetGuidance(" COMPRESS");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_BLENDING");
|
||||
cmd_gl2ps_opts->SetGuidance(" TIGHT_BOUNDING_BOX");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_OPENGL_CONTEXT");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_TEX_FONTSIZE");
|
||||
cmd_gl2ps_opts->SetGuidance(" PORTABLE_SORT");
|
||||
cmd_gl2ps_opts->SetGuidance("The default (typical) list of options is:");
|
||||
cmd_gl2ps_opts->SetGuidance(" SILENT|OCCLUSION_CULL|BEST_ROOT|DRAW_BACKGROUND");
|
||||
|
||||
parameter = new G4UIparameter("options",'s',true);
|
||||
parameter->SetDefaultValue("SILENT|OCCLUSION_CULL|BEST_ROOT|DRAW_BACKGROUND");
|
||||
cmd_gl2ps_opts->SetParameter (parameter);
|
||||
|
||||
|
||||
}
|
||||
virtual ~Messenger() {
|
||||
delete cmd_format;
|
||||
delete cmd_file;
|
||||
delete cmd_size;
|
||||
delete cmd_do_transparency;
|
||||
delete cmd_gl2ps_sort;
|
||||
delete cmd_gl2ps_opts;
|
||||
}
|
||||
public:
|
||||
virtual void SetNewValue(G4UIcommand* a_cmd,G4String a_value) {
|
||||
G4VisManager::Verbosity verbosity = GetVisManager()->GetVerbosity();
|
||||
G4VViewer* viewer = GetVisManager()->GetCurrentViewer();
|
||||
if (!viewer) {
|
||||
if (verbosity >= G4VisManager::errors) G4cerr << "ERROR: No current viewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
G4ToolsSGOffscreenViewer* tsg_viewer = dynamic_cast<G4ToolsSGOffscreenViewer*>(viewer);
|
||||
if(!tsg_viewer) {
|
||||
G4cout << "G4ToolsSGOffscreenViewer::Messenger::SetNewValue:"
|
||||
<< " current viewer is not a G4ToolsSGOffscreenViewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> args;
|
||||
tools::double_quotes_tokenize(a_value,args);
|
||||
if(args.size()!=a_cmd->GetParameterEntries()) return;
|
||||
if(a_cmd==cmd_format) {
|
||||
if(!IsKnownFormat(args[0])) {
|
||||
G4cout << "G4ToolsSGOffscreenViewer::Messenger::SetNewValue:"
|
||||
<< " unknown file format " << args[0] << "." << G4endl;
|
||||
return;
|
||||
}
|
||||
tsg_viewer->SetFileFormat(args[0]);
|
||||
} else if(a_cmd==cmd_file) {
|
||||
G4bool reset_index = G4UIcommand::ConvertToBool(args[2].c_str());
|
||||
tsg_viewer->SetFileName(args[0],args[1],reset_index);
|
||||
} else if(a_cmd==cmd_size) {
|
||||
unsigned int w,h;
|
||||
if(!tools::to(args[0],w)) w = 0;
|
||||
if(!tools::to(args[1],h)) h = 0;
|
||||
tsg_viewer->SetSize(w,h);
|
||||
} else if(a_cmd==cmd_do_transparency) {
|
||||
G4bool _do = a_cmd->ConvertToBool(args[0].c_str());
|
||||
tsg_viewer->SetDoTransparency(_do);
|
||||
} else if(a_cmd==cmd_gl2ps_sort) {
|
||||
tsg_viewer->SetGL2PSSort(args[0]);
|
||||
} else if(a_cmd==cmd_gl2ps_opts) {
|
||||
tsg_viewer->SetGL2PSOptions(args[0]);
|
||||
}
|
||||
}
|
||||
private:
|
||||
G4UIcommand* cmd_format;
|
||||
G4UIcommand* cmd_file;
|
||||
G4UIcommand* cmd_size;
|
||||
G4UIcmdWithABool* cmd_do_transparency;
|
||||
G4UIcommand* cmd_gl2ps_sort;
|
||||
G4UIcommand* cmd_gl2ps_opts;
|
||||
};
|
||||
|
||||
protected:
|
||||
unsigned int GetFileIndex() {
|
||||
if(fResetFileIndex) {fFileIndex = 0;fResetFileIndex = false;}
|
||||
fFileIndex++;
|
||||
return fFileIndex;
|
||||
}
|
||||
|
||||
static bool IsKnownFormat(const std::string& a_format) {
|
||||
if(a_format=="gl2ps_eps") return true;
|
||||
if(a_format=="gl2ps_ps") return true;
|
||||
if(a_format=="gl2ps_pdf") return true;
|
||||
if(a_format=="gl2ps_svg") return true;
|
||||
if(a_format=="gl2ps_tex") return true;
|
||||
if(a_format=="gl2ps_pgf") return true;
|
||||
if(a_format=="zb_ps") return true;
|
||||
if(a_format=="zb_png") return true;
|
||||
if(a_format=="zb_jpeg") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool GetFormatExtension(const std::string& a_format,std::string& a_ext) {
|
||||
if(a_format=="gl2ps_eps") {a_ext = "eps";return true;}
|
||||
if(a_format=="gl2ps_ps") {a_ext = "ps";return true;}
|
||||
if(a_format=="gl2ps_pdf") {a_ext = "pdf";return true;}
|
||||
if(a_format=="gl2ps_svg") {a_ext = "svg";return true;}
|
||||
if(a_format=="gl2ps_tex") {a_ext = "tex";return true;}
|
||||
if(a_format=="gl2ps_pgf") {a_ext = "pgf";return true;}
|
||||
if(a_format=="zb_ps") {a_ext = "ps";return true;}
|
||||
if(a_format=="zb_png") {a_ext = "png";return true;}
|
||||
if(a_format=="zb_jpeg") {a_ext = "jpeg";return true;}
|
||||
a_ext.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string fFileName;
|
||||
std::string fFilePrefix;
|
||||
unsigned int fFileIndex;
|
||||
bool fResetFileIndex;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -34,6 +34,9 @@
|
||||
#include "G4Scene.hh"
|
||||
#include "G4VVisCommand.hh"
|
||||
|
||||
#include <tools/fpng>
|
||||
#include <tools/toojpeg>
|
||||
|
||||
#include <tools/sg/device_interactor>
|
||||
#include <tools/sg/separator>
|
||||
#include <tools/sg/ortho>
|
||||
@@ -265,7 +268,7 @@ public:
|
||||
CreateSG(_camera,fVP.GetActualLightpointDirection());
|
||||
|
||||
{G4Color background = fVP.GetBackgroundColour ();
|
||||
fSGViewer->set_clear_color(float(background.GetRed()),float(background.GetBlue()),float(background.GetBlue()),1);}
|
||||
fSGViewer->set_clear_color(float(background.GetRed()),float(background.GetGreen()),float(background.GetBlue()),1);}
|
||||
}
|
||||
|
||||
virtual void ClearView() {}
|
||||
@@ -328,58 +331,81 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
G4bool CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
// Typical comparison. Taken from OpenGL.
|
||||
G4bool CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
// Typical comparison. Taken from OpenInventor.
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(lastVP.GetCBDAlgorithmNumber() !=
|
||||
fVP.GetCBDAlgorithmNumber()) ||
|
||||
(lastVP.IsSection () != fVP.IsSection ()) ||
|
||||
(lastVP.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
(lastVP.IsExplode () != fVP.IsExplode ()) ||
|
||||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(lastVP.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
|
||||
(lastVP.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
|
||||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(lastVP.GetDefaultVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetDefaultTextVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(lastVP.IsPicking () != fVP.IsPicking ()) ||
|
||||
(lastVP.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(lastVP.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
(vp.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(vp.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(vp.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(vp.IsCulling () != fVP.IsCulling ()) ||
|
||||
(vp.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(vp.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(vp.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(vp.GetCBDAlgorithmNumber() !=
|
||||
fVP.GetCBDAlgorithmNumber()) ||
|
||||
(vp.IsSection () != fVP.IsSection ()) ||
|
||||
(vp.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
// This assumes use of generic clipping (sectioning, slicing,
|
||||
// DCUT, cutaway). If a decision is made to implement locally,
|
||||
// this will need changing. See G4OpenGLViewer::SetView,
|
||||
// G4OpenGLStoredViewer.cc::CompareForKernelVisit and
|
||||
// G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
|
||||
(vp.IsExplode () != fVP.IsExplode ()) ||
|
||||
(vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(vp.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
|
||||
(vp.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
|
||||
(vp.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(vp.GetDefaultVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultVisAttributes()->GetColour()) ||
|
||||
(vp.GetDefaultTextVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(vp.IsPicking () != fVP.IsPicking ()) ||
|
||||
// Scaling for Open Inventor is done by the scene handler so it
|
||||
// needs a kernel visit. (In this respect, it differs from the
|
||||
// OpenGL drivers, where it's done in SetView.)
|
||||
(vp.GetScaleFactor () != fVP.GetScaleFactor ()) ||
|
||||
(vp.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(vp.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering()) ||
|
||||
(vp.GetSpecialMeshRenderingOption() !=
|
||||
fVP.GetSpecialMeshRenderingOption())
|
||||
)
|
||||
return true;
|
||||
|
||||
if (lastVP.IsDensityCulling () &&
|
||||
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ())) return true;
|
||||
|
||||
if (lastVP.GetCBDAlgorithmNumber() > 0) {
|
||||
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
|
||||
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
|
||||
}
|
||||
|
||||
if (lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
if (vp.IsDensityCulling () &&
|
||||
(vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
return true;
|
||||
|
||||
if (lastVP.IsSpecialMeshRendering() &&
|
||||
(lastVP.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
if (vp.GetCBDAlgorithmNumber() > 0) {
|
||||
if (vp.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
|
||||
else if (vp.GetCBDParameters() != fVP.GetCBDParameters()) return true;
|
||||
}
|
||||
|
||||
if (vp.IsSection () &&
|
||||
(vp.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
|
||||
if (vp.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
|
||||
if (vp.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
if (vp.IsExplode () &&
|
||||
(vp.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
|
||||
if (vp.IsSpecialMeshRendering() &&
|
||||
(vp.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// void keyPressEvent (KeyEvent*);
|
||||
// void keyReleaseEvent (KeyEvent*);
|
||||
// void mouseDoubleClickEvent(MouseEvent*);
|
||||
@@ -412,6 +438,8 @@ protected:
|
||||
{tools::sg::torche* light = new tools::sg::torche;
|
||||
light->on = true;
|
||||
light->direction = tools::vec3f(-a_light_dir.x(),-a_light_dir.y(),-a_light_dir.z());
|
||||
light->ambient = tools::colorf(0.2f,0.2f,0.2f,1.0f); //same as in G4OpenGLViewer.cc glLight(GL_LIGHT0,GL_AMBIENT and GL_DIFFUSE).
|
||||
light->color = tools::colorf(0.8f,0.8f,0.8f,1.0f); //idem.
|
||||
scene_3D->add(light);}
|
||||
|
||||
{tools::sg::blend* blend = new tools::sg::blend;
|
||||
@@ -422,13 +450,15 @@ protected:
|
||||
scene_3D->add(new tools::sg::noderef(fSGSceneHandler.GetPersistent3DObjects()));
|
||||
}
|
||||
|
||||
void Export(const G4String& a_format,const G4String& a_file) {
|
||||
void Export(const G4String& a_format,const G4String& a_file,G4bool a_do_transparency) {
|
||||
if(!fSGViewer) return;
|
||||
const G4Colour& back_color = fVP.GetBackgroundColour();
|
||||
if(!write_paper(G4cout,f_gl2ps_mgr,f_zb_mgr,0,0,
|
||||
bool top_to_bottom = false; //if using tools::fpng, tools::toojpeg.
|
||||
if(!tools::sg::write_paper(G4cout,f_gl2ps_mgr,f_zb_mgr,
|
||||
tools::fpng::write,tools::toojpeg::write,
|
||||
float(back_color.GetRed()),float(back_color.GetGreen()),float(back_color.GetBlue()),float(back_color.GetAlpha()),
|
||||
fSGViewer->sg(),
|
||||
fSGViewer->width(),fSGViewer->height(),a_file,a_format)) {
|
||||
fSGViewer->sg(),fSGViewer->width(),fSGViewer->height(),
|
||||
a_file,a_format,a_do_transparency,top_to_bottom,std::string(),std::string())) {
|
||||
G4cout << "G4ToolsSGViewer::Export: write_paper() failed." << G4endl;
|
||||
return;
|
||||
}
|
||||
@@ -454,6 +484,8 @@ protected:
|
||||
write_scene->SetGuidance("- gl2ps_tex: gl2ps producing tex");
|
||||
write_scene->SetGuidance("- gl2ps_pgf: gl2ps producing pgf");
|
||||
write_scene->SetGuidance("- zb_ps: tools::sg offscreen zbuffer put in a PostScript file.");
|
||||
write_scene->SetGuidance("- zb_png: tools::sg offscreen zbuffer put in a png file.");
|
||||
write_scene->SetGuidance("- zb_jpeg: tools::sg offscreen zbuffer put in a jpeg file.");
|
||||
|
||||
parameter = new G4UIparameter("format",'s',true);
|
||||
parameter->SetDefaultValue("gl2ps_eps");
|
||||
@@ -462,6 +494,11 @@ protected:
|
||||
parameter = new G4UIparameter("file",'s',true);
|
||||
parameter->SetDefaultValue("out.eps");
|
||||
write_scene->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter ("do_transparency", 'b', true);
|
||||
parameter->SetDefaultValue ("true");
|
||||
write_scene->SetParameter (parameter);
|
||||
|
||||
}
|
||||
virtual ~Messenger() {
|
||||
delete write_scene;
|
||||
@@ -484,7 +521,8 @@ protected:
|
||||
tools::double_quotes_tokenize(a_value,args);
|
||||
if(args.size()!=a_cmd->GetParameterEntries()) return;
|
||||
if(a_cmd==write_scene) {
|
||||
tsg_viewer->Export(args[0],args[1]);
|
||||
G4bool do_transparency = G4UIcommand::ConvertToBool(args[2].c_str());
|
||||
tsg_viewer->Export(args[0],args[1],do_transparency);
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -5,13 +5,14 @@ geant4_add_module(G4ToolsSG
|
||||
G4ToolsSGNode.hh
|
||||
G4ToolsSGSceneHandler.hh
|
||||
G4ToolsSGViewer.hh
|
||||
G4ToolsSGOffscreen.hh
|
||||
G4ToolsSGOffscreenViewer.hh
|
||||
SOURCES
|
||||
G4ToolsSGSceneHandler.cc)
|
||||
G4ToolsSGSceneHandler.cc
|
||||
G4ToolsSGOffscreen.cc)
|
||||
|
||||
geant4_module_link_libraries(G4ToolsSG
|
||||
PUBLIC
|
||||
G4UIbasic
|
||||
G4UIcommon
|
||||
G4intercoms
|
||||
G4modeling
|
||||
G4vis_management
|
||||
@@ -35,6 +36,18 @@ endif()
|
||||
if(GEANT4_USE_TOOLSSG_XT_GLES)
|
||||
geant4_module_sources(G4ToolsSG PUBLIC_HEADERS G4ToolsSGXtGLES.hh SOURCES G4ToolsSGXtGLES.cc)
|
||||
geant4_module_compile_definitions(G4ToolsSG PRIVATE TOOLS_USE_GL_GL_H)
|
||||
|
||||
# A minor hack around a likely issue in geant4_module_link_libraries
|
||||
# When Qt is activated, G4UIcommon is a public dependency. CMake will deduplicate
|
||||
# this (in favour of PUBLIC at final library link time, but geant4_module_link_libraries
|
||||
# does not do this internally yet (To be checked). We then get validation
|
||||
# warnings on duplicated deps. NB: Also demonstrates awkward vis system of more than
|
||||
# one driver per library...
|
||||
if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC G4UIcommon)
|
||||
else()
|
||||
geant4_module_link_libraries(G4ToolsSG PRIVATE G4UIcommon)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# X11/Xt links if selected
|
||||
@@ -57,7 +70,15 @@ if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
G4ToolsSGQtGLES.cc
|
||||
G4ToolsSGQtViewer.cc)
|
||||
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Widgets OpenGL::GL)
|
||||
geant4_module_link_libraries(G4ToolsSG
|
||||
PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::OpenGL
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
OpenGL::GL
|
||||
G4UIbasic
|
||||
G4UIcommon)
|
||||
endif()
|
||||
|
||||
# Windows sources if selected
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 09th June 2022
|
||||
|
||||
#include "G4ToolsSGOffscreen.hh"
|
||||
|
||||
#include "G4ToolsSGOffscreenViewer.hh"
|
||||
|
||||
#include <tools/offscreen/sg_viewer>
|
||||
|
||||
G4ToolsSGOffscreen::G4ToolsSGOffscreen():
|
||||
parent
|
||||
("TOOLSSG_OFFSCREEN",
|
||||
"TSG_OFFSCREEN",
|
||||
"TOOLSSG_OFFSCREEN is a graphics driver based on the g4tools tools/sg scene graph logic where\n\
|
||||
the rendering is done by using various offscreen library as tools/sg/zb, gl2ps, png, jpeg.",
|
||||
parent::threeDInteractive)
|
||||
,fSGSession(nullptr)
|
||||
{}
|
||||
|
||||
G4ToolsSGOffscreen::~G4ToolsSGOffscreen() {
|
||||
delete fSGSession;
|
||||
}
|
||||
|
||||
void G4ToolsSGOffscreen::Initialise() {
|
||||
if(fSGSession) return; //done.
|
||||
fSGSession = new tools::offscreen::session(G4cout);
|
||||
if(!fSGSession->is_valid()) {
|
||||
G4cerr << "G4ToolsSGOffscreen::Initialise : session::is_valid() failed." << G4endl;
|
||||
delete fSGSession;
|
||||
fSGSession = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4ToolsSGOffscreen::CreateSceneHandler(const G4String& a_name) {
|
||||
G4VSceneHandler* pScene = new G4ToolsSGSceneHandler(*this,a_name);
|
||||
return pScene;
|
||||
}
|
||||
|
||||
G4VViewer* G4ToolsSGOffscreen::CreateViewer(G4VSceneHandler& a_scene,const G4String& a_name) {
|
||||
if(!fSGSession) Initialise();
|
||||
if(!fSGSession) return nullptr;
|
||||
G4VViewer* pView = new G4ToolsSGOffscreenViewer(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
"G4ToolsSGOffscreen::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4ToolsSGViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
delete pView;
|
||||
pView = nullptr;
|
||||
}
|
||||
}
|
||||
if (!pView) {
|
||||
G4cerr <<
|
||||
"G4ToolsSGOffscreen::CreateViewer: ERROR: null pointer on new G4ToolsSGViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
return pView;
|
||||
}
|
||||
|
||||
G4bool G4ToolsSGOffscreen::IsUISessionCompatible () const
|
||||
{
|
||||
//G4bool isCompatible = true;
|
||||
//return isCompatible;
|
||||
return true;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ tools::sg::separator* G4ToolsSGSceneHandler::GetOrCreateNode()
|
||||
size_t iDepth = 1;
|
||||
while (iDepth < depth) {
|
||||
const auto& children = node->children();
|
||||
const G4int nChildren = children.size();
|
||||
const G4int nChildren = (G4int)children.size();
|
||||
G4int iChild = 0;
|
||||
G4ToolsSGNode* child = nullptr;
|
||||
for (; iChild < nChildren; ++iChild) {
|
||||
|
||||
Reference in New Issue
Block a user