aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.DS_Storebin8196 -> 8196 bytes
-rw-r--r--cmake-build-release/.ninja_depsbin272640 -> 358188 bytes
-rw-r--r--cmake-build-release/.ninja_log64
-rw-r--r--cmake-build-release/CMakeFiles/projects_ray_autogen.dir/ParseCache.txt124
-rw-r--r--cmake-build-release/Testing/Temporary/LastTest.log4
-rwxr-xr-xcmake-build-release/projects_raybin350681 -> 350729 bytes
-rw-r--r--scenefiles-4d/unit_sphere.json2
-rw-r--r--src/illuminate/illuminate.cpp272
8 files changed, 160 insertions, 306 deletions
diff --git a/.DS_Store b/.DS_Store
index 03e9cdb..b746bb5 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/cmake-build-release/.ninja_deps b/cmake-build-release/.ninja_deps
index 1dd70c6..c77f947 100644
--- a/cmake-build-release/.ninja_deps
+++ b/cmake-build-release/.ninja_deps
Binary files differ
diff --git a/cmake-build-release/.ninja_log b/cmake-build-release/.ninja_log
index 0536d40..183942e 100644
--- a/cmake-build-release/.ninja_log
+++ b/cmake-build-release/.ninja_log
@@ -35,3 +35,67 @@
7 34 1702449311248367705 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
38 1376 1702449312584870357 CMakeFiles/projects_ray.dir/src/accelerate/myqtconcurrent.cpp.o 202e3ecc659447bc
1376 1487 1702449312699120051 projects_ray 45fbfe11691b47a4
+7 422 1702449492387854000 projects_ray_autogen/timestamp 55fca76aac650d2f
+7 422 1702449492387854000 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+7 422 1702449492387854000 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+7 422 1702449492387854000 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+423 643 1702449492612892188 CMakeFiles/projects_ray.dir/src/settings.cpp.o af593dd8c38f8a51
+424 766 1702449492735548848 CMakeFiles/projects_ray.dir/src/camera/camera.cpp.o ae395a7ba55f31e0
+424 1159 1702449493127944322 CMakeFiles/projects_ray.dir/src/intersect/normals.cpp.o dc9fbf174942b6a6
+422 1242 1702449493209947634 CMakeFiles/projects_ray.dir/projects_ray_autogen/mocs_compilation.cpp.o 1ad68196f2f117c1
+424 1250 1702449493216958161 CMakeFiles/projects_ray.dir/src/raytracer/raytracescene.cpp.o 4a558d7c0ab76c07
+423 1348 1702449493315022332 CMakeFiles/projects_ray.dir/src/mainwindow.cpp.o 8a94e9f3bb65e6ba
+423 1527 1702449493494801235 CMakeFiles/projects_ray.dir/src/main.cpp.o 94fb23c1a8b2c56c
+766 1547 1702449493516117104 CMakeFiles/projects_ray.dir/src/intersect/intersect.cpp.o d2b1593379e5dcda
+643 1572 1702449493540998673 CMakeFiles/projects_ray.dir/src/utils/sceneparser.cpp.o e6ffba0ae97d5386
+424 1786 1702449493752805712 CMakeFiles/projects_ray.dir/src/raytracer/raytracer.cpp.o 19b4d88ef40a6db1
+1159 1946 1702449493914545993 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+1242 1987 1702449493956540906 CMakeFiles/projects_ray.dir/src/illuminate/shadow.cpp.o 976dc05943374640
+1251 2006 1702449493973524002 CMakeFiles/projects_ray.dir/src/illuminate/reflect.cpp.o 899987bee3f68062
+1348 2092 1702449494060410954 CMakeFiles/projects_ray.dir/src/texture/texture.cpp.o ee619672f0183b37
+1548 2226 1702449494194849367 CMakeFiles/projects_ray.dir/src/utils/raytracerutils.cpp.o 2155c0e78af65352
+1527 2227 1702449494195758020 CMakeFiles/projects_ray.dir/src/accelerate/myqthreads.cpp.o 1275de63f43c05f3
+1572 2267 1702449494236003666 CMakeFiles/projects_ray.dir/src/aliasing/supersample.cpp.o 856523a4b6d122f7
+1946 2293 1702449494263175911 CMakeFiles/projects_ray.dir/src/vec4ops/vec4ops.cpp.o d7fc6a03a78a11b2
+1786 2556 1702449494524724589 CMakeFiles/projects_ray.dir/src/aliasing/filter.cpp.o 9dee6d99978c214
+2007 2777 1702449494744944219 CMakeFiles/projects_ray.dir/src/accelerate/kdtree.cpp.o cef03b69fda1011b
+2227 2872 1702449494841801073 CMakeFiles/projects_ray.dir/src/vec4ops/rotations4d.cpp.o cad2614c6119bd5e
+2092 2899 1702449494868005082 CMakeFiles/projects_ray.dir/src/accelerate/bvh.cpp.o 58a267a27bf597a8
+1988 3376 1702449495343876471 CMakeFiles/projects_ray.dir/src/accelerate/myqtconcurrent.cpp.o 202e3ecc659447bc
+3376 3483 1702449495454463051 projects_ray 45fbfe11691b47a4
+7 35 1702449639360321520 projects_ray_autogen/timestamp 55fca76aac650d2f
+7 35 1702449639360321520 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+7 35 1702449639360321520 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+7 35 1702449639360321520 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+39 710 1702449640031620512 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+711 820 1702449640143696445 projects_ray 45fbfe11691b47a4
+7 35 1702449662726439983 projects_ray_autogen/timestamp 55fca76aac650d2f
+7 35 1702449662726439983 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+7 35 1702449662726439983 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+7 35 1702449662726439983 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+38 733 1702449663421583266 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+733 841 1702449663531466646 projects_ray 45fbfe11691b47a4
+7 34 1702449740842205717 projects_ray_autogen/timestamp 55fca76aac650d2f
+7 34 1702449740842205717 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+7 34 1702449740842205717 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+7 34 1702449740842205717 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+38 721 1702449741525690079 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+721 827 1702449741633075912 projects_ray 45fbfe11691b47a4
+7 35 1702450109364382786 projects_ray_autogen/timestamp 55fca76aac650d2f
+7 35 1702450109364382786 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+7 35 1702450109364382786 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+7 35 1702450109364382786 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+39 712 1702450110037255256 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+712 816 1702450110143402439 projects_ray 45fbfe11691b47a4
+7 33 1702450451414108535 projects_ray_autogen/timestamp 55fca76aac650d2f
+7 33 1702450451414108535 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+7 33 1702450451414108535 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+7 33 1702450451414108535 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+37 706 1702450452082570638 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+706 820 1702450452198733637 projects_ray 45fbfe11691b47a4
+6 34 1702450469770048434 projects_ray_autogen/timestamp 55fca76aac650d2f
+6 34 1702450469770048434 projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+6 34 1702450469770048434 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/timestamp 55fca76aac650d2f
+6 34 1702450469770048434 /Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/mocs_compilation.cpp 55fca76aac650d2f
+38 725 1702450470457408233 CMakeFiles/projects_ray.dir/src/illuminate/illuminate.cpp.o 36fb1526130d4f10
+725 831 1702450470565593736 projects_ray 45fbfe11691b47a4
diff --git a/cmake-build-release/CMakeFiles/projects_ray_autogen.dir/ParseCache.txt b/cmake-build-release/CMakeFiles/projects_ray_autogen.dir/ParseCache.txt
index 0e68cf3..05a22d1 100644
--- a/cmake-build-release/CMakeFiles/projects_ray_autogen.dir/ParseCache.txt
+++ b/cmake-build-release/CMakeFiles/projects_ray_autogen.dir/ParseCache.txt
@@ -1,10 +1,26 @@
# Generated by CMake. Changes will be overwritten.
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/myqtconcurrent.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/rgba.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/kdtree.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenefilereader.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/aliasing/filter.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/rotations4d.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/transform4d.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/intersect/normals.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/texture/texture.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/raytracerutils.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/kdtree.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/settings.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/sceneparser.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/illuminate/shadow.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/settings.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/mainwindow.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/intersect/intersect.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracescene.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/illuminate/reflect.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/main.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/illuminate/illuminate.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/mainwindow.h
mmc:Q_OBJECT
- mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.h
+ mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/mainwindow.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/moc_predefs.h
mdp:/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/Availability.h
mdp:/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/AvailabilityInternal.h
@@ -457,6 +473,7 @@
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/camera/camera.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracescene.h
+ mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/aspectratiowidget/aspectratiowidget.hpp
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/rgba.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenedata.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/sceneparser.h
@@ -507,6 +524,7 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qiterator.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qline.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qlist.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qlocale.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qlogging.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qmalloc.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qmap.h
@@ -527,6 +545,7 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qprocessordetection.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qrect.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qrefcount.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qregularexpression.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qscopedpointer.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qscopeguard.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qset.h
@@ -599,21 +618,52 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qtguiexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qtguiglobal.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qtransform.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qvalidator.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qwindowdefs.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/QOpenGLWidget
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/qopenglwidget.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/qtopenglwidgetsexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/qtopenglwidgetsglobal.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QBoxLayout
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QCheckBox
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QDoubleSpinBox
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QLabel
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QMainWindow
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QPushButton
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QSlider
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QSpinBox
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QWidget
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qabstractbutton.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qabstractslider.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qabstractspinbox.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qboxlayout.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qcheckbox.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qframe.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qgridlayout.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qlabel.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qlayout.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qlayoutitem.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qmainwindow.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qpushbutton.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qsizepolicy.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qslider.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qspinbox.h
+ mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtabwidget.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgets-config.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgetsexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgetsglobal.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qwidget.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracescene.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/camera/camera.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/aliasing/supersample.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/camera/camera.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/vec4ops.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenefilereader.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/myqthreads.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/vec4ops.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/bvh.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/bvh.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenedata.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/sceneparser.h
/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/aspectratiowidget/aspectratiowidget.hpp
mmc:Q_OBJECT
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/aspectratiowidget/aspectratiowidget.hpp
@@ -1065,20 +1115,10 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgetsexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgetsglobal.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qwidget.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/sceneparser.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenedata.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/bvh.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/bvh.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/vec4ops.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/myqthreads.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenefilereader.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/vec4ops.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/camera/camera.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/aliasing/supersample.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/camera/camera.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/mainwindow.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracescene.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.h
mmc:Q_OBJECT
- mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/mainwindow.h
+ mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/cmake-build-release/projects_ray_autogen/moc_predefs.h
mdp:/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/Availability.h
mdp:/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/AvailabilityInternal.h
@@ -1531,7 +1571,6 @@
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/camera/camera.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracescene.h
- mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/aspectratiowidget/aspectratiowidget.hpp
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/rgba.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenedata.h
mdp:/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/sceneparser.h
@@ -1582,7 +1621,6 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qiterator.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qline.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qlist.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qlocale.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qlogging.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qmalloc.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qmap.h
@@ -1603,7 +1641,6 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qprocessordetection.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qrect.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qrefcount.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qregularexpression.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qscopedpointer.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qscopeguard.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtCore.framework/Versions/A/Headers/qset.h
@@ -1676,57 +1713,20 @@
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qtguiexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qtguiglobal.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qtransform.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qvalidator.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtGui.framework/Versions/A/Headers/qwindowdefs.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/QOpenGLWidget
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/qopenglwidget.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/qtopenglwidgetsexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtOpenGLWidgets.framework/Versions/A/Headers/qtopenglwidgetsglobal.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QBoxLayout
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QCheckBox
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QDoubleSpinBox
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QLabel
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QMainWindow
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QPushButton
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QSlider
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QSpinBox
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/QWidget
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qabstractbutton.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qabstractslider.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qabstractspinbox.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qboxlayout.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qcheckbox.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qframe.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qgridlayout.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qlabel.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qlayout.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qlayoutitem.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qmainwindow.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qpushbutton.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qsizepolicy.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qslider.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qspinbox.h
- mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtabwidget.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgets-config.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgetsexports.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qtwidgetsglobal.h
mdp:/Users/sotech117/Qt/6.5.2/macos/lib/QtWidgets.framework/Versions/A/Headers/qwidget.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/illuminate/illuminate.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/main.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/intersect/intersect.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/illuminate/reflect.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracescene.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/mainwindow.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/settings.h
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/illuminate/shadow.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/sceneparser.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/settings.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/kdtree.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/raytracer/raytracer.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/raytracerutils.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/texture/texture.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/intersect/normals.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/transform4d.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/vec4ops/rotations4d.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/aliasing/filter.cpp
-/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/scenefilereader.cpp
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/kdtree.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/utils/rgba.h
+/Users/sotech117/Documents/master/graphics/the-all-americans-in-cs1230/src/accelerate/myqtconcurrent.cpp
diff --git a/cmake-build-release/Testing/Temporary/LastTest.log b/cmake-build-release/Testing/Temporary/LastTest.log
index 6b7e648..a362618 100644
--- a/cmake-build-release/Testing/Temporary/LastTest.log
+++ b/cmake-build-release/Testing/Temporary/LastTest.log
@@ -1,3 +1,3 @@
-Start testing: Dec 13 01:35 EST
+Start testing: Dec 13 01:58 EST
----------------------------------------------------------
-End testing: Dec 13 01:35 EST
+End testing: Dec 13 01:58 EST
diff --git a/cmake-build-release/projects_ray b/cmake-build-release/projects_ray
index bbcd585..6df9ecc 100755
--- a/cmake-build-release/projects_ray
+++ b/cmake-build-release/projects_ray
Binary files differ
diff --git a/scenefiles-4d/unit_sphere.json b/scenefiles-4d/unit_sphere.json
index 5099526..0c5901f 100644
--- a/scenefiles-4d/unit_sphere.json
+++ b/scenefiles-4d/unit_sphere.json
@@ -21,7 +21,7 @@
{
"type": "directional",
"color": [1.0, 1.0, 1.0],
- "direction": [-3.0, -2.0, -1.0, -2.0]
+ "direction": [0.0, -1.0, 0.0, 0.0]
}
]
},
diff --git a/src/illuminate/illuminate.cpp b/src/illuminate/illuminate.cpp
index 39ecccb..641f06d 100644
--- a/src/illuminate/illuminate.cpp
+++ b/src/illuminate/illuminate.cpp
@@ -1,50 +1,7 @@
#include <iostream>
#include "raytracer/raytracer.h"
-glm::vec4 RayTracer::illuminationFromPointLight(
- const SceneLightData &light,
- glm::vec4 intersectionWorld,
- glm::vec4 normalWorld,
- glm::vec4 directionToCamera,
- const RenderShapeData &shape,
- const RayTraceScene &scene
- )
-{
- auto directionFromIntersectionToLight = light.pos - intersectionWorld;
- directionFromIntersectionToLight = glm::normalize(directionFromIntersectionToLight);
-
- // check if this light is blocked by an object
- auto distanceToLight = glm::distance(light.pos, intersectionWorld);
- bool isShadow = RayTracer::isShadowed(
- light.pos,
- distanceToLight,
- glm::vec4(directionFromIntersectionToLight),
- glm::vec4(intersectionWorld),
- scene);
- if (isShadow)
- {
- // if this is a shadow, then no light contribution
- return glm::vec4(0.f);
- }
-
- // calculate attenuation
- float c1 = light.function.x;
- float c2 = light.function.y;
- float c3 = light.function.z;
- float attenuation = std::min(1.f, 1.f / (c1 + distanceToLight * c2 + (distanceToLight * distanceToLight) * c3));
-
- return phong(
- light.color,
- attenuation,
- directionFromIntersectionToLight,
- directionToCamera,
- intersectionWorld,
- normalWorld,
- shape,
- scene);
-}
-
-glm::vec4 RayTracer::illuminationFromSpotLight(
+glm::vec4 RayTracer::illuminationFromDirectionalLight(
const SceneLightData &light,
glm::vec4 intersectionWorld,
glm::vec4 normalWorld,
@@ -53,108 +10,42 @@ glm::vec4 RayTracer::illuminationFromSpotLight(
const RayTraceScene &scene
)
{
- auto distance = glm::distance(light.pos, intersectionWorld);
+ // define direction and distance of directional light
+ auto directionFromIntersectionToLight = - light.dir;
+ directionFromIntersectionToLight = glm::normalize(directionFromIntersectionToLight);
+ float distanceToLight = FINF; // directional light infinitely far away
- // calculate the angle from the shape to the spot light
- auto directionFromIntersectionToLight = glm::normalize(light.pos - intersectionWorld);
+ float kd = scene.getGlobalData().kd;
+ float ks = scene.getGlobalData().ks;
+ auto material = shape.primitive.material;
- // calculate intensity, based on angle. apply falloff if necessary
- auto lightDirection = glm::normalize(light.dir);
- // invert the direction of the intersection to light for dot product to work correctly
- auto cosTheta = glm::dot(-directionFromIntersectionToLight, lightDirection);
- auto theta = glm::acos(cosTheta);
+ glm::vec4 illumination(0, 0, 0, 1.f);
- // determine intensity, based on location on spot cone
- glm::vec4 intensity;
- float inner = light.angle - light.penumbra;
- if (theta <= inner)
- {
- intensity = light.color;
- }
- else if
- (
- theta > inner
- && theta <= light.angle
- )
- {
- // inside the penumbra, need to apply falloff
- float falloff = -2 * std::pow(theta - inner, 3) / std::pow(light.penumbra, 3) +
- 3 * std::pow(theta - inner, 2) / std::pow(light.penumbra, 2);
- intensity = light.color * (1 - falloff);
- }
- else // theta > light.angle
- {
- return glm::vec4(0.f);
+ // calculate diffuse term
+ auto dotDiffuse = glm::dot(normalWorld, directionFromIntersectionToLight);
+ if (dotDiffuse < 0) {
+ return illumination;
}
+ // add the diffuse
+ auto diffuse = (kd * material.cDiffuse);
+ illumination += light.color * dotDiffuse * diffuse;
- // if the light is within the cone, see if it's a shadow
- auto distanceToLight = glm::distance(light.pos, intersectionWorld);
- bool isShadow = RayTracer::isShadowed(
- light.pos,
- distanceToLight,
- glm::vec4(directionFromIntersectionToLight),
- glm::vec4(intersectionWorld),
- scene);
- if (isShadow)
- {
- // if this is a shadow, then no light contribution
- return glm::vec4(0.f);
+ // if the obj has no specular, return
+ if (material.cSpecular == glm::vec4(0.f)) {
+ return illumination;
}
- // calculate attenuation
- float c1 = light.function.x;
- float c2 = light.function.y;
- float c3 = light.function.z;
- float attenuation = std::min(1.f, 1.f / (c1 + distance * c2 + (distance * distance) * c3));
+ // get the light reflection vector
+ auto reflectedDirOverNormal = glm::normalize(glm::reflect(directionFromIntersectionToLight, normalWorld));
- return phong(
- intensity,
- attenuation,
- directionFromIntersectionToLight,
- directionToCamera,
- intersectionWorld,
- normalWorld,
- shape,
- scene);
-}
-
-glm::vec4 RayTracer::illuminationFromDirectionalLight(
- const SceneLightData &light,
- glm::vec4 intersectionWorld,
- glm::vec4 normalWorld,
- glm::vec4 directionToCamera,
- const RenderShapeData &shape,
- const RayTraceScene &scene
-)
-{
- // define direction and distance of directional light
- auto directionFromIntersectionToLight = - light.dir;
- directionFromIntersectionToLight = glm::normalize(directionFromIntersectionToLight);
- float distanceToLight = FINF; // directional light infinitely far away
-
- // check if an object blocks ours
- bool isShadow = RayTracer::isShadowed(
- light.pos,
- distanceToLight,
- directionFromIntersectionToLight,
- glm::vec4(intersectionWorld),
- scene);
- if (isShadow)
- {
- // if this is a shadow, then no light contribution
- return glm::vec4(0.f);
+ // calculate specular term
+ auto dotSpecular = glm::dot(reflectedDirOverNormal, -directionToCamera);
+ if (dotSpecular > 0) {
+ auto toPow = std::pow(dotSpecular, material.shininess);
+ illumination += light.color * toPow * (ks * material.cSpecular);
}
- float attenuation = 1.f; // directional lights don't attenuate
- return phong(
- light.color,
- attenuation,
- directionFromIntersectionToLight,
- directionToCamera,
- intersectionWorld,
- normalWorld,
- shape,
- scene);
+ return illumination;
}
@@ -182,125 +73,24 @@ glm::vec4 RayTracer::illuminatePixel(
for (const SceneLightData &light : scene.getLights()) {
switch (light.type) {
case LightType::LIGHT_POINT:
- illumination +=
- illuminationFromPointLight(light, intersectionWorld, normalWorld, directionToCamera, shape, scene);
continue;
case LightType::LIGHT_DIRECTIONAL:
illumination +=
illuminationFromDirectionalLight(light, intersectionWorld, normalWorld, directionToCamera, shape, scene);
continue;
case LightType::LIGHT_SPOT:
- illumination +=
- illuminationFromSpotLight(light, intersectionWorld, normalWorld, directionToCamera, shape, scene);
continue;
case LightType::LIGHT_AREA:
- illumination +=
- illuminationFromAreaLight(light, intersectionWorld, normalWorld, directionToCamera, shape, scene);
continue;
default:
continue;
}
}
- auto incidentDir = -directionToCamera;
+ // auto incidentDir = -directionToCamera;
// recursive raytracing for the reflection and refraction (see reflect.cpp)
- illumination += refract(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1);
- illumination += reflect(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1);
+ // illumination += refract(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1);
+ // illumination += reflect(intersectionWorld, normalWorld, incidentDir, shape, scene, depth + 1);
return illumination;
-}
-
-// helper function to handle the diffuse and specular terms
-// also handles the texture within that diffuse term
-glm::vec4 RayTracer::phong(
- glm::vec4 lightColor,
- float attenuation,
- glm::vec4 directionFromIntersectionToLight,
- glm::vec4 directionToCamera,
- glm::vec4 intersectionWorld,
- glm::vec4 normalWorld,
- const RenderShapeData &shape,
- const RayTraceScene &scene)
-{
- float kd = scene.getGlobalData().kd;
- float ks = scene.getGlobalData().ks;
- auto material = shape.primitive.material;
-
- glm::vec4 illumination(0.f);
-
- // calculate diffuse term
- auto dotDiffuse = glm::dot(normalWorld, directionFromIntersectionToLight);
- if (dotDiffuse > 0) // ensure not facing away
- {
- auto diffuse = (kd * material.cDiffuse);
- // commenting out texture stuff bc 4d textures??????
-// if (material.textureMap.isUsed)
-// {
-// glm::vec4 pObject = shape.inverseCTM * glm::vec4(intersectionWorld, 1.f);
-// diffuse = interpolateTexture(pObject, shape, diffuse);
-// }
- illumination += (attenuation * lightColor) * dotDiffuse * diffuse;
- }
-
- // add specular term
- auto reflectedDirOverNormal =
- 2 * glm::dot(directionFromIntersectionToLight, normalWorld) * normalWorld -
- directionFromIntersectionToLight;
- auto dotSpecular = glm::dot(reflectedDirOverNormal, directionToCamera);
- auto toPow = std::pow(dotSpecular, material.shininess);
- if (dotSpecular > 0) {
- illumination += (attenuation * lightColor) * toPow * (ks * material.cSpecular);
- }
-
- return illumination;
-}
-
-// EXTRA CREDIT -> AREA LIGHT
-glm::vec4 RayTracer::illuminationFromAreaLight(
- const SceneLightData &light,
- glm::vec4 intersectionWorld,
- glm::vec4 normalWorld,
- glm::vec4 directionToCamera,
- const RenderShapeData &shape,
- const RayTraceScene &scene
-) {
- // select a random point within the light's height and width
- float width = light.width;
- float height = light.height;
- float x = ((float) rand() / (float) RAND_MAX) * width - width / 2.f;
- float y = ((float) rand() / (float) RAND_MAX) * height - height / 2.f;
- glm::vec4 lightPosition = light.pos + glm::vec4(x, y, 0.f, 0.f);
-
- auto directionFromIntersectionToLight = lightPosition - intersectionWorld;
- directionFromIntersectionToLight = glm::normalize(directionFromIntersectionToLight);
-
- // check if this light is blocked by an object
- auto distanceToLight = glm::distance(lightPosition, intersectionWorld);
- bool isShadow = RayTracer::isShadowed(
- lightPosition,
- distanceToLight,
- glm::vec4(directionFromIntersectionToLight),
- glm::vec4(intersectionWorld),
- scene);
- if (isShadow)
- {
- // if this is a shadow, then show a ray to a random point in the light
- return glm::vec4(0.f);
- }
-
- // calculate attenuation
- float c1 = light.function.x;
- float c2 = light.function.y;
- float c3 = light.function.z;
- float attenuation = std::min(1.f, 1.f / (c1 + distanceToLight * c2 + (distanceToLight * distanceToLight) * c3));
-
- return phong(
- light.color,
- attenuation,
- directionFromIntersectionToLight,
- directionToCamera,
- intersectionWorld,
- normalWorld,
- shape,
- scene);
-}
+} \ No newline at end of file