3D Types

Blitz3D Forums/Blitz3D Beginners Area/3D Types

cermit(Posted 2004) [#1]
Now im not used to Blitz3D even that i got Blitz3D.
So in 1d, you can draw an image how many times you want.
But when it comes to 3d how do i do that with 3d entities?

Say i have a type called 3d.diamonds and i want a
field with those, how can i do that ?


Rob Farley(Posted 2004) [#2]
Not sure what exactly you're after... however...

type diamond
field mesh
end type

d.diamond = new diamond
d\mesh = loadmesh("diamond.3ds")



cermit(Posted 2004) [#3]
so i have to load ( or copy ) the mesh for each type i create okey


Shambler(Posted 2004) [#4]
Here's a little demo for you

;Cermit in the sky with diamonds
Graphics3D 800,600

;a camera
cam=CreateCamera()
CameraClsColor cam,0,0,50
PositionEntity cam,0,60,0

;camera target
look=CreatePivot()
PositionEntity look,0,0,0
PointEntity cam,look

;a light
light=CreateLight(2)
PositionEntity light,0,10,0
LightColor light,255,255,0


;a diamond
diamondmesh=CreateCube()
PositionEntity diamondmesh,100000,100000,100000
HideEntity diamondmesh


Type diamond
Field mesh
End Type

;create a field of diamonds
For x=-50 To 50 Step 10
For z=-50 To 50 Step 10
d.diamond=New diamond
d\mesh=CopyMesh(diamondmesh)
PositionEntity d\mesh,x,0,z
EntityShininess d\mesh,1
EntityColor d\mesh,255,255,0
Next 
Next 



While Not KeyHit(1)

;twinkle twinkle
For d.diamond=Each diamond
TurnEntity d\mesh,Rnd(3),Rnd(3),Rnd(3)
Next


RenderWorld()
Text 0,0,"Press Escape to exit"
Flip

Wend



cermit(Posted 2004) [#5]
That was what i meant thanks =)


Zethrax(Posted 2004) [#6]
Generally you'll find it better to use CopyEntity rather than CopyMesh, though. CopyMesh does a full copy of all the mesh data, whereas CopyEntity uses the mesh data of the original mesh, which saves memory and is probably much faster when copying.


cermit(Posted 2004) [#7]
Thanks for advise =), very bad spending
a lot of emory if not nesesary..


BlackJumper(Posted 2004) [#8]
@Shambler:

slight error in your code.... should read:
;a faux-diamond
CubicZirconiumMesh=CreateCube()


;-)