diff --git a/.todo b/.todo index c3e5df9..98cc554 100644 --- a/.todo +++ b/.todo @@ -1,2 +1 @@ -- rapid prototyping demo - support reference objects diff --git a/Engine.cc b/Engine.cc index bbc19b2..806edfe 100644 --- a/Engine.cc +++ b/Engine.cc @@ -1414,6 +1414,7 @@ void Engine::Object::draw() { glPushAttrib(GL_TRANSFORM_BIT); glEnable(GL_NORMALIZE); + glPushMatrix(); glScalef(m_scale, m_scale, m_scale); } @@ -1422,7 +1423,10 @@ void Engine::Object::draw() checkGLError(); if (m_is_scaled) + { + glPopMatrix(); glPopAttrib(); + } if (transform) glPopMatrix(); diff --git a/lib/demo/checkers.lua b/lib/demo/checkers.lua index 6bac0d0..f9a3e06 100644 --- a/lib/demo/checkers.lua +++ b/lib/demo/checkers.lua @@ -13,3 +13,9 @@ function init_event() checker = ag.loadTexture("checker.jpg") createWorld() end + +function reinit_event() + ball = ag.createSphere(0.5) + ball:setColor(1, 1, 0) + ball:setPosition(3, 3, 4) +end diff --git a/tests/bowling.lua b/tests/bowling.lua index 7cd2726..dda6cf0 100644 --- a/tests/bowling.lua +++ b/tests/bowling.lua @@ -1,5 +1,7 @@ function init_event() + ag.import("std") + local rows = 5 local offset = 1 local pin = ag.loadModel("bowling_pin", 0.5) @@ -22,13 +24,9 @@ function init_event() ball = ag.loadModel("checkerball", 0.5) ball:setPosition(2*camx - cx, 2*camy - cy, 2*camz - cz) ball:setMass(5) - --ball = ag.createSphere(0.4) - --ball:setColor(0.2, 0.2, 0.9) --- local crate = ag.loadModel("crate") --- crate:setPosition(0, 20, 10) - --- crate_texture = ag.loadTexture("crate.png") + smallPin = std.loadModelBounds("bowling_pin", 0, 0, 1) + smallPin:setPosition(0, -1, 1) end function mousebutton_down_event(button)