slic/src
diff -u -r1.3 -r1.4
--- VRML2Writer.cc 9 Jul 2009 18:24:36 -0000 1.3
+++ VRML2Writer.cc 9 Jul 2009 20:57:43 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/VRML2Writer.cc,v 1.3 2009/07/09 18:24:36 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/VRML2Writer.cc,v 1.4 2009/07/09 20:57:43 jeremy Exp $
#include "VRML2Writer.hh"
// stl
@@ -54,24 +54,36 @@
void VRML2Writer::processPhysicalVolume(G4VPhysicalVolume* pv)
{
- writeLine("Transform {");
+ writeLine("DEF " + pv->GetName() + " Transform {");
indent();
writeLine("children [");
indent();
- // shape node
- writeLine("Shape {");
- indent();
- processVisualization(pv);
- processSolid(pv->GetLogicalVolume()->GetSolid());
- unindent();
- writeLine("}");
+ // shape node for each physical volume
+ const G4VisAttributes* vis = pv->GetLogicalVolume()->GetVisAttributes();
+ bool show = true;
+ if (vis && !vis->IsVisible()) show = false;
+ if (show)
+ {
+ writeLine("DEF " + pv->GetName() + " Shape {");
+ indent();
+ processVisualization(pv);
+ processSolid(pv->GetLogicalVolume()->GetSolid());
+ unindent();
+ writeLine("}");
+ }
G4LogicalVolume* lv = pv->GetLogicalVolume();
-
+
// Recurse through daughter volumes
- for (int i=0, ndau=lv->GetNoDaughters(); i < ndau; i++) {
- processPhysicalVolume(lv->GetDaughter(i));
+ bool showDaughters = true;
+ if (vis && vis->IsDaughtersInvisible()) showDaughters = false;
+ if (showDaughters)
+ {
+ for (int i=0, ndau=lv->GetNoDaughters(); i < ndau; i++)
+ {
+ processPhysicalVolume(lv->GetDaughter(i));
+ }
}
unindent();
@@ -117,7 +129,7 @@
std::stringstream ss;
ss << r << " " << g << " " << b;
writeLine("diffuseColor " + ss.str());
- writeLine("transparency 0.7");
+ writeLine("transparency 0.0"); // use viewer like Deep View to get a wireframe or transparent view
unindent();
writeLine("}");
unindent();