my example in leadwerks mod!
BlitzMax Forums/BlitzMax Programming/my example in leadwerks mod!
| ||
create a mesh! i have a bug in vertex tex coords change a texture!! Framework leadwerks.engine AppTitle=StripAll(AppFile) SetGraphicsDriver GLGraphicsDriver() Graphics 1024,768,0,60,2 'A world must be created or loaded before you do anything: CreateWorld() Global camera:TCamera=CreateCamera() PositionEntity camera,0,30,0 cubo:tmesh = CreateMesh() surf:tsurface=CreateSurface(cubo) v0:Int=AddVertex(surf,-10,0,-10,0,1) v1:Int=AddVertex(surf,-10,0,10,0,0) v2:Int=AddVertex(surf,10,0,10,1,0) v3:Int=AddVertex(surf,10,0,-10,1,1) AddTriangle(surf,v0,v1,v2) AddTriangle(surf,v0,v2,v3) mat:tmaterial = CreateMaterial() MaterialFX(mat,FX_FULLBRIGHT) tex:Ttexture = LoadTexture("tex\cleopatraProf.jpg") MaterialTexture(mat,tex) PaintEntity cubo,mat Point_Entity_camera(camera,0,0,0.001) Global tempo_click,camera_zoom# camera_zoom#=1 While Not KeyHit(KEY_ESCAPE) pixmap:TPixmap=LockTexture(tex) For n = 0 To 10000 'WritePixel pixmap,Rnd(511),Rnd(511),65000 Next UnlockTexture(tex) tempo_click=tempo_click-1 func_zoom() RenderWorld() GLDrawRect 30,30,10,10 Flip False Wend End Function Point_Entity_camera(entity:tcamera,x#,y#,z#) Local xdiff# = EntityX(entity)-x# Local ydiff# = EntityY(entity)-y# Local zdiff# = EntityZ(entity)-z# Local dista#=Sqr((xdiff#*xdiff#)+(zdiff#*zdiff#)) Local pitch# = ATan2(ydiff#,dista#) Local yaw# = ATan2(xdiff#,-zdiff#) RotateEntity entity,pitch#,yaw#,0 End Function Function func_zoom() If (KeyDown(KEY_PAGEUP) And tempo_click<0 )Or dif_zm<0 dif_zm=0 tempo_click=1 camera_zoom#=camera_zoom#*1.03 EndIf If (KeyDown(KEY_PAGEdown) And tempo_click<0 )Or dif_zm>0 dif_zm=0 tempo_click=1 camera_zoom#=camera_zoom#/1.03 EndIf If camera_zoom#<0.1 Then camera_zoom#=0.1 If camera_zoom#>50 Then camera_zoom#=50 CameraZoom camera,camera_zoom# End Function |
| ||
Sweet. I think there was an error in the last test that didn't write the tex coords correctly. I have since fixed this. |
| ||
not found a entitypickmode! thanks |