I'm struggling. It works with cubes, cones and plains, but not with spheres and cylinders. Anyone else explain why?
sync on : sync rate 60 : autocam off
make object cube 1,10
`make object cone 1,10
`make object plain 1,10,10,1
`make object sphere 1,10,4,4
`make object cylinder 1,10
set object wireframe 1,1
set object cull 1,0
position camera 0,0,-20
LOCK VERTEXDATA FOR LIMB 1,0
vc=GET VERTEXDATA VERTEX COUNT()
ic=GET VERTEXDATA INDEX COUNT()
UNLOCK VERTEXDATA
if ic=0
polygons=vc/3
mode=0
else
polygons=ic/3
mode=1
endif
poly=0
make object sphere 3,0.5
ghost object on 3
make object sphere 4,0.5
ghost object on 4
make object sphere 5,0.5
ghost object on 5
do
c=0
if poly=0
poly=1 : c=1
else
if upkey() and poly <> polygons then inc poly : wait 100 : c=1
if downkey() and poly <> 1 then dec poly : wait 100 : c=1
endif
if c=1
if object exist(2)=1 then delete object 2
if mode=0
LOCK VERTEXDATA FOR LIMB 1,0
v1=(poly*3)-3
v2=v1+1
v3=v1+2
x1#=GET VERTEXDATA POSITION X(v1)
y1#=GET VERTEXDATA POSITION Y(v1)
z1#=GET VERTEXDATA POSITION Z(v1)
x2#=GET VERTEXDATA POSITION X(v2)
y2#=GET VERTEXDATA POSITION Y(v2)
z2#=GET VERTEXDATA POSITION Z(v2)
x3#=GET VERTEXDATA POSITION X(v3)
y3#=GET VERTEXDATA POSITION Y(v3)
z3#=GET VERTEXDATA POSITION Z(v3)
UNLOCK VERTEXDATA
else
LOCK VERTEXDATA FOR LIMB 1,0
i=(poly*3)-3
v1=GET INDEXDATA(i)
v2=GET INDEXDATA(i+1)
v3=GET INDEXDATA(i+2)
x1#=GET VERTEXDATA POSITION X(v1)
y1#=GET VERTEXDATA POSITION Y(v1)
z1#=GET VERTEXDATA POSITION Z(v1)
x2#=GET VERTEXDATA POSITION X(v2)
y2#=GET VERTEXDATA POSITION Y(v2)
z2#=GET VERTEXDATA POSITION Z(v2)
x3#=GET VERTEXDATA POSITION X(v3)
y3#=GET VERTEXDATA POSITION Y(v3)
z3#=GET VERTEXDATA POSITION Z(v3)
UNLOCK VERTEXDATA
endif
make object triangle 2,x1#,y1#,z1#,x2#,y2#,z2#,x3#,y3#,z3#
set object cull 2,0
ghost object on 2
color object 2,rgb(255,0,0)
endif
position object 3,x1#,y1#,z1#
sx=object screen x(3)
sy=object screen y(3)
text sx,sy,str$(v1)
position object 4,x2#,y2#,z2#
sx=object screen x(4)
sy=object screen y(4)
text sx,sy,str$(v2)
position object 5,x3#,y3#,z3#
sx=object screen x(5)
sy=object screen y(5)
text sx,sy,str$(v3)
set cursor 0,0
print "Vertex Count = ";vc
print "Index Count = ";ic
print "Polygon Count = ";polygons
print "Current Poly = ";poly
print "Use UP/DOWN keys to change poly"
print v1;" = ";x1#;",";y1#;",";z1#
print v2;" = ";x2#;",";y2#;",";z2#
print v3;" = ";x3#;",";y3#;",";z3#
sync
loop
Boo!