-
Notifications
You must be signed in to change notification settings - Fork 25
/
NoiseCalculator.cpp
68 lines (46 loc) · 1.22 KB
/
NoiseCalculator.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Fill out your copyright notice in the Description page of Project Settings.
#include "PolyVox_Test.h"
//#include "TerrainGenManager.h"
#include "SimplexNoiseBPLibrary.h"
#include "NoiseCalculator.h"
NoiseCalculator::NoiseCalculator(ATerrainGenManager* chunk, FVector loc)
{
genchunk = chunk;
chunkloc = loc;
Thread = FRunnableThread::Create(this, TEXT("NoiseCalculator"), 0, TPri_BelowNormal);
}
NoiseCalculator::NoiseCalculator()
{
Thread = FRunnableThread::Create(this, TEXT("NoiseCalculator"), 0, TPri_BelowNormal);
}
NoiseCalculator::~NoiseCalculator()
{
delete Thread;
Thread = NULL;
}
bool NoiseCalculator::Init()
{
return true;
}
void NoiseCalculator::Stop()
{
isThreadFinished = true;
}
uint32 NoiseCalculator::Run()
{
UE_LOG(LogTemp, Error, TEXT("Spawning chunk"))
FVector loc = genchunk->GetActorLocation();
FVector loc = FVector(0.0f, 0.0f, -10.0f);
genchunk->initialize(chunkloc.X / 200.0f, chunkloc.Y / 200.0f, -10.0f);
genchunk->SetGenLoc(chunkloc.X / 200.0f, chunkloc.Y / 200.0f, -10.0f);
isThreadFinished = true;
return 0;
}
void NoiseCalculator::EnsureCompletion()
{
Stop();
Thread->WaitForCompletion();
}
void NoiseCalculator::ShutDown()
{
}