Opened 7 years ago
Last modified 17 months ago
#4825 assigned defect
Delete TILE_CENTERED_HEIGHT_MAP
Reported by: | elexis | Owned by: | smiley |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | Maps | Keywords: | |
Cc: | Patch: | Phab:D4687 |
Description
As elaborated here Phab:rP10878#23878 and here Phab:rP12641, the TILE_CENTERED_HEIGHT_MAP
property is intransparent.
FeXoR proposed in a @todo
in heightmap.js
to remove this property and always have the actual height set in the heightmap of the map.
About every call to getHeight
intends to get the height of the center of a tile in order to possibly modify that tile (for example paintTerrainBasedOnHeight
does that).
So these calls should just compute the height of the center instead of the height of the corner and not leave the reader in confusion.
Change History (5)
comment:1 by , 6 years ago
comment:2 by , 5 years ago
The function getTileCenteredHeightmap
in
heightmap.js
can also provide the needed information.
comment:3 by , 4 years ago
Oh, but the function's names should be telling:
getHeight(x, y)
should return the height of the vertex with the given integer coordinates and raise for float arguments.
getExactHeight(vector2D)
should return the calculated height at the floating coordinate.
getTileHeight(x, y)
should return the height of the center of the tile with the given indices.
While getTileHeight(x, y)
could just return
getExactHeight(vector2D(x + 0.5, y + 0.5))
IMO it's more relevant to be fast then precise and should rather return
getHeight(x, y) + getHeight(x + 1, y) + getHeight(x+1, y+1) + getHeight(x, y+1) / 4
or check the arguments and directly access the heightmap values.
comment:4 by , 2 years ago
Milestone: | Backlog → Alpha 27 |
---|---|
Owner: | set to |
Patch: | → Phab:D4687 |
Status: | new → assigned |
Absolutely. While getExactHeight() can do this it's very slow. I'd suggest to just use the average of the 4 corners of the tile.