[SOLVED] Get data, vertices (xyz) and polygons (normal)

Hi, I’m trying to write a mask generator for the landscape.

However, the functions:
GetHeight () and getNormal () return data based on the coordinates in the world.
How can sort out the mesh terrain, and get the vertex and normal data from the polygons?

An example of the Noob code:

	void generig_map(TerrainQuad terrain) {

		int size = terrain.getTerrainSize();

		for (int x = 0; x < size; x++) {
			for (int y = 0; y < size; y++) {
				System.out.print("Height: " + terrain.getHeight(new Vector2f(x, y)) + "\n");
			}
		}
	};

You have the heightmap for height and your loops gave you the x and z coordinates.

The landscape is usually scaled by Y, not rely on a height map.

The GetHeight () and getNormal () functions do not provide local terrain mesh data, they provide render data. What is not expected of them.

But you know the scale because you set it.

Yes,know the scale, but I want to go through vertex and normal of the landscape grid. In this case, terrain.getHeight (new Vector2f (x, y)) returns any coordinates and is not based on the vertex index.

I expected this to be the indices of the vertices. But it was not so.

Then im sorry but i dont easily know how to do what you are asking. Could you maybe explain exactly what you are trying to do? I know what you want but i dont understand why. There may be easier ways if we know the result you are trying to achieve.

I did get the result, but I used Panda3D to generate the mask.

I assumed that the method getHeight() is based on vertex indices, for example: x 0 and z 0 is the first vertex in the grid pool. But it turned out that it just gets a point on the surface.

I’m used to other thinking, because of the use of other engines.