C++ coding exercise about Lighting Equations (GLM)

profileasbdefg
CSE386Fall2020.zip

CSE386Fall2020/CSE386Fall2020.sln

Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30225.117 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSE386Fall2020", "CSE386Fall2020\CSE386Fall2020.vcxproj", "{659B8968-8E25-4C19-900A-DAD4857079CF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {659B8968-8E25-4C19-900A-DAD4857079CF}.Debug|x64.ActiveCfg = Debug|x64 {659B8968-8E25-4C19-900A-DAD4857079CF}.Debug|x64.Build.0 = Debug|x64 {659B8968-8E25-4C19-900A-DAD4857079CF}.Debug|x86.ActiveCfg = Debug|Win32 {659B8968-8E25-4C19-900A-DAD4857079CF}.Debug|x86.Build.0 = Debug|Win32 {659B8968-8E25-4C19-900A-DAD4857079CF}.Release|x64.ActiveCfg = Release|x64 {659B8968-8E25-4C19-900A-DAD4857079CF}.Release|x64.Build.0 = Release|x64 {659B8968-8E25-4C19-900A-DAD4857079CF}.Release|x86.ActiveCfg = Release|Win32 {659B8968-8E25-4C19-900A-DAD4857079CF}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {40C8B49A-C5B1-4406-9E9E-7C55C48DFA6A} EndGlobalSection EndGlobal

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.pbxproj

// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 5175876724B41A28002E29F2 /* IScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175873224B41A22002E29F2 /* IScene.cpp */; }; 5175876924B41A28002E29F2 /* FragmentOps.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175873724B41A22002E29F2 /* FragmentOps.cpp */; }; 5175876C24B41A28002E29F2 /* FrameBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175873B24B41A23002E29F2 /* FrameBuffer.cpp */; }; 5175876D24B41A28002E29F2 /* Light.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175873E24B41A23002E29F2 /* Light.cpp */; }; 5175877324B41A28002E29F2 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175874924B41A24002E29F2 /* Image.cpp */; }; 5175877424B41A28002E29F2 /* Rasterization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175874B24B41A24002E29F2 /* Rasterization.cpp */; }; 5175877924B41A28002E29F2 /* ColorAndMaterials.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175875224B41A25002E29F2 /* ColorAndMaterials.cpp */; }; 5175877A24B41A28002E29F2 /* RayTracer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175875424B41A26002E29F2 /* RayTracer.cpp */; }; 5175877E24B41A28002E29F2 /* Camera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175875824B41A26002E29F2 /* Camera.cpp */; }; 5175877F24B41A28002E29F2 /* Utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175875A24B41A26002E29F2 /* Utilities.cpp */; }; 5175878524B41A28002E29F2 /* IShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175876224B41A27002E29F2 /* IShape.cpp */; }; 5175878824B41A28002E29F2 /* Defs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175876524B41A27002E29F2 /* Defs.cpp */; }; 5175878924B41A28002E29F2 /* VertextData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5175876624B41A28002E29F2 /* VertextData.cpp */; }; 5175878C24B428FA002E29F2 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5175878B24B428FA002E29F2 /* OpenGL.framework */; }; 519E9E2424C5F9DF00490B62 /* ExerciseBasicGraphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 519E9E2324C5F9DF00490B62 /* ExerciseBasicGraphics.cpp */; }; 51BB743724BF706100DEBF4A /* usflag.ppm in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5175874424B41A23002E29F2 /* usflag.ppm */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 51AECD9624B4142F00BC4B16 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 12; dstPath = usr/share/man/man1; dstSubfolderSpec = 16; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 51BB743624BF701F00DEBF4A /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 16; files = ( 51BB743724BF706100DEBF4A /* usflag.ppm in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 510C3E1924C36A22006FF0C1 /* VertexData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VertexData.h; sourceTree = "<group>"; }; 5175873224B41A22002E29F2 /* IScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IScene.cpp; sourceTree = "<group>"; }; 5175873324B41A22002E29F2 /* IShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IShape.h; sourceTree = "<group>"; }; 5175873424B41A22002E29F2 /* RayTracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RayTracer.h; sourceTree = "<group>"; }; 5175873524B41A22002E29F2 /* ColorAndMaterials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorAndMaterials.h; sourceTree = "<group>"; }; 5175873724B41A22002E29F2 /* FragmentOps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FragmentOps.cpp; sourceTree = "<group>"; }; 5175873924B41A22002E29F2 /* Rasterization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rasterization.h; sourceTree = "<group>"; }; 5175873B24B41A23002E29F2 /* FrameBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameBuffer.cpp; sourceTree = "<group>"; }; 5175873C24B41A23002E29F2 /* FrameBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameBuffer.h; sourceTree = "<group>"; }; 5175873E24B41A23002E29F2 /* Light.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Light.cpp; sourceTree = "<group>"; }; 5175873F24B41A23002E29F2 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; }; 5175874024B41A23002E29F2 /* Light.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Light.h; sourceTree = "<group>"; }; 5175874224B41A23002E29F2 /* HitRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitRecord.h; sourceTree = "<group>"; }; 5175874424B41A23002E29F2 /* usflag.ppm */ = {isa = PBXFileReference; lastKnownFileType = file; path = usflag.ppm; sourceTree = "<group>"; }; 5175874624B41A24002E29F2 /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utilities.h; sourceTree = "<group>"; }; 5175874924B41A24002E29F2 /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Image.cpp; sourceTree = "<group>"; }; 5175874A24B41A24002E29F2 /* Camera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Camera.h; sourceTree = "<group>"; }; 5175874B24B41A24002E29F2 /* Rasterization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Rasterization.cpp; sourceTree = "<group>"; }; 5175874D24B41A24002E29F2 /* IScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IScene.h; sourceTree = "<group>"; }; 5175875124B41A25002E29F2 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; }; 5175875224B41A25002E29F2 /* ColorAndMaterials.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorAndMaterials.cpp; sourceTree = "<group>"; }; 5175875424B41A26002E29F2 /* RayTracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RayTracer.cpp; sourceTree = "<group>"; }; 5175875824B41A26002E29F2 /* Camera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Camera.cpp; sourceTree = "<group>"; }; 5175875924B41A26002E29F2 /* Defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Defs.h; sourceTree = "<group>"; }; 5175875A24B41A26002E29F2 /* Utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utilities.cpp; sourceTree = "<group>"; }; 5175876124B41A27002E29F2 /* FragmentOps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FragmentOps.h; sourceTree = "<group>"; }; 5175876224B41A27002E29F2 /* IShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IShape.cpp; sourceTree = "<group>"; }; 5175876524B41A27002E29F2 /* Defs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Defs.cpp; sourceTree = "<group>"; }; 5175876624B41A28002E29F2 /* VertextData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VertextData.cpp; sourceTree = "<group>"; }; 5175878B24B428FA002E29F2 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; 519E9E2324C5F9DF00490B62 /* ExerciseBasicGraphics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExerciseBasicGraphics.cpp; sourceTree = "<group>"; }; 51AECD9824B4142F00BC4B16 /* CSE386Fall2020 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CSE386Fall2020; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 51AECD9524B4142F00BC4B16 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 5175878C24B428FA002E29F2 /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 5175878A24B428FA002E29F2 /* Frameworks */ = { isa = PBXGroup; children = ( 5175878B24B428FA002E29F2 /* OpenGL.framework */, ); name = Frameworks; sourceTree = "<group>"; }; 51AECD8F24B4142F00BC4B16 = { isa = PBXGroup; children = ( 51AECD9A24B4142F00BC4B16 /* CSE386Fall2020 */, 51AECD9924B4142F00BC4B16 /* Products */, 5175878A24B428FA002E29F2 /* Frameworks */, ); sourceTree = "<group>"; }; 51AECD9924B4142F00BC4B16 /* Products */ = { isa = PBXGroup; children = ( 51AECD9824B4142F00BC4B16 /* CSE386Fall2020 */, ); name = Products; sourceTree = "<group>"; }; 51AECD9A24B4142F00BC4B16 /* CSE386Fall2020 */ = { isa = PBXGroup; children = ( 519E9E2324C5F9DF00490B62 /* ExerciseBasicGraphics.cpp */, 5175875824B41A26002E29F2 /* Camera.cpp */, 5175874A24B41A24002E29F2 /* Camera.h */, 5175875224B41A25002E29F2 /* ColorAndMaterials.cpp */, 5175873524B41A22002E29F2 /* ColorAndMaterials.h */, 5175876524B41A27002E29F2 /* Defs.cpp */, 5175875924B41A26002E29F2 /* Defs.h */, 5175875124B41A25002E29F2 /* Doxyfile */, 5175873724B41A22002E29F2 /* FragmentOps.cpp */, 5175876124B41A27002E29F2 /* FragmentOps.h */, 5175873B24B41A23002E29F2 /* FrameBuffer.cpp */, 5175873C24B41A23002E29F2 /* FrameBuffer.h */, 5175874224B41A23002E29F2 /* HitRecord.h */, 5175874924B41A24002E29F2 /* Image.cpp */, 5175873F24B41A23002E29F2 /* Image.h */, 5175873224B41A22002E29F2 /* IScene.cpp */, 5175874D24B41A24002E29F2 /* IScene.h */, 5175876224B41A27002E29F2 /* IShape.cpp */, 5175873324B41A22002E29F2 /* IShape.h */, 5175873E24B41A23002E29F2 /* Light.cpp */, 5175874024B41A23002E29F2 /* Light.h */, 5175874B24B41A24002E29F2 /* Rasterization.cpp */, 5175873924B41A22002E29F2 /* Rasterization.h */, 5175875424B41A26002E29F2 /* RayTracer.cpp */, 5175873424B41A22002E29F2 /* RayTracer.h */, 5175874424B41A23002E29F2 /* usflag.ppm */, 5175875A24B41A26002E29F2 /* Utilities.cpp */, 5175874624B41A24002E29F2 /* Utilities.h */, 510C3E1924C36A22006FF0C1 /* VertexData.h */, 5175876624B41A28002E29F2 /* VertextData.cpp */, ); path = CSE386Fall2020; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 51AECD9724B4142F00BC4B16 /* CSE386Fall2020 */ = { isa = PBXNativeTarget; buildConfigurationList = 51AECD9F24B4142F00BC4B16 /* Build configuration list for PBXNativeTarget "CSE386Fall2020" */; buildPhases = ( 51AECD9424B4142F00BC4B16 /* Sources */, 51AECD9524B4142F00BC4B16 /* Frameworks */, 51AECD9624B4142F00BC4B16 /* CopyFiles */, 51BB743624BF701F00DEBF4A /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = CSE386Fall2020; productName = CSE386Fall2020; productReference = 51AECD9824B4142F00BC4B16 /* CSE386Fall2020 */; productType = "com.apple.product-type.tool"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 51AECD9024B4142F00BC4B16 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1160; ORGANIZATIONNAME = MAZ; TargetAttributes = { 51AECD9724B4142F00BC4B16 = { CreatedOnToolsVersion = 11.5; }; }; }; buildConfigurationList = 51AECD9324B4142F00BC4B16 /* Build configuration list for PBXProject "CSE386Fall2020" */; compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 51AECD8F24B4142F00BC4B16; productRefGroup = 51AECD9924B4142F00BC4B16 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 51AECD9724B4142F00BC4B16 /* CSE386Fall2020 */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ 51AECD9424B4142F00BC4B16 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 5175878524B41A28002E29F2 /* IShape.cpp in Sources */, 5175876D24B41A28002E29F2 /* Light.cpp in Sources */, 5175877324B41A28002E29F2 /* Image.cpp in Sources */, 5175877E24B41A28002E29F2 /* Camera.cpp in Sources */, 5175877A24B41A28002E29F2 /* RayTracer.cpp in Sources */, 519E9E2424C5F9DF00490B62 /* ExerciseBasicGraphics.cpp in Sources */, 5175876924B41A28002E29F2 /* FragmentOps.cpp in Sources */, 5175878924B41A28002E29F2 /* VertextData.cpp in Sources */, 5175876C24B41A28002E29F2 /* FrameBuffer.cpp in Sources */, 5175878824B41A28002E29F2 /* Defs.cpp in Sources */, 5175876724B41A28002E29F2 /* IScene.cpp in Sources */, 5175877F24B41A28002E29F2 /* Utilities.cpp in Sources */, 5175877424B41A28002E29F2 /* Rasterization.cpp in Sources */, 5175877924B41A28002E29F2 /* ColorAndMaterials.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 51AECD9D24B4142F00BC4B16 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = NO; LIBRARY_SEARCH_PATHS = /usr/local/Cellar/freeglut/3.2.1/lib/; MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "-lglut"; SDKROOT = macosx; }; name = Debug; }; 51AECD9E24B4142F00BC4B16 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = NO; LIBRARY_SEARCH_PATHS = /usr/local/Cellar/freeglut/3.2.1/lib/; MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; OTHER_LDFLAGS = "-lglut"; SDKROOT = macosx; }; name = Release; }; 51AECDA024B4142F00BC4B16 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; HEADER_SEARCH_PATHS = ( /usr/local/Cellar/glm/0.9.9.8/include/, /usr/local/Cellar/freeglut/3.2.1/include/, ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 51AECDA124B4142F00BC4B16 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; HEADER_SEARCH_PATHS = ( /usr/local/Cellar/glm/0.9.9.8/include/, /usr/local/Cellar/freeglut/3.2.1/include/, ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 51AECD9324B4142F00BC4B16 /* Build configuration list for PBXProject "CSE386Fall2020" */ = { isa = XCConfigurationList; buildConfigurations = ( 51AECD9D24B4142F00BC4B16 /* Debug */, 51AECD9E24B4142F00BC4B16 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 51AECD9F24B4142F00BC4B16 /* Build configuration list for PBXNativeTarget "CSE386Fall2020" */ = { isa = XCConfigurationList; buildConfigurations = ( 51AECDA024B4142F00BC4B16 /* Debug */, 51AECDA124B4142F00BC4B16 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 51AECD9024B4142F00BC4B16 /* Project object */; }

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.xcworkspace/contents.xcworkspacedata

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

IDEDidComputeMac32BitWarning

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

PreviewsEnabled

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.xcworkspace/xcuserdata/zmudam.xcuserdatad/UserInterfaceState.xcuserstate

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.xcworkspace/xcuserdata/zmudam.xcuserdatad/WorkspaceSettings.xcsettings

BuildLocationStyle UseAppPreferences CustomBuildLocationType RelativeToDerivedData DerivedDataLocationStyle Default IssueFilterStyle ShowActiveSchemeOnly LiveSourceIssuesEnabled ShowSharedSchemesAutomaticallyEnabled

CSE386Fall2020/CSE386Fall2020.xcodeproj/project.xcworkspace/xcuserdata/zmudam.xcuserdatad/xcdebugger/Expressions.xcexplist

CSE386Fall2020/CSE386Fall2020.xcodeproj/xcuserdata/zmudam.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

CSE386Fall2020/CSE386Fall2020.xcodeproj/xcuserdata/zmudam.xcuserdatad/xcschemes/xcschememanagement.plist

SchemeUserState CSE386Fall2020.xcscheme_^#shared#^_ orderHint 0

CSE386Fall2020/CSE386Fall2020/Camera.cpp

CSE386Fall2020/CSE386Fall2020/Camera.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "Camera.h"

/**
 *  @fn   RaytracingCamera::RaytracingCamera(const dvec3 &viewingPos, const dvec3 &lookAtPt, const dvec3 &up)
 *  @brief    Constructs a raytracing camera.
 *  @param    viewingPos  Location of camera.
 *  @param    lookAtPt    A focus point in front of the camera..
 *  @param    up          Up vector.
 */

RaytracingCamera :: RaytracingCamera ( const  dvec3  & viewingPos ,   const  dvec3  & lookAtPt ,   const  dvec3  & up )   {
    changeConfiguration ( viewingPos ,  lookAtPt ,  up );
}

/**
 *  @fn   void RaytracingCamera::changeConfiguration(const dvec3 &viewingPos, const dvec3 &lookAtPt, const dvec3 &up)
 *  @brief    Change configuration parameters of this camera.
 *  @param    viewingPos  The new viewing position.
 *  @param    lookAtPt    A new focus point point.
 *  @param    up          Up vector.
 */

void   RaytracingCamera :: changeConfiguration ( const  dvec3  & viewingPos ,   const  dvec3  & lookAtPt ,   const  dvec3  & up )   {
     /* CSE 386 - todo  */
}

/**
 *  @fn   PerspectiveCamera::PerspectiveCamera(const dvec3 &pos, const dvec3 &lookAtPt, const dvec3 &up, double FOVRads)
 *  @brief    Constructs a perspective camera.
 *  @param    pos         The position of the camera.
 *  @param    lookAtPt    A focus point in front of the camera.
 *  @param    up          Up vector.
 *  @param    FOVRads     The field of view in radians.
 */

PerspectiveCamera :: PerspectiveCamera ( const  dvec3  & pos ,   const  dvec3  & lookAtPt ,   const  dvec3  & up ,   double   FOVRads )
     :   RaytracingCamera ( pos ,  lookAtPt ,  up )   {
    distToPlane  =   0 ;
    fov  =   FOVRads ;
}

/**
 *  @fn   OrthographicCamera::OrthographicCamera(const dvec3 &pos, const dvec3 &lookAtPt, const dvec3 &up, double ppwu)
 *  @brief    Constructs an orthographic camera.
 *  @param    pos         Position of camera.
 *  @param    lookAtPt    A focus point in front of the camera.
 *  @param    up          Up vector.
 *  @param    ppwu        Pixels per world unit.
 */

OrthographicCamera :: OrthographicCamera ( const  dvec3  & pos ,   const  dvec3  & lookAtPt ,   const  dvec3  & up ,   double  ppwu )
     :   RaytracingCamera ( pos ,  lookAtPt ,  up )   {
    pixelsPerWorldUnit  =  ppwu ;
}

/**
 *  @fn   dvec2 RaytracingCamera::getProjectionPlaneCoordinates(double x, double y) const
 *  @brief    Gets projection plane coordinates at (x, y).
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @return   Projection plane coordinates.
 */

dvec2  RaytracingCamera :: getProjectionPlaneCoordinates ( double  x ,   double  y )   const   {
     /* CSE 386 - todo  */
    dvec2 s ;
     return  s ;
}

/**
 *  @fn   void PerspectiveCamera::calculateViewingParameters(int W, int H)
 *  @brief    Calculates the viewing parameters associated with this camera.
 *  @param    W   The width of window.
 *  @param    H   The height of window.
 */

void   PerspectiveCamera :: calculateViewingParameters ( int  W ,   int  H )   {
     /* CSE 386 - todo  */
     /* fill in nx, ny, distToPlane, top, bottom, left, and right */
}

/**
 *  @fn   void OrthographicCamera::calculateViewingParameters(int W, int H)
 *  @brief    Calculates the viewing parameters associated with this camera.
 *  @param    W   The width of window.
 *  @param    H   The height of window.
 */

void   OrthographicCamera :: calculateViewingParameters ( int  W ,   int  H )   {
     /* CSE 386 - todo  */
     /* fill in nx, ny, distToPlane, top, bottom, left, and right */
}

/**
 *  @fn   Ray OrthographicCamera::getRay(double x, double y) const
 *  @brief    Determines camera ray going through projection plane at (x, y), in direction -w.
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @return   The ray through the projection plane at (x, y), in direction -w.
 */

Ray   OrthographicCamera :: getRay ( double  x ,   double  y )   const   {
     /* CSE 386 - todo  */
     return   Ray ( dvec3 ( 0 , 0 , 0 ),  dvec3 ( 0 , 0 , 1 ));
}

/**
 *  @fn   Ray PerspectiveCamera::getRay(double x, double y) const
 *  @brief    Determines ray eminating from camera through the projection plane at (x, y).
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @return   The ray eminating from camera through the projection plane at (x, y).
 */

Ray   PerspectiveCamera :: getRay ( double  x ,   double  y )   const   {
    dvec2 uv  =  getProjectionPlaneCoordinates ( x ,  y );
    dvec3 rayDirection  =  glm :: normalize ( - distToPlane  *  cameraFrame . +
                                            uv . *  cameraFrame . +  
                                            uv . *  cameraFrame . v );   // Page 76
     return   Ray ( cameraFrame . origin ,  rayDirection );
}

/**
 *  @fn   void PerspectiveCamera::setFOV(double FOV, int W, int H)
 *  @brief    Sets a camera's field of view.
 *  @param    FOV The field of view.
 *  @param    W   Width of window.
 *  @param    H   Height of window.
 */

void   PerspectiveCamera :: setFOV ( double  FOV ,   int  W ,   int  H )   {
    fov  =  FOV ;
    calculateViewingParameters ( W ,  H );
}

/**
@fn    ostream &operator << (ostream &os, const RaytracingCamera &camera)
@brief     Output stream for cameras.
@param     os      Output stream.
@param     camera  The camera.
*/

ostream  & operator   <<   ( ostream  & os ,   const   RaytracingCamera   & camera )   {
    os  <<   "Camera info:"   <<  endl ;
    os  <<   "Frame"   <<  endl ;
    os  <<  camera . cameraFrame  <<  endl ;
     return  os ;
}

CSE386Fall2020/CSE386Fall2020/Camera.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <iostream> #include "IShape.h" /** * @struct RaytracingCamera * @brief Base class for cameras in raytracing applications. */ struct RaytracingCamera { Frame cameraFrame; //!< The camera's frame double left, right, bottom, top; //!< The camera's vertical field of view double nx, ny; //!< Window size RaytracingCamera(const dvec3 &pos, const dvec3 &lookAtPt, const dvec3 &up); void changeConfiguration(const dvec3 &pos, const dvec3 &lookAtPt, const dvec3 &up); dvec2 getProjectionPlaneCoordinates(double x, double y) const; virtual void calculateViewingParameters(int width, int height) = 0; virtual Ray getRay(double x, double y) const = 0; friend ostream &operator << (ostream &os, const RaytracingCamera &camera); }; /** * @struct PerspectiveCamera * @brief Encapsulates a perspective camera for raytracing applications. */ struct PerspectiveCamera : public RaytracingCamera { double fov; //!< The camera's field of view double distToPlane; //!< Distance to image plane PerspectiveCamera(const dvec3 &pos, const dvec3 &lookAtPt, const dvec3 &up, double FOVRads); virtual void calculateViewingParameters(int width, int height); virtual Ray getRay(double x, double y) const; void setFOV(double FOV, int W, int H); }; /** * @struct OrthographicCamera * @brief Encapsulates a orthographic camera for raytracing applications. */ struct OrthographicCamera : public RaytracingCamera { double pixelsPerWorldUnit; //!< Controls the size of the image plane. OrthographicCamera(const dvec3 &pos, const dvec3 &lookAtPt, const dvec3 &up, double ppwu); virtual void calculateViewingParameters(int width, int height); virtual Ray getRay(double x, double y) const; };

CSE386Fall2020/CSE386Fall2020/ColorAndMaterials.cpp

CSE386Fall2020/CSE386Fall2020/ColorAndMaterials.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "Utilities.h"
#include   "ColorAndMaterials.h"

/**
 *  @fn   Material::Material(const color &amb, const color &diff, const color &spec, double S)
 *  @brief    Construct a Materials based on the basic color and shinieness values.
 *  @param    amb         Ambient
 *  @param    diff        Diffuse
 *  @param    spec        Specular
 *  @param    S           Shinieness
 */

Material :: Material ( const  color  & amb ,  
                     const  color  & diff ,  
                     const  color  & spec ,   double  S )   {
    ambient  =  amb ;
    diffuse  =  diff ;
    specular  =  spec ;
    shininess  =  S ;
    alpha  =   1.0 ;
}

/**
 *  @fn   Material::Material(const vector<double> &C)
 *  @brief    Construct a Materials based on the basic color and shinieness values.
 *  @param    C           Vector holding 10 values: ambient, diffuse, specular, shinieness
 */

Material :: Material ( const  vector < double >   & C )   :
     Material ( color ( C [ 0 ],  C [ 1 ],  C [ 2 ]),
        color ( C [ 3 ],  C [ 4 ],  C [ 5 ]),
        color ( C [ 6 ],  C [ 7 ],  C [ 8 ]),
        C [ 9 ])   {
}

/**
 *  @fn   Material::Material(const color &oneColor)
 *  @brief    Constructs a material that has ambient values only. Diffuse and specular are black.
 *  @param    oneColor    Ambient values
 */

Material :: Material ( const  color  & oneColor )   {
    ambient  =  oneColor ;
    diffuse  =  specular  =  black ;
    shininess  =   0.0 ;
    alpha  =   1.0 ;
}

/**
 *  @fn   Material operator*(double w) const
 *  @brief    Multiply a Material by a scalar value.
 *  @param    w   Weight of multiplication.
 *  @return   The Material resulting from multiplying the given Material by the given weight.
 */

Material   Material :: operator   * ( double  w )   const   {
     Material  result  =   * this ;
    result . alpha  *=  w ;
    result . ambient  *=  w ;
    result . diffuse  *=  w ;
    result . specular  *=  w ;
     return  result ;
}

/**
 *  @fn   Material &Material::operator+=(const Material &mat)
 *  @brief    Add in a second material.
 *  @param    mat The second Material.
 *  @return   The revised Material.
 */

Material   & Material :: operator   += ( const   Material   & mat )   {
     Material  result  =   * this ;
    alpha  +=  mat . alpha ;
    ambient  +=  mat . ambient ;
    diffuse  +=  mat . diffuse ;
    specular  +=  mat . specular ;
     return   * this ;
}

/**
 *  @fn   Material Material::operator+(const Material &mat) const
 *  @brief    Adds two Materials
 *  @param    mat The second Material.
 *  @return   The sum of two Materials.
 */

Material   Material :: operator   + ( const   Material   & mat )   const   {
     Material  result  =   * this ;
    result . alpha  +=  mat . alpha ;
    result . ambient  +=  mat . ambient ;
    result . diffuse  +=  mat . diffuse ;
    result . specular  +=  mat . specular ;
     return  result ;
}

/**
 *  @fn   Material Material::operator-(const Material &mat) const
 *  @brief    Subtracts two materials
 *  @param    mat The second Material.
 *  @return   The subtraction of two Materials.
 */

Material   Material :: operator   - ( const   Material   & mat )   const   {
     Material  result  =   * this ;
    result . alpha  -=  mat . alpha ;
    result . ambient  -=  mat . ambient ;
    result . diffuse  -=  mat . diffuse ;
    result . specular  -=  mat . specular ;
     return  result ;
}

/**
 *  @fn   Material operator*(double w, const Material &mat)
 *  @brief    Multiply a Material and a scalar.
 *  @param    w   The scalar multiplicand
 *  @param    mat Material
 *  @return   The original material multiplied by given weight.
 */

Material   operator   * ( double  w ,   const   Material   & mat )   {
     return  mat  *  w ;
}

ostream  & operator   <<   ( ostream  & os ,   const   Material   & mat )   {
    os  <<   "Material: "   <<  mat . ambient <<   ' '   <<  mat . diffuse  <<
             ' '   <<  mat . specular  <<   ' '   <<  mat . shininess ;
     return  os ;
}  

CSE386Fall2020/CSE386Fall2020/ColorAndMaterials.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <vector> #include "Defs.h" typedef dvec3 color; const color black(0, 0, 0); const color red(1, 0, 0); const color green(0, 1, 0); const color blue(0, 0, 1); const color magenta(1, 0, 1); const color yellow(1, 1, 0); const color cyan(0, 1, 1); const color white(1, 1, 1); const color gray(0.5, 0.5, 0.5); const color lightGray(0.8, 0.8, 0.8); const color darkGray(0.3, 0.3, 0.3); /** * @struct Material * @brief Represents all the material information. */ struct Material { color ambient; //!< ambient material property color diffuse; //!< diffuse material property color specular; //!< specular material property double shininess; //!< shininess material property double alpha; //!< alpha value of object. 1 if opaque. Material() : Material(black, black, black, 0.0) { } Material(const color &amb, const color &diff, const color &spec, double shininess); Material(const vector<double> &C); Material(const color &oneColor); friend Material operator *(double w, const Material &mat); Material operator *(double w) const; Material &operator +=(const Material &mat); Material operator +(const Material &mat) const; Material operator -(const Material &mat) const; }; // http://www.it.hiof.no/~borres/j3d/explain/light/p-materials.html const Material brass(vector<double>{0.329412, 0.223529, 0.027451, 0.780392, 0.568627, 0.113725, 0.992157, 0.941176, 0.807843, 27.8974}); const Material bronze(vector<double>{0.2125, 0.1275, 0.054, 0.714, 0.4284, 0.18144, 0.393548, 0.271906, 0.166721, 25.6}); const Material polishedBronze(vector<double>{0.25, 0.148, 0.06475, 0.4, 0.2368, 0.1036, 0.774597, 0.458561, 0.200621, 76.8}); const Material chrome(vector<double>{0.25, 0.25, 0.25, 0.4, 0.4, 0.4, 0.774597, 0.774597, 0.774597, 76.8}); const Material copper(vector<double>{0.19125, 0.0735, 0.0225, 0.7038, 0.27048, 0.0828, 0.256777, 0.137622, 0.086014, 12.8}); const Material polishedCopper(vector<double>{0.2295, 0.08825, 0.0275, 0.5508, 0.2118, 0.066, 0.580594, 0.223257, 0.0695701, 51.2}); const Material gold(vector<double>{0.24725, 0.1995, 0.0745, 0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 51.2}); const Material polishedGold(vector<double>{0.24725, 0.2245, 0.0645, 0.34615, 0.3143, 0.0903, 0.797357, 0.723991, 0.208006, 83.2}); const Material tin(vector<double>{0.105882, 0.058824, 0.113725, 0.427451, 0.470588, 0.541176, 0.333333, 0.333333, 0.521569, 9.84615}); const Material silver(vector<double>{0.19225, 0.19225, 0.19225, 0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 51.2}); const Material polishedSilver(vector<double>{0.23125, 0.23125, 0.23125, 0.2775, 0.2775, 0.2775, 0.773911, 0.773911, 0.773911, 89.6}); const Material blackPlastic(vector<double>{0.0, 0.0, 0.0, 0.01, 0.01, 0.01, 0.50, 0.50, 0.50, 32.0}); const Material cyanPlastic(vector<double>{0.0, 0.1, 0.06, 0.0, 0.50980392, 0.50980392, 0.50196078, 0.50196078, 0.50196078, 32.0}); const Material greenPlastic(vector<double>{0.0, 0.0, 0.0, 0.1, 0.35, 0.1, 0.45, 0.55, 0.45, 32.0}); const Material redPlastic(vector<double>{0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.7, 0.6, 0.6, 32.0}); const Material whitePlastic(vector<double>{0.0, 0.0, 0.0, 0.55, 0.55, 0.55, 0.70, 0.70, 0.70, 32.0}); const Material yellowPlastic(vector<double>{0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.60, 0.60, 0.50, 32.0}); const Material blackRubber(vector<double>{0.02, 0.02, 0.02, 0.01, 0.01, 0.01, 0.4, 0.4, 0.4, 10.0}); const Material cyanRubber(vector<double>{0.0, 0.05, 0.05, 0.4, 0.5, 0.5, 0.04, 0.7, 0.7, 10.0}); const Material greenRubber(vector<double>{0.0, 0.05, 0.0, 0.4, 0.5, 0.4, 0.04, 0.7, 0.04, 10.0}); const Material redRubber(vector<double>{0.05, 0.0, 0.0, 0.5, 0.4, 0.4, 0.7, 0.04, 0.04, 10.0}); const Material whiteRubber(vector<double>{0.05, 0.05, 0.05, 0.5, 0.5, 0.5, 0.7, 0.7, 0.7, 10.0}); const Material yellowRubber(vector<double>{0.05, 0.05, 0.0, 0.5, 0.5, 0.4, 0.7, 0.7, 0.04, 10.0}); const Material pewter(vector<double>{0.105882, 0.058824, 0.113725, 0.427451, 0.470588, 0.541176, 0.333333, 0.333333, 0.521569, 9.846150}); // Translucent materials - this code base does not support material alpha values const Material emerald(vector<double>{0.0215, 0.1745, 0.0215, 0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 76.8}); const Material jade(vector<double>{0.135, 0.2225, 0.1575, 0.54, 0.89, 0.63, 0.316228, 0.316228, 0.316228, 12.8}); const Material obsidian(vector<double>{0.05375, 0.05, 0.06625, 0.18275, 0.17, 0.22525, 0.332741, 0.328634, 0.346435, 38.4}); const Material perl(vector<double>{0.25, 0.20725, 0.20725, 1.0, 0.829, 0.829, 0.296648, 0.296648, 0.296648, 11.264}); const Material ruby(vector<double>{0.1745, 0.01175, 0.01175, 0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 76.8}); const Material turquoise(vector<double>{0.1, 0.18725, 0.1745, 0.396, 0.74151, 0.69102, 0.297254, 0.30829, 0.306678, 12.8}); ostream &operator << (ostream &os, const Material &mat);

CSE386Fall2020/CSE386Fall2020/CSE386Fall2020.vcxproj

Debug Win32 Release Win32 Debug x64 Release x64 16.0 Win32Proj {659b8968-8e25-4c19-900a-dad4857079cf} CSE386Fall2020 10.0 Application true v142 Unicode Application false v142 true Unicode Application true v142 Unicode Application false v142 true Unicode true false true false Level3 true WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);WINDOWS true Console true Level3 true true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true Console true true true Level3 true _DEBUG;_CONSOLE;%(PreprocessorDefinitions);WINDOWS true Console true Level3 true true true NDEBUG;_CONSOLE;%(PreprocessorDefinitions);WINDOWS true Console true true true This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.

CSE386Fall2020/CSE386Fall2020/CSE386Fall2020.vcxproj.filters

{4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Resource Files Resource Files

CSE386Fall2020/CSE386Fall2020/CSE386Fall2020.vcxproj.user

CSE386Fall2020/CSE386Fall2020/Defs.cpp

CSE386Fall2020/CSE386Fall2020/Defs.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   < iostream >
#include   "Defs.h"
#include   "Utilities.h"

/**
 *  @fn   Window::Window(int W, int H)
 *  @brief    Constructs window based on specific size values.
 *  @param    W   Width of window.
 *  @param    H   Height of window.
 */

Window :: Window ( int  W ,   int  H )   {
    width  =  W ;
    height  =  H ;
}

/**
 *  @fn   int Window::area() const
 *  @brief    Compute the area of the window
 *  @return   Area of window.
 */

int   Window :: area ()   const   {
     return  width  *  height ;
}

/**
 *  @fn   double Window::aspectRatio() const
 *  @brief    Compute aspect ratio of the window.
 *  @return   A aspect ratio of window - width/height.
 */

double   Window :: aspectRatio ()   const   {
     return  width  /   ( double ) height ;
}

/**
 *  @fn   BoundingBox3D::BoundingBox3D(double left, double right, double bottom, double top, double back, double front)
 *
 *  @brief    Constructor
 *  @param    left    left.
 *  @param    right   right.
 *  @param    bottom  bottom.
 *  @param    top     top.
 *  @param    back    back.
 *  @param    front   front.
 */

BoundingBox3D :: BoundingBox3D ( double  left ,   double  right ,   double  bottom ,   double  top ,   double  back ,   double  front )   {
    lx  =  left ;
    rx  =  right ;
    ly  =  bottom ;
    ry  =  top ;
    lz  =  front ;
    rz  =  back ;
}

/**
 *  @fn   double BoundingBox3D::width() const
 *  @brief    Gets the width - x axis
 *  @return   Width of bounding box.
 */

double   BoundingBox3D :: width ()   const   {
     return  rx  -  lx ;
}

/**
 *  @fn   double BoundingBox3D::height() const
 *  @brief    Gets the height - y axis
 *  @return   Height of bounding box.
 */

double   BoundingBox3D :: height ()   const   {
     return  ry  -  ly ;
}

/**
 *  @fn   double BoundingBox3D::depth() const
 *  @brief    Gets the depth - z axis
 *  @return   Depth of bounding box.
 */

double   BoundingBox3D :: depth ()   const   {
     return  lz  -  rz ;
}

/**
 *  @fn   void Frame::setInverse()
 *  @brief    Sets the inverse based on the current parameters.
 *  @see  Page *** from textbook
 */

void   Frame :: setInverse ()   {
    dmat4 T ;
    T [ 0 ][ 0 ]   =  u [ 0 ];
    T [ 0 ][ 1 ]   =  u [ 1 ];
    T [ 0 ][ 2 ]   =  u [ 2 ];

    T [ 1 ][ 0 ]   =  v [ 0 ];
    T [ 1 ][ 1 ]   =  v [ 1 ];
    T [ 1 ][ 2 ]   =  v [ 2 ];

    T [ 2 ][ 0 ]   =  w [ 0 ];
    T [ 2 ][ 1 ]   =  w [ 1 ];
    T [ 2 ][ 2 ]   =  w [ 2 ];

    T [ 3 ][ 0 ]   =  origin [ 0 ];
    T [ 3 ][ 1 ]   =  origin [ 1 ];
    T [ 3 ][ 2 ]   =  origin [ 2 ];

    inverse  =  glm :: inverse ( T );
}

/**
 *  @fn   dvec3 Frame::toFrameCoords(const dvec3 &pt) const
 *  @brief    Converts a point to a frame coordinates
 *  @param    pt  Point in world coordinates.
 *  @return   The frame coordinates of a point given in woord coordinates.
 */

dvec3  Frame :: toFrameCoords ( const  dvec3  & pt )   const   {
     return   ( inverse  *  dvec4 ( pt . x ,  pt . y ,  pt . z ,   1.0 )). xyz ();
}

/**
@fn    dvec3 Frame::toWorldCoords(const dvec3 &pt) const
@brief     Converts a frame coordinate into the equivalent point in world coordinates
@param     pt  Point in frame coordinates.
@return    The world coordinates of a point given in frame coordinates.
*/

dvec3  Frame :: toWorldCoords ( const  dvec3  & pt )   const   {
     return  origin  +  pt . *  u  +  pt . *  v  +  pt . *  w ;
}

/**
 *  @fn   dvec3 Frame::toFrameVector(const dvec3 &V) const
 *  @brief    Converts a V (in world system) into equivalent frame vector.
 *  @param    V   World vector to process.
 *  @return   Frame vector that expresses the same direction as the original.
 */

dvec3  Frame :: toFrameVector ( const  dvec3  & V )   const   {
    dvec3 A  =  toFrameCoords ( V );
    dvec3 B  =  toFrameCoords ( ORIGIN3D );
     return  A  -  B ;
}

/**
 *  @fn   dvec3 Frame::toWorldVector(const dvec3 &V) const
 *  @brief    Converts a V (in frame system) into equivalent world vector.
 *  @param    V   Frame vector to process.
 *  @return   World vector that expresses the same direction as the original.
 */

dvec3  Frame :: toWorldVector ( const  dvec3  & V )   const   {
    dvec3 vectorHead  =  origin  +  u  *  V . +  v  *  V . +  w  *  V . z ;
    dvec3 vectorTail  =  origin ;
     return  vectorHead  -  vectorTail ;
}

/**
 *  @fn   Frame Frame::createOrthoNormalBasis(const dvec3 &pos, const dvec3 &w, const dvec3 &up)
 *  @brief    Creates ortho normal basis given a position and two non-parallel vectors.
 *  @param    pos The position of the new frame's origin.
 *  @param    w   "z" vector in new frame.
 *  @param    up  up vector in new frame.
 *  @return   The new ortho normal basis.
 */

Frame   Frame :: createOrthoNormalBasis ( const  dvec3  & pos ,   const  dvec3  & w ,   const  dvec3  & up )   {
     /* CSE 386 - todo  */
     Frame  frame ;
     return  frame ;
}

/**
@fn    Frame Frame::createOrthoNormalBasis(const dmat4 &viewingMatrix)
@brief     Creates ortho normal basis given two non-parallel vectors.
@param     viewingMatrix The viewing matrix created by glm::lookAt
@return    The equivalent Frame
*/

Frame   Frame :: createOrthoNormalBasis ( const  dmat4  & viewingMatrix )   {
     /* CSE 386 - todo  */
     return   Frame ();
}

/**
@fn    dmat4 Frame::toViewingMatrix()
@brief     Returns the viewing matrix equivalent to the frame
@return    The equivalent viewing matrix
*/

dmat4  Frame :: toViewingMatrix ()   const   {
     return  glm :: inverse ( dmat4 ( u . x ,  u . y ,  u . z ,   0 ,
                                v . x ,  v . y ,  v . z ,   0 ,
                                w . x ,  w . y ,  w . z ,   0 ,
                                origin . x ,  origin . y ,  origin . z ,   1 ));
}

/**
 *  @fn   Frame::Frame()
 *  @brief    Constructs a new frame equivalent to the world frame.
 */

Frame :: Frame ()   :  origin ( ORIGIN3D ),  u ( ZEROVEC ),  v ( ZEROVEC ),  w ( ZEROVEC )   {
    setInverse ();
}

/**
 *  @fn   Frame::Frame(const dvec3 &O, const dvec3 &U, const dvec3 &V, const dvec3 &W)
 *  @brief    Constructs a new frame given 3 orthonormal vectors (assumed to be orthonormal).
 *  @param    O   Origin of new frame.
 *  @param    U   New "x" vector.
 *  @param    V   New "y" vector.
 *  @param    W   New "z" vector.
 */

Frame :: Frame ( const  dvec3  & O ,   const  dvec3  & U ,   const  dvec3  & V ,   const  dvec3  & W )
     :  origin ( O ),  u ( U ),  v ( V ),  w ( W )   {
    setInverse ();
}

/**
 *  @fn   void Frame::setFrame(const dvec3 &O, const dvec3 &U, const dvec3 &V, const dvec3 &W)
 *  @brief    Sets the frame's axes and origin.
 *  @param    O   Origin of new frame.
 *  @param    U   New "x" vector.
 *  @param    V   New "y" vector.
 *  @param    W   New "z" vector.
 */

void   Frame :: setFrame ( const  dvec3  & O ,   const  dvec3  & U ,   const  dvec3  & V ,   const  dvec3  & W )   {
    origin  =  O ;
    u  =  U ;
    v  =  V ;
    w  =  W ;
    setInverse ();
}

/**
@fn    ostream &operator << (ostream &os, const Frame &frame)
@brief     Output stream operator for Frame object
@param     os  Output stream.
@param     frame   Frame to stream.
*/

ostream  & operator   <<   ( ostream  & os ,   const   Frame   & frame )   {
    os  <<   "Pos: "   <<  frame . origin  <<  endl ;
    os  <<   "U: "   <<  frame . <<  endl ;
    os  <<   "V: "   <<  frame . <<  endl ;
    os  <<   "W: "   <<  frame . <<  endl ;
     return  os ;
}

CSE386Fall2020/CSE386Fall2020/Defs.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <iostream> #include <vector> #include <cmath> #include <memory> #include <limits> // Glut takes care of all the system-specific chores required for creating windows, // initializing OpenGL contexts, and handling input events #include <GL/freeglut.h> #define GLM_FORCE_CTOR_INIT #define GLM_FORCE_SWIZZLE // Enable GLM "swizzle" operators // Basic GLM functionality #include <glm/glm.hpp> #define GLM_ENABLE_EXPERIMENTAL #include <glm/gtx/rotate_vector.hpp> using std::cout; using std::endl; using std::vector; using std::ostream; using std::string; using glm::dvec2; using glm::dvec3; using glm::dvec4; using glm::dmat2; using glm::dmat3; using glm::dmat4; using glm::dmat4x2; using glm::dmat2x4; const std::string username = "username"; const double EPSILON = 1.0E-3; //!< default value used for "SMALL" tolerances. const int TIME_INTERVAL = 100; //!< default time interval used timers. const int WINDOW_WIDTH = 500; //!< default window width. const int WINDOW_HEIGHT = 250; //!< default window height. const unsigned char ESCAPE = 27; //!< escape key. const int SLICES = 8; //!< default value used when slicing up a curved object. const int STACKS = 8; //!< default value used when slicing up a curved object - vertically const double PI = 3.14159265358979323846264338327950288419716939937510582097494; //!< pi const double TWO_PI = 2 * PI; //!< 2pi (360 degrees) const double PI_2 = PI / 2.0; //!< pi/2 (90 degrees) const double PI_3 = PI / 3.0; //!< pi/3 (60 degrees) const double PI_4 = PI / 4.0; //!< pi/4 (45 degrees) const double PI_6 = PI / 6.0; //!< pi/6 (30 degrees) const dvec3 ORIGIN3D(0.0, 0.0, 0.0); //!< (0, 0, 0) const dvec4 ORIGIN3DHOMO(0.0, 0.0, 0.0, 1.0); //!< (0, 0, 0, 1) const dvec2 ORIGIN2D(0.0, 0.0); //!< (0, 0) const dvec3 ORIGIN2DHOMO(0.0, 0.0, 1.0); //!< (0, 0, 1) const dvec3 ZEROVEC(0.0, 0.0, 0.0); //!< <0, 0, 0> const dvec3 X_AXIS(1.0, 0.0, 0.0); //!< <1, 0, 0> const dvec3 Y_AXIS(0.0, 1.0, 0.0); //!< <0, 1, 0> const dvec3 Z_AXIS(0.0, 0.0, 1.0); //!< <0, 0, 1> /** * @struct Window * @brief Represents a positionless rectangle, with a particular dimension */ struct Window { int width; //!< width of window int height; //!< height of window Window(int W, int H); int area() const; double aspectRatio() const; }; /** * @class BoundingBox * @brief A bounding box in 2D. */ template <class T> struct BoundingBox { T lx; //!< lower left corner's x value T ly; //!< lower left corner's y value T rx; //!< upper right corner's x value T ry; //!< upper right corner's y value BoundingBox(T left, T right, T bottom, T top) { lx = left; rx = right; ly = bottom; ry = top; } T width() const { return rx - lx; } T height() const { return ry - ly; } double aspectRatio() const { return (double)width() / height(); } }; typedef BoundingBox<double> BoundingBoxd; typedef BoundingBox<int>BoundingBoxi; /** * @struct BoundingBox3D * @brief Represents a bounding box in 3D. */ struct BoundingBox3D { double lx; //!< lower left x double ly; //!< lower left y double lz; //!< lower left z double rx; //!< upper right x double ry; //!< upper right y double rz; //!< upper right z BoundingBox3D(double left, double right, double bottom, double top, double back, double front); double width() const; double height() const; double depth() const; }; /** * @struct Frame * @brief Represents a coordinate frame */ struct Frame { dvec3 u; //!< frame's "x" axis dvec3 v; //!< frame's "y" axis dvec3 w; //!< frame's "z" axis dvec3 origin; //!< location of frame's origin dmat4 inverse; //!< The inverse of the frame's transformation Frame(); Frame(const dvec3 &O, const dvec3 &U, const dvec3 &V, const dvec3 &W); dvec3 toFrameCoords(const dvec3 &pt) const; dvec3 toWorldCoords(const dvec3 &pt) const; dvec3 toFrameVector(const dvec3 &pt) const; dvec3 toWorldVector(const dvec3 &pt) const; void setFrame(const dvec3 &O, const dvec3 &U, const dvec3 &V, const dvec3 &W); static Frame createOrthoNormalBasis(const dvec3 &pos, const dvec3 &w, const dvec3 &up); static Frame createOrthoNormalBasis(const dmat4 &viewingMatrix); dmat4 toViewingMatrix() const; friend ostream &operator <<(ostream &os, const Frame &frame); protected: void setInverse(); };

CSE386Fall2020/CSE386Fall2020/Doxyfile

# Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv # built into libc) for the transcoding. See # https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = "CSE386Fall2020" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = NO # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode # U+3044. # The default value is: NO. ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, # Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, # C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: # FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: # Fortran. In the later case the parser tries to guess whether the code is fixed # or free formatted code, this is the default for Fortran type files), VHDL. For # instance to make doxygen treat .inc files as Fortran files (default is PHP), # and .f files as C (default is Fortran), use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. # Minimum value: 0, maximum value: 99, default value: 0. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option # is disabled and one has to add nested compounds explicitly via \ingroup. # The default value is: NO. GROUP_NESTED_COMPOUNDS = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = YES # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option # has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO, these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. HIDE_COMPOUND_REFERENCE= NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if <section_label> ... \endif and \cond <section_label> # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete # parameter documentation, but not about the absence of documentation. # The default value is: NO. WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. # The default value is: NO. WARN_AS_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, # *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.idl \ *.ddl \ *.odl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.cs \ *.d \ *.php \ *.php4 \ *.php5 \ *.phtml \ *.inc \ *.m \ *.markdown \ *.md \ *.mm \ *.dox \ *.py \ *.pyw \ *.f90 \ *.f95 \ *.f03 \ *.f08 \ *.f \ *.for \ *.tcl \ *.vhd \ *.vhdl \ *.ucf \ *.qsf # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # <filter> <input-file> # # where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the config file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the # clang parser (see: http://clang.llvm.org/) for more accurate parsing at the # cost of reduced performance. This can be particularly helpful with template # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse-libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories # specified with INPUT and INCLUDE_PATH. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. CLANG_OPTIONS = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the # documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that # are dynamically created via Javascript. If disabled, the navigation index will # consists of multiple levels of tabs that are statically embedded in every HTML # page. Disable this option to support browsers that do not have Javascript, # like the Qt help browser. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_MENUS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: https://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it # enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from https://www.mathjax.org before deployment. # The default value is: http://cdn.mathjax.org/mathjax/latest. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use <access key> + S # (what the <access key> is depends on the OS and browser, but it is typically # <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down # key> to jump into the search results window, the results can be navigated # using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel # the search. The filter options can be selected when the cursor is inside the # search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> # to select a filter and <Enter> or <escape> to activate or cancel the filter # option. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing # and searching needs to be provided by external tools. See the section # "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file # which needs to be processed by an external indexer. Doxygen will invoke an # external search engine pointed to by the SEARCHENGINE_URL option to obtain the # search results. # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the # SEARCHDATA_FILE tag the name of this file can be specified. # The default file is: searchdata.xml. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHDATA_FILE = searchdata.xml # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple # projects and redirect the results back to the right project. # This tag requires that the tag SEARCHENGINE is set to YES. EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are # all added to the same external search index. Each project needs to have a # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of # to a relative location where the documentation can be found. The format is: # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... # This tag requires that the tag SEARCHENGINE is set to YES. EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # # Note that when enabling USE_PDFLATEX this option is only used for generating # bitmaps for formulas in the HTML output, but not in the Makefile that is # written to the output directory. # The default file is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used by the # printer. # Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x # 14 inches) and executive (7.25 x 10.5 inches). # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. The package can be specified just # by its name or with the correct syntax as to be used with the LaTeX # \usepackage command. To get the times font for instance you can specify : # EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} # To use the option intlimits with the amsmath package you can specify: # EXTRA_PACKAGES=[intlimits]{amsmath} # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the # generated LaTeX document. The header should contain everything until the first # chapter. If it is left blank doxygen will generate a standard header. See # section "Doxygen usage" for information on how to let doxygen write the # default header to a separate file. # # Note: Only use a user-defined header if you know what you are doing! The # following commands have a special meaning inside the header: $title, # $datetime, $date, $doxygenversion, $projectname, $projectnumber, # $projectbrief, $projectlogo. Doxygen will replace $title with the empty # string, for the replacement values of the other commands the user is referred # to HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last # chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what # special commands can be used inside the footer. # # Note: Only use a user-defined footer if you know what you are doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = # The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined # LaTeX style sheets that are included after the standard style sheets created # by doxygen. Using this option one can overrule certain style aspects. Doxygen # will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_EXTRA_STYLESHEET = # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the LATEX_OUTPUT output # directory. Note that the files will be copied as-is; there are no commands or # markers available. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_EXTRA_FILES = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will # contain links (just like the HTML output) instead of page references. This # makes the output suitable for online browsing using a PDF viewer. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate # the PDF file directly from the LaTeX files. Set this option to YES, to get a # higher quality PDF documentation. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running # if errors occur, instead of asking the user for help. This option is also used # when generating formulas in HTML. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BATCHMODE = NO # If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the # index chapters (such as File Index, Compound Index, etc.) in the output. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HIDE_INDICES = NO # If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source # code with syntax highlighting in the LaTeX output. # # Note that which sources are shown also depends on other settings such as # SOURCE_BROWSER. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See # https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain # If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated # page will contain the date and time when the page was generated. Setting this # to NO can help when comparing the output of multiple runs. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_TIMESTAMP = NO #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The # RTF output is optimized for Word 97 and may not look too pretty with other RTF # readers/editors. # The default value is: NO. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: rtf. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will # contain hyperlink fields. The RTF file will contain links (just like the HTML # output) instead of page references. This makes the output suitable for online # browsing using Word or some other Word compatible readers that support those # fields. # # Note: WordPad (write) and others do not support links. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's config # file, i.e. a series of assignments. You only have to provide replacements, # missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is # similar to doxygen's config file. A template extensions file can be generated # using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = # If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code # with syntax highlighting in the RTF output. # # Note that which sources are shown also depends on other settings such as # SOURCE_BROWSER. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_SOURCE_CODE = NO #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for # classes and files. # The default value is: NO. GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. A directory man3 will be created inside the directory specified by # MAN_OUTPUT. # The default directory is: man. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to the generated # man pages. In case the manual section does not start with a number, the number # 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is # optional. # The default value is: .3. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_EXTENSION = .3 # The MAN_SUBDIR tag determines the name of the directory created within # MAN_OUTPUT in which the man pages are placed. If defaults to man followed by # MAN_EXTENSION with the initial . removed. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_SUBDIR = # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # will generate one additional man file for each entity documented in the real # man page(s). These additional files only source the real man page, but without # them the man command would be unable to find the correct page. # The default value is: NO. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_LINKS = NO #--------------------------------------------------------------------------- # Configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that # captures the structure of the code including all documentation. # The default value is: NO. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: xml. # This tag requires that the tag GENERATE_XML is set to YES. XML_OUTPUT = xml # If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program # listings (including syntax highlighting and cross-referencing information) to # the XML output. Note that enabling this will significantly increase the size # of the XML output. # The default value is: YES. # This tag requires that the tag GENERATE_XML is set to YES. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- # If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files # that can be used to generate PDF. # The default value is: NO. GENERATE_DOCBOOK = NO # The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in # front of it. # The default directory is: docbook. # This tag requires that the tag GENERATE_DOCBOOK is set to YES. DOCBOOK_OUTPUT = docbook # If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the # program listings (including syntax highlighting and cross-referencing # information) to the DOCBOOK output. Note that enabling this will significantly # increase the size of the DOCBOOK output. # The default value is: NO. # This tag requires that the tag GENERATE_DOCBOOK is set to YES. DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an # AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module # file that captures the structure of the code including all documentation. # # Note that this feature is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI # output from the Perl module output. # The default value is: NO. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely # formatted so it can be parsed by a human reader. This is useful if you want to # understand what is going on. On the other hand, if this tag is set to NO, the # size of the Perl module output will be much smaller and Perl will parse it # just the same. # The default value is: YES. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file are # prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful # so different doxyrules.make files included by the same Makefile don't # overwrite each other's variables. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all # C-preprocessor directives found in the sources and include files. # The default value is: YES. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names # in the source code. If set to NO, only conditional compilation will be # performed. Macro expansion can be done in a controlled way by setting # EXPAND_ONLY_PREDEF to YES. # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and # EXPAND_AS_DEFINED tags. # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will be # used. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that are # defined before the preprocessor is started (similar to the -D option of e.g. # gcc). The argument of the tag is a list of macros of the form: name or # name=definition (no spaces). If the definition and the "=" are omitted, "=1" # is assumed. To prevent a macro definition from being undefined via #undef or # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The # macro definition that is found in the sources will be used. Use the PREDEFINED # tag if you want to use a different macro definition that overrules the # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have # an all uppercase name, and do not end with a semicolon. Such function macros # are typically used for boiler-plate code, and will confuse the parser if not # removed. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration options related to external references #--------------------------------------------------------------------------- # The TAGFILES tag can be used to specify one or more tag files. For each tag # file the location of the external documentation should be added. The format of # a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where loc1 and loc2 can be relative or absolute paths or URLs. See the # section "Linking to external documentation" for more information about the use # of tag files. # Note: Each tag file must have a unique name (where the name does NOT include # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create a # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES, all external class will be listed in # the class index. If set to NO, only the inherited external classes will be # listed. # The default value is: NO. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed # in the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. EXTERNAL_GROUPS = YES # If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # NO turns the diagrams off. Note that this option also works with HAVE_DOT # disabled, but it is recommended to install and use dot, since it yields more # powerful graphs. # The default value is: YES. CLASS_DIAGRAMS = NO # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. # If left empty dia is assumed to be found in the default search path. DIA_PATH = # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of # processors available in the system. You can set it explicitly to a value # larger than 0 to get control over the balance between CPU load and processing # speed. # Minimum value: 0, maximum value: 32, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. DOT_NUM_THREADS = 0 # When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make # sure dot is able to find the font, which can be done by putting it in a # standard location or by setting the DOTFONTPATH environment variable or by # setting DOT_FONTPATH to the directory containing the font. # The default value is: Helvetica. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size (in points) of the font of # dot graphs. # Minimum value: 4, maximum value: 24, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the default font as specified with # DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set # the path where dot can find it using this tag. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for # each documented class showing the direct and indirect inheritance relations. # Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation # dependencies (inheritance, containment, and class references variables) of the # class with other documented classes. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for # groups, showing the direct groups dependencies. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES, doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside the # class node. If there are many fields or methods and many nodes the graph may # become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the # number of items for each type to make the size more manageable. Set this to 0 # for no limit. Note that the threshold may be exceeded by 50% before the limit # is enforced. So when you set the threshold to 10, up to 15 fields may appear, # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. UML_LIMIT_NUM_FIELDS = 10 # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. TEMPLATE_RELATIONS = NO # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the # direct and indirect include dependencies of the file with other documented # files. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. INCLUDE_GRAPH = YES # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other documented # files. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH tag is set to YES then doxygen will generate a call # dependency graph for every global function or class method. # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. Disabling a call graph can be # accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. CALL_GRAPH = YES # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. Disabling a caller graph can be # accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. CALLER_GRAPH = YES # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The # dependency relations are determined by the #include relations between the # files in the directories. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: # http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). # Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, # png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and # png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # # Note that this requires a modern browser other than Internet Explorer. Tested # and working are Firefox, Chrome, Safari, and Opera. # Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make # the SVG files visible. Older versions of IE do not have SVG support. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. INTERACTIVE_SVG = NO # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. DOT_PATH = "C:\Program Files (x86)\Graphviz2.38\bin" # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile # command). # This tag requires that the tag HAVE_DOT is set to YES. DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the \mscfile # command). MSCFILE_DIRS = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile # command). DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the # path where java can find the plantuml.jar file. If left blank, it is assumed # PlantUML is not used or called during a preprocessing step. Doxygen will # generate a warning when it encounters a \startuml command in this case and # will not generate output for the diagram. PLANTUML_JAR_PATH = # When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a # configuration file for plantuml. PLANTUML_CFG_FILE = # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. PLANTUML_INCLUDE_PATH = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes # larger than this value, doxygen will truncate the graph, which is visualized # by representing a node as a red box. Note that doxygen if the number of direct # children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that # the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. # Minimum value: 0, maximum value: 10000, default value: 50. # This tag requires that the tag HAVE_DOT is set to YES. DOT_GRAPH_MAX_NODES = 100 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs # generated by dot. A depth value of 3 means that only nodes reachable from the # root by following a path via at most 3 edges will be shown. Nodes that lay # further from the root node will be omitted. Note that setting this option to 1 # or 2 may greatly reduce the computation time needed for large code bases. Also # note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. # Minimum value: 0, maximum value: 1000, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. MAX_DOT_GRAPH_DEPTH = 4 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not seem # to support this out of the box. # # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support # this, this feature is disabled by default. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot # files that are used to generate the various graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES

CSE386Fall2020/CSE386Fall2020/ExerciseBasicGraphics.cpp

CSE386Fall2020/CSE386Fall2020/ExerciseBasicGraphics.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   < ctime >
#include   < vector >
#include   "Defs.h"
#include   "Utilities.h"
#include   "FrameBuffer.h"
#include   "ColorAndMaterials.h"
#include   "Rasterization.h"

FrameBuffer  frameBuffer ( WINDOW_WIDTH ,  WINDOW_HEIGHT );

void  closed5x5Square ( int  x ,   int  y ,  color C )   {
}

void  closed5x5Square ( const  dvec2  & centerPt ,  color C )   {
}

void  open5x5Square ( const  dvec2  & centerPt ,  color C )   {
}

void  pieChart ( const  dvec2  & centerPt ,   double  radius ,   double  percentage ,   const  color  & C1 ,   const  color  & C2 )   {
}

void  render ()   {
    frameBuffer . clearColorAndDepthBuffers ();

    drawLine ( frameBuffer ,   0 ,   0 ,   100 ,   100 ,  red );
    drawLine ( frameBuffer ,   100 ,   100 ,   200 ,   100 ,  green );

    frameBuffer . showColorBuffer ();
}

void  resize ( int  width ,   int  height )   {
    frameBuffer . setFrameBufferSize ( width ,  height );
    glutPostRedisplay ();
}

void  keyboard ( unsigned   char  key ,   int  x ,   int  y )   {
     switch   ( key )   {
     case  ESCAPE :     glutLeaveMainLoop ();
                     break ;
     }
}

int  main ( int  argc ,   char   * argv [])   {
    graphicsInit ( argc ,  argv ,  __FILE__ );
        
    glutDisplayFunc ( render );
    glutReshapeFunc ( resize );
    glutKeyboardFunc ( keyboard );
    glutMouseFunc ( mouseUtility );

    frameBuffer . setClearColor ( white );

    glutMainLoop ();

     return   0 ;
}

CSE386Fall2020/CSE386Fall2020/FragmentOps.cpp

CSE386Fall2020/CSE386Fall2020/FragmentOps.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "FragmentOps.h"

FogParams   FragmentOps :: fogParams ;
bool   FragmentOps :: performDepthTest  =   true ;
bool   FragmentOps :: readonlyDepthBuffer  =   false ;
bool   FragmentOps :: readonlyColorBuffer  =   false ;

/**
 *  @fn   double FogParams::fogFactor(const dvec3 &fragPos, const dvec3 &eyePos) const
 *  @brief    Computes fog factor - f.
 *  @param    fragPos The fragment position.
 *  @param    eyePos  The eye position.
 *  @return   The fog factor - f.
 */

double   FogParams :: fogFactor ( const  dvec3  & fragPos ,   const  dvec3  & eyePos )   const   {
     /* CSE 386 - todo  */
     return   0.5 ;
}

/**
 *  @fn   color FragmentOps::applyLighting(const Fragment &fragment, const dvec3 &eyePositionInWorldCoords, const vector<LightSourcePtr> &lights, const dmat4 &viewingMatrix)
 *  @brief    Applies the lighting to a fragment
 *  @param    fragment                    The fragment.
 *  @param    eyePositionInWorldCoords    The eye position in world coordinates.
 *  @param    lights                      The vector of lights in the scene.
 *  @param    viewingMatrix               The viewing matrix.
 *
 *  @return   The color of the fragment after applying lighting equations.
 */

color  FragmentOps :: applyLighting ( const   Fragment   & fragment ,   const  dvec3  & eyePositionInWorldCoords ,
                                         const  vector < LightSourcePtr >   & lights ,
                                         const  dmat4  & viewingMatrix )   {
     /* CSE 386 - todo  */
     return  fragment . material . ambient ;
}

/**
 *  @fn   color FragmentOps::applyFog(const color &destColor, const dvec3 &eyePos, const dvec3 &fragPos)
 *  @brief    Applies fog to a fragment.
 *  @param    destColor   Destination color.
 *  @param    eyePos      Eye position.
 *  @param    fragPos     Fragment position.
 *  @return   The color after applying the fog.
 */

color  FragmentOps :: applyFog ( const  color  & destColor ,
                             const  dvec3  & eyePos ,   const  dvec3  & fragPos )   {
     /* CSE 386 - todo  */
     return  destColor ;
}

/**
 *  @fn   color FragmentOps::applyBlending(double alpha, const color &srcColor, const color &destColor)
 *  @brief    Applies blending to a fragment.
 *  @param    alpha       Alpha value.
 *  @param    srcColor    Source color.
 *  @param    destColor   Destination color.
 *  @return   The blended color.
 */

color  FragmentOps :: applyBlending ( double  alpha ,   const  color  & srcColor ,   const  color  & destColor )   {
     /* CSE 386 - todo  */
     return  srcColor ;
}

/**
 *  @fn   void FragmentOps::processFragment(FrameBuffer &frameBuffer, const dvec3 &eyePositionInWorldCoords, const vector<LightSourcePtr> lights, const Fragment &fragment, const dmat4 &viewingMatrix)
 *  @brief    Process the fragment, leaving the results in the framebuffer.
 *  @param  [in,out]  frameBuffer                 The frame buffer
 *  @param            eyePositionInWorldCoords    The eye position in world coordinates.
 *  @param            lights                      Vector of lights in scene.
 *  @param            fragment                    Fragment to be processed.
 *  @param            viewingMatrix               The viewing transformation matrix.
 */

void   FragmentOps :: processFragment ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePositionInWorldCoords ,
                                         const  vector < LightSourcePtr >  lights ,
                                         const   Fragment   & fragment ,
                                         const  dmat4  & viewingMatrix )   {
     const  dvec3  & eyePos  =  eyePositionInWorldCoords ;

     const   double   & =  fragment . windowPos . z ;
     int  X  =   ( int ) fragment . windowPos . x ;
     int  Y  =   ( int ) fragment . windowPos . y ;
    DEBUG_PIXEL  =   ( ==  xDebug  &&  Y  ==  yDebug );
     bool  passDepthTest  =   ! performDepthTest  ||  Z  <  frameBuffer . getDepth ( X ,  Y );
     if   ( passDepthTest )   {
         if   ( DEBUG_PIXEL )   {
            cout  <<  endl ;
         }
         /* CSE 386 - todo: lighting, blending, readonly buffers */
        frameBuffer . setColor ( X ,  Y ,  fragment . material . ambient );
        frameBuffer . setDepth ( X ,  Y ,  Z );
     }
}

CSE386Fall2020/CSE386Fall2020/FragmentOps.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include "FrameBuffer.h" #include "Light.h" /** * @enum fogType * @brief Represents the different types of fog processing. */ enum fogType { NO_FOG, LINEAR_FOG, EXPONENTIAL_FOG, EXPONENTIAL_2_FOG }; /** * @struct FogParams * @brief A fog parameters. */ struct FogParams { double start, end, density; fogType type; color color; double fogFactor(const dvec3 &fragPos, const dvec3 &eyePos) const; }; /** * @struct Fragment * @brief Represents the information relevant to a single fragment. Think * of a fragment as a pixel competing to get into the framebuffer. */ struct Fragment { dvec3 windowPos; Material material; dvec3 worldNormal; dvec3 worldPos; }; /** * @class FragmentOps * @brief Class to encapsulate the methods related to fragment processing. */ class FragmentOps { public: static bool performDepthTest; //!< True ==> use depth buffer. Typically true static bool readonlyDepthBuffer; //!< True ==> rendering will not affect depth buffer. Typically false static bool readonlyColorBuffer; //!< True ==> rendering will not affect color buffer. Typically false static FogParams fogParams; //!< Parameters controlling fog effects. static void processFragment(FrameBuffer &frameBuffer, const dvec3 &eyePositionInWorldCoords, const vector<LightSourcePtr> lights, const Fragment &fragment, const dmat4 &viewingMatrix); protected: static color applyFog(const color &destColor, const dvec3 &eyePos, const dvec3 &fragPos); static color applyBlending(double alpha, const color &src, const color &dest); static color applyLighting(const Fragment &fragment, const dvec3 &eyePositionInWorldCoords, const vector<LightSourcePtr> &lights, const dmat4 &viewingMatrix); };

CSE386Fall2020/CSE386Fall2020/FrameBuffer.cpp

CSE386Fall2020/CSE386Fall2020/FrameBuffer.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "Defs.h"
#include   "Utilities.h"
#include   "FrameBuffer.h"

/**
 *  @fn   FrameBuffer::FrameBuffer(const int width, const int height)
 *  @brief    Constructor
 *  @param    width   The width.
 *  @param    height  The height.
 */

FrameBuffer :: FrameBuffer ( const   int  width ,   const   int  height )   :  window ( width ,  height )   {
    setFrameBufferSize ( width ,  height );
}

/**
 *  @fn   FrameBuffer::~FrameBuffer()
 *  @brief    Destructor
 */

FrameBuffer ::~ FrameBuffer ()   {
     delete []  colorBuffer ;
     delete []  depthBuffer ;
}

/**
 *  @fn   void FrameBuffer::setFrameBufferSize(int width, int height)
 *  @brief    Sets frame buffer size
 *  @param    width   The width.
 *  @param    height  The height.
 *  @see  https://www.opengl.org/archives/resources/features/KilgardTechniques/oglpitfall/
 */

void   FrameBuffer :: setFrameBufferSize ( int  width ,   int  height )   {
    window  =   Window ( width ,  height );

     delete   []  colorBuffer ;
     delete   []  depthBuffer ;

    colorBuffer  =   new   GLubyte [ window . area ()   *  BYTES_PER_PIXEL ];
    depthBuffer  =   new   double [ window . area ()];
}

/**
 *  @fn   void FrameBuffer::setClearColor(const color &clear)
 *  @brief    Sets clear color.
 *  @param    clear   Clear color.
 */

void   FrameBuffer :: setClearColor ( const  color  & clear )   {
    clearColorUB [ 0 ]   =   ( GLubyte )( clear . *   255.0 );
    clearColorUB [ 1 ]   =   ( GLubyte )( clear . *   255.0 );
    clearColorUB [ 2 ]   =   ( GLubyte )( clear . *   255.0 );
    clearColor  =  color ( clearColorUB [ 0 ],  clearColorUB [ 1 ],  clearColorUB [ 2 ]);
}

/**
 *  @fn   void FrameBuffer::clearColorAndDepthBuffers()
 *  @brief    Clears the color and depth buffers
 */

void   FrameBuffer :: clearColorAndDepthBuffers ()   {
     for   ( int  y  =   0 ;  y  <  window . height ;   ++ y )   {
         for   ( int  x  =   0 ;  x  <  window . width ;   ++ x )   {
            std :: memcpy ( colorBuffer  +  BYTES_PER_PIXEL  *   ( +  y  *  window . width ),
                clearColorUB ,  BYTES_PER_PIXEL );
         }
     }
     const   int  SZ  =  window . area ();
    std :: fill ( depthBuffer ,  depthBuffer  +  SZ ,   1.0 );
}

/**
 *  @fn   void FrameBuffer::showColorBuffer() const
 *  @brief    Shows the contents of the color buffer to screen.
 */

void   FrameBuffer :: showColorBuffer ()   const   {
    glRasterPos2d ( - 1 ,   - 1 );
    glDrawPixels ( window . width ,  window . height ,  GL_RGB ,  GL_UNSIGNED_BYTE ,  colorBuffer );
    glFlush ();
}

/**
 *  @fn   void FrameBuffer::setColor(int x, int y, const color &rgb)
 *  @brief    Sets a color at (x, y)
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @param    rgb The new RGB value.
 */

void   FrameBuffer :: setColor ( int  x ,   int  y ,   const  color  & rgb )   {
     if   ( <   0   ||  x  >=  window . width  ||  y  <   0   ||  y  >=  window . height )   {
         return ;
     }

    color clampedColor  =  glm :: clamp ( rgb ,   0.0 ,   1.0 );

     GLubyte  c []   =   {   ( GLubyte )( clampedColor . *   255 ),
                     ( GLubyte )( clampedColor . *   255 ),
                     ( GLubyte )( clampedColor . *   255 )   };

    std :: memcpy ( colorBuffer  +  BYTES_PER_PIXEL  *   ( +  y  *  window . width ),  c ,  BYTES_PER_PIXEL );
}

/**
 *  @fn   color FrameBuffer::getColor(int x, int y) const
 *  @brief    Gets the color at (x, y)
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @return   The color at (x, y)
 */

color  FrameBuffer :: getColor ( int  x ,   int  y )   const   {
     double  red ,  green ,  blue ;

     if   ( checkInWindow ( x ,  y ))   {
         GLubyte  c [ BYTES_PER_PIXEL ];

         // Retrieve color values from the color buffer
        std :: memcpy ( c ,  colorBuffer  +  BYTES_PER_PIXEL  *   ( +  y  *  window . width ),  BYTES_PER_PIXEL );

         // Convert individual color components back to doubleing point values
        red  =  c [ 0 ]   /   255.0 ;
        green  =  c [ 1 ]   /   255.0 ;
        blue  =  c [ 2 ]   /   255.0 ;
     }   else   {
        red  =  clearColorUB [ 0 ]   /   255.0 ;
        green  =  clearColorUB [ 1 ]   /   255.0 ;
        blue  =  clearColorUB [ 2 ]   /   255.0 ;
     }
     return  color ( red ,  green ,  blue );
}

/**
@fn    void FrameBuffer::setDepth(int x, int y, double depth)
@brief     Sets a depth at (x, y)
@param     x       The x coordinate.
@param     y       The y coordinate.
@param     depth   The new depth.
*/

void   FrameBuffer :: setDepth ( double  x ,   double  y ,   double  depth )   {
    setDepth (( int )( x ),   ( int )( y ),  depth );
}

/**
 *  @fn   void FrameBuffer::setDepth(int x, int y, double depth)
 *  @brief    Sets a depth at (x, y)
 *  @param    x       The x coordinate.
 *  @param    y       The y coordinate.
 *  @param    depth   The new depth.
 */

void   FrameBuffer :: setDepth ( int  x ,   int  y ,   double  depth )   {
     if   ( checkInWindow ( x ,  y ))   {
        depthBuffer [ *  window . width  +  x ]   =  depth ;
     }
}

/**
@fn    double FrameBuffer::getDepth(double x, double y) const
@brief     Gets a depth at (x, y)
@param     x   The x coordinate.
@param     y   The y coordinate.
@return    The depth at (x, y).
*/

double   FrameBuffer :: getDepth ( int  x ,   int  y )   const   {
     if   ( checkInWindow ( x ,  y ))   {
         return  depthBuffer [ *  window . width  +  x ];
     }   else   {
         return   0.0 ;
     }
}

/**
 *  @fn   double FrameBuffer::getDepth(double x, double y) const
 *  @brief    Gets a depth at (x, y)
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @return   The depth at (x, y).
 */

double   FrameBuffer :: getDepth ( double  x ,   double  y )   const   {
     return  getDepth (( int )( x ),   ( int )( y ));
}

/**
 *  @fn   bool FrameBuffer::checkInWindow(int x, int y) const
 *  @brief    Returns true iff (x, y) is a valid window coordinate.
 *  @param    x   The x coordinate.
 *  @param    y   The y coordinate.
 *  @return   True iff (x, y) is a valid window coordinate.
 */

bool   FrameBuffer :: checkInWindow ( int  x ,   int  y )   const   {
     return   0   <=  x  &&  x  <  window . width  &&
             0   <=  y  &&  y  <  window . height ;
}

/**
 *  @fn   void FrameBuffer::setPixel(int x, int y, const color &C, double depth)
 *  @brief    Sets a pixel's color and depth values
 *  @param    x       Window x coordinate.
 *  @param    y       Window y coordinate.
 *  @param    C       The color to set.
 *  @param    depth   The depth to set
 */

void   FrameBuffer :: setPixel ( int  x ,   int  y ,   const  color  & C ,   double  depth )   {
    setDepth ( x ,  y ,  depth );
    setColor ( x ,  y ,  C );
}

static   double  computeAq ( const   QuadricParameters   & qParams ,   const   Ray   & ray )   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . J ;
     const   double  twoA  =   2.0   *  A ;
     const   double  twoB  =   2.0   *  B ;
     const   double  twoC  =   2.0   *  C ;
    dvec3  Ro   =  ray . origin ;
     const  dvec3  & Rd   =  ray . dir ;

     return  A  *  glm :: pow ( Rd . x ,   2 )   +
            B  *  glm :: pow ( Rd . y ,   2 )   +
            C  *  glm :: pow ( Rd . z ,   2 );
}

static   double  computeBq ( const   QuadricParameters   & qParams ,   const   Ray   & ray )   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . J ;
     const   double  twoA  =   2.0   *  A ;
     const   double  twoB  =   2.0   *  B ;
     const   double  twoC  =   2.0   *  C ;
    dvec3  Ro   =  ray . origin ;
     const  dvec3  & Rd   =  ray . dir ;

     return  twoA  *   Ro . x * Rd . +
        twoB  *   Ro . y * Rd . +
        twoC  *   Ro . z * Rd . z ;
}

static   double  computeCq ( const   QuadricParameters   & qParams ,   const   Ray   & ray )   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . J ;
     const   double  twoA  =   2.0   *  A ;
     const   double  twoB  =   2.0   *  B ;
     const   double  twoC  =   2.0   *  C ;
    dvec3  Ro   =  ray . origin ;
     const  dvec3  & Rd   =  ray . dir ;

     return  A  *  glm :: pow ( Ro . x ,   2.0 )   +
        B  *  glm :: pow ( Ro . y ,   2.0 )   +
        C  *  glm :: pow ( Ro . z ,   2.0 )   +
        J ;
}

static   double  solve ( double  A ,   double  B ,   double  C )   {
     double  D  =  B  *  B  -   4   *  A * C ;
     if   ( <   0 )   return   - 1.0 ;
     return   ( - +  std :: sqrt ( D ))   /   ( 2.0   *  A );
}

/**
 *  @fn   void FrameBuffer::showAxes(int x, int y, const Ray &ray, double thickness)
 *  @brief    Inserts a R, G, or B pixel if the ray hits the X, Y, or Z axis.
 *  @param    x   The x coordinate in the framebuffer
 *  @param    y   The y coordinate in the framebuffer
 *  @param    ray The viewing ray
 *  @param    thickness how wide the axes should appear
 */

void   FrameBuffer :: showAxes ( int  x ,   int  y ,   const   Ray   & ray ,   double  thickness )   {
    color currColor  =  getColor ( x ,  y );
     static   const   QuadricParameters  X  =   QuadricParameters :: cylinderXQParams ( thickness );
     static   const   QuadricParameters  Y  =   QuadricParameters :: cylinderYQParams ( thickness );
     static   const   QuadricParameters  Z  =   QuadricParameters :: cylinderZQParams ( thickness );
     const   double   AqX   =  computeAq ( X ,  ray );
     const   double   BqX   =  computeBq ( X ,  ray );
     const   double   CqX   =  computeCq ( X ,  ray );
     const   double   AqY   =  computeAq ( Y ,  ray );
     const   double   BqY   =  computeBq ( Y ,  ray );
     const   double   CqY   =  computeCq ( Y ,  ray );
     const   double   AqZ   =  computeAq ( Z ,  ray );
     const   double   BqZ   =  computeBq ( Z ,  ray );
     const   double   CqZ   =  computeCq ( Z ,  ray );
     const   double  tX  =  solve ( AqX ,   BqX ,   CqX );
     const   double  tY  =  solve ( AqY ,   BqY ,   CqY );
     const   double  tZ  =  solve ( AqZ ,   BqZ ,   CqZ );
     const  dvec3  Xintercept   =  ray . getPoint ( tX );
     const  dvec3  Yintercept   =  ray . getPoint ( tY );
     const  dvec3  Zintercept   =  ray . getPoint ( tZ );
     const   int  W  =   2 ;
     if   ( %  W  ==   0   &&  y  %  W  ==   0 )   {       // color every other pixel
         if   ( tX  >=   0   &&   Xintercept . >=   0 )   {
            setColor ( x ,  y ,  red );
         }   else   if   ( tY  >   0   &&   Yintercept . >=   0 )   {
            setColor ( x ,  y ,  green );
         }   else   if   ( tZ  >   0   &&   Zintercept . >=   0 )   {
            setColor ( x ,  y ,  blue );
         }
     }
}

void  dot ( FrameBuffer   & fb ,   int  x ,   int  y ,   int  W ,   const  color  & C ,   double  Z )   {
     for   ( int  col  =  x  -  W ;  col  <=  x  +  W ;  col ++ )   {
         for   ( int  row  =  y  -  W ;  row  <=  y  +  W ;  row ++ )   {
             if   ( row  >=   0   &&  row  <  fb . getWindowHeight ()   &&
                col  >=   0   &&  col  <  fb . getWindowWidth ())   {
                    fb . setColor ( col ,  row ,  C );
             }
         }
     }
}

/**
 *  @fn   void FrameBuffer::showAxes(const dmat4 &VM, const dmat4 &PM, const dmat4 &VPM, const BoundingBoxi &viewport, double thickness)
 *  @brief    Displays axes.
 *  @param    VM  viewing matrix
 *  @param    PM  projection matrix
 *  @param    VPM         viewport transformation matrix
 *  @param    viewport    viewport
 *  @param    thickness   how wide the axes should appear
 */

void   FrameBuffer :: showAxes ( const  dmat4  & VM ,   const  dmat4  & PM ,   const  dmat4  & VPM ,
                             const   BoundingBoxi   & viewport ,   double  thickness )   {
     const   double  LEN  =   10 ;
     const   double  INC  =   0.1 ;
     const   static  color C []   =   {  red ,  green ,  blue  };
     for   ( double  i  =   0.0 ;  i  <=  LEN ;  i  +=  INC )   {
        vector < dvec4 >  pts  =   {  dvec4 ( i ,   0.0 ,   0.0 ,   1.0 ),  dvec4 ( 0.0 ,  i ,   0.0 ,   1.0 ),  dvec4 ( 0.0 ,   0.0 ,  i ,   1.0 )   };
         for   ( size_t j  =   0 ;  j  <  pts . size ();  j ++ )   {
            dvec4 eye  =  VM  *  pts [ j ];
            dvec4 proj  =  PM  *  eye ;
            dvec4 clip ;
             if   ( proj . >=   0 )   {
                clip  =  proj  /  proj . w ;
             }   else   {
                clip . /=   - proj . w ;
                clip . /=   - proj . w ;
                clip . =   - std :: abs ( proj . z / proj . w );
                clip . =   1.0 ;
             }
             const   int  W  =   1 ;
             if   ( std :: abs ( clip . x )   <=   1.0   &&  std :: abs ( clip . y )   <=   1.0   &&  std :: abs ( clip . z )   <=   1.0 )   {
                dvec4 window  =  VPM  *  clip ;
                 int  x  =   ( int ) glm :: clamp ( window . x ,   ( double ) viewport . lx ,   ( double ) viewport . rx );
                 int  y  =   ( int ) glm :: clamp ( window . y ,   ( double ) viewport . ly ,   ( double ) viewport . ry );
                 double  currZ  =  getDepth ( x ,  y );
                 if   ( std :: abs ( window . -  currZ )   <   0.01 )   {
                    dot ( * this ,  x ,  y ,   1 ,  C [ j ],  window . z );
                 }
             }
         }
     }
}

CSE386Fall2020/CSE386Fall2020/FrameBuffer.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include "Defs.h" #include "IShape.h" #include "ColorAndMaterials.h" #ifndef WINDOWS #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif const int BYTES_PER_PIXEL = 3; //!< RGB requires 3 bytes. /** * @struct FrameBuffer * @brief Represents a framebuffer. Two identically sized 2D arrays. The color * buffer stores the colors and the depth buffer stores the corresponding * depth at each pixel. */ struct FrameBuffer { FrameBuffer(const int width, const int height); ~FrameBuffer(); void setFrameBufferSize(int width, int height); void setClearColor(const color &clearColor); void setColor(int x, int y, const color &C); color getColor(int x, int y) const; void clearColorAndDepthBuffers(); void showColorBuffer() const; int getWindowWidth() const { return window.width; } int getWindowHeight() const { return window.height; } void setDepth(double x, double y, double depth); void setDepth(int x, int y, double depth); double getDepth(int x, int y) const; double getDepth(double x, double y) const; void showAxes(int x, int y, const Ray &ray, double thickness); void showAxes(const dmat4 &VM, const dmat4 &PM, const dmat4 &VPM, const BoundingBoxi &viewport, double thickness); void setPixel(int x, int y, const color &C, double depth); protected: bool checkInWindow(int x, int y) const; Window window; //!< Dimensions of framebuffer GLubyte clearColorUB[BYTES_PER_PIXEL]; //!< Clear color, as unsigned bytes color clearColor; //!< Clear color GLubyte *colorBuffer; //!< 2D array for holding colors double *depthBuffer; //!< 2D array for holding depths };

CSE386Fall2020/CSE386Fall2020/HitRecord.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <vector> #include "Defs.h" #include "ColorAndMaterials.h" #include "Image.h" #include "Utilities.h" /** * @struct HitRecord * @brief Stores information regarding a ray-object intersection. Used in raytracing. */ struct HitRecord { double t; //!< the t value where the intersection took place. dvec3 interceptPt; //!< the (x,y,z) value where the intersection took place. dvec3 normal; //!< the normal vector at the intersection point. Material material; //!< the Material value of the object. Image *texture; //!< the texture associated with this object, if any. double u, v; //!< (u,v) correpsonding to intersection point. /** * @fn HitRecord() * @brief Constructs a HitRecord that corresponds to "no hit" */ HitRecord() { u = v = 0; t = FLT_MAX; texture = nullptr; } /** * @fn static HitRecord getClosest(const vector<HitRecord> &hits) * @brief Gets a closest, give a vector of hits. * @param hits The hits to consider. * @return The closest hit, that is in front of the camera. */ static HitRecord getClosest(const vector<HitRecord> &hits) { HitRecord theHit; for (size_t i = 0; i < hits.size(); i++) { if (inRangeExclusive(hits[i].t, 0, theHit.t)) { theHit = hits[i]; } } return theHit; } };

CSE386Fall2020/CSE386Fall2020/Image.cpp

CSE386Fall2020/CSE386Fall2020/Image.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   < iostream >
#include   < fstream >
#include   < utility >
#include   < set >
#include   "Utilities.h"
#include   "Image.h"

static   unsigned   int  getNextChar ( std :: ifstream  & input ,  string  & str )   {
     const   int  N  =   2000 ;
     char  buf ;
    input . read ( & buf ,   1 );
     unsigned   int  result  =   ( unsigned   char ) buf ;
     return  result ;
}

static   void  p3 ( std :: ifstream  & input ,   Image   & im )   {
     const   int  N  =   100 ;
     char  buf [ +   1 ];

     int  maxValue ;
    input  >>  im . >>  im . >>  maxValue ;
    input . getline ( buf ,  N );

    im . pixels  =   new  color [ im . W * im . H ];
    color  * =  im . pixels ;
     for   ( int  row  =   0 ;  row  <  im . H ;  row ++ )   {
         for   ( int  col  =   0 ;  col  <  im . W ;  col ++ ,  p ++ )   {
             int  r ,  g ,  b ;
            input  >>  r  >>  g  >>  b ;
             double  R  =  map (( double ) r ,   0.0 ,   ( double ) maxValue ,   0.0 ,   1.0 );
             double  G  =  map (( double ) g ,   0.0 ,   ( double ) maxValue ,   0.0 ,   1.0 );
             double  B  =  map (( double ) b ,   0.0 ,   ( double ) maxValue ,   0.0 ,   1.0 );
             * =  color ( R ,  G ,  B );
         }
     }
}

static   void  p6 ( std :: ifstream  & input ,   Image   & im )   {
     const   int  N  =   100 ;
     char  buf [ +   1 ];

     int  maxValue ;
    input  >>  im . >>  im . >>  maxValue ;
    input . getline ( buf ,  N );

    im . pixels  =   new  color [ im . W * im . H ];
    string buffer ;
    color  * =  im . pixels ;
     for   ( int  row  =   0 ;  row  <  im . H ;  row ++ )   {
         for   ( int  col  =   0 ;  col  <  im . W ;  col ++ ,  p ++ )   {
             int  r ,  g ,  b ;
            r  =  getNextChar ( input ,  buffer );
            g  =  getNextChar ( input ,  buffer );
            b  =  getNextChar ( input ,  buffer );
             double  R  =  map (( double ) r ,   0.0 ,   ( double ) maxValue ,   0.0 ,   1.0 );
             double  G  =  map (( double ) g ,   0.0 ,   ( double ) maxValue ,   0.0 ,   1.0 );
             double  B  =  map (( double ) b ,   0.0 ,   ( double ) maxValue ,   0.0 ,   1.0 );
             * =  color ( R ,  G ,  B );
         }
     }
}

/**
 *  @fn   Image::Image(char *ppmFileName)
 *  @brief    Constructs and image given the name of a PPM file. The file must be
 *          P3 or P6.
 *  @param  [in,out]  ppmFileName Filename of the ppm file.
 */

Image :: Image ( std :: string ppmFileName )   {
     const   int  N  =   100 ;
     char  buf1 [ +   1 ];
     char  buf2 [ +   1 ];
    std :: ifstream input ( ppmFileName . c_str (),  std :: ios :: binary );
    input . getline ( buf1 ,  N );
     int  type  =   3 ;

     while   ( input . peek ()   ==   '#' )   {
        input . getline ( buf2 ,  N );
     }
    string header ( buf1 );
    header  =  header . substr ( 0 ,   2 );
     if   ( header  ==   "P3" )   {
        p3 ( input ,   * this );
     }   else   if   ( header  ==   "P6" )   {
        p6 ( input ,   * this );
     }   else   {
        std :: cerr  <<   "Problem with PPM file: "   <<  ppmFileName  <<   "("   <<  header  <<   ")"   <<  endl ;
         return ;
     }

    input . close ();
}

/**
 *  @fn   color Image::getPixelUV(double u, double v) const
 *  @brief    Gets the color that corresponds to the coordinate (u, v). This is
 *          done by finding the texel whose center is closest to (u, v). In the
 *          event of a tie, picks one of these.
 *  @param    u   The u in (u, v).
 *  @param    v   The v in (u, v).
 *  @return   The color corresponding to the position (u, v).
 */

color  Image :: getPixelUV ( double  u ,   double  v )   const   {
     int  x  =  u  ==   1   ?  W - 1   :   ( int )( W * u );
     int  y  =  v  ==   1   ?  H - 1   :   ( int )( H * v );
     return  pixels [ *  W  +  x ];
}

CSE386Fall2020/CSE386Fall2020/Image.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <memory> #include "Defs.h" /** * @struct Image * @brief Represents a rectangular RGB image. */ struct Image { int W, H; color *pixels; Image(std::string ppmFileName); ~Image() { delete[] pixels; } color getPixelUV(double u, double v) const; };

CSE386Fall2020/CSE386Fall2020/IScene.cpp

CSE386Fall2020/CSE386Fall2020/IScene.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "IScene.h"

/**
 *  @fn   IScene::IScene(RaytracingCamera *theCamera)
 *  @brief    Construct scene using a particular camera.
 *  @param  [in,out]  theCamera   The camera to use.
 */

IScene :: IScene ( RaytracingCamera   * theCamera )   {
    camera  =  theCamera ;
}

/**
 *  @fn   void IScene::addOpaqueObject(const VisibleIShapePtr obj)
 *  @brief    Adds an visible object to the scene
 *  @param    obj The object to be added.
 */

void   IScene :: addOpaqueObject ( const   VisibleIShapePtr  obj )   {
    opaqueObjs . push_back ( obj );
}

/**
 *  @fn   void IScene::addTransparentObject(const VisibleIShapePtr obj, double alpha)
 *  @brief    Adds a transparent object to the scene
 *  @param    obj     The transparent object to be added.
 *  @param    alpha   The alpha value of the object.
 */

void   IScene :: addTransparentObject ( const   VisibleIShapePtr  obj ,   double  alpha )   {
    obj -> material . alpha  =  alpha ;
    transparentObjs . push_back ( obj );
}

/**
 *  @fn   void IScene::addLight(const PositionalLightPtr light)
 *  @brief    Adds a positional light to the scene.
 *  @param    light   The light to be added.
 */

void   IScene :: addLight ( const   PositionalLightPtr  light )   {
    lights . push_back ( light );
}

CSE386Fall2020/CSE386Fall2020/IScene.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <vector> #include <map> #include "Defs.h" #include "Light.h" #include "Camera.h" #include "Light.h" #include "IShape.h" /** * @struct IScene * @brief Represents an scene of implicitly represented objects. Used mostly in ray tracing. */ struct IScene { vector<PositionalLightPtr> lights; //!< All the positional lights in the scene vector<VisibleIShapePtr> opaqueObjs; //!< All the visible objects in the scene vector<VisibleIShapePtr> transparentObjs; //!< All the transparent objects in the scene RaytracingCamera *camera; //!< The one camera in the scene IScene(RaytracingCamera *theCamera); void addOpaqueObject(const VisibleIShapePtr obj); void addTransparentObject(const VisibleIShapePtr obj, double alpha); void addLight(const PositionalLightPtr light); };

CSE386Fall2020/CSE386Fall2020/IShape.cpp

CSE386Fall2020/CSE386Fall2020/IShape.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   < vector >
#include   "IShape.h"

/**
 *  @fn   IShape::IShape()
 *  @brief    Constructs a default IShape, centered at the origin.
 */

IShape :: IShape ()   {
}

/**
 *  @fn   void IShape::getTexCoords(const dvec3 &pt, double &u, double &v) const
 *  @brief    Computes the tex coordinate of a point on the surface. The default
 *          return value is (0, 0)
 *  @param            pt  The coordinate to process
 *  @param  [in,out]  u   The u, in (u, v).
 *  @param  [in,out]  v   The v, in (u, v).
 */

void   IShape :: getTexCoords ( const  dvec3  & pt ,   double   & u ,   double   & v )   const   {
    u  =  v  =   0 ;
}

/**
 *  @fn   dvec3 IShape::movePointOffSurface(const dvec3 &pt, const dvec3 &n)
 *  @brief    Compute point that is slightly off surface.
 *  @param    pt  Intersection point.
 *  @param    n   Normal vector at pt.
 *  @return   The point that is approximately EPSILON off the surface.
 */

dvec3  IShape :: movePointOffSurface ( const  dvec3  & pt ,   const  dvec3  & n )   {
     /* CSE 386 - todo  */
     return  pt ;
}

/**
 *  @fn   VisibleIShape::VisibleIShape(IShapePtr shapePtr, const Material &mat)
 *  @brief    Represents an visible, implicit shape.
 *  @param    shapePtr    Pointer to the implicit shape.
 *  @param    mat         Material
 */

VisibleIShape :: VisibleIShape ( IShapePtr  shapePtr ,   const   Material   & mat )
     :  material ( mat ),  shape ( shapePtr )   {
    texture  =   nullptr ;
}

/**
 *  @fn   void VisibleIShape::findClosestIntersection(const Ray &ray, HitRecord &hit) const
 *  @brief    Identifies the closest intersection
 *  @param            ray The ray.
 *  @param  [in,out]  hit The hit that repesents the closest "hit".
 */

void   VisibleIShape :: findClosestIntersection ( const   Ray   & ray ,   HitRecord   & hit )   const   {
    shape -> findClosestIntersection ( ray ,  hit );
     if   ( hit . <  FLT_MAX )   {
        hit . material  =  material ;
     }
}

/**
 *  @fn   void VisibleIShape::setTexture(Image *tex)
 *  @brief    Sets a texture for this implicit shape.
 *  @param  [in,out]  tex The image to use as the texture, if not null.
 */

void   VisibleIShape :: setTexture ( Image   * tex )   {
    texture  =  tex ;
}

/**
 *  @fn   HitRecord VisibleIShape::findIntersection(const Ray &ray, const vector<VisibleIShapePtr> &surfaces)
 *  @brief    Searches for the first intersection
 *  @param    ray         The ray.
 *  @param    surfaces    The surfaces in the scene.
 *  @return   The closest intersection that is in front of the camera.
 */

HitRecord   VisibleIShape :: findIntersection ( const   Ray   & ray ,   const  vector < VisibleIShapePtr >   & surfaces )   {
     /* CSE 386 - todo  */
     HitRecord  theHit ;
     return  theHit ;
}

/**
 *  @fn   IDisk::IDisk()
 *  @brief    Implicit representation of an implicit disk. Create a unit circle, centered
 *          on the origin, and lying on the x-y plane.
 */

IDisk :: IDisk ()
     :   IShape (),  center ( ORIGIN3D ),  n ( Y_AXIS ),  radius ( 1.0 )   {
}

/**
 *  @fn   IDisk::IDisk(const dvec3 &pos, const dvec3 &normal, double rad)
 *  @brief    Implicit representation of an implicit disk.
 *  @param    pos     Center of disk.
 *  @param    normal  Normal vector of disk.
 *  @param    rad     Radius of disk.
 */

IDisk :: IDisk ( const  dvec3  & pos ,   const  dvec3  & normal ,   double  rad )
     :   IShape (),  center ( pos ),  n ( normal ),  radius ( rad )   {
}

/**
 *  @fn   void IDisk::findClosestIntersection(const Ray &ray, HitRecord &hit) const
 *  @brief    Identifies the nearest intersection
 *  @param            ray The ray.
 *  @param  [in,out]  hit The hit.
 */

void   IDisk :: findClosestIntersection ( const   Ray   & ray ,   HitRecord   & hit )   const   {
     /* CSE 386 - todo  */
    hit . =   1.0f ;
    hit . normal  =  Z_AXIS ;
}

/**
 *  @fn   ISphere::ISphere(const dvec3 & position, double radius)
 *  @brief    Implicit representation of a 3D sphere.
 *  @param    position    The center of the sphere.
 *  @param    radius      The radius of the sphere.
 */

ISphere :: ISphere ( const  dvec3  & position ,   double  radius )
     :   IQuadricSurface ( QuadricParameters :: sphereQParams ( radius ),  position )   {
}

/**
 *  @fn   void ISphere::getTexCoords(const dvec3 &pt, double &u, double &v) const
 *  @brief    Gets texture coordinates for a point on the surface.
 *  @param            pt  The point on the surface.
 *  @param  [in,out]  u   The u in the (u, v) texture coordinates.
 *  @param  [in,out]  v   The v in the (u, v) texture coordinates.
 */

void   ISphere :: getTexCoords ( const  dvec3  & pt ,   double   & u ,   double   & v )   const   {
     /* CSE 386 - todo  */
    u  =  v  =   0 ;
}

/**
 *  @fn   void ISphere::computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const
 *  @see  textbook.
 *  @brief    Calculates aq, bq, and cq that are used in the quadric equations. The 
 *          values that are know to be zero are eliminated from the code.
 *  @param            ray The ray.
 *  @param  [in,out]  Aq  aq.
 *  @param  [in,out]  Bq  bq.
 *  @param  [in,out]  Cq  cq.
 */

void   ISphere :: computeAqBqCq ( const   Ray   & ray ,   double   & Aq ,   double   & Bq ,   double   & Cq )   const   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . D ;
     const   double   & =  qParams . E ;
     const   double   & =  qParams . F ;
     const   double   & =  qParams . G ;
     const   double   & =  qParams . H ;
     const   double   & =  qParams . I ;
     const   double   & =  qParams . J ;

    dvec3  Ro   =  ray . origin  -  center ;
     const  dvec3  & Rd   =  ray . dir ;

     Aq   =   /*A * */   ( Rd . x * Rd . x )   +
         /*B * */   ( Rd . y * Rd . y )   +
         /*C * */   ( Rd . z * Rd . z );
         //D * (Rd.x * Rd.y) +
         //E * (Rd.x * Rd.z) +
         //F * (Rd.y * Rd.z);

     Bq   =   2   *   /* A * */   Ro . x * Rd . +
         2   *   /* B * */   Ro . y * Rd . +
         2   *   /* C * */   Ro . z * Rd . z ;
         //D * (Ro.x * Rd.y + Ro.y * Rd.x) +
         //E * (Ro.x * Rd.z + Ro.z * Rd.x) +
         //F * (Ro.y * Rd.z + Ro.z * Rd.y) +
         //G * Rd.x + H * Rd.y + I * Rd.z;

     Cq   =   /* A * */   ( Ro . *   Ro . x )   +
         /* B * */   ( Ro . *   Ro . y )   +
         /* C * */   ( Ro . *   Ro . z )   +
         //D * (Ro.x * Ro.y) +
         //E * (Ro.x * Ro.z) +
         //F * (Ro.y * Ro.z) +
         //G * Ro.x +
         //H * Ro.y +
        I  *   Ro . +  J ;
}

/**
 *  @fn   QuadricParameters::QuadricParameters() : QuadricParameters(vector<double> {1, 1, 1, 0, 0, 0, 0, 0, 0, -1})
 *  @brief    Default constructor
 */

QuadricParameters :: QuadricParameters ()
     :   QuadricParameters ( vector < double >   { 1 ,   1 ,   1 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   - 1 })   {
}

/**
 *  @fn   QuadricParameters::QuadricParameters(const vector<double> &items)
 *  @brief    Constructor using 10 values.
 *  @param    items   The items.
 */

QuadricParameters :: QuadricParameters ( const  vector < double >   & items )
             :  A ( items [ 0 ]),  B ( items [ 1 ]),  C ( items [ 2 ]),  D ( items [ 3 ]),
                E ( items [ 4 ]),  F ( items [ 5 ]),  G ( items [ 6 ]),  H ( items [ 7 ]),
                I ( items [ 8 ]),  J ( items [ 9 ])   {
}

/**
 *  @fn   QuadricParameters::QuadricParameters(double a, double b, double c, double d, double e, double , double g, double h, double i, double j)
 *  @brief    Constructor
 *  @param    a   Quadric parameter A.
 *  @param    b   Quadric parameter B.
 *  @param    c   Quadric parameter C.
 *  @param    d   Quadric parameter D.
 *  @param    e   Quadric parameter E.
 *  @param    f   Quadric parameter F.
 *  @param    g   Quadric parameter G.
 *  @param    h   Quadric parameter H.
 *  @param    i   Quadric parameter I.
 *  @param    j   Quadric parameter J.
 */

QuadricParameters :: QuadricParameters ( double  a ,   double  b ,   double  c ,   double  d ,   double  e ,   double  f ,
                                     double  g ,   double  h ,   double  i ,   double  j )
                 :   QuadricParameters ( vector < double >   { a ,  b ,  c ,  d ,  e ,  f ,  g ,  h ,  i ,  j })   {
}

/**
 *  @fn   QuadricParameters QuadricParameters::cylinderXQParams(double R)
 *  @brief    Constructs the parameters for a cylinder oriented along the x axis.
 *  @param    R   Radius of cylinder.
 *  @return   The QuadricParameters.
 */

QuadricParameters   QuadricParameters :: cylinderXQParams ( double  R )   {
     double  R2  =  R  *  R ;
     return   QuadricParameters ( 0.0 ,   1.0   /  R2 ,   1.0   /  R2 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   - 1 );
}

/**
 *  @fn   QuadricParameters QuadricParameters::cylinderYQParams(double R)
 *  @brief    Constructs the parameters for a cylinder oriented along the y axis.
 *  @param    R   Radius of cylinder.
 *  @return   The QuadricParameters.
 */

QuadricParameters   QuadricParameters :: cylinderYQParams ( double  R )   {
     double  R2  =  R  *  R ;
     return   QuadricParameters ( 1.0   /  R2 ,   0 ,   1.0   /  R2 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   - 1 );
}

/**
 *  @fn   QuadricParameters QuadricParameters::cylinderZQParams(double R)
 *  @brief    Constructs the parameters for a cylinder oriented along the z axis.
 *  @param    R   Radius of cylinder.
 *  @return   The QuadricParameters.
 */

QuadricParameters   QuadricParameters :: cylinderZQParams ( double  R )   {
     double  R2  =  R  *  R ;
     return   QuadricParameters ( 1.0   /  R2 ,   1.0   /  R2 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   - 1 );
}

/**
 *  @fn   QuadricParameters QuadricParameters::sphereQParams(double R)
 *  @brief    Constructs the parameters for a sphere centered on the origin.
 *  @param    R   Radius of cylinder.
 *  @return   The QuadricParameters.
 */

QuadricParameters   QuadricParameters :: sphereQParams ( double  R )   {
     double  R2  =  R  *  R ;
     return   QuadricParameters ( 1 ,   1 ,   1 ,   0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   - R2 );
}

/**
 *  @fn   QuadricParameters QuadricParameters::ellipsoidQParams(dvec3 sz)
 *  @brief    Ellipoid parameters
 *  @param    sz  Size of ellipsoid.
 *  @return   The QuadricParameters.
 */

QuadricParameters   QuadricParameters :: ellipsoidQParams ( const  dvec3  & sz )   {
    dvec3 size  =  sz  *  sz ;
     return   QuadricParameters ( 1.0   /  size . x ,   1.0   /  size . y ,   1.0   /  size . z ,
                             0 ,   0 ,   0 ,   0 ,   0 ,   0 ,   - 1 );
}

/**
 *  @fn   IPlane::IPlane(const dvec3 &point, const dvec3 &normal)
 *  @brief    Constructor
 *  @param    point   The point.
 *  @param    normal  The normal.
 */

IPlane :: IPlane ( const  dvec3  & point ,   const  dvec3  & normal )
     :   IShape (),  a ( point ),  n ( normalize ( normal ))   {
}

/**
 *  @fn   IPlane::IPlane(const vector<dvec3> &vertices)
 *  @brief    Constructor
 *  @param    vertices    The three vertices.
 */

IPlane :: IPlane ( const  vector < dvec3 >   & vertices )
                 :   IShape ()   {
    a  =  vertices [ 0 ];
    n  =  glm :: normalize ( glm :: cross ( vertices [ 2 ]   -  vertices [ 1 ],  vertices [ 0 ]   -  vertices [ 1 ]));
}

/**
 *  @fn   IPlane::IPlane(const dvec3 &p0, const dvec3 &p1, const dvec3 &p2) : IShape(), a(p1), n(glm::normalize(glm::cross(p2 - p1, p0 - p1)))
 *  @brief    Constructor
 *  @param    p0  The p 0.
 *  @param    p1  The first dvec3.
 *  @param    p2  The second dvec3.
 */

IPlane :: IPlane ( const  dvec3  & p0 ,   const  dvec3  & p1 ,   const  dvec3  & p2 )
                 :   IShape (),  a ( p1 ),  n ( glm :: normalize ( glm :: cross ( p2  -  p1 ,  p0  -  p1 )))   {
}

/**
 *  @fn   bool IPlane::onFrontSide(const dvec3 &point) const
 *  @brief    Determines if point is on the "front side of plane"
 *  @param    point   The point.
 *  @return   True if it succeeds, false if it fails.
 */

bool   IPlane :: onFrontSide ( const  dvec3  & point )   const   {
     // If dot product is positive the point is on the "positive" side of the plane
     bool  onFront  =  glm :: dot ( point . xyz ()   -  a ,  n )   >=   0.0 ;
     return  onFront ;
}

/**
 *  @fn   void IPlane::findClosestIntersection(const Ray &ray, HitRecord &hit) const
 *  @brief    Implicit representation of a plane
 *  @param            ray The ray.
 *  @param  [in,out]  hit The hit.
 */

void   IPlane :: findClosestIntersection ( const   Ray   & ray ,   HitRecord   & hit )   const   {
     /* CSE 386 - todo  */
    hit . =   1 ;
    hit . normal  =  Z_AXIS ;
}

/**
 *  @fn   void IPlane::findIntersection(const dvec3 &p1, const dvec3 &p2, double &t) const
 *  @brief    Searches for the first intersection between a line segment. Used in the pipeline.
 *  @param    p1  The first point
 *  @param    p2  The second piont.
 *  @param  [in,out]  t   The value of t where the intersection takes place.
 */

void   IPlane :: findIntersection ( const  dvec3  & p1 ,   const  dvec3  & p2 ,   double   & t )   const   {
     double  d1  =  glm :: dot ( p1 . xyz ()   -  a ,  n );
     double  d2  =  glm :: dot ( p2 . xyz ()   -  a ,  n );

     // Find the paramter of the intercept with the plane
    t  =  d1  /   ( d1  -  d2 );
}

/**
 *  @fn   IQuadricSurface::IQuadricSurface(const QuadricParameters &params, const dvec3 &position)
 *  @brief    Constructs an implicit representation of a QuadricSurface.
 *  @param    params      Options for controlling the operation.
 *  @param    position    The position.
 */

IQuadricSurface :: IQuadricSurface ( const   QuadricParameters   & params ,   const  dvec3  & position )
                                 :   IShape (),  qParams ( params ),  center ( position )   {
    twoA  =   2.0   *  qParams . A ;
    twoB  =   2.0   *  qParams . B ;
    twoC  =   2.0   *  qParams . C ;
}

/**
 *  @fn   IQuadricSurface::IQuadricSurface(const vector<double> &params, const dvec3 &position)
 *  @brief    Constructs an implicit representation of a QuadricSurface.
 *  @param    params      Quadric parameters.
 *  @param    position    The position of the quadric.
 */

IQuadricSurface :: IQuadricSurface ( const  vector < double >   & params ,
                                 const  dvec3  & position )  
                     :   IQuadricSurface ( QuadricParameters ( params ),  position )   {
}

/**
 *  @fn   IQuadricSurface::IQuadricSurface(const dvec3 &position)
 *  @brief    Constructs an implicit representation of a QuadricSurface.
 *  @param    position    The position of the quadric.
 */

IQuadricSurface :: IQuadricSurface ( const  dvec3  & position )
                     :   IQuadricSurface ( QuadricParameters (),  position )   {
}

/**
 *  @fn   void IQuadricSurface::computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const
 *  @brief    Calculates the aq bq cq
 *  @param            ray The ray.
 *  @param  [in,out]  Aq  The aq.
 *  @param  [in,out]  Bq  The bq.
 *  @param  [in,out]  Cq  The cq.
 */

void   IQuadricSurface :: computeAqBqCq ( const   Ray   & ray ,   double   & Aq ,   double   & Bq ,   double   & Cq )   const   {
    dvec3  Ro   =  ray . origin  -  center ;
     const  dvec3  & Rd   =  ray . dir ;
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . D ;
     const   double   & =  qParams . E ;
     const   double   & =  qParams . F ;
     const   double   & =  qParams . G ;
     const   double   & =  qParams . H ;
     const   double   & =  qParams . I ;
     const   double   & =  qParams . J ;
     Aq   =  A  *   ( Rd . x * Rd . x )   +
        B  *   ( Rd . y * Rd . y )   +
        C  *   ( Rd . z * Rd . z )   +
        D  *   ( Rd . *   Rd . y )   +
        E  *   ( Rd . *   Rd . z )   +
        F  *   ( Rd . *   Rd . z );

     Bq   =  twoA  *   Ro . x * Rd . +
        twoB  *   Ro . y * Rd . +
        twoC  *   Ro . z * Rd . +
        D  *   ( Ro . *   Rd . +   Ro . *   Rd . x )   +
        E  *   ( Ro . *   Rd . +   Ro . *   Rd . x )   +
        F  *   ( Ro . *   Rd . +   Ro . *   Rd . y )   +
        G  *   Rd . +  H  *   Rd . +  I  *   Rd . z ;

     Cq   =  A  *   ( Ro . *   Ro . x )   +
        B  *   ( Ro . *   Ro . y )   +
        C  *   ( Ro . *   Ro . z )   +
        D  *   ( Ro . *   Ro . y )   +
        E  *   ( Ro . *   Ro . z )   +
        F  *   ( Ro . *   Ro . z )   +
        G  *   Ro . +
        H  *   Ro . +
        I  *   Ro . +  J ;
}

/**
 *  @fn   int IQuadricSurface::findIntersections(const Ray &ray, HitRecord hits[2]) const
 *  @brief    Searches for the first intersections
 *  @param    ray     The ray.
 *  @param    hits    The hits.
 *  @return   The found intersections.
 */

int   IQuadricSurface :: findIntersections ( const   Ray   & ray ,   HitRecord  hits [ 2 ])   const   {
     double   Aq ,   Bq ,   Cq ;
    computeAqBqCq ( ray ,   Aq ,   Bq ,   Cq );
     double  roots [ 2 ];

     int  numRoots  =  quadratic ( Aq ,   Bq ,   Cq ,  roots );
     int  numIntersections  =   0 ;

     for   ( int  i  =   0 ;  i  <  numRoots ;  i ++ )   {
         if   ( roots [ i ]   >   0 )   {
             const   double   & =  roots [ i ];
            hits [ numIntersections ]. =  t ;
            hits [ numIntersections ]. interceptPt  =  ray . origin  +  t  *  ray . dir ;
             const  dvec3  & intercept  =  hits [ numIntersections ]. interceptPt ;
            hits [ numIntersections ]. normal  =  normal ( intercept );
            numIntersections ++ ;
         }
     }

     return  numIntersections ;
}

/**
 *  @fn   void IQuadricSurface::findClosestIntersection(const Ray &ray, HitRecord &hit) const
 *  @brief    Searches for the nearest intersection
 *  @param            ray The ray.
 *  @param  [in,out]  hit The hit.
 */

void   IQuadricSurface :: findClosestIntersection ( const   Ray   & ray ,   HitRecord   & hit )   const   {
     static   HitRecord  hits [ 2 ];
    hit . =  FLT_MAX ;

     int  numIntercepts  =  findIntersections ( ray ,  hits );
     if   ( numIntercepts  ==   1   &&  hits [ 0 ]. >   0 )   {
        hit . =  hits [ 0 ]. t ;
        hit . interceptPt  =  hits [ 0 ]. interceptPt ;
        hit . normal  =  normal ( hit . interceptPt );
     }   else   if   ( numIntercepts  ==   2 )   {
         if   ( hits [ 0 ]. >   0 )   {
            hit . =  hits [ 0 ]. t ;
            hit . interceptPt  =  hits [ 0 ]. interceptPt ;
            hit . normal  =  normal ( hit . interceptPt );
         }   else   if   ( hits [ 1 ]. >   0 )   {
            hit . =  hits [ 1 ]. t ;
            hit . interceptPt  =  hits [ 1 ]. interceptPt ;
            hit . normal  =  normal ( hit . interceptPt );
         }
     }
}

/**
 *  @fn   dvec3 IQuadricSurface::normal(const dvec3 &P) const
 *  @brief    Normals the given p
 *  @param    P   A dvec3 to process.
 *  @return   A dvec3.
 */

dvec3  IQuadricSurface :: normal ( const  dvec3  & P )   const   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . D ;
     const   double   & =  qParams . E ;
     const   double   & =  qParams . F ;
     const   double   & =  qParams . G ;
     const   double   & =  qParams . H ;
     const   double   & =  qParams . I ;
     const   double   & =  qParams . J ;
    dvec3 pt  =  P  -  center ;
    dvec3 normal ( twoA  *  pt . +  D  *  pt . +  E  *  pt . +  G ,
                    twoB  *  pt . +  D  *  pt . +  F  *  pt . +  H ,
                    twoC  *  pt . +  E  *  pt . +  F  *  pt . +  I );
     return  glm :: normalize ( normal );
}

/**
 *  @fn   ICylinder::ICylinder(const dvec3 &pos, double R, double L, const QuadricParameters &qParams)
 *  @brief    Constructs an implicit representation of a cylinder.
 *  @param    pos     The position.
 *  @param    R       Radius.
 *  @param    L       Length of cylinder.
 *  @param    qParams Quadric parameters.
 */

ICylinder :: ICylinder ( const  dvec3  & pos ,   double  R ,   double  L ,
                     const   QuadricParameters   & qParams )
     :   IQuadricSurface ( qParams ,  pos ),  radius ( R ),  length ( L )   {
}

/**
 *  @fn   void ICylinder::computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const
 *  @brief    Calculates the aq bq cq
 *  @param            ray The ray.
 *  @param  [in,out]  Aq  The aq.
 *  @param  [in,out]  Bq  The bq.
 *  @param  [in,out]  Cq  The cq.
 */

void   ICylinder :: computeAqBqCq ( const   Ray   & ray ,   double   & Aq ,   double   & Bq ,   double   & Cq )   const   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . D ;
     const   double   & =  qParams . E ;
     const   double   & =  qParams . F ;
     const   double   & =  qParams . G ;
     const   double   & =  qParams . H ;
     const   double   & =  qParams . I ;
     const   double   & =  qParams . J ;
    dvec3  Ro   =  ray . origin  -  center ;
     const  dvec3  & Rd   =  ray . dir ;

     Aq   =  A  *   ( Rd . x * Rd . x )   +
        B  *   ( Rd . y * Rd . y )   +
        C  *   ( Rd . z * Rd . z );
     //D * (Rd.x * Rd.y) +
     //E * (Rd.x * Rd.z) +
     //F * (Rd.y * Rd.z);

     Bq   =  twoA  *   Ro . x * Rd . +
        twoB  *   Ro . y * Rd . +
        twoC  *   Ro . z * Rd . z ;
     //D * (Ro.x * Rd.y + Ro.y * Rd.x) +
     //E * (Ro.x * Rd.z + Ro.z * Rd.x) +
     //F * (Ro.y * Rd.z + Ro.z * Rd.y) +
     //G * Rd.x + H * Rd.y + I * Rd.z;

     Cq   =  A  *   ( Ro . *   Ro . x )   +
        B  *   ( Ro . *   Ro . y )   +
        C  *   ( Ro . *   Ro . z )   +
         //D * (Ro.x * Ro.y) +
         //E * (Ro.x * Ro.z) +
         //F * (Ro.y * Ro.z) +
         //G * Ro.x +
         //H * Ro.y +
         //I * Ro.z +
        J ;
}

/**
 *  @fn   ICylinderY::ICylinderY(const dvec3 &pos, double rad, double len) : ICylinder(pos, rad, len, QuadricParameters::cylinderYQParams(rad))
 *  @brief    Constructor
 *  @param    pos The position.
 *  @param    rad The radians.
 *  @param    len The length.
 */

ICylinderY :: ICylinderY ( const  dvec3  & pos ,   double  rad ,   double  len )
     :   ICylinder ( pos ,  rad ,  len ,   QuadricParameters :: cylinderYQParams ( rad ))   {
}

/**
 *  @fn   void ICylinderY::findClosestIntersection(const Ray &ray, HitRecord &hit) const
 *  @brief    Searches for the nearest intersection
 *  @param            ray The ray.
 *  @param  [in,out]  hit The hit.
 */

void   ICylinderY :: findClosestIntersection ( const   Ray   & ray ,   HitRecord   & hit )   const   {
     const  dvec3  & rayOrigin  =  ray . origin ;
     const  dvec3  & rayDirection  =  ray . dir ;
     static   HitRecord  hits [ 2 ];
     int  numHits  =   ICylinder :: findIntersections ( ray ,  hits );
     for   ( int  i  =   0 ;  i  <  numHits ;  i ++ )   {
         if   ( hits [ i ]. interceptPt . <  center . +  length  /   2   &&
            hits [ i ]. interceptPt . >  center . -  length  /   2 )   {
                hit  =  hits [ i ];
                 return ;
         }
     }
    hit . =  FLT_MAX ;
}

/**
@fn    void ICylinderY::getTexCoords(const dvec3 &pt, double &u, double &v) const
@brief     Gets tex coordinates
@param             pt  The point.
@param  [in,out]   u   Tex coordinate u.
@param  [in,out]   v   Tex coordinate v.
*/

void   ICylinderY :: getTexCoords ( const  dvec3  & pt ,   double   & u ,   double   & v )   const   {
     /* CSE 386 - todo  */
    u  =  v  =   0 ;
}

ITriangle :: ITriangle ( const  dvec3  & A ,   const  dvec3  & B ,   const  dvec3  & C )
     :   IShape (),  a ( A ),  b ( B ),  c ( C ),  plane ( IPlane ( A ,  B ,  C ))   {
}

/**
 *  @fn   bool ITriangle::inside(const dvec3 &pt) const
 *  @brief    Insides the given point
 *  @param    pt  The point.
 *  @return   true iff the point is inside the triangle.
 */

bool   ITriangle :: inside ( const  dvec3  & pt )   const   {   // equation 2.35
    dvec3 n  =  glm :: cross ( -  a ,  c  -  a );
     double  n2  =  std :: pow ( glm :: length ( n ),   2.0 );
    dvec3 na  =  glm :: cross ( -  b ,  pt  -  b );
    dvec3 nb  =  glm :: cross ( -  c ,  pt  -  c );
    dvec3 nc  =  glm :: cross ( -  a ,  pt  -  a );
     double  alpha  =  glm :: dot ( n ,  na )   /  n2 ;
     double  beta  =  glm :: dot ( n ,  nb )   /  n2 ;
     double  gamma  =  glm :: dot ( n ,  nc )   /  n2 ;
     return  inRangeExclusive ( beta ,   0 ,   1 )   &&  inRangeExclusive ( gamma ,   0 ,   1 )   &&  inRangeExclusive ( alpha ,   0 ,   1 );
}

/**
 *  @fn   void ITriangle::findClosestIntersection(const Ray &ray, HitRecord &hit) const
 *  @brief    Searches for the nearest intersection
 *  @param            ray The ray.
 *  @param  [in,out]  hit Hit record.
 */

void   ITriangle :: findClosestIntersection ( const   Ray   & ray ,   HitRecord   & hit )   const   {
    plane . findClosestIntersection ( ray ,  hit );
    hit . normal  =  plane . n ;
     if   ( ! inside ( hit . interceptPt ))   {
        hit . =  FLT_MAX ;
     }
}

/**
 *  @fn   IEllipsoid::IEllipsoid(const dvec3 &position, const dvec3 &sz) : IQuadricSurface(QuadricParameters::ellipoidParameters(sz), position)
 *  @brief    Constructs an implicit representation of an ellipsoid.
 *  @param    position    The center of ellipsoid.
 *  @param    sz          The size of ellipsoid.
 */

IEllipsoid :: IEllipsoid ( const  dvec3  & position ,   const  dvec3  & sz )
     :   IQuadricSurface ( QuadricParameters :: ellipsoidQParams ( sz ),  position )   {
}

/**
 *  @fn   void IEllipsoid::computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const
 *  @brief    Calculates the aq bq cq, given a particular ray.
 *  @param            ray The ray.
 *  @param  [in,out]  Aq  Aq.
 *  @param  [in,out]  Bq  Bq.
 *  @param  [in,out]  Cq  Cq.
 */

void   IEllipsoid :: computeAqBqCq ( const   Ray   & ray ,   double   & Aq ,   double   & Bq ,   double   & Cq )   const   {
     const   double   & =  qParams . A ;
     const   double   & =  qParams . B ;
     const   double   & =  qParams . C ;
     const   double   & =  qParams . D ;
     const   double   & =  qParams . E ;
     const   double   & =  qParams . F ;
     const   double   & =  qParams . G ;
     const   double   & =  qParams . H ;
     const   double   & =  qParams . I ;
     const   double   & =  qParams . J ;
    dvec3  Ro   =  ray . origin  -  center ;
     const  dvec3  & Rd   =  ray . dir ;

     Aq   =  A  *   ( Rd . x * Rd . x )   +
        B  *   ( Rd . y * Rd . y )   +
        C  *   ( Rd . z * Rd . z );
     //D * (Rd.x * Rd.y) +
     //E * (Rd.x * Rd.z) +
     //F * (Rd.y * Rd.z);

     Bq   =   2   *  A  *   Ro . x * Rd . +
         2   *  B  *   Ro . y * Rd . +
         2   *  C  *   Ro . z * Rd . z ;
     //D * (Ro.x * Rd.y + Ro.y * Rd.x) +
     //E * (Ro.x * Rd.z + Ro.z * Rd.x) +
     //F * (Ro.y * Rd.z + Ro.z * Rd.y) +
     //G * Rd.x + H * Rd.y + I * Rd.z;

     Cq   =  A  *   ( Ro . *   Ro . x )   +
        B  *   ( Ro . *   Ro . y )   +
        C  *   ( Ro . *   Ro . z )   +
         //D * (Ro.x * Ro.y) +
         //E * (Ro.x * Ro.z) +
         //F * (Ro.y * Ro.z) +
         //G * Ro.x +
         //H * Ro.y +
        I  *   Ro . +  J ;
}

CSE386Fall2020/CSE386Fall2020/IShape.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <vector> #include "HitRecord.h" struct IShape; typedef IShape *IShapePtr; struct VisibleIShape; typedef VisibleIShape *VisibleIShapePtr; /** * @struct Ray * @brief Represents a ray. */ struct Ray { dvec3 origin; //!< starting point for this ray dvec3 dir; //!< direction for this ray, given it's origin Ray(const dvec3 &rayOrigin, const dvec3 &rayDirection) : origin(rayOrigin), dir(glm::normalize(rayDirection)) { } dvec3 getPoint(double t) const { return origin + t * dir; } }; /** * @struct IShape * @brief Base class for all implicit shapes. */ struct IShape { IShape(); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const = 0; virtual void getTexCoords(const dvec3 &pt, double &u, double &v) const; static dvec3 movePointOffSurface(const dvec3 &pt, const dvec3 &n); }; /** * @struct VisibleIShape * @brief A visible implicit shape. */ struct VisibleIShape { Material material; //!< Material for this shape. IShapePtr shape; //!< Pointer to underlying implicit shape. Image *texture; //!< Texture associated with this shape, if any. VisibleIShape(IShapePtr shapePtr, const Material &mat); void findClosestIntersection(const Ray &ray, HitRecord &hit) const; void setTexture(Image *tex); static HitRecord findIntersection(const Ray &ray, const vector<VisibleIShapePtr> &surfaces); }; /** * @struct IPlane * @brief An implicit representation of a plane. */ struct IPlane : public IShape { dvec3 a; //!< point on the plane dvec3 n; //!< plane's normal vector IPlane(const dvec3 &point, const dvec3 &normal); IPlane(const vector<dvec3> &vertices); IPlane(const dvec3 &p1, const dvec3 &p2, const dvec3 &p3); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const; bool onFrontSide(const dvec3 &point) const; void findIntersection(const dvec3 &p1, const dvec3 &p2, double &t) const; }; /** * @struct IDisk * @brief Implicit representation of a disk (i.e., 2D circle) with a particular * center and normal vector. */ struct IDisk : public IShape { IDisk(); IDisk(const dvec3 &position, const dvec3 &n, double rad); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const; dvec3 center; //!< center point of disk dvec3 n; //!< normal vector of disk double radius; }; /** * @struct QuadricParameters * @brief Represents the 9 parameters that describe a quadric. */ struct QuadricParameters { double A, B, C, D, E, F, G, H, I, J; QuadricParameters(); QuadricParameters(const vector<double> &items); QuadricParameters(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j); static QuadricParameters cylinderXQParams(double R); static QuadricParameters cylinderYQParams(double R); static QuadricParameters cylinderZQParams(double R); static QuadricParameters sphereQParams(double R); static QuadricParameters ellipsoidQParams(const dvec3 &sz); }; /** * @struct ITriangle * @brief Implicit representation of triangle. */ struct ITriangle : public IShape { dvec3 a; //!< first vertex. dvec3 b; //!< second vertex. dvec3 c; //!< third vertex. IPlane plane; //!< the plane this triangle lies on. ITriangle(const dvec3 &A, const dvec3 &B, const dvec3 &C); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const; bool inside(const dvec3 &pt) const; }; /** * @struct IQuadricSurface * @brief Implicit representation of quadric surface. These shapes can be * described by the general quadric surface equation */ struct IQuadricSurface : public IShape { dvec3 center; //!< center of quadric IQuadricSurface(const QuadricParameters &params, const dvec3 &position); IQuadricSurface(const vector<double> &params, const dvec3 & position); IQuadricSurface(const dvec3 & position); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const; int findIntersections(const Ray &ray, HitRecord hits[2]) const; dvec3 normal(const dvec3 &pt) const; virtual void computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const; protected: QuadricParameters qParams; //!< The parameters that make up the quadric double twoA; //!< 2*A double twoB; //!< 2*B double twoC; //!< 2*C }; /** * @struct ISphere * @brief Implicit representation of sphere. */ struct ISphere : IQuadricSurface { ISphere(const dvec3 &position, double radius); virtual void getTexCoords(const dvec3 &pt, double &u, double &v) const; virtual void computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const; }; /** * @struct ICylinder * @brief Base class for implicit representation of a cylinder. */ struct ICylinder : public IQuadricSurface { double radius, length; ICylinder(const dvec3 &position, double R, double len, const QuadricParameters &qParams); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const = 0; virtual void computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const; }; /** * @struct ICylinderY * @brief Implicit representation of open cylinder oriented along y-axis coordinate. */ struct ICylinderY : public ICylinder { ICylinderY(const dvec3 &position, double R, double len); virtual void findClosestIntersection(const Ray &ray, HitRecord &hit) const; void getTexCoords(const dvec3 &pt, double &u, double &v) const; }; /** * @struct IEllipsoid * @brief Implicit representation of an ellipsoid. */ struct IEllipsoid : public IQuadricSurface { IEllipsoid(const dvec3 &position, const dvec3 &sz); virtual void computeAqBqCq(const Ray &ray, double &Aq, double &Bq, double &Cq) const; };

CSE386Fall2020/CSE386Fall2020/Light.cpp

CSE386Fall2020/CSE386Fall2020/Light.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "Light.h"

/**
 *  @fn   color ambientColor(const color &mat, const color &light)
 *  @brief    Computes the ambient color produced by a single light at a single point.
 *  @param    mat     Ambient material property.
 *  @param    light   Light's ambient color.
 *  @return   Ambient color.
  */

color ambientColor ( const  color  & mat ,   const  color  & light )   {
     /* CSE 386 - todo  */
     return  mat ;
}

/**
 *  @fn   color diffuseColor(const color &mat, const color &light, const dvec3 &l, const dvec3 &n)
 *  @brief    Computes diffuse color produce by a single light at a single point.
 *  @param    mat         Material.
 *  @param    light       The light.
 *  @param    l           Light vector.
 *  @param    n           Normal vector.
 *  @return   Diffuse color.
 */

color diffuseColor ( const  color  & mat ,   const  color  & light ,
                     const  dvec3  & l ,   const  dvec3  & n )   {
     /* CSE 386 - todo  */
     return  mat ;
}

/**
 *  @fn   color specularColor(const color &mat, const color &light, double shininess, const dvec3 &r, const dvec3 &v)
 *  @brief    Computes specular color produce by a single light at a single point.
 *  @param    mat         Material.
 *  @param    light       The light's color.
 *  @param    shininess   Material shininess.
 *  @param    r           Reflection vector.
 *  @param    v           Viewing vector.
 *  @return   Specular color.
 */

color specularColor ( const  color  & mat ,   const  color  & light ,
                     double  shininess ,
                     const  dvec3  & r ,   const  dvec3  & v )   {
     /* CSE 386 - todo  */
     return  mat ;
}

/**
 *  @fn   color totalColor(const Material &mat, const LightColor &lightColor, const dvec3 &viewingDir, const dvec3 &normal, const dvec3 &lightPos, const dvec3 &intersectionPt, bool attenuationOn, const LightAttenuationParameters &ATparams)
 *  @brief    Color produced by a single light at a single point.
 *  @param    mat             Material.
 *  @param    lightColor      The light's color.
 *  @param    v               The v vector.
 *  @param    n               Normal vector.
 *  @param    lightPos        Light position.
 *  @param    intersectionPt  (x,y,z) of intersection point.
 *  @param    attenuationOn   true if attenuation is on.
 *  @param    ATparams        Attenuation parameters.
 *  @return   Color produced by a single light at a single point.
 */
 
color totalColor ( const   Material   & mat ,   const   LightColor   & lightColor ,
                 const  dvec3  & v ,   const  dvec3  & n ,
                 const  dvec3  & lightPos ,   const  dvec3  & intersectionPt ,
                 bool  attenuationOn ,  
                 const   LightATParams   & ATparams )   {
     /* CSE 386 - todo  */
     if   ( DEBUG_PIXEL )   {
        cout  <<  endl ;
     }
     return  mat . ambient ;
}

/**
 *  @fn   color PositionalLight::illuminate(const dvec3 &interceptWorldCoords, const dvec3 &normal, const Material &material, const Frame &eyeFrame, bool inShadow) const
 *  @brief    Computes the color this light produces in raytracing applications.
 *  @param    interceptWorldCoords                The surface properties of the intercept point.
 *  @param    normal                  The normal vector.
 *  @param    material            The object's material properties.
 *  @param    eyeFrame            The coordinate frame of the camera.
 *  @param    inShadow            true if the point is in a shadow.
 *  @return   The color produced at the intercept point, given this light.
 */

color  PositionalLight :: illuminate ( const  dvec3  & interceptWorldCoords ,
                                     const  dvec3  & normal ,
                                     const   Material   & material ,
                                     const   Frame   & eyeFrame ,   bool  inShadow )   const   {
     /* CSE 386 - todo  */
     return  material . ambient ;
}

/**
 *  @fn   color SpotLight::illuminate(const dvec3 &interceptWorldCoords, const dvec3 &normal, const Material &material, const Frame &eyeFrame, bool inShadow) const
 *  @brief    Computes the color this light produces in raytracing applications.
 *  @param    interceptWorldCoords                The surface properties of the intercept point.
 *  @param    normal                  The normal vector.
 *  @param    material            The object's material properties.
 *  @param    eyeFrame            The coordinate frame of the camera.
 *  @param    inShadow            true if the point is in a shadow.
 *  @return   The color produced at the intercept point, given this light.
 */

color  SpotLight :: illuminate ( const  dvec3  & interceptWorldCoords ,
                             const  dvec3  & normal ,
                             const   Material   & material ,
                             const   Frame   & eyeFrame ,   bool  inShadow )   const   {
     /* CSE 386 - todo  */
     return  material . ambient ;
}

/**
@fn    ostream &operator << (ostream &os, const LightAttenuationParameters &at)
@brief     Output stream for light attenuation parameters.
@param     os      Output stream.
@param     at      Attenuation parameters.
@return    The output stream.
*/

ostream  & operator   <<   ( ostream  & os ,   const   LightATParams   & at )   {
    os  <<  dvec3 ( at . constant ,  at . linear ,  at . quadratic )   <<  endl ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const PositionalLight &pl)
@brief     Output stream for light attenuation parameters.
@param     os      Output stream.
@param     pl      Positional light.
@return    The output stream.
*/

ostream  & operator   <<   ( ostream  & os ,   const   PositionalLight   & pl )   {
    os  <<   ( pl . isOn  ?   "ON"   :   "OFF" )   <<  endl ;
    os  <<   ( pl . isTiedToWorld ?   "WORLD"   :   "CAMERA" )   <<  endl ;
    os  <<   " position "   <<  pl . pos  <<  endl ;
    os  <<   " ambient "   <<  pl . lightColor . ambient  <<  endl ;
    os  <<   " diffuse "   <<  pl . lightColor . diffuse  <<  endl ;
    os  <<   " specular "   <<  pl . lightColor . specular  <<  endl ;
    os  <<   "Attenuation: "   <<   ( pl . attenuationIsTurnedOn  ?   "ON"   :   "OFF" )
         <<   " "   <<  pl . atParams  <<  endl ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const SpotLight &sl)
@brief     Output stream for light attenuation parameters.
@param     os      Output stream.
@param     sl      Spotlight.
@return    The output stream.
*/

ostream  & operator   <<   ( ostream  & os ,   const   SpotLight   & sl )   {
     PositionalLight  pl  =   ( sl );
    os  <<  pl ;
    os  <<   " FOV "   <<  sl . fov  <<  endl ;
     return  os ;
}


ostream  & operator   <<   ( ostream  & os ,   const   LightColor   & light )   {
    os  <<   "Light Color: "   <<  light . ambient  <<   ' '   <<  light . diffuse  <<
                 ' '   <<  light . specular ;
     return  os ;
}

CSE386Fall2020/CSE386Fall2020/Light.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <iostream> #include <vector> #include "Defs.h" #include "HitRecord.h" /** * @struct LightATParams * @brief A light attenuation parameters. */ struct LightATParams { double constant, linear, quadratic; //!< Parameters controlling attenuation. LightATParams(double C, double L, double Q) { constant = C; linear = L; quadratic = Q; } double factor(double distance) const { return 1.0 / (constant + linear * distance + quadratic * distance * distance); } friend ostream &operator << (ostream &os, const LightATParams &at); }; /** * @struct LightColor * @brief Represents the colors of each light component. */ struct LightColor { color ambient, diffuse, specular; //!< The three light components. LightColor(const color &amb, const color &dif, const color &spec) : ambient(amb), diffuse(dif), specular(spec) { } LightColor(const color &oneColor) : ambient(oneColor), diffuse(oneColor), specular(oneColor) { } LightColor(const vector<double> &C) : LightColor(color(C[0], C[1], C[2]), color(C[3], C[4], C[5]), color(C[6], C[7], C[8])) { } }; /** * @struct LightSource * @brief A generic light source. */ struct LightSource { bool isOn; //!< True if the light is active; otherwise, has no effect. LightSource() { isOn = true; } virtual color illuminate(const dvec3 &interceptWorldCoords, const dvec3 &normal, const Material &material, const Frame &eyeFrame, bool inShadow) const = 0; }; /** * @struct PositionalLight * @brief Represents a simple positional light source. */ struct PositionalLight : public LightSource { dvec3 pos; //!< The position of the light. bool attenuationIsTurnedOn; //!< true if attenuation is active. bool isTiedToWorld; //!< true if the position is in world (or eye) coordinates. LightATParams atParams; LightColor lightColor; PositionalLight(const dvec3 &position, const LightColor &color) : LightSource(), lightColor(color), pos(position), atParams(1.0, 0.0, 0.0) { attenuationIsTurnedOn = false; isTiedToWorld = true; } void setAttenuation(bool isOn) { attenuationIsTurnedOn = isOn; } void setAttenuationParams(const LightATParams &params) { atParams = params; } virtual color illuminate(const dvec3 &interceptWorldCoords, const dvec3 &normal, const Material &material, const Frame &eyeFrame, bool inShadow) const; friend ostream &operator << (ostream &os, const PositionalLight &pl); }; /** * @struct SpotLight * @brief A spot light. */ struct SpotLight : public PositionalLight { double fov; //!< Field of view of the light. dvec3 spotDir; //!< Direction of spotlight. SpotLight(const dvec3 &position, const dvec3 &dir, double angleInRadians, const LightColor &lightColor) : PositionalLight(position, lightColor), spotDir(dir), fov(angleInRadians) { } virtual color illuminate(const dvec3 &interceptWorldCoords, const dvec3 &normal, const Material &material, const Frame &eyeFrame, bool inShadow) const; friend ostream &operator << (ostream &os, const SpotLight &pl); }; const LightColor pureWhiteLight(vector<double>{1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}); color ambientColor(const color &matAmbient, const color &lightAmbient); color diffuseColor(const color &matDiffuse, const color &lightDiffuse, const dvec3 &l, const dvec3 &n); color specularColor(const color &mat, const color &light, double shininess, const dvec3 &r, const dvec3 &v); color totalColor(const Material &mat, const LightColor &lightColor, const dvec3 &v, const dvec3 &n, const dvec3 &lightPos, const dvec3 &intersectionPt, bool attenuationOn, const LightATParams &ATparams); typedef LightSource *LightSourcePtr; typedef PositionalLight *PositionalLightPtr; typedef SpotLight *SpotLightPtr; ostream &operator << (ostream &os, const LightColor &light);

CSE386Fall2020/CSE386Fall2020/packages.config

CSE386Fall2020/CSE386Fall2020/Rasterization.cpp

CSE386Fall2020/CSE386Fall2020/Rasterization.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   < cmath >
#include   "Rasterization.h"

/**
@fn    template <class T> T barycentricWeighting(double w1, double w2, double w3, const T &i1, const T &i2, const T &i3)
@brief     Computes the Barycentric weighting of three values.
@tparam    T   Generic type parameter.
@param     w1  The first weight.
@param     w2  The second weight.
@param     w3  The third weight.
@param     i1  The first item.
@param     i2  The second item.
@param     i3  The third item.
@return    The Barycentric weighting of the three items.
*/

template   < class  T >
T barycentricWeighting ( double  w1 ,   double  w2 ,   double  w3 ,   const  T  & i1 ,   const  T  & i2 ,   const  T  & i3 )   {
     return  w1 * i1  +  w2 * i2  +  w3 * i3 ;
}

/**
 *  @fn   void drawVerticalLine(FrameBuffer &fb, int x, int bottom, int top, const color &rgb)
 *  @brief    Draw vertical line
 *  @param  [in,out]  fb      Framebuffer
 *  @param            x       The x coordinate.
 *  @param            bottom  Bottom.
 *  @param            top     Top.
 *  @param            rgb     Color.
 */

static   void  drawVerticalLine ( FrameBuffer   & fb ,   int  x ,   int  bottom ,   int  top ,   const  color  & rgb )   {
     const   int  H  =  fb . getWindowHeight ();
     const   int  W  =  fb . getWindowWidth ();

     if   ( bottom  >  top )   {
        std :: swap ( bottom ,  top );
     }

    bottom  =  bottom  <   0   ?   0   :  bottom ;
    top  =  top  >=  H  ?  H  -   1   :  top ;
     for   ( int  y  =  bottom ;  y  <=  top ;  y ++ )   {
         if   ( inRectangle (( double ) x ,   ( double ) y ,   0.0 ,   0.0 ,  W - 1.0 ,  H - 1.0 ))
            fb . setColor ( x ,  y ,  rgb );
     }
}

/**
 *  @fn   void drawHorizontalLine(FrameBuffer &fb, int y, int left, int right, const color &rgb)
 *  @brief    Draw horizontal line
 *  @param  [in,out]  fb      Framebuffer
 *  @param            y       The y coordinate.
 *  @param            left    Left.
 *  @param            right   Right.
 *  @param            rgb     Color.
 */

static   void  drawHorizontalLine ( FrameBuffer   & fb ,   int  y ,   int  left ,   int  right ,   const  color  & rgb )   {
     const   int  H  =  fb . getWindowHeight ();
     const   int  W  =  fb . getWindowWidth ();

     if   ( left  >  right )   {
        std :: swap ( left ,  right );
     }
    left  =  left  <   0   ?   0   :  left ;
    right  =  right  >=  W  ?  W  -   1   :  right ;
     for   ( int  x  =  left ;  x  <=  right ;  x ++ )   {
         if   ( inRectangle (( double ) x ,   ( double ) y ,   0.0 ,   0.0 ,  W  -   1.0 ,  H  -   1.0 ))
            fb . setColor ( x ,  y ,  rgb );
     }
}

/**
 *  @fn   void drawBresenhamLine(FrameBuffer &fb, const dvec2 &p1, const dvec2 &p2, const color &rgb)
 *  @brief    Draw line using bresenham's algorithm
 *  @param  [in,out]  fb  Framebuffer.
 *  @param            p1  First point.
 *  @param            p2  Second point.
 *  @param            rgb Color.
 */

static   void  drawBresenhamLine ( FrameBuffer   & fb ,  
                         const  dvec2  & p1 ,  
                         const  dvec2  & p2 ,   const  color  & rgb )   {
     const   int  H  =  fb . getWindowHeight ();
     const   int  W  =  fb . getWindowWidth ();

     int  x0  =   ( int ) p1 . x ;
     int  y0  =   ( int ) p1 . y ;
     int  x1  =   ( int ) p2 . x ;
     int  y1  =   ( int ) p2 . y ;

     int  dx  =  std :: abs ( x1  -  x0 );
     int  dy  =  std :: abs ( y1  -  y0 );

     int  sx  =  x0  <  x1  ?   1   :   - 1 ;
     int  sy  =  y0  <  y1  ?   1   :   - 1 ;

     int  err  =  dx  -  dy ;

     if   ( inRectangle (( double ) x0 ,   ( double ) y0 ,   0.0 ,   0.0 ,  W  -   1.0 ,  H  -   1.0 ))   {
        fb . setColor ( x0 ,  y0 ,  rgb );
     }

     while   ( x0  !=  x1  ||  y0  !=  y1 )   {
         int  e2  =  err  <<   1 ;

         if   ( e2  >   - dy )   {
            err  -=  dy ;
            x0  +=  sx ;
         }
         if   ( e2  <  dx )   {
            err  +=  dx ;
            y0  +=  sy ;
         }

         if   ( inRectangle (( double ) x0 ,   ( double ) y0 ,   0.0 ,   0.0 ,  W  -   1.0 ,  H  -   1.0 ))   {
            fb . setColor ( x0 ,  y0 ,  rgb );
         }
     }
}

/**
 *  @fn   void drawLine(FrameBuffer &fb, const dvec2 &A, const dvec2 &B, const color &rgb)
 *  @brief    Draw line
 *  @param  [in,out]  fb  Framebuffer.
 *  @param            A   First endpoint.
 *  @param            B   Second endpoint.
 *  @param            rgb Color.
 */

void  drawLine ( FrameBuffer   & fb ,   const  dvec2  & A ,   const  dvec2  & B ,   const  color  & rgb )   {
     if   ( A . ==  B . x )   {
        drawVerticalLine ( fb ,   ( int ) A . x ,   ( int ) A . y ,   ( int ) B . y ,  rgb );
     }   else   if   ( A . ==  B . y )   {
        drawHorizontalLine ( fb ,   ( int ) A . y ,   ( int ) A . x ,   ( int ) B . x ,  rgb );
     }   else   {
        drawBresenhamLine ( fb ,  A . xy (),  B . xy (),  rgb );
     }
}

/**
 *  @fn   void drawLine(FrameBuffer &frameBuffer, int x1, int y1, int x2, int y2, const color &C)
 *  @brief    Draw line from (x1, y1) to (x2, y2)
 *  @param  [in,out]  frameBuffer Framebuffer.
 *  @param            x1  x value of first corner
 *  @param            y1  y value of first corner
 *  @param            x2  x second of first corner
 *  @param            y2  y value of second corner
 *  @param            C   The color
 */

void  drawLine ( FrameBuffer   & frameBuffer ,   int  x1 ,   int  y1 ,   int  x2 ,   int  y2 ,   const  color  & C )   {
    drawLine ( frameBuffer ,  dvec2 ( x1 ,  y1 ),  dvec2 ( x2 ,  y2 ),  C );
}

/**
 *  @fn   void drawArc(FrameBuffer &fb, const dvec2 &center, double R, double startRads, double lengthInRads, const color &rgb)
 *  @brief    Draw arc on xy plane, using traditional x-y axis orientation. Zero degrees is
 *          +x axis, 90 degrees, is +y axis, etc.
 *  @param  [in,out]  fb              Framebuffer.
 *  @param            center          The center of the "circle".
 *  @param            R               Radius.
 *  @param            startRads       The start of the arc, in radians.
 *  @param            lengthInRads    The length of the arc, in radians.
 *  @param            rgb             Color.
 */

void  drawArc ( FrameBuffer   & fb ,   const  dvec2  & center ,   double  R ,
                     double  startRads ,   double  lengthInRads ,   const  color  & rgb )   {
     double  lengthInPixels  =   2   *  PI  *  R ;
     int  DIV  =   ( int ) std :: fmax (( lengthInPixels  /   5 ),   4 );
     double  radInc  =  lengthInRads  /  DIV ;
     for   ( int  i  =   0 ;  i  <  DIV ;  i ++ )   {
         double  a1  =  startRads  +  i  *  radInc ;
         double  a2  =  a1  +  radInc ;
        dvec2 pt1  =  pointOnCircle ( center ,  R ,  a1 );
        dvec2 pt2  =  pointOnCircle ( center ,  R ,  a2 );
        drawLine ( fb ,  pt1 ,  pt2 ,  rgb );
     }
}

/**
 *  @fn   void drawWirePolygon(FrameBuffer &fb, const vector<dvec3> &pts, const color &rgb)
 *  @brief    Draw wire polygon
 *  @param  [in,out]  fb  Framebuffere.
 *  @param            pts The vertices of the polygon.
 *  @param            rgb Color.
 */

void  drawWirePolygon ( FrameBuffer   & fb ,   const  vector < dvec3 >   & pts ,   const  color  & rgb )   {
     for   ( unsigned   int  i  =   1 ;  i  <  pts . size ();  i ++ )   {
        drawLine ( fb ,  pts [ -   1 ]. xy (),  pts [ i ]. xy (),  rgb );
     }
    drawLine ( fb ,  pts [ 0 ]. xy (),  pts [ pts . size ()   -   1 ]. xy (),  rgb );
}

/**
 *  @fn   void drawAxisOnWindow(FrameBuffer &fb)
 *  @brief    Draw the x & y axis on window, centered on window
 *  @param  [in,out]  fb  Framebuffer.
 */

void  drawAxisOnWindow ( FrameBuffer   & fb )   {
     int  W  =  fb . getWindowWidth ();
     int  H  =  fb . getWindowHeight ();
     int  W2  =  W  /   2 ;
     int  H2  =  H  /   2 ;
    drawHorizontalLine ( fb ,  H2 ,   0 ,  W - 1 ,  red );
    drawVerticalLine ( fb ,  W2 ,   0 ,  H - 1 ,  green );
}

/**
 *  @fn   double cheapNonPerspectiveCorrectInterpolationForLines(const dvec2 &start, const dvec2 &end, const dvec2 &online)
 *  @brief    Cheap non perspective correct interpolation for lines
 *  @param    start   The starting vertex.
 *  @param    end     The ending vertex
 *  @param    online  The 2D point to interpolate.
 *  @return   Interpolated value.
 */

static   double  cheapNonPerspectiveCorrectInterpolationForLines ( const  dvec2  & start ,   const  dvec2  & end ,   const  dvec2  & online )   {
     return  glm :: length ( online  -  start )   /  glm :: length ( end  -  start );
}

/**
 *  @fn   void drawVerticalLine(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, VertexData v0, VertexData v1, const dmat4 &viewingMatrix)
 *  @brief    Draw vertical line
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            v0              The first endpoint.
 *  @param            v1              The second endpoint.
 *  @param            viewingMatrix   The viewing matrix.
 */

static   void  drawVerticalLine ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,
                         const  vector < LightSourcePtr >   & lights ,   VertexData  v0 ,   VertexData  v1 ,
                         const  dmat4  & viewingMatrix )   {
     if   ( v1 . pos . <  v0 . pos . y )   {
        std :: swap ( v0 ,  v1 );
     }

     double  zDifference  =  v1 . pos . -  v0 . pos . z ;

     for   ( double  y  =  v0 . pos . y ;  y  <  v1 . pos . y ;  y ++ )   {
         // Interpolate vertex attributes
         double  weight  =  cheapNonPerspectiveCorrectInterpolationForLines ( v0 . pos . xy (),  v1 . pos . xy (),  dvec2 ( v0 . pos . x ,  y ));

         Fragment  fragment ;

         // Interpolate vertex attributes using alpha, beta, and gamma weights
         double  oneMinusW  =   1.0   -  weight ;
        fragment . material  =  weightedAverage ( oneMinusW ,  v0 . material ,  weight ,  v1 . material );
         double  z  =  weightedAverage ( oneMinusW ,  v0 . pos . z ,  weight ,  v1 . pos . z );
        fragment . worldNormal  =  weightedAverage ( oneMinusW ,  v0 . normal ,  weight ,  v1 . normal );
        fragment . worldPos  =  weightedAverage ( oneMinusW ,  v0 . worldPos ,  weight ,  v1 . worldPos );
        fragment . windowPos  =  dvec3 ( v0 . pos . x ,  y ,  z );

         FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );
     }
}

/**
 *  @fn   static void drawHorizontalLine(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, VertexData v0, VertexData v1, const dmat4 &viewingMatrix)
 *  @brief    Draw horizontal line
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            v0              The first endpoint.
 *  @param            v1              The second endpoint.
 *  @param            viewingMatrix   The viewing matrix.
 */

static   void  drawHorizontalLine ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,
                     const  vector < LightSourcePtr >   & lights ,   VertexData  v0 ,   VertexData  v1 ,
                     const  dmat4  & viewingMatrix )   {
     if   ( v1 . pos . <  v0 . pos . x )   {
        std :: swap ( v0 ,  v1 );
     }

     for   ( double  x  =  v0 . pos . x ;  x  <  v1 . pos . x ;  x ++ )   {
         // Interpolate vertex attributes
         double  weight  =  cheapNonPerspectiveCorrectInterpolationForLines ( v0 . pos . xy (),  v1 . pos . xy (),  dvec2 ( x ,  v0 . pos . y ));

         Fragment  fragment ;

         // Interpolate vertex attributes using alpha, beta, and gamma weights
        fragment . material  =  weightedAverage ( 1.0   -  weight ,  v0 . material ,  weight ,  v1 . material );
         double  z  =  weightedAverage ( 1   -  weight ,  v0 . pos . z ,  weight ,  v1 . pos . z );
        fragment . worldNormal  =  weightedAverage ( 1.0   -  weight ,  v0 . normal ,  weight ,  v1 . normal );
        fragment . worldPos  =  weightedAverage ( 1.0   -  weight ,  v0 . worldPos ,  weight ,  v1 . worldPos );
        fragment . windowPos  =  dvec3 ( x ,  v1 . pos . y ,  z );

         FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );
     }
}

/**
 *  @fn   static void midPointLine(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, VertexData v0, VertexData v1, const dmat4 &viewingMatrix)
 *  @brief    Middle point line
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            v0              The first endpoint.
 *  @param            v1              The second endpoint.
 *  @param            viewingMatrix   The viewing matrix.
 */

static   void  midPointLine ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,  
                     const  vector < LightSourcePtr >   & lights ,   VertexData  v0 ,   VertexData  v1 ,
                     const  dmat4  & viewingMatrix )   {
     if   ( v1 . pos . <  v0 . pos . x )   {
        std :: swap ( v0 ,  v1 );
     }

     // Calculate slope of the line
     double  m  =   ( v1 . pos . -  v0 . pos . y )   /   ( v1 . pos . -  v0 . pos . x );

     if   ( >   0   &&  m  <   1.0 )   {   // For slope in (0,1] More "run" than "rise"
         double  y  =  v0 . pos . y ;

         for   ( double  x  =  v0 . pos . x ;  x  <  v1 . pos . x ;  x  +=   1.0 )   {

             // Interpolate vertex attributes
             double  weight  =  cheapNonPerspectiveCorrectInterpolationForLines ( v0 . pos . xy (),  v1 . pos . xy (),  dvec2 ( x ,  y ));

             Fragment  fragment ;

             // Interpolate vertex attributes using alpha, beta, and gamma weights
            fragment . material  =  weightedAverage ( 1.0   -  weight ,  v0 . material ,  weight ,  v1 . material );
             double  z  =  weightedAverage ( 1   -  weight ,  v0 . pos . z ,  weight ,  v1 . pos . z );
            fragment . worldNormal  =  weightedAverage ( 1.0   -  weight ,  v0 . normal ,  weight ,  v1 . normal );
            fragment . worldPos  =  weightedAverage ( 1.0   -  weight ,  v0 . worldPos ,  weight ,  v1 . worldPos );
            fragment . windowPos  =  dvec3 ( x ,  y ,  z );

             FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );

             // Evaluate the implicit equation for the line to determine if
             // the line will be above the midpoint between the pixel centers.
             double  fXY  =   ( v0 . pos . -  v1 . pos . y )   *   ( +   1.0 )   +
                 ( v1 . pos . -  v0 . pos . x )   *   ( +   0.5 )   +
                v0 . pos . *  v1 . pos . -  v1 . pos . *  v0 . pos . y ;

             if   ( fXY  <   0 )   {
                y  +=   1.0 ;
             }
         }
     }   else   if   ( >   1 )   {   // For slope in (1,infinity] More "run" than "rise"
         double  x  =  v0 . pos . x ;

         for   ( double  y  =  v0 . pos . y ;  y  <  v1 . pos . y ;  y  +=   1.0 )   {

             // Interpolate vertex attributes
             double  weight  =  cheapNonPerspectiveCorrectInterpolationForLines ( v0 . pos . xy (),  v1 . pos . xy (),  dvec2 ( x ,  y ));

             Fragment  fragment ;

             // Interpolate vertex attributes using alpha, beta, and gamma weights
            fragment . material  =  weightedAverage ( 1.0   -  weight ,  v0 . material ,  weight ,  v1 . material );
             double  z  =  weightedAverage ( 1   -  weight ,  v0 . pos . z ,  weight ,  v1 . pos . z );
            fragment . worldNormal  =  weightedAverage ( 1.0   -  weight ,  v0 . normal ,  weight ,  v1 . normal );
            fragment . worldPos  =  weightedAverage ( 1.0   -  weight ,  v0 . worldPos ,  weight ,  v1 . worldPos );
            fragment . windowPos  =  dvec3 ( x ,  y ,  z );

             FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );

             // Evaluate the implicit equation for the line to determine if
             // the line will be left or right the midpoint between the pixel centers.
             double  fXY  =   ( v0 . pos . -  v1 . pos . y )   *   ( +   0.5 )   +
                 ( v1 . pos . -  v0 . pos . x )   *   ( +   1.0 )   +
                v0 . pos . *  v1 . pos . -  v1 . pos . *  v0 . pos . y ;

             if   ( fXY  >   0 )   {
                x  +=   1.0 ;
             }
         }
     }   else   if   ( >=   - 1.0   &&  m  <   0 )   {   // For slope in [-1,0) More "run" than "rise"
         double  y  =  v0 . pos . y ;
         double  x  =  v0 . pos . x ;

         for   ( double  x  =  v0 . pos . x ;  x  <  v1 . pos . x ;  x  +=   1.0 )   {
             // Interpolate vertex attributes
             double  weight  =  cheapNonPerspectiveCorrectInterpolationForLines ( v0 . pos . xy (),  v1 . pos . xy (),  dvec2 ( x ,  y ));

             Fragment  fragment ;

             // Interpolate vertex attributes using alpha, beta, and gamma weights
            fragment . material  =  weightedAverage ( 1.0   -  weight ,  v0 . material ,  weight ,  v1 . material );
             double  z  =  weightedAverage ( 1   -  weight ,  v0 . pos . z ,  weight ,  v1 . pos . z );
            fragment . worldNormal  =  weightedAverage ( 1.0   -  weight ,  v0 . normal ,  weight ,  v1 . normal );
            fragment . worldPos  =  weightedAverage ( 1.0   -  weight ,  v0 . worldPos ,  weight ,  v1 . worldPos );
            fragment . windowPos  =  dvec3 ( x ,  y ,  z );

             FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );

             // Evaluate the implicit equation for the line to determine if
             // the line will be below the midpoint between the pixel centers.
             double  fXY  =   ( v0 . pos . -  v1 . pos . y )   *   ( +   1.0 )   +
                 ( v1 . pos . -  v0 . pos . x )   *   ( -   0.5 )   +
                v0 . pos . *  v1 . pos . -  v1 . pos . *  v0 . pos . y ;

             if   ( fXY  >   0 )   {
                y  -=   1.0 ;
             }
         }
     }   else   if   ( <   - 1 )   {   // For slope in [-infinity,-1) More "run" than "rise"
         double  x  =  v0 . pos . x ;

         for   ( double  y  =  v0 . pos . y ;  y  >  v1 . pos . y ;  y  -=   1.0 )   {

             // Interpolate vertex attributes
             double  weight  =  cheapNonPerspectiveCorrectInterpolationForLines ( v0 . pos . xy (),  v1 . pos . xy (),  dvec2 ( x ,  y ));

             Fragment  fragment ;

             // Interpolate vertex attributes using alpha, beta, and gamma weights
            fragment . material  =  weightedAverage ( 1.0   -  weight ,  v0 . material ,  weight ,  v1 . material );
             double  z  =  weightedAverage ( 1   -  weight ,  v0 . pos . z ,  weight ,  v1 . pos . z );
            fragment . worldNormal  =  weightedAverage ( 1.0   -  weight ,  v0 . normal ,  weight ,  v1 . normal );
            fragment . worldPos  =  weightedAverage ( 1.0   -  weight ,  v0 . worldPos ,  weight ,  v1 . worldPos );
            fragment . windowPos  =  dvec3 ( x ,  y ,  z );

             FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );

             // Evaluate the implicit equation for the line to determine if
             // the line will be left or right the midpoint between the pixel centers.
             double  fXY  =   ( v0 . pos . -  v1 . pos . y )   *   ( +   0.5 )   +
                 ( v1 . pos . -  v0 . pos . x )   *   ( -   1.0 )   +
                v0 . pos . *  v1 . pos . -  v1 . pos . *  v0 . pos . y ;

             if   ( fXY  <   0 )   {
                x  +=   1.0 ;
             }
         }
     }
}

/**
 *  @fn   void drawLine(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const VertexData &v0, const VertexData &v1, const dmat4 &viewingMatrix)
 *  @brief    Draw line
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            v0              The first endpoint.
 *  @param            v1              The second endpoint.
 *  @param            viewingMatrix   The viewing matrix.
 */

void  drawLine ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,  
                 const  vector < LightSourcePtr >   & lights ,  
                 const   VertexData   & v0 ,   const   VertexData   & v1 ,
                     const  dmat4  & viewingMatrix )   {
     if   ( v0 . pos . ==  v1 . pos . x )   {
        drawVerticalLine ( frameBuffer ,  eyePos ,  lights ,  v0 ,  v1 ,  viewingMatrix );
     }   else   if   ( v0 . pos . ==  v1 . pos . y )   {
        drawHorizontalLine ( frameBuffer ,  eyePos ,  lights ,  v0 ,  v1 ,  viewingMatrix );
     }   else   {
        midPointLine ( frameBuffer ,  eyePos ,  lights ,  v0 ,  v1 ,  viewingMatrix );
     }
}

/**
 *  @fn   void drawManyLines(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const vector<VertexData> &vertices, const dmat4 &viewingMatrix)
 *  @brief    Draw many lines
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            vertices        Vector of vertice-pairs.
 *  @param            viewingMatrix   Viewing matrix.
 */

void  drawManyLines ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,
                     const  vector < LightSourcePtr >   & lights ,  
                     const  vector < VertexData >   & vertices ,
                     const  dmat4  & viewingMatrix )   {
     for   ( unsigned   int  i  =   0 ;   ( +   1 )   <  vertices . size ();  i  +=   2 )   {
        drawLine ( frameBuffer ,  eyePos ,  lights ,  vertices [ i ],  vertices [ +   1 ],  viewingMatrix );
     }
}

/**
 *  @fn   void drawWireFrameTriangle(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const VertexData &v0, const VertexData &v1, const VertexData &v2, const dmat4 &viewingMatrix)
 *  @brief    Draw wire frame triangle.
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            v0              First VertexData.
 *  @param            v1              Second VertexData.
 *  @param            v2              Third VertexData.
 *  @param            viewingMatrix   Viewing matrix.
 */

void  drawWireFrameTriangle ( FrameBuffer   & frameBuffer ,
                             const  dvec3  & eyePos ,
                             const  vector < LightSourcePtr >   & lights ,  
                             const   VertexData   & v0 ,  
                             const   VertexData   & v1 ,  
                             const   VertexData   & v2 ,
                             const  dmat4  & viewingMatrix )   {
    drawLine ( frameBuffer ,  eyePos ,  lights ,  v0 ,  v1 ,  viewingMatrix );
    drawLine ( frameBuffer ,  eyePos ,  lights ,  v1 ,  v2 ,  viewingMatrix );
    drawLine ( frameBuffer ,  eyePos ,  lights ,  v2 ,  v0 ,  viewingMatrix );
}

/**
 *  @fn   void drawManyWireFrameTriangles(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const vector<VertexData> &vertices, const dmat4 &viewingMatrix)
 *  @brief    Draw many wire frame triangles
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            vertices        The vector of vertex-triplets.
 *  @param            viewingMatrix   Viewing matrix.
 */

void  drawManyWireFrameTriangles ( FrameBuffer   & frameBuffer ,  
                                     const  dvec3  & eyePos ,
                                     const  vector < LightSourcePtr >   & lights ,
                                     const  vector < VertexData >   & vertices ,
                                     const  dmat4  & viewingMatrix )   {
     for   ( unsigned   int  i  =   0 ;   ( +   2 )   <  vertices . size ();  i  +=   3 )   {
        drawWireFrameTriangle ( frameBuffer ,  eyePos ,  lights ,  
                                vertices [ i ],  vertices [ +   1 ],  vertices [ +   2 ],  viewingMatrix );
     }
}

/**
 *  @fn   static inline double f01(const VertexData &v0, const VertexData &v1, const VertexData &v2, double x, double y)
 *  @brief    Computes f01. Implicit equation for the line between v0 and v1.
 *  @see      *** page in textbook.
 *  @param    v0  v0.
 *  @param    v1  v1.
 *  @param    v2  v2.
 *  @param    x   x coordinate.
 *  @param    y   y coordinate.
 *  @return   f01.
 */

static   inline   double  f01 ( const   VertexData   & v0 ,   const   VertexData   & v1 ,   const   VertexData   & v2 ,   double  x ,   double  y )   {
     return   ( v0 . pos . -  v1 . pos . y )   *  x  +   ( v1 . pos . -  v0 . pos . x )   *  y  +
         ( v0 . pos . *  v1 . pos . y )   -   ( v1 . pos . *  v0 . pos . y );

}

/**
 *  @fn   static inline double f12(const VertexData &v0, const VertexData &v1, const VertexData &v2, double x, double y)
 *  @brief    Computes f12. Implicit equation for the line between v1 and v2.
 *  @see      *** page in textbook.
 *  @param    v0  v0.
 *  @param    v1  v1.
 *  @param    v2  v2.
 *  @param    x   x coordinate.
 *  @param    y   y coordinate.
 *  @return   f12.
 */

static   inline   double  f12 ( const   VertexData   & v0 ,   const   VertexData   & v1 ,   const   VertexData   & v2 ,   double  x ,   double  y )   {
     return   ( v1 . pos . -  v2 . pos . y )   *  x  +   ( v2 . pos . -  v1 . pos . x )   *  y  +
         ( v1 . pos . *  v2 . pos . y )   -   ( v2 . pos . *  v1 . pos . y );

}

/**
 *  @fn   static inline double f20(const VertexData &v0, const VertexData &v1, const VertexData &v2, double x, double y)
 *  @brief    Computes f20. Implicit equation for the line between v2 and v0.
 *  @see      *** page in textbook.
 *  @param    v0  v0.
 *  @param    v1  v1.
 *  @param    v2  v2.
 *  @param    x   x coordinate.
 *  @param    y   y coordinate.
 *  @return   f02.
 */

static   inline   double  f20 ( const   VertexData   & v0 ,   const   VertexData   & v1 ,   const   VertexData   & v2 ,   double  x ,   double  y )   {
     return   ( v2 . pos . -  v0 . pos . y )   *  x  +   ( v0 . pos . -  v2 . pos . x )   *  y  +
         ( v2 . pos . *  v0 . pos . y )   -   ( v0 . pos . *  v2 . pos . y );

}

/**
 *  @fn   void drawFilledTriangle(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const VertexData &v0, const VertexData &v1, const VertexData &v2, const dmat4 &viewingMatrix)
 *  @brief    Draw filled triangle.
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            v0              v0.
 *  @param            v1              v1.
 *  @param            v2              v2.
 *  @param            viewingMatrix   Viewing matrix.
 */

void  drawFilledTriangle ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,   const  vector < LightSourcePtr >   & lights ,
                         const   VertexData   & v0 ,   const   VertexData   & v1 ,   const   VertexData   & v2 ,
                         const  dmat4  & viewingMatrix )   {
     // Find minimimum and maximum x and y limits for the triangle
     double  xMin  =  glm :: floor ( min ( v0 . pos . x ,  v1 . pos . x ,  v2 . pos . x ));
     double  xMax  =  glm :: ceil ( max ( v0 . pos . x ,  v1 . pos . x ,  v2 . pos . x ));
     double  yMin  =  glm :: floor ( min ( v0 . pos . y ,  v1 . pos . y ,  v2 . pos . y ));
     double  yMax  =  glm :: ceil ( max ( v0 . pos . y ,  v1 . pos . y ,  v2 . pos . y ));

     double  fAlpha  =  f12 ( v0 ,  v1 ,  v2 ,  v0 . pos . x ,  v0 . pos . y );
     double  fBeta  =  f20 ( v0 ,  v1 ,  v2 ,  v1 . pos . x ,  v1 . pos . y );
     double  fGamma  =  f01 ( v0 ,  v1 ,  v2 ,  v2 . pos . x ,  v2 . pos . y );

     for   ( double  y  =  yMin ;  y  <=  yMax ;  y ++ )   {
         for   ( double  x  =  xMin ;  x  <=  xMax ;  x ++ )   {  
             // Calculate the weights for inperpolation
             // If any weight is negative, the fragment is not in the triangle
             double  alpha  =  f12 ( v0 ,  v1 ,  v2 ,  x ,  y )   /  fAlpha ;
             double  beta  =  f20 ( v0 ,  v1 ,  v2 ,  x ,  y )   /  fBeta ;
             double  gamma  =  f01 ( v0 ,  v1 ,  v2 ,  x ,  y )   /  fGamma ;

             // Determine if the pixel position is inside the triangle
             if   ( alpha  >=   0   &&  beta  >=   0   &&  gamma  >=   0 )   {
                 if   (( alpha  >   0   ||  fAlpha  *  f12 ( v0 ,  v1 ,  v2 ,   - 1 ,   - 1 )   >   0 )   &&
                     ( beta  >   0   ||  fBeta  *  f20 ( v0 ,  v1 ,  v2 ,   - 1 ,   - 1 )   >   0 )   &&
                     ( gamma  >   0   ||  fGamma  *  f01 ( v0 ,  v1 ,  v2 ,   - 1 ,   - 1 )   >   0 ))   {
                         Fragment  fragment ;

                         // Interpolate vertex attributes using alpha, beta, and gamma weights
                        fragment . material  =  barycentricWeighting ( alpha ,  beta ,  gamma ,
                                                                v0 . material ,  v1 . material ,  v2 . material );
                        fragment . worldNormal  =  barycentricWeighting ( alpha ,  beta ,  gamma ,
                                                                    v0 . normal ,  v1 . normal ,  v2 . normal );
                        fragment . worldPos  =  barycentricWeighting ( alpha ,  beta ,  gamma ,
                                                                    v0 . worldPos ,  v1 . worldPos ,  v2 . worldPos );
                         double  z  =  barycentricWeighting ( alpha ,  beta ,  gamma ,
                                                        v0 . pos . z ,  v1 . pos . z ,  v2 . pos . z );
                        fragment . windowPos  =  dvec3 ( x ,  y ,  z );
                         FragmentOps :: processFragment ( frameBuffer ,  eyePos ,  lights ,  fragment ,  viewingMatrix );
                 }
             }
         }
     }
}

/**
 *  @fn   void drawManyFilledTriangles(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const vector<VertexData> &vertices, const dmat4 &viewingMatrix)
 *  @brief    Draw many filled triangles,
 *  @param  [in,out]  frameBuffer     Framebuffer.
 *  @param            eyePos          Eye position.
 *  @param            lights          Vector of lights in scene.
 *  @param            vertices        The vector of vertice-triplets.
 *  @param            viewingMatrix   Viewing matrix.
 */

void  drawManyFilledTriangles ( FrameBuffer   & frameBuffer ,   const  dvec3  & eyePos ,  
                             const  vector < LightSourcePtr >   & lights ,   const  vector < VertexData >   & vertices ,
                             const  dmat4  & viewingMatrix )   {
     for   ( int  i  =   0 ;  i  <   ( int ) vertices . size ()   -   2 ;  i  +=   3 )   {
         const   VertexData   & Vi   =  vertices [ i ];
         const   VertexData   & Vi1   =  vertices [ i + 1 ];
         const   VertexData   & Vi2   =  vertices [ i + 2 ];
        drawFilledTriangle ( frameBuffer ,  eyePos ,  lights ,   Vi ,   Vi1 ,   Vi2 ,  viewingMatrix );
     }
}

CSE386Fall2020/CSE386Fall2020/Rasterization.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include "Defs.h" #include "FragmentOps.h" #include "VertexData.h" void drawAxisOnWindow(FrameBuffer &frameBuffer); void drawWirePolygon(FrameBuffer &frameBuffer, const vector<dvec3> &pts, const color &rgb); void drawLine(FrameBuffer &frameBuffer, int x1, int y1, int x2, int y2, const color &C); void drawLine(FrameBuffer &frameBuffer, const dvec2 &pt1, const dvec2 &pt2, const color &C); void drawLine(FrameBuffer &frameBuffer, const dvec3 &eyePos, vector<LightSourcePtr> &lights, const VertexData &v0, const VertexData &v1, const dmat4 &viewingMatrix); void drawManyLines(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const vector<VertexData> &vertices, const dmat4 &viewingMatrix); void drawWireFrameTriangle(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const VertexData &v0, const VertexData &v1, const VertexData &v2, const dmat4 &viewingMatrix); void drawFilledTriangle(FrameBuffer &frameBuffer, const dvec3 &eyePos, vector<LightSourcePtr> &lights, const VertexData &v0, const VertexData &v1, const VertexData &v2, const dmat4 &viewingMatrix); void drawManyWireFrameTriangles(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const vector<VertexData> &vertices, const dmat4 &viewingMatrix); void drawManyFilledTriangles(FrameBuffer &frameBuffer, const dvec3 &eyePos, const vector<LightSourcePtr> &lights, const vector<VertexData> &vertices, const dmat4 &viewingMatrix); void drawArc(FrameBuffer &fb, const dvec2 &center, double R, double startRads, double lengthInRads, const color &rgb);

CSE386Fall2020/CSE386Fall2020/RayTracer.cpp

CSE386Fall2020/CSE386Fall2020/RayTracer.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/
#include   "RayTracer.h"
#include   "IShape.h"

/**
 *  @fn   RayTracer::RayTracer(const color &defa)
 *  @brief    Constructs a raytracers.
 *  @param    defa    The clear color.
 */

RayTracer :: RayTracer ( const  color  & defa )
     :  defaultColor ( defa )   {
}

/**
 *  @fn   void RayTracer::raytraceScene(FrameBuffer &frameBuffer, int depth, const IScene &theScene) const
 *  @brief    Raytrace scene
 *  @param  [in,out]  frameBuffer Framebuffer.
 *  @param            depth       The current depth of recursion.
 *  @param            theScene    The scene.
 */

void   RayTracer :: raytraceScene ( FrameBuffer   & frameBuffer ,   int  depth ,
                                 const   IScene   & theScene )   const   {
     const   RaytracingCamera   & camera  =   * theScene . camera ;
     const  vector < VisibleIShapePtr >   & objs  =  theScene . opaqueObjs ;
     const  vector < PositionalLightPtr >   & lights  =  theScene . lights ;

     for   ( int  y  =   0 ;  y  <  frameBuffer . getWindowHeight ();   ++ y )   {
         for   ( int  x  =   0 ;  x  <  frameBuffer . getWindowWidth ();   ++ x )   {
            DEBUG_PIXEL  =   ( ==  xDebug  &&  y  ==  yDebug );
             if   ( DEBUG_PIXEL )   {
                cout  <<   "" ;
             }
             /* CSE 386 - todo  */
             Ray  ray  =  camera . getRay ( x ,  y );
            frameBuffer . setColor ( x ,  y ,  gray );
            frameBuffer . showAxes ( x ,  y ,  ray ,   0.25 );            // Displays R/x, G/y, B/z axes
         }
     }

    frameBuffer . showColorBuffer ();
}


/**
 *  @fn   color RayTracer::traceIndividualRay(const Ray &ray, const IScene &theScene, int recursionLevel) const
 *  @brief    Trace an individual ray.
 *  @param    ray             The ray.
 *  @param    theScene        The scene.
 *  @param    recursionLevel  The recursion level.
 *  @return   The color to be displayed as a result of this ray.
 */

color  RayTracer :: traceIndividualRay ( const   Ray   & ray ,   const   IScene   & theScene ,   int  recursionLevel )   const   {
     /* CSE 386 - todo  */
     HitRecord  theHit  =   VisibleIShape :: findIntersection ( ray ,  theScene . opaqueObjs );
    color result  =  defaultColor ;

     if   ( theHit . <  FLT_MAX )   {
        color totalColor  =  theHit . material . ambient ;
        result  =  defaultColor ;
     }

     return  result ;
}

CSE386Fall2020/CSE386Fall2020/RayTracer.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include "Utilities.h" #include "FrameBuffer.h" #include "Camera.h" #include "IScene.h" /** * @struct RayTracer * @brief Encapsulates the functionality of a ray tracer. */ struct RayTracer { color defaultColor; RayTracer(const color &defaultColor); void raytraceScene(FrameBuffer &frameBuffer, int depth, const IScene &theScene) const; protected: color traceIndividualRay(const Ray &ray, const IScene &theScene, int recursionLevel) const; };

CSE386Fall2020/CSE386Fall2020/usflag.ppm

CSE386Fall2020/CSE386Fall2020/Utilities.cpp

CSE386Fall2020/CSE386Fall2020/Utilities.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   < iostream >
#include   < iomanip >
#include   < cstdlib >

#include   "Defs.h"
#include   "FrameBuffer.h"
#include   "Utilities.h"

/**
@fn    ostream &operator << (ostream &os, const dvec2 &V)
@brief     Output stream for vec2.
@param     os      Output stream.
@param     V       The vector.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dvec2  & V )   {
    os  <<   "[ "   <<  V . <<   " "   <<  V . <<   " ]" ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const dvec3 &V)
@brief     Output stream for vec3.
@param     os      Output stream.
@param     V       The vector.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dvec3  & V )   {
    os  <<   "[ "   <<  V . <<   " "   <<  V . <<   " "   <<  V . <<   " ]" ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const dvec4 &V)
@brief     Output stream for vec4.
@param     os      Output stream.
@param     V       The vector.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dvec4  & V )   {
    os  <<   "[ "   <<  V . <<   " "   <<  V . <<   " "   <<  V . <<   " "   <<  V . <<   " ]" ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const dmat432 &M)
@brief     Output stream for mat2.
@param     os      Output stream.
@param     M       The matrix.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dmat2  & M )   {
    os  <<   "\n" ;
     for   ( int  row  =   0 ;  row  <   2 ;  row ++ )   {
        os  <<   "|\t" ;
         for   ( int  col  =   0 ;  col  <   2 ;  col ++ )   {
            os  <<  std :: setw ( 8 )   <<  std :: setprecision ( 4 )   <<  M [ col ][ row ]   <<   "\t" ;
         }
        os  <<   "|\n" ;
     }
    os  <<   "\n" ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const dmat3 &M)
@brief     Output stream for mat3.
@param     os      Output stream.
@param     M       The matrix.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dmat3  & M )   {
    os  <<   "\n" ;
     for   ( int  row  =   0 ;  row  <   3 ;  row ++ )   {
        os  <<   "|\t" ;
         for   ( int  col  =   0 ;  col  <   3 ;  col ++ )   {
            os  <<  std :: setw ( 8 )   <<  std :: setprecision ( 4 )   <<  M [ col ][ row ]   <<   "\t" ;
         }
        os  <<   "|\n" ;
     }
    os  <<   "\n" ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const dmat4 &M)
@brief     Output stream for mat4.
@param     os      Output stream.
@param     M       The matrix.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dmat4  & M )   {
    os  <<   "\n" ;
     for   ( int  row  =   0 ;  row  <   4 ;  row ++ )   {
        os  <<   "|\t" ;
         for   ( int  col  =   0 ;  col  <   4 ;  col ++ )   {
            os  <<  std :: setw ( 8 )   <<  std :: setprecision ( 4 )   <<  M [ col ][ row ]   <<   "\t" ;
         }
        os  <<   "|\n" ;
     }
    os  <<   "\n" ;
     return  os ;
}

/**
@fn    ostream &operator << (ostream &os, const dmat4x2 &M)
@brief     Output stream for mat4x2.
@param     os      Output stream.
@param     M       The matrix.
*/

ostream  & operator   <<   ( ostream  & os ,   const  dmat4x2  & M )   {
    os  <<   "\n" ;
     for   ( int  row  =   0 ;  row  <   2 ;  row ++ )   {
        os  <<   "|\t" ;
         for   ( int  col  =   0 ;  col  <   4 ;  col ++ )   {
            os  <<  M [ col ][ row ]   <<   "\t" ;
         }
        os  <<   "|\n" ;
     }
    os  <<   "\n" ;
     return  os ;
}
/**
 *  @fn   void swap(double &a, double &b)
 *  @brief    Swaps that values of two doubleing point numbers, without
 *          using std.
 *  @param  [in,out]  a   First double.
 *  @param  [in,out]  b   Second double.
 */

void  swap ( double   & a ,   double   & b )   {
     /* CSE 386 - todo  */
}

/**
 *  @fn   bool approximatelyEqual(double a, double b)
 *  @brief    Determines if two values are approximately equal.
 *          That is, their values within EPSILON of each other.
 *  @param    a   The first value.
 *  @param    b   The second value.
 *  @return   true iff (a-b) is in [-EPSILON, EPSILON].
 */

bool  approximatelyEqual ( double  a ,   double  b )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
 *  @fn   bool approximatelyZero(double a)
 *  @brief    Determines if a value is approximately zero.
 *          That is, the value is within EPSILON of zero.
 *  @param    a   The value.
 *  @return   true iff a is in [-EPSILON, EPSILON].
 */

bool  approximatelyZero ( double  a )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
 *  @fn   double normalizeDegrees(double degrees)
 *  @brief    Converts an arbitrary number of degrees to an equivalent
 *          number of degrees in the range [0, 360). Loops should NOT
 *          be used in this function.
 *  @param    degrees The degrees.
 *  @return   Normalized degrees in the range [0, 360).
 *  @test     normalizeDegrees(0) --> 0
 *  @test     normalizeDegrees(1) --> 1
 *  @test     normalizeDegrees(-1) --> 359
 *  @test     normalizeDegrees(-721) --> 359
 */

double  normalizeDegrees ( double  degrees )   {
     /* CSE 386 - todo  */
     return  degrees ;
}

/**
 *  @fn   double normalizeRadians(double rads)
 *  @brief    Converts an arbitrary number of radians to an equivalent
 *          number of radians in the range [0, 2*M_PI). Loops should NOT
 *          be used in this function.
 *  @param    rads    The radians.
 *  @return   Normalized radians in the range [0, 2*M_PI).
 *  @test     normalizeRadians(0) --> 0
 *  @test     normalizeRadians(1) --> 1
 *  @test     normalizeRadians(3*M_PI) --> M_PI
 *  @test     normalizeRadians(-31*M_PI) --> M_PI
 */

double  normalizeRadians ( double  rads )   {
     /* CSE 386 - todo  */
     return  rads ;
}

/**
 *  @fn   double rad2deg(double rads)
 *  @brief    Converts radians to degrees.  This function behaves like glm::degrees,
 * without using glm::degrees.
 *  @param    rads    The radians.
 *  @return   Degrees.
 */

double  rad2deg ( double  rads )   {
     return  rads ;
}

/**
 *  @fn   double deg2rad(double degs)
 *  @brief    Converts degrees to radians. This function behaves like glm::radians,
 * without using glm::radians.
 *  @param    degs    The degrees.
 *  @return   Radians.
 */

double  deg2rad ( double  degs )   {
     /* CSE 386 - todo  */
     return  degs ;
}

/**
@fn    double min(double A, double B, double C)
@brief     Determines the minimum of three values, using std::min.
@param     A   First value.
@param     B   Second value
@param     C   Third value.
@return    The minimum value.
*/

double  min ( double  A ,   double  B ,   double  C )   {
     /* CSE 386 - todo  */
     return  A ;
}

/**
@fn    double max(double A, double B, double C)
@brief     Determines the maximum of three values, using std::max.
@param     A   First value.
@param     B   Second value
@param     C   Third value.
@return    The maximum value.
*/

double  max ( double  A ,   double  B ,   double  C )   {
     /* CSE 386 - todo  */
     return  A ;
}

/**
 *  @fn   void pointOnUnitCircle(double angleRads, double &x, double &y)
 *  @brief    Determines the (x,y) position of a point on the standard
 *          unit circle.
 *  @param            angleRads   The angle in radians.
 *  @param  [in,out]  x           A double to process.
 *  @param  [in,out]  y           A double to process.
 */

void  pointOnUnitCircle ( double  angleRads ,   double   & x ,   double   & y )   {
     /* CSE 386 - todo  */
    x  =  y  =   0 ;
}

/**
@fn    dvec2 pointOnCircle(const dvec2 &center, double R, double angleRads)
@brief     Computes the (x,y) value of a point on the circle centered on 'center',
*           having radius R. The point is determined by sweeping an arc 'angleRads'.
@param     center      The center of the circle
@param     R           Radius of circle.
@param     angleRads   The angle in radians.
@return    The point on the circle.
*/

dvec2 pointOnCircle ( const  dvec2  & center ,   double  R ,   double  angleRads )   {
     /* CSE 386 - todo  */
     return  dvec2 ( 0 ,   0 );
}

/**
@fn    double directionInDegrees(double x1, double y1, double x2, double y2)
@brief     Compute the direction/heading of (x2,y2), relative
*           to (x1,y1). Result is in range [0, 360).
@param     x1  x value of first (x,y) pair
@param     y1  y value of first (x,y) pair
@param     x2  x value of second (x,y) pair
@param     y2  y value of second (x,y) pair
@return    The angle of (x2,y2) relative to (x1,y1).
@test  directionInDegrees(2, 10, 3, 11) --> 45
@test  directionInDegrees(3, 11, 2, 10) --> 225
@test  directionInDegrees(0, 0, 10, 10) --> 45
@test  directionInDegrees(2, 2, 2, 0) --> 270
*/

double  directionInDegrees ( double  x1 ,   double  y1 ,   double  x2 ,   double  y2 )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
@fn    double directionInDegrees(const dvec2 &referencePt, const dvec2 &targetPt)
@brief     Compute the direction/heading of 'targetPt', relative
*           to referencePt.
@param     referencePt Reference point.
@param     targetPt    Target point point.
@return    A double.
@test  directionInDegrees((2,10), (3,11)) --> 45
*/

double  directionInDegrees ( const  dvec2  & referencePt ,   const  dvec2  & targetPt )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
@fn    double directionInDegrees(const dvec2 &targetPt)
@brief     Compute the direction/heading of 'targetPt', relative
*           to the origin.
@param     targetPt    Target point.
@return    The direction in degrees.
@test  directionInDegrees((1,0)) --> 0
@test  directionInDegrees((1,1)) --> 45
*/

double  directionInDegrees ( const  dvec2  & targetPt )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
@fn    dvec2 doubleIt(const dvec2 &V)
@brief     Computes 2*V
@param     V   The vector.
@return    2*V.
*/

dvec2 doubleIt ( const  dvec2  & V )   {
     /* CSE 386 - todo  */
     return  V ;
}

/**
@fn    dvec3 myNormalize(const dvec3 &V)
@brief     Computes the normalization of V, without calling glm::normalize.
@param     V   The vector.
@return    Normalized vector V.
*/

dvec3 myNormalize ( const  dvec3  & V )   {
     /* CSE 386 - todo  */
     return  V ;
}

/**
@fn    bool isOrthogonal(const dvec3 &a, const dvec3 &b)
@brief     Determines if two vectors are orthogonal, or nearly orthogonal.
@param     a   The first vector.
@param     b   The second vector.
@return    True iff the two vector are orthogonal.
*/

bool  isOrthogonal ( const  dvec3  & a ,   const  dvec3  & b )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
 *  @fn   double cosBetween(const dvec2 &v1, const dvec2 &v2)
 *  @brief    Cosine between v1 and v2. 
 *  @param    v1  The first vector.
 *  @param    v2  The second vector.
 *  @return   The cosine between v1 and v2.
 */

double  cosBetween ( const  dvec2  & v1 ,   const  dvec2  & v2 )   {
     /* CSE 386 - todo  */
     double  cos  =  glm :: dot ( v1 ,  v2 ) / ( glm :: length ( v1 ) * glm :: length ( v2 ));
     return   0 ;
}

/**
 *  @fn   double cosBetween(const dvec3 &v1, const dvec3 &v2)
 *  @brief    Computes the cosine between v1 and v2.
 *  @param    v1  The first vector.
 *  @param    v2  The second vector.
 *  @return   A double.
 */

double  cosBetween ( const  dvec3  & v1 ,   const  dvec3  & v2 )   {
     /* CSE 386 - todo  */
     double  cos  =  glm :: dot ( v1 ,  v2 )   /   ( glm :: length ( v1 ) * glm :: length ( v2 ));
     return   0 ;
}

/**
 *  @fn   double radsBetween(const dvec2 &v1, const dvec2 &v2)
 *  @brief    Computes the radians between two vectors. Uses trig functions.
 *  @param    v1  The first vector.
 *  @param    v2  The second vector.
 *  @return   The number of radians between the two vectors.
 */

double  radsBetween ( const  dvec2  & v1 ,   const  dvec2  & v2 )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
 *  @fn   double radsBetween(const dvec3 &v1, const dvec3 &v2)
 *  @brief    Computes the radians between two vectors. Uses trig functions.
 *  @param    v1  The first vector.
 *  @param    v2  The second vector.
 *  @return   The number of radians between the two vectors.
 */

double  radsBetween ( const  dvec3  & v1 ,   const  dvec3  & v2 )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
@fn    dvec3 project(const dvec3 &from, const dvec3 &onto)
@brief     Project the vector 'from' onto the vector 'onto'
@param     from    Source for the.
@param     onto    The onto.
@return    'from' projected onto 'onto'
*/

dvec3 project ( const  dvec3  & from ,   const  dvec3  & onto )   {
     /* CSE 386 - todo  */
     return  from ;
}

/**
@fn    dvec2 rotate90CCW(const dvec2 &pt)
@brief     Rotate a 2D point about the origin, 90 degrees counterclockwise.
@param     pt  A dvec2 to process.
@return    The point rotated 90 degrees counterclockwise.
@test  rotate90CCW((-4,-10)) -> (10,-4)
@test  rotate90CCW((10,-4)) -> (4,10)
*/

dvec2 rotate90CCW ( const  dvec2  & pt )   {
     /* CSE 386 - todo  */
     return  pt ;
}

/**
 *  @fn   double map(double x, double xLow, double xHigh, double yLow, double yHigh)
 *  @brief    Linearlly map a value from one interval to another.
 *  @param            x       x value.
 *  @param            xLow    The low value of the x range.
 *  @param            xHigh   The high value of the x range.
 *  @param            yLow    The low value of the y range.
 *  @param            yHigh   The high value of the y range.
 *  @test     map(2, 0, 5, 10, 11) --> 10.4
 */

double  map ( double  x ,   double  xLow ,   double  xHigh ,   double  yLow ,   double  yHigh )   {
     /* CSE 386 - todo  */
     return  x ;
}

/**
 *  @fn   void map(double x, double xLow, double xHigh, double yLow, double yHigh, double &y)
 *  @brief    Linearlly map a value from one interval to another.
 *  @param            x       x value.
 *  @param            xLow    The low value of the x range.
 *  @param            xHigh   The high value of the x range.
 *  @param            yLow    The low value of the y range.
 *  @param            yHigh   The high value of the y range.
 *  @param  [in,out]  y       The mapped value in the y range.
 *  @test     map(2, 0, 5, 10, 11, y) --> y = 10.4
 */

void  map ( double  x ,   double  xLow ,   double  xHigh ,   double  yLow ,   double  yHigh ,   double   & y )   {
     /* CSE 386 - todo  */
    y  =  x ;
}

/**
 *  @fn   vector<double> quadratic(double A, double B, double C)
 *  @brief    Solves the quadratic equation, given A, B, and C.
 *          0, 1, or 2 roots are inserted into the vector and returned.
 *          The roots are placed into the vector in sorted in ascending order.
 *  @param    A   A.
 *  @param    B   B.
 *  @param    C   C.
 *  @return   Vector containing the real roots.
 *  @test     quadratic(1,4,3) --> [-3,-1]
 *  @test     quadratic(1,0,0) --> [0]
 *  @test     quadratic(-4, -2, -1) --> []
 */

vector < double >  quadratic ( double  A ,   double  B ,   double  C )   {
     /* CSE 386 - todo  */
    vector < double >  vecOfRoots ( 2 );
    vecOfRoots [ 0 ]   =- 1 ;
    vecOfRoots [ 1 ]   =   1 ;
     return  vecOfRoots ;
}

/**
 *  @fn   int quadratic(double A, double B, double C, double roots[2])
 *  @brief    Solves the quadratic equation, given A, B, and C.
 *          0, 1, or 2 roots are inserted into the array 'roots'.
 *          The roots are sorted in ascending order.
 *  @param    A       A.
 *  @param    B       B.
 *  @param    C       C.
 *  @param    roots   The real roots.
 *  @test     quadratic(1, 4, 3, ary) --> returns 2 and fills in ary with: [-3,-1]
 *  @test     quadratic(1 ,0, 0, ary) --> returns 1 and fills in ary with: [0]
 *  @test     quadratic(-4, -2, -1, ary) --> returns 0 and does not modify ary.
 *  @return   The number of real roots put into the array 'roots'
*/

int  quadratic ( double  A ,   double  B ,   double  C ,   double  roots [ 2 ])   {
     /* CSE 386 - todo  */
    roots [ 0 ]   =   - 1 ;
    roots [ 1 ]   =   + 1 ;
     return   2 ;
}

/**
 *  @fn   double areaOfParallelogram(const dvec3 &v1, const dvec3 &v2)
 *  @brief    Computes the area of parallelogram, given two vectors eminating
 *          from the same corner of the parallelogram.
 *  @param    v1  The first vector.
 *  @param    v2  The second vector.
 *  @return   Area of parallelogram.
 */

double  areaOfParallelogram ( const  dvec3  & v1 ,   const  dvec3  & v2 )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
 *  @fn   double areaOfTriangle(double a, double b, double c)
 *  @brief    Computes the area of triangle using Heron's formula
 *  @param    a length of first side.
 *  @param    b length of second side.
 *  @param    c length of third side.
 *  @return   Area of triangle. Returns -1.0 if any of the sides are <= 0.
 */

double  areaOfTriangle ( double  a ,   double  b ,   double  c )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
 *  @fn   double areaOfTriangle(const dvec3 &pt1, const dvec3 &pt2, const dvec3 &pt3)
 *  @brief    Computes the area of triangle.
 *  @param    pt1 The first point.
 *  @param    pt2 The second point.
 *  @param    pt3 The third point.
 *  @return   Area of triangle.
 */

double  areaOfTriangle ( const  dvec3  & pt1 ,   const  dvec3  & pt2 ,   const  dvec3  & pt3 )   {
     /* CSE 386 - todo  */
     return   0 ;
}

/**
@fn    bool isOrthoNormalBasis(const dvec3 &u, const dvec3 &v, const dvec3 &w)
@brief     Determines if three vectors form an orthonormal basis.
@param     u   The u vector.
@param     v   The v vector.
@param     w   The w vector.
@return    True if ortho normal basis, false if not.
*/

bool  isOrthoNormalBasis ( const  dvec3  & u ,   const  dvec3  & v ,   const  dvec3  & w )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
 *  @fn   bool isRightHandedOrthoNormalBasis(const dvec3 &u, const dvec3 &v, const dvec3 &w)
 *  @brief    Determines if three vectors form a right-handed orthonormal basis.
 *  @param    u   The u vector.
 *  @param    v   The v vector.
 *  @param    w   The w vector.
 *  @return   true iff right handed ortho normal basis.
 */

bool  isRightHandedOrthoNormalBasis ( const  dvec3  & u ,   const  dvec3  & v ,   const  dvec3  & w )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
@fn    dvec3 pointingVector(const dvec3 &pt1, const dvec3 &pt2)
@brief     Computes unit-length pointing vector.
@param     pt1 The first point.
@param     pt2 The second point.
@return    Unit length vector that points from pt1 to pt2.
*/

dvec3 pointingVector ( const  dvec3  & pt1 ,   const  dvec3  & pt2 )   {
     /* CSE 386 - todo  */
     return  pt1 ;
}

/**
@fn    dvec3 normalFrom3Points(const dvec3 &pt0, const dvec3 &pt1, const dvec3 &pt2)
@brief     Computes a unit-length normal vector from 3 points, specified in counterclockwise order.
@param     pt0 The first point.
@param     pt1 The second point.
@param     pt2 The third point.
@return    Normal vector.
*/

dvec3 normalFrom3Points ( const  dvec3  & pt0 ,   const  dvec3  & pt1 ,   const  dvec3  & pt2 )   {
     /* CSE 386 - todo  */
     return  pt0 ;
}

/**
@fn    dvec3 normalFrom3Points(const vector<dvec3> pts)
@brief     Computes a unit-length normal vector from 3 points, specified in counterclockwise order.
@param     pts The points.
@return    The normal vector.
*/

dvec3 normalFrom3Points ( const  vector < dvec3 >   & pts )   {
     /* CSE 386 - todo  */
     return  pts [ 0 ];
}

/**
@fn    dvec3 getRow(const dmat3 &mat, int row)
@brief     Retrieves a particular row out of a matrix.
@param     mat The matrix.
@param     row The row.
@return    The extracted row.
*/

dvec3 getRow ( const  dmat3  & mat ,   int  row )   {
     /* CSE 386 - todo  */
     return  dvec3 ();
}

/**
 *  @fn   dvec3 getCol(const dmat3 &mat, int col)
 *  @brief    Retrieves a particular column out of a matrix.
 *  @param    mat The matrix.
 *  @param    col The column.
 *  @return   The extracted column.
 */

dvec3 getCol ( const  dmat3  & mat ,   int  col )   {
     /* CSE 386 - todo  */
     return  dvec3 ();
}

/**
@fn    bool isInvertible(const dmat432 &mat)
@brief     Determines if mat is invertible
@param     mat The matrix.
@return    true if invertible, false if not.
*/

bool  isInvertible ( const  dmat2  & mat )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
 *  @fn   bool isInvertible(const dmat3 &mat)
 *  @brief    Determines if mat is invertible
 *  @param    mat The matrix.
 *  @return   true if invertible, false if not.
 */

bool  isInvertible ( const  dmat3  & mat )   {
     /* CSE 386 - todo  */
     return   false ;
}

/**
 *  @fn   dvec3 solveLinearSystem(const dmat3 &M, const dvec3 &y)
 *  @brief    Solves a linear system
 *  @param    M   The matrix.
 *  @param    y   The vector.
 *  @return   x, such that M*x = y. Returns (0,0,0) if no solution exists (i.e., M is singular).
 */

dvec3 solveLinearSystem ( const  dmat3  & M ,   const  dvec3  & y )   {
     /* CSE 386 - todo  */
     return  dvec3 ();
}

/**
 *  @fn   dmat3 addMatrices(const vector<dmat3> &M)
 *  @brief    Adds the several matrices together.
 *  @param    M   Vector of matrices.
 *  @return   M[0]+M[1]+...+M[n-1]
 */

dmat3 addMatrices ( const  vector < dmat3 >   & M )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 multiplyMatrices(const vector<dmat3> &M)
 *  @brief    Multiply many matrices together.
 *  @param    M   The vector of matrices.
 *  @return   Returns M[0]*M[1]*...M[n-1].
 */

dmat3 multiplyMatrices ( const  vector < dmat3 >   & M )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dvec3 multiplyMatrixAndVertex(const dmat3 &M, const dvec3 &x)
 *  @brief    Multiply matrix and vertex
 *  @param    M   A matrix.
 *  @param    x   A vector.
 *  @return   Returns M*x.
 */

dvec3 multiplyMatrixAndVertex ( const  dmat3  & M ,   const  dvec3  & x )   {
     /* CSE 386 - todo  */
     return  dvec3 ();
}

/**
 *  @fn   dvec3 multiplyMatricesAndVertex(const vector<dmat3> &M, const dvec3 &x)
 *  @brief    Multiply matrices and vertex
 *  @param    M   A vector of matrices to process.
 *  @param    x   The vertex to process.
 *  @return   Returns the result of M[0]*M[1]*...M[n-1]*x
 */

dvec3 multiplyMatricesAndVertex ( const  vector < dmat3 >   & M ,   const  dvec3  & x )   {
     /* CSE 386 - todo  */
     return  dvec3 ();
}

/**
 *  @fn   vector<dvec3> multiplyMatrixAndVertices(const dmat3 &M, const vector<dvec3> &verts)
 *  @brief    Returns the vector containing: <M*x[0], M*x[1], ... M*x[n-1]>
 *  @param    M       A dmat3 to process.
 *  @param    verts   The vertices.
 *  @return   Returns the vector: <M*x[0], M*x[1], ... M*x[n-1]>
 */

vector < dvec3 >  multiplyMatrixAndVertices ( const  dmat3  & M ,   const  vector < dvec3 >   & verts )   {
     /* CSE 386 - todo  */
    vector < dvec3 >  result ;
     return  result ;
}

/**
 *  @fn   vector<dvec3> multiplyMatricesAndVertices(const vector<dmat3> &M, const vector<dvec3> &verts)
 *  @brief    Multiply matrices and vertices
 *  @param    M       Vector of matrices.
 *  @param    verts   Vector of vertices.
 *  @return   Returns: <BIGMAT*x[0], BIGMAT*x[1], ... BIGMAT*x[n-1]>, where BIGMAT = M[0]*M[1]*...M[n-1]
 */

vector < dvec3 >  multiplyMatricesAndVertices ( const  vector < dmat3 >   & M ,   const  vector < dvec3 >   & verts )   {
     /* CSE 386 - todo  */
    vector < dvec3 >  result ;
     return  result ;
}

/**
@fn    dmat3 T(double dx, double dy)
@brief     Creates the 3x3 translation matrix for 2D systems.
@param     dx  x translation factor.
@param     dy  y translation factor.
@return    The scaling matrix.
*/

dmat3 T ( double  dx ,   double  dy )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 S(double sx, double sy)
 *  @brief    Creates the 3x3 scaling matrix for 2D systems.
 *  @param    sx  x scale factor.
 *  @param    sy  y scale factor.
 *  @return   The scaling matrix.
 */

dmat3 S ( double  sx ,   double  sy )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 R(double deg)
 *  @brief    Returns 3x3 rotation matrix for 2D rotations.
 *  @param    deg Degrees to rotate.
 *  @return   The rotation matrix.
 */

dmat3 R ( double  deg )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 horzShear(double a)
 *  @brief    Horizontal shear.
 *  @param    a   Shearing parameter.
 *  @return   The 3x3 shearing matrix.
 */

dmat3 horzShear ( double  a )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 vertShear(double a)
 *  @brief    Vertical shear.
 *  @param    a   Shearing parameter.
 *  @return   The 3x3 shearing matrix.
 */

dmat3 vertShear ( double  a )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 reflectAcrossYaxis()
 *  @brief    Reflect across the Y axis.
 *  @return   The 3x3 matrix.
 */

dmat3 reflectAcrossYaxis ()   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 reflectAcrossOrigin()
 *  @brief    Reflect across the origin.
 *  @return   The 3x3 matrix.
 */

dmat3 reflectAcrossOrigin ()   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 scale2XAboutPoint(double x, double y)
 *  @brief    Scale objects 2X about a particular point.
 *  @param    x   The x value about which scaling should occur.
 *  @param    y   The y value about which scaling should occur.
 *  @return   The 3x3 scale matrix.
 */

dmat3 scale2XAboutPoint ( float  x ,   float  y )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 reflectAcrossLineYeqXplus50()
 *  @brief    Reflect objects across the line y = x + 50
 *  @return   The reflection matrix.
 */

dmat3 reflectAcrossLineYeqXplus50 ()   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
 *  @fn   dmat3 rotateAroundOwnAxisAndAroundSun(double distFromOrigin, double angleAboutOwnAxis, double angleAboutOrigin)
 *  @brief    Perform a earth-like rotation about the sun/origin.
 *  @param    distFromOrigin      How far object is away from origin.
 *  @param    angleAboutOwnAxis   How many radians the object is rotated about its own axis
 *  @param    angleAboutOrigin    How many radians the object is rotated about the origin
 *  @return   The 3x3 scale matrix.
 */

dmat3 rotateAroundOwnAxisAndAroundSun ( double  distFromOrigin ,
                                                 double  angleAboutOwnAxis ,
                                                 double  angleAboutOrigin )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
@fn    dmat4 T(double dx, double dy, double dz)
@brief     Creates the 4x4 translation matrix for 3D systems.
@param     dx  The x translation factor.
@param     dy  The y translation factor.
@param     dz  The z translation factor.
@return    The 4x4 translation matrix for 3D systems.
*/

dmat4 T ( double  dx ,   double  dy ,   double  dz )   {
     /* CSE 386 - todo  */
     return  dmat4 ();
}

/**
@fn    dmat4 S(double sx, double sy, double sz)
@brief     Creates the 4x4 scaling matrix for 3D systems.
@param     sx  The x scaling factor.
@param     sy  The y scaling factor.
@param     sz  The z scaling factor.
@return    The 4x4 scaling matrix for 3D systems.
*/

dmat4 S ( double  sx ,   double  sy ,   double  sz )   {
     /* CSE 386 - todo  */
     return  dmat4 ();
}

/**
@fn    dmat4 S(double scale)
@brief     Creates the 4x4 scaling matrix for 3D systems.
@param     scale   The scale.
@return    The 4x4 [uniform] scaling matrix for 3D systems.
*/

dmat4 S ( double  scale )   {
     /* CSE 386 - todo  */
     return  dmat4 ();
}

/**
@fn    dmat3 Rx(double rads)
@brief     Creates the 4x4 rotation matrix for 3D systems.
@param     rads    Rotation amount, in radians.
@return    The 4x4 matrix for rotation about the +x axis.
*/

dmat4  Rx ( double  rads )   {
     /* CSE 386 - todo  */
     return  dmat4 ();
}

/**
@fn    dmat3 Ry(double rads)
@brief     Creates the 4x4 rotation matrix for 3D systems.
@param     rads    Rotation amount, in radians.
@return    The 4x4 matrix for rotation about the +y axis.
*/

dmat4  Ry ( double  rads )   {
     /* CSE 386 - todo  */
     return  dmat4 ();
}

/**
@fn    dmat3 Rz(double rads)
@brief     Creates the 4x4 rotation matrix for 3D systems.
@param     rads    Rotation amount, in radians.
@return    The 4x4 matrix for rotation about the +z axis.
*/

dmat4  Rz ( double  rads )   {
     /* CSE 386 - todo  */
     return  dmat4 ();
}

/**
@fn    mat3 mystery(float a, float b)
@brief     Returns W*W*W, where W = [[a b a][b b a][b b a]].
@param     a   The value of a.
@param     b   The value of b.
@return    Returns W*W*W, where W = [[a b a][b b a][b b a]]
*/

glm :: mat3 mystery ( float  a ,   float  b )   {
     /* CSE 386 - todo  */
     return  dmat3 ();
}

/**
@fn    void computeXYZFromAzimuthAndElevation(double R, double az, double el, double &x, double &y, double &z)
@brief     Computes (x,y,z), given a specific azimuth/elevation angles.
@param             R   The radius of the sphere.
@param             az  Azimuth
@param             el  Elevation.
@param  [in,out]   x   A double to process.
@param  [in,out]   y   A double to process.
@param  [in,out]   z   A double to process.
*/

void  computeXYZFromAzimuthAndElevation ( double  R ,
                                         double  az ,   double  el ,
                                         double   & x ,   double   & y ,   double   & z )   {
    z  =  R * std :: cos ( el ) * std :: cos ( az );
    x  =  R * std :: cos ( el ) * std :: sin ( az );
    y  =  R * std :: sin ( el );
}

/**
@fn    void computeAzimuthAndElevationFromXYZ(double x, double y, double z, double &R, double &az, double &el)
@brief     Calculates the azimuth and elevation from xyz
@param             x   The x coordinate.
@param             y   The y coordinate.
@param             z   The z coordinate.
@param  [in,out]   R   The radius of the sphere.
@param  [in,out]   az  Azimuth.
@param  [in,out]   el  Elevation.
*/

void  computeAzimuthAndElevationFromXYZ ( double  x ,   double  y ,   double  z ,
                                         double   & R ,   double   & az ,   double   & el )   {
    R  =  glm :: length ( dvec3 ( x ,  y ,  z ));
    az  =  std :: atan2 ( x ,  z );
    el  =  std :: atan2 ( y ,  glm :: length ( dvec2 ( x ,  z )));
}

/**
@fn    void computeAzimuthAndElevationFromXYZ(const dvec3 &pt, double &R, double &az, double &el)
@brief     Compute the azimuth/elevation (relative to the origin) of the point (x,y,z)
@param             pt  The point - (x,y,z).
@param  [in,out]   R   The radius of the sphere.
@param  [in,out]   az  Azimuth.
@param  [in,out]   el  Elevation.
*/

void  computeAzimuthAndElevationFromXYZ ( const  dvec3  & pt ,
                                         double   & R ,   double   & az ,   double   & el )   {
    computeAzimuthAndElevationFromXYZ ( pt . x ,  pt . y ,  pt . z ,  R ,  az ,  el );
}

/**
@fn    bool inRangeInclusive(double val, double lo, double hi)
@brief     Determines if value is in a range inclusive
@param     val The value.
@param     lo  The low end of the range.
@param     hi  The high end of the range.
@return    True iff val in [lo, hi].
*/

bool  inRangeInclusive ( double  val ,   double  lo ,   double  hi )   {
     return  val  >=  lo  &&  val  <=  hi ;
}

/**
@fn    bool inRangeExclusive(double val, double lo, double hi)
@brief     Determines if value is in a range exclusive
@param     val The value.
@param     lo  The low end of the range.
@param     hi  The high end of the range.
@return    true iff val in (lo, hi).
*/

bool  inRangeExclusive ( double  val ,   double  lo ,   double  hi )   {
     return  val  >  lo  &&  val  <  hi ;
}

/**
@fn    bool inRectangle(double x, double y, double left, double bottom, double right, double top)
@brief     Determines if (x,y) is inside (or on) a rectangle.
@param     x       The x coordinate.
@param     y       The y coordinate.
@param     left    The left edge of rectangle.
@param     bottom  The bottom edge of rectangle.
@param     right   The right edge of rectangle.
@param     top     The top edge of rectangle.
@return    true iff (x,y) is in/on the rectangle.
*/

bool  inRectangle ( double  x ,   double  y ,   double  left ,   double  bottom ,   double  right ,   double  top )   {
     return  inRangeInclusive ( x ,  left ,  right )   &&
        inRangeInclusive ( y ,  bottom ,  top );
}

/**
@fn    bool inRectangle(const dvec2 &pt, const dvec2 &lowerLeft, const dvec2 &upperRight)
@brief     Determines if (x,y) is inside (or on) a rectangle.
@param     pt          The point - (x,y)
@param     lowerLeft   The lower left corner of the rectangle - (left, bottom).
@param     upperRight  The upper right corner of the rectangle - (right, top).
@return    true iff (x,y) is in/on the rectangle.
*/

bool  inRectangle ( const  dvec2  & pt ,   const  dvec2  & lowerLeft ,   const  dvec2  & upperRight )   {
     return  inRangeInclusive ( pt . x ,  lowerLeft . x ,  upperRight . x )   &&
        inRangeInclusive ( pt . y ,  lowerLeft . y ,  upperRight . y );
}

/**
@fn    bool approximateVectorEquality(const dvec3 &v1, const dvec3 &v2)
@brief     Determines if two vectors are equal, or nearly equal. Near equality
*           is when the radians between the two vectors is less than EPSILON and
*           the difference between the lengths is less than EPSILON.
@param     v1  The first vector.
@param     v2  The second vector.
@return    true iff v1 == v2.
*/

bool  approximateVectorEquality ( const  dvec3  & v1 ,   const  dvec3  & v2 )   {
     return  radsBetween ( v1 ,  v2 )   <  EPSILON  &&  approximatelyEqual ( glm :: length ( v1 ),  glm :: length ( v2 ));
}


/**
@fn    string extractBaseFilename(const string &str)
@brief     Extracts the base filename described by str
@param     str The string.
@return    The extracted base filename.
@test  extractBaseFileName("/usr/etc/hosts.txt") --> "hosts.txt"
*/

string extractBaseFilename ( const  string  & str )   {
#ifdef  WINDOWS
    size_t pos  =  str . rfind ( '\\' );
#else
    size_t pos  =  str . rfind ( '/' );
#endif
     return  str . substr ( pos  +   1 );
}

bool  DEBUG_PIXEL  =   false ;
int  xDebug  =   - 1 ,  yDebug  =   - 1 ;

void  mouseUtility ( int  b ,   int  s ,   int  x ,   int  y )   {
     if   ( ==  GLUT_RIGHT_BUTTON  &&  s  ==  GLUT_DOWN )   {
        xDebug  =  x ;
        yDebug  =  glutGet ( GLUT_WINDOW_HEIGHT )   -  y  -   1 ;
        cout  <<   "("   <<  xDebug  <<   ","   <<  yDebug  <<   ") = "   <<  endl ;
     }
}

void  graphicsInit ( int  argc ,   char   * argv  [],   const  std :: string  & windowName )   {
#ifndef  WINDOWS
    setenv ( "DISPLAY" ,   ":0.0" ,   1 );
#endif
    glutInit ( & argc ,  argv );
    glutInitDisplayMode ( GLUT_RGB  |  GLUT_SINGLE );
    glutInitWindowSize ( WINDOW_WIDTH ,  WINDOW_HEIGHT );
    std :: string title  =  username  +  std :: string ( " -- " )   +  extractBaseFilename ( windowName );
    glutCreateWindow ( title . c_str ());
    glutSetOption ( GLUT_ACTION_ON_WINDOW_CLOSE ,  GLUT_ACTION_GLUTMAINLOOP_RETURNS );
    
    glPixelStorei ( GL_UNPACK_ALIGNMENT ,   1 );
    glPixelStorei ( GL_PACK_ALIGNMENT ,   1 );
}

CSE386Fall2020/CSE386Fall2020/Utilities.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include <iostream> #include <vector> #include <cmath> #include <string> #include "Defs.h" #include "ColorAndMaterials.h" extern bool DEBUG_PIXEL; extern int xDebug, yDebug; void mouseUtility(int, int, int, int); // Simple streaming for vectors and matrices. ostream &operator << (ostream &os, const dvec2 &v); ostream &operator << (ostream &os, const dvec3 &v); ostream &operator << (ostream &os, const dvec4 &v); ostream &operator << (ostream &os, const dmat2 &v); ostream &operator << (ostream &os, const dmat3 &v); ostream &operator << (ostream &os, const dmat4 &v); ostream &operator << (ostream &os, const dmat4x2 &v); template <class T> ostream &operator << (ostream &os, const vector<T> &V) { os << "[" << endl; for (size_t i = 0; i < V.size(); i++) { os << '\t' << V[i] << endl; } os << "]" << endl; return os; } void swap(double &a, double &b); bool approximatelyEqual(double a, double b); bool approximatelyZero(double a); double normalizeDegrees(double degrees); double normalizeRadians(double rads); double rad2deg(double rads); double deg2rad(double degs); double min(double a, double b, double c); double max(double a, double b, double c); void pointOnUnitCircle(double angleRads, double &x, double &y); dvec2 pointOnCircle(const dvec2 &center, double R, double angleRads); double directionInDegrees(double x1, double y1, double x2, double y2); double directionInDegrees(const dvec2 &targetPt); double directionInDegrees(const dvec2 &referencePt, const dvec2 &targetPt); dvec2 doubleIt(const dvec2 &V); dvec3 myNormalize(const dvec3 &V); bool isOrthogonal(const dvec3 &a, const dvec3 &b); double cosBetween(const dvec2 &v1, const dvec2 &v2); double cosBetween(const dvec3 &v1, const dvec3 &v2); double radsBetween(const dvec2 &v1, const dvec2 &v2); double radsBetween(const dvec3 &v1, const dvec3 &v2); dvec3 project(const dvec3 &from, const dvec3 &onto); double map(double x, double xLow, double xHigh, double yLow, double yHigh); void map(double x, double xLow, double xHigh, double yLow, double yHigh, double &y); vector<double> quadratic(double A, double B, double C); int quadratic(double A, double B, double C, double roots[2]); double areaOfParallelogram(const dvec3 &v1, const dvec3 &v2); double areaOfTriangle(const dvec3 &pt1, const dvec3 &pt2, const dvec3 &pt3); bool isOrthoNormalBasis(const dvec3 &u, const dvec3 &v, const dvec3 &w); bool isRightHandedOrthoNormalBasis(const dvec3 &u, const dvec3 &v, const dvec3 &w); dvec3 pointingVector(const dvec3 &pt1, const dvec3 &pt2); dvec3 normalFrom3Points(const dvec3 &pt1, const dvec3 &pt2, const dvec3 &pt3); dvec3 normalFrom3Points(const vector<dvec3> &pts); dvec3 getRow(const dmat3 &mat, int row); dvec3 getCol(const dmat3 &mat, int col); bool isInvertible(const dmat2 &mat); bool isInvertible(const dmat3 &mat); dvec3 solveLinearSystem(const dmat3 &M, const dvec3 &y); dmat3 addMatrices(const vector<dmat3> &M); dmat3 multiplyMatrices(const vector<dmat3> &M); dvec3 multiplyMatrixAndVertex(const dmat3 &M, const dvec3 &x); dvec3 multiplyMatricesAndVertex(const vector<dmat3> &M, const dvec3 &x); vector<dvec3> multiplyMatrixAndVertices(const dmat3 &M, const vector<dvec3> &verts); vector<dvec3> multiplyMatricesAndVertices(const vector<dmat3> &M, const vector<dvec3> &verts); void computeXYZFromAzimuthAndElevation(double R, double az, double el, double &x, double &y, double &z); void computeAzimuthAndElevationFromXYZ(double x, double y, double z, double &R, double &az, double &el); void computeAzimuthAndElevationFromXYZ(const dvec3 &pt, double &R, double &az, double &el); string extractBaseFilename(const string &str); // 2D versions dmat3 T(double dx, double dy); dmat3 S(double sx, double sy); dmat3 R(double deg); dmat3 vertShear(double a); dmat3 horzShear(double a); // 3D versions dmat4 T(double dx, double dy, double dz); dmat4 S(double sx, double sy, double sz); dmat4 S(double scale); dmat4 Rx(double rads); dmat4 Ry(double rads); dmat4 Rz(double rads); dmat3 reflectAcrossYaxis(); dmat3 reflectAcrossOrigin(); dmat3 scale2XAboutPoint(float x, float y); dmat3 reflectAcrossLineYeqXplus50(); dmat3 rotateAroundOwnAxisAndAroundSun(double distFromSun, double angleAboutOwnAxis, double angleAboutSun); bool inRangeInclusive(double val, double lo, double hi); bool inRangeExclusive(double val, double lo, double hi); bool inRectangle(double x, double y, double left, double bottom, double right, double top); bool inRectangle(const dvec2 &pt, const dvec2 &lowerLeft, const dvec2 &upperRight); bool approximateVectorEquality(const dvec3 &v1, const dvec3 &v2); glm::mat3 mystery(float a, float b); /** * @fn template <class T> vector< vector<T> > allocate2D(int rows, int cols) * @brief Allocates a vector of vectors. * @tparam T Generic type parameter. * @param rows The number rows. * @param cols The number cols. * @return The vector of vectors, having the proper dimensions. */ template <class T> vector<vector<T>> allocate2D(int rows, int cols) { vector<vector<T>> result(rows); for (int r = 0; r < rows; r++) { result[r] = vector<T>(cols); } return result; } /** * @fn template <class T> T weightedAverage(double W1, const T &item1, double W2, const T &item2) * @brief Computes the weighted average of two items. * @tparam T Generic type parameter. * @param W1 The first weight. * @param item1 The first item. * @param W2 The second weight. * @param item2 The second item. * @return The weighted average. */ template <class T> T weightedAverage(double W1, const T &item1, double W2, const T &item2) { return item1 * W1 + item2 * W2; } /** * @fn template <class T> T average(const T &a, const T &b) * @brief Computes the average of two items. * @tparam T Generic type parameter. * @param a First item. * @param b Second item. * @return The average value. */ template <class T> T average(const T &a, const T &b) { return (a + b) / 2.0; } /** * @fn template <class T> T average(const T &a, const T &b , const T &c, const T &d) * @brief Computes the average of four items. * @tparam T Generic type parameter. * @param a First item. * @param b Second item. * @param c Third item. * @param d Fourth item. * @return The average value. */ template <class T> T average(const T &a, const T &b , const T &c, const T &d) { return (a + b + c + d) / 4.0; } /** * @fn template <class T1, class T2> void addAll(vector<T1> &vec, const vector<T2> &newItems) * @brief Adds all the elements in newItems to end of the vector vec. * @tparam T Generic type parameter. * @param [in,out] vec The destination vector. * @param newItems The new items to be added. */ template <class T> void addAll(vector<T> &vec, const vector<T> &newItems) { vector<T> s; for (typename vector<T>::const_iterator i = newItems.begin(); i != newItems.end(); i++) { vec.push_back(*i); } } void graphicsInit(int argc, char *argv [], const std::string &fileName);

CSE386Fall2020/CSE386Fall2020/VertexData.h

/**************************************************** * 2016-2020 Eric Bachmann and Mike Zmuda * All Rights Reserved. * NOTICE: * Dissemination of this information or reproduction * of this material is prohibited unless prior written * permission is granted.. ****************************************************/ #pragma once #include "Defs.h" #include "ColorAndMaterials.h" /** * @struct VertexData * @brief A vertex data. Used for Pipeline graphics. */ struct VertexData { dvec4 pos; //!< Processed coordinate. dvec3 normal; //!< transformed normal vector. dvec3 worldPos; //!< Saved world position, for lighting calculations. Material material; //!< This vertex's material. VertexData(const dvec4 &pos, const dvec3 &norm, const Material &mat, const dvec3 &worldPos); VertexData(const dvec4 &pos) : VertexData(pos, Z_AXIS, bronze, ORIGIN3D) { } VertexData(const dvec4 &pos, const dvec3 &norm, const Material &mat) : VertexData(pos, norm, mat, ORIGIN3D) { } VertexData(double w1, const VertexData &vd1, double w2, const VertexData &vd2); static void addTriVertsAndNormal(vector<VertexData> &verts, const dvec4 &V1, const dvec4 &V2, const dvec4 &V3, const dvec3 &n, const Material &mat); static void addTriVertsAndComputeNormal(vector<VertexData> &verts, const dvec4 &V1, const dvec4 &V2, const dvec4 &V3, const Material &mat); static void addTriVertsAndComputeNormals(vector<VertexData> &verts, const vector<dvec4> &pts, const Material &mat); static void addConvexPolyVertsAndComputeNormals(vector<VertexData> &verts, const vector<dvec4> &polyCorners, const Material &mat); static void addConvexPolyVertsAndComputeNormals(vector<VertexData> &verts, const dvec4 &p1, const dvec4 &p2, const dvec4 &p3, const dvec4 &p4, const Material &mat); VertexData operator + (const VertexData &other) const; }; VertexData operator * (double w, const VertexData &V1);

CSE386Fall2020/CSE386Fall2020/VertextData.cpp

CSE386Fall2020/CSE386Fall2020/VertextData.cpp

/****************************************************
 * 2016-2020 Eric Bachmann and Mike Zmuda
 * All Rights Reserved.
 * NOTICE:
 * Dissemination of this information or reproduction
 * of this material is prohibited unless prior written
 * permission is granted..
 ****************************************************/

#include   "VertexData.h"
#include   "Utilities.h"

/**
 *  @fn   VertexData::VertexData(const dvec4 &pos, const dvec3 &norm, const Material &mat, const dvec3 &worldPos) : position(pos), normal(glm::normalize(norm)), material(mat), worldPosition(worldPos)
 *  @brief    Constructor
 *  @param    pos         Current coordinate.
 *  @param    norm        Normal vector
 *  @param    mat         Material
 *  @param    worldPos    World position.
 */

VertexData :: VertexData ( const  dvec4  & pos ,
                 const  dvec3  & norm ,
                 const   Material   & mat ,
                 const  dvec3  & worldPos )   :
    pos ( pos ),  normal ( glm :: normalize ( norm )),  material ( mat ),  worldPos ( worldPos )   {
}

/**
 *  @fn   VertexData::VertexData(double w1, const VertexData &vd1, double w2, const VertexData &vd2)
 *  @brief    Constructs object using weighted average of two VertexData objects.
 *  @param    w1  Weight #1.
 *  @param    vd1 VertexData #1.
 *  @param    w2  Weight #2.
 *  @param    vd2 VertexData #2.
 */

VertexData :: VertexData ( double  w1 ,   const   VertexData   & vd1 ,
                     double  w2 ,   const   VertexData   & vd2 )
                     :  pos ( weightedAverage ( w1 ,  vd1 . pos ,  w2 ,  vd2 . pos )),
                        normal ( weightedAverage ( w1 ,  vd1 . normal ,  w2 ,  vd2 . normal )),
                        material ( weightedAverage ( w1 ,  vd1 . material ,  w2 ,  vd2 . material )),
                        worldPos ( weightedAverage ( w1 ,  vd1 . worldPos ,  w2 ,  vd2 . worldPos ))   {
}

/**
 *  @fn   void VertexData::addTriVertsAndComputeNormal(vector<VertexData> &verts, const dvec4 &V1, const dvec4 &V2, const dvec4 &V3, const dvec3 &n, const Material &mat)
 *  @brief    Adds a triangle vertices, adding vertices to end of verts. Vertices are specified
 *          in counterclockwise order.
 *  @param  [in,out]  verts   The vector of vertices.
 *  @param            V1      The first vertice
 *  @param            V2      The second vertice.
 *  @param            V3      The third vertice.
 *  @param            n       Normal vector.
 *  @param            mat     The matrix.
 */

void   VertexData :: addTriVertsAndNormal ( vector < VertexData >   & verts ,
                                             const  dvec4  & V1 ,
                                             const  dvec4  & V2 ,
                                             const  dvec4  & V3 ,
                                             const  dvec3  & n ,
                                             const   Material   & mat )   {
    verts . push_back ( VertexData ( V1 ,  n ,  mat ));
    verts . push_back ( VertexData ( V2 ,  n ,  mat ));
    verts . push_back ( VertexData ( V3 ,  n ,  mat ));
}

/**
 *  @fn   void VertexData::addTriVertsAndComputeNormal(vector<VertexData> &verts, const dvec4 &V1, const dvec4 &V2, const dvec4 &V3, const Material &mat)
 *  @brief    Adds a triangle vertices and computes normal, adding vertices to end of verts. Vertices are specified in counterclockwise order.
 *  @param  [in,out]  verts   The vector of vertices.
 *  @param            V1      The first vertice
 *  @param            V2      The second vertice.
 *  @param            V3      The third vertice.
 *  @param            mat     Material.
 */

void   VertexData :: addTriVertsAndComputeNormal ( vector < VertexData >   & verts ,
                                             const  dvec4  & V1 ,
                                             const  dvec4  & V2 ,
                                             const  dvec4  & V3 ,
                                             const   Material   & mat )   {
    dvec3 n  =  normalFrom3Points ( V1 . xyz (),  V2 . xyz (),  V3 . xyz ());
    verts . push_back ( VertexData ( V1 ,  n ,  mat ));
    verts . push_back ( VertexData ( V2 ,  n ,  mat ));
    verts . push_back ( VertexData ( V3 ,  n ,  mat ));
}

/**
 *  @fn   void VertexData::addTriVertsAndComputeNormals(vector<VertexData> &verts, const vector<dvec4> &pts, const Material &mat)
 *  @brief    Adds multiple triangles to triangle vertices
 *  @param  [in,out]  verts   The vector of vertices.
 *  @param            pts     The new triangle vertices to be added.
 *  @param            mat     Material.
 */

void   VertexData :: addTriVertsAndComputeNormals ( vector < VertexData >   & verts ,
                                 const  vector < dvec4 >   & pts ,
                                 const   Material   & mat )   {
    size_t numTris  =  pts . size ()   /   3 ;
     for   ( size_t i  =   0 ;  i  <  numTris ;  i ++ )   {
         const  dvec4  & V1  =  pts [ 3   *  i ];
         const  dvec4  & V2  =  pts [ 3   *  i  +   1 ];
         const  dvec4  & V3  =  pts [ 3   *  i  +   2 ];
        addTriVertsAndComputeNormal ( verts ,  V1 ,  V2 ,  V3 ,  mat );
     }
}

/**
 *  @fn   void VertexData::addConvexPolyVertsAndComputeNormals(vector<VertexData> &verts, const vector<dvec4> &polyCorners, const Material &mat)
 *  @brief    Converts polygon into triangles vertices and adds them to vert.
 *  @param  [in,out]  verts   The vector of vertices.
 *  @param            polyCorners     The polygon to be added.
 *  @param            mat     Material.

 */

void   VertexData :: addConvexPolyVertsAndComputeNormals ( vector < VertexData >   & verts ,
                                         const  vector < dvec4 >   & polyCorners ,
                                         const   Material   & mat )   {
    size_t numTris  =  polyCorners . size ()   -   2 ;
     for   ( size_t i  =   0 ;  i  <  numTris ;  i ++ )   {
         const  dvec4  & V1  =  polyCorners [ 0 ];
         const  dvec4  & V2  =  polyCorners [ +   1 ];
         const  dvec4  & V3  =  polyCorners [ +   2 ];
        addTriVertsAndComputeNormal ( verts ,  V1 ,  V2 ,  V3 ,  mat );
     }
}

/**
 *  @fn   void VertexData::addConvexPolyVertsAndComputeNormals(vector<VertexData> &verts, const dvec4 &p1, const dvec4 &p2, const dvec4 &p3, const dvec4 &p4, const Material &mat)
 *  @brief    Adds a convex quadrilateral.
 *  @param  [in,out]  verts   The vertices.
 *  @param            p1      The first vertex.
 *  @param            p2      The second vertex.
 *  @param            p3      The third vertex.
 *  @param            p4      The fourth vertex.
 *  @param            mat     The matrix.
 */

void   VertexData :: addConvexPolyVertsAndComputeNormals ( vector < VertexData >   & verts ,
                                         const  dvec4  & p1 ,
                                         const  dvec4  & p2 ,
                                         const  dvec4  & p3 ,
                                         const  dvec4  & p4 ,
                                         const   Material   & mat )   {
    addConvexPolyVertsAndComputeNormals ( verts ,  vector < dvec4 > ({  p1 ,  p2 ,  p3 ,  p4  }),  mat );
}

/**
 *  @fn   VertexData operator* (double w, const VertexData &data)
 *  @brief    Multiplication operator for VertexData objects
 *  @param    w       The scalar multiplier.
 *  @param    data    Vertex data to scale.
 *  @return   The scaled Vertex data.
 */

VertexData   operator   *   ( double  w ,   const   VertexData   & data )   {
     VertexData  result ( w * data . pos ,  w * data . normal ,  w * data . material ,  w * data . worldPos );
     return  result ;
}

/**
 *  @fn   VertexData VertexData::operator+ (const VertexData &other) const
 *  @brief    Addition operator for VertexData objects
 *  @param    other   The 2nd VertexData object.
 *  @return   The raw summation of the two VertexData objects
 */

VertexData   VertexData :: operator   +   ( const   VertexData   & other )   const   {
     VertexData  result ( * this );
    result . material  +=  other . material ;
    result . normal  +=  other . normal ;
    result . pos  +=  other . pos ;
    result . worldPos  +=  other . worldPos ;
     return  result ;
}