CMSC23740 Common Code Library
Support code for CS23740 programming projects
Loading...
Searching...
No Matches
cs237.hpp
Go to the documentation of this file.
1
9
10/*
11 * COPYRIGHT (c) 2026 John Reppy (https://cs.uchicago.edu/~jhr)
12 * All rights reserved.
13 */
14
15#ifndef _CS237_HPP_
16#define _CS237_HPP_
17
18#include "cs237/config.h"
19
20#include <cmath>
21#include <cstdint>
22#include <cassert>
23#include <iostream>
24#include <memory>
25#include <string>
26#include <vector>
27#include <algorithm>
28
29/* GLM include files; we include the extensions, such as transforms,
30 * and enable the experimental support for `to_string`.
31 */
32#define GLM_FORCE_CXX20 // we are using C++ 2020
33#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES // make vec3 consistent with GLSL shaders
34#define GLM_FORCE_DEPTH_ZERO_TO_ONE // Vulkan's clip-space Z-axis is 0..1
35#include "glm/glm.hpp"
36#define GLM_ENABLE_EXPERIMENTAL
37#include "glm/ext.hpp"
38
39/* The Vulkan library */
40#define VULKAN_HPP_TYPESAFE_CONVERSION 1
41#include <vulkan/vulkan.hpp>
42
43/* The Vuklan Memory Allocation (VMA) library */
44#ifdef CS237_USE_VMA
45#include <vma/vk_mem_alloc.h>
46#endif
47
48/* The GLFW library */
49//#define GLFW_INCLUDE_VULKAN
50#include <GLFW/glfw3.h>
51
52namespace cs237 {
53
56[[ noreturn ]]
57inline void ReportError (const char *file, int line, std::string const &msg)
58{
59 std::string s = "[" + std::string(file) + ":" + std::to_string(line) + "] " + msg;
60 throw std::runtime_error(s);
61}
62
63} // namespace cs237
64
65#define ERROR(msg) cs237::ReportError (__FILE__, __LINE__, msg);
66
67/* CS23740 support files */
68#include "cs237/types.hpp"
69
70#include "cs237/shader.hpp"
71#include "cs237/pipeline.hpp"
72#include "cs237/application.hpp"
73#include "cs237/window.hpp"
74#include "cs237/memory-obj.hpp"
75#include "cs237/buffer.hpp"
76#include "cs237/image.hpp"
77#include "cs237/texture.hpp"
78#include "cs237/attachment.hpp"
80
81/* geometric types */
82#include "cs237/aabb.hpp"
83#include "cs237/plane.hpp"
84#include "cs237/gobjects.hpp"
85
86/***** a wrapper for printing GLM vectors *****/
87template<glm::length_t L, typename T, glm::qualifier Q>
88std::ostream& operator<< (std::ostream& s, glm::vec<L,T,Q> const &v)
89{
90 return (s << glm::to_string(v));
91}
92
93#endif // !_CS237_HPP_
std::ostream & operator<<(std::ostream &s, glm::vec< L, T, Q > const &v)
Definition cs237.hpp:88
Definition aabb.hpp:22
void ReportError(const char *file, int line, std::string const &msg)
Definition cs237.hpp:57