fix terrain generation
This commit is contained in:
parent
546f36eb86
commit
2be10bdd8b
@ -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" />
|
||||||
|
145416
cw 9/models/GeneratedTerrain.obj
Normal file
145416
cw 9/models/GeneratedTerrain.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user