File indexing completed on 2025-05-30 08:06:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef G4TheRayTracer_H
0032 #define G4TheRayTracer_H 1
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 #include "globals.hh"
0052 #include "G4ThreeVector.hh"
0053 #include "G4Colour.hh"
0054
0055 class G4Event;
0056 class G4EventManager;
0057 class G4UserEventAction;
0058 class G4UserStackingAction;
0059 class G4UserTrackingAction;
0060 class G4UserSteppingAction;
0061 class G4RTTrackingAction;
0062 class G4RTSteppingAction;
0063 class G4RTMessenger;
0064 class G4RayShooter;
0065 class G4VFigureFileMaker;
0066 class G4RayTrajectoryPoint;
0067 class G4VisAttributes;
0068 class G4VRTScanner;
0069
0070
0071 class G4TheRayTracer
0072 {
0073 public:
0074 G4TheRayTracer(G4VFigureFileMaker* figMaker = 0,
0075 G4VRTScanner* scanner = 0);
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 public:
0086 virtual ~G4TheRayTracer();
0087
0088 public:
0089 virtual void Trace(const G4String& fileName);
0090
0091
0092
0093
0094 protected:
0095 virtual G4bool CreateBitMap();
0096
0097 void CreateFigureFile(const G4String& fileName);
0098
0099 G4bool GenerateColour(G4Event* anEvent);
0100
0101 virtual void StoreUserActions();
0102 virtual void RestoreUserActions();
0103
0104
0105 G4Colour GetSurfaceColour(G4RayTrajectoryPoint* point);
0106 G4Colour GetMixedColour
0107 (const G4Colour& surfCol,const G4Colour& transCol,G4double weight=0.5);
0108 G4Colour Attenuate(G4RayTrajectoryPoint* point,const G4Colour& sourceCol);
0109 G4bool ValidColour(const G4VisAttributes* visAtt);
0110
0111 public:
0112 inline void SetFigureFileMaker(G4VFigureFileMaker* figMaker)
0113
0114
0115 { theFigMaker = figMaker; }
0116 inline G4VFigureFileMaker* GetFigureFileMaker() {return theFigMaker;}
0117 inline void SetScanner(G4VRTScanner* scanner)
0118
0119
0120 { theScanner = scanner; }
0121 inline G4VRTScanner* GetScanner() {return theScanner;}
0122
0123 protected:
0124 G4RayShooter * theRayShooter;
0125 static G4VFigureFileMaker * theFigMaker;
0126 G4RTMessenger * theMessenger;
0127 static G4VRTScanner * theScanner;
0128
0129 G4EventManager * theEventManager;
0130
0131 G4UserEventAction * theUserEventAction;
0132 G4UserStackingAction * theUserStackingAction;
0133 G4UserTrackingAction * theUserTrackingAction;
0134 G4UserSteppingAction * theUserSteppingAction;
0135
0136 G4UserEventAction * theRayTracerEventAction;
0137 G4UserStackingAction * theRayTracerStackingAction;
0138 G4RTTrackingAction * theRayTracerTrackingAction;
0139 G4RTSteppingAction * theRayTracerSteppingAction;
0140
0141 unsigned char* colorR;
0142 unsigned char* colorG;
0143 unsigned char* colorB;
0144
0145 G4int nColumn;
0146 G4int nRow;
0147
0148 G4ThreeVector eyePosition;
0149 G4ThreeVector targetPosition;
0150 G4ThreeVector eyeDirection;
0151 G4ThreeVector lightDirection;
0152 G4ThreeVector up;
0153 G4double headAngle;
0154 G4double viewSpan;
0155 G4double attenuationLength;
0156
0157 G4bool distortionOn;
0158 G4bool antialiasingOn;
0159
0160 G4Colour rayColour;
0161 G4Colour backgroundColour;
0162
0163 public:
0164 inline void SetNColumn(G4int val) { nColumn = val; }
0165 inline G4int GetNColumn() const { return nColumn; }
0166 inline void SetNRow(G4int val) { nRow = val; }
0167 inline G4int GetNRow() const { return nRow; }
0168 inline void SetEyePosition(const G4ThreeVector& val) { eyePosition = val; }
0169 inline G4ThreeVector GetEyePosition() const { return eyePosition; }
0170 inline void SetTargetPosition(const G4ThreeVector& val) { targetPosition = val; }
0171 inline G4ThreeVector GetTargetPosition() const { return targetPosition; }
0172 inline void SetLightDirection(const G4ThreeVector& val) { lightDirection = val.unit(); }
0173 inline G4ThreeVector GetLightDirection() const { return lightDirection; }
0174 inline void SetUpVector(const G4ThreeVector& val) { up = val; }
0175 inline G4ThreeVector GetUpVector() const { return up; }
0176 inline void SetHeadAngle(G4double val) { headAngle = val; }
0177 inline G4double GetHeadAngle() const { return headAngle; }
0178 inline void SetViewSpan(G4double val) { viewSpan = val; }
0179 inline G4double GetViewSpan() const { return viewSpan; }
0180 inline void SetAttenuationLength(G4double val) { attenuationLength = val; }
0181 inline G4double GetAttenuationLength() const { return attenuationLength; }
0182 inline void SetDistortion(G4bool val) { distortionOn = val; }
0183 inline G4bool GetDistortion() const { return distortionOn; }
0184 inline void SetBackgroundColour(const G4Colour& val) { backgroundColour = val; }
0185 inline G4Colour GetBackgroundColour() const { return backgroundColour; }
0186 };
0187
0188 #endif