OWL
Loading...
Searching...
No Matches
common.h
1// ======================================================================== //
2// Copyright 2019-2020 Ingo Wald //
3// //
4// Licensed under the Apache License, Version 2.0 (the "License"); //
5// you may not use this file except in compliance with the License. //
6// You may obtain a copy of the License at //
7// //
8// http://www.apache.org/licenses/LICENSE-2.0 //
9// //
10// Unless required by applicable law or agreed to in writing, software //
11// distributed under the License is distributed on an "AS IS" BASIS, //
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13// See the License for the specific language governing permissions and //
14// limitations under the License. //
15// ======================================================================== //
16
21#pragma once
22
23#include <owl/common/math/vec.h>
24#include <owl/common/math/box.h>
25#include <owl/common/math/AffineSpace.h>
26
27#include <string.h>
28#include <set>
29#include <map>
30#include <vector>
31#include <stack>
32#include <typeinfo>
33#include <mutex>
34#include <atomic>
35#include <sstream>
36
37namespace owl {
38
39 using owl::common::vec2uc;
40 using owl::common::vec3uc;
41 using owl::common::vec4uc;
42
43 using owl::common::vec2f;
44 using owl::common::vec3f;
45 using owl::common::vec4f;
46
47 using owl::common::vec2i;
48 using owl::common::vec3i;
49 using owl::common::vec4i;
50
51 using owl::common::vec2ui;
52 using owl::common::vec3ui;
53 using owl::common::vec4ui;
54
55 using owl::common::vec2l;
56 using owl::common::vec3l;
57 using owl::common::vec4l;
58
59 using owl::common::vec2ul;
60 using owl::common::vec3ul;
61 using owl::common::vec4ul;
62
63 using owl::common::box3f;
66
67 using owl::common::prettyNumber;
68 using owl::common::prettyDouble;
69
70 template<size_t alignment>
71 inline size_t smallestMultipleOf(size_t unalignedSize)
72 {
73 const size_t numBlocks = (unalignedSize+alignment-1)/alignment;
74 return numBlocks*alignment;
75 }
76
77 inline void *addPointerOffset(void *ptr, size_t offset)
78 {
79 if (ptr == nullptr) return nullptr;
80 return (void*)((unsigned char *)ptr + offset);
81 }
82
83}
84
85#define IGNORING_THIS() std::cout << OWL_TERMINAL_YELLOW << "## ignoring " << __PRETTY_FUNCTION__ << OWL_TERMINAL_DEFAULT << std::endl;
86
Definition: AffineSpace.h:52
3D Linear Transform (3x3 Matrix)
Definition: LinearSpace.h:185