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);
|
||||
glPopMatrix();
|
||||
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;
|
||||
}
|
||||
gluDeleteQuadric(quad);
|
||||
glEndList();
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,14 @@ camx, camy, camz, cx, cy, cz = ag.getCamera()
|
||||
ball = ag.loadModel("checkerball")
|
||||
ball:setPosition(2*camx - cx, 2*camy - cy, 2*camz - cz)
|
||||
|
||||
function key_down_event(key)
|
||||
if (key == "space") then
|
||||
function mousebutton_down_event(button)
|
||||
local function button1()
|
||||
local newball = ball:clone()
|
||||
newball:setPosition(camx, camy, camz)
|
||||
force = 10000
|
||||
newball:addForce(force * (cx-camx), force * (cy-camy), force * (cz-camz))
|
||||
end
|
||||
if (button == 1) then
|
||||
button1()
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user