TerraForge3D
2.3.1
3D Terrain And Landscape Generator
Mesh.h
1
#pragma once
2
3
#define GLM_FORCE_SIMD_AVX2
4
#include <glm/glm.hpp>
5
6
enum
MeshType
7
{
8
Plane = 0,
9
Icosphere
10
};
11
12
struct
Vert
13
{
14
glm::vec4 position;
15
glm::vec4 normal;
16
glm::vec2 texCoord;
17
glm::vec4 extras1;
18
};
19
20
class
Mesh
21
{
22
public
:
23
Mesh
();
24
25
~Mesh
();
26
27
void
RecalculateNormals();
28
29
void
GeneratePlane(
int
resolution,
float
scale,
float
textureScale = 1.0f);
30
31
void
GenerateScreenQuad(
float
dist = 0);
32
33
void
GenerateIcoSphere(
int
resolution,
float
radius,
float
textureScale = 1.0f);
34
35
void
SetElevation(
float
elevation,
int
x,
int
y);
36
37
float
GetElevation(
int
x,
int
y);
38
39
void
AddElevation(
float
elevation,
int
x,
int
y);
40
41
glm::vec2 GetTexCoord(
float
x,
float
y,
float
z);
42
43
glm::vec3 GetNormals(
int
x,
int
y);
44
45
void
ClearNormals();
46
47
Mesh
*Clone();
48
49
bool
IsValid();
50
51
Vert
*vert;
52
int
*indices;
53
int
vertexCount;
54
int
indexCount;
55
int
res;
56
float
sc;
57
float
texSc;
58
float
maxHeight = -100;
59
float
minHeight = 100;
60
bool
deleteOnDestruction =
true
;
61
private
:
62
MeshType currType;
63
glm::vec3 right = glm::vec3(1.0f, 0.0f, 0.0f);
64
glm::vec3 front = glm::vec3(0.0f, 0.0f, -1.0f);
65
};
Mesh
Definition:
Mesh.h:21
Vert
Definition:
Mesh.h:13
TerraForge3D
include
Base
Mesh.h
Generated on Thu Apr 7 2022 14:10:50 for TerraForge3D by
1.9.3