Cleanup sea triangles creation.
This commit is contained in:
parent
9e77e6680b
commit
f66c6ea6e9
@ -157,7 +157,7 @@ def main():
|
||||
|
||||
sea_polar_textures = sea.load_polar_textures(('data/sea_bump1.png', 'data/sea_bump2.png'))
|
||||
sea_detail_texture = sea.load_detail_texture('data/sea_bump.png')
|
||||
sea_triangles = sea.SeaTriangles(64, proj_far_z - 0.1, proj_ratio)
|
||||
sea_triangles = sea.sea_triangles(64, proj_far_z - 0.1, proj_ratio)
|
||||
|
||||
scene = SceneNode(
|
||||
FuncNode(update_camera, (mouse, camera, environment)),
|
||||
|
@ -71,9 +71,8 @@ def load_detail_texture(path, scale = 0.5, waves_height = 0.002):
|
||||
data = array(_typecode, list(map(_conv, normals)))
|
||||
return Texture(_format, width, height, 0, _flags, data)
|
||||
|
||||
class SeaTriangles(Triangles):
|
||||
# TODO: with FOV
|
||||
def __init__(self, vsubdivs, distance, projection_ratio):
|
||||
def sea_triangles(vsubdivs, distance, projection_ratio):
|
||||
assert vsubdivs > 0
|
||||
vertices = []
|
||||
hsubdivs = round(vsubdivs * projection_ratio)
|
||||
@ -102,4 +101,4 @@ class SeaTriangles(Triangles):
|
||||
x2 += stepx
|
||||
y1 = y2
|
||||
y2 += stepy
|
||||
super().__init__(array('f', chain.from_iterable(vertices)))
|
||||
return Triangles(array('f', chain.from_iterable(vertices)))
|
||||
|
Loading…
Reference in New Issue
Block a user