OpenVDB 13.1.0
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#ifndef _USE_MATH_DEFINES
7#define _USE_MATH_DEFINES
8#endif
9#include <cmath>
10#include <chrono>
11#include <fstream>
12#include <nanovdb/NanoVDB.h>
13#include "ComputePrimitives.h"
14
15// http://www.burtleburtle.net/bob/hash/doobs.html
16inline __hostdev__ uint32_t hash(uint32_t x)
17{
18 x += (x << 10u);
19 x ^= (x >> 6u);
20 x += (x << 3u);
21 x ^= (x >> 11u);
22 x += (x << 15u);
23 return x;
24}
25
26inline __hostdev__ float randomf(uint32_t s)
27{
28 return hash(s) / float(0xffffffffu);
29}
A collection of parallel compute primitives.
Implements a light-weight self-contained VDB data-structure in a single file! In other words,...
__hostdev__ float randomf(uint32_t s)
Definition common.h:26
__hostdev__ uint32_t hash(uint32_t x)
Definition common.h:16
#define __hostdev__
Definition SampleFromVoxels.h:29