Skip to content

Commit

Permalink
Translated scene_capture_texture.lua to a python file
Browse files Browse the repository at this point in the history
  • Loading branch information
Angar0Os committed Nov 19, 2024
1 parent 46654b9 commit f946b54
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scene_capture_texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,20 @@
while not hg.ReadKeyboard().Key(hg.K_Escape) and hg.IsWindowOpen(win):
dt = hg.TickClock()

#Update Scene and render to the frameBuffer
scene.Update(dt)

trs = scene.GetNode("engine_master").GetTransform()
trs.SetRot(trs.GetRot() + hg.Vec3(0, hg.Deg(15) * hg.time_to_sec_f(dt), 0))

view_id = 0
view_id = hg.SubmitSceneToPipeline(view_id, scene, hg.IntRect(0, 0, res_x, res_y), True, pipeline, res, frame_buffer.handle)
view_id, pass_id = hg.SubmitSceneToPipeline(view_id, scene, hg.IntRect(0, 0, res_x, res_y), True, pipeline, res, frame_buffer.handle)

#Draw a plabe using the texture the scene was rendered to
hg.SetViewPerspective(view_id , 0, 0, res_x, res_y, hg.TranslationMat4(hg.Vec3(0, 0, -1.8)))
hg.SetViewPerspective(view_id, 0, 0, res_x, res_y, hg.TranslationMat4(hg.Vec3(0, 0, -1.8)))

val_uniforms = {hg.MakeUniformSetValue('color', hg.Vec4(1, 1, 1, 1))}
tex_uniforms = {hg.MakeUniformSetTexture('s_tex', tex_color, 0)}
val_uniforms = [hg.MakeUniformSetValue('color', hg.Vec4(1, 1, 1, 1))]
tex_uniforms = [hg.MakeUniformSetTexture('s_tex', tex_color, 0)]

hg.DrawModel(view_id, plane_mdl, plane_prg, val_uniforms, tex_uniforms,
hg.TransformationMat4(hg.Vec3(0, 0, 0), hg.Vec3(math.pi / 2, 0, math.pi)))
Expand Down

0 comments on commit f946b54

Please sign in to comment.