-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcachedNoiseObject.h
41 lines (35 loc) · 1.02 KB
/
cachedNoiseObject.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef CACHED_NOISE_OBJECT_H
#define CACHED_NOISE_OBJECT_H
#include "cachedNoise.h"
// #include "MurmurHash3.h"
#include "hash.h"
#include <node.h>
#include <node_object_wrap.h>
#include <random>
#include <unordered_map>
#include <vector>
using v8::Context;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Isolate;
using v8::Local;
using v8::Number;
using v8::Object;
using v8::Persistent;
using v8::String;
using v8::Value;
using v8::Exception;
class CachedNoiseObject : public node::ObjectWrap {
public:
static Persistent<Function> constructor;
static void Init(Isolate* isolate);
static void NewInstance(const FunctionCallbackInfo<Value>& args);
CachedNoise cachedNoise;
std::unordered_map<std::pair<int, int>, std::vector<double>> cache;
explicit CachedNoiseObject(int s, double frequency, int octaves);
static void New(const FunctionCallbackInfo<Value>& args);
static void In2D(const FunctionCallbackInfo<Value>& args);
double in2D(int x, int z);
};
#endif