-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e1d2707
Showing
178 changed files
with
79,409 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pipeline: | ||
build: | ||
image: cguds/cgray-tests | ||
pull: true | ||
commands: | ||
- mkdir build && cd build | ||
- cmake -D CMAKE_BUILD_TYPE=Debug .. | ||
- cmake --build . --target cgray | ||
|
||
test: | ||
image: cguds/cgray-tests | ||
pull: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vs | ||
build_debug/ | ||
build_debug_2/ | ||
build_debug_3/ | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR) | ||
|
||
project(CG1-raytracer) | ||
|
||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited config" FORCE) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
SET(CMAKE_CXX_FLAGS -pthread) | ||
|
||
set(ASSIGNMENT_LIBRARIES) | ||
|
||
find_package(PNG QUIET) | ||
if (PNG_FOUND) | ||
include_directories(${PNG_INCLUDE_DIRS}) | ||
add_definitions(${PNG_DEFINITIONS}) | ||
set(ASSIGNMENT_LIBRARIES ${ASSIGNMENT_LIBRARIES} ${PNG_LIBRARIES}) | ||
elseif(WIN32 AND MSVC) | ||
add_definitions(-DGDIPLUS_SUPPORT) | ||
set(ASSIGNMENT_LIBRARIES ${ASSIGNMENT_LIBRARIES} gdiplus) | ||
else() | ||
find_package(PNG) | ||
message(FATAL_ERROR "libpng-dev is required to build the CG1-raytracer.\nPlease install libpng-dev.") | ||
endif () | ||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
set(ALL_ASSIGNMENT_SOURCES) | ||
|
||
file(GLOB ASSIGNMENT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/assignment-*.cmake") | ||
foreach(f ${ASSIGNMENT_FILES}) | ||
get_filename_component(_fname ${f} NAME_WE) | ||
message(STATUS "Found files of ${_fname}") | ||
include(${f}) | ||
foreach(_s ${ASSIGNMENT_SOURCES}) | ||
message(STATUS " - ${_s}") | ||
endforeach() | ||
list(APPEND ALL_ASSIGNMENT_SOURCES ${ASSIGNMENT_SOURCES}) | ||
endforeach() | ||
|
||
add_executable(cgray ${ALL_ASSIGNMENT_SOURCES} main/main.cpp) | ||
target_link_libraries(cgray ${ASSIGNMENT_LIBRARIES}) | ||
|
||
include(cgray-tests.cmake OPTIONAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
core/color.cpp | ||
core/point.cpp | ||
core/vector.cpp | ||
rt/cameras/orthographic.cpp | ||
rt/cameras/perspective.cpp | ||
rt/ray.cpp | ||
rt/renderer.cpp | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
core/assert.h | ||
core/color.h | ||
core/image.cpp | ||
core/image.h | ||
core/julia.cpp | ||
core/julia.h | ||
core/macros.h | ||
core/point.h | ||
core/scalar.cpp | ||
core/scalar.h | ||
core/vector.h | ||
core/float4.h | ||
rt/cameras/camera.h | ||
rt/cameras/orthographic.h | ||
rt/cameras/perspective.h | ||
rt/ray.h | ||
rt/renderer.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_julia.cpp | ||
main/a_cameras.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
rt/groups/simplegroup.cpp | ||
rt/integrators/casting.cpp | ||
rt/integrators/castingdist.cpp | ||
rt/solids/solid.cpp | ||
rt/solids/aabox.cpp | ||
rt/solids/disc.cpp | ||
rt/solids/infiniteplane.cpp | ||
rt/solids/quad.cpp | ||
rt/solids/sphere.cpp | ||
rt/solids/triangle.cpp | ||
rt/intersection.cpp | ||
rt/bbox.cpp | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
rt/groups/group.h | ||
rt/groups/simplegroup.h | ||
rt/integrators/integrator.h | ||
rt/integrators/casting.h | ||
rt/integrators/castingdist.h | ||
rt/solids/solid.h | ||
rt/solids/aabox.h | ||
rt/solids/disc.h | ||
rt/solids/infiniteplane.h | ||
rt/solids/quad.h | ||
rt/solids/sphere.h | ||
rt/solids/triangle.h | ||
rt/bbox.h | ||
rt/intersection.h | ||
rt/primitive.h | ||
rt/world.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_solids.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
rt/groups/bvh.cpp | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
rt/groups/bvh.h | ||
rt/groups/kdtree.h | ||
rt/loaders/obj.cpp | ||
rt/loaders/obj.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_indexing.cpp | ||
) | ||
|
||
file(COPY | ||
DESTINATION ${CMAKE_BINARY_DIR}/models | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
core/float4.cpp | ||
rt/primmod/instance.cpp | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
core/float4.h | ||
core/matrix.cpp | ||
core/matrix.h | ||
rt/primmod/instance.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_instancing.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
rt/materials/dummy.cpp | ||
rt/lights/directional.cpp | ||
rt/lights/pointlight.cpp | ||
rt/lights/spotlight.cpp | ||
rt/lights/projective.cpp | ||
rt/integrators/raytrace.cpp | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
rt/materials/material.h | ||
rt/materials/dummy.h | ||
rt/lights/light.h | ||
rt/lights/directional.h | ||
rt/lights/pointlight.h | ||
rt/lights/spotlight.h | ||
rt/lights/projective.h | ||
rt/integrators/raytrace.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_lighting.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
rt/materials/lambertian.cpp | ||
rt/materials/lambertian.h | ||
rt/materials/phong.cpp | ||
rt/materials/phong.h | ||
rt/materials/mirror.cpp | ||
rt/materials/mirror.h | ||
rt/materials/combine.cpp | ||
rt/materials/combine.h | ||
rt/integrators/recraytrace.cpp | ||
rt/integrators/recraytrace.h | ||
rt/textures/texture.h | ||
rt/textures/constant.cpp | ||
rt/textures/constant.h | ||
core/interpolate.cpp | ||
core/interpolate-impl.h | ||
core/interpolate.h | ||
rt/coordmappers/coordmapper.h | ||
rt/coordmappers/cylindrical.cpp | ||
rt/coordmappers/cylindrical.h | ||
rt/coordmappers/environment.cpp | ||
rt/coordmappers/environment.h | ||
rt/solids/env.h | ||
rt/solids/env.cpp | ||
rt/coordmappers/plane.cpp | ||
rt/coordmappers/plane.h | ||
rt/coordmappers/spherical.cpp | ||
rt/coordmappers/spherical.h | ||
rt/coordmappers/tmapper.cpp | ||
rt/coordmappers/tmapper.h | ||
rt/coordmappers/world.cpp | ||
rt/coordmappers/world.h | ||
rt/materials/flatmaterial.cpp | ||
rt/materials/flatmaterial.h | ||
rt/materials/cooktorrance.cpp | ||
rt/materials/cooktorrance.h | ||
rt/textures/checkerboard.cpp | ||
rt/textures/checkerboard.h | ||
rt/textures/imagetex.cpp | ||
rt/textures/imagetex.h | ||
rt/textures/perlin.cpp | ||
rt/textures/perlin.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_materials.cpp | ||
main/a_textures.cpp | ||
main/a_local.cpp | ||
main/a_mappers.cpp | ||
) | ||
|
||
file(COPY | ||
models/stones_diffuse.png | ||
DESTINATION ${CMAKE_BINARY_DIR}/models | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
core/random.cpp | ||
core/random.h | ||
rt/materials/fuzzymirror.cpp | ||
rt/materials/fuzzymirror.h | ||
rt/materials/glass.cpp | ||
rt/materials/glass.h | ||
rt/cameras/dofperspective.cpp | ||
rt/cameras/dofperspective.h | ||
rt/lights/arealight.cpp | ||
rt/lights/arealight.h | ||
rt/loaders/objmat.cpp | ||
rt/solids/striangle.cpp | ||
rt/solids/striangle.h | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_distributed.cpp | ||
main/a_smooth.cpp | ||
rt/motionblur.h | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
rt/primmod/bmap.cpp | ||
rt/primmod/bmap.h | ||
rt/volume.h | ||
rt/lights/ambient.h | ||
rt/lights/ambient.cpp | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_bump.cpp | ||
main/a_volume.cpp | ||
) | ||
|
||
file(COPY | ||
models/stones_bump.png | ||
models/stones_spec.png | ||
DESTINATION ${CMAKE_BINARY_DIR}/models | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(MY_ADDITIONAL_SOURCES | ||
# Please add your source files here | ||
) | ||
|
||
set(ASSIGNMENT_SOURCES | ||
${MY_ADDITIONAL_SOURCES} | ||
main/a_competition.cpp | ||
) | ||
|
||
file(COPY | ||
models/stones_bump.png | ||
models/stones_spec.png | ||
models/japanHouse.obj | ||
models/man.obj | ||
models/building.obj | ||
models/buildingadd.obj | ||
DESTINATION ${CMAKE_BINARY_DIR}/models | ||
) | ||
|
||
file(COPY | ||
models/tex/Concrete.png | ||
models/tex/concrete1.png | ||
models/tex/grass.png | ||
models/tex/int_blue.png | ||
models/tex/plastic2.png | ||
models/tex/wood.png | ||
models/tex/wood3.png | ||
DESTINATION ${CMAKE_BINARY_DIR}/models/tex | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef CG1RAYTRACER_ASSERT_HEADER | ||
#define CG1RAYTRACER_ASSERT_HEADER | ||
|
||
#include <iostream> | ||
#include <cstdlib> | ||
#include <exception> | ||
#include <sstream> | ||
|
||
namespace rt { | ||
|
||
class Assert : public std::exception { | ||
public: | ||
Assert() = default; | ||
Assert(const Assert& other) : os(other.os.str()) {} | ||
|
||
template <class T> | ||
Assert& operator<<(const T& msg) { | ||
os << msg; | ||
return *this; | ||
} | ||
|
||
const char* what() const noexcept override { | ||
str = os.str(); // os.str() is temporary | ||
return str.c_str(); | ||
} | ||
private: | ||
mutable std::string str; | ||
std::ostringstream os; | ||
}; | ||
|
||
class NullAssert { | ||
public: | ||
NullAssert() {} | ||
template <class T> | ||
NullAssert& operator<<(const T&) { return *this; } | ||
}; | ||
|
||
} // namespace rt | ||
|
||
#ifndef NDEBUG | ||
#ifndef assert | ||
#define assert(cond) if(!(cond)) throw rt::Assert() << "Assertion failure at " << __FILE__ << ":" << __LINE__ << " -- " << #cond << " -- " | ||
#endif | ||
#ifndef release_assert | ||
#define release_assert(cond) if(!(cond)) throw rt::Assert() << "Fatal error at at " << __FILE__ << ":" << __LINE__ << " -- " << #cond << " -- " | ||
#endif | ||
#else | ||
#ifndef assert | ||
#define assert(cond) rt::NullAssert() | ||
#endif | ||
#ifndef release_assert | ||
#define release_assert(cond) if(!(cond)) throw rt::Assert() << "Fatal error -- " | ||
#endif | ||
#endif | ||
|
||
#define UNREACHABLE do { release_assert(false) << "UNREACHABLE"; } while (false) | ||
#define NOT_IMPLEMENTED do { release_assert(false) << "NOT IMPLEMENTED"; } while (false) | ||
|
||
#endif |
Oops, something went wrong.