3D Types
Blitz3D Forums/Blitz3D Beginners Area/3D Types
| ||
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 ? |
| ||
Not sure what exactly you're after... however...type diamond field mesh end type d.diamond = new diamond d\mesh = loadmesh("diamond.3ds") |
| ||
so i have to load ( or copy ) the mesh for each type i create okey |
| ||
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 |
| ||
That was what i meant thanks =) |
| ||
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. |
| ||
Thanks for advise =), very bad spending a lot of emory if not nesesary.. |
| ||
@Shambler: slight error in your code.... should read: ;a faux-diamond CubicZirconiumMesh=CreateCube() ;-) |