I want to generate a terrain which looks like hills. Some sort of sine waves. Should be as simple as possible. But I can not figure out how. I get very scary results, which are nothing worth. I need to have vertices, normals and the indices of the vertices.
for(int i=0; i < size; i++) {
for(int j=0;j < size; j++) {
verticesList.add((float) j);
verticesList.add((float)Math.sin(j) * 1.5f);
verticesList.add((float) i);
normalsList.add((float) j);
normalsList.add((float)Math.sin(j) * 1.5f);
normalsList.add((float) i);
indicesList.add((byte)(i+j));
verticesList.add((float) j);
verticesList.add((float)Math.sin(j) * 1.5f);
verticesList.add((float) i+1);
normalsList.add((float) j);
normalsList.add((float)Math.sin(j) * 1.5f);
normalsList.add((float) i+1);
indicesList.add((byte)(i+j + 1));
}
}
I know that this is not the way how normals a "calculated".
P.S.: I need something like this:
edit:
How do I compute the normals?