diff options
author | sanine <sanine.not@pm.me> | 2023-03-24 16:08:18 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-03-24 16:08:18 -0500 |
commit | d31a57c0afc8769cef8af82321c07cbc14c0474b (patch) | |
tree | ca8c8c981fc0633769e3c903d9e3b8ae89630e78 /main.lua | |
parent | e5553bb81c93cd76456d07d3a1d7e8bb1b249b6e (diff) |
fix issue with nanovg breaking rendering
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -59,14 +59,13 @@ level:addSystem{ surface = { mode = ode.ContactBounce + ode.ContactSoftCFM, mu = ode.Infinity, - bounce = 0.99, + bounce = 0.90, bounce_vel = 0.1, soft_cfm = 0.001, }, } local collisions = ode.Collide(o1, o2, 1) if #collisions > 0 then - print("collision detected!") ode.ContactSetGeom(contact, collisions[1]) local joint = ode.JointCreateContact(self.world, self.contactgroup, contact) ode.JointAttach(joint, b1, b2) @@ -83,7 +82,7 @@ level:addSystem{ end local x, y, z = ode.BodyGetPosition(entity.physicsBody) - local a, b, c, d = ode.BodyGetQuaternion(entity.physicsBody) + local d, a, b, c = ode.BodyGetQuaternion(entity.physicsBody) entity.transform:identity():translate(Vec3{x, y, z}):mul(Quaternion{a, b, c, d}:toMat4()) end, } @@ -150,7 +149,7 @@ local ball = { parent=false, mesh=icosa, shader=shader, - collisionShape=ode.CreateSphere(space, 0.5), + collisionShape=ode.CreateSphere(space, 1.0), physicsBody=ode.BodyCreate(world), } level:addEntity(ball) @@ -195,12 +194,21 @@ local fpsAverage = averager(200) -- main loop honey.loop(window, function(dt) gl.ClearColor(0.2, 0.4, 1.0, 1.0) - gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT) + gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT + gl.STENCIL_BUFFER_BIT) + + gl.UseProgram(0) + gl.Enable(gl.DEPTH_TEST) + level:update(dt) nvg.BeginFrame(vg, vw, vh, 1.0) nvg.StrokeColor(vg, nvg.RGBf(1, 1, 1)) nvg.FontFace(vg, "November") nvg.Text(vg, 50, 50, "fps: "..tostring(math.floor(fpsAverage(1/dt)))) + nvg.BeginPath(vg) + nvg.MoveTo(vg, 50, 50) + nvg.LineTo(vg, 50, 100) + nvg.LineTo(vg, 100, 50) + nvg.Stroke(vg) nvg.EndFrame(vg) end) |