Is it possible to use the MP_MeshSetData() function with only #PB_Mesh_Vertex, and in a second step with #PB_Mesh_Normal | #PB_Mesh_Color | #PB_Mesh_UVCoordinate, or only the first time must I set all #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_Color | #PB_Mesh_UVCoordinate ?
I had some big crashes (complete hang with reboot!!!) with some tests.
Translation : pitch, yaw, roll : y-axis, x-axis, z-axis ; rectangle, not retangle ; Effect, not Effekt (almost no "k" in english)
Loot a the following code. I have sort of a pause every second. After one minute, wave effect is suspended. Maybe the sinus function, but strange, isn't it?
Code: Select all
;////////////////////////////////////////////////////////////////
;//
;// Project Title: MP 3D Test
;// Created On: 2.12.2010
;// Author: djes
;// OS:Windows
;//
;////////////////////////////////////////////////////////////////
#subdivisions = 64
MP_Graphics3D (640,480,0,3) ; Erstelle ein WindowsFenster #Window = 0
SetWindowTitle(0, "3D Darstellung eines Mesh Objektes")
camera=MP_CreateCamera() ; Kamera erstellen
light=MP_CreateLight(1) ; Es werde Licht
grid = MP_CreatePlane(#subdivisions, #subdivisions)
If CreateImage(0, 1024, 1024)
Font = LoadFont(#PB_Any, "Arial" , 138*4)
StartDrawing(ImageOutput(0))
Box(0, 0, 512, 512,RGB(255,0,0))
Box(512, 0, 512, 512,RGB(0,255,0))
Box(0, 512, 512, 512,RGB(0,0,255))
Box(512, 512, 512, 512,RGB(255,255,0))
DrawingFont(FontID(Font))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(73*4,35*4,"5",RGB(0,0,0))
StopDrawing() ; This is absolutely needed when the drawing operations are finished !!! Never forget it !
EndIf
;
Textur = MP_ImageToTexture(0) ; Create Texture from image
MP_EntitySetTexture (grid,Textur)
MP_ScaleEntity (grid, 0.1, 0.1, 0.1)
MP_TurnEntity (grid, 0, 30, 0) ; Ein bischen drehen
i.f = 0
x.f=0 : y.f=0 : z.f+6
While Not MP_KeyDown(#PB_Key_Escape) And Not MP_WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
If MP_KeyDown(#PB_Key_Left)=1 : x=x-1 : EndIf ;links Debug #PB_Key_Left
If MP_KeyDown(#PB_Key_Right)=1 : x=x+1 : EndIf ;rechts #PB_Key_Right
If MP_KeyDown(#PB_Key_Down)=1 : y=y-1 : EndIf ;Runter #PB_Key_Down
If MP_KeyDown(#PB_Key_Up)=1 : y=y+1 : EndIf ;rauf #PB_Key_Up
If MP_KeyDown(#PB_Key_Z)=1 : z=z+0.1 : EndIf ;y Vertauscht bei y-z bei deutscher tastatur
If MP_KeyDown(#PB_Key_Y)=1 : z=z+0.1 : EndIf ;y Vertauscht bei y-z bei deutscher tastatur
If MP_KeyDown(#PB_Key_A)=1 : z=z-0.1 : EndIf ;a #PB_Key_A
MP_PositionEntity (grid, x, y, z) ; Position des Würfel
MP_TurnEntity (grid, 1, 0, 0) ; Ein bischen drehen
MP_RenderWorld() ; Erstelle die Welt
MP_Flip () ; Stelle Sie dar
;****************
; Vertices deform
For gz = 0 To #subdivisions ;min 1
For gx = 0 To #subdivisions ;min 1
MP_VertexSetz(grid, (gz * (#subdivisions + 1)) + gx, Sin(i + gx / 2 + gz / 2))
i+0.0001
Next gx
Next gz
Wend
End