Does anyone have any quick "generate cube" code?

Blitz3D Forums/Blitz3D Programming/Does anyone have any quick "generate cube" code?

im rushing around at the moment and cant think quickly enough to make one myself.
And nope, i dont mean CreateCube()

Something that does it using the createmesh functions?


Cheers guys (and any gals who are around too!) :)


[edit]

Found a fix:

Function CreateCube(parent=0)
Local m,s
	m=CreateMesh(parent)
	s=CreateSurface( m)
	AddVertex s,-1,+1,-1,0,0:AddVertex s,+1,+1,-1,1,0
	AddVertex s,+1,-1,-1,1,1:AddVertex s,-1,-1,-1,0,1
	AddTriangle s,0,1,2:AddTriangle s,0,2,3
	s=CreateSurface( m)
	AddVertex s,+1,+1,-1,0,0:AddVertex s,+1,+1,+1,1,0
	AddVertex s,+1,-1,+1,1,1:AddVertex s,+1,-1,-1,0,1
	AddTriangle s,0,1,2:AddTriangle s,0,2,3
	s=CreateSurface( m)
	AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0
	AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1
	AddTriangle s,0,1,2:AddTriangle s,0,2,3
	s=CreateSurface( m)
	AddVertex s,-1,+1,+1,0,0:AddVertex s,-1,+1,-1,1,0
	AddVertex s,-1,-1,-1,1,1:AddVertex s,-1,-1,+1,0,1
	AddTriangle s,0,1,2:AddTriangle s,0,2,3
	s=CreateSurface( m)
	AddVertex s,-1,+1,+1,0,1:AddVertex s,+1,+1,+1,0,0
	AddVertex s,+1,+1,-1,1,0:AddVertex s,-1,+1,-1,1,1
	AddTriangle s,1,2,0:AddTriangle s,2,3,0
	s=CreateSurface( m)
	AddVertex s,-1,-1,-1,1,0:AddVertex s,+1,-1,-1,1,1
	AddVertex s,+1,-1,+1,0,1:AddVertex s,-1,-1,+1,0,0
	AddTriangle s,0,1,2:AddTriangle s,0,2,3
	FitMesh m,-1,-1,-1,2,2,2
	UpdateNormals m
	Return m
End Function


There is one (or two) here:
http://www.blitzbasic.com/logs/userlog.php?user=6822&log=379

Myb god hes been at it, aint ya "Puki"? :D


Cheers for that Beaker...

WOW - "Beaker" saw my worklog.

Yeh, I am working away at documenting vertex stuff. In honesty, I am a newbie at this, but I want to document my ongoing experience so that others can eventually benefit from it.

Be careful with my stuff though - it may not be the most optimised. Some of the comments in the code may be incorrect (but that won't affect the code).

i saw your worklog too :P

Ive dont vertex n creation quite heavily before but i just needed to grab some quick code- Youve done some very good stuff puki!

And nope, i dont mean CreateCube()

Damn.

/me wanders off....

Its all sorted now... juts added my cubemap system into supernova- and im thorougholy dissapointed at how incorect cubemaps are....when used on cubes.... :/

Does it work if you just try to do the mapping to one face of the cube?

sorry, what do you mean by that? not sure what you mean.

Oh, I thought you were doing the cube-mapping to each side of the cube and it wasn't working.

Ignore me - I'm mental.

hehe. no worries :/ il hjave to just do a clever spheremap trick instead of cubemap. Odd, init?


Wait.. no, cuz you cant correctly spheremap a cube.


Il just do a standard texture :/