drawing capped cylinders now (i think)
git-svn-id: svn://anubis/anaglym/trunk@125 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
869e6465cc
commit
3ee41bfa9f
20
Engine.cc
20
Engine.cc
@ -733,9 +733,27 @@ void Engine::Object::render()
|
|||||||
gluCylinder(quad, (*m_args)[0], (*m_args)[0], (*m_args)[1], 12, 1);
|
gluCylinder(quad, (*m_args)[0], (*m_args)[0], (*m_args)[1], 12, 1);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
break;
|
break;
|
||||||
case OdeWorld::CCYLINDER:
|
case OdeWorld::CCYLINDER: {
|
||||||
|
glPushAttrib(GL_TRANSFORM_BIT); /* save current clip planes */
|
||||||
|
double halfheight = (*m_args)[1] / 2.0;
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(0, 0, -halfheight);
|
||||||
|
gluCylinder(quad, (*m_args)[0], (*m_args)[0], (*m_args)[1], 12, 1);
|
||||||
|
|
||||||
|
double clip_plane[] = {0, 0, -1, halfheight};
|
||||||
|
glClipPlane(GL_CLIP_PLANE0, clip_plane);
|
||||||
|
glEnable(GL_CLIP_PLANE0);
|
||||||
|
gluSphere(quad, (*m_args)[0], 12, 8);
|
||||||
|
glTranslatef(0, 0, 2*halfheight);
|
||||||
|
clip_plane[2] = 1.0;
|
||||||
|
glClipPlane(GL_CLIP_PLANE0, clip_plane);
|
||||||
|
gluSphere(quad, (*m_args)[0], 12, 8);
|
||||||
|
glPopMatrix();
|
||||||
|
glPopAttrib();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gluDeleteQuadric(quad);
|
||||||
glEndList();
|
glEndList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,11 +19,14 @@ camx, camy, camz, cx, cy, cz = ag.getCamera()
|
|||||||
ball = ag.loadModel("checkerball")
|
ball = ag.loadModel("checkerball")
|
||||||
ball:setPosition(2*camx - cx, 2*camy - cy, 2*camz - cz)
|
ball:setPosition(2*camx - cx, 2*camy - cy, 2*camz - cz)
|
||||||
|
|
||||||
function key_down_event(key)
|
function mousebutton_down_event(button)
|
||||||
if (key == "space") then
|
local function button1()
|
||||||
local newball = ball:clone()
|
local newball = ball:clone()
|
||||||
newball:setPosition(camx, camy, camz)
|
newball:setPosition(camx, camy, camz)
|
||||||
force = 10000
|
force = 10000
|
||||||
newball:addForce(force * (cx-camx), force * (cy-camy), force * (cz-camz))
|
newball:addForce(force * (cx-camx), force * (cy-camy), force * (cz-camz))
|
||||||
end
|
end
|
||||||
|
if (button == 1) then
|
||||||
|
button1()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user