
separate (adagate.drawisland)


procedure drawZPM is
begin



	--////// draw double cylinder ZPM begin ///////////
	glUseProgram(pidzpm34);

-------------------------------------------------------------------------
	bmvp := imvp;
	if mrolling then

		barreltime := glfwGetTime;
		tt := float( (barreltime - timeofroll ) / secperroll );
		barangle := onepi*tt*rad2deg;

		if( tt<1.0 ) then
			mposbar(1):=olbarrl(1)+tt*(nubarrl(1)-olbarrl(1));
			mposbar(2):=olbarrl(2)+tt*(nubarrl(2)-olbarrl(2));
			mposbar(3):=olbarrl(3)+tt*(nubarrl(3)-olbarrl(3));

			if    (rolldir=-1) then axis:=xaxis; barangle:=-barangle;
			elsif (rolldir=+1) then axis:=xaxis;
			elsif (rolldir=+3) then axis:=zaxis; barangle:=-barangle;
			elsif (rolldir=-3) then axis:=zaxis;
			end if;

			cyl2obj.updcyl2(mbarrel, mposbar(1),mposbar(2),mposbar(3));
			bmm:=identity;
			translate(bmm, -mposbar(1), -mposbar(2), -mposbar(3) );
			degRotate(bmm, barangle, axis(1), axis(2), axis(3) );
			translate(bmm, mposbar(1), mposbar(2), mposbar(3) );
			bmvp := bmm;
			matXmat( bmvp, iviewmatrix ); --vm ); -- check vm
			matXmat( bmvp, projMatrix ); -- check pm
		else
			mrolling:=false;
			mposbar:=nubarrl;
			cyl2obj.updcyl2(mbarrel, mposbar(1),mposbar(2),mposbar(3));
		end if; -- tt
	end if; -- mrolling
	gluniformmatrix4fv( imvp34, 1, gl_false, bmvp(1,1)'address );
-------------------------------------------------------------------------

	if  not mseated  then
		cyl2obj.Draw(mbarrel,vertbuff,rgbbuff,elembuff, false);
	else
		cyl2obj.Draw(mbarrel,vertbuff,rgbbuff,elembuff, true);
	end if;

	--////// draw double cylinder ZPM end ///////////


end drawZPM;


