add geant4 scene and gcompose app
This commit is contained in:
20
app/gcompose/CMakeLists.txt
Normal file
20
app/gcompose/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
add_executable(gcompose src/main.cpp)
|
||||
|
||||
target_include_directories(gcompose PRIVATE
|
||||
${SRC_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
${Geant4_INCLUDE_DIRS}
|
||||
${VTK_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(gcompose
|
||||
mutomCore
|
||||
mutomMath
|
||||
mutomGeant
|
||||
mutomVtk
|
||||
${Geant4_LIBRARIES}
|
||||
${VTK_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS gcompose RUNTIME DESTINATION bin)
|
||||
45
app/gcompose/src/main.cpp
Normal file
45
app/gcompose/src/main.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
#include "Math/ContainerBox.h"
|
||||
#include <HEP/Geant/Scene.h>
|
||||
|
||||
#include <Vtk/uLibVtkViewer.h>
|
||||
#include <Vtk/vtkContainerBox.h>
|
||||
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkCubeSource.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkActor.h>
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::cout << "Starting gcompose application..." << std::endl;
|
||||
|
||||
uLib::ContainerBox world_box(Vector3f(100, 100, 100));
|
||||
|
||||
uLib::Scene scene;
|
||||
scene.ConstructWorldBox(&world_box, "G4_AIR");
|
||||
scene.Initialize();
|
||||
|
||||
// 2. Initialize VTK Viewer
|
||||
Vtk::Viewer viewer;
|
||||
|
||||
uLib::Vtk::vtkContainerBox vtk_box(&world_box);
|
||||
viewer.AddPuppet(vtk_box);
|
||||
|
||||
viewer.GetRenderer()->Render();
|
||||
|
||||
std::cout << "Geant4 and VTK scenes are ready." << std::endl;
|
||||
std::cout << "Starting VTK Interactor..." << std::endl;
|
||||
|
||||
// 3. Start VTK interactor (blocks until window is closed)
|
||||
viewer.Start();
|
||||
|
||||
// 4. Clean up
|
||||
std::cout << "Shutting down..." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user