reorg modules
This commit is contained in:
parent
7262e4fa2e
commit
1d5579db6d
9 changed files with 68 additions and 63 deletions
|
@ -1,30 +1,33 @@
|
|||
"""
|
||||
This shows how to use the Pyray wrapper around the static binding.
|
||||
"""
|
||||
from raylib.static.pyray import pyray as prl
|
||||
|
||||
from raylib.pyray import PyRay
|
||||
from raylib.colors import *
|
||||
|
||||
prl.init_window(800, 450, "Raylib texture test")
|
||||
prl.set_target_fps(60)
|
||||
pyray = PyRay()
|
||||
|
||||
camera = prl.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
|
||||
image = prl.load_image("examples/models/resources/heightmap.png")
|
||||
texture = prl.load_texture_from_image(image)
|
||||
mesh = prl.gen_mesh_heightmap(image, (16, 8, 16))
|
||||
model = prl.load_model_from_mesh(mesh)
|
||||
model.materials.maps[prl.MAP_DIFFUSE].texture = texture
|
||||
pyray.init_window(800, 450, "Raylib texture test")
|
||||
pyray.set_target_fps(60)
|
||||
|
||||
prl.unload_image(image)
|
||||
prl.set_camera_mode(camera, prl.CAMERA_ORBITAL)
|
||||
camera = pyray.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
|
||||
image = pyray.load_image("examples/models/resources/heightmap.png")
|
||||
texture = pyray.load_texture_from_image(image)
|
||||
mesh = pyray.gen_mesh_heightmap(image, (16, 8, 16))
|
||||
model = pyray.load_model_from_mesh(mesh)
|
||||
model.materials.maps[pyray.MAP_DIFFUSE].texture = texture
|
||||
|
||||
while not prl.window_should_close():
|
||||
prl.update_camera(prl.pointer(camera))
|
||||
prl.begin_drawing()
|
||||
prl.clear_background(RAYWHITE)
|
||||
prl.begin_mode_3d(camera)
|
||||
prl.draw_model(model, (-8.0, 0.0, -8.0), 1.0, RED)
|
||||
prl.draw_grid(20, 1.0)
|
||||
prl.end_mode_3d()
|
||||
prl.draw_text("This mesh should be textured", 190, 200, 20, VIOLET)
|
||||
prl.end_drawing()
|
||||
prl.close_window()
|
||||
pyray.unload_image(image)
|
||||
pyray.set_camera_mode(camera, pyray.CAMERA_ORBITAL)
|
||||
|
||||
while not pyray.window_should_close():
|
||||
pyray.update_camera(pyray.pointer(camera))
|
||||
pyray.begin_drawing()
|
||||
pyray.clear_background(RAYWHITE)
|
||||
pyray.begin_mode_3d(camera)
|
||||
pyray.draw_model(model, (-8.0, 0.0, -8.0), 1.0, RED)
|
||||
pyray.draw_grid(20, 1.0)
|
||||
pyray.end_mode_3d()
|
||||
pyray.draw_text("This mesh should be textured", 190, 200, 20, VIOLET)
|
||||
pyray.end_drawing()
|
||||
pyray.close_window()
|
||||
|
|
Reference in a new issue