comparison tests/test_materials.nim @ 1021:73b572f82a1f

add: bases for a better input-system
author sam <sam@basx.dev>
date Thu, 09 May 2024 23:02:35 +0700
parents a40bb0a48e07
children 74957cbf589b
comparison
equal deleted inserted replaced
1020:355ef428b5f4 1021:73b572f82a1f
39 39
40 var engine = initEngine("Test materials") 40 var engine = initEngine("Test materials")
41 41
42 const 42 const
43 shaderConfiguration1 = createShaderConfiguration( 43 shaderConfiguration1 = createShaderConfiguration(
44 name = "shader 1",
44 inputs = [ 45 inputs = [
45 attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), 46 attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead),
46 attr[Vec2f]("uv", memoryPerformanceHint = PreferFastRead), 47 attr[Vec2f]("uv", memoryPerformanceHint = PreferFastRead),
47 ], 48 ],
48 intermediates = [ 49 intermediates = [
65 engine.initRenderer({ 66 engine.initRenderer({
66 doubleTextureMaterial: shaderConfiguration1, 67 doubleTextureMaterial: shaderConfiguration1,
67 }) 68 })
68 engine.loadScene(scene) 69 engine.loadScene(scene)
69 var t = cpuTime() 70 var t = cpuTime()
70 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): 71 while engine.updateInputs() and not keyIsDown(Escape):
71 var d = float32(cpuTime() - t) 72 var d = float32(cpuTime() - t)
72 setShaderGlobalArray(scene, "test2", @[newVec4f(d), newVec4f(d * 2)]) 73 setShaderGlobalArray(scene, "test2", @[newVec4f(d), newVec4f(d * 2)])
73 engine.renderScene(scene) 74 engine.renderScene(scene)
74 engine.destroy() 75 engine.destroy()
75 76