├── strategy.md ├── Homeworks ├── 2_ImageWarping │ ├── project │ │ ├── src │ │ │ └── App │ │ │ │ ├── ImageWarper.cpp │ │ │ │ ├── Resources │ │ │ │ └── images │ │ │ │ │ ├── new.jpg │ │ │ │ │ ├── open.jpg │ │ │ │ │ └── save.jpg │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── mainwindow.qrc │ │ │ │ ├── main.cpp │ │ │ │ ├── RBFWarper.h │ │ │ │ └── mainwindow.ui │ │ ├── include │ │ │ └── _deps │ │ │ │ └── README.md │ │ ├── data │ │ │ └── test.png │ │ └── README.md │ └── documents │ │ ├── eigen_example │ │ ├── src │ │ │ ├── CMakeLists.txt │ │ │ └── test │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── 00_LinearEquation │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── main.cpp │ │ ├── include │ │ │ └── _deps │ │ │ │ └── README.md │ │ └── README.md │ │ ├── ann_example │ │ ├── src │ │ │ └── test │ │ │ │ └── CMakeLists.txt │ │ └── README.md │ │ ├── 1_RBF.md │ │ └── 0_IDW.md ├── 0_CppPratices │ ├── project │ │ ├── data │ │ │ ├── P3.txt │ │ │ ├── P4.txt │ │ │ ├── P6.txt │ │ │ ├── P1.txt │ │ │ ├── P2.txt │ │ │ └── P5.txt │ │ ├── src │ │ │ ├── CMakeLists.txt │ │ │ ├── libraries │ │ │ │ ├── DArray │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── PolynomialList │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── PolynomialList.cpp │ │ │ │ └── CMakeLists.txt │ │ │ └── executables │ │ │ │ ├── 7_UseDll │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── main.cpp │ │ │ │ ├── 6_UseLib │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── main.cpp │ │ │ │ ├── 1_BasicDArray │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 3_TemplateDArray │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 2_EfficientDArray │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 5_map_Polynomial │ │ │ │ ├── PolynomialList.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 4_list_Polynomial │ │ │ │ ├── PolynomialList.cpp │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── main.cpp │ │ │ │ └── CMakeLists.txt │ │ ├── include │ │ │ └── README.md │ │ └── CMakeSettings.json │ ├── samples │ │ ├── data │ │ │ ├── P3.txt │ │ │ ├── P4.txt │ │ │ ├── P6.txt │ │ │ ├── P1.txt │ │ │ ├── P2.txt │ │ │ └── P5.txt │ │ ├── src │ │ │ ├── CMakeLists.txt │ │ │ ├── libraries │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── DArray │ │ │ │ │ └── CMakeLists.txt │ │ │ │ └── PolynomialList │ │ │ │ │ └── CMakeLists.txt │ │ │ └── executables │ │ │ │ ├── 7_UseDll │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 1_BasicDArray │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 3_TemplateDArray │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 2_EfficientDArray │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── 6_UseLib │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 4_list_Polynomial │ │ │ │ ├── main.cpp │ │ │ │ └── CMakeLists.txt │ │ │ │ └── 5_map_Polynomial │ │ │ │ └── CMakeLists.txt │ │ ├── include │ │ │ └── README.md │ │ └── README.md │ └── documents │ │ ├── 1_BasicDArray │ │ └── C2Cpp │ │ │ ├── bin │ │ │ └── README.md │ │ │ ├── src │ │ │ ├── CMakeLists.txt │ │ │ ├── Array5 │ │ │ │ ├── Array.cpp │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── main.cpp │ │ │ ├── Array │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── test.cpp │ │ │ ├── Array0 │ │ │ │ └── CMakeLists.txt │ │ │ ├── Array1.0 │ │ │ │ └── CMakeLists.txt │ │ │ ├── Array1.1 │ │ │ │ └── CMakeLists.txt │ │ │ ├── Array2 │ │ │ │ └── CMakeLists.txt │ │ │ ├── Array3 │ │ │ │ └── CMakeLists.txt │ │ │ └── Array4 │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── main.cpp │ │ │ │ └── Array.h │ │ │ └── README.md │ │ ├── 5_map_Polynomial │ │ └── README.md │ │ ├── README.md │ │ └── 3_TemplateDArray │ │ └── README.md ├── 4_MinSurfMeshPara │ ├── project │ │ ├── src │ │ │ ├── Basic │ │ │ │ ├── Sampler │ │ │ │ │ ├── Sampler2D.cpp │ │ │ │ │ ├── Sampler3D.cpp │ │ │ │ │ ├── AliasMethod.cpp │ │ │ │ │ ├── CosHsSample3D.cpp │ │ │ │ │ └── UniformGridSampler2D.cpp │ │ │ │ ├── ShapeMesh │ │ │ │ │ ├── desktop.ini │ │ │ │ │ ├── SphereMesh.cpp │ │ │ │ │ ├── CapsuleMesh.cpp │ │ │ │ │ └── ShapeMesh.cpp │ │ │ │ ├── Parallel.cpp │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Operation │ │ │ │ │ └── OpQueue.cpp │ │ │ │ ├── ImgPixelSet.cpp │ │ │ │ └── Math.cpp │ │ │ ├── App │ │ │ │ └── UEngine │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── UEngine.qrc │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── UEngine.cpp │ │ │ │ │ ├── GenScene.h │ │ │ │ │ └── main.cpp │ │ │ ├── Engine │ │ │ │ ├── Intersector │ │ │ │ │ └── Intersector.cpp │ │ │ │ ├── RTX │ │ │ │ │ ├── Film.h │ │ │ │ │ ├── BVHNode.h │ │ │ │ │ ├── BVHNode.cpp │ │ │ │ │ ├── FilmTile.cpp │ │ │ │ │ ├── FilmTile.h │ │ │ │ │ ├── RTX_Renderer.cpp │ │ │ │ │ └── Film.cpp │ │ │ │ ├── Scene │ │ │ │ │ ├── SObjLoader.h │ │ │ │ │ ├── Component.cpp │ │ │ │ │ ├── SimpleLoader.h │ │ │ │ │ ├── CmptLight.cpp │ │ │ │ │ └── AssimpLoader.h │ │ │ │ ├── Viewer │ │ │ │ │ ├── Raster.cpp │ │ │ │ │ ├── EnvGenerator.cpp │ │ │ │ │ ├── DLDM_Generator.cpp │ │ │ │ │ ├── ForwardRaster.cpp │ │ │ │ │ ├── PLDM_Generator.cpp │ │ │ │ │ ├── SLDM_Generator.cpp │ │ │ │ │ ├── Picker.h │ │ │ │ │ ├── WireframeRaster.cpp │ │ │ │ │ └── Picker.cpp │ │ │ │ ├── MeshEdit │ │ │ │ │ └── Simulate.cpp │ │ │ │ ├── Primitive │ │ │ │ │ ├── TriMesh.cpp │ │ │ │ │ └── Sphere.cpp │ │ │ │ ├── Filter │ │ │ │ │ ├── FilterSinc.cpp │ │ │ │ │ └── FilterMitchell.cpp │ │ │ │ ├── Light │ │ │ │ │ ├── DirectionalLight.cpp │ │ │ │ │ ├── PointLight.cpp │ │ │ │ │ ├── DiskLight.cpp │ │ │ │ │ ├── SphereLight.cpp │ │ │ │ │ ├── CapsuleLight.cpp │ │ │ │ │ ├── SpotLight.cpp │ │ │ │ │ └── AreaLight.cpp │ │ │ │ ├── Material │ │ │ │ │ ├── BSDF_Glass.cpp │ │ │ │ │ ├── BSDF_Mirror.cpp │ │ │ │ │ ├── BSDF.cpp │ │ │ │ │ └── Beckmann.cpp │ │ │ │ └── CMakeLists.txt │ │ │ ├── UI │ │ │ │ ├── Grid.cpp │ │ │ │ ├── Hierarchy.cpp │ │ │ │ └── CMakeLists.txt │ │ │ ├── OpenGL │ │ │ │ ├── VAO.cpp │ │ │ │ ├── Texture.cpp │ │ │ │ └── CMakeLists.txt │ │ │ └── Qt │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── OpThread.cpp │ │ ├── data │ │ │ ├── .gitignore │ │ │ └── shaders │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── Common │ │ │ │ ├── empty.fs │ │ │ │ ├── basic.fs │ │ │ │ ├── basic_T2.fs │ │ │ │ ├── basic_P3.vs │ │ │ │ ├── MVP_P3.vs │ │ │ │ ├── basic_P2T2.vs │ │ │ │ ├── camera.h │ │ │ │ ├── basic_P3T2.vs │ │ │ │ ├── postProcess.fs │ │ │ │ ├── basic_P3N3.vs │ │ │ │ ├── basic_P3N3_invN.vs │ │ │ │ ├── basic_P3N3T2.vs │ │ │ │ ├── basic_P3N3T2_invN.vs │ │ │ │ ├── basic_P3N3T2T3.vs │ │ │ │ └── interpolation.fs │ │ │ │ ├── Engine │ │ │ │ ├── DirectionalLight │ │ │ │ │ ├── genDepth.fs │ │ │ │ │ └── genDepth.vs │ │ │ │ ├── Light │ │ │ │ │ ├── AreaLight.h │ │ │ │ │ ├── DiskLight.h │ │ │ │ │ ├── SpotLight.h │ │ │ │ │ ├── PointLight.h │ │ │ │ │ ├── SphereLight.h │ │ │ │ │ └── CapsuleLight.h │ │ │ │ ├── PointLight │ │ │ │ │ ├── genDepth.vs │ │ │ │ │ ├── genDepth.fs │ │ │ │ │ └── genDepth.gs │ │ │ │ ├── IBL │ │ │ │ │ ├── cubemap.vs │ │ │ │ │ ├── prefilter.fs │ │ │ │ │ ├── brdf.fs │ │ │ │ │ └── irradiance_convolution.fs │ │ │ │ ├── DeferredPipeline │ │ │ │ │ ├── postProcess.fs │ │ │ │ │ └── GBuffer_Emission.fs │ │ │ │ ├── Skybox │ │ │ │ │ ├── skybox.vs │ │ │ │ │ └── skybox.fs │ │ │ │ └── BRDF │ │ │ │ │ └── Diffuse.h │ │ │ │ └── Math │ │ │ │ ├── line.h │ │ │ │ ├── quat.h │ │ │ │ ├── basic.h │ │ │ │ ├── plane.h │ │ │ │ ├── intersect.h │ │ │ │ └── Segment.h │ │ ├── include │ │ │ ├── .gitignore │ │ │ ├── Basic │ │ │ │ ├── Math.h │ │ │ │ ├── Node.h │ │ │ │ ├── Timer.h │ │ │ │ ├── HeapObj.h │ │ │ │ ├── LStorage.h │ │ │ │ ├── Op │ │ │ │ │ ├── LambdaOp.h │ │ │ │ │ ├── Op.h │ │ │ │ │ └── OpQueue.h │ │ │ │ ├── Sampler │ │ │ │ │ ├── Sampler2D.h │ │ │ │ │ ├── UniformGridSampler2D.h │ │ │ │ │ ├── Sampler3D.h │ │ │ │ │ ├── CosHsSampler3D.h │ │ │ │ │ ├── BasicSampler.h │ │ │ │ │ └── AliasMethod.h │ │ │ │ ├── ImgPixelSet.h │ │ │ │ ├── ArgManager.h │ │ │ │ ├── ShapeMesh │ │ │ │ │ ├── ShapeMesh.h │ │ │ │ │ ├── PlaneMesh.h │ │ │ │ │ ├── CubeMesh.h │ │ │ │ │ ├── DiskMesh.h │ │ │ │ │ ├── SphereMesh.h │ │ │ │ │ └── CapsuleMesh.h │ │ │ │ ├── TypeMap.h │ │ │ │ ├── Array2D.h │ │ │ │ └── Geometry.h │ │ │ ├── UI │ │ │ │ ├── Hierarchy.h │ │ │ │ └── Setting.h │ │ │ ├── OpenGL │ │ │ │ └── Camera.h │ │ │ ├── Engine │ │ │ │ ├── Scene │ │ │ │ │ ├── SObj.h │ │ │ │ │ ├── AllComponents.h │ │ │ │ │ ├── Component.h │ │ │ │ │ ├── CmptMaterial.h │ │ │ │ │ ├── CmptGeometry.h │ │ │ │ │ └── CmptLight.h │ │ │ │ ├── Light │ │ │ │ │ ├── Light.h │ │ │ │ │ ├── AreaLight.h │ │ │ │ │ ├── DiskLight.h │ │ │ │ │ ├── SpotLight.h │ │ │ │ │ ├── PointLight.h │ │ │ │ │ ├── SphereLight.h │ │ │ │ │ ├── CapsuleLight.h │ │ │ │ │ ├── DirectionalLight.h │ │ │ │ │ └── InfiniteAreaLight.h │ │ │ │ ├── Material │ │ │ │ │ ├── GGX.h │ │ │ │ │ ├── Beckmann.h │ │ │ │ │ ├── SchlickGGX.h │ │ │ │ │ ├── BSDF_Frostbite.h │ │ │ │ │ ├── BSDF_MetalWorkflow.h │ │ │ │ │ ├── MicrofacetDistribution.h │ │ │ │ │ ├── AllBSDFs.h │ │ │ │ │ ├── Material.h │ │ │ │ │ └── Gooch.h │ │ │ │ ├── Primitive │ │ │ │ │ ├── Plane.h │ │ │ │ │ ├── Capsule.h │ │ │ │ │ ├── Sphere.h │ │ │ │ │ ├── Triangle.h │ │ │ │ │ ├── Primitive.h │ │ │ │ │ ├── Shape.h │ │ │ │ │ └── Disk.h │ │ │ │ ├── Viewer │ │ │ │ │ ├── BVHAccel.h │ │ │ │ │ ├── Raster.h │ │ │ │ │ ├── PathTracer.h │ │ │ │ │ ├── RayTracer.h │ │ │ │ │ ├── Ray.h │ │ │ │ │ ├── WireframeRaster.h │ │ │ │ │ └── Roamer.h │ │ │ │ ├── MeshEdit │ │ │ │ │ ├── Simulate.h │ │ │ │ │ ├── Glue.h │ │ │ │ │ └── MST.h │ │ │ │ ├── Intersector │ │ │ │ │ ├── ClosestIntersector.h │ │ │ │ │ ├── VisibilityChecker.h │ │ │ │ │ └── Intersector.h │ │ │ │ ├── Filter │ │ │ │ │ ├── FilterBox.h │ │ │ │ │ ├── ImgFilter.h │ │ │ │ │ ├── FilterTriangle.h │ │ │ │ │ ├── FilterSinc.h │ │ │ │ │ └── FilterMitchell.h │ │ │ │ └── Engine.h │ │ │ ├── _deps │ │ │ │ └── README.md │ │ │ └── Qt │ │ │ │ └── OpThread.h │ │ ├── config │ │ │ └── ROOT_PATH.h.in │ │ └── CMakeSettings.json │ └── README.md ├── 1_MiniDraw │ ├── project │ │ ├── src │ │ │ ├── CMakeLists.txt │ │ │ └── App │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── minidraw.qrc │ │ │ │ ├── Rect.h │ │ │ │ ├── Ellipse.h │ │ │ │ ├── Line.h │ │ │ │ ├── Polygon.h │ │ │ │ ├── Freehand.h │ │ │ │ ├── Line.cpp │ │ │ │ ├── Rect.cpp │ │ │ │ ├── main.cpp │ │ │ │ ├── Ellipse.cpp │ │ │ │ ├── Freehand.cpp │ │ │ │ ├── Polygon.cpp │ │ │ │ ├── viewwidget.ui │ │ │ │ ├── ShapeManager.h │ │ │ │ └── minidraw.h │ │ ├── README.md │ │ └── CMakeSettings.json │ ├── documents │ │ ├── hello │ │ │ ├── src │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── App │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── hello │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── main.cpp │ │ │ │ │ ├── mainwindow.h │ │ │ │ │ ├── mainwindow.ui │ │ │ │ │ └── mainwindow.cpp │ │ │ └── README.md │ │ └── example │ │ │ ├── src │ │ │ ├── CMakeLists.txt │ │ │ └── App │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── example.qrc │ │ │ │ ├── main.cpp │ │ │ │ ├── example.h │ │ │ │ └── example.cpp │ │ │ └── README.md │ ├── hw1-minidraw-demo.avi │ └── README.md ├── 3_PoissonImageEditing │ ├── project │ │ ├── include │ │ │ └── _deps │ │ │ │ └── README.md │ │ ├── src │ │ │ └── App │ │ │ │ ├── Resources │ │ │ │ └── images │ │ │ │ │ ├── open.jpg │ │ │ │ │ └── save.jpg │ │ │ │ ├── mainwindow.qrc │ │ │ │ ├── main.cpp │ │ │ │ ├── Ellipse.h │ │ │ │ ├── Line.h │ │ │ │ ├── Rect.h │ │ │ │ ├── Freehand.h │ │ │ │ ├── Polygon.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Line.cpp │ │ │ │ ├── ChildWindow.cpp │ │ │ │ ├── Ellipse.cpp │ │ │ │ ├── Freehand.cpp │ │ │ │ ├── ChildWindow.h │ │ │ │ ├── Rect.cpp │ │ │ │ ├── ShapeManager.h │ │ │ │ └── mainwindow.ui │ │ └── CMakeSettings.json │ ├── documents │ │ ├── opencv_example │ │ │ └── src │ │ │ │ └── test │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Resources │ │ │ │ └── images │ │ │ │ │ ├── open.jpg │ │ │ │ │ └── save.jpg │ │ │ │ ├── mainwindow.qrc │ │ │ │ ├── main.cpp │ │ │ │ └── mainwindow.ui │ │ └── ScanningLine.md │ └── README.md ├── 7_SimulationTaichi │ ├── project │ │ ├── src │ │ │ ├── app │ │ │ │ └── CMakeLists.txt │ │ │ └── example │ │ │ │ ├── 03_cubes │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 00_mls_mpm88 │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 01_mls_mpm88_x │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 02_snowball │ │ │ │ └── CMakeLists.txt │ │ │ │ └── 04_fountain │ │ │ │ └── CMakeLists.txt │ │ └── README.md │ └── README.md ├── 8_Shader │ ├── project │ │ ├── src │ │ │ ├── tool │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── SimpleLoader.h │ │ │ └── app │ │ │ │ ├── 0_displacement_normal │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── 1_denoise │ │ │ │ └── CMakeLists.txt │ │ │ │ └── 2_shadow │ │ │ │ └── CMakeLists.txt │ │ ├── data │ │ │ ├── shaders │ │ │ │ ├── empty.frag │ │ │ │ ├── p3.vert │ │ │ │ └── p3t2n3.vert │ │ │ └── models │ │ │ │ └── CMakeLists.txt │ │ └── include │ │ │ └── _deps │ │ │ └── CMakeLists.txt │ └── README.md ├── 9_PathTracing │ ├── project │ │ ├── src │ │ │ ├── PathTracer │ │ │ │ └── CMakeLists.txt │ │ │ └── UEditor │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Editor.h │ │ │ │ ├── Cmpt │ │ │ │ ├── ArcBall.h │ │ │ │ ├── Roamer.h │ │ │ │ ├── PathTracerAgency.h │ │ │ │ ├── Hierarchy.h │ │ │ │ └── Inspector.h │ │ │ │ └── GenScene.h │ │ └── data │ │ │ ├── shaders │ │ │ ├── img.fs │ │ │ ├── p2t2.vs │ │ │ ├── env.vs │ │ │ ├── p3t2.vs │ │ │ ├── postprocess.fs │ │ │ ├── env.fs │ │ │ ├── light.fs │ │ │ └── p3t2n3t3.vs │ │ │ └── textures │ │ │ └── CMakeLists.txt │ └── README.md ├── 6_MassSpring │ ├── documents │ │ └── tetgen │ │ │ ├── data │ │ │ ├── cube.stl │ │ │ └── cube.poly │ │ │ ├── src │ │ │ ├── TetGene │ │ │ │ ├── Tet_generate.cpp │ │ │ │ ├── main.cpp │ │ │ │ ├── Tet_generate.h │ │ │ │ ├── globalFunctions.h │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ │ └── README.md │ ├── README.md │ └── project │ │ └── README.md └── 5_ARAP │ └── README.md ├── Reports ├── hw6-demo.avi ├── hw7-taichi-demo.mp4 ├── hw1-minidraw-demo.avi └── assets │ ├── 1583098161615.png │ ├── 1583098210666.png │ ├── 1583098272933.png │ ├── 1583699140233.png │ ├── 1583700528440.png │ ├── 1583700762855.png │ ├── 1583700774519.png │ ├── 1583700865694.png │ ├── 1583704170672.png │ ├── 1584284532305.png │ ├── 1584300546008.png │ ├── 1584300591475.png │ ├── 1584300649657.png │ ├── 1584300677296.png │ ├── 1584300793632.png │ ├── 1584300843377.png │ ├── hw1-class-diagram.png │ ├── NAR]A@_D_5XJIRE2WIA9H54.png │ ├── image-20200323015637652.png │ ├── image-20200327011756903.png │ ├── image-20200327012117541.png │ ├── image-20200327012132998.png │ ├── image-20200327230346905.png │ ├── image-20200328020952204.png │ ├── image-20200328021706013.png │ ├── image-20200406042730673.png │ └── image-20200406044430748.png ├── .gitignore └── Softwares └── Qt.md /strategy.md: -------------------------------------------------------------------------------- 1 | # 攻略 2 | 3 | 暂无内容。 4 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/ImageWarper.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/data/P3.txt: -------------------------------------------------------------------------------- 1 | P 2 2 | 1 2 3 | 4 -3 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/data/P4.txt: -------------------------------------------------------------------------------- 1 | P 2 2 | 1 4 3 | 4 -3 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/data/P6.txt: -------------------------------------------------------------------------------- 1 | P 2 2 | 2 4 3 | 3 -2 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/data/P3.txt: -------------------------------------------------------------------------------- 1 | P 2 2 | 1 2 3 | 4 -3 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/data/P4.txt: -------------------------------------------------------------------------------- 1 | P 2 2 | 1 4 3 | 4 -3 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/data/P6.txt: -------------------------------------------------------------------------------- 1 | P 2 2 | 2 4 3 | 3 -2 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/Sampler2D.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/Sampler3D.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() 2 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | *.txt 3 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/bin/README.md: -------------------------------------------------------------------------------- 1 | 程序默认的工作路径 -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() 2 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/include/_deps/README.md: -------------------------------------------------------------------------------- 1 | # 依赖库 2 | 3 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/.gitignore: -------------------------------------------------------------------------------- 1 | Resources/ 2 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Intersector/Intersector.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() 2 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/App/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() 2 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/eigen_example/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() 2 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/include/_deps/README.md: -------------------------------------------------------------------------------- 1 | # 依赖 2 | 3 | 依赖库头文件放于此处 4 | 5 | -------------------------------------------------------------------------------- /Reports/hw6-demo.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/hw6-demo.avi -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/eigen_example/src/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddSubDirs() 2 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/src/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" TEST ON) 2 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/eigen_example/include/_deps/README.md: -------------------------------------------------------------------------------- 1 | # 依赖 2 | 3 | - Eigen 4 | 5 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/.gitignore: -------------------------------------------------------------------------------- 1 | App/RTGIwRRF/ 2 | CppUtil/ 3 | _DEBUG_* 4 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array5/Array.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Array.h" 3 | 4 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" QT ON LIBS "Qt5::Widgets") 2 | -------------------------------------------------------------------------------- /Reports/hw7-taichi-demo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/hw7-taichi-demo.mp4 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/data/P1.txt: -------------------------------------------------------------------------------- 1 | P 8 2 | 0 2 3 | 5 -3 4 | 12 5 5 | 2 6 6 | 5 7 7 | 3 -4 8 | 2 9 9 | 2 2 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/data/P1.txt: -------------------------------------------------------------------------------- 1 | P 8 2 | 0 2 3 | 5 -3 4 | 12 5 5 | 2 6 6 | 5 7 7 | 3 -4 8 | 2 9 9 | 2 2 -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/src/example/03_cubes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" TEST ON) 2 | -------------------------------------------------------------------------------- /Reports/hw1-minidraw-demo.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/hw1-minidraw-demo.avi -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/data/P2.txt: -------------------------------------------------------------------------------- 1 | P 8 2 | 0 4 3 | 4 -3 4 | 11 4 5 | 3 -4 6 | 4 7 7 | 7 -4 8 | 4 -8 9 | 6 4 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/data/P2.txt: -------------------------------------------------------------------------------- 1 | P 8 2 | 0 4 3 | 4 -3 4 | 11 4 5 | 3 -4 6 | 4 7 7 | 7 -4 8 | 4 -8 9 | 6 4 -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/src/App/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" QT ON LIBS "Qt5::Widgets") 2 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/ShapeMesh/desktop.ini: -------------------------------------------------------------------------------- 1 | [LocalizedFileNames] 2 | Cube.cpp=@Cube.cpp,0 3 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/src/example/00_mls_mpm88/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" TEST ON) 2 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/src/example/01_mls_mpm88_x/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" TEST ON) 2 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/src/example/02_snowball/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" TEST ON) 2 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/src/example/04_fountain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" TEST ON) 2 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/src/tool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "LIB" LIBS "Ubpa::UGM_core;Ubpa::UGL_core") 2 | -------------------------------------------------------------------------------- /Reports/assets/1583098161615.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583098161615.png -------------------------------------------------------------------------------- /Reports/assets/1583098210666.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583098210666.png -------------------------------------------------------------------------------- /Reports/assets/1583098272933.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583098272933.png -------------------------------------------------------------------------------- /Reports/assets/1583699140233.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583699140233.png -------------------------------------------------------------------------------- /Reports/assets/1583700528440.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583700528440.png -------------------------------------------------------------------------------- /Reports/assets/1583700762855.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583700762855.png -------------------------------------------------------------------------------- /Reports/assets/1583700774519.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583700774519.png -------------------------------------------------------------------------------- /Reports/assets/1583700865694.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583700865694.png -------------------------------------------------------------------------------- /Reports/assets/1583704170672.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1583704170672.png -------------------------------------------------------------------------------- /Reports/assets/1584284532305.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584284532305.png -------------------------------------------------------------------------------- /Reports/assets/1584300546008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584300546008.png -------------------------------------------------------------------------------- /Reports/assets/1584300591475.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584300591475.png -------------------------------------------------------------------------------- /Reports/assets/1584300649657.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584300649657.png -------------------------------------------------------------------------------- /Reports/assets/1584300677296.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584300677296.png -------------------------------------------------------------------------------- /Reports/assets/1584300793632.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584300793632.png -------------------------------------------------------------------------------- /Reports/assets/1584300843377.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/1584300843377.png -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/App/hello/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" QT ON LIBS "Qt5::Widgets") 2 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/eigen_example/src/test/00_LinearEquation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE") 2 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/README.md: -------------------------------------------------------------------------------- 1 | 引擎内部实现了 `#include` 功能,生成的 `_DEBUG_*.h` 文件是用于 debug 的 2 | 3 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/data/shaders/empty.frag: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | void main() 4 | { 5 | // empty 6 | } 7 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/ann_example/src/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "EXE" LIBS "UANN_ann_static") 2 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/PathTracer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget(MODE "LIB" 2 | LIBS "Ubpa::UEngine_core" 3 | ) 4 | -------------------------------------------------------------------------------- /Reports/assets/hw1-class-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/hw1-class-diagram.png -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/minidraw.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/libraries/DArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_SetupTarget(MODE DLL NAME DArray SOURCES DArray.cpp LIBS "") 2 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/src/App/example.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/hw1-minidraw-demo.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/1_MiniDraw/hw1-minidraw-demo.avi -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/empty.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | in vec4 FragPos; 3 | 4 | void main() 5 | { 6 | } -------------------------------------------------------------------------------- /Reports/assets/NAR]A@_D_5XJIRE2WIA9H54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/NAR]A@_D_5XJIRE2WIA9H54.png -------------------------------------------------------------------------------- /Reports/assets/image-20200323015637652.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200323015637652.png -------------------------------------------------------------------------------- /Reports/assets/image-20200327011756903.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200327011756903.png -------------------------------------------------------------------------------- /Reports/assets/image-20200327012117541.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200327012117541.png -------------------------------------------------------------------------------- /Reports/assets/image-20200327012132998.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200327012132998.png -------------------------------------------------------------------------------- /Reports/assets/image-20200327230346905.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200327230346905.png -------------------------------------------------------------------------------- /Reports/assets/image-20200328020952204.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200328020952204.png -------------------------------------------------------------------------------- /Reports/assets/image-20200328021706013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200328021706013.png -------------------------------------------------------------------------------- /Reports/assets/image-20200406042730673.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200406042730673.png -------------------------------------------------------------------------------- /Reports/assets/image-20200406044430748.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Reports/assets/image-20200406044430748.png -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/UEngine.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/7_UseDll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_SetupTarget(MODE "EXE" NAME "7_UseDll" SOURCES "main.cpp" LIBS "DArray") -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/data/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/2_ImageWarping/project/data/test.png -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/.gitignore: -------------------------------------------------------------------------------- 1 | glad/ 2 | glm/ 3 | KHR/ 4 | GLFW/glfw3.h 5 | GLFW/glfw3native.h 6 | Eigen/ 7 | HEMesh/ 8 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/data/P5.txt: -------------------------------------------------------------------------------- 1 | P 10 2 | 3 -3 3 | 2 3 4 | 10 40 5 | 30 -14 6 | 24 17 7 | 71 -24 8 | 42 -18 9 | 61 24 10 | 9 -45 11 | 2 -2 -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/6_UseLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_SetupTarget(MODE "EXE" NAME "6_UseLib" SOURCES "main.cpp" LIBS "PolynomialList") -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/data/P5.txt: -------------------------------------------------------------------------------- 1 | P 10 2 | 3 -3 3 | 2 3 4 | 10 40 5 | 30 -14 6 | 24 17 7 | 71 -24 8 | 42 -18 9 | 61 24 10 | 9 -45 11 | 2 -2 -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/DirectionalLight/genDepth.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | in vec4 FragPos; 3 | 4 | void main() 5 | { 6 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/UI/Grid.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/UI/Grid.cpp -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/data/cube.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/6_MassSpring/documents/tetgen/data/cube.stl -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/libraries/PolynomialList/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_SetupTarget(MODE "LIB" NAME "PolynomialList" SOURCES "PolynomialList.cpp" LIBS "") -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/OpenGL/VAO.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/OpenGL/VAO.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/include/README.md: -------------------------------------------------------------------------------- 1 | 本目录一般放置公用的库头文件,在代码中通过`#include <*.h>`来引用,须通过头文件路径设置才能找到。 2 | 3 | 注:如果非公用头文件,头文件可放在代码目录中,通过`#include "*.h"`来引用即可。 4 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Math.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Basic/Math.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Node.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Basic/Node.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Timer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Basic/Timer.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/UI/Hierarchy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/UI/Hierarchy.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/Film.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/Film.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/OpenGL/Texture.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/OpenGL/Texture.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/UI/Hierarchy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/UI/Hierarchy.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/line.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/line.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/quat.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/quat.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/HeapObj.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Basic/HeapObj.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/LStorage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Basic/LStorage.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/OpenGL/Camera.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/OpenGL/Camera.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/BVHNode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/BVHNode.h -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/include/README.md: -------------------------------------------------------------------------------- 1 | `\include`目录一般放置公用的库头文件,在代码中通过`#include <*.h>`来引用,须通过头文件路径设置才能找到。 2 | 3 | 注:如果非公用头文件,头文件可放在代码目录中,通过`#include "*.h"`来引用即可。 4 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/libraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TARGET_PREFIX "") 2 | 3 | Ubpa_GetDirName(DIRNAME) 4 | set(FOLDER_NAME ${DIRNAME}) 5 | 6 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/libraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TARGET_PREFIX "") 2 | 3 | Ubpa_GetDirName(DIRNAME) 4 | set(FOLDER_NAME ${DIRNAME}) 5 | 6 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/basic.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/basic.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/plane.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/plane.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Op/LambdaOp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Basic/Op/LambdaOp.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/SObj.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/SObj.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetTargetName(UI "${PROJECT_SOURCE_DIR}/src/UI") 2 | 3 | Ubpa_AddTarget(MODE "EXE" QT ON LIBS ${UI}) 4 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/UEngine.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/UEngine.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/BVHNode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/BVHNode.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/FilmTile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/FilmTile.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/FilmTile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/FilmTile.h -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/7_UseDll/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/executables/7_UseDll/main.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/7_UseDll/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/samples/src/executables/7_UseDll/main.cpp -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/Resources/images/new.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/2_ImageWarping/project/src/App/Resources/images/new.jpg -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/intersect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/intersect.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/Light.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/Light.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/GGX.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/GGX.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Scene/SObjLoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Scene/SObjLoader.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/Raster.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/Raster.cpp -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/Resources/images/open.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/2_ImageWarping/project/src/App/Resources/images/open.jpg -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/Resources/images/save.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/2_ImageWarping/project/src/App/Resources/images/save.jpg -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/AreaLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/AreaLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/DiskLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/DiskLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/SpotLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/SpotLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Plane.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Plane.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/BVHAccel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/BVHAccel.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/Raster.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/Raster.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/MeshEdit/Simulate.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/MeshEdit/Simulate.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Primitive/TriMesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Primitive/TriMesh.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/RTX_Renderer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/RTX_Renderer.cpp -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/src/TetGene/Tet_generate.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/6_MassSpring/documents/tetgen/src/TetGene/Tet_generate.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/1_BasicDArray/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/executables/1_BasicDArray/main.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/1_BasicDArray/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/samples/src/executables/1_BasicDArray/main.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/PointLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/PointLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/SphereLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/SphereLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/Beckmann.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/Beckmann.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/MeshEdit/Simulate.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/MeshEdit/Simulate.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Capsule.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Capsule.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Sphere.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Sphere.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/PathTracer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/PathTracer.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/RayTracer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/RayTracer.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/AliasMethod.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/AliasMethod.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/ShapeMesh/SphereMesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Basic/ShapeMesh/SphereMesh.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/EnvGenerator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/EnvGenerator.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/3_TemplateDArray/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/executables/3_TemplateDArray/main.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/3_TemplateDArray/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/samples/src/executables/3_TemplateDArray/main.cpp -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Resources/images/open.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/3_PoissonImageEditing/project/src/App/Resources/images/open.jpg -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Resources/images/save.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/3_PoissonImageEditing/project/src/App/Resources/images/save.jpg -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/AreaLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/AreaLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/DiskLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/DiskLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/SpotLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/SpotLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/CapsuleLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/CapsuleLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/SchlickGGX.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/SchlickGGX.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Triangle.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Triangle.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/GenScene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Scene; 7 | Ptr GenScene(int n); 8 | } 9 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/CosHsSample3D.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/CosHsSample3D.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/ShapeMesh/CapsuleMesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Basic/ShapeMesh/CapsuleMesh.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/DLDM_Generator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/DLDM_Generator.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/ForwardRaster.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/ForwardRaster.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/PLDM_Generator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/PLDM_Generator.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/SLDM_Generator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/SLDM_Generator.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/2_EfficientDArray/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/executables/2_EfficientDArray/main.cpp -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/2_EfficientDArray/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/samples/src/executables/2_EfficientDArray/main.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/PointLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/PointLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/SphereLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/SphereLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/DirectionalLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/DirectionalLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/CapsuleLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Light/CapsuleLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/InfiniteAreaLight.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Light/InfiniteAreaLight.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/BSDF_Frostbite.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/BSDF_Frostbite.h -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/libraries/PolynomialList/PolynomialList.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/libraries/PolynomialList/PolynomialList.cpp -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(libs "Qt5::Widgets") 2 | 3 | if(USE_ANN) 4 | list(APPEND libs "UANN_ann_static") 5 | endif() 6 | 7 | Ubpa_AddTarget(MODE "EXE" QT ON LIBS ${libs}) 8 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/BSDF_MetalWorkflow.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/BSDF_MetalWorkflow.h -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/5_map_Polynomial/PolynomialList.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/executables/5_map_Polynomial/PolynomialList.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Intersector/ClosestIntersector.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Intersector/ClosestIntersector.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Intersector/VisibilityChecker.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Intersector/VisibilityChecker.h -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetTargetName(pathtracer ${PROJECT_SOURCE_DIR}/src/PathTracer) 2 | 3 | Ubpa_AddTarget(MODE "EXE" 4 | LIBS Ubpa::UEngine_core ${pathtracer} 5 | ) 6 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/4_list_Polynomial/PolynomialList.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/0_CppPratices/project/src/executables/4_list_Polynomial/PolynomialList.cpp -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/MicrofacetDistribution.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/MicrofacetDistribution.h -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/config/ROOT_PATH.h.in: -------------------------------------------------------------------------------- 1 | #ifndef _ROOT_PATH_H_ 2 | #define _ROOT_PATH_H_ 3 | 4 | #include 5 | 6 | const std::string ROOT_PATH("${CMAKE_SOURCE_DIR}/"); 7 | 8 | #endif //!_ROOT_PATH_H_ -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) out vec4 FragColor; 3 | 4 | uniform vec3 color; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(color, 1.0); 9 | } -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_AddTarget_GDR(MODE "EXE" QT ON 2 | LIBS_GENERAL "Qt5::Widgets" 3 | LIBS_DEBUG "opencv_world420d.lib" 4 | LIBS_RELEASE "opencv_world420.lib") 5 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/Resources/images/open.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/Resources/images/open.jpg -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/Resources/images/save.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libreliu/USTC-CG/HEAD/Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/Resources/images/save.jpg -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB",生成 dll 就 "DLL" 2 | set(mode "EXE") 3 | set(TARGET_PREFIX "") 4 | 5 | Ubpa_GetDirName(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB",生成 dll 就 "DLL" 2 | set(mode "EXE") 3 | set(TARGET_PREFIX "") 4 | 5 | Ubpa_GetDirName(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #生成 exe 就 "EXE",生成 lib 就 "LIB",生成 dll 就 "DLL" 2 | set(mode "EXE") 3 | set(TARGET_PREFIX "") 4 | 5 | Ubpa_GetDirName(DIRNAME) 6 | set(FOLDER_NAME ${DIRNAME}) 7 | 8 | Ubpa_AddSubDirs() -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/mainwindow.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/images/open.jpg 4 | Resources/images/save.jpg 5 | 6 | 7 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/PointLight/genDepth.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | 6 | void main() 7 | { 8 | gl_Position = model * vec4(aPos, 1.0); 9 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/_deps/README.md: -------------------------------------------------------------------------------- 1 | # 依赖 2 | 3 | - [stb_image.h](https://github.com/nothings/stb/blob/master/stb_image.h) 4 | - [stb_image_write.h](https://github.com/nothings/stb/blob/master/stb_image_write.h) 5 | 6 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Parallel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | #include 6 | 7 | Parallel::Parallel() 8 | : coreNum(static_cast(omp_get_num_procs())) { } 9 | 10 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GlobGroupSrcs(RST sources PATHS 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | "${PROJECT_SOURCE_DIR}/include/Basic" 4 | ) 5 | 6 | Ubpa_AddTarget(MODE "LIB" SOURCES ${sources} LIBS Ubpa::UGM_core) 7 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Rect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include"Shape.h" 4 | namespace DrawContext { 5 | class Rect :public Shape 6 | { 7 | public: 8 | Rect(); 9 | ~Rect(); 10 | 11 | void Draw(QPainter& painter); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/mainwindow.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/images/open.jpg 4 | Resources/images/save.jpg 5 | 6 | 7 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/img.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoord; 5 | 6 | // texture samplers 7 | uniform sampler2D img; 8 | 9 | void main() 10 | { 11 | FragColor = texture(img, TexCoord); 12 | } 13 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/src/App/main.cpp: -------------------------------------------------------------------------------- 1 | #include "example.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | example w; 8 | w.show(); 9 | return a.exec(); 10 | } 11 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Ellipse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | class Ellipse : public Shape { 7 | public: 8 | Ellipse(); 9 | ~Ellipse(); 10 | 11 | void Draw(QPainter& painter); 12 | }; 13 | 14 | }; -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | return a.exec(); 10 | } 11 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_T2.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture0; 7 | 8 | void main(){ 9 | FragColor = vec4(texture(texture0, TexCoords).rgb, 1.0f); 10 | } -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Line.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | 7 | class Line :public Shape 8 | { 9 | public: 10 | Line(); 11 | ~Line(); 12 | 13 | void Draw(QPainter& painter); 14 | }; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Sampler/Sampler2D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Sampler2D { 7 | public: 8 | virtual const valf2 GetSample() const = 0; 9 | virtual ~Sampler2D() {} 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/App/hello/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/mainwindow.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/images/new.jpg 4 | Resources/images/open.jpg 5 | Resources/images/save.jpg 6 | 7 | 8 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Ellipse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | class Ellipse : public Shape { 7 | public: 8 | Ellipse(); 9 | ~Ellipse(); 10 | 11 | void Draw(QPainter& painter); 12 | }; 13 | 14 | }; -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Line.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | 7 | class Line :public Shape 8 | { 9 | public: 10 | Line(); 11 | ~Line(); 12 | 13 | void Draw(QPainter& painter); 14 | }; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | 7 | uniform mat4 model; 8 | 9 | void main(){ 10 | gl_Position = projection * view * model * vec4(aPos,1.0); 11 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Sampler/UniformGridSampler2D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Sampler2D.h" 4 | 5 | namespace Ubpa { 6 | class UniformGridSampler2D : public Sampler2D { 7 | public: 8 | virtual const valf2 GetSample() const; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Polygon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | 7 | class Polygon :public Shape 8 | { 9 | public: 10 | Polygon(); 11 | ~Polygon(); 12 | 13 | void Draw(QPainter& painter); 14 | }; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | return a.exec(); 10 | } 11 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/MVP_P3.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 proj; 7 | 8 | void main() 9 | { 10 | gl_Position = proj * view * model * vec4(aPos, 1.0); 11 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/DirectionalLight/genDepth.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | uniform mat4 model; 5 | uniform mat4 lightProjView; 6 | 7 | void main() 8 | { 9 | gl_Position = lightProjView * model * vec4(aPos, 1.0); 10 | } -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/data/shaders/p3.vert: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | 5 | uniform mat4 projection; 6 | uniform mat4 view; 7 | uniform mat4 model; 8 | 9 | void main() 10 | { 11 | gl_Position = projection * view * model * vec4(aPos, 1.0); 12 | } 13 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/data/models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_DownloadFile( 2 | https://ubpa.github.io/USTC_CG_Data/Homeworks/08_Shader/models/spot_triangulated_good.obj 3 | ${CMAKE_CURRENT_SOURCE_DIR}/spot_triangulated_good.obj 4 | SHA256 6B24ADB11D65CF3658FA76BC1D589525E51AB997E442859EAC7CA3211B8E0357 5 | ) 6 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/p2t2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec2 aTexCoord; 4 | 5 | out vec2 TexCoord; 6 | 7 | void main() 8 | { 9 | TexCoord = aTexCoord; 10 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 11 | } 12 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P2T2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec2 aPos; 4 | layout (location = 1) in vec2 aTexCoords; 5 | 6 | out vec2 TexCoords; 7 | 8 | void main() 9 | { 10 | TexCoords = aTexCoords; 11 | gl_Position = vec4(aPos, 0.0, 1.0); 12 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GlobGroupSrcs(RST sources PATHS 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | "${PROJECT_SOURCE_DIR}/include/Qt" 4 | ) 5 | Ubpa_GetTargetName(Basic "${PROJECT_SOURCE_DIR}/src/Basic") 6 | Ubpa_AddTarget(MODE "LIB" QT ON SOURCES ${sources} LIBS "${Basic};Qt5::Widgets") 7 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Sampler/Sampler3D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Sampler3D { 7 | public: 8 | virtual const valf3 GetSample() = 0; 9 | virtual const valf3 GetSample(float& pd) = 0; 10 | virtual ~Sampler3D() {} 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Scene/Component.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | void Component::Init_AfterGenPtr() { 8 | auto sobj = GetSObj(); 9 | if (sobj) 10 | sobj->AttachComponent(This()); 11 | } 12 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Scene/SimpleLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class SObj; 9 | namespace SimpleLoader { 10 | Ptr LoadObj(const std::string& path); 11 | Ptr LoadTet(const std::string& path); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/IBL/cubemap.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 WorldPos; 5 | 6 | uniform mat4 projection; 7 | uniform mat4 view; 8 | 9 | void main() 10 | { 11 | WorldPos = aPos; 12 | gl_Position = projection * view * vec4(WorldPos, 1.0); 13 | } -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Rect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include"Shape.h" 4 | namespace DrawContext { 5 | class Rect :public Shape 6 | { 7 | public: 8 | Rect(); 9 | ~Rect(); 10 | 11 | void Draw(QPainter& painter); 12 | virtual const Eigen::Matrix &getMaskMatrix() override; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/camera.h: -------------------------------------------------------------------------------- 1 | // 160 2 | layout (std140) uniform Camera{ 3 | mat4 view; // 64 0 64 4 | mat4 projection; // 64 64 64 5 | vec3 viewPos; // 12 128 144 6 | float nearPlane; // 4 144 148 7 | float farPlane; // 4 148 152 8 | float fov; // 4 152 156 9 | float ar; // 4 156 160 10 | }; 11 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Freehand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | 7 | class Freehand :public Shape 8 | { 9 | public: 10 | Freehand(); 11 | ~Freehand(); 12 | 13 | 14 | void Draw(QPainter& painter) override; 15 | private: 16 | std::vector path; 17 | }; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/OpenGL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GlobGroupSrcs(RST sources PATHS 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | "${PROJECT_SOURCE_DIR}/include/OpenGL" 4 | ) 5 | add_definitions(-DUSE_QT_OPENGL_API) 6 | Ubpa_GetTargetName(Basic "${PROJECT_SOURCE_DIR}/src/Basic") 7 | Ubpa_AddTarget(MODE "LIB" SOURCES ${sources} LIBS ${Basic} Qt5::Widgets) 8 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Freehand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | 7 | class Freehand :public Shape 8 | { 9 | public: 10 | Freehand(); 11 | ~Freehand(); 12 | 13 | 14 | void Draw(QPainter& painter) override; 15 | private: 16 | std::vector path; 17 | }; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Polygon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace DrawContext { 6 | 7 | class Polygon :public Shape 8 | { 9 | public: 10 | Polygon(); 11 | ~Polygon(); 12 | 13 | void Draw(QPainter& painter); 14 | const Eigen::Matrix &getMaskMatrix() override; 15 | }; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/AllComponents.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/src/app/0_displacement_normal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetTargetName(tool "${PROJECT_SOURCE_DIR}/src/tool") 2 | set(src 3 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 4 | ${PROJECT_SOURCE_DIR}/data/shaders/dn.vert 5 | ${PROJECT_SOURCE_DIR}/data/shaders/light_dn.frag) 6 | Ubpa_AddTarget(MODE "EXE" SOURCES ${src} LIBS "Ubpa::UGL_core;glfw;${tool}") 7 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/src/app/1_denoise/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(src 2 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 3 | ${PROJECT_SOURCE_DIR}/data/shaders/p3t2n3_denoise.vert 4 | ${PROJECT_SOURCE_DIR}/data/shaders/light.frag) 5 | 6 | Ubpa_GetTargetName(tool "${PROJECT_SOURCE_DIR}/src/tool") 7 | Ubpa_AddTarget(MODE "EXE" SOURCES ${src} LIBS "Ubpa::UGL_core;glfw;${tool}") 8 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Intersector/Intersector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class SObj; 7 | 8 | class Sphere; 9 | class Plane; 10 | class Triangle; 11 | class TriMesh; 12 | class BVHAccel; 13 | class Disk; 14 | class Capsule; 15 | 16 | class Intersector { }; 17 | } 18 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Sampler/UniformGridSampler2D.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | const valf2 UniformGridSampler2D::GetSample() const { 8 | 9 | float x = Math::Rand_F(); 10 | float y = Math::Rand_F(); 11 | 12 | return valf2(x, y); 13 | } 14 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Line.cpp: -------------------------------------------------------------------------------- 1 | #include "Line.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Line::Line() 6 | { 7 | this->setAttr("point-required", 2); 8 | } 9 | 10 | Line::~Line() 11 | { 12 | } 13 | 14 | void Line::Draw(QPainter& painter) 15 | { 16 | if (ctrl_points.size() == 2) { 17 | painter.drawLine(ctrl_points[0], ctrl_points[1]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Rect.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Rect::Rect() 6 | { 7 | this->setAttr("point-required", 2); 8 | } 9 | 10 | Rect::~Rect() 11 | { 12 | } 13 | 14 | void Rect::Draw(QPainter& painter) 15 | { 16 | if (ctrl_points.size() == 2) { 17 | painter.drawRect(QRect(ctrl_points[0], ctrl_points[1])); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(MSVC) 2 | Ubpa_AddTarget_GDR(MODE "EXE" QT ON 3 | LIBS_GENERAL "Qt5::Widgets" 4 | LIBS_DEBUG "opencv_world420d.lib" 5 | LIBS_RELEASE "opencv_world420.lib") 6 | else() 7 | Ubpa_AddTarget_GDR(MODE "EXE" QT ON 8 | LIBS_GENERAL "Qt5::Widgets" 9 | LIBS_DEBUG ${OpenCV_LIBS} 10 | LIBS_RELEASE ${OpenCV_LIBS}) 11 | 12 | endif() -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Line.cpp: -------------------------------------------------------------------------------- 1 | #include "Line.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Line::Line() 6 | { 7 | this->setAttr("point-required", 2); 8 | } 9 | 10 | Line::~Line() 11 | { 12 | } 13 | 14 | void Line::Draw(QPainter& painter) 15 | { 16 | if (ctrl_points.size() == 2) { 17 | painter.drawLine(ctrl_points[0], ctrl_points[1]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/env.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoord; 5 | 6 | uniform mat4 view; 7 | uniform mat4 projection; 8 | 9 | void main() 10 | { 11 | TexCoord = aPos; 12 | mat4 viewNoT = mat4(mat3(view)); 13 | vec4 pos = projection * viewNoT * vec4(aPos, 1.0); 14 | gl_Position = pos.xyww; 15 | } 16 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/textures/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_DownloadFile( 2 | https://cdn.jsdelivr.net/gh/Ubpa/USTC_CG_data@master/Homeworks/09_PathTracing/newport_loft.hdr 3 | # https://ubpa.github.io/USTC_CG_Data/Homeworks/09_PathTracing/newport_loft.hdr 4 | ${CMAKE_CURRENT_LIST_DIR}/newport_loft.hdr 5 | SHA256 F521688AB09B3E748341921D0C8C114D1256E6CA9E94C6E6783B9952B0042C44 6 | ) 7 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array1.0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array1.1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array4/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "Array.h" 5 | 6 | void main() 7 | { 8 | DArray pa; 9 | 10 | //pa.InitArray( ); 11 | 12 | pa.SetArraySize( 3 ); 13 | pa.SetValue( 0, 1.0 ); 14 | pa.SetValue( 1, 2.0 ); 15 | pa.SetValue( 2, 3.0 ); 16 | 17 | pa.PrintArray( ); 18 | 19 | //pa.FreeArray( ); 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array5/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GetDirName(DIRNAME) 2 | set(targetName "${DIRNAME}") 3 | #多个源文件用 ';' 分隔 4 | #如:set(sources "main.cpp;src_2.cpp;help.h") 5 | file(GLOB sources 6 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 8 | ) 9 | Ubpa_SetupTarget(MODE "EXE" NAME ${targetName} SOURCES ${sources} LIBS "") 10 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3T2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | layout (location = 1) in vec2 aTexCoords; 7 | 8 | uniform mat4 model; 9 | 10 | out vec2 TexCoords; 11 | 12 | void main(){ 13 | TexCoords = aTexCoords; 14 | 15 | gl_Position = projection * view * model * vec4(aPos,1.0); 16 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Filter/FilterSinc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | float FilterSinc::WindowSinc(float x, float radius) const { 8 | x = std::abs(x); 9 | if (x > radius) 10 | return 0; 11 | const auto lanczos = Math::Sinc(x / tau); 12 | return Math::Sinc(x) * lanczos; 13 | } 14 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Op/Op.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Op : public HeapObj { 7 | protected: 8 | Op(bool isHold = true) :isHold(isHold) { } 9 | virtual ~Op() = default; 10 | 11 | public: 12 | void operator()() { Run(); } 13 | virtual void Run() = 0; 14 | 15 | public: 16 | bool isHold; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | 7 | #if defined(_WIN32) || defined(_WIN64) 8 | _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); 9 | #endif 10 | 11 | QApplication a(argc, argv); 12 | MainWindow w; 13 | w.show(); 14 | return a.exec(); 15 | } 16 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array4/Array.h: -------------------------------------------------------------------------------- 1 | 2 | class DArray 3 | { 4 | private: 5 | int n; // the size of the array 6 | double *pData; // the data of the array 7 | 8 | public: 9 | DArray(); 10 | ~DArray(); 11 | int InitArray( ); 12 | int SetArraySize( int size ); 13 | int FreeArray( ); 14 | int SetValue( int k, double value ); 15 | int PrintArray( ); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Sampler/CosHsSampler3D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Sampler3D.h" 4 | 5 | namespace Ubpa { 6 | class CosHsSampler3D : public Sampler3D { 7 | public: 8 | virtual const valf3 GetSample(); 9 | 10 | // Also returns the probability density at the sample point for use in importance sampling. 11 | virtual const valf3 GetSample(float& pd); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/DirectionalLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | using namespace std; 6 | 7 | const rgbf DirectionalLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 8 | cout << "WARNING::DirectionalLight:" << endl 9 | << "\t" << "not implemented" << endl; 10 | return 0.f; 11 | } 12 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/main.cpp: -------------------------------------------------------------------------------- 1 | #include "minidraw.h" 2 | #include 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | 7 | #if defined(_WIN32) || defined(_WIN64) 8 | _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); 9 | #endif 10 | 11 | QApplication a(argc, argv); 12 | MiniDraw w; 13 | w.show(); 14 | int ret = a.exec(); 15 | return ret; 16 | } 17 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Primitive.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | 5 | namespace Ubpa { 6 | // renderable 7 | class Primitive : public Shape { 8 | protected: 9 | Primitive() = default; 10 | virtual ~Primitive() = default; 11 | 12 | public: 13 | virtual const Ptr GetPrimitive() override { 14 | return This(); 15 | } 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/UI/Setting.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Setting : public Grid { 7 | public: 8 | using Grid::Grid; 9 | 10 | protected: 11 | virtual ~Setting() = default; 12 | 13 | public: 14 | static Ptr GetInstance() { 15 | static auto instance = Ubpa::New(); 16 | return instance; 17 | } 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/p3t2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec2 aTexCoord; 4 | 5 | out vec2 TexCoord; 6 | 7 | uniform mat4 model; 8 | uniform mat4 view; 9 | uniform mat4 projection; 10 | 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0f); 14 | TexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y); 15 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/DeferredPipeline/postProcess.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec3 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D img; 7 | 8 | void main(){ 9 | vec3 color = texture(img, TexCoords).xyz; 10 | 11 | // HDR tonemapping 12 | color = color / (vec3(1.0)+color); 13 | 14 | // gamma 15 | color = pow(color, vec3(1.0/2.2)); 16 | 17 | FragColor = color; 18 | } -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/README.md: -------------------------------------------------------------------------------- 1 | # C to C++ 2 | 3 | 此为 [1_BasicDArray](../) 和 [3_TemplateDArray](../../3_TemplateDArray/) 中的相关项目 4 | 5 | 包含七个子项目 6 | 7 | - Array:固定长度数组 8 | - Array0:动态数组功能实现 9 | - Array 1.0:用 `struct` 打包 `p` 和 `n`,引用形式 10 | - Array 1.1:用 `struct` 打包 `p` 和 `n`,指针形式 11 | - Array 2:函数放到 `struct` 中 12 | - Array 3:改用 `class` 13 | - Array 4:头文件和实现文件 14 | - Array 5:模板 `template` 15 | 16 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Ellipse.cpp: -------------------------------------------------------------------------------- 1 | #include "Ellipse.h" 2 | #include 3 | 4 | using namespace DrawContext; 5 | 6 | Ellipse::Ellipse() 7 | { 8 | this->setAttr("point-required", 2); 9 | } 10 | 11 | 12 | Ellipse::~Ellipse() 13 | { 14 | } 15 | 16 | void Ellipse::Draw(QPainter& painter) 17 | { 18 | if (ctrl_points.size() == 2) { 19 | painter.drawEllipse(QRect(ctrl_points[0], ctrl_points[1])); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/ChildWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "ChildWindow.h" 2 | #include "ImageWidget.h" 3 | 4 | 5 | ChildWindow::ChildWindow(void) 6 | { 7 | imagewidget_ = new ImageWidget(this); 8 | setCentralWidget(imagewidget_); 9 | } 10 | 11 | 12 | ChildWindow::~ChildWindow(void) 13 | { 14 | } 15 | 16 | bool ChildWindow::LoadFile(QString filename) 17 | { 18 | imagewidget_->Open(filename); 19 | return true; 20 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ImgPixelSet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Ubpa { 7 | class ImgPixelSet : public RandSet { 8 | public: 9 | ImgPixelSet(); 10 | ImgPixelSet(size_t width, size_t height); 11 | 12 | using RandSet::RandPick; 13 | std::vector RandPick(size_t n); 14 | std::vector PickAll(); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/src/TetGene/main.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Tet_generate.h" 3 | #include "tetgen.h" 4 | 5 | #include 6 | 7 | using namespace std; 8 | 9 | int main() 10 | { 11 | tetgenio *a; 12 | tetgenio *c; 13 | CTet_generate b; 14 | a = b.poly_in("../data/cube.poly"); 15 | c = b.tet_out(a); 16 | cout << c->numberofpoints << endl; 17 | b.tet_output(c, "../data/2.tet"); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Ellipse.cpp: -------------------------------------------------------------------------------- 1 | #include "Ellipse.h" 2 | #include 3 | 4 | using namespace DrawContext; 5 | 6 | Ellipse::Ellipse() 7 | { 8 | this->setAttr("point-required", 2); 9 | } 10 | 11 | 12 | Ellipse::~Ellipse() 13 | { 14 | } 15 | 16 | void Ellipse::Draw(QPainter& painter) 17 | { 18 | if (ctrl_points.size() == 2) { 19 | painter.drawEllipse(QRect(ctrl_points[0], ctrl_points[1])); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/src/TetGene/Tet_generate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "tetgen.h" 3 | #include "Vec.h" 4 | 5 | using trimesh::vec; 6 | 7 | class CTet_generate 8 | { 9 | public: 10 | CTet_generate(void); 11 | ~CTet_generate(void); 12 | tetgenio* poly_in(char* filename); 13 | tetgenio* tet_out(tetgenio* in); 14 | void tet_output(tetgenio *a, char* filename); 15 | //vec get_normal(tetgenio* tet, int index); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Shape.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class Primitive; 9 | 10 | class Shape : public HeapObj { 11 | protected: 12 | Shape() = default; 13 | virtual ~Shape() = default; 14 | 15 | public: 16 | virtual const bboxf3 GetBBox() const = 0; 17 | virtual const Ptr GetPrimitive() = 0; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/Editor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Editor { 7 | public: 8 | Read scene; 9 | 10 | static Editor& Instance() noexcept { 11 | static Editor instance; 12 | return instance; 13 | } 14 | 15 | void SetCamera(SObj* cameraobj); 16 | 17 | static void OnRegister(); 18 | 19 | private: 20 | Editor(); 21 | ~Editor(); 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/IBL/prefilter.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "../../Math/sample.h" 4 | #include "../BRDF/FDG.h" 5 | 6 | out vec4 FragColor; 7 | in vec3 WorldPos; 8 | 9 | uniform samplerCube environmentMap; 10 | uniform float roughness; 11 | uniform float resolution; 12 | 13 | void main() 14 | { 15 | // TODO 16 | vec3 prefilteredColor = vec3(1,1,1); 17 | 18 | FragColor = vec4(prefilteredColor, 1.0); 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/AllBSDFs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/Material.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Ubpa { 12 | class Image; 13 | 14 | class Material : public HeapObj { 15 | protected: 16 | Material() = default; 17 | virtual ~Material() = default; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/src/app/2_shadow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(src 2 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 3 | ${PROJECT_SOURCE_DIR}/data/shaders/p3t2n3.vert 4 | ${PROJECT_SOURCE_DIR}/data/shaders/p3.vert 5 | ${PROJECT_SOURCE_DIR}/data/shaders/light_shadow.frag 6 | ${PROJECT_SOURCE_DIR}/data/shaders/empty.frag 7 | ) 8 | 9 | Ubpa_GetTargetName(tool "${PROJECT_SOURCE_DIR}/src/tool") 10 | Ubpa_AddTarget(MODE "EXE" SOURCES ${src} LIBS "Ubpa::UGL_core;glfw;${tool}") 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | resources/ 2 | build/ 3 | lib/ 4 | students/ 5 | .vs/ 6 | _deps/ 7 | 8 | *Config.h 9 | 10 | CMakeSettings.json 11 | 12 | *.obj 13 | *.uscene 14 | 15 | *.bmp 16 | *.png 17 | *.jpg 18 | *.gif 19 | *.mp4 20 | *.pdf 21 | 22 | *.html 23 | 24 | *.rar 25 | *.zip 26 | 27 | *.doc 28 | *.docx 29 | *.ppt 30 | *.pptx 31 | 32 | *.filters 33 | *.vcxproj 34 | *.log 35 | *.sln 36 | *.user 37 | *.dll 38 | *.lib 39 | *.exe 40 | *.ilk 41 | *.pdb 42 | /.vscode/settings.json 43 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/1_RBF.md: -------------------------------------------------------------------------------- 1 | # Radial basis functions interpolation method [^RBF] 2 | 3 | $$ 4 | \pmb{f}(\pmb{p})=\sum a_i R(d)+Aq+a 5 | $$ 6 | 7 | 其中 8 | 9 | $$ 10 | R(d)=(d^2+r^2)^{\mu/2} 11 | $$ 12 | 13 | ## 参考文献 14 | 15 | [^RBF]: Arad N, Reisfeld D. [**Image warping using few anchor points and radial functions**](http://citeseer.ist.psu.edu/arad95image.html )[C]//Computer graphics forum. Edinburgh, UK: Blackwell Science Ltd, 1995, 14(1): 35-46. 16 | 17 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/README.md: -------------------------------------------------------------------------------- 1 | # 9. 路径追踪算法 2 | 3 | > Path Tracing 4 | 5 | ## 作业递交 6 | 7 | - 递交内容:程序代码及实验报告(可选:演示视频) 8 | - 递交时间:2020 年 5 月 2 日星期六 9 | 10 | ## 作业要求 11 | 12 | - 实现路径追踪算法 13 | - 环境光贴图重要性采样 14 | - 搭建场景(代码,json)并渲染 15 | 16 | 17 | ## 提供的材料 18 | 19 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 20 | 21 | ### (1) 说明文档 `documents` [->](documents/) 22 | 23 | 本次作业的要求说明和一些辅助资料 24 | 25 | ### (2) 作业项目 `project` [->](project/) 26 | 27 | 本次作业的基础代码框架 28 | 29 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/6_UseLib/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | PolynomialList p1("../data/P3.txt"); 10 | PolynomialList p2("../data/P4.txt"); 11 | PolynomialList p3; 12 | p1.Print(); 13 | p2.Print(); 14 | 15 | p3=p1+p2; 16 | p3.Print(); 17 | p3=p1-p2; 18 | p3.Print(); 19 | 20 | p3=p1*p2; 21 | p3.Print(); 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Material/BSDF_Glass.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | using namespace Ubpa::Math; 8 | 9 | using namespace std; 10 | 11 | const rgbf BSDF_Glass::Sample_f(const normalf & wo, const pointf2 & texcoord, normalf & wi, float & PD) { 12 | cout << "WARNING::BSDF_Glass:" << endl 13 | << "\t" << "not implemented" << endl; 14 | return 0.f; 15 | } 16 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Material/BSDF_Mirror.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | using namespace Ubpa::Math; 8 | 9 | using namespace std; 10 | 11 | const rgbf BSDF_Mirror::Sample_f(const normalf & wo, const pointf2 & texcoord, normalf & wi, float & PD) { 12 | cout << "WARNING::BSDF_Mirror:" << endl 13 | << "\t" << "not implemented" << endl; 14 | return 0.f; 15 | } 16 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ArgManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Ubpa { 8 | class ArgManager { 9 | public: 10 | ArgManager(int argc, char** argv); 11 | std::vector GetAll(const std::string& key); 12 | std::string Get(const std::string& key, size_t idx, const std::string& defaultValue = ""); 13 | private: 14 | std::map> pairs; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/include/_deps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_DownloadFile( 2 | https://ubpa.github.io/USTC_CG_Data/Homeworks/08_Shader/stb_image.h 3 | ${CMAKE_CURRENT_SOURCE_DIR}/stb_image.h 4 | SHA256 73b55b976e61debbb7bc10d5b31c8f043ab5d966e67f75258e0d3f57f2a0321e 5 | ) 6 | 7 | Ubpa_DownloadFile( 8 | https://ubpa.github.io/UData/common/include/stb_image_write.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/stb_image_write.h 10 | SHA256 F34D6E55C7BB69C98BF66F191A7636A0B022047BCE7C7B16A9A9F356046FDC8A 11 | ) 12 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/README.md: -------------------------------------------------------------------------------- 1 | # 参考代码 2 | 3 | 本目录是课前热身练习的参考代码。 4 | 5 | ## 注意事项 6 | 7 | - 每次作业的参考代码一般在作业批改和讲解完毕再提供出来,供同学们作业结束后进行参考及对比学习 8 | - 但本次热身练习是课前布置,希望学生们在春节假期自觉来完成,为开学后的课程打好扎实基础。因此,本次热身练习提前提供参考代码,供同学们自学使用。 9 | - 本次热身练习共包含7个小练习,务必一个小练习一个小练习去完成。每个小练习完成后再去看参考代码进行对比学习。 10 | - 务必完全理解本次热身练习的所有小练习的知识点及代码技巧! 11 | 12 | ### 公用文件夹 13 | 14 | - 文件夹 `include/` 存放库(lib)外部使用者需要调用的头文件。第6个小练习是编写静态库,故将需要开发的接口头文件放在该文件夹内。第4个小练习的头文件放在了 `src/` 相应目录里,因为这里不需要外部使用。 15 | - 文件夹 `data/` 存放项目的相关数据,这里提供给第4个小练习的数据。 16 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/6_UseLib/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(int argc, char** argv) { 9 | PolynomialList p1("../data/P3.txt"); 10 | PolynomialList p2("../data/P4.txt"); 11 | PolynomialList p3; 12 | p1.Print(); 13 | p2.Print(); 14 | 15 | p3 = p1 + p2; 16 | p3.Print(); 17 | p3 = p1 - p2; 18 | p3.Print(); 19 | 20 | p3 = p1 * p2; 21 | p3.Print(); 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/README.md: -------------------------------------------------------------------------------- 1 | # 6. 质点弹簧系统仿真 2 | 3 | 4 | ## 作业递交 5 | 6 | - 递交内容:程序代码及实验报告(含仿真动画视频) 7 | - 递交时间:2020 年 3 月 29 日星期日 8 | 9 | ## 作业要求 10 | 11 | - 在给定的网格框架上完成作业,实现 12 | - 质点弹簧仿真模型的欧拉隐式方法 13 | - 质点弹簧仿真模型的加速模拟方法 14 | - 学习使用 Tetgen 库生成四面体剖分 15 | 16 | 17 | ## 提供的材料 18 | 19 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 20 | 21 | ### (1) 说明文档 `documents` [->](documents/) 22 | 23 | 本次作业的要求说明和一些辅助资料 24 | 25 | ### (2) 作业项目 `project` [->](project/) 26 | 27 | 本次作业的基础代码框架 28 | 29 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/1_BasicDArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/3_TemplateDArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/5_map_Polynomial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/1_BasicDArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/4_list_Polynomial/main.cpp: -------------------------------------------------------------------------------- 1 | #include "PolynomialList.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(int argc, char** argv) { 9 | PolynomialList p1("../data/P3.txt"); 10 | PolynomialList p2("../data/P4.txt"); 11 | PolynomialList p3; 12 | p1.Print(); 13 | p2.Print(); 14 | 15 | p3 = p1 + p2; 16 | p3.Print(); 17 | p3 = p1 - p2; 18 | p3.Print(); 19 | 20 | p3 = p1 * p2; 21 | p3.Print(); 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/5_map_Polynomial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/7_UseDll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "DArray") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Primitive/Disk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Primitive.h" 4 | 5 | namespace Ubpa { 6 | class Disk : public Primitive { 7 | public: 8 | Disk() = default; 9 | 10 | public: 11 | static const Ptr New() { 12 | return Ubpa::New(); 13 | } 14 | 15 | protected: 16 | virtual ~Disk() = default; 17 | 18 | public: 19 | virtual const bboxf3 GetBBox() const override { 20 | return { {-1,-0.001,-1}, {1,0.001,1} }; 21 | } 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 8. 着色器 4 | 5 | ## 作业递交 6 | 7 | - 递交内容:程序代码及实验报告(可选:演示视频) 8 | - 递交时间:2020 年 4 月 19 日星期日 9 | 10 | ## 作业要求 11 | 12 | - 实现 normal map 和 displacement map 13 | - 利用 displacement map 在 vertex shader 中进行简单降噪 14 | - 实现点光源阴影(可选) 15 | 16 | 17 | ## 提供的材料 18 | 19 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 20 | 21 | ### (1) 说明文档 `documents` [->](documents/) 22 | 23 | 本次作业的要求说明和一些辅助资料 24 | 25 | ### (2) 作业项目 `project` [->](project/) 26 | 27 | 本次作业的基础代码框架 28 | 29 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/2_EfficientDArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/4_list_Polynomial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/2_EfficientDArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/4_list_Polynomial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/ann_example/README.md: -------------------------------------------------------------------------------- 1 | # ANN 示例 2 | 3 | ## 目录结构 4 | 5 | 本项目目录包含以下若干子目录: 6 | 7 | - [src/](src/):源代码 8 | 9 | ## 使用说明 10 | 11 | ### 搭建工程 12 | 13 | CMake 三连即可 14 | 15 | ### ANN 16 | 17 | [官方网站](http://www.cs.umd.edu/~mount/ANN/) 提供的源码不包含 CMakeLists.txt,因此我们将其改成 CMake 后移植到了 GitHub 上,详见 [Ubpa | UANN](https://github.com/Ubpa/UANN) 18 | 19 | 项目中的 `UANN_test` 和 `UANN_sample` 的使用方法也请参考 [Ubpa | UANN](https://github.com/Ubpa/UANN) 20 | 21 | 本示例项目提供了[简单的使用方法](src/test/main.cpp) 22 | 23 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/PointLight/genDepth.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | in vec4 FragPos; 3 | 4 | uniform vec3 lightPos; 5 | uniform float lightFar; 6 | 7 | void main() 8 | { 9 | // get distance between fragment and light source 10 | float lightDistance = length(FragPos.xyz - lightPos); 11 | 12 | // map to [0;1] range by dividing by lightFar 13 | lightDistance = lightDistance / lightFar; 14 | 15 | // Write this as modified depth 16 | gl_FragDepth = lightDistance; 17 | } -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/Cmpt/ArcBall.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Ubpa::Cmpt { 7 | class Hierarchy; 8 | 9 | class ArcBall : public Component { 10 | public: 11 | bool reverse_x{ false }; 12 | bool reverse_y{ true }; 13 | float speed{ 1.f }; 14 | 15 | void OnUpdate(const Hierarchy* hierarchy); 16 | 17 | static void OnRegister(); 18 | 19 | private: 20 | vecf3 sphere_p0; 21 | quatf rot; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/5_map_Polynomial/README.md: -------------------------------------------------------------------------------- 1 | # 5. 基于 map 的多项式类 2 | 3 | > **注:** 如果你正在接受这些编程训练,表示你已经同意我们之间的版权协议。请严禁将这些练习的代码(包括你自己的代码)在不经允许的情况下在公共网上公布和散播。一经发现,后果自负。谢谢!-刘利刚 (ligang.liu@gmail.com) 4 | 5 | ## 作业目的 6 | 7 | 作业 1.4 的 `Polynomial` 也可以使用 STL 中的 `map` 类来实现同样的功能。对于 `Polynomial`,它其实就是一个稀疏向量,用 `map` 是更自然的表示,而且从效率上更高。 8 | 9 | ## 作业要求 10 | 11 | - 使用 `map` 来实现 `polynomial` 类; 12 | - 对比一下利用 `list `和利用 `map` 实现的 `polynomial` 类:随机生成多项式,当输入的多项式非零项个数较大,且不按次数顺序排列时,两种实现方式的效率;加、减、乘运算的效率,等。感受两种容器的时间复杂度的不同。 13 | 14 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/6_UseLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | #多个库文件用 ';' 分隔,如果为空,则为 "" 11 | #如:set(libs "targetName;xxx.lib") 12 | set(libs "PolynomialList") 13 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 14 | -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/src/TetGene/globalFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBALFUNCTIONS_H 2 | #define GLOBALFUNCTIONS_H 3 | 4 | template 5 | void SafeDelete(object *ptr) 6 | { 7 | if (ptr != NULL) 8 | { 9 | delete ptr; 10 | ptr = NULL; 11 | } 12 | } 13 | 14 | template 15 | void SafeDeletes(object *ptr) 16 | { 17 | if (ptr != NULL) 18 | { 19 | delete[] ptr; 20 | ptr = NULL; 21 | } 22 | } 23 | 24 | 25 | #endif // GLOBALFUNCTIONS_H 26 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/GenScene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Scene; 7 | 8 | class SceneGenerator { 9 | public: 10 | static SceneGenerator& Instance() { 11 | static SceneGenerator instance; 12 | return instance; 13 | } 14 | 15 | Scene* GenScene(const std::string& path); 16 | // n : [0, 0] 17 | Scene* GenScene(size_t n); 18 | 19 | void PrintSerializedScene(Scene* scene); 20 | 21 | private: 22 | SceneGenerator(); 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Qt/OpThread.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | using namespace std; 8 | 9 | OpThread::OpThread(Ptr op) 10 | : op(op), isStop(false) { 11 | qRegisterMetaType>("Ptr"); 12 | } 13 | 14 | void OpThread::run() { 15 | isStop = false; 16 | 17 | if(op!=nullptr) 18 | op->Run(); 19 | 20 | isStop = true; 21 | } 22 | 23 | void OpThread::UI_Op_Run(Ptr op) { 24 | emit UI_Op(op); 25 | } 26 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Freehand.cpp: -------------------------------------------------------------------------------- 1 | #include "Freehand.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Freehand::Freehand() { 6 | this->setAttr("raw-mode", 1); 7 | } 8 | 9 | Freehand::~Freehand() { 10 | 11 | } 12 | 13 | void Freehand::Draw(QPainter& painter) { 14 | if (ctrl_points.size() >= 1) { 15 | auto it = ctrl_points.begin(); 16 | for (; it != ctrl_points.end() && (it + 1) != ctrl_points.end(); it++) { 17 | painter.drawLine(*it, *(it+1)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/UI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GlobGroupSrcs(RST sources PATHS 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | "${PROJECT_SOURCE_DIR}/include/UI" 4 | ) 5 | 6 | Ubpa_GetTargetName(Basic "${PROJECT_SOURCE_DIR}/src/Basic") 7 | Ubpa_GetTargetName(OpenGL "${PROJECT_SOURCE_DIR}/src/OpenGL") 8 | Ubpa_GetTargetName(Qt "${PROJECT_SOURCE_DIR}/src/Qt") 9 | Ubpa_GetTargetName(Engine "${PROJECT_SOURCE_DIR}/src/Engine") 10 | 11 | Ubpa_AddTarget(MODE "LIB" QT ON SOURCES ${sources} LIBS ${Basic} ${OpenGL} ${Qt} ${Engine}) 12 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/postprocess.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoord; 5 | 6 | // texture samplers 7 | uniform sampler2D img; 8 | 9 | void main() 10 | { 11 | const float gamma = 2.2; 12 | 13 | vec3 hdrColor = texture(img, TexCoord).rgb; 14 | 15 | // Reinhard tone mapping 16 | vec3 mapped = hdrColor / (hdrColor + vec3(1.0)); 17 | 18 | // Gamma correction 19 | mapped = pow(mapped, vec3(1.0 / gamma)); 20 | 21 | FragColor = vec4(mapped, 1.0); 22 | } 23 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ShapeMesh/ShapeMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class ShapeMesh { 9 | public: 10 | ShapeMesh(unsigned vertexNum, unsigned triNum = 0); 11 | float* GetPosArr(); 12 | unsigned GetVertexNum() { return vertexNum; } 13 | unsigned GetTriNum() { return triNum; } 14 | unsigned GetPosArrSize(); 15 | protected: 16 | std::vector posArr; 17 | unsigned vertexNum; 18 | unsigned triNum; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/ShapeMesh/ShapeMesh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | using namespace std; 6 | 7 | ShapeMesh::ShapeMesh(unsigned vertexNum, unsigned triNum) 8 | : vertexNum(vertexNum), triNum(triNum){ 9 | posArr = vector(vertexNum); 10 | } 11 | 12 | float * ShapeMesh::GetPosArr() { 13 | return posArr.front().data(); 14 | } 15 | 16 | unsigned ShapeMesh::GetPosArrSize() { 17 | return static_cast(posArr.size() * 3 * sizeof(float)); 18 | } 19 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Filter/FilterMitchell.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | float FilterMitchell::Mitchell1D(float x) const { 6 | x = std::abs(2 * x); 7 | if (x > 1) 8 | return ((-B - 6 * C) * x * x * x 9 | + (6 * B + 30 * C) * x * x 10 | + (-12 * B - 48 * C) * x 11 | + (8 * B + 24 * C)) * (1.f / 6.f); 12 | else 13 | return ((12 - 9 * B - 6 * C) * x * x * x 14 | + (-18 + 12 * B + 6 * C) * x * x 15 | + (6 - 2 * B)) * (1.f / 6.f); 16 | } 17 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Freehand.cpp: -------------------------------------------------------------------------------- 1 | #include "Freehand.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Freehand::Freehand() { 6 | this->setAttr("raw-mode", 1); 7 | } 8 | 9 | Freehand::~Freehand() { 10 | 11 | } 12 | 13 | void Freehand::Draw(QPainter& painter) { 14 | if (ctrl_points.size() >= 1) { 15 | auto it = ctrl_points.begin(); 16 | for (; it != ctrl_points.end() && (it + 1) != ctrl_points.end(); it++) { 17 | painter.drawLine(*it, *(it+1)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/Component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class SObj; 7 | 8 | class Component : public HeapObj { 9 | protected: 10 | Component(Ptr sobj) : wSObj(sobj) { } 11 | virtual ~Component() = default; 12 | 13 | protected: 14 | virtual void Init_AfterGenPtr() override; 15 | 16 | public: 17 | const Ptr GetSObj() const { return wSObj.lock(); } 18 | 19 | private: 20 | friend SObj; 21 | WPtr wSObj; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/src/TetGene/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx" 9 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 10 | ) 11 | #多个库文件用 ';' 分隔,如果为空,则为 "" 12 | #如:set(libs "targetName;xxx.lib") 13 | set(libs "") 14 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 15 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/Cmpt/Roamer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Ubpa::Cmpt { 8 | class L2W; 9 | class Position; 10 | class Rotation; 11 | 12 | class Roamer : public Component { 13 | public: 14 | float move_speed = 5.f; 15 | float rotate_speed = 0.1f; 16 | 17 | void OnUpdate(CmptTag::LastFrame l2w, Position* pos, Rotation* rot); 18 | 19 | static void OnRegist(); 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/executables/3_TemplateDArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | "${CMAKE_CURRENT_SOURCE_DIR}/*.inl" 10 | ) 11 | #多个库文件用 ';' 分隔,如果为空,则为 "" 12 | #如:set(libs "targetName;xxx.lib") 13 | set(libs "") 14 | Ubpa_SetupTarget(MODE ${mode} NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 15 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/postProcess.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D image; 7 | 8 | uniform bool needTonemap = false; 9 | uniform bool needGamma = false; 10 | 11 | void main(){ 12 | vec3 color = texture(image, TexCoords).rgb; 13 | 14 | 15 | // HDR tonemapping 16 | if(needTonemap) 17 | color = color / (vec3(1.0)+color); 18 | 19 | // gamma 20 | if(needGamma) 21 | color = pow(color, vec3(1.0/2.2)); 22 | 23 | FragColor = vec4(color, 1.0f); 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/PointLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | using namespace std; 6 | 7 | float PointLight::Fwin(float d, float radius) { 8 | cout << "WARNING::PointLight:" << endl 9 | << "\t" << "not implemented" << endl; 10 | return 0.f; 11 | } 12 | 13 | const rgbf PointLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 14 | cout << "WARNING::PointLight:" << endl 15 | << "\t" << "not implemented" << endl; 16 | return 0.f; 17 | } 18 | -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/project/README.md: -------------------------------------------------------------------------------- 1 | # 作业完成说明 2 | 3 | ## 项目说明 4 | 5 | - 读取 *.obj 格式面网格或 *.tet 格式的体网格,生成类 MassSpring 用于传输用于模拟的网格数据 6 | - MassSpring 类中存储了模拟方法类 Simulate; 7 | - 程序 UI 窗口最上方设置两个按钮分别为开始(或继续)模拟时间计时和停止时间计时 8 | - attribute中新添了Simulation组件用于设置模拟的一些参数 9 | 10 | 11 | ## 作业完成步骤 12 | 13 | - 本次作业主要完成类 Simulation 中 Init 和 SimulateOnce 接口函数,前者主要初始化一些模拟用到的矩阵和辅助变量,会在每次更改模拟参数(如劲度系数)时调用从而修改相应的一些辅助变量;后者则是更新下一帧的位置position和速度velocity; 14 | - 模拟只需要顶点的位置和边的索引信息(边索引为点的序号的列表,每两个序号表示一条边由哪两个点连接),均已在Simulation中建立完成 15 | 16 | ## 具体实施步骤 17 | 18 | - 根据20-80原则思考应该如何逐步完成? 19 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/libraries/DArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | list(APPEND sources "${CMAKE_SOURCE_DIR}/include/DArray.h") 11 | #多个库文件用 ';' 分隔,如果为空,则为 "" 12 | #如:set(libs "targetName;xxx.lib") 13 | set(libs "") 14 | Ubpa_SetupTarget(MODE "DLL" NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 15 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/README.md: -------------------------------------------------------------------------------- 1 | # 作业项目 2 | 3 | ## 目录结构 4 | 5 | 本项目目录包含以下若干子目录: 6 | 7 | - [`src/`](src/):本次作业项目的源代码 8 | 9 | ## 其他说明 10 | 11 | - Qt:[简易说明](../../../Softwares/Qt.md) 12 | - CMake-GUI 在 configure 的时候,Optional platform for generator 要选 **x64** 13 | - CMake 一开始会拉取 [UCMake](https://github.com/Ubpa/UCMake),所以会稍微久一点,拉取的 UCMake 位于 `build/_deps/`,内含一些 CMake 的自定义函数 `Ubpa_xxx`,详细请看 [UbpaTool.cmake](https://github.com/Ubpa/UCMake/blob/master/cmake/UbpaTool.cmake),构建好的工程中会自带一些 UCMake 中的[示例项目](https://github.com/Ubpa/UCMake/tree/master/src),可以查看模仿 14 | 15 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/Polygon.cpp: -------------------------------------------------------------------------------- 1 | #include "Polygon.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Polygon::Polygon() { 6 | 7 | } 8 | 9 | Polygon::~Polygon() { 10 | 11 | } 12 | 13 | void Polygon::Draw(QPainter& painter) { 14 | if (ctrl_points.size() >= 1) { 15 | auto it = ctrl_points.begin(); 16 | for (; it != ctrl_points.end() && (it + 1) != ctrl_points.end(); it++) { 17 | painter.drawLine(*it, *(it+1)); 18 | } 19 | 20 | painter.drawLine(ctrl_points.back(), ctrl_points.front()); 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Filter/FilterBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImgFilter.h" 4 | 5 | namespace Ubpa { 6 | class FilterBox : public ImgFilter { 7 | public: 8 | FilterBox(const vecf2& radius) : ImgFilter(radius) { } 9 | 10 | protected: 11 | virtual ~FilterBox() = default; 12 | 13 | public: 14 | const Ptr New(const vecf2& radius) { 15 | return Ubpa::New(radius); 16 | } 17 | 18 | public: 19 | virtual float Evaluate(const pointf2& p) const override { 20 | return 1; 21 | } 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/README.md: -------------------------------------------------------------------------------- 1 | # Example 2 | 3 | ## 目录结构 4 | 5 | 本项目目录包含以下若干子目录: 6 | 7 | - `\src`:本次作业项目的源代码 8 | 9 | ## 其他说明 10 | 11 | - Qt:[简易说明](../../../Softwares/Qt.md) 12 | - CMake-GUI 在 configure 的时候,Optional platform for generator 要选 **x64** 13 | - CMake 一开始会拉取 [UCMake](https://github.com/Ubpa/UCMake),所以会稍微久一点,拉取的 UCMake 位于 `build/_deps/`,内含一些 CMake 的自定义函数 `Ubpa_xxx`,详细请看 [UbpaTool.cmake](https://github.com/Ubpa/UCMake/blob/master/cmake/UbpaTool.cmake),构建好的工程中会自带一些 UCMake 中的[示例项目](https://github.com/Ubpa/UCMake/tree/master/src),可以查看模仿 14 | 15 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/src/App/example.h: -------------------------------------------------------------------------------- 1 | #ifndef EXAMPLE_H 2 | #define EXAMPLE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "ui_example.h" 8 | 9 | class example : public QMainWindow 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | example(QWidget *parent = 0); 15 | ~example(); 16 | 17 | QMenu *pMenutest; 18 | QAction *pAction; 19 | QToolBar *main_toolbar_; 20 | 21 | private slots: 22 | void hello(); 23 | 24 | private: 25 | Ui::exampleClass ui; 26 | }; 27 | 28 | #endif // EXAMPLE_H 29 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/README.md: -------------------------------------------------------------------------------- 1 | # Example 2 | 3 | ## 目录结构 4 | 5 | 本项目目录包含以下若干子目录: 6 | 7 | - `\src`:本次作业项目的源代码 8 | 9 | ## 其他说明 10 | 11 | - Qt:[简易说明](../../../Softwares/Qt.md) 12 | - CMake-GUI 在 configure 的时候,Optional platform for generator 要选 **x64** 13 | - CMake 一开始会拉取 [UCMake](https://github.com/Ubpa/UCMake),所以会稍微久一点,拉取的 UCMake 位于 `build/_deps/`,内含一些 CMake 的自定义函数 `Ubpa_xxx`,详细请看 [UbpaTool.cmake](https://github.com/Ubpa/UCMake/blob/master/cmake/UbpaTool.cmake),构建好的工程中会自带一些 UCMake 中的[示例项目](https://github.com/Ubpa/UCMake/tree/master/src),可以查看模仿 14 | 15 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | // 请参阅 https://go.microsoft.com//fwlink//?linkid=834763 了解有关此文件的详细信息。 3 | "configurations": [ 4 | { 5 | "name": "x64-Debug", 6 | "generator": "Ninja", 7 | "configurationType": "Debug", 8 | "inheritEnvironments": [ "msvc_x64_x64" ], 9 | "buildRoot": "${projectDir}\\out\\build\\${name}", 10 | "installRoot": "${projectDir}\\out\\install\\${name}", 11 | "cmakeCommandArgs": "", 12 | "buildCommandArgs": "-v", 13 | "ctestCommandArgs": "" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Filter/ImgFilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace Ubpa { 9 | class ImgFilter : public HeapObj { 10 | protected: 11 | ImgFilter(const vecf2& radius) : 12 | radius(radius), invRadius(1.0f / radius[0], 1.0f / radius[1]) { } 13 | virtual ~ImgFilter() = default; 14 | 15 | public: 16 | virtual float Evaluate(const pointf2& p) const = 0; 17 | 18 | public: 19 | const vecf2 radius; 20 | const vecf2 invRadius; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/samples/src/libraries/PolynomialList/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #项目名,默认为目录名 2 | Ubpa_GetDirName(DIRNAME) 3 | set(targetName "${TARGET_PREFIX}${DIRNAME}") 4 | #多个源文件用 ';' 分隔 5 | #如:set(sources "main.cpp;src_2.cpp;help.h") 6 | file(GLOB sources 7 | "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 9 | ) 10 | list(APPEND sources "${CMAKE_SOURCE_DIR}/include/PolynomialList.h") 11 | #多个库文件用 ';' 分隔,如果为空,则为 "" 12 | #如:set(libs "targetName;xxx.lib") 13 | set(libs "") 14 | Ubpa_SetupTarget(MODE "LIB" NAME ${targetName} SOURCES ${sources} LIBS ${libs}) 15 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Material/Gooch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class Gooch : public Material { 9 | public: 10 | Gooch(const rgbf& colorFactor = rgbf(1.0f)) :colorFactor(colorFactor) {} 11 | virtual ~Gooch() = default; 12 | 13 | public: 14 | static Ptr New(const rgbf& colorFactor = rgbf(1.0f)) { 15 | return Ubpa::New(colorFactor); 16 | } 17 | 18 | public: 19 | rgbf colorFactor; 20 | Ptr colorTexture; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/Cmpt/PathTracerAgency.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Ubpa { 7 | class BVH; 8 | } 9 | 10 | namespace Ubpa::Cmpt { 11 | class SObjPtr; 12 | class Material; 13 | class Camera; 14 | class L2W; 15 | class SObjPtr; 16 | 17 | class PathTracerAgency : public Component { 18 | public: 19 | void OnUpdate(const Cmpt::Camera* cam, const Cmpt::L2W* l2w, const SObjPtr* ptr); 20 | static void OnRegister(); 21 | 22 | private: 23 | BVH* bvh{ nullptr }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/README.md: -------------------------------------------------------------------------------- 1 | # 3. 泊松图像编辑 (Poisson Image Editing) 2 | 3 | 4 | ## 作业递交 5 | 6 | - 递交内容:程序代码及实验报告 7 | - 递交时间:2020 年 3 月 8 日星期日 8 | 9 | ## 作业要求 10 | 11 | - 实现 Poisson Image Editing 算法 12 | - 实现多边形光栅化的[扫描线转换算法](documents/ScanningLine.md) 13 | - 学习使用Eigen库求解大型稀疏方程组 14 | - 学习使用 OpenCV 15 | - 实时拖动区域显示结果(Optional) 16 | - 矩阵预分解 17 | 18 | 19 | ## 提供的材料 20 | 21 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 22 | 23 | ### (1) 说明文档 `documents` [->](documents/) 24 | 25 | 本次作业的要求说明和一些辅助资料 26 | 27 | ### (2) 作业项目 `project` [->](project/) 28 | 29 | 本次作业的基础代码框架 30 | 31 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/ChildWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | QT_BEGIN_NAMESPACE 5 | class QImage; 6 | class QPainter; 7 | class QRect; 8 | class ImageWidget; 9 | QT_END_NAMESPACE 10 | 11 | class ChildWindow : 12 | public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | ChildWindow(void); 18 | ~ChildWindow(void); 19 | 20 | bool LoadFile(QString filename); 21 | QString current_file() { return current_file_; } 22 | 23 | public slots: 24 | 25 | 26 | public: 27 | ImageWidget *imagewidget_; 28 | QString current_file_; 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/MeshEdit/Glue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class TriMesh; 7 | class Glue : public HeapObj { 8 | public: 9 | Glue(Ptr triMesh) { Init(triMesh); } 10 | 11 | public: 12 | static const Ptr New(Ptr triMesh) { 13 | return Ubpa::New(triMesh); 14 | } 15 | 16 | public: 17 | void Init(Ptr triMesh) { this->triMesh = triMesh; } 18 | void Clear() { triMesh = nullptr; } 19 | bool Run(); 20 | 21 | private: 22 | Ptr triMesh; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/IBL/brdf.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "../../Math/sample.h" 4 | #include "../BRDF/FDG.h" 5 | #include "../../Math/quat.h" 6 | 7 | out vec3 FragColor; 8 | in vec2 TexCoords; 9 | 10 | // ---------------------------------------------------------------------------- 11 | vec3 IntegrateBRDF(float NdotV, float roughness) 12 | { 13 | // TODO 14 | return vec3(1,1,1); 15 | } 16 | // ---------------------------------------------------------------------------- 17 | void main() 18 | { 19 | FragColor = IntegrateBRDF(TexCoords.x, TexCoords.y); 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Material/BSDF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | using namespace Ubpa; 8 | 9 | const normalf BSDF::TangentSpaceNormalToWorld(const normalf & worldTangent, const normalf & worldNormal, const normalf & tangentSpaceNormal) { 10 | const normalf bitangent = worldTangent.cross(worldNormal); 11 | matf3 TBN(worldTangent.cast_to(), bitangent.cast_to(), worldNormal.cast_to()); 12 | return (TBN * tangentSpaceNormal.cast_to()).normalize().cast_to(); 13 | } 14 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/Cmpt/Hierarchy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class SObj; 9 | } 10 | 11 | namespace Ubpa::Cmpt { 12 | class 13 | [[description("Multi-Scene Viewer")]] 14 | Hierarchy : public Component { 15 | public: 16 | Read selected_sobj; 17 | 18 | Hierarchy(); 19 | 20 | void OnUpdate(); 21 | 22 | static void OnRegister(); 23 | 24 | private: 25 | void View_SObj(SObj* sobj); 26 | 27 | int base_flags;// ImGuiTreeNodeFlags 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/env.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #define PI 3.1415926 4 | 5 | out vec3 FragColor; 6 | 7 | in vec3 TexCoord; 8 | 9 | uniform vec3 EnvLight_color; 10 | uniform float EnvLight_intensity; 11 | uniform sampler2D EnvLight_texture; 12 | 13 | void main() 14 | { 15 | vec3 nTexCoord = normalize(TexCoord); 16 | float u = (atan(-nTexCoord.x, -nTexCoord.z) / PI + 1) / 2; 17 | float v = acos(nTexCoord.y) / PI; // reverse: 1 - acos(nTexCoord.y) / PI; 18 | vec3 env = EnvLight_color * EnvLight_intensity * texture(EnvLight_texture, vec2(u, v)).rgb; 19 | FragColor = env; 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/ScanningLine.md: -------------------------------------------------------------------------------- 1 | # 多边形的扫描转换算法 2 | 3 | 多边形的扫描转换算法是多边形区域光栅化(求解一个平面多边形区域的内部像素)的经典算法,可在任何一本计算机图形学的课本上都能找到,网上也有不少详细介绍资料。 4 | 5 | 算法的基本思想是:通过维持一个特别的数据结构(结构中保存扫描线与多边形的交点)进行填充。 6 | 7 | ![https://cdn.jsdelivr.net/gh/Ubpa/USTC_CG_Data@master/Homeworks/03_PoissonImageEditing/scan_line.jpg](https://cdn.jsdelivr.net/gh/Ubpa/USTC_CG_Data@master/Homeworks/03_PoissonImageEditing/scan_line.jpg) 8 | 9 | > 图片无法加载则访问该链接:[USTC_CG_Data@master/Homeworks/03_PoissonImageEditing/scan_line.jpg](https://cdn.jsdelivr.net/gh/Ubpa/USTC_CG_Data@master/Homeworks/03_PoissonImageEditing/scan_line.jpg) 10 | 11 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3N3.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | layout (location = 1) in vec3 aNormal; 7 | 8 | out VS_OUT { 9 | vec3 FragPos; 10 | vec3 Normal; 11 | } vs_out; 12 | 13 | uniform mat4 model; 14 | 15 | void main() 16 | { 17 | vec4 worldPos = model * vec4(aPos, 1.0); 18 | vs_out.FragPos = worldPos.xyz; 19 | 20 | mat3 normalMatrix = transpose(inverse(mat3(model))); 21 | vs_out.Normal = normalize(normalMatrix * aNormal); 22 | 23 | gl_Position = projection * view * worldPos; 24 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/App/UEngine/main.cpp: -------------------------------------------------------------------------------- 1 | #include "UEngine.h" 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | QApplication a(argc, argv); 10 | 11 | // load style sheet 12 | QFile f(":qdarkstyle/Resources/style.qss"); 13 | if (f.exists()){ 14 | f.open(QFile::ReadOnly | QFile::Text); 15 | QTextStream ts(&f); 16 | qApp->setStyleSheet(ts.readAll()); 17 | } 18 | else 19 | printf("Unable to set stylesheet, file not found\n"); 20 | 21 | UEngine w; 22 | w.show(); 23 | return a.exec(); 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/DiskLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | using namespace std; 7 | 8 | const rgbf DiskLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 9 | cout << "WARNING::DiskLight:" << endl 10 | << "\t" << "not implemented" << endl; 11 | return 0.f; 12 | } 13 | 14 | float DiskLight::PDF(const pointf3 & p, const normalf & wi) const { 15 | cout << "WARNING::DiskLight:" << endl 16 | << "\t" << "not implemented" << endl; 17 | return 0.f; 18 | } 19 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/0_IDW.md: -------------------------------------------------------------------------------- 1 | # Inverse distance-weighted interpolation methods[^IDW] 2 | 3 | $$ 4 | \pmb{f}(\pmb{p})=\sum w_i(\pmb{p})\pmb{f}_i(\pmb{p}) 5 | $$ 6 | 7 | 其中 8 | 9 | $$ 10 | w_i(\pmb{p})=\frac{\sigma_i(\pmb{p})}{\sum \sigma_j(\pmb{p})} 11 | $$ 12 | 13 | $$ 14 | \sigma_i(\pmb{p})=\frac{1}{\|\pmb{p}-\pmb{p_i}\|^u} 15 | $$ 16 | 17 | 显然 $0\le w_i(\pmb{p})\le 1$,且 $\sum w_i(\pmb{p})=1$ 18 | 19 | ## 参考文献 20 | 21 | [^IDW]: Ruprecht D, Muller H. [**Image warping with scattered data interpolation**](http://citeseer.ist.psu.edu/426836.html)[J]. IEEE Computer Graphics and Applications, 1995, 15(2): 37-43. 22 | 23 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ShapeMesh/PlaneMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ShapeMesh.h" 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class PlaneMesh : public ShapeMesh { 9 | public: 10 | PlaneMesh(); 11 | float* GetNormalArr(); 12 | float* GetTexCoordsArr(); 13 | unsigned* GetIndexArr(); 14 | unsigned GetNormalArrSize(); 15 | unsigned GetTexCoordsArrSize(); 16 | unsigned GetIndexArrSize(); 17 | protected: 18 | std::vector> normalArr; 19 | std::vector> texCoordsArr; 20 | std::vector> indexArr; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Skybox/skybox.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | 4 | out vec3 TexCoords; 5 | 6 | // 160 7 | layout (std140) uniform Camera{ 8 | mat4 view; // 64 0 64 9 | mat4 projection; // 64 64 64 10 | vec3 viewPos; // 12 128 144 11 | float nearPlane; // 4 144 148 12 | float farPlane; // 4 148 152 13 | float fov; // 4 152 156 14 | float ar; // 4 156 160 15 | }; 16 | 17 | void main() 18 | { 19 | TexCoords = aPos; 20 | mat4 viewNoT = mat4(mat3(view)); 21 | vec4 pos = projection * viewNoT * vec4(aPos, 1.0); 22 | gl_Position = pos.xyww; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/TypeMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Ubpa { 7 | using TypeInfoRef = std::reference_wrapper; 8 | 9 | struct Hasher { 10 | std::size_t operator()(TypeInfoRef code) const 11 | { 12 | return code.get().hash_code(); 13 | } 14 | }; 15 | 16 | struct EqualTo { 17 | bool operator()(TypeInfoRef lhs, TypeInfoRef rhs) const 18 | { 19 | return lhs.get() == rhs.get(); 20 | } 21 | }; 22 | 23 | template 24 | using TypeMap = std::unordered_map; 25 | } 26 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/SphereLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | using namespace std; 8 | 9 | const rgbf SphereLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 10 | cout << "WARNING::SphereLight:" << endl 11 | << "\t" << "not implemented" << endl; 12 | return 0.f; 13 | } 14 | 15 | float SphereLight::PDF(const pointf3 & p, const normalf & wi) const { 16 | cout << "WARNING::SphereLight:" << endl 17 | << "\t" << "not implemented" << endl; 18 | return 0.f; 19 | } 20 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/Picker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Ubpa { 7 | class Viewer; 8 | 9 | class ClosestIntersector; 10 | 11 | class Picker final : public HeapObj { 12 | public: 13 | Picker(Viewer* viewer); 14 | 15 | public: 16 | static const Ptr New(Viewer* viewer) { 17 | return Ubpa::New(viewer); 18 | } 19 | 20 | protected: 21 | virtual ~Picker() = default; 22 | 23 | public: 24 | void Init(); 25 | 26 | Viewer* GetViewer() const { return viewer; } 27 | 28 | private: 29 | Viewer* viewer; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/project/README.md: -------------------------------------------------------------------------------- 1 | # 项目说明 2 | 3 | ## 简介 4 | 5 | - 本项目是 Taichi 的简单使用,包含了若干示例代码: 6 | - example_00_mls_mpm88:为作者提供的示例代码 7 | - example_01_mls_mpm88_x:同上,规范了格式、注释等 8 | - example_02_mls_mpm88_snowball:为我们提供的示例,两团雪在空中碰撞掉落地上的仿真 9 | - example_03_mls_mpm88_cubes:为我们提供的示例,三个方块(2个雪块和1个刚性块)碰撞掉落地上的仿真 10 | - example_04_mls_mpm88_fountain:为我们提供的示例,一个不断喷出水的喷泉的仿真 11 | 12 | - 本次作业通过需要修改 [src/app/main.cpp](src/app/main.cpp) 来完成各种仿真结果 13 | 14 | ### 项目配置 15 | 16 | - 下载库文件 [taichi.h](https://cdn.jsdelivr.net/gh/Ubpa/USTC_CG_Data@master/Homeworks/07_SimulationTaichi/mls_mpm88/taichi.h) 并放到 `include/_deps/` 中(自行创建文件夹) 17 | 18 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/App/hello/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit MainWindow(QWidget *parent = nullptr); 16 | ~MainWindow(); 17 | 18 | 19 | private: 20 | Ui::MainWindow *ui; 21 | 22 | QAction* hello_world_action_; 23 | QMenu* main_menu_; 24 | QToolBar* main_toolbar_; 25 | void CreateButtons(); 26 | 27 | private slots: 28 | void HelloWorld(); 29 | }; 30 | 31 | #endif // MAINWINDOW_H 32 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ShapeMesh/CubeMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ShapeMesh.h" 4 | 5 | namespace Ubpa { 6 | class CubeMesh : public ShapeMesh { 7 | public: 8 | CubeMesh(); 9 | float* GetNormalArr(); 10 | float* GetTexCoordsArr(); 11 | unsigned* GetIndexArr(); 12 | unsigned GetNormalArrSize(); 13 | unsigned GetTexCoordsArrSize(); 14 | unsigned GetIndexArrSize(); 15 | protected: 16 | std::vector> normalArr; 17 | std::vector> texCoordsArr; 18 | std::vector> indexArr; 19 | static const float CubeMeshData[192]; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/src/executables/4_list_Polynomial/main.cpp: -------------------------------------------------------------------------------- 1 | #include "PolynomialList.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(int argc, char** argv) { 9 | PolynomialList p1("../data/P3.txt"); 10 | PolynomialList p2("../data/P4.txt"); 11 | PolynomialList p3; 12 | p1.Print(); 13 | p2.Print(); 14 | 15 | p3 = p1 + p2; 16 | p3.Print(); 17 | p3 = p1 - p2; 18 | p3.Print(); 19 | 20 | p3 = p1 * p2; 21 | p3.Print(); 22 | 23 | // my extended tests 24 | p3 = p3 + PolynomialList({ 1 }, { 0.0000001 }); 25 | p3.Print(); 26 | p3.compress(); 27 | p3.Print(); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Sampler/BasicSampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Ubpa { 8 | namespace BasicSampler { 9 | const pointf2 UniformInSquare(); 10 | 11 | // Concentric 12 | const pointf2 UniformInDisk(); 13 | 14 | const pointf2 UniformOnDisk(); 15 | 16 | //const pointf3 UniformInSphereMesh(); 17 | 18 | const vecf3 UniformOnSphere(); 19 | const vecf3 UniformOnSphere(float& pd); 20 | float PDofUniformOnSphere(); 21 | 22 | const vecf3 CosOnHalfSphereMesh(); 23 | 24 | const vecf3 CosOnSphereMesh(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/src/UEditor/Cmpt/Inspector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace Ubpa { 10 | class SObj; 11 | } 12 | 13 | namespace Ubpa::Cmpt { 14 | class Hierarchy; 15 | 16 | class 17 | [[description("SObj's components Viewer")]] 18 | Inspector : public Component/*, public VarPtrVisitor*/ { 19 | public: 20 | 21 | void OnUpdate(const Hierarchy* hierarchy); 22 | 23 | static void OnRegister(); 24 | 25 | protected: 26 | class Viewer_Cmpt; 27 | class Viewer_Obj; 28 | class Viewer_Var; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/example/src/App/example.cpp: -------------------------------------------------------------------------------- 1 | #include "example.h" 2 | 3 | example::example(QWidget *parent) 4 | : QMainWindow(parent) 5 | { 6 | ui.setupUi(this); 7 | pAction = new QAction(tr("&hello"),this); 8 | 9 | pMenutest = menuBar()->addMenu(tr("&Test")); 10 | pMenutest->addAction(pAction); 11 | 12 | main_toolbar_ = addToolBar(tr("&Main")); 13 | main_toolbar_->addAction(pAction); 14 | 15 | connect(pAction, &QAction::triggered, this, &example::hello); 16 | } 17 | 18 | example::~example() 19 | { 20 | 21 | } 22 | 23 | void example::hello() 24 | { 25 | QMessageBox::information(NULL, "Hello", "Hello, Qt", QMessageBox::Yes); 26 | } 27 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/viewwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | ViewWidget 3 | 4 | 5 | ViewWidget 6 | 7 | 8 | 9 | 0 10 | 0 11 | 400 12 | 300 13 | 14 | 15 | 16 | ViewWidget 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/CmptMaterial.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Material; 7 | 8 | class CmptMaterial : public Component { 9 | public: 10 | CmptMaterial(Ptr sobj = nullptr, Ptr material = nullptr) 11 | : Component(sobj), material(material) { } 12 | 13 | public: 14 | static const Ptr New(Ptr sobj, Ptr material) { 15 | return Ubpa::New(sobj, material); 16 | } 17 | 18 | protected: 19 | virtual ~CmptMaterial() = default; 20 | 21 | public: 22 | Ptr material; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/CmptGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Primitive; 7 | 8 | class CmptGeometry : public Component { 9 | public: 10 | CmptGeometry(Ptr sobj = nullptr, Ptr primitive = nullptr) 11 | : Component(sobj), primitive(primitive) { } 12 | 13 | public: 14 | static const Ptr New(Ptr sobj, Ptr primitive) { 15 | return Ubpa::New(sobj, primitive); 16 | } 17 | 18 | protected: 19 | virtual ~CmptGeometry() = default; 20 | 21 | public: 22 | Ptr primitive; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/CapsuleLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace Ubpa; 7 | 8 | using namespace std; 9 | 10 | const rgbf CapsuleLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 11 | cout << "WARNING::CapsuleLight:" << endl 12 | << "\t" << "not implemented" << endl; 13 | return 0.f; 14 | } 15 | 16 | float CapsuleLight::PDF(const pointf3 & p, const normalf & wi) const { 17 | cout << "WARNING::CapsuleLight:" << endl 18 | << "\t" << "not implemented" << endl; 19 | return 0.f; 20 | } 21 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/Ray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class Ray : public rayf3 { 7 | public: 8 | Ray(const pointf3& origin = pointf3(0.f, 0.f, 0.f), const vecf3& dir = vecf3(1.f, 1.f, 1.f), float tMin = 0.001f, float tMax = FLT_MAX) 9 | : rayf3(origin, dir), tMin(tMin), tMax(tMax) { } 10 | 11 | public: 12 | const pointf3 StartPos() const { return (*this)(tMin); } 13 | const pointf3 EndPos() const { return (*this)(tMax); } 14 | 15 | const valf3 InvDir() const { return{ 1.f / d[0], 1.f / d[1], 1.f / d[2] }; } 16 | 17 | public: 18 | float tMin; 19 | float tMax; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Filter/FilterTriangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImgFilter.h" 4 | 5 | namespace Ubpa { 6 | class FilterTriangle : public ImgFilter { 7 | public: 8 | FilterTriangle(const vecf2& radius) : ImgFilter(radius) { } 9 | 10 | protected: 11 | virtual ~FilterTriangle() = default; 12 | 13 | public: 14 | const Ptr New(const vecf2& radius) { 15 | return Ubpa::New(radius); 16 | } 17 | 18 | public: 19 | virtual float Evaluate(const pointf2& p) const override { 20 | const auto delta = (radius - vecf2(p.Abs())).MaxWith({ 0,0 }); 21 | return delta[0] * delta[1]; 22 | } 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/WireframeRaster.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class WireframeRaster : public ForwardRaster { 7 | public: 8 | WireframeRaster(RawAPI_OGLW* pOGLW, Ptr scene, Ptr camera) 9 | : ForwardRaster(pOGLW, scene, camera) { } 10 | 11 | public: 12 | static Ptr New(RawAPI_OGLW* pOGLW, Ptr scene, Ptr camera) { 13 | return Ubpa::New(pOGLW, scene, camera); 14 | } 15 | 16 | protected: 17 | virtual ~WireframeRaster() = default; 18 | 19 | public: 20 | virtual void Init() override; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/README.md: -------------------------------------------------------------------------------- 1 | # 作业说明文档 2 | 3 | 以下是本次热身练习(包含7个小练习)的学习目标。 4 | 5 | ## [1. 基础的动态数组](1_BasicDArray/) 6 | - 对于只有C语言编程基础的同学:初步学习从C语言编程到C++语言编程的过渡 7 | - 初步了解类(对象)的编写,了解构造函数、析构函数、函数重载等 8 | - 熟悉和巩固指针、动态内存分配的机制与操作 9 | 10 | ## [2. 高效的动态数组](2_EfficientDArray/) 11 | - 进一步巩固指针、动态内存分配的机制与操作 12 | - 深刻理解对象的 public 接口的重要性 13 | 14 | ## [3. 模板动态数组](3_TemplateDArray/) 15 | - 学习和使用 template 模板 16 | - 初步了解和使用STL的vector,并深刻理解其原理与机制 17 | 18 | ## [4. 基于 `list` 的多项式类](4_list_Polynomial/) 19 | - 学习STL的list的使用 20 | 21 | ## [5. 基于 `map` 的多项式类](5_map_Polynomial/) 22 | - 学习STL的map的使用 23 | 24 | ## [6. 静态库](6_Lib/) 25 | - 了解静态库的编写与使用 26 | 27 | ## [7. 动态库](7_Dll/) 28 | - 了解动态库的编写与使用 29 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Operation/OpQueue.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | using namespace std; 8 | 9 | void OpQueue::Push(Ptr op) { 10 | if (op != nullptr) 11 | opList.push_back(op); 12 | } 13 | 14 | void OpQueue::Run() { 15 | stack< list>::const_iterator > removeIts; 16 | for (auto it = opList.cbegin(); it != opList.cend(); ++it) { 17 | (*it)->Run(); 18 | if (!(*it)->isHold) 19 | removeIts.push(it); 20 | } 21 | 22 | while (!removeIts.empty()) { 23 | opList.erase(removeIts.top()); 24 | removeIts.pop(); 25 | } 26 | 27 | if (opList.empty()) 28 | isHold = false; 29 | } 30 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array5/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "Array.h" 5 | 6 | void main() 7 | { 8 | // test double array 9 | DArray pa; 10 | 11 | //pa.InitArray( ); 12 | 13 | pa.SetArraySize( 3 ); 14 | pa.SetValue( 0, 1.0 ); 15 | pa.SetValue( 1, 2.0 ); 16 | pa.SetValue( 2, 3.0 ); 17 | 18 | pa.PrintArray( ); 19 | 20 | //pa.FreeArray( ); 21 | 22 | 23 | 24 | // test int array 25 | DArray pb; 26 | 27 | //pb.InitArray( ); 28 | 29 | pb.SetArraySize( 3 ); 30 | pb.SetValue( 0, 10 ); 31 | pb.SetValue( 1, 11 ); 32 | pb.SetValue( 2, 12 ); 33 | 34 | pb.PrintArray( ); 35 | 36 | //pb.FreeArray( ); 37 | } 38 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3N3_invN.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | layout (location = 1) in vec3 aNormal; 7 | 8 | out VS_OUT { 9 | vec3 FragPos; 10 | vec3 Normal; 11 | } vs_out; 12 | 13 | uniform mat4 model; 14 | 15 | uniform bool invertedNormals; 16 | 17 | void main() 18 | { 19 | vec4 worldPos = model * vec4(aPos, 1.0); 20 | vs_out.FragPos = worldPos.xyz; 21 | 22 | mat3 normalMatrix = transpose(inverse(mat3(model))); 23 | vs_out.Normal = normalize(normalMatrix * (invertedNormals ? -aNormal : aNormal)); 24 | 25 | gl_Position = projection * view * worldPos; 26 | } -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/data/cube.poly: -------------------------------------------------------------------------------- 1 | # Part 1 - node list 2 | # node count, 3 dim, no attribute, no boundary marker 3 | 8 3 0 0 4 | # Node index, node coordinates 5 | 0 0.0 0.0 0.0 6 | 1 2.0 0.0 0.0 7 | 2 2.0 2.5 0.0 8 | 3 0.0 2.5 0.0 9 | 4 0.0 0.0 2.0 10 | 5 2.0 0.0 2.0 11 | 6 2.0 2.5 2.0 12 | 7 0.0 2.5 2.0 13 | # Part 2 - facet list 14 | # facet count, with boundary marker 15 | 6 1 16 | # facets 17 | 1 18 | 4 0 1 2 3 # front 19 | 1 20 | 4 4 5 6 7 # back 21 | 1 0 2 #boundary marker 2 22 | 4 0 1 5 4 # bottom 23 | 1 24 | 4 1 2 6 5 # right 25 | 1 26 | 4 2 3 7 6 # top 27 | 1 28 | 4 3 0 4 7 # left 29 | # Part 3 - hole list 30 | 0 # no hole 31 | # Part 4 - region list 32 | 0 # no region -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ShapeMesh/DiskMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ShapeMesh.h" 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class DiskMesh : public ShapeMesh { 9 | public: 10 | DiskMesh(unsigned n); 11 | float* GetNormalArr(); 12 | float* GetTexCoordsArr(); 13 | unsigned* GetIndexArr(); 14 | float* GetTangentArr(); 15 | unsigned GetNormalArrSize(); 16 | unsigned GetTexCoordsArrSize(); 17 | unsigned GetIndexArrSize(); 18 | unsigned GetTangentArrSize(); 19 | protected: 20 | std::vector normalArr; 21 | std::vector texCoordsArr; 22 | std::vector indexArr; 23 | std::vector tangentArr; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/WireframeRaster.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | using namespace Ubpa; 19 | 20 | using namespace Define; 21 | using namespace std; 22 | 23 | void WireframeRaster::Init() { 24 | ForwardRaster::Init(); 25 | 26 | glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 27 | 28 | SetDrawSky(false); 29 | } 30 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/data/shaders/p3t2n3.vert: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoord; 5 | layout (location = 2) in vec3 aNormal; 6 | 7 | out VS_OUT { 8 | vec3 WorldPos; 9 | vec2 TexCoord; 10 | vec3 Normal; 11 | } vs_out; 12 | 13 | uniform mat4 projection; 14 | uniform mat4 view; 15 | uniform mat4 model; 16 | 17 | void main() 18 | { 19 | vec4 worldPos = model * vec4(aPos, 1.0); 20 | 21 | vs_out.WorldPos = worldPos.xyz / worldPos.w; 22 | vs_out.TexCoord = aTexCoord; 23 | vs_out.Normal = normalize(transpose(inverse(mat3(model))) * aNormal); 24 | 25 | gl_Position = projection * view * worldPos; 26 | } 27 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Array2D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | template 7 | class Array2D { 8 | public: 9 | static constexpr int width = W; 10 | static constexpr int height = H; 11 | static constexpr int size = W * H; 12 | 13 | public: 14 | T& At(int x, int y) { return this->operator()(x, y); } 15 | T& operator()(int x, int y) { 16 | assert(x >= 0 && x < W - 1); 17 | assert(y >= 0 && y < H - 1); 18 | return data[y * W + x]; 19 | } 20 | 21 | const T* GetData() const& { data.data(); } 22 | T* GetData()& { data.data(); } 23 | 24 | private: 25 | std::array data; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ShapeMesh/SphereMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ShapeMesh.h" 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class SphereMesh : public ShapeMesh { 9 | public: 10 | SphereMesh(unsigned n); 11 | float* GetNormalArr(); 12 | float* GetTexCoordsArr(); 13 | unsigned* GetIndexArr(); 14 | float* GetTangentArr(); 15 | unsigned GetNormalArrSize(); 16 | unsigned GetTexCoordsArrSize(); 17 | unsigned GetIndexArrSize(); 18 | unsigned GetTangentArrSize(); 19 | protected: 20 | std::vector normalArr; 21 | std::vector texCoordsArr; 22 | std::vector indexArr; 23 | std::vector tangentArr; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Material/Beckmann.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | using namespace std; 7 | 8 | float Beckmann::D(const normalf & wh) const { 9 | cout << "WARNING::Beckmann:" << endl 10 | << "\t" << "not implemented" << endl; 11 | return 0.f; 12 | } 13 | 14 | float Beckmann::Lambda(const normalf & w) const { 15 | cout << "WARNING::Beckmann:" << endl 16 | << "\t" << "not implemented" << endl; 17 | return 0.f; 18 | } 19 | 20 | const normalf Beckmann::Sample_wh() const { 21 | cout << "WARNING::Beckmann:" << endl 22 | << "\t" << "not implemented" << endl; 23 | return 0.f; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/8_Shader/project/src/tool/SimpleLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | namespace SimpleLoader { 7 | class OGLResources { 8 | public: 9 | ~OGLResources(); 10 | gl::VertexArray* va{ nullptr }; 11 | std::map name2vb; 12 | gl::ElementBuffer* eb{ nullptr }; 13 | std::vector positions; 14 | std::vector normals; 15 | std::vector texcoords; 16 | std::vector indices; 17 | std::vector tangents; 18 | }; 19 | 20 | // noise: position[p] += 0.05 * Xi * normal[p], Xi is random in [0, 1] 21 | OGLResources* LoadObj(const std::string& path, bool noise = false); 22 | } 23 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/SpotLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | using namespace std; 6 | 7 | float SpotLight::Fwin(float d, float radius) { 8 | cout << "WARNING::SpotLight:" << endl 9 | << "\t" << "not implemented" << endl; 10 | return 0.f; 11 | } 12 | 13 | const rgbf SpotLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 14 | cout << "WARNING::SpotLight:" << endl 15 | << "\t" << "not implemented" << endl; 16 | return 0.f; 17 | } 18 | 19 | float SpotLight::Falloff(const normalf & wi) const { 20 | cout << "WARNING::SpotLight:" << endl 21 | << "\t" << "not implemented" << endl; 22 | return 0.f; 23 | } 24 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3N3T2.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | layout (location = 1) in vec3 aNormal; 7 | layout (location = 2) in vec2 aTexCoords; 8 | 9 | out VS_OUT { 10 | vec3 FragPos; 11 | vec3 Normal; 12 | vec2 TexCoords; 13 | } vs_out; 14 | 15 | uniform mat4 model; 16 | 17 | void main() 18 | { 19 | vec4 worldPos = model * vec4(aPos, 1.0); 20 | vs_out.FragPos = worldPos.xyz; 21 | vs_out.TexCoords = aTexCoords; 22 | 23 | mat3 normalMatrix = transpose(inverse(mat3(model))); 24 | vs_out.Normal = normalize(normalMatrix * aNormal); 25 | 26 | gl_Position = projection * view * worldPos; 27 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Op/OpQueue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Op.h" 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class OpQueue final : public Op { 9 | public: 10 | OpQueue(bool isHold = true) : Op(isHold) { } 11 | 12 | public: 13 | static const Ptr New(bool isHold = true) { return Ubpa::New(isHold); } 14 | 15 | public: 16 | void Push(Ptr op); 17 | OpQueue& operator<<(Ptr op) { 18 | Push(op); 19 | return *this; 20 | } 21 | 22 | virtual void Run() override; 23 | 24 | bool IsEmpty() const { return opList.empty(); } 25 | 26 | private: 27 | virtual ~OpQueue() = default; 28 | 29 | private: 30 | std::list> opList; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Scene/CmptLight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class Light; 9 | 10 | class CmptLight : public Component { 11 | public: 12 | CmptLight(Ptr sobj = nullptr, Ptr light = nullptr) 13 | : Component(sobj), light(light) { } 14 | 15 | public: 16 | static const Ptr New(Ptr sobj, Ptr light) { 17 | return Ubpa::New(sobj, light); 18 | } 19 | 20 | protected: 21 | virtual ~CmptLight() = default; 22 | 23 | public: 24 | transformf GetLightToWorldMatrixWithoutScale() const; 25 | 26 | public: 27 | Ptr light; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/PointLight/genDepth.gs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (triangles) in; 3 | layout (triangle_strip, max_vertices=18) out; 4 | 5 | uniform mat4 shadowMatrices[6]; 6 | 7 | out vec4 FragPos; // FragPos from GS (output per emitvertex) 8 | 9 | void main() 10 | { 11 | for(int face = 0; face < 6; ++face) 12 | { 13 | gl_Layer = face; // built-in variable that specifies to which face we render. 14 | for(int i = 0; i < 3; ++i) // for each triangle's vertices 15 | { 16 | FragPos = gl_in[i].gl_Position; 17 | gl_Position = shadowMatrices[face] * FragPos; 18 | EmitVertex(); 19 | } 20 | EndPrimitive(); 21 | } 22 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | Ubpa_GlobGroupSrcs(RST sources PATHS 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | "${PROJECT_SOURCE_DIR}/include/Engine" 4 | ) 5 | Ubpa_GetTargetName(OpenGL "${PROJECT_SOURCE_DIR}/src/OpenGL") 6 | Ubpa_GetTargetName(Qt "${PROJECT_SOURCE_DIR}/src/Qt") 7 | 8 | set(libs ${OpenGL} ${Qt} Qt5::Widgets) 9 | 10 | if(TARGET assimp::assimp) 11 | list(APPEND libs assimp::assimp) 12 | add_definitions(-DUSE_ASSIMP) 13 | endif() 14 | 15 | if(TARGET tinyxml2::tinyxml2) 16 | list(APPEND libs tinyxml2::tinyxml2) 17 | add_definitions(-DUSE_TINYXML2) 18 | endif() 19 | 20 | list(APPEND libs Ubpa::UHEMesh_core Ubpa::UDP_core) 21 | 22 | Ubpa_AddTarget(MODE "LIB" SOURCES ${sources} LIBS ${libs}) 23 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/eigen_example/src/test/00_LinearEquation/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace std; 6 | using namespace Eigen; 7 | 8 | int main() { 9 | MatrixXf A(4, 4); 10 | 11 | float data[4][4] = { 12 | {1, 0, 0, 0}, 13 | {0, 1, 0, 0}, 14 | {0, 0, 1, 0}, 15 | {0, 0, 0, 1} 16 | }; 17 | 18 | for (size_t row = 0; row < 4; row++) { 19 | for (size_t col = 0; col < 4; col++) 20 | A(row, col) = data[row][col]; 21 | } 22 | 23 | MatrixXf b(4, 2); 24 | for (size_t row = 0; row < 4; row++) { 25 | b(row, 0) = 1; 26 | b(row, 1) = 2; 27 | } 28 | 29 | MatrixXf x = A.colPivHouseholderQr().solve(b); 30 | 31 | cout << x << endl; 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Homeworks/7_SimulationTaichi/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 7. 基于 Taichi 的仿真 4 | 5 | ## 作业递交 6 | 7 | - 递交内容:程序代码及实验报告(或含仿真视频) 8 | - 递交时间:2020 年 4 月 5 日星期日 9 | 10 | ## 作业要求 11 | 12 | - 构建不同的模拟场景★ 13 | - 使用 `add_objec` 函数设计自己的模拟场景(可以改变模拟物体的形状、粒子数目、初始位置、初始速度等等) 14 | - 探究参数空间:通过调整不同的参数设置体会不同参数对仿真结果的影响★★ 15 | - 比如:探究杨氏模量E对雪模拟的影响,结合其背后的物理原理进行比较分析 16 | - 探究其他算法和模型:通过改变物理模型、改变模拟算法实现新的模拟结果★★★ 17 | - 比如:水冲击弹性物体的模拟 18 | - 渲染与绘制(可选 ★★★★★) 19 | - 学习使用商业软件(如Houdini、Blender等)对结果进行渲染 20 | - 【注:3D粒子更合适光照渲染,因此此处不作要求】 21 | 22 | 23 | ## 提供的材料 24 | 25 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 26 | 27 | ### (1) 说明文档 `documents` [->](documents/) 28 | 29 | 本次作业的要求说明和一些辅助资料 30 | 31 | ### (2) 作业项目 `project` [->](project/) 32 | 33 | 本次作业的基础代码框架 34 | 35 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/README.md: -------------------------------------------------------------------------------- 1 | # 4. 极小曲面和网格参数化 2 | 3 | 4 | ## 作业递交 5 | 6 | - 递交内容:程序代码及实验报告 7 | - 递交时间:2020 年 3 月 15 日星期日 8 | 9 | ## 作业要求 10 | 11 | - 初步了解 \*.obj 格式的 3D 数据(\*.obj, \*.mtl) 12 | - 使用 Win10 自带的 “3D 查看器” 查看 obj 数据文件 13 | - 安装并使用开源3D几何处理框架 [MeshLab](http://www.meshlab.net) 查看 3D 数据文件 (MeshLab 功能多,可多学习使用) 14 | - 学习三角网格的数据结构及操作 15 | - 使用 UEngine 网格程序框架 16 | - 寻找**非封闭**网格曲面的边界 17 | - 实现极小曲面与网格参数化 18 | - 极小曲面:边界固定,求解稀疏方程组 19 | - 参数化:边界映射到平面凸多边形,求解稀疏方程组 20 | - 巩固使用 Eigen 库求解稀疏线性方程组 21 | 22 | 23 | ## 提供的材料 24 | 25 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 26 | 27 | ### (1) 说明文档 `documents` [->](documents/) 28 | 29 | 本次作业的要求说明和一些辅助资料 30 | 31 | ### (2) 作业项目 `project` [->](project/) 32 | 33 | 本次作业的基础代码框架 34 | 35 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/IBL/irradiance_convolution.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "../../Math/sample.h" 4 | 5 | out vec3 FragColor; 6 | in vec3 WorldPos; 7 | 8 | uniform samplerCube environmentMap; 9 | 10 | void main() 11 | { 12 | // The world vector acts as the normal of a tangent surface 13 | // from the origin, aligned to WorldPos. Given this normal, calculate all 14 | // incoming radiance of the environment. The result of this radiance 15 | // is the radiance of light coming from -Normal direction, which is what 16 | // we use in the PBR shader to sample irradiance. 17 | vec3 N = normalize(WorldPos); 18 | 19 | vec3 irradiance = vec3(0.0); 20 | 21 | // TODO 22 | 23 | FragColor = irradiance; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Filter/FilterSinc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImgFilter.h" 4 | 5 | namespace Ubpa { 6 | class FilterSinc : public ImgFilter { 7 | public: 8 | FilterSinc(const vecf2& radius, float tau) : ImgFilter(radius), tau(tau) { } 9 | 10 | protected: 11 | virtual ~FilterSinc() = default; 12 | 13 | public: 14 | const Ptr New(const vecf2& radius, float tau) { 15 | return Ubpa::New(radius, tau); 16 | } 17 | 18 | public: 19 | virtual float Evaluate(const pointf2& p) const override { 20 | return WindowSinc(p[0], radius[0]) * WindowSinc(p[1], radius[1]); 21 | } 22 | 23 | private: 24 | float WindowSinc(float x, float radius) const; 25 | 26 | private: 27 | const float tau; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/1_BasicDArray/C2Cpp/src/Array/test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "Array.h" 4 | 5 | int main() 6 | { 7 | Array a; 8 | a.InsertAt(0, 2.1); 9 | a.Display(); 10 | 11 | a.PushBack(3.0); 12 | a.PushBack(3.1); 13 | a.PushBack(3.2); 14 | a.Display(); 15 | 16 | a.DeleteAt(0); 17 | a.Display(); 18 | a.InsertAt(0, 4.1); 19 | a.Display(); 20 | 21 | Array b; 22 | b.PushBack(21); 23 | b.Display(); 24 | b.DeleteAt(0); 25 | b.Display(); 26 | b.PushBack(22); 27 | b.SetSize(5); 28 | b.Display(); 29 | 30 | Array c(5, 3.4); 31 | c.PushBack(5.5); 32 | c.Display(); 33 | c.SetSize(10); 34 | c.Display(); 35 | 36 | Array d; 37 | 38 | for (int i = 0; i < 17; i++) 39 | { 40 | d.PushBack(i); 41 | d.Display(); 42 | } 43 | return 0; 44 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Sampler/AliasMethod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class AliasMethod { 7 | public: 8 | AliasMethod(const std::vector& distribution = std::vector()) { 9 | Init(distribution); 10 | } 11 | 12 | public: 13 | void Init(const std::vector& distribution); 14 | 15 | void Clear() { table.clear(); } 16 | 17 | // 0, 1, ..., n - 1 18 | int Sample() const; 19 | int Sample(double& p) const; 20 | 21 | double P(int i) const; 22 | 23 | private: 24 | struct Item { 25 | Item() :u(-1), k(-1) {} 26 | 27 | double p; // orig probability 28 | double u; // choose probability 29 | int k; // alias 30 | }; 31 | 32 | std::vector table; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/App/hello/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | MainWindow 3 | 4 | 5 | 6 | 0 7 | 0 8 | 400 9 | 300 10 | 11 | 12 | 13 | MainWindow 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3N3T2_invN.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | layout (location = 1) in vec3 aNormal; 7 | layout (location = 2) in vec2 aTexCoords; 8 | 9 | out VS_OUT { 10 | vec3 FragPos; 11 | vec3 Normal; 12 | vec2 TexCoords; 13 | } vs_out; 14 | 15 | uniform mat4 model; 16 | 17 | uniform bool invertedNormals; 18 | 19 | void main() 20 | { 21 | vec4 worldPos = model * vec4(aPos, 1.0); 22 | vs_out.FragPos = worldPos.xyz; 23 | vs_out.TexCoords = aTexCoords; 24 | 25 | mat3 normalMatrix = transpose(inverse(mat3(model))); 26 | vs_out.Normal = normalize(normalMatrix * (invertedNormals ? -aNormal : aNormal)); 27 | 28 | gl_Position = projection * view * worldPos; 29 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Math/Segment.h: -------------------------------------------------------------------------------- 1 | #ifndef MATH_SEGMENT_H 2 | #define MATH_SEGMENT_H 3 | 4 | #include "basic.h" 5 | 6 | // ------------------------------ 接口 ------------------------------ 7 | 8 | struct Segment { 9 | vec3 a; 10 | vec3 b; 11 | }; 12 | 13 | vec3 Segment_At(Segment segment, float t); 14 | vec3 Segment_ClosestPoint(Segment segment, vec3 p); 15 | 16 | // ------------------------------ 实现 ------------------------------ 17 | 18 | vec3 Segment_At(Segment segment, float t) { 19 | return mix(segment.a, segment.b, saturate(t)); 20 | } 21 | 22 | vec3 Segment_ClosestPoint(Segment segment, vec3 p) { 23 | vec3 ab = segment.b - segment.a; 24 | float t = dot(p - segment.a, ab) / dot(ab, ab); 25 | return Segment_At(segment, t); 26 | } 27 | 28 | #endif // !MATH_SEGMENT_H 29 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Light/AreaLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | using namespace std; 7 | 8 | const rgbf AreaLight::Sample_L(const pointf3 & p, normalf & wi, float & distToLight, float & PD) const { 9 | cout << "WARNING::AreaLight:" << endl 10 | << "\t" << "not implemented" << endl; 11 | return 0.f; 12 | } 13 | 14 | float AreaLight::PDF(const pointf3 & p, const normalf & wi) const { 15 | cout << "WARNING::AreaLight:" << endl 16 | << "\t" << "not implemented" << endl; 17 | return 0.f; 18 | } 19 | 20 | bool AreaLight::Hit(const pointf3 & p, const vecf3 & dirToLight, pointf3 & hitPos) const { 21 | cout << "WARNING::AreaLight:" << endl 22 | << "\t" << "not implemented" << endl; 23 | return false; 24 | } 25 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/ShapeMesh/CapsuleMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ShapeMesh.h" 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class CapsuleMesh : public ShapeMesh { 9 | public: 10 | CapsuleMesh(unsigned n, float height = 2.f); 11 | float* GetNormalArr(); 12 | float* GetTexCoordsArr(); 13 | unsigned* GetIndexArr(); 14 | float* GetTangentArr(); 15 | unsigned GetNormalArrSize(); 16 | unsigned GetTexCoordsArrSize(); 17 | unsigned GetIndexArrSize(); 18 | unsigned GetTangentArrSize(); 19 | 20 | float GetHeight() const { return height; } 21 | 22 | protected: 23 | std::vector normalArr; 24 | std::vector texCoordsArr; 25 | std::vector indexArr; 26 | std::vector tangentArr; 27 | 28 | private: 29 | float height; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/RBFWarper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ImageWarper.h" 3 | #include 4 | #include 5 | 6 | class RBFWarper { 7 | public: 8 | 9 | using TMatrix = struct { 10 | double t11; 11 | double t12; 12 | double t21; 13 | double t22; 14 | }; 15 | 16 | using IntPoint = IPoint; 17 | using IntMapPoint = std::pair; 18 | 19 | const IntPoint& doTrans(const IntPoint &p); 20 | void initialize(std::vector v); 21 | 22 | static RBFWarper *getInstance(); 23 | 24 | protected: 25 | std::vector a_vecs; 26 | std::vector ctrl_point_pair; 27 | size_t total_pairs; 28 | 29 | Eigen::Matrix2d M_mat; 30 | Eigen::Vector2d b_vec; 31 | 32 | static RBFWarper inst; 33 | }; -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/Rect.cpp: -------------------------------------------------------------------------------- 1 | #include "Rect.h" 2 | 3 | using namespace DrawContext; 4 | 5 | Rect::Rect() 6 | { 7 | this->setAttr("point-required", 2); 8 | this->setAttr("mask-matrix-valid", 1); 9 | this->mask_mat_valid = false; 10 | } 11 | 12 | Rect::~Rect() 13 | { 14 | } 15 | 16 | void Rect::Draw(QPainter& painter) 17 | { 18 | if (ctrl_points.size() == 2) { 19 | painter.drawRect(QRect(ctrl_points[0], ctrl_points[1])); 20 | } 21 | } 22 | 23 | const Eigen::Matrix &DrawContext::Rect::getMaskMatrix() 24 | { 25 | assert(ctrl_points.size() == 2); 26 | if (mask_mat_valid) { 27 | return mask_mat; 28 | } else { 29 | QRect rect = getBoundingRect(); 30 | mask_mat = Eigen::Matrix::Ones(rect.height(), rect.width()); 31 | mask_mat_valid = true; 32 | return mask_mat; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Filter/FilterMitchell.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImgFilter.h" 4 | 5 | namespace Ubpa { 6 | class FilterMitchell : public ImgFilter { 7 | public: 8 | FilterMitchell(const vecf2& radius, float B, float C) : ImgFilter(radius), B(B), C(C) { } 9 | 10 | protected: 11 | virtual ~FilterMitchell() = default; 12 | 13 | public: 14 | static const Ptr New(const vecf2& radius, float B, float C) { 15 | return Ubpa::New(radius, B, C); 16 | } 17 | 18 | public: 19 | virtual float Evaluate(const pointf2& p) const override { 20 | return Mitchell1D(p[0] * invRadius[0]) * Mitchell1D(p[1] * invRadius[1]); 21 | } 22 | 23 | private: 24 | float Mitchell1D(float x) const; 25 | 26 | private: 27 | const float B; 28 | const float C; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Scene/CmptLight.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | using namespace Ubpa; 10 | 11 | using namespace std; 12 | 13 | transformf CmptLight::GetLightToWorldMatrixWithoutScale() const { 14 | auto tsfm = transformf::eye(); 15 | 16 | for (auto cur = GetSObj(); cur != nullptr; cur = cur->GetParent()) { 17 | auto cmptTransform = cur->GetComponent(); 18 | if (!cmptTransform) 19 | continue; 20 | 21 | auto pos = cmptTransform->GetPosition(); 22 | auto rotation = cmptTransform->GetRotation(); 23 | // tsfm = T * R * tsfm 24 | tsfm = transformf(pos.cast_to()) * transformf(rotation) * tsfm; 25 | } 26 | 27 | return tsfm; 28 | } 29 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/light.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) out vec4 GBuffer0; 4 | layout (location = 1) out vec4 GBuffer1; 5 | layout (location = 2) out vec4 GBuffer2; 6 | layout (location = 3) out vec4 GBuffer3; 7 | 8 | // layout : light 9 | // x y z w 10 | // 0 [radiance] 0 11 | // 1 0 0 0 0 12 | // 2 0 0 0 1.5 13 | // 3 0 0 0 0 14 | 15 | in VS_OUT { 16 | vec3 WorldPos; 17 | vec2 TexCoord; 18 | mat3 TBN; 19 | } vs_out; 20 | 21 | uniform vec3 radiance_factor; 22 | uniform sampler2D radiance_texture; 23 | 24 | void main() 25 | { 26 | vec3 radiance = radiance_factor * texture(radiance_texture, vs_out.TexCoord).rgb; 27 | 28 | GBuffer0 = vec4(radiance, 0); 29 | GBuffer1 = vec4(0, 0, 0, 0); 30 | GBuffer2 = vec4(0, 0, 0, 1.5); 31 | GBuffer3 = vec4(0, 0, 0, 0); 32 | } 33 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/ShapeManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | #include 5 | 6 | namespace DrawContext { 7 | 8 | class ShapeManager { 9 | public: 10 | 11 | typedef Shape* (*ShapeFactory)(int param); 12 | 13 | /* static member used to register type 14 | * if type has already occupied, return -1 15 | * else >=0 number given 16 | */ 17 | static int registerShape(ShapeFactory fact, int type); 18 | 19 | /* return the factory for one shape */ 20 | static ShapeFactory getFactory(int type); 21 | 22 | /* Hard-coded map */ 23 | typedef enum ShapeType { 24 | Rect = 0, 25 | Polygon = 1, 26 | Ellipse = 2, 27 | Line = 3, 28 | Point = 4, 29 | Freehand = 5, 30 | Circle = 6, 31 | } ShapeType; 32 | 33 | protected: 34 | static std::map shape_factories; 35 | }; 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/DeferredPipeline/GBuffer_Emission.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) out vec4 GBuffer0; 4 | layout (location = 1) out vec4 GBuffer1; 5 | layout (location = 2) out vec4 GBuffer2; 6 | layout (location = 3) out vec4 GBuffer3; 7 | 8 | // layout 9 | // x y z w 10 | // 0 [ pos ] ID 11 | // 1 [ norm ] 12 | // 2 [ L ] 13 | // 3 14 | 15 | in VS_OUT { 16 | vec3 FragPos; 17 | vec3 Normal; 18 | vec2 TexCoords; 19 | vec3 Tangent; 20 | } fs_in; 21 | 22 | struct BSDF_Emission { 23 | vec3 L; 24 | }; 25 | 26 | uniform BSDF_Emission emission; 27 | uniform int ID; 28 | 29 | void main() { 30 | // pack GBuffer 31 | GBuffer0 = vec4(fs_in.FragPos, ID); 32 | GBuffer1 = vec4(normalize(fs_in.Normal), 0); 33 | GBuffer2 = vec4(emission.L, 0); 34 | GBuffer3 = vec4(0); 35 | } 36 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/ShapeManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shape.h" 4 | #include 5 | 6 | namespace DrawContext { 7 | 8 | class ShapeManager { 9 | public: 10 | 11 | typedef Shape* (*ShapeFactory)(int param); 12 | 13 | /* static member used to register type 14 | * if type has already occupied, return -1 15 | * else >=0 number given 16 | */ 17 | static int registerShape(ShapeFactory fact, int type); 18 | 19 | /* return the factory for one shape */ 20 | static ShapeFactory getFactory(int type); 21 | 22 | /* Hard-coded map */ 23 | typedef enum ShapeType { 24 | Rect = 0, 25 | Polygon = 1, 26 | Ellipse = 2, 27 | Line = 3, 28 | Point = 4, 29 | Freehand = 5, 30 | Circle = 6, 31 | } ShapeType; 32 | 33 | protected: 34 | static std::map shape_factories; 35 | }; 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Basic/Geometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Ubpa { 7 | namespace Geometry { 8 | template 9 | bool IsConvexPolygon(const std::vector>& points) { 10 | assert(points.size() >= 4); 11 | std::vector> vecs(points.size()); 12 | std::vector> norms(points.size()); 13 | for (size_t i = 0; i < points.size(); i++) { 14 | size_t next = (i + 1) % points.size(); 15 | vecs[i] = points[next] - points[i]; 16 | } 17 | for (size_t i = 0; i < vecs.size(); i++) { 18 | size_t next = (i + 1) % points.size(); 19 | norms[i] = vecs[i].cross(vecs[next]); 20 | for (size_t j = 0; j < i; j++) { 21 | if (norms[j].dot(norms[i]) < static_cast(0)) 22 | return false; 23 | } 24 | } 25 | return true; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/Viewer/Roamer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Ubpa { 6 | class RawAPI_OGLW; 7 | class Camera; 8 | 9 | class Roamer final : public HeapObj { 10 | public: 11 | Roamer(RawAPI_OGLW* pOGLW); 12 | 13 | public: 14 | static const Ptr New(RawAPI_OGLW* pOGLW) { 15 | return Ubpa::New(pOGLW); 16 | } 17 | 18 | protected: 19 | virtual ~Roamer() = default; 20 | 21 | public: 22 | void Init(); 23 | void SetWH(int w, int h); 24 | 25 | RawAPI_OGLW* GetOGLW() { return pOGLW; } 26 | Ptr GetCamera() { return camera; } 27 | 28 | public: 29 | void SetLock(bool isLock) { lock = isLock; } 30 | 31 | private: 32 | void ListenerInit(); 33 | void UpdateCamera(); 34 | 35 | RawAPI_OGLW* pOGLW; 36 | unsigned int cameraUBO; 37 | Ptr camera; 38 | bool lock; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /Homeworks/5_ARAP/README.md: -------------------------------------------------------------------------------- 1 | # 5. ARAP参数化 2 | 3 | 4 | ## 作业递交 5 | 6 | - 递交内容:程序代码及实验报告 7 | - 递交时间:2020 年 3 月 22 日星期日 8 | 9 | ## 作业要求 10 | 11 | - 在给定的网格框架上完成作业,实现 12 | - ASAP (As-similar-as-possible) 参数化算法 13 | - ARAP (As-rigid-as-possible) 参数化算法 14 | - Hybrid 参数化方法(可选) 15 | - 对各种参数化方法(包括作业4的Floater方法、ASAP/ARAP方法等)进行比较 16 | - 继续学习和巩固三角网格的数据结构及编程 17 | - 学习和实现矩阵的 SVD 分解 18 | - 进一步巩固使用 Eigen 库求解大型稀疏线性方程组 19 | 20 | 21 | ## 提供的材料 22 | 23 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 24 | 25 | ### (1) 说明文档 `documents` [->](documents/) 26 | 27 | 本次作业的要求说明和一些辅助资料 28 | 29 | ### (2) 作业项目 `project` [->](project/) 30 | 31 | 本次作业的基础代码框架 32 | 33 | ## 参考文献 34 | 35 | [^08Liu]: Liu, Ligang, et al. "[**A local/global approach to mesh parameterization.**](http://cs.harvard.edu/~sjg/papers/arap.pdf)" *Computer Graphics Forum*. Vol. 27. No. 5. Oxford, UK: Blackwell Publishing Ltd, 2008. 36 | 37 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/documents/eigen_example/README.md: -------------------------------------------------------------------------------- 1 | # Eigen 示例 2 | 3 | ## 目录结构 4 | 5 | 本项目目录包含以下若干子目录: 6 | 7 | - [src/](src/):源代码 8 | - [include/](include/):头文件 9 | - [_deps/](include/_deps/):依赖(目前为空) 10 | 11 | ## 使用说明 12 | 13 | 首先手动下载 Eigen 14 | 15 | - [官方网站](http://eigen.tuxfamily.org/) 16 | - [Eigen 3.3.7 下载链接](https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip) 17 | 18 | 将 eigen-3.3.7 下的文件夹 Eigen 置于 [include/_deps/](include/_deps/) 中 19 | 20 | ## 其他说明 21 | 22 | - Qt:[简易说明](../../../Softwares/Qt.md) 23 | - CMake-GUI 在 configure 的时候,Optional platform for generator 要选 **x64** 24 | - CMake 一开始会拉取 [UCMake](https://github.com/Ubpa/UCMake),所以会稍微久一点,拉取的 UCMake 位于 `build/_deps/`,内含一些 CMake 的自定义函数 `Ubpa_xxx`,详细请看 [UbpaTool.cmake](https://github.com/Ubpa/UCMake/blob/master/cmake/UbpaTool.cmake),构建好的工程中会自带一些 UCMake 中的[示例项目](https://github.com/Ubpa/UCMake/tree/master/src),可以查看模仿 25 | 26 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/BRDF/Diffuse.h: -------------------------------------------------------------------------------- 1 | #ifndef BRDF_DIFFUSE_H 2 | #define BRDF_DIFFUSE_H 3 | 4 | #include "../../Math/basic.h" 5 | 6 | // ------------------------------ 接口 ------------------------------ 7 | 8 | void BRDF_Diffuse(out vec3 fd, out vec3 fs, vec3 albedo); 9 | vec3 BRDF_Diffuse(vec3 albedo); 10 | 11 | // diffuse 12 | vec3 BRDFd_Diffuse(vec3 albedo); 13 | // specular 14 | vec3 BRDFs_Diffuse(vec3 albedo); 15 | 16 | // ------------------------------ 实现 ------------------------------ 17 | 18 | vec3 BRDFd_Diffuse(vec3 albedo) { 19 | return albedo * INV_PI; 20 | } 21 | 22 | vec3 BRDFs_Diffuse(vec3 albedo) { 23 | return vec3(0); 24 | } 25 | 26 | void BRDF_Diffuse(out vec3 fd, out vec3 fs, vec3 albedo) { 27 | fd = albedo * INV_PI; 28 | fs = vec3(0); 29 | } 30 | 31 | vec3 BRDF_Diffuse(vec3 albedo) { 32 | return albedo * INV_PI; 33 | } 34 | 35 | #endif // !BRDF_DIFFUSE_H 36 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Engine/MeshEdit/MST.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ShortestPath.h" 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Ubpa { 16 | class TriMesh; 17 | class Paramaterize; 18 | 19 | class MST : public HeapObj { 20 | public: 21 | MST(Ptr triMeshObj); 22 | public: 23 | static const Ptr New(Ptr triMeshObj) { 24 | return Ubpa::New(triMeshObj); 25 | } 26 | public: 27 | void Clear(); 28 | bool Init(Ptr triMeshObj); 29 | 30 | bool Run(); 31 | Ptr GetTreeObj(); 32 | 33 | private: 34 | const std::vector> FindMST(const std::vector& vertices); 35 | 36 | private: 37 | Ptr shortestPath; 38 | Ptr treeObj; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/README.md: -------------------------------------------------------------------------------- 1 | # 作业项目 2 | 3 | ## 目录结构 4 | 5 | 本项目目录包含以下若干子目录: 6 | 7 | - [src/](src/):源代码 8 | - [include/](include/):头文件 9 | - [_deps/](include/_deps/):依赖(目前为空) 10 | 11 | ## 使用说明 12 | 13 | ### Eigen 14 | 15 | 如需 Eigen,参考 [Eigen 示例项目](../documents/eigen_example) 16 | 17 | ### ANN (Optional) 18 | 19 | 如需 ANN,参考 [ANN 示例项目](../documents/ann_example/) 20 | 21 | 对于本项目,在 CMake 进行 Configure 后,配置框中找到 `USE_ANN` 并勾选上,然后重新 Configure 后再 Generate 和 Open Project 即可完成配置 22 | 23 | ## 其他说明 24 | 25 | - Qt:[简易说明](../../../Softwares/Qt.md) 26 | - CMake-GUI 在 configure 的时候,Optional platform for generator 要选 **x64** 27 | - CMake 一开始会拉取 [UCMake](https://github.com/Ubpa/UCMake),所以会稍微久一点,拉取的 UCMake 位于 `build/_deps/`,内含一些 CMake 的自定义函数 `Ubpa_xxx`,详细请看 [UbpaTool.cmake](https://github.com/Ubpa/UCMake/blob/master/cmake/UbpaTool.cmake),构建好的工程中会自带一些 UCMake 中的[示例项目](https://github.com/Ubpa/UCMake/tree/master/src),可以查看模仿 28 | 29 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Viewer/Picker.cpp: -------------------------------------------------------------------------------- 1 | #include "Picker.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | using namespace Ubpa; 26 | 27 | using namespace std; 28 | 29 | Picker::Picker(Viewer * viewer) 30 | : viewer(viewer) { } 31 | 32 | void Picker::Init() { 33 | cout << "WARNING::Picker::Init:" << endl 34 | << "\t" << "not implemented" << endl; 35 | } 36 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/documents/hello/src/App/hello/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | 4 | #include 5 | 6 | MainWindow::MainWindow(QWidget *parent) : 7 | QMainWindow(parent), 8 | ui(new Ui::MainWindow) 9 | { 10 | ui->setupUi(this); 11 | CreateButtons(); 12 | } 13 | 14 | MainWindow::~MainWindow() 15 | { 16 | delete ui; 17 | } 18 | 19 | void MainWindow::HelloWorld() { 20 | QMessageBox::about(this, tr("Hello world"), 21 | tr("Well done! Go ahead.")); 22 | } 23 | 24 | void MainWindow::CreateButtons() 25 | { 26 | hello_world_action_ = new QAction(tr("&Hello world"), this); 27 | connect(hello_world_action_, &QAction::triggered, this, &MainWindow::HelloWorld); 28 | main_menu_ = menuBar()->addMenu(tr("&Main")); 29 | main_menu_->addAction(hello_world_action_); 30 | main_toolbar_ = addToolBar(tr("&Main")); 31 | main_toolbar_->addAction(hello_world_action_); 32 | } 33 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/ImgPixelSet.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Ubpa; 4 | 5 | using namespace std; 6 | 7 | ImgPixelSet::ImgPixelSet() { 8 | 9 | } 10 | 11 | ImgPixelSet::ImgPixelSet(size_t width, size_t height) { 12 | data.reserve(width * height); 13 | for (size_t i = 0; i < width; i++) { 14 | for (size_t j = 0; j < height; j++) { 15 | Insert(valu2(i, j)); 16 | } 17 | } 18 | } 19 | 20 | vector ImgPixelSet::RandPick(size_t n) { 21 | vector pixels; 22 | 23 | const size_t num = min(Size(), n); 24 | pixels.reserve(num); 25 | 26 | for (size_t i=0; i < num; i++) 27 | pixels.push_back(RandPick()); 28 | 29 | return pixels; 30 | } 31 | 32 | std::vector ImgPixelSet::PickAll() { 33 | vector pixels; 34 | const size_t num = Size(); 35 | 36 | for (size_t i = 0; i < num; i++) 37 | pixels.push_back(RandPick()); 38 | 39 | return pixels; 40 | } 41 | -------------------------------------------------------------------------------- /Homeworks/9_PathTracing/project/data/shaders/p3t2n3t3.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout (location = 0) in vec3 aPos; 4 | layout (location = 1) in vec2 aTexCoord; 5 | layout (location = 2) in vec3 aNormal; 6 | layout (location = 3) in vec3 aTangent; 7 | 8 | out VS_OUT { 9 | vec3 WorldPos; 10 | vec2 TexCoord; 11 | mat3 TBN; 12 | } vs_out; 13 | 14 | uniform mat4 projection; 15 | uniform mat4 view; 16 | uniform mat4 model; 17 | 18 | void main() 19 | { 20 | vec4 worldPos = model * vec4(aPos, 1.0); 21 | vs_out.WorldPos = worldPos.xyz / worldPos.w; 22 | 23 | vs_out.TexCoord = aTexCoord; 24 | 25 | mat3 normalMatrix = transpose(inverse(mat3(model))); 26 | 27 | vec3 N = normalize(normalMatrix * aNormal); 28 | vec3 T = mat3(model) * aTangent; 29 | T = normalize(T - dot(T, N) * N); 30 | vec3 B = cross(N, T); 31 | vs_out.TBN = mat3(T, B, N); 32 | 33 | gl_Position = projection * view * worldPos; 34 | } 35 | -------------------------------------------------------------------------------- /Homeworks/2_ImageWarping/project/src/App/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | MainWindowClass 3 | 4 | 5 | MainWindowClass 6 | 7 | 8 | 9 | 0 10 | 0 11 | 600 12 | 400 13 | 14 | 15 | 16 | MainWindow 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Engine/Skybox/skybox.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec3 TexCoords; 5 | 6 | // 32 7 | layout (std140) uniform Environment{ 8 | vec3 colorFactor; // 12 0 9 | float intensity; // 4 12 10 | bool haveSkybox; // 4 16 11 | bool haveEnvironment; // 4 20 12 | }; 13 | 14 | uniform samplerCube skybox; 15 | uniform bool needGamma = false; 16 | 17 | vec3 GetEnvironment(vec3 texcoord); 18 | 19 | void main() 20 | { 21 | vec3 ambient = GetEnvironment(TexCoords); 22 | 23 | // gamma 24 | if(needGamma) 25 | ambient = pow(ambient, vec3(1.0/2.2)); 26 | 27 | FragColor = vec4(ambient, 1); 28 | } 29 | 30 | vec3 GetEnvironment(vec3 texcoord) { 31 | if(!haveEnvironment) 32 | return vec3(0); 33 | 34 | if(!haveSkybox) 35 | return intensity * colorFactor; 36 | 37 | return intensity * colorFactor * texture(skybox, texcoord).rgb; 38 | } 39 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/src/App/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | MainWindowClass 3 | 4 | 5 | MainWindowClass 6 | 7 | 8 | 9 | 0 10 | 0 11 | 600 12 | 400 13 | 14 | 15 | 16 | MainWindow 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/basic_P3N3T2T3.vs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | #include "camera.h" 4 | 5 | layout (location = 0) in vec3 aPos; 6 | layout (location = 1) in vec3 aNormal; 7 | layout (location = 2) in vec2 aTexCoords; 8 | layout (location = 3) in vec3 aTangent; 9 | 10 | out VS_OUT { 11 | vec3 FragPos; 12 | vec3 Normal; 13 | vec2 TexCoords; 14 | vec3 Tangent; 15 | } vs_out; 16 | 17 | uniform mat4 model; 18 | 19 | void main() 20 | { 21 | vec4 worldPos = model * vec4(aPos, 1.0); 22 | vs_out.FragPos = worldPos.xyz / worldPos.w; 23 | vs_out.TexCoords = aTexCoords; 24 | 25 | mat3 normalMatrix = transpose(inverse(mat3(model))); 26 | 27 | vec3 N = normalize(normalMatrix * aNormal); 28 | vs_out.Normal = N; 29 | 30 | vec3 T = normalize(normalMatrix * aTangent); 31 | vs_out.Tangent = normalize(T - dot(T, N) * N); 32 | 33 | gl_Position = projection * view * worldPos; 34 | } 35 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/RTX/Film.cpp: -------------------------------------------------------------------------------- 1 | #include "Film.h" 2 | 3 | #include "FilmTile.h" 4 | 5 | #include 6 | #include 7 | 8 | using namespace Ubpa; 9 | 10 | Film::Film(Ptr img, Ptr filter) 11 | : resolution(img->GetWidth(), img->GetHeight()), 12 | pixels(img->GetWidth(), std::vector(img->GetHeight())), 13 | frame({ 0,0 }, { img->GetWidth(),img->GetHeight() }), 14 | filter(filter), 15 | img(img) 16 | { 17 | assert(img != nullptr && img->IsValid()); 18 | assert(img->GetChannel() == 3); 19 | } 20 | 21 | const Ptr Film::GenFilmTile(const bboxi2 & frame) const { 22 | return FilmTile::New(frame, filter); 23 | } 24 | 25 | void Film::MergeFilmTile(Ptr filmTile) { 26 | for (const auto pos : filmTile->AllPos()) { 27 | pixels[pos[0]][pos[1]] += filmTile->At(pos); 28 | img->SetPixel(pos, pixels[pos[0]][pos[1]].ToRadiance()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Scene/AssimpLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | struct aiNode; 11 | struct aiMesh; 12 | struct aiScene; 13 | struct aiMaterial; 14 | enum aiTextureType; 15 | 16 | namespace Ubpa { 17 | class Image; 18 | class SObj; 19 | class TriMesh; 20 | 21 | namespace AssimpLoader { 22 | const Ptr Load(const std::string& path); 23 | using Str2Img = std::map>; 24 | const Ptr LoadNode(Str2Img& str2img, const std::string& dir, aiNode* node, const aiScene* scene); 25 | void LoadMesh(Str2Img& str2img, const std::string& dir, aiMesh* mesh, const aiScene* scene, Ptr sobj); 26 | const Ptr LoadTet(const std::string& dir); 27 | Ptr LoadTexture(Str2Img& str2img, const std::string& dir, aiMaterial* material, aiTextureType type); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/README.md: -------------------------------------------------------------------------------- 1 | # 1. 画图小工具 MiniDraw 2 | 3 | > 预备: 4 | > - 安装 Qt,查看[简易说明](../../Softwares/Qt.md) 5 | > 6 | > 作业步骤: 7 | > - 查看[文档](documents/),内含多个小教程 8 | > - 完成项目 [project](project/) 9 | > - 按照[作业规范](../README.md)提交作业 10 | 11 | ## 作业递交 12 | 13 | - 递交内容:程序代码及实验报告 14 | - 递交时间:2020 年 2 月 23 日星期日 15 | 16 | ## 要求 17 | 18 | - 写一个画图小程序 MiniDraw,要求画直线 (Line),椭圆 (Ellipse),矩形 (Rectangle),多边形 (Polygon) 等图形元素(图元) 19 | - 每种图元需用一个类(对象)来封装,如 `CLine`,`CEllipse`,`CRect`,`CPolygon`,`CFreehand` 20 | - 各种图元从一个父类来继承,如 `CFigure` 21 | - 学习类的继承和多态 22 | 23 | ## 目的 24 | 25 | - 学习 Qt 窗口编程 26 | - STL `vector` 等的使用 27 | - 学习鼠标操作 28 | - GDI 画图 29 | - 学习面向对象编程 30 | - 巩固类的封装性 31 | - 学习体会类的继承和多态 32 | - 多使用 Online Help 33 | 34 | ## 提供的材料 35 | 36 | 根据上述要求和方法根据两个文件夹`(1) documents`和`(2) project`的内容进行练习。 37 | 38 | ### (1) 说明文档 `documents` [->](documents/) 39 | 40 | 本次作业的要求说明和一些辅助资料 41 | 42 | ### (2) 作业项目 `project` [->](project/) 43 | 44 | 本次作业的基础代码框架 45 | 46 | -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "-v", 12 | "ctestCommandArgs": "", 13 | "variables": [] 14 | }, 15 | { 16 | "name": "x64-Release", 17 | "generator": "Ninja", 18 | "configurationType": "RelWithDebInfo", 19 | "buildRoot": "${projectDir}\\out\\build\\${name}", 20 | "installRoot": "${projectDir}\\out\\install\\${name}", 21 | "cmakeCommandArgs": "", 22 | "buildCommandArgs": "-v", 23 | "ctestCommandArgs": "", 24 | "inheritEnvironments": [ "msvc_x64_x64" ], 25 | "variables": [] 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/project/CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "-v", 12 | "ctestCommandArgs": "", 13 | "variables": [] 14 | }, 15 | { 16 | "name": "x64-Release", 17 | "generator": "Ninja", 18 | "configurationType": "RelWithDebInfo", 19 | "buildRoot": "${projectDir}\\out\\build\\${name}", 20 | "installRoot": "${projectDir}\\out\\install\\${name}", 21 | "cmakeCommandArgs": "", 22 | "buildCommandArgs": "-v", 23 | "ctestCommandArgs": "", 24 | "inheritEnvironments": [ "msvc_x64_x64" ], 25 | "variables": [] 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Engine/Primitive/Sphere.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace Ubpa; 6 | 7 | const pointf2 Sphere::TexcoordOf(const normalf & normal) { 8 | auto nDir = normal.normalize(); 9 | const float phi = std::atan2(-nDir[0], -nDir[2]) + PI; 10 | const float theta = acos(nDir[1]); 11 | 12 | const auto u = phi / (2.f * PI); 13 | const auto v = theta / PI; 14 | return pointf2(u, v); 15 | } 16 | 17 | const normalf Sphere::TangentOf(const normalf & normal) { 18 | auto nDir = normal.normalize(); 19 | const float phi = std::atan2(-nDir[0], -nDir[2]) + PI; 20 | 21 | return normalf(cos(phi), 0, -sin(phi)); 22 | } 23 | 24 | const normalf Sphere::SphereCoord::ToDir() const { 25 | const auto sinTheta = sin(theta); 26 | 27 | float x = sinTheta * sin(phi); 28 | float y = cos(theta); 29 | float z = sinTheta * cos(phi); 30 | return { x,y,z }; 31 | } 32 | -------------------------------------------------------------------------------- /Softwares/Qt.md: -------------------------------------------------------------------------------- 1 | # QT 简略使用说明 2 | 3 | ## 安装 4 | 5 | - 打开[官网](https://www.qt.io/) 6 | - 点击右上角的 "Download. Try. Buy" 7 | - 点击 "Downloads for open sources users" 的 "Go open source"(此时需要登录)得到下载器 8 | - 打开下载器,选择 Qt 5.12.2 的 MSVC 2017 64-bit(可以用于 VS2019) 9 | - 将 `YOUR_PATH_TO/Qt5/msvc 2017 64/bin` 加入到环境变量 `Path` 中([配置方法](https://jingyan.baidu.com/article/7908e85ce8ddd3af491ad27c.html)) 10 | - VS 2019 菜单栏->扩展->管理扩展,搜索 Qt,找到 Qt Visual Studio Tools 并安装(需退出 VS),该工具以便在 VS 中打开 *.qrc 和 *.ui 文件时可以自动打开 Qt Resource Editor 和 Qt Designer 11 | - 安装 Qt Visual Studio Tools 成功后,重启 VS,菜单栏->扩展->Qt VS Tool->Qt Options,在弹出的窗口中 12 | - Qt Versions 下选择 Add,添加 path 为 `YOUR_PATH_TO/Qt5/msvc 2017 64` 13 | - Qt Default Settings 下 Ask before checkout files 选择 **False** 14 | 15 | ## 入门 16 | 17 | Qt 的使用资料众多。本课程需要 Qt 相关技能不多,主要靠模仿和查阅官方文档的方式解决具体问题 18 | 19 | 建议可以花 1-2 天的时间跟一下教程,如 [跟小豆君学Qt](https://zhuanlan.zhihu.com/c_119081535) 20 | 21 | 作业 1 包含了[入门教程](../Homeworks/1_MiniDraw/documents/) 22 | 23 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/documents/opencv_example/src/test/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | MainWindowClass 3 | 4 | 5 | MainWindowClass 6 | 7 | 8 | 9 | 0 10 | 0 11 | 600 12 | 400 13 | 14 | 15 | 16 | MainWindow 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/src/Basic/Math.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | using namespace Ubpa; 7 | 8 | using namespace std; 9 | 10 | static uniform_int_distribution uiMap; 11 | static uniform_int_distribution iMap; 12 | static uniform_real_distribution fMap(0.0f,1.0f); 13 | static uniform_real_distribution fMap_exclude1(0.0f, 0.99999999f); 14 | static uniform_real_distribution dMap(0.0,1.0); 15 | static default_random_engine engine; 16 | 17 | int Math::Rand_I() { 18 | return iMap(engine); 19 | } 20 | 21 | unsigned int Math::Rand_UI() { 22 | return uiMap(engine); 23 | } 24 | 25 | float Math::Rand_F() { 26 | return fMap(engine); 27 | } 28 | 29 | float Math::Rand_F_exclude1() { 30 | return fMap_exclude1(engine); 31 | } 32 | 33 | double Math::Rand_D() { 34 | return dMap(engine); 35 | } 36 | 37 | void Math::RandSetSeedByCurTime() { 38 | engine.seed(clock()); 39 | } 40 | -------------------------------------------------------------------------------- /Homeworks/6_MassSpring/documents/tetgen/README.md: -------------------------------------------------------------------------------- 1 | # TetGen 使用指南 2 | 3 | ## Tetgen 说明 4 | 5 | - Tetgen 为生成四面体网格剖分的开源库 6 | - Tetgen 官网[->](http://www.wias-berlin.de/software/tetgen) 7 | - Tetgen 官方文档下载[->](http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual.pdf) 8 | 9 | ## 四面体网格数据文件格式 10 | 11 | 12 | - tet 网格数据文件的格式与三角网格数据 obj 文件的格式很类似,包含点的列表和四面体的列表;与 obj 文件不一样的是,顶点的索引是从 0 开始 (obj 文件的索引是从 1 开始) 13 | - 下面为一个两个四面体构成的网格的例子,第一行格式:tet 后为顶点数和四面体数 14 | 15 | ``` 16 | tet 5 2 17 | 0 0 0 18 | 0 1 0 19 | 0 0 1 20 | 1 0 0 21 | 1 1 1 22 | 0 1 2 3 23 | 1 2 3 4 24 | ``` 25 | 26 | 其中第2-6行表示5个顶点的坐标,最后两行表示两个四面体的顶点索引,例如第一个四面体由序号为0,1,2,3的顶点构成 27 | 28 | 29 | ## 四面体网格数据生成方法 30 | 31 | - 本示范代码中的 main.cpp 设置读入表面网格文件路径(代码写的接口支持.stl, . poly)和输出网格路径(输出四面体网格为自定义格式.tet) 32 | - poly文件可参考 Tetgen 官方文档 33 | - Tetgen 中可通过设置一些参数来控制生成四面体网格的质量,详细可参考 Tetgen 的官方说明文档 34 | - 例子:在类 CTet_generate 的 tet_out 函数中设置,例如这里的代码中参数为"pqnnfea0.1z",其中0.1为生成网格最大四面体体积,对大模型要适当调大该参数,否则生成网格会过于稠密;注意:代码使用时读取文件后需要在控制台窗口中敲击回车才会继续运行 35 | 36 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/data/shaders/Common/interpolation.fs: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D image; 7 | 8 | uniform float weight[5] = float[] (0.4714, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162); 9 | 10 | void main() 11 | { 12 | vec3 result = vec3(0); 13 | 14 | result = texture(image, TexCoords).rgb; 15 | if(result != vec3(0)){ 16 | FragColor = vec4(result,1.0f); 17 | }else{ 18 | vec2 tex_offset = 1.0 / textureSize(image, 0); // gets size of single texel 19 | float weightSum = 0; 20 | for(int i=0;i<9;i++){ 21 | for(int j=0;j<9;j++){ 22 | vec3 tmpColor; 23 | tmpColor = texture(image, TexCoords + vec2(tex_offset.x * (i - 4), tex_offset.y * (j - 4))).rgb; 24 | if(tmpColor != vec3(0)){ 25 | float w = weight[abs(i-4)]*weight[abs(j-4)]; 26 | result += tmpColor * w; 27 | weightSum += w; 28 | } 29 | } 30 | } 31 | FragColor = vec4(result / weightSum, 1.0); 32 | } 33 | } -------------------------------------------------------------------------------- /Homeworks/1_MiniDraw/project/src/App/minidraw.h: -------------------------------------------------------------------------------- 1 | #ifndef MINIDRAW_H 2 | #define MINIDRAW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | class MiniDraw : public QMainWindow 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | MiniDraw(QWidget *parent = 0); 17 | ~MiniDraw(); 18 | 19 | void Init(); 20 | void AboutBox(); 21 | 22 | // maintain statusbar messages 23 | void putMessage(const QString msg); 24 | void setShapeStatus(DrawContext::ShapeManager::ShapeType shape); 25 | void setModeStatus(ViewWidget::mode mode); 26 | void setCursorStatus(int x, int y); 27 | 28 | ViewWidget::mode modeVal; 29 | DrawContext::ShapeManager::ShapeType shapeVal; 30 | 31 | private: 32 | void updateSBarIndicator(void); 33 | 34 | Ui::MiniDrawClass ui; 35 | ViewWidget* view_widget_; 36 | QLabel* sbar_perm_indicator; 37 | 38 | int cursor_x; 39 | int cursor_y; 40 | }; 41 | 42 | #endif // MINIDRAW_H 43 | -------------------------------------------------------------------------------- /Homeworks/0_CppPratices/documents/3_TemplateDArray/README.md: -------------------------------------------------------------------------------- 1 | # 3. 模板动态数组 2 | 3 | > **Template** **D**ynamic **Array** (TemplateDArray) 4 | > 5 | > --- 6 | > 7 | > **注:** 如果你正在接受这些编程训练,表示你已经同意我们之间的版权协议。请严禁将这些练习的代码(包括你自己的代码)在不经允许的情况下在公共网上公布和散播。一经发现,后果自负。谢谢!-刘利刚 (ligang.liu@gmail.com) 8 | 9 | ## 问题 10 | 11 | 现在实现的类已经比较好了,用户使用起来很方便。 12 | 13 | 但是,新的问题又出来了。 14 | 15 | 上述的动态数组只能存储 `double` 类型的数据。想象一下,另一个用户也想用这个动态数组,但是他处理的数据是 `int` 类型的,该如何办? 16 | 17 | 当然,你可以再写一个基于 `int` 类型的动态数组类,你发现,大部分的代码都不要改动,只要将类型 `double` 变成 `int` 即可。 18 | 19 | 如果另一个用户需要处理的是 `float` 类型,还有用户处理的是 `char` 类型的….该怎么办? 20 | 21 | 这样做的缺点很显然: 22 | 23 | - 这些类的代码大同小异,代码冗余; 24 | - 当对这个类进行修改时,所有的这些类都要同时改,不利于代码维护; 25 | 26 | 有无办法解决这个问题?即,如果能把变量的“类型”也当作一个“变量”,不就可以了吗?这个在 C 中是不能解决的,但是在 C++ 中,有一种新的机制 `template`,就可以解决上述问题。`Template` 的使用非常简单,大致的形式见:[Array5](../1_BasicDArray/C2Cpp/src/Array5) 27 | 28 | `Template` 的学习是“泛型编程”的基础,务必要掌握! 29 | 30 | ## 作业要求 31 | 32 | - 将上一个作业改为 `template` 类,并做充分测试; 33 | - 注意:对于 `template` 类,需要将 `*.cpp` 的实现代码放在 `*.h` 中,才能编译通过。其他情况都需分开。 34 | 35 | -------------------------------------------------------------------------------- /Homeworks/4_MinSurfMeshPara/project/include/Qt/OpThread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace Ubpa { 8 | class Op; 9 | 10 | class OpThread : public QThread, public HeapObj { 11 | Q_OBJECT 12 | public: 13 | OpThread(Ptr op = nullptr); 14 | 15 | public: 16 | static const Ptr New(Ptr op = nullptr) { 17 | return Ubpa::New(op); 18 | } 19 | 20 | protected: 21 | virtual ~OpThread() = default; 22 | 23 | public: 24 | void SetOp(Ptr op) { this->op = op; } 25 | void Stop() { isStop = true; } 26 | bool IsStop() const { return isStop; } 27 | 28 | signals: 29 | void UI_Op(Ptr op); 30 | 31 | public: 32 | template 33 | void UIConnect(T* obj, void (T::* f)(Ptr op)) { 34 | connect(this, &OpThread::UI_Op, obj, f); 35 | } 36 | void UI_Op_Run(Ptr op); 37 | 38 | protected: 39 | virtual void run(); 40 | 41 | private: 42 | volatile bool isStop; 43 | Ptr op; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /Homeworks/3_PoissonImageEditing/project/CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "-v", 12 | "ctestCommandArgs": "", 13 | "intelliSenseMode": "windows-msvc-x64", 14 | "variables": [] 15 | }, 16 | { 17 | "name": "x64-Release", 18 | "generator": "Ninja", 19 | "configurationType": "RelWithDebInfo", 20 | "buildRoot": "${projectDir}\\out\\build\\${name}", 21 | "installRoot": "${projectDir}\\out\\install\\${name}", 22 | "cmakeCommandArgs": "", 23 | "buildCommandArgs": "-v", 24 | "ctestCommandArgs": "", 25 | "inheritEnvironments": [ "msvc_x64_x64" ], 26 | "variables": [] 27 | } 28 | ] 29 | } --------------------------------------------------------------------------------