CMSC23740 Common Code Library
Support code for CS23740 programming projects
Loading...
Searching...
No Matches
cs237.hpp
Go to the documentation of this file.
1
10/*
11 * COPYRIGHT (c) 2024 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_CXX17 // we are using C++ 2017
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 GLFW and Vulkan library */
40#define VULKAN_HPP_TYPESAFE_CONVERSION 1
41#include <vulkan/vulkan.hpp>
42
43/* The GLFW library */
44//#define GLFW_INCLUDE_VULKAN
45#include <GLFW/glfw3.h>
46
47namespace cs237 {
48
51[[ noreturn ]]
52inline void ReportError (const char *file, int line, std::string const &msg)
53{
54 std::string s = "[" + std::string(file) + ":" + std::to_string(line) + "] " + msg;
55 throw std::runtime_error(s);
56}
57
58} // namespace cs237
59
60#define ERROR(msg) cs237::ReportError (__FILE__, __LINE__, msg);
61
62/* CS23740 support files */
63#include "cs237/types.hpp"
64
65#include "cs237/shader.hpp"
66#include "cs237/pipeline.hpp"
67#include "cs237/application.hpp"
68#include "cs237/window.hpp"
69#include "cs237/memory-obj.hpp"
70#include "cs237/buffer.hpp"
71#include "cs237/image.hpp"
72#include "cs237/texture.hpp"
73#include "cs237/attachment.hpp"
75
76/* geometric types */
77#include "cs237/aabb.hpp"
78#include "cs237/plane.hpp"
79#include "cs237/gobjects.hpp"
80
81/***** a wrapper for printing GLM vectors *****/
82template<glm::length_t L, typename T, glm::qualifier Q>
83std::ostream& operator<< (std::ostream& s, glm::vec<L,T,Q> const &v)
84{
85 return (s << glm::to_string(v));
86}
87
88#endif // !_CS237_HPP_
std::ostream & operator<<(std::ostream &s, glm::vec< L, T, Q > const &v)
Definition cs237.hpp:83
Definition aabb.hpp:22
void ReportError(const char *file, int line, std::string const &msg)
Definition cs237.hpp:52