fix terrain generation

This commit is contained in:
s469065 2023-02-13 07:04:56 +01:00
parent 546f36eb86
commit 2be10bdd8b
3 changed files with 145423 additions and 5 deletions

View File

@ -56,7 +56,7 @@
<ProjectGuid>{5BACD057-4B83-4CB6-A367-40A10BCE2149}</ProjectGuid> <ProjectGuid>{5BACD057-4B83-4CB6-A367-40A10BCE2149}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>grk-cw9</RootNamespace> <RootNamespace>grk-cw9</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
<ProjectName>grk-cw9</ProjectName> <ProjectName>grk-cw9</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

File diff suppressed because it is too large Load Diff

View File

@ -220,8 +220,8 @@ std::vector<glm::vec3> normals;
void Terraingen() { void Terraingen() {
//TODO offset //TODO offset
const int size = 128; const int size = 128;
const float scaleA = 0.01f; const float scaleA = 0.012f;
const float scaleB = 0.7f; const float scaleB = 0.08f;
for (int x = 0; x < size; x++) for (int x = 0; x < size; x++)
@ -234,10 +234,12 @@ void Terraingen() {
(x - size / 2) * scaleA, (x - size / 2) * scaleA,
(y - size / 2) * scaleA (y - size / 2) * scaleA
)); ));
//<-1,1> ~> <0,1>
noise = (noise + 1) / 2;
//x, y, z of a point //x, y, z of a point
vertices.push_back(glm::vec3( vertices.push_back(glm::vec3(
(x - size / 2) * scaleB, ((x - size / 2) * scaleB)+5,
noise * 1, ((noise * 1.2f)-0.65f),
(y - size / 2) * scaleB (y - size / 2) * scaleB
)); ));
} }