until Michael release his next version with infinite points list here is a way to convert a picture to Entity in 3D, it will calculate the necessary number of partitions for the picture every partition is 999 points if you want use this picture
i wonder how to make the picture transparent, i have used MP_MeshSetAlpha (Entity(i),2) but it does not work.
Code: Select all
Global xres=640, yres=480
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "shadow, press Z, X keys to shift picture")
;MP_Wireframe(1)
camera=MP_CreateCamera()
light=MP_CreateLight(2)
MP_LightSetColor (light, RGB(255,255,255))
MP_InitShadow()
texture2 = MP_CreateTextureColor(256, 256, MP_ARGB(0,255,255,0))
texture = MP_CreateTextureColor(256, 256, MP_ARGB(0,255,0,0))
sphere = MP_CreateSphere(30)
MP_EntitySetColor(sphere,RGB(0,255,0))
MP_EntitySetTexture(sphere, texture2)
MP_ScaleMesh(sphere,1,1,1)
plane = MP_CreatePlane(10, 10)
MP_EntitySetTexture(plane, texture)
MP_RotateEntity(plane, 0, 90, 90)
MP_PositionCamera(camera, 10, 5, 6)
MP_CameraLookAt(camera,0,0,0)
MP_PositionEntity(light, 0, 10, 20)
MP_EntityLookAt(light,0,0,0)
;==============================================================
; load image
Define image_id.i
image_id = LoadImage( #PB_Any, "woman.bmp" )
Dim image_pixel_data.b( ImageWidth(image_id), ImageHeight(image_id) )
ImagePartitions = Int(ImageWidth(image_id)*ImageHeight(image_id)/999)
Dim Entity(ImagePartitions)
For i=0 To ImagePartitions
Entity(i) = MP_CreatePrimitives (999, 1)
Next i
Dim j(999)
StartDrawing( ImageOutput( image_id ) )
For y = 0 To ImageHeight(image_id) - 1
For x = 0 To ImageWidth(image_id) - 1
rd=MP_Red(Point( x, y ))
gr=MP_Green(Point( x, y ))
bl=MP_Blue(Point( x, y ))
pixColor = Point( x, y )
i+1
ImagePart = Int(i/999)
If ImagePart > ImagePartitions
Break 2
EndIf
MP_SetPrimitives(Entity(ImagePart), j(ImagePart), x, y, 0, MP_ARGB(0,rd,gr,bl))
j(ImagePart) + 1
Next x
Next y
StopDrawing()
For i=0 To ImagePartitions
MP_ScaleEntity(Entity(i), 0.03, 0.03, 0.03)
;MP_MeshSetAlpha(Entity(i),3)
;MP_EntitySetTexture (Entity(i), Textur2)
;MP_MeshSetAlpha (Entity(i),2)
MP_PositionEntity(Entity(i), 0, 0, 0)
MP_RotateEntity(Entity(i),90,180,0)
Next
;==============================================================
MP_PositionEntity(light, 0 , 10, 0)
MP_EntityLookAt(light,0,0,0)
xx.f=-5 :z.f=-4
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
If MP_KeyDown(#PB_Key_Z)
xx.f + 0.1
z.f + 0.1
ElseIf MP_KeyDown(#PB_Key_X)
xx.f - 0.1
z.f - 0.1
EndIf
For i=0 To 20
MP_PositionEntity(Entity(i), xx, 1, z)
MP_TurnEntity(Entity(i),1,0,0)
Next
For i=21 To ImagePartitions
MP_PositionEntity(Entity(i), xx, 1, z)
MP_TurnEntity(Entity(i),1,0,0)
Next
MP_RenderWorld()
MP_Flip ()
Wend