# Graz University of Technology计算机图形学课设 **Repository Path**: disgreater/cgcv ## Basic Information - **Project Name**: Graz University of Technology计算机图形学课设 - **Description**: 光线追踪方面的公式结合光线方向矢量,对json文件进行解析,并创建png文件与ref文件夹中的标准答案对比,基本都对 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-04-25 - **Last Updated**: 2023-04-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Here lies the framework provided for task1 of the 2023 courses ["Computergraphics"](https://online.tugraz.at/tug_online/wbLv.wbShowLVDetail?pStpSpNr=334588&pSpracheNr=1) [1] and ["Computergraphics and -vision"](https://online.tugraz.at/tug_online/wbLv.wbShowLVDetail?pStpSpNr=335228&pSpracheNr=1&pMUISuche=FALSE) [2] at [Graz University of Technology](https://www.tugraz.at/home/) [3]. ## Automatic Testing Pipeline / (Final) Submission **The assignments.icg.tugraz.at automatically runs your code in a testing pipeline as soon as you push to a `submission` branch. This branch is also the one that will be used for the final testing of your solution, so make sure that you do not forget to push to the `submission` branch!** For submission you must create a `submission` branch and push your code into this branch. This will also trigger an automated test, for which you can view build logs, output logs and rendered images in the CI/CD section of the gitlab webinterface. We will only grade solutions that have been pushed to the `submission` branch of your repository! To build the framework, please follow the build instructions down below. ## Git Basics / Creating the `submission` Branch The following commands add the local change (of a file) in the working directory to so-called staging area and create a commit: ```bash git add git commit -m "I did this and that and enter info about it here here" ``` To push this commit to the server (and make the changes visible in the web interface), you need to `git push`: ```bash git push origin ``` To create the `submission` branch (and thus make a submission, which will also be evaluated by the automatic test system for your feedback), you can use the following commands from within the root directory of this repository: ```bash git checkout -b submission git push origin submission ``` The first command creates a new `submission` branch, and the second command pushes this branch onto the remote repository. ## Building and running the assignment framework To build the framework, the following tools are needed * a C++ toolchain with C++17 support (e.g. GCC 8.x+, Visual Studio 2017+ ) * [CMake 3.10+](https://cmake.org/) [5] CMake scripts to generate a build system can be found in `build/cmake`. Compiled applications will be placed in a subdirectory `./bin/` within the CMake binary directory. We have tested the environment and can provide support for issues on the following systems: * Ubuntu 20.04 and 22.04 * Windows 10 with Build Tools (2017, 2019) * Docker on Ubuntu and Windows We offer multiple ways to build and run the framework, which are described below. The recommended configurations are VS Code (with Dev Containter) for Linux, and a native install for Windows, but other configurations work as well. Docker on Mac (ARM) was tested and can be used, but we do not offer support for this configuration. Whichever development environment you chose, keep in mind that your results on our servers (in your submission branch) will be used for grading. ## VS Code If you are on Linux and using VS Code, you can just press `F5` or go to `Run and Debug` and press `Launch Task 1` when you have opened your repository with it. VS Code should automatically create the build folders, build your code and execute it within a debug environment. This is enabled by the `.vscode/launch.json` configuration. You can also edit it to launch other tasks by replacing the arguments in `args` (e.g. replace `"data/task1/ray_cubes_transformed.json"` with `"data/task1/cone_shadow_spotlights.json"`): ```json ... "request": "launch", "program": "${workspaceFolder}/build/bin/bin/task1", "args": [ "data/task1/ray_cubes_transformed.json" ], "cwd": "${workspaceFolder}", ...  ``` ## Using VS Code with Dev Container We also provide you with a prebuild Dev Container environment. You just have to install VS Code and the extension Dev Containers (`ms-vscode-remote.remote-containers`) and execute the command `Open Folder in Container...` ![VS Code docker](doc/images/vscode_devcontainer.png) The image will now build and install the C++-extension automatically. You should be able to just run and edit your code just like instructed above. ## Docker Image (replacement for a VM) You can also run everything from the command line within a Docker image. For this, you have to build and tag the image first (these commands only work on Linux or Mac, both x86 and aarch64, for Windows see below): ```bash docker build -t cg1-runner . ``` >Note: you only have to build the docker image once Then you can start the container and mount your local directory using the following command: ```bash docker run --init -v $PWD:/cg1 -it cg1-runner ./scripts/run_all_tests.sh ``` ### Docker Image on Windows The build command stays the same, but you have to exchange the start command for the following: ```bash docker run --init -v ${PWD}:/cg1 -it cg1-runner sh ./scripts/run_all_tests.sh ``` You may get the following error: ``` ./scripts/run_all_tests.sh: 7: cd: can't cd to .. ``` You will need to open `./scripts/run_all_tests.sh` and change the line endings to LF (instead of CRLF). ## Windows Native For working on Windows, the framework was tested on the [Visual Studio](https://www.visualstudio.com/) 2017 and 2019 [4] IDE (Community Edition is sufficient). Note that the framework requires Version 15.5 and up. Open the CMake 3.10+ GUI application and point the CMake source path to the location of your `build/cmake` directory. Set the second path to point to the location where you would like your Visual Studio project files to be placed, e.g., `build/vs2017`. ![CMake Screenshot](doc/images/cmake_win_1.png) Press [Configure] and select the Visual Studio 2017 generator ![CMake Screenshot](doc/images/cmake_win_2.png) At this point, you can optionally edit the configuration and afterwards press [Generate]. ![CMake Screenshot](doc/images/cmake_win_3.png) Finally, open the generated Visual Studio 2017 solution that should now be found in the build directory specified earlier. Do not forget to set the correct startup project: ![CMake Screenshot](doc/images/vs_set_startup_project_marked.png) To set up the working directory and commandline arguments for launching your application from within the Visual Studio debugger, go to Project Properties > Debugging: ![CMake Screenshot](doc/images/vs_set_working_dir_marked.png) ## Ubuntu Native (20.04 and up) The current compilers shipping with Ubuntu 20.04 and up (if installed using `build-essential` or `gcc`) are sufficient for this exercise. If you have an older version, please install *and switch* using `update-alternative` to the newer version: ```bash sudo apt-get install gcc-11 g++-11 ``` On older versions of Ubuntu (e.g. Ubuntu 16.04), g++ 8.x is not available from default distribution repositories. You may be able to get a working build from other sources such as, e.g., the [`ubuntu-toolchain-r/test`](https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test) [6] repository: ```bash sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-8 g++-8 ``` Assuming you have installed [CMake 3.10](https://cmake.org/) [5] or newer as well as a suitable C++ toolchain, a build system can then be generated. First, switch into the directory where you want to the build files to be placed, for example: ```bash cd /path/to/repository cd build mkdir bin cd bin ``` Then, call `cmake` to generate the build system: ```bash cmake ../cmake/ ``` The path to the `build/cmake` directory containing the CMake scripts (here `../cmake/`) has to be passed as the last argument to the `cmake` command. To use a compiler other than the system default, specify the `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER` variables via the commandline as shown in the example above. > Instead of using the commandline, you can install the `cmake-qt-gui` package to get a GUI application for managing the CMake generation process in essentially the same way as described in the Windows setup guide above. Use the "Specify native compilers" option in the generator selection dialogue to change the set of compilers to be used. Once the build files have been generated, the project can be compiled using ```bash make task1 ``` [1] https://online.tugraz.at/tug_online/wbLv.wbShowLVDetail?pStpSpNr=334588&pSpracheNr=1 [2] https://online.tugraz.at/tug_online/wbLv.wbShowLVDetail?pStpSpNr=335228&pSpracheNr=1&pMUISuche=FALSE [3] https://www.tugraz.at/home/ [4] https://www.visualstudio.com/ [5] https://cmake.org/ [6] https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test