diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a329fd..e31c043 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project("Simple Raytracer" C) -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.3) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug") @@ -14,6 +14,26 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) add_link_options(--coverage) endif() +find_package( Doxygen ) + +if ( DOXYGEN_FOUND ) + set( DOXYGEN_EXCLUDE_PATTERNS + */test/* + */main/* + */external/* ) + + set( DOXYGEN_OUTPUT_DIRECTORY doxygen ) + set( DOXYGEN_EXTRACT_ALL YES ) + set( DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES ) + + doxygen_add_docs( doxygen "${CMAKE_CURRENT_SOURCE_DIR}" ) + +else() + + message( "Doxygen need to be installed to generate the doxygen documentation" ) + +endif() + add_subdirectory(module_math) add_subdirectory(module_datastructures) add_subdirectory(module_shapes) diff --git a/module_shapes/cone.h b/module_shapes/cone.h index f3f9d97..ac3ddca 100644 --- a/module_shapes/cone.h +++ b/module_shapes/cone.h @@ -3,6 +3,9 @@ #include "cylinder.h" +/** + * \extends CYLINDER_Cylinder + */ typedef CYLINDER_Cylinder CONE_Cone; const SHAPE_vtable CONE_vtable; diff --git a/module_shapes/cube.h b/module_shapes/cube.h index 8eeeb2f..729aec7 100644 --- a/module_shapes/cube.h +++ b/module_shapes/cube.h @@ -4,6 +4,9 @@ #include "ray.h" #include "shape.h" +/** + * \extends SHAPE_Shape + */ typedef SHAPE_Shape CUBE_Cube; const SHAPE_vtable CUBE_vtable; diff --git a/module_shapes/cylinder.h b/module_shapes/cylinder.h index c9d7d84..917f114 100644 --- a/module_shapes/cylinder.h +++ b/module_shapes/cylinder.h @@ -4,6 +4,10 @@ #include "ray.h" #include "shape.h" + +/** + * \extends SHAPE_Shape + */ typedef struct CYLINDER_Cylinder { SHAPE_Shape shape; double minimum, maximum; diff --git a/module_shapes/group.c b/module_shapes/group.c index e9a110f..e886519 100644 --- a/module_shapes/group.c +++ b/module_shapes/group.c @@ -23,7 +23,7 @@ void GROUP_init(GROUP_Group* group) { group->list = ARRLIST_new(); } -void delete_subshape(void* void_shape, void* context) { +static void delete_subshape(void* void_shape, void* context) { assert(void_shape); UNUSED(context); SHAPE_Shape* shape = (SHAPE_Shape*) void_shape; @@ -65,7 +65,7 @@ typedef struct check_shape_context { RAY_Intersections* intersections; } check_shape_context; -void check_shape(void* void_shape, void* void_context) { +static void check_shape(void* void_shape, void* void_context) { check_shape_context* c = (check_shape_context*) void_context; SHAPE_Shape* shape = (SHAPE_Shape*) void_shape; SHAPE_intersect(c->intersections, shape, c->local_ray); diff --git a/module_shapes/group.h b/module_shapes/group.h index 060adc7..8fe60d3 100644 --- a/module_shapes/group.h +++ b/module_shapes/group.h @@ -18,6 +18,13 @@ void GROUP_destroy(GROUP_Group* group); void GROUP_delete(GROUP_Group* group); void GROUP_delete_shape(SHAPE_Shape* shape); +/** + * \pure This function should never be called...it should be overridden by the members of the group. + * @param local_normal + * @param group + * @param local_point + * @param hit + */ void GROUP_local_normal_at(TUPLES_Vector* local_normal, SHAPE_Shape* group, const TUPLES_Point* local_point, const RAY_Xs* hit); void GROUP_local_intersect(RAY_Intersections* intersections, SHAPE_Shape* group, const RAY_Ray* local_ray); diff --git a/module_shapes/plane.h b/module_shapes/plane.h index 9d7b8a3..7ef3362 100644 --- a/module_shapes/plane.h +++ b/module_shapes/plane.h @@ -4,7 +4,11 @@ #include #include "shape.h" +/** + * \extends SHAPE_Shape + */ typedef SHAPE_Shape PLANE_Plane; + const SHAPE_vtable PLANE_vtable; #define PLANE_new() (PLANE_Plane*)SHAPE_new(&PLANE_vtable) diff --git a/module_shapes/sphere.h b/module_shapes/sphere.h index c04a460..e12b700 100644 --- a/module_shapes/sphere.h +++ b/module_shapes/sphere.h @@ -5,7 +5,11 @@ #include "material.h" #include "shape.h" +/** + * \extends SHAPE_Shape + */ typedef SHAPE_Shape SPHERE_Sphere; + const SHAPE_vtable SPHERE_vtable; #define SPHERE_new() (SPHERE_Sphere*)SHAPE_new(&SPHERE_vtable) diff --git a/module_shapes/testshape.h b/module_shapes/testshape.h index 6d393bb..63a3af5 100644 --- a/module_shapes/testshape.h +++ b/module_shapes/testshape.h @@ -5,6 +5,10 @@ #include "ray.h" const SHAPE_vtable TESTSHAPE_vtable; + +/** + * \extends SHAPE_Shape + */ typedef struct TESTSHAPE_TestShape { SHAPE_Shape parent; /** parent class */ double size; diff --git a/module_shapes/triangle.h b/module_shapes/triangle.h index e1daf99..360d278 100644 --- a/module_shapes/triangle.h +++ b/module_shapes/triangle.h @@ -3,12 +3,18 @@ #include "shape.h" +/** + * \extends SHAPE_Shape + */ typedef struct TRIANGLE_Triangle { SHAPE_Shape shape; /* Superclass */ TUPLES_Point p1, p2, p3; /* Corners of the triangle */ TUPLES_Vector e1, e2, normal; /* Two edges and the normal vector */ } TRIANGLE_Triangle; +/** + * \extends TRIANGLE_Triangle + */ typedef struct TRIANGLE_SmoothTriangle { union { TRIANGLE_Triangle tri;