Editeur de MeshDATA experimental en cours
Publié : ven. 08/mai/2009 20:41
Salut j'ais commencé un éditeur de Mesh 3D en cours de construction que j'ais préféré commencer à diffuser, il est opérationnel, mais pas à 100%!!
Note: il faut d'abort créer les points vertice puis les assembler!!
bon j'admet que c'est un projet minable
, mais bon, on n'est jamais mieux servit que par soit même 
Code : Tout sélectionner
;{ -Initialisation
If InitEngine3D()
If InitKeyboard() And InitMouse() =0
MessageRequester("Erreur","Les péripheriques utiles pour le déplacement dans l'environnement 3D sont inaccessibles!")
End
EndIf
Else
MessageRequester("Erreur","l'Initialisation 3D à échouée!")
End
EndIf
If InitPalette() And InitSprite() And InitSprite3D()
UseJPEGImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()
Else
MessageRequester("Erreur","Les éléments indispensable pour la décoration 3D sont inaccessibles!")
End
EndIf
;}
;{ -Enumeration
Enumeration
#Window_0
EndEnumeration
Enumeration
#Bill0
#Bill1
EndEnumeration
Enumeration
#Material0
#Material1
EndEnumeration
Enumeration
#Frame3D_0
#Bt_Face
#Bt_Dessus
#Bt_Cote
#Bt_3D
#Text_0
#Rd_Ligne
#Rd_Texture
#Bt_IMG_Lumiere
#Frame3D_2
#Bt_AjouterVertice
#Bt_EffacerVertice
#Text_1
#Nom_Vertice
#String_ID_Vertice
#Bt_Plus_Selection
#Bt_Moin_Selection
#Text_2
#String_Xposition
#Text_4
#String_Yposition
#Text_6
#String_Zposition
#Frame3D_4
#Text_10
#String_IdV1_Triangle
#Text_Clr1
#Bt_IMG_Couleur1
#Text_12
#String_IdV2_Triangle
#Text_Clr2
#Bt_IMG_Couleur2
#Text_14
#String_IdV3_Triangle
#Text_Clr3
#Bt_IMG_Couleur3
#Bt_Remplir
#Bt_Repere
#Bt_MESHDATA
#ProgressBar_0
#Bt_X
EndEnumeration
Enumeration
#lumiere
#clrINI0
EndEnumeration
Enumeration
#Camera0
#Camera1
#Camera2
#Camera3
EndEnumeration
;}
;{ Inimage
CreateImage(#lumiere, 20, 20)
StartDrawing(ImageOutput(#lumiere))
Restore eclairage
For ay=0 To 20-1
For ax=0 To 20-1
Read a.l
Plot(ax,ay,a.l)
Next ax
Next ay
StopDrawing()
CreateImage(#clrINI0, 20, 20)
StartDrawing(ImageOutput(#clrINI0))
Box(0,0,20,20,#Gray)
StopDrawing()
;}
Procedure ImageBtn(img,couleur,tx,ty)
CreateImage(img, tx,ty)
StartDrawing(ImageOutput(img))
Box(0,0,tx,ty,couleur)
StopDrawing()
EndProcedure
Procedure Open_Window_0(LargW,HautW,LargS,HautS)
If OpenWindow(#Window_0, 0, 0, LargW,HautW, "MeshConvertData", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(#Window_0), 0, 0, LargS,HautS, 0, 0, 0)
If CreateGadgetList(WindowID(#Window_0))
Frame3DGadget(#Frame3D_0, 802, 5, 95, 150, "Fenêtre active")
ButtonGadget(#Bt_Face, 810, 25, 40, 30, "Face")
ButtonGadget(#Bt_Dessus, 850, 25, 40, 30, "Dessus")
ButtonGadget(#Bt_Cote, 810, 60, 40, 30, "Côté")
ButtonGadget(#Bt_3D, 850, 60, 40, 30, "3D")
GadgetToolTip(#Bt_3D, "Effectuez des rotations autour de votre objet ")
TextGadget(#Text_0, 815, 95, 70, 15, "Rendu:", #PB_Text_Center)
OptionGadget(#Rd_Ligne, 815, 115, 65, 15, "Ligne")
OptionGadget(#Rd_Texture, 815, 135, 55, 15, "Texturé")
ButtonImageGadget(#Bt_IMG_Lumiere, 870, 130, 20, 20, ImageID(#lumiere))
Frame3DGadget(#Frame3D_2, 802, 160, 95, 150, "Vertex")
ButtonGadget(#Bt_AjouterVertice, 806, 175, 42, 23, "+Vertice")
GadgetToolTip(#Bt_AjouterVertice, "appuyez ici pour ajouter une vertice dans l'espace de modelisation!")
ButtonGadget(#Bt_EffacerVertice, 850, 175, 42, 23, "-Vertice")
GadgetToolTip(#Bt_EffacerVertice, "appuyez ici pour éffacer une vertice dans l'espace de modelisation!")
TextGadget(#Text_1, 805, 205, 35, 15, "Vertice")
SpinGadget(#Nom_Vertice, 853, 200, 30, 20, 0, 0 ,#PB_Spin_Numeric )
GadgetToolTip(#Nom_Vertice, "Pour selectionner l'Id Vertice de façon précise")
TextGadget(#Text_2, 803, 225, 15, 15, "X", #PB_Text_Center)
TextGadget(#Text_4, 850, 225, 15, 15, "Y", #PB_Text_Center)
TextGadget(#Text_6, 803, 264, 15, 15, "Z", #PB_Text_Center)
SpinGadget(#String_Xposition, 803, 242, 45, 20, -1000, 1000 ,#PB_Spin_Numeric )
SpinGadget(#String_Yposition, 850, 242, 45, 20, -1000, 1000 ,#PB_Spin_Numeric )
SpinGadget(#String_Zposition, 803, 281, 45, 20, -1000, 1000 ,#PB_Spin_Numeric )
Frame3DGadget(#Frame3D_4, 802, 315, 95, 165, "Mise en forme")
;TextGadget(#Text_10, 803, 320, 60, 15, " V1 V2 V3 ")
SpinGadget(#String_IdV1_Triangle, 803, 340, 30, 20, 0, 0 ,#PB_Spin_Numeric )
SpinGadget(#String_IdV2_Triangle, 834, 340, 30, 20, 0, 0 ,#PB_Spin_Numeric )
SpinGadget(#String_IdV3_Triangle, 865, 340, 30, 20, 0, 0 ,#PB_Spin_Numeric )
ButtonImageGadget(#Bt_IMG_Couleur1, 803, 362, 20, 20, ImageID(#clrINI0))
ButtonImageGadget(#Bt_IMG_Couleur2, 834, 362, 20, 20, ImageID(#clrINI0))
ButtonImageGadget(#Bt_IMG_Couleur3, 865, 362, 20, 20, ImageID(#clrINI0))
ButtonGadget(#Bt_Remplir, 805, 385, 85, 25, "Remplir ")
GadgetToolTip(#Bt_Remplir, "appuyez ici pour ajouter une vertice dans l'espace de modelisation!")
;SpinGadget(#Nom_Triangle, 853, 200, 30, 20, 0, 0 ,#PB_Spin_Numeric )
ButtonGadget(#Bt_Repere, 800, 485, 95, 20, "Repère OFF")
ButtonGadget(#Bt_MESHDATA, 802, 520, 91, 35, "MESH DATA")
GadgetToolTip(#Bt_MESHDATA, "Appuyez ici pour générer le DataSection du model mesh en cours")
ProgressBarGadget(#ProgressBar_0, 805, 555, 85, 10, 0, 10, #PB_ProgressBar_Smooth)
ButtonGadget(#Bt_X, 850, 580, 40, 15, "X")
GadgetToolTip(#Bt_X, "Fermer l'application")
ProcedureReturn #True
EndIf
EndIf
EndIf
EndProcedure
Procedure Graph2DScreen_Box(xb,yb,Lb,Hb,couleur)
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Outlined)
Box(xb,yb,Lb,Hb,couleur)
StopDrawing()
EndProcedure
;{ Fermeture temporaire!!!
Procedure LaserLine(IDLaser,index1,index2,teinteIndex1,teinteIndex2,x1,y1,z1,x2,y2,z2)
Structure spoint
Position.f[3]
Couleur.l
EndStructure
Structure sline
Index.w[3]
EndStructure
Protected Dim Sommets.spoint(2)
Protected Dim Triangles.sline(0)
CreateMesh(IDLaser, 0)
Sommets(0)\Position[0] = x1
Sommets(0)\Position[1] = y1
Sommets(0)\Position[2] = z1
Sommets(0)\Couleur = teinteIndex1
Sommets(1)\Position[0] = x2
Sommets(1)\Position[1] = y2
Sommets(1)\Position[2] = z2
Sommets(1)\Couleur = teinteIndex2
Triangles(0)\Index[0] = index1
Triangles(0)\Index[1] = index2
Triangles(0)\Index[0] = index2
Triangles(0)\Index[1] = index1
SetMeshData(IDLaser, #PB_Mesh_Vertex | #PB_Mesh_Color, @Sommets(), 2)
SetMeshData(IDLaser, #PB_Mesh_Face, @Triangles(), 1)
;-----------------------------------------------------------------------------------------
CreateTexture(IDLaser, 64, 64)
StartDrawing(TextureOutput(IDLaser))
Box(0,0, TextureWidth(IDLaser), TextureHeight(IDLaser), RGB(255, 255, 255))
StopDrawing()
CreateMaterial(IDLaser, TextureID(IDLaser))
MaterialAmbientColor(IDLaser, #PB_Material_AmbientColors)
CreateEntity(IDLaser, MeshID(IDLaser), MaterialID(IDLaser))
EntityRenderMode(IDLaser, #PB_Entity_Wireframe)
;-----------------------------------------------------------------------------------------
ProcedureReturn Laser
EndProcedure
;}
Procedure Triangulation(IDStrip,index1,index2,index3,teinteIndex1,teinteIndex2,teinteIndex3,x1,y1,z1,x2,y2,z2,x3,y3,z3)
Structure s_Sommet
Position.f[3]
Couleur.l
EndStructure
Structure s_Triangle
Index.w[3]
EndStructure
Protected Dim Sommets.s_Sommet(3)
Protected Dim Triangles.s_Triangle(1)
;ReDim meshNUM.Mesh(IDStrip/4)
CreateMesh(IDStrip, 0)
Sommets(0)\Position[0] = x1
Sommets(0)\Position[1] = y1
Sommets(0)\Position[2] = z1
Sommets(0)\Couleur = teinteIndex1
Sommets(1)\Position[0] = x2
Sommets(1)\Position[1] = y2
Sommets(1)\Position[2] = z2
Sommets(1)\Couleur = teinteIndex2
Sommets(2)\Position[0] = x3
Sommets(2)\Position[1] = y3
Sommets(2)\Position[2] = z3
Sommets(2)\Couleur = teinteIndex3
Triangles(0)\Index[0] = index1
Triangles(0)\Index[1] = index2
Triangles(0)\Index[2] = index3
SetMeshData(IDStrip, #PB_Mesh_Vertex|#PB_Mesh_Color, @Sommets(), 3)
SetMeshData(IDStrip, #PB_Mesh_Face, @Triangles(), 1)
;-----------------------------------------------------------------------------------------
CreateTexture(IDStrip, 64, 64)
StartDrawing(TextureOutput(IDStrip))
Box(0,0, TextureWidth(IDStrip), TextureHeight(IDStrip), RGB(255, 255, 255))
StopDrawing()
CreateMaterial(IDStrip, TextureID(IDStrip))
MaterialAmbientColor(IDStrip, #PB_Material_AmbientColors)
CreateEntity(IDStrip, MeshID(IDStrip), MaterialID(IDStrip))
EntityRenderMode(IDStrip, #PB_Entity_CastShadow)
;-----------------------------------------------------------------------------------------
ProcedureReturn IDStrip
EndProcedure
;{ Valeurs initials
VertexSpeed = 1
modeCam=1
IDcam=1
lW=900
hW=600
Lxs=800
Hys=600
color1=33023
color2=#Gray/2
color3=#Gray/2
color4=#Gray/2
vclr1=#Gray
vclr2=vclr1
vclr3=vclr1
T0=3
enumV=1
T1=4
numT=1
T2=5
;}
Structure VSpot
xv.l
yv.l
zv.l
EndStructure
Structure Mesh
v1.l
v2.l
v3.l
EndStructure
Dim vertexNUM.VSpot(0)
Dim meshNUM.Mesh(0)
; Structure s_Sommet
; Position.f[3]
; EndStructure
;
; Structure s_Triangle
; Index.w[3]
; EndStructure
;
; Dim Sommets.s_Sommet(0)
; Dim Triangles.s_Triangle(0)
If Open_Window_0(lW,hW,Lxs,Hys)
;{ Déco
Add3DArchive("c:\", #PB_3DArchive_FileSystem)
If SkyBox("ciel.JPG")=0
Debug "erreur: skybox"
EndIf
;}
;{ Mesh sol
;-------------------------------------------
#Mesh = 0
CreateMesh(#Mesh, 100)
Options = #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_UVCoordinate
SetMeshData(#Mesh, Options , ?Surface, 4)
SetMeshData(#Mesh, #PB_Mesh_Face, ?Planate, 2)
#TextureSol = 0
CreateTexture(#TextureSol, 1000, 1000)
StartDrawing(TextureOutput(#TextureSol))
Box(0, 0, TextureWidth(#TextureSol), TextureHeight(#TextureSol), RGB(240,250,255))
For i = 0 To TextureHeight(#TextureSol)-1 Step 50
Line(i, 0, 0, TextureHeight(#TextureSol), RGB(230,240,255))
Line(0, i, TextureWidth(#TextureSol), 0, RGB(230,240,255))
Next i
StopDrawing()
#MatiereSol = 0
CreateMaterial(#MatiereSol, TextureID(#TextureSol))
#EntitySol = 0
CreateEntity(#EntitySol, MeshID(#Mesh), MaterialID(#MatiereSol))
ScaleEntity(#EntitySol, 10000, 0, 10000)
EntityLocate(#EntitySol, 0, -10, 0)
;--------------------------------------------------------------------
;}
; #IdMesh_cargo=7
; If CreateMesh(#IdMesh_cargo, 6)
; SetMeshData(#IdMesh_cargo, #PB_Mesh_Vertex, ?cargo_Spot,6)
; SetMeshData(#IdMesh_cargo, #PB_Mesh_Face, ?cargo_Plan,8)
;
; If CreateEntity(#IdMesh_cargo, MeshID(#IdMesh_cargo), MaterialID(#MatiereSol))
; EntityRenderMode(#IdMesh_cargo, #PB_Entity_CastShadow)
; EntityLocate(#IdMesh_cargo, 0, 50, 0)
; Else
; Debug "Erreur NewMesh"
; EndIf
; EndIf
;{ Camera 0-3
CreateCamera(#Camera0, 0, 0, 44.35, 50)
CameraLocate(#Camera0, 400, 0, 0)
RotateCamera(#Camera0,90,0,0) ;:CameraProjection(#Camera0, #PB_Camera_Orthographic)
CreateCamera(#Camera1, 44.35, 0, 44.35, 50)
CameraLocate(#Camera1, 0, 400, 0)
RotateCamera(#Camera1,0,-90,0)
CreateCamera(#Camera2, 0, 50, 44.35, 50)
CameraLocate(#Camera2, 0, 0, 400)
CreateCamera(#Camera3, 44.35, 50, 44.35, 50)
CameraFOV(#Camera3, 20)
CameraLocate(#Camera3, 0, 0, 300)
;}
DisableGadget(#Bt_Face,1)
DisableGadget(#Bt_Dessus,0)
DisableGadget(#Bt_Cote,0)
DisableGadget(#Bt_3D,0)
Repeat
Event = WaitWindowEvent()
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
If vertex
G0=Val(GetGadgetText(#Nom_Vertice))*3
vertexNUM(G0/3)\xv =BillboardX(0,G0)
vertexNUM(G0/3)\yv =BillboardY(0,G0)
vertexNUM(G0/3)\zv =BillboardZ(0,G0)
EndIf
If Event = #PB_Event_Gadget
Select GadgetID
Case #Bt_Face
IDcam=#Camera0
DisableGadget(#Bt_Face,1)
DisableGadget(#Bt_Dessus,0)
DisableGadget(#Bt_Cote,0)
DisableGadget(#Bt_3D,0)
color1=33023
color2=#Gray/2
color3=#Gray/2
color4=#Gray/2
modeVtx=1
modeCam=1
VertexSpeed = 1
Case #Bt_Dessus
IDcam=#Camera1
DisableGadget(#Bt_Face,0)
DisableGadget(#Bt_Dessus,1)
DisableGadget(#Bt_Cote,0)
DisableGadget(#Bt_3D,0)
color1=#Gray/2
color2=33023
color3=#Gray/2
color4=#Gray/2
modeVtx=2
modeCam=1
VertexSpeed = 1
Case #Bt_Cote
IDcam=#Camera2
DisableGadget(#Bt_Face,0)
DisableGadget(#Bt_Dessus,0)
DisableGadget(#Bt_Cote,1)
DisableGadget(#Bt_3D,0)
color1=#Gray/2
color2=#Gray/2
color3=33023
color4=#Gray/2
modeVtx=3
modeCam=1
VertexSpeed = 1
Case #Bt_3D
IDcam=#Camera3
DisableGadget(#Bt_Face,0)
DisableGadget(#Bt_Dessus,0)
DisableGadget(#Bt_Cote,0)
DisableGadget(#Bt_3D,1)
color1=#Gray/2
color2=#Gray/2
color3=#Gray/2
color4=33023
modeCam=2
VertexSpeed = 5
Case #Rd_Ligne
CameraRenderMode(IDcam, #PB_Camera_Wireframe)
Case #Rd_Texture
CameraRenderMode(IDcam, #PB_Camera_Textured)
Case #Bt_IMG_Lumiere
Case #Bt_AjouterVertice
If IsBillboardGroup(T0)=#False
CreateTexture(T0, 10,10)
StartDrawing(TextureOutput(T0))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(5, 0,Str(enumV), RGB(240,250,255))
StopDrawing()
If CreateMaterial(T0, TextureID(T0))
MaterialBlendingMode(T0, #PB_Material_Add)
If CreateBillboardGroup(T0, MaterialID(T0),TextureWidth(T0), TextureHeight(T0))
ReDim vertexNUM.VSpot(enumV)
;ReDim Sommets.s_Sommet(enumV)
AddBillboard(0, T0,0,0,0)
SetGadgetAttribute(#Nom_Vertice,#PB_Spin_Minimum,1)
SetGadgetAttribute(#Nom_Vertice,#PB_Spin_Maximum,enumV)
SetGadgetText(#Nom_Vertice,Str(enumV))
SetGadgetAttribute(#String_IdV1_Triangle,#PB_Spin_Maximum,enumV)
SetGadgetAttribute(#String_IdV2_Triangle,#PB_Spin_Maximum,enumV)
SetGadgetAttribute(#String_IdV3_Triangle,#PB_Spin_Maximum,enumV)
T0=T0+3
enumV=enumV+1
vertex=#True
EndIf
EndIf
EndIf
Case #Bt_IMG_Couleur1
vclr1=ColorRequester(#Gray)
ImageBtn(#clrINI0,vclr1,20,20)
SetGadgetState(#Bt_IMG_Couleur1, ImageID(#clrINI0))
SetGadgetState(#Bt_IMG_Couleur2, ImageID(#clrINI0))
SetGadgetState(#Bt_IMG_Couleur3, ImageID(#clrINI0))
vclr2=vclr1
vclr3=vclr1
Case #Bt_IMG_Couleur2
vclr2=ColorRequester(#Gray)
ImageBtn(#clrINI0,vclr2,20,20)
SetGadgetState(#Bt_IMG_Couleur2, ImageID(#clrINI0))
SetGadgetState(#Bt_IMG_Couleur3, ImageID(#clrINI0))
vclr3=vclr2
Case #Bt_IMG_Couleur3
vclr3=ColorRequester(#Gray)
ImageBtn(#clrINI0,vclr3,20,20)
SetGadgetState(#Bt_IMG_Couleur3, ImageID(#clrINI0))
Case #Bt_Remplir
ReDim meshNUM.Mesh(numT)
If vertex
V1 = Val(GetGadgetText(#String_IdV1_Triangle))
V2 = Val(GetGadgetText(#String_IdV2_Triangle))
V3 = Val(GetGadgetText(#String_IdV3_Triangle))
If V1
xv1=vertexNUM(V1)\xv
yv1=vertexNUM(V1)\yv
zv1=vertexNUM(V1)\zv
meshNUM(numT)\v1=V1
EndIf
If V2
xv2=vertexNUM(V2)\xv
yv2=vertexNUM(V2)\yv
zv2=vertexNUM(V2)\zv
meshNUM(numT)\v2=V2
EndIf
If V3
xv3=vertexNUM(V3)\xv
yv3=vertexNUM(V3)\yv
zv3=vertexNUM(V3)\zv
meshNUM(numT)\v3=V3
EndIf
; If V1=0 And V2=0 And V3=0
; MessageRequester("Akkim","Il faut spécifier au minimum 2 points Vertices pour pouvoir remplir une forme!")
; EndIf
If V1=V2 Or V1=V3 Or V2=V3
MessageRequester("Akkim","Il faut spécifier des points Vertices differents pour pouvoir remplir une forme!")
Else
If V1 And V2 And V3=0
LaserLine(T1,0,1,vclr1,vclr2,xv1,yv1,zv1,xv2,yv2,zv2)
ElseIf V1 And V3 And V2=0
LaserLine(T1,0,1,vclr1,vclr3,xv1,yv1,zv1,xv3,yv3,zv3)
ElseIf V2 And V3 And V1=0
LaserLine(T1,0,1,vclr2,vclr3,xv2,yv2,zv2,xv3,yv3,zv3)
ElseIf V1 And V2 And V3
Triangulation(T1,0,1,2,vclr1,vclr2,vclr3,xv1,yv1,zv1,xv2,yv2,zv2,xv3,yv3,zv3)
Triangulation(T2,2,1,0,vclr1,vclr2,vclr3,xv1,yv1,zv1,xv2,yv2,zv2,xv3,yv3,zv3)
ElseIf V1=0 And V2=0 And V3=0
MessageRequester("Akkim","Il faut spécifier au minimum 2 points Vertices pour pouvoir remplir une forme!")
EndIf
EndIf
T1=T1+3
numT=numT+1
T2=T2+3
EndIf
Case #Bt_Repere
; If b1
; HideBillboardGroup(1, 0)
; Else
; HideBillboardGroup(1, 1)
; b1=#True
; EndIf
Case #Bt_MESHDATA
Vmax=GetGadgetAttribute(#Nom_Vertice, #PB_Spin_Maximum)
Namesh$=InputRequester("Projet","Nommer votre Objet Mesh","Projet")
Vertx$=Namesh$+"_Spot"
Surfc$=Namesh$+"_Plan"
Debug ""
Debug ";{ Model: "+Namesh$
Debug "#IdMesh_"+Namesh$+"=0"
Debug "CreateMesh(#IdMesh_"+Namesh$+", 0)"
Debug "SetMeshData(#IdMesh_"+Namesh$+", #PB_Mesh_Vertex, ?"+Vertx$+","+Str(Vmax)+")"
Debug "SetMeshData(#IdMesh_"+Namesh$+", #PB_Mesh_Face, ?"+Surfc$+","+Str(numt-1)+")"
Debug ""
Debug "CreateEntity(#Entity_"+Namesh$+", MeshID(#IdMesh_"+Namesh$+"), #PB_Material_none)"
;EntityLocate(#EntitySol, 0, -10, 0)
Debug ""
Debug "DataSection"
Debug ""
Debug Vertx$+":"
For i=1 To Vmax
Debug "Data.f "+Str(vertexNUM(i)\xv)+","+Str(vertexNUM(i)\yv)+","+Str(vertexNUM(i)\zv)
Next i
Debug ""
Debug Surfc$+":"
For j=1 To numt-1
Debug "Data.w "+Str(meshNUM(j)\v1-1)+","+Str(meshNUM(j)\v2-1)+","+Str(meshNUM(j)\v3-1)
Next j
Debug ""
Debug "EndDataSection"
Debug ";}"
Case #ProgressBar_0
Case #Bt_X
Close=#True
EndSelect
EndIf
If IsBillboardGroup(G0) And vertex
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
bX = VertexSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
bX = -VertexSpeed
Else
bX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
bY = VertexSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
bY = -VertexSpeed
Else
bY = 0
EndIf
; If IsMesh(T1)
; SetMeshData(T1, #PB_Mesh_Vertex|#PB_Mesh_Color , @Sommets(), 3)
; SetMeshData(T1, #PB_Mesh_Face, @Triangles(), 1)
; EndIf
SetGadgetText(#String_Xposition,Str(vertexNUM(G0/3)\xv))
SetGadgetText(#String_Yposition,Str(vertexNUM(G0/3)\yv))
SetGadgetText(#String_Zposition,Str(vertexNUM(G0/3)\zv))
EndIf
;EndIf
Select modeCam
Case 1
Select modeVtx
Case 1
MoveBillboard(0,G0,0,bY,bX)
Case 2
MoveBillboard(0,G0,-bX,0,-bY)
Case 3
MoveBillboard(0,G0,-bX,bY,0)
EndSelect
Case 2
CameraLookAt(#Camera3,0,0,0)
MoveCamera(#Camera3,-bX,bY,0)
EndSelect
EndIf
RenderWorld()
AmbientColor(RGB(128,128,128))
CreateLight(0, RGB(188,190,192), 10, 200, 0)
WorldShadows(#PB_Shadow_Additive)
Fog(RGB(125,127,130), 1, 300, 700)
Graph2DScreen_Box(0,0,Lxs/2,Hys/2,color1) ;HG
Graph2DScreen_Box(Lxs/2,0,Lxs/2,Hys/2,color2) ;HD
Graph2DScreen_Box(0,Hys/2,Lxs/2,Hys/2,color3) ;BG
Graph2DScreen_Box(Lxs/2,Hys/2,Lxs/2,Hys/2,color4) ;BD
FlipBuffers()
Until Event = #PB_Event_CloseWindow Or Close
Else
MessageRequester("Akkim:","Erreur, cette application ne peut pas s'executer sur cet ordinateur!")
EndIf
End
;
;{ ImgElcairage
DataSection
eclairage:
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$000000,$000000,$000000
Data.l $00FFFF,$000000,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$000000,$00FFFF
Data.l $00FFFF,$000000,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$000000,$00FFFF
Data.l $000000,$000000,$000000,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$00FFFF,$00FFFF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
EndDataSection
;}
;----------------------------------
;{ Définition du cube
DataSection
Surface:
Data.f -0.5,0.5,-0.5
Data.f 0,1,0
Data.f 0,0
Data.f 0.5,0.5,-0.5
Data.f 0,1,0
Data.f 0,6
Data.f 0.5,0.5,0.5
Data.f 0,1,0
Data.f 6,6
Data.f -0.5,0.5,0.5
Data.f 0,1,0
Data.f 6,0
Planate:
Data.w 2,1,0
Data.w 0,3,2
EndDataSection
;}
;{ Model: cargo
DataSection
cargo_Spot:
Data.f 25.0,54.0,40.0
Data.f 0.0,16.0,66.0
Data.f 23.0,54.0,-37.0
Data.f 0.0,14.0,-66.0
Data.f -91.0,0.0,0.0
Data.f 0.0,-10.0,0.0
cargo_Plan:
Data.w 1,2,5
Data.w 3,4,5
Data.w 2,5,5
Data.w 4,5,5
Data.w 4,5,3
Data.w 1,5,2
Data.w 1,5,3
Data.w 1,5,3
EndDataSection
;}
bon j'admet que c'est un projet minable

