Created
January 22, 2014 21:17
-
-
Save BitPuffin/8567509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
TTerrainSection* = tuple | |
buffer: PArrayBuffer | |
geometry: ref tuple [ | |
indices: array[0..sectionTriangleCount-1, array[0..2, int]], | |
vertices: array[0..sectionArea-1, TVec3]] | |
heightmap: ref array[0..sectionWidth-1, array[0..sectionHeight-1, uint32]] | |
PTerrainSection* = ref TTerrainSection | |
TTerrainSections* = TQuadTree[PTerrainSection] | |
... | |
proc generateVertices(section: PTerrainSection) = | |
debug("Generating vertices from heightmap") | |
if section.heightmap == nil: # ERROR: Type mismatch blaablablabla | |
# This might attempt to read from disk in the future | |
error("Heightmap was nil, this shouldn't happen!") | |
raise newException(E_Base, "Heightmap was nil, this is unacceptable") | |
if section.geometry.vertices != nil: | |
error("Vertices are not nil, this shouldn't happen") | |
raise newException(E_Base, "Vertices are not nil") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment