Page 10 of 14

Posted: Fri Apr 04, 2008 9:25 am
by Mistrel
PureGDK (even thought it looked interesting at first sight) is far too slow, fat and unelegant to be used right now. Hopefully you'll work on it and we'll see some improvement.
Please be specific when you say "slow", "fat", and "unelegant".

Kelebrindae has already demonstrated that PureGDK is the fastest 3D solution available for PureBasic.

According to Kelebrindae's demo, when many objects are on the screen at once performance degraded unlike any of the other demos. I believe that this might be due to a discrepancy which I've already said that I'll look into once I can see the source code.

As I've already explained: DBP is larger in comparison to Dreammotion and PureBasic but this is for a reason. PureBasic uses static linking while Dreammotion and DBP uses DLLs. DBP is plugin-based which will make it inherently larger than a single-library engine but at the same time it is infinitely more expandable.
But, right now PureGDK is not a good product since free product overrun it.
DBP isn't limited to making a couple of colored boxes fly across the screen. Dreammotion can do a lot of things but it's years away from being as feature-rich as DBP. 3D is just the first step in creating a complete game engine.

I'd love to talk pros and cons about PureGDK vs other PureBasic solutions but many of the arguments I've heard have been hardly worth discussion.

Posted: Fri Apr 04, 2008 9:44 am
by Kelebrindae
@Poshu
Woah, guy! Don't you think you're a little harsh, here ? :shock:
Please show a little respect for the huge amount of work Mistrel has put in his product.

Yes, perhaps PureGDK is a slower than Dreammotion on this test (althought I've got different results on my PC: in windowed mode, 512 objects => 15-25 FPS with Dreammotion, versus 50-75 FPS with PureGDK. my specs: XP SP2, P4 3 Ghz, Intel 910 GPU => without a powerful GPU, it seems that PureGDK is much faster than Dreammotion).

But keep in mind that this test only calls very basic 3D functionnalities; in a full-fledged 3D app (layered textures, collisions, shaders, etc..), the results could be different.
Also, there's a lot of things that Dreammotion can't do yet. Example: if you look closely, you'll notice that the cubes aren't transparent for all others => there's no automatic "Z-sorting" for alphablended objects: they are always rendered in the order in which they've been created; you can see an object through another one only if the latter has been created first.

Besides, maybe Dreammotion and PureGDK are not targeted at the same audience. Take a look at the sources: PureGDK code is much simpler to understand for a novice; a lot of things are automated/provided (Wrapvalue and Curvevalue, to say the least).
If you are some code guru and you look for speed, go for C++ and tap directly into the Direct3D or OpenGL API. But if (like me) you are just a moderately skilled programmer and/or have only 1-2 hours a day left in your schedule after work and the kids' bedtime, PureGDK is perfect for the job.
See ? Please, don't say it "is not a good product"; just say it doesn't fit your (own personnal) needs. :wink:

@Mistrel
dbDisableObjectZWrite() and dbStatistic(): oh yes, you're right. I guess I didn't look closely enough at the commands list.
And sorry, lad: I didn't mean those demos to be an argument against you. :oops:

Here are the sources (they probably can be optimized):
PB alone:

Code: Select all

; AbstractDance Demo, "PureBasic only" version
; Author: Kelebrindae 
; Date: april 02, 2006
; PB version: v4.00
; OS: Windows XP
; Demo: Yes


;- Initialisation 
Resultat = MessageRequester("Abstract Dance","Full Screen ?",#PB_MessageRequester_YesNo) 
If Resultat = 6      
  FullScreen=1 
Else            
  FullScreen=0 
EndIf 

If InitEngine3D() = 0 
   MessageRequester( "Error" , "Can't initialize 3D, check if engine3D.dll is available" , 0 ) 
   End 
ElseIf InitSprite() = 0 Or InitKeyboard() = 0 
   MessageRequester( "Error" , "Can't find DirectX 7.0 or above" , 0 ) 
   End 
EndIf 

If Fullscreen  
  OpenScreen(1024,768,32,"Abstract Dance") 
Else 
  OpenWindow(0,0, 0, 1024 , 768,"Abstract Dance",#PB_Window_ScreenCentered) 
  OpenWindowedScreen(WindowID(0),0,0, 1024 , 768,0,0,0) 
EndIf 

;- Data structures and definitions
Structure Vertex 
  px.f 
  py.f 
  pz.f 
  nx.f 
  ny.f 
  nz.f 
  Couleur.l 
  U.f 
  V.f 
EndStructure 

Structure FaceTri 
  f1.w 
  f2.w 
  f3.w 
EndStructure 

Enumeration
  #tetrahedron
  #cube
  #octahedron
  #dodecahedron
  #icosahedron
EndEnumeration

Structure quaternion
  x.f
  y.f
  z.f
  w.f
EndStructure

Structure myVector3
  x.f
  y.f
  z.f
EndStructure

Global cQuat.quaternion
Global pResultVector.myVector3

Structure posAngle
  x.f
  y.f
  z.f
  xangle.f
  yangle.f
  zangle.f
EndStructure

Global nbobjects.l = 256 ; Change this to alter the number of objects on screen
While MessageRequester("Abstract Dance","This demo will show " + Str(nbobjects) + " 3D objects." + Chr(10) + Chr(10) + "Do you want more objects?",#PB_MessageRequester_YesNo) = 6
  nbobjects * 2
Wend

Global t.l=1,tmax.l=2000                        ; used to store pos and rotations
Global *PtrPosAngle.posAngle,*OldPtrPosAngle.posAngle,*posAngleBuffer.l  ; used to store pos and rotations
Global sizeofPosAngle.l = SizeOf(posAngle),oldPtrOffset.l = nbobjects * sizeofPosAngle

*posAngleBuffer = AllocateMemory(sizeofPosAngle*nbobjects*(tmax+100)) 
*oldPtrPosAngle = *posAngleBuffer
*PtrPosAngle = *posAngleBuffer + sizeofPosAngle


;- ---- Procedures ----
;************************************************************************************
; Name: CreatePlatonicMesh
; Purpose: Create a platonic solid mesh, scaled
; Parameters:
;   - solide: #tetrahedron,#cube,#octahedron,#dodecahedron, or #icosahedron
;   - X size
;   - Y size
;   - Z size
;   - origin of mapping coord U 
;   - origin of mapping coord V
;   - Vertices color
; Return value: mesh number, or -1 if an error occurs
;************************************************************************************
Procedure.l CreatePlatonicMesh(solid.l,sizeX.f,sizeY.f,sizeZ.f,Uorigin.f,Vorigin.f,Uscale.f,Vscale.f,color.l) 

  Protected nbVert.l , nbTri.l              ; Number of vertices and faces
  Protected x.f,y.f,z.f                     ; vertex position
  Protected nx.f,ny.f,nz.f                  ; vertex normals
  Protected u.f,v.f                         ; vertex UV coords (texture mapping)
  Protected *PtrV.Vertex,*vertexBuffer.l    ; vertices buffer in memory
  Protected *PtrF.FaceTri,*facetriBuffer.l  ; Faces buffer in memory
  Protected newmesh.l                       ; Procedure Result
  
  ; Restore the good set of meshdatas
  Select solid
    Case #tetrahedron
      Restore tetrahedron
    
    Case #cube
      Restore cube
    
    Case #octahedron
      Restore octahedron
    
    Case #dodecahedron
      Restore dodecahedron
      
    Case #icosahedron
      Restore icosahedron
    
    Default
      ProcedureReturn -1 
  EndSelect 

  ; Read number of vertices and triangles
  Read nbVert
  Read nbTri

  ; Allocate the needed memory for vertices
  *vertexBuffer = AllocateMemory(SizeOf(Vertex)*nbVert) 
  *PtrV = *vertexBuffer 

  ; Read and store vertices position, normals, uv coords
  For i = 1 To nbVert
    Read x
    Read y
    Read z
    Read nx
    Read ny
    Read nz
    Read u
    Read v
  
    *PtrV\px = x * sizex
    *PtrV\py = y * sizey
    *PtrV\pz = z * sizez
    
    *PtrV\nx = nx 
    *PtrV\ny = ny
    *PtrV\nz = nz 
    *PtrV\couleur = Color 
    *PtrV\u = uorigin + (u * uscale)
    *PtrV\v = vorigin + (v * vscale)
    *PtrV + SizeOf(Vertex) 
  Next i    


  ; Allocate the needed memory for faces
  *facetriBuffer=AllocateMemory(SizeOf(FaceTri)*nbTri) 
  *PtrF=*facetriBuffer 
  
  ;Read and store faces infos
  For i=1 To nbTri 
    Read v1
    Read v2
    Read v3 
     
    *PtrF\f1=v1  
    *PtrF\f2=v2 
    *PtrF\f3=v3 
    *PtrF + SizeOf(FaceTri) 
  Next i 
     
  ; Create mesh from stored infos
  newmesh = CreateMesh(#PB_Any,100)
  If IsMesh(newmesh) 
    SetMeshData(newmesh,#PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_UVCoordinate | #PB_Mesh_Color,*vertexBuffer,nbVert) 
    SetMeshData(newmesh,#PB_Mesh_Face,*facetriBuffer,nbTri) 
    ; and don't forget to free memory
    FreeMemory(*vertexBuffer)
    FreeMemory(*facetriBuffer)
    ProcedureReturn newmesh 
  Else 
    ; even if "createMesh" has failed
    FreeMemory(*vertexBuffer)
    FreeMemory(*facetriBuffer)
    ProcedureReturn -1    
  EndIf 
    
EndProcedure    

;************************************************************************************
; Name: EulerAnglesToQuat
; Purpose: convert three Euler angles X,Y,Z to a quaternion
; Parameters: X,Y,Z angles, in radians
; Return-Value: nothing, but store the result in the quaternion called "cQuat"
;************************************************************************************

Procedure EulerAnglesToQuat(x.f,y.f,z.f)
    Protected roll.f,pitch.f,yaw.f
    Protected cyaw.f, cpitch.f, croll.f, syaw.f, spitch.f, sroll.f
    Protected cyawcpitch.f, syawspitch.f, cyawspitch.f, syawcpitch.f
    Protected norm.f
    
    roll = x
    pitch= y
    yaw  = z

    cyaw = Cos(0.5 * yaw)
    cpitch = Cos(0.5 * pitch)
    croll = Cos(0.5 * roll)
    syaw = Sin(0.5 * yaw)
    spitch = Sin(0.5 * pitch)
    sroll = Sin(0.5 * roll)

    cyawcpitch = cyaw*cpitch
    syawspitch = syaw*spitch
    cyawspitch = cyaw*spitch
    syawcpitch = syaw*cpitch


    norm = (cyawcpitch * croll + syawspitch * sroll)

    cQuat\x = (cyawcpitch * sroll - syawspitch * croll)
    cQuat\y = (cyawspitch * croll + syawcpitch * sroll)
    cQuat\z = (syawcpitch * croll - cyawspitch * sroll)
    cQuat\w = norm
EndProcedure

;************************************************************************************
; Name: QuaternionTransform
; Purpose: apply a myVector3 transform to the quaternion cQuat (=> translation)
; Parameters: X,Y,Z values
; Return-Value: nothing, but store the result in the myVector3 called "pResult"
;************************************************************************************
Procedure QuaternionTransform(x.f,y.f,z.f)

	pResultVector\x = cQuat\w*cQuat\w*x + 2*cQuat\y*cQuat\w*z - 2*cQuat\z*cQuat\w*y + cQuat\x*cQuat\x*x + 2*cQuat\y*cQuat\x*y + 2*cQuat\z*cQuat\x*z - cQuat\z*cQuat\z*x - cQuat\y*cQuat\y*x
	pResultVector\y = 2*cQuat\x*cQuat\y*x + cQuat\y*cQuat\y*y + 2*cQuat\z*cQuat\y*z + 2*cQuat\w*cQuat\z*x - cQuat\z*cQuat\z*y + cQuat\w*cQuat\w*y - 2*cQuat\x*cQuat\w*z - cQuat\x*cQuat\x*y;
	pResultVector\z = 2*cQuat\x*cQuat\z*x + 2*cQuat\y*cQuat\z*y + cQuat\z*cQuat\z*z - 2*cQuat\w*cQuat\y*x - cQuat\y*cQuat\y*z + 2*cQuat\w*cQuat\x*y - cQuat\x*cQuat\x*z + cQuat\w*cQuat\w*z;
	
EndProcedure

;************************************************************************************
; Name: CurveValue
; Purpose: provide a smooth transition between "actuelle" and "Cible" values
; Parameters:
;   - Cible : target value
;   - actuelle: current value
;   - P : nb steps between the two values
; Return-Value: result
;************************************************************************************
Procedure.f CurveValue(Cible.f, actuelle.f, P.f)
  ;Calcule une valeur progressive allant de la valeur actuelle à la valeur cible
  Protected Delta.f
  
  Delta = Cible - actuelle
  If P > 1000.0
    P = 1000.0
  EndIf
  
  ProcedureReturn  (actuelle + ( Delta * P / 1000.0))
EndProcedure

;************************************************************************************
; Name: WrapValueF
; Purpose: provide a modulo(360) operation for floats => useful for angles
; Parameters: angle
; Return-Value: result (0 >= result < 360)
;************************************************************************************
Procedure.f wrapValueF(angle.f)
    If angle < 0
      ProcedureReturn angle+360
    ElseIf angle >= 360
        ProcedureReturn angle-360
    EndIf
  ProcedureReturn angle
EndProcedure


;- ---- Main program ----
; A texture and a semi-transparent material are generated to replace 
; "dbGhostObjectOn" command and diffuse/ambient lighting manipulations

;-Texture 
; Create a "rainbowy" 64x64 texture
CreateTexture(0,64,64) 
StartDrawing(TextureOutput(0)) 
  numstep.w=171
  value.f=0
  x.w=0:y.w=0
  couleur.l
  For mode=1 To 6
     For i=1 To numstep
        value=i*(255.00/numstep)
        If value>255
          value=255
        EndIf
  
        Select mode
           Case 1
              couleur = RGB(255,value,0)

           Case 2
              couleur = RGB(255-value,255,0)
 
           Case 3
              couleur = RGB(0,255,value)

           Case 4
              couleur = RGB(0,255-value,255)

           Case 5
              couleur = RGB(value,0,255)

           Case 6
              couleur = RGB(255,value,255)
        EndSelect
        Box(x,y,2,2,couleur)
        x=x+2
        If x=64
          x=0
          y=y+2
        EndIf
     Next i
  Next mode
StopDrawing()  

;-Material
; convert it into a semi-transparent material 
CreateMaterial(0,TextureID(0))
MaterialBlendingMode(0,#PB_Material_Add) 


;-Entity 
; Create a bunch of cubes
colorConv.f =1024.00/nbobjects
Define numcolor.l,xt.l,yt.l,u.f,v.f
dotsize.f = 1.0/32.0
For i=0 To nbobjects-1

  numcolor = i*colorConv
  If numcolor < 32
    numcolor=32
  ElseIf numcolor > 1023
    numcolor=1023
  EndIf
  yt=numcolor/32
  xt=numcolor-(yt*32)
  u=(xt/32.00)
  v=(yt/32.00)
  
  myCubeMesh = CreatePlatonicMesh(#cube,1,1,1,u,v,dotsize,dotsize,$FFFFFF) 
  CreateEntity(i+1,MeshID(myCubeMesh),MaterialID(0))
  FreeMesh(myCubeMesh)

Next i

;-Camera 
CreateCamera(0, 0, 0 , 100 , 100) 
MoveCamera(0,0,0,-40) 
CameraLookAt(0,0,0,0) 
xtarget=1:ytarget=-18:ztarget=-8
xcam.f=CameraX(0):ycam.f=CameraY(0):zcam.f=CameraZ(0)
xcamd.f=0:ycamd.f=0:zcamd.f=0
xcamdt.f=(xtarget-xcam)/500.00:ycamdt.f=(ytarget-ycam)/500.00:zcamdt.f=(ztarget-zcam)/500.00

;-Light 
; strong ambient light, for a flashy look
AmbientColor(RGB(200,200,200)) 

;- Variables
Define mode.l=0  ; forward or reverse motion
Define vmax.l=100,vcur.l=100,v.f=1 ; motion speed modificator
Define speed.f=0.3,var1.f=1,var2.f=2.5,var3.f=2.5  ; speed and rotation values
Define xmean.f,ymean.f,zmean.f  ; Used to compute the center of the entity "swarm"
Define oldtimer.l = ElapsedMilliseconds() ; Used to cap frame rate

For i=1 To nbobjects
  *ptrPosAngle\x = 0
  *ptrPosAngle\y = 0
  *ptrPosAngle\z = 0
  *ptrPosAngle\xangle = 0
  *ptrPosAngle\yangle = 0
  *ptrPosAngle\zangle = 0
  *ptrPosAngle+sizeOfPosAngle
Next i

;- Main loop
Repeat 
   If fullscreen = 0 
      While WindowEvent() : Wend 
   EndIf
   xmean=0:ymean=0:zmean=0

   ; "Forward motion" mode
   If mode=0
      v=vcur/100.00
      For i=1 To nbobjects
         *oldPtrPosAngle = *ptrPosAngle - oldPtrOffset
         *ptrPosAngle\xangle = wrapvalueF( *oldPtrPosAngle\xangle+(var1*v) )
         *ptrPosAngle\yangle = wrapvalueF( *oldPtrPosAngle\yangle+(((i/100)-var2)*v) )
         *ptrPosAngle\zangle = wrapvalueF( *oldPtrPosAngle\zangle+(((i/100)-var3)*v) )
         
         ; rotate cube
         RotateEntity(i,*ptrPosAngle\yangle,*ptrPosAngle\xangle,*ptrPosAngle\zangle)
                
         ; a little maths to compute next position according to speed and angles  
         EulerAnglesToQuat(*ptrPosAngle\xangle * 0.0174533,*ptrPosAngle\yangle * 0.0174533,*ptrPosAngle\zangle * 0.0174533 )
         QuaternionTransform(0,0,speed*v)                 
                 
         ; move cube 
         MoveEntity( i,pResultVector\x,pResultVector\y,pResultVector\z )
         
         *ptrPosAngle\x=EntityX(i)
         *ptrPosAngle\y=EntityY(i)
         *ptrPosAngle\z=EntityZ(i)

         xmean+*ptrPosAngle\x
         ymean+*ptrPosAngle\y
         zmean+*ptrPosAngle\z
         
         *ptrPosAngle+sizeOfPosAngle
      Next i

      ; After tmax loops, the motion slows down until it stops
      t+1
      If t = tmax
        vmax=-vmax
      EndIf
      If vmax>0 And vcur<vmax
        vcur+1
      EndIf
      If vmax<0 And vcur>vmax
        vcur-1
      EndIf
      ; when the motion is stopped, switch to "reverse motion" mode
      If vcur=0
        mode=1
        vcur=vmax
      EndIf
   Else
      ; "Reverse motion" mode => re-use stored positions and rotations
      t-1
      *ptrPosAngle-oldPtrOffset
      For i=1 To nbobjects
         EntityLocate( i,*ptrPosAngle\x,*ptrPosAngle\y,*ptrPosAngle\z )
         RotateEntity( i,*ptrPosAngle\yangle,*ptrPosAngle\xangle,*ptrPosAngle\zangle )
         xmean+*ptrPosAngle\x
         ymean+*ptrPosAngle\y
         zmean+*ptrPosAngle\z
         *ptrPosAngle+sizeOfPosAngle
      Next i
      *ptrPosAngle-oldPtrOffset
      If t=1
         mode=0
         var1=-2 + (Random(40)/10.00)
         var2=-4 + (Random(80)/10.00)
         var3=-4 + (Random(80)/10.00)
      EndIf
   EndIf

    ; The camera constantly flies toward random destinations
   xcamd=curvevalue(xcamdt,xcamd,500.0)
   ycamd=curvevalue(ycamdt,ycamd,500.0)
   zcamd=curvevalue(zcamdt,zcamd,500.0)
   xcam+xcamd
   ycam+ycamd
   zcam+zcamd
   CameraLocate(0,xcam,ycam,zcam)
  
   ; Every 500 loops, the destination change
   campos+1
   If campos=500
      xtarget=EntityX(1)+25-Random(50)
      ytarget=EntityY(1)+25-Random(50)
      ztarget=EntityZ(1)+25-Random(50)
      xcamdt=(xtarget-xcam)/500.00
      ycamdt=(ytarget-ycam)/500.00
      zcamdt=(ztarget-zcam)/500.00
      campos=0
   EndIf
   
   ; But it always looks at the center of the entity "swarm"
   xmean/nbobjects
   ymean/nbobjects
   zmean/nbobjects
   CameraLookAt(0,xmean,ymean,zmean)
   
  ; show it all
  RenderWorld() 
  
  ; uncomment this to show FPS
  StartDrawing(ScreenOutput())
  DrawText(0,0,Str(Engine3DFrameRate(#PB_Engine3D_Average)) + " FPS / " + Str(CountRenderedTriangles()) + " triangles", $00FFFF, $BB0000)
  StopDrawing() 
  
  ; Flip buffers with no vSync
  FlipBuffers(0)
  
  ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) 
FreeMemory(*posAngleBuffer)

DataSection:
tetrahedron:
; Nb sommets / Nb faces
Data.l 10,4

; Vertices: pos / normals / uv
Data.f 0.817497,0.578350,0
Data.f 0,1,0
Data.f 0.5,0.5
Data.f -0.815497,0.578350,0
Data.f 0,1,0
Data.f 0.5,1.5
Data.f 0,-0.576350,0.817497
Data.f 0,0.577351,0.816496
Data.f -0.5,1
Data.f 0,-0.576350,-0.815497
Data.f 0,0.577351,-0.816496
Data.f -0.5,1
Data.f 0,-0.576350,-0.815497
Data.f 0.816496,-0.577351,0
Data.f -0.5,1.5
Data.f 0,-0.576350,0.817497
Data.f 0.816496,-0.577351,0
Data.f 0.5,1.5
Data.f 0.817497,0.578350,0
Data.f 0.816496,-0.577351,0
Data.f 0,0.5
Data.f 0,-0.576350,-0.815497
Data.f -0.816496,-0.577351,0
Data.f -0.5,1.5
Data.f -0.815497,0.578350,0
Data.f -0.816496,-0.577351,0
Data.f 0,0.5
Data.f 0,-0.576350,0.817497
Data.f -0.816496,-0.577351,0
Data.f 0.5,1.5

; Faces
Data.l 0,1,2
Data.l 1,0,3
Data.l 4,6,5
Data.l 7,9,8

cube:
; Nb sommets / Nb faces
Data.l 24,12

; Vertices: pos / normals / uv
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,1
Data.f 0.5,0.5,0.5
Data.f 0,1,0
Data.f 1,1
Data.f -0.5,0.5,0.5
Data.f 0,1,0
Data.f 1,0
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,1
Data.f 0.5,-0.5,-0.5
Data.f 0,-1,0
Data.f 1,1
Data.f -0.5,-0.5,-0.5
Data.f 0,-1,0
Data.f 1,0
Data.f -0.5,0.5,0.5
Data.f 0,0,1
Data.f 0,0
Data.f 0.5,0.5,0.5
Data.f 0,0,1
Data.f 0,1
Data.f 0.5,-0.5,0.5
Data.f 0,0,1
Data.f 1,1
Data.f -0.5,-0.5,0.5
Data.f 0,0,1
Data.f 1,0
Data.f 0.5,0.5,-0.5
Data.f 0,0,-1
Data.f 0,0
Data.f -0.5,0.5,-0.5
Data.f 0,0,-1
Data.f 0,1
Data.f -0.5,-0.5,-0.5
Data.f 0,0,-1
Data.f 1,1
Data.f 0.5,-0.5,-0.5
Data.f 0,0,-1
Data.f 1,0
Data.f -0.5,0.5,-0.5
Data.f -1,0,0
Data.f 0,0
Data.f -0.5,0.5,0.5
Data.f -1,0,0
Data.f 0,1
Data.f -0.5,-0.5,0.5
Data.f -1,0,0
Data.f 1,1
Data.f -0.5,-0.5,-0.5
Data.f -1,0,0
Data.f 1,0
Data.f 0.5,0.5,0.5
Data.f 1,0,0
Data.f 0,0
Data.f 0.5,0.5,-0.5
Data.f 1,0,0
Data.f 0,1
Data.f 0.5,-0.5,-0.5
Data.f 1,0,0
Data.f 1,1
Data.f 0.5,-0.5,0.5
Data.f 1,0,0
Data.f 1,0

; Faces
Data.l 2,1,0
Data.l 0,3,2
Data.l 6,5,4
Data.l 4,7,6
Data.l 10,9,8
Data.l 8,11,10
Data.l 14,13,12
Data.l 12,15,14
Data.l 18,17,16
Data.l 16,19,18
Data.l 22,21,20
Data.l 20,23,22


octahedron:
; Nb sommets / Nb faces
Data.l 18,8

; Vertices: pos / normals / uv
Data.f 0,0.708107,0.708107
Data.f 0,1,0
Data.f 0,0.5
Data.f 0,0.708107,-0.706107
Data.f 0,1,0
Data.f 0,1.5
Data.f 1.001000,0,0
Data.f 1,0,0
Data.f 0.5,1
Data.f 0,-0.706107,0.708107
Data.f 0,0,1
Data.f -0.5,1
Data.f -0.999000,0,0
Data.f -1,0,0
Data.f 0,1.5
Data.f 0,-0.706107,-0.706107
Data.f 0,0,-1
Data.f -0.5,1
Data.f 1.001000,0,0
Data.f 0.577350,0,0.816496
Data.f 0,0.5
Data.f 0,0.708107,0.708107
Data.f 0.577350,0,0.816496
Data.f 0.5,1
Data.f 0,0.708107,0.708107
Data.f -0.577350,0,0.816496
Data.f 0.5,1
Data.f -0.999000,0,0
Data.f -0.577350,0.816496,0
Data.f -0.5,1
Data.f 0,0.708107,-0.706107
Data.f -0.577350,0,-0.816496
Data.f 0.5,1
Data.f 1.001000,0,0
Data.f 0.577350,0,-0.816496
Data.f 0,0.5
Data.f 0,0.708107,-0.706107
Data.f 0.577350,0,-0.816496
Data.f 0.5,1
Data.f 0,-0.706107,-0.706107
Data.f 0.577350,-0.816496,0
Data.f 0,1.5
Data.f 0,-0.706107,0.708107
Data.f 0.577350,-0.816496,0
Data.f 0,0.5
Data.f -0.999000,0,0
Data.f -0.577350,-0.816496,0
Data.f -0.5,1
Data.f 0,-0.706107,0.708107
Data.f -0.577350,-0.816496,0
Data.f 0,0.5
Data.f 0,-0.706107,-0.706107
Data.f -0.577350,-0.816496,0
Data.f 0,1.5

; Faces
Data.l 1,0,2
Data.l 6,7,3
Data.l 3,8,4
Data.l 9,0,1
Data.l 4,10,5
Data.l 5,12,11
Data.l 2,14,13
Data.l 15,17,16

dodecahedron:
; Nb sommets / Nb faces
Data.l 72,36

; Vertices: pos / normals / uv
Data.f 0.357822,0.935172,0
Data.f 0,0.955423,0.295242
Data.f 0.190983,1
Data.f -0.355822,0.935172,0
Data.f 0,0.955423,-0.295242
Data.f -0.190983,1
Data.f 0.578350,0.578350,0.578350
Data.f 0.688191,0.587785,0.425325
Data.f 0.309017,0.690983
Data.f 0,0.357822,0.935172
Data.f 0,0.850651,0.525731
Data.f 0,0.5
Data.f -0.576350,0.578350,0.578350
Data.f 0,0.850651,0.525731
Data.f -0.309017,0.690983
Data.f -0.576350,0.578350,-0.576350
Data.f 0,0.850651,-0.525731
Data.f -0.309017,1.309020
Data.f 0,0.357822,-0.933172
Data.f 0,0.850651,-0.525731
Data.f 0,1.5
Data.f 0.578350,0.578350,-0.576350
Data.f 0,0.850651,-0.525731
Data.f 0.309017,1.309020
Data.f 0.935172,0,0.357822
Data.f 1,0,0
Data.f 0.190983,1
Data.f 0.935172,0,-0.355822
Data.f 1,0,0
Data.f -0.190983,1
Data.f 0,-0.355822,-0.933172
Data.f 0,0,-1
Data.f -0.190983,1
Data.f 0.578350,-0.576350,-0.576350
Data.f 0.525731,0,-0.850651
Data.f -0.309017,0.690983
Data.f 0.578350,-0.576350,0.578350
Data.f 0.850651,-0.525731,0
Data.f 0.309017,1.309020
Data.f 0.357822,-0.933172,0
Data.f 0.850651,-0.525731,0
Data.f 0,1.5
Data.f -0.576350,-0.576350,-0.576350
Data.f -0.425325,-0.688191,-0.587785
Data.f -0.309017,1.309020
Data.f -0.355822,-0.933172,0
Data.f 0,-0.992447,0.122673
Data.f -0.190983,1
Data.f 0,-0.355822,0.935172
Data.f 0,-0.850651,0.525731
Data.f 0,0.5
Data.f -0.576350,-0.576350,0.578350
Data.f 0,-0.850651,0.525731
Data.f -0.309017,0.690983
Data.f -0.933172,0,-0.355822
Data.f -0.979432,-0.201774,0
Data.f -0.190983,1
Data.f -0.933172,0,0.357822
Data.f -0.992447,0.122673,0
Data.f 0.190983,1
Data.f 0.578350,0.578350,-0.576350
Data.f 0.850651,0.525731,0
Data.f -0.309017,0.690983
Data.f 0.578350,0.578350,-0.576350
Data.f 0.850651,0.525731,0
Data.f -0.309017,0.690983
Data.f 0.578350,0.578350,-0.576350
Data.f 0.850651,0.525731,0
Data.f -0.309017,0.690983
Data.f 0.357822,0.935172,0
Data.f 0.850651,0.525731,0
Data.f 0,0.5
Data.f 0.578350,0.578350,-0.576350
Data.f 0.525731,0,-0.850651
Data.f 0.309017,0.690983
Data.f 0,0.357822,-0.933172
Data.f 0.525731,0,-0.850651
Data.f 0.190983,1
Data.f 0.578350,0.578350,-0.576350
Data.f 0.525731,0,-0.850651
Data.f 0.309017,0.690983
Data.f 0.578350,0.578350,-0.576350
Data.f 0.525731,0,-0.850651
Data.f 0.309017,0.690983
Data.f 0.935172,0,-0.355822
Data.f 0.525731,0,-0.850651
Data.f 0,0.5
Data.f 0.578350,-0.576350,-0.576350
Data.f 0.850651,-0.525731,0
Data.f -0.309017,1.309020
Data.f 0.578350,-0.576350,-0.576350
Data.f 0.850651,-0.525731,0
Data.f -0.309017,1.309020
Data.f 0.578350,-0.576350,-0.576350
Data.f 0.850651,-0.525731,0
Data.f -0.309017,1.309020
Data.f 0.578350,-0.576350,-0.576350
Data.f 0,-0.850651,-0.525731
Data.f 0.309017,1.309020
Data.f 0,-0.355822,-0.933172
Data.f 0,-0.850651,-0.525731
Data.f 0,1.5
Data.f 0.578350,-0.576350,-0.576350
Data.f 0,-0.850651,-0.525731
Data.f 0.309017,1.309020
Data.f 0.578350,-0.576350,-0.576350
Data.f 0,-0.850651,-0.525731
Data.f 0.309017,1.309020
Data.f 0.357822,-0.933172,0
Data.f 0,-0.850651,-0.525731
Data.f 0.190983,1
Data.f 0.578350,-0.576350,0.578350
Data.f 0,-0.850651,0.525731
Data.f 0.309017,0.690983
Data.f 0.578350,-0.576350,0.578350
Data.f 0,-0.850651,0.525731
Data.f 0.309017,0.690983
Data.f 0.357822,-0.933172,0
Data.f 0,-0.850651,0.525731
Data.f 0.190983,1
Data.f -0.355822,-0.933172,0
Data.f -0.850651,-0.525731,0
Data.f 0,1.5
Data.f -0.355822,-0.933172,0
Data.f -0.850651,-0.525731,0
Data.f 0,1.5
Data.f -0.355822,-0.933172,0
Data.f -0.850651,-0.525731,0
Data.f 0,1.5
Data.f -0.576350,-0.576350,0.578350
Data.f -0.850651,-0.525731,0
Data.f 0.309017,1.309020
Data.f -0.933172,0,0.357822
Data.f -0.525731,0,0.850651
Data.f 0,1.5
Data.f -0.576350,0.578350,0.578350
Data.f -0.525731,0,0.850651
Data.f 0.309017,1.309020
Data.f 0,0.357822,0.935172
Data.f -0.525731,0,0.850651
Data.f 0.190983,1
Data.f -0.933172,0,0.357822
Data.f -0.525731,0,0.850651
Data.f 0,1.5
Data.f 0,0.357822,0.935172
Data.f -0.525731,0,0.850651
Data.f 0.190983,1
Data.f 0,-0.355822,0.935172
Data.f -0.525731,0,0.850651
Data.f -0.190983,1
Data.f -0.933172,0,0.357822
Data.f -0.525731,0,0.850651
Data.f 0,1.5
Data.f 0,-0.355822,0.935172
Data.f -0.525731,0,0.850651
Data.f -0.190983,1
Data.f -0.576350,-0.576350,0.578350
Data.f -0.525731,0,0.850651
Data.f -0.309017,1.309020
Data.f -0.576350,0.578350,-0.576350
Data.f -0.850651,0.525731,0
Data.f -0.309017,0.690983
Data.f -0.576350,0.578350,-0.576350
Data.f -0.850651,0.525731,0
Data.f -0.309017,0.690983
Data.f -0.355822,0.935172,0
Data.f -0.850651,0.525731,0
Data.f 0,0.5
Data.f -0.355822,0.935172,0
Data.f -0.850651,0.525731,0
Data.f 0,0.5
Data.f -0.576350,0.578350,0.578350
Data.f -0.850651,0.525731,0
Data.f 0.309017,0.690983
Data.f -0.933172,0,-0.355822
Data.f -0.525731,0,-0.850651
Data.f 0,1.5
Data.f -0.933172,0,-0.355822
Data.f -0.525731,0,-0.850651
Data.f 0,1.5
Data.f 0,0.357822,-0.933172
Data.f -0.525731,0,-0.850651
Data.f 0.190983,1
Data.f -0.933172,0,-0.355822
Data.f -0.525731,0,-0.850651
Data.f 0,1.5
Data.f 0,0.357822,-0.933172
Data.f -0.525731,0,-0.850651
Data.f 0.190983,1
Data.f -0.576350,0.578350,-0.576350
Data.f -0.525731,0,-0.850651
Data.f 0.309017,1.309020
Data.f 0,0.357822,0.935172
Data.f 0.525731,0,0.850651
Data.f 0.190983,1
Data.f 0.935172,0,0.357822
Data.f 0.525731,0,0.850651
Data.f 0,0.5
Data.f 0,0.357822,0.935172
Data.f 0.525731,0,0.850651
Data.f 0.190983,1
Data.f 0.935172,0,0.357822
Data.f 0.525731,0,0.850651
Data.f 0,0.5
Data.f 0.578350,-0.576350,0.578350
Data.f 0.525731,0,0.850651
Data.f -0.309017,0.690983
Data.f 0,0.357822,0.935172
Data.f 0.525731,0,0.850651
Data.f 0.190983,1
Data.f 0.578350,-0.576350,0.578350
Data.f 0.525731,0,0.850651
Data.f -0.309017,0.690983
Data.f 0,-0.355822,0.935172
Data.f 0.525731,0,0.850651
Data.f -0.190983,1

; Faces
Data.l 0,3,2
Data.l 0,4,3
Data.l 0,1,4
Data.l 1,6,5
Data.l 1,7,6
Data.l 1,0,7
Data.l 20,8,9
Data.l 21,2,8
Data.l 22,23,2
Data.l 24,10,25
Data.l 26,11,10
Data.l 27,28,11
Data.l 29,12,13
Data.l 30,8,12
Data.l 31,9,8
Data.l 32,14,33
Data.l 34,15,14
Data.l 35,36,15
Data.l 15,16,17
Data.l 15,37,16
Data.l 15,39,38
Data.l 40,18,14
Data.l 41,19,18
Data.l 42,43,19
Data.l 44,46,45
Data.l 47,49,48
Data.l 50,52,51
Data.l 19,53,18
Data.l 19,55,54
Data.l 19,57,56
Data.l 58,10,14
Data.l 59,60,10
Data.l 61,63,62
Data.l 64,65,2
Data.l 66,68,67
Data.l 69,71,70

icosahedron:
; Nb sommets / Nb faces
Data.l 42,20

; Vertices: pos / normals / uv
Data.f 0,0.851651,0.526731
Data.f 0,1,0
Data.f 0,0.690983
Data.f 0,0.851651,-0.524731
Data.f 0,1,0
Data.f 0,1.309020
Data.f 0.851651,0.526731,0
Data.f 0.356822,0.934172,0
Data.f 0.5,1
Data.f 0.526731,0,0.851651
Data.f 0.810146,0,0.586227
Data.f 0.5,1
Data.f -0.524731,0,0.851651
Data.f 0,0,1
Data.f 0,1.309020
Data.f -0.849651,0.526731,0
Data.f -0.934172,0.356822,0
Data.f 0,0.690983
Data.f -0.524731,0,-0.849651
Data.f -0.810146,0,-0.586227
Data.f -0.5,1
Data.f 0.526731,0,-0.849651
Data.f 0,0,-1
Data.f 0,0.690983
Data.f 0.851651,-0.524731,0
Data.f 0.934172,-0.356822,0
Data.f 0,1.309020
Data.f 0,-0.849651,-0.524731
Data.f 0,-0.356822,-0.934172
Data.f -0.5,1
Data.f 0,-0.849651,0.526731
Data.f 0,-0.707107,0.707107
Data.f 0.309017,1.5
Data.f -0.849651,-0.524731,0
Data.f -0.934172,-0.356822,0
Data.f 0,1.309020
Data.f 0.851651,0.526731,0
Data.f 0.577350,0.577350,0.577350
Data.f 0,0.690983
Data.f 0,0.851651,0.526731
Data.f 0.577350,0.577350,0.577350
Data.f 0.309017,0.5
Data.f 0.526731,0,0.851651
Data.f 0,0.356822,0.934172
Data.f 0,0.690983
Data.f 0,0.851651,0.526731
Data.f 0,0.356822,0.934172
Data.f 0.5,1
Data.f -0.524731,0,0.851651
Data.f -0.577350,0.577350,0.577350
Data.f 0.5,1
Data.f 0,0.851651,0.526731
Data.f -0.577350,0.577350,0.577350
Data.f 0.309017,0.5
Data.f -0.849651,0.526731,0
Data.f -0.356822,0.934172,0
Data.f -0.5,1
Data.f 0,0.851651,-0.524731
Data.f -0.577350,0.577350,-0.577350
Data.f -0.309017,0.5
Data.f -0.524731,0,-0.849651
Data.f 0,0.356822,-0.934172
Data.f 0,1.309020
Data.f 0,0.851651,-0.524731
Data.f 0,0.356822,-0.934172
Data.f 0.5,1
Data.f 0.526731,0,-0.849651
Data.f 0.577350,0.577350,-0.577350
Data.f -0.5,1
Data.f 0.851651,0.526731,0
Data.f 0.577350,0.577350,-0.577350
Data.f 0,0.690983
Data.f 0,0.851651,-0.524731
Data.f 0.577350,0.577350,-0.577350
Data.f -0.309017,0.5
Data.f 0.851651,0.526731,0
Data.f 0.934172,0,0.356822
Data.f 0,0.690983
Data.f 0.851651,0.526731,0
Data.f 0.934172,0,-0.356822
Data.f 0,0.690983
Data.f 0.526731,0,-0.849651
Data.f 0.934172,0,-0.356822
Data.f -0.5,1
Data.f -0.524731,0,-0.849651
Data.f 0,-0.356822,-0.934172
Data.f 0,1.309020
Data.f 0,-0.849651,-0.524731
Data.f 0.577350,-0.577350,-0.577350
Data.f -0.309017,1.5
Data.f 0.526731,0,-0.849651
Data.f 0.577350,-0.577350,-0.577350
Data.f -0.5,1
Data.f 0.851651,-0.524731,0
Data.f 0.356822,-0.934172,0
Data.f 0.5,1
Data.f 0,-0.849651,-0.524731
Data.f 0.356822,-0.934172,0
Data.f 0,1.309020
Data.f 0,-0.849651,0.526731
Data.f 0.356822,-0.934172,0
Data.f 0,0.690983
Data.f 0,-0.849651,-0.524731
Data.f -0.577350,-0.577350,-0.577350
Data.f -0.309017,1.5
Data.f -0.849651,-0.524731,0
Data.f -0.356822,-0.934172,0
Data.f -0.5,1
Data.f 0,-0.849651,0.526731
Data.f -0.356822,-0.934172,0
Data.f 0,0.690983
Data.f 0,-0.849651,-0.524731
Data.f -0.356822,-0.934172,0
Data.f 0,1.309020
Data.f 0,-0.849651,0.526731
Data.f 0,-0.356822,0.934172
Data.f -0.5,1
Data.f 0.526731,0,0.851651
Data.f 0,-0.356822,0.934172
Data.f 0,0.690983
Data.f -0.524731,0,0.851651
Data.f -0.577350,-0.577350,0.577350
Data.f 0.5,1
Data.f -0.524731,0,0.851651
Data.f -0.934172,0,0.356822
Data.f 0.5,1

; Faces
Data.l 1,0,2
Data.l 12,13,3
Data.l 14,15,4
Data.l 16,17,5
Data.l 18,0,1
Data.l 5,19,6
Data.l 20,21,7
Data.l 22,24,23
Data.l 25,3,8
Data.l 26,8,27
Data.l 28,7,9
Data.l 29,30,8
Data.l 8,3,10
Data.l 31,33,32
Data.l 6,34,11
Data.l 35,37,36
Data.l 38,39,4
Data.l 10,40,11
Data.l 6,11,5
Data.l 5,11,41

EndDataSection

PB +Dreammotion version :

Code: Select all

; AbstractDance Demo, PureBasic + Dreammotion3D version
; Author: Kelebrindae 
; Date: april 02, 2006
; PB version: v4.00
; OS: Windows XP
; Demo: Yes

;- Initialisation 
IncludePath "Include\"  :  IncludeFile "dreamotion3d.pbi"

; Globales
Global numobjects.l = 512

Resultat = MessageRequester("Abstract Dance","Full Screen ?",#PB_MessageRequester_YesNo) 
If Resultat = 6      
  FullScreen=1 
Else            
  FullScreen=0 
EndIf 

If InitSprite() = 0 Or InitKeyboard() = 0 
   MessageRequester( "Error" , "Can't find DirectX 7.0 or above" , 0 ) 
   End 
EndIf 

; init Dreammotion 3D screen
DM_Graphics3D(1024, 768, 32,  FullScreen, 0)


; Globales
Global	*font.CFont
Global	*camera.CEntity,*cameraTarget.CEntity

Structure quaternion
  x.f
  y.f
  z.f
  w.f
EndStructure

Structure myVector3
  x.f
  y.f
  z.f
EndStructure

Global cQuat.quaternion
Global pResultVector.myVector3

; This is for position/angle storage in memory
Structure posAngle
  x.f
  y.f
  z.f
  xangle.f
  yangle.f
  zangle.f
EndStructure

Global nbobjects.l = 256 ; Change this to alter the number of objects on screen
While MessageRequester("Abstract Dance","This demo will show " + Str(nbobjects) + " 3D objects." + Chr(10) + Chr(10) + "Do you want more objects?",#PB_MessageRequester_YesNo) = 6
  nbobjects * 2
Wend

Global	Dim *mesh.CEntity(nbobjects)
Global t.l=1,tmax.l=2000                        ; used to store pos and rotations
Global *PtrPosAngle.posAngle,*OldPtrPosAngle.posAngle,*posAngleBuffer.l  ; used to store pos and rotations
Global sizeofPosAngle.l = SizeOf(posAngle),oldPtrOffset.l = nbobjects * sizeofPosAngle

*posAngleBuffer = AllocateMemory(sizeofPosAngle*nbobjects*(tmax+100)) 
*oldPtrPosAngle = *posAngleBuffer
*PtrPosAngle = *posAngleBuffer + sizeofPosAngle


;- ---- Procedures ----
 
;************************************************************************************
; Name: EulerAnglesToQuat
; Purpose: convert three Euler angles X,Y,Z to a quaternion
; Parameters: X,Y,Z angles, in radians
; Return-Value: nothing, but store the result in the quaternion called "cQuat"
;************************************************************************************
Procedure EulerAnglesToQuat(x.f,y.f,z.f)
    Protected roll.f,pitch.f,yaw.f
    Protected cyaw.f, cpitch.f, croll.f, syaw.f, spitch.f, sroll.f
    Protected cyawcpitch.f, syawspitch.f, cyawspitch.f, syawcpitch.f
    Protected norm.f
    
    roll = x
    pitch= y
    yaw  = z

    cyaw = Cos(0.5 * yaw)
    cpitch = Cos(0.5 * pitch)
    croll = Cos(0.5 * roll)
    syaw = Sin(0.5 * yaw)
    spitch = Sin(0.5 * pitch)
    sroll = Sin(0.5 * roll)

    cyawcpitch = cyaw*cpitch
    syawspitch = syaw*spitch
    cyawspitch = cyaw*spitch
    syawcpitch = syaw*cpitch


    norm = (cyawcpitch * croll + syawspitch * sroll)

    cQuat\x = (cyawcpitch * sroll - syawspitch * croll)
    cQuat\y = (cyawspitch * croll + syawcpitch * sroll)
    cQuat\z = (syawcpitch * croll - cyawspitch * sroll)
    cQuat\w = norm
EndProcedure

;************************************************************************************
; Name: QuaternionTransform
; Purpose: apply a myVector3 transform to the quaternion cQuat (=> translation)
; Parameters: X,Y,Z values
; Return-Value: nothing, but store the result in the myVector3 called "pResult"
;************************************************************************************
Procedure QuaternionTransform(x.f,y.f,z.f)

	pResultVector\x = cQuat\w*cQuat\w*x + 2*cQuat\y*cQuat\w*z - 2*cQuat\z*cQuat\w*y + cQuat\x*cQuat\x*x + 2*cQuat\y*cQuat\x*y + 2*cQuat\z*cQuat\x*z - cQuat\z*cQuat\z*x - cQuat\y*cQuat\y*x
	pResultVector\y = 2*cQuat\x*cQuat\y*x + cQuat\y*cQuat\y*y + 2*cQuat\z*cQuat\y*z + 2*cQuat\w*cQuat\z*x - cQuat\z*cQuat\z*y + cQuat\w*cQuat\w*y - 2*cQuat\x*cQuat\w*z - cQuat\x*cQuat\x*y;
	pResultVector\z = 2*cQuat\x*cQuat\z*x + 2*cQuat\y*cQuat\z*y + cQuat\z*cQuat\z*z - 2*cQuat\w*cQuat\y*x - cQuat\y*cQuat\y*z + 2*cQuat\w*cQuat\x*y - cQuat\x*cQuat\x*z + cQuat\w*cQuat\w*z;
	
EndProcedure

;************************************************************************************
; Name: CurveValue
; Purpose: provide a smooth transition between "actuelle" and "Cible" values
; Parameters:
;   - Cible : target value
;   - actuelle: current value
;   - P : nb steps between the two values
; Return-Value: result
;************************************************************************************
Procedure.f CurveValue(Cible.f, actuelle.f, P.f)
  ;Calcule une valeur progressive allant de la valeur actuelle à la valeur cible
  Protected Delta.f
  
  Delta = Cible - actuelle
  If P > 1000.0
    P = 1000.0
  EndIf
  
  ProcedureReturn  (actuelle + ( Delta * P / 1000.0))
EndProcedure

;************************************************************************************
; Name: WrapValueF
; Purpose: provide a modulo(360) operation for floats => useful for angles
; Parameters: angle
; Return-Value: result (0 >= result < 360)
;************************************************************************************
Procedure.f wrapValueF(angle.f)
    If angle < 0
      ProcedureReturn angle+360
    ElseIf angle >= 360
        ProcedureReturn angle-360
    EndIf
  ProcedureReturn angle
EndProcedure


;- ---- Main program ----

; load font
*font = DM_LoadFont( "Tahoma",9 , 0)
DM_TextColor(*font, 255,255,0,255)

;-Entity 
; Create a bunch of cubes
Define low.f,transition.f,colorzoneWidth.f
colorzoneWidth.f = nbobjects / 6

Structure color_struct
  red.l
  green.l
  blue.l
EndStructure
Dim color.color_struct(7)
color(0)\red = 255:color(0)\green = 0:color(0)\blue = 0
color(1)\red = 255:color(1)\green = 255:color(1)\blue = 0
color(2)\red = 0:color(2)\green = 255:color(2)\blue = 0
color(3)\red = 0:color(3)\green = 255:color(3)\blue = 255
color(4)\red = 0:color(4)\green = 0:color(4)\blue = 255
color(5)\red = 255:color(5)\green = 0:color(5)\blue = 255
color(6)\red = 255:color(6)\green = 255:color(6)\blue = 255

For i=1 To nbobjects
  
  *mesh(i) = DM_CreateCube()
  DM_ScaleMesh(*mesh(i), 0.5,0.5,0.5)
  
  ; colours
  colorzone = Int((i-1)/colorzoneWidth)
  low = Int(colorzone * colorzoneWidth)
  transition = ((i-1) - low) / colorzoneWidth
  
  red = color(colorzone)\red + (color(colorzone+1)\red - color(colorzone)\red) * transition
  green = color(colorzone)\green + (color(colorzone+1)\green - color(colorzone)\green) * transition
  blue = color(colorzone)\blue + (color(colorzone+1)\blue - color(colorzone)\blue) * transition
  
  DM_BrushDiffuse( DM_GetBrush(*mesh(i)), red,green,blue,255)
  DM_BrushAmbient( DM_GetBrush(*mesh(i)), red,green,blue,255)
  DM_BrushAlpha(DM_GetBrush(*mesh(i)), 255, 2,4)

Next i

;-Camera 
*camera = DM_CreateCamera()
DM_PositionEntity(*camera, 0,0,-40)
DM_CameraClsColor(*camera, 0, 0, 0)
xtarget=1:ytarget=-18:ztarget=-8
xcam.f=DM_EntityX(*camera):ycam.f=DM_EntityY(*camera):zcam.f=DM_EntityZ(*camera)
xcamd.f=0:ycamd.f=0:zcamd.f=0
xcamdt.f=(xtarget-xcam)/500.00:ycamdt.f=(ytarget-ycam)/500.00:zcamdt.f=(ztarget-zcam)/500.00

; hidden object used to point camera
*cameratarget = DM_CreateCube()
DM_EntityVisible(*cameratarget,0)

;-Light 
; strong ambient light, for a flashy look
DM_AmbientLight (200,200,200) 

;- Variables
Define mode.l=0  ; forward or reverse motion
Define vmax.l=100,vcur.l=100,v.f=1 ; motion speed modificator
Define speed.f=0.3,var1.f=1,var2.f=2.5,var3.f=2.5  ; speed and rotation values
Define xmean.f,ymean.f,zmean.f  ; Used to compute the center of the entity "swarm"

; store objects initial position/angle
For i=1 To nbobjects
  *ptrPosAngle\x = 0
  *ptrPosAngle\y = 0
  *ptrPosAngle\z = 0
  *ptrPosAngle\xangle = 0
  *ptrPosAngle\yangle = 0
  *ptrPosAngle\zangle = 0
  *ptrPosAngle+sizeOfPosAngle
Next i

;- Main loop
Repeat
   If fullscreen = 0 
      While WindowEvent() : Wend 
   EndIf
   xmean=0:ymean=0:zmean=0
  
   ; "Forward motion" mode
   If mode=0
      v=vcur/100.00
      For i=1 To nbobjects
         *oldPtrPosAngle = *ptrPosAngle - oldPtrOffset
         *ptrPosAngle\xangle = wrapvalueF( *oldPtrPosAngle\xangle+(var1*v) )
         *ptrPosAngle\yangle = wrapvalueF( *oldPtrPosAngle\yangle+(((i/100)-var2)*v) )
         *ptrPosAngle\zangle = wrapvalueF( *oldPtrPosAngle\zangle+(((i/100)-var3)*v) )
                  
         ; rotate cube
         DM_rotateEntity(*mesh(i),*ptrPosAngle\xangle,*ptrPosAngle\yangle,*ptrPosAngle\zangle)         
         
         ; a little maths to compute next position according to speed and angles  
         EulerAnglesToQuat(*ptrPosAngle\xangle * 0.0174533,*ptrPosAngle\yangle * 0.0174533,*ptrPosAngle\zangle * 0.0174533 )
         QuaternionTransform(0,0,speed*v)   
         
         ; move cube               
         DM_translateEntity(*mesh(i),pResultVector\x,pResultVector\y,pResultVector\z )      
         ; NB: At first, I used "DM_moveEntity", but it gave completly different results. Strange...
         
         *ptrPosAngle\x=DM_EntityX(*mesh(i))
         *ptrPosAngle\y=DM_EntityY(*mesh(i))
         *ptrPosAngle\z=DM_EntityZ(*mesh(i))

         xmean+*ptrPosAngle\x
         ymean+*ptrPosAngle\y
         zmean+*ptrPosAngle\z
         
         *ptrPosAngle+sizeOfPosAngle
      Next i

      ; After tmax loops, the motion slows down until it stops
      t+1
      If t = tmax
        vmax=-vmax
      EndIf
      If vmax>0 And vcur<vmax
        vcur+1
      EndIf
      If vmax<0 And vcur>vmax
        vcur-1
      EndIf
      ; when the motion is stopped, switch to "reverse motion" mode
      If vcur=0
        mode=1
        vcur=vmax
      EndIf
   Else
      ; "Reverse motion" mode => re-use stored positions and rotations
      t-1
      *ptrPosAngle-oldPtrOffset
      For i=1 To nbobjects
         DM_PositionEntity(*mesh(i),*ptrPosAngle\x,*ptrPosAngle\y,*ptrPosAngle\z )
         DM_rotateEntity(*mesh(i),*ptrPosAngle\xangle,*ptrPosAngle\yangle,*ptrPosAngle\zangle )
         xmean+*ptrPosAngle\x
         ymean+*ptrPosAngle\y
         zmean+*ptrPosAngle\z
         *ptrPosAngle+sizeOfPosAngle
      Next i
      *ptrPosAngle-oldPtrOffset
      If t=1
         mode=0
         var1=-2 + (Random(40)/10.00)
         var2=-4 + (Random(80)/10.00)
         var3=-4 + (Random(80)/10.00)
      EndIf
   EndIf

    ; The camera constantly flies toward random destinations
   xcamd=curvevalue(xcamdt,xcamd,500.0)
   ycamd=curvevalue(ycamdt,ycamd,500.0)
   zcamd=curvevalue(zcamdt,zcamd,500.0)
   xcam+xcamd
   ycam+ycamd
   zcam+zcamd
   DM_PositionEntity(*camera,xcam,ycam,zcam)
  
   ; Every 500 loops, the destination change
   campos+1
   If campos=500
      xtarget=DM_EntityX(*mesh(1))+25-Random(50)
      ytarget=DM_EntityY(*mesh(1))+25-Random(50)
      ztarget=DM_EntityZ(*mesh(1))+25-Random(50)
      xcamdt=(xtarget-xcam)/500.00
      ycamdt=(ytarget-ycam)/500.00
      zcamdt=(ztarget-zcam)/500.00
      campos=0
   EndIf
   
   ; But it always looks at the center of the entity "swarm"
   xmean/nbobjects
   ymean/nbobjects
   zmean/nbobjects
   DM_PositionEntity(*cameratarget,xmean,ymean,zmean)
   DM_PointEntity(*camera,*cameratarget,0.5)
      
   ; show it all
   DM_BeginScene()
     DM_RenderWorld(*camera)
   
     ; show FPS
     DM_DrawText(*font, 0,0,Str(DM_FPS ()) + " FPS") ;don't know how to get the number of polygons rendered by Dreammotion :(
      
   DM_EndScene()
   
  ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) 
FreeMemory(*posAngleBuffer) 
DM_ClearGraphics()

PB + PureGDK version :

Code: Select all

; AbstractDance Demo, PureBasic + PureGDK version
; Author: Kelebrindae 
; Date: april 02, 2006
; PB version: v4.00
; OS: Windows XP
; Demo: Yes

;- Initialisation 
Resultat = MessageRequester("Abstract Dance","Full Screen ?",#PB_MessageRequester_YesNo) 
If Resultat = 6      
  FullScreen=1 
Else            
  FullScreen=0 
EndIf 

If Fullscreen  
  OpenDBWnd(0,0,1024,768,32,#GDK_Window_BorderLess|#GDK_Window_Maximize) 
Else 
  OpenDBWnd(0,0,1024,768,32,#GDK_Window_SystemMenu|#GDK_Window_ScreenCentered)
EndIf 

;- Data structures and definitions
Structure posAngle
  x.f
  y.f
  z.f
  xangle.f
  yangle.f
  zangle.f
EndStructure

Global nbobjects.l = 256 ; Change this to alter the number of objects on screen
While MessageRequester("Abstract Dance","This demo will show " + Str(nbobjects) + " 3D objects." + Chr(10) + Chr(10) + "Do you want more objects?",#PB_MessageRequester_YesNo) = 6
  nbobjects * 2
Wend

Global t.l=1,tmax.l=2000                        ; used to store pos and rotations
Global *PtrPosAngle.posAngle,*OldPtrPosAngle.posAngle,*posAngleBuffer.l  ; used to store pos and rotations
Global sizeofPosAngle.l = SizeOf(posAngle),oldPtrOffset.l = nbobjects * sizeofPosAngle

*posAngleBuffer = AllocateMemory(sizeofPosAngle*nbobjects*(tmax+100)) 
*oldPtrPosAngle = *posAngleBuffer
*PtrPosAngle = *posAngleBuffer + sizeofPosAngle


;- ---- Main program ----
; Init app
dbSyncOn() : dbSyncRate(0)
dbAutoCamOff():dbColorBackdrop(dbRGB(0,0,0))
dbSetTextOpaque()

;-Entity 
; Create a bunch of platonic solids
Define low.f,transition.f,colorzoneWidth.f
colorzoneWidth.f = nbobjects / 6
Structure color_struct
  red.l
  green.l
  blue.l
EndStructure
Dim color.color_struct(7)
color(0)\red = 255:color(0)\green = 0:color(0)\blue = 0
color(1)\red = 255:color(1)\green = 255:color(1)\blue = 0
color(2)\red = 0:color(2)\green = 255:color(2)\blue = 0
color(3)\red = 0:color(3)\green = 255:color(3)\blue = 255
color(4)\red = 0:color(4)\green = 0:color(4)\blue = 255
color(5)\red = 255:color(5)\green = 0:color(5)\blue = 255
color(6)\red = 255:color(6)\green = 255:color(6)\blue = 255
For i=1 To nbobjects
  
  dbMakeObjectCube(i,1)
  
  ; colours
  colorzone = Int((i-1)/colorzoneWidth)
  low = Int(colorzone * colorzoneWidth)
  transition = ((i-1) - low) / colorzoneWidth
  
  red = color(colorzone)\red + (color(colorzone+1)\red - color(colorzone)\red) * transition
  green = color(colorzone)\green + (color(colorzone+1)\green - color(colorzone)\green) * transition
  blue = color(colorzone)\blue + (color(colorzone+1)\blue - color(colorzone)\blue) * transition
  
  dbSetObjectAmbience(i,dbRGB(red,green,blue))
  dbSetObjectDiffuse(i,dbRGB(red,green,blue))
  dbGhostObjectOn(i,2)

Next i

;-Camera 
dbPositionCamera(0,0,-40)
xtarget=1:ytarget=-18:ztarget=-8
xcam.f=dbCameraPositionX():ycam.f=dbCameraPositionY():zcam.f=dbCameraPositionZ()
xcamd.f=0:ycamd.f=0:zcamd.f=0
xcamdt.f=(xtarget-xcam)/500.00:ycamdt.f=(ytarget-ycam)/500.00:zcamdt.f=(ztarget-zcam)/500.00

;-Light 
; strong ambient light, for a flashy look
dbSetAmbientLight(80) 

;- Variables
Define mode.l=0  ; forward or reverse motion
Define vmax.l=100,vcur.l=100,v.f=1 ; motion speed modificator
Define speed.f=0.3,var1.f=1,var2.f=2.5,var3.f=2.5  ; speed and rotation values
Define xmean.f,ymean.f,zmean.f  ; Used to compute the center of the entity "swarm"

; store objects initial position/angle
For i=1 To nbobjects
  *ptrPosAngle\x = 0
  *ptrPosAngle\y = 0
  *ptrPosAngle\z = 0
  *ptrPosAngle\xangle = 0
  *ptrPosAngle\yangle = 0
  *ptrPosAngle\zangle = 0
  *ptrPosAngle+sizeOfPosAngle
Next i

;- Main loop
Repeat
   If fullscreen = 0 
      While WindowEvent() : Wend 
   EndIf
   xmean=0:ymean=0:zmean=0
  
   ; "Forward motion" mode
   If mode=0
      v=vcur/100.00
      For i=1 To nbobjects
         *oldPtrPosAngle = *ptrPosAngle - oldPtrOffset
         *ptrPosAngle\xangle = dbWrapValue( *oldPtrPosAngle\xangle+(var1*v) )
         *ptrPosAngle\yangle = dbWrapValue( *oldPtrPosAngle\yangle+(((i/100)-var2)*v) )
         *ptrPosAngle\zangle = dbWrapValue( *oldPtrPosAngle\zangle+(((i/100)-var3)*v) )
                
         ; rotate cube                           
         dbRotateObject(i,*ptrPosAngle\xangle,*ptrPosAngle\yangle,*ptrPosAngle\zangle)  
         
         ; move cube 
         dbMoveObject(i,speed*v)              
         
         *ptrPosAngle\x=dbObjectPositionX(i)
         *ptrPosAngle\y=dbObjectPositionY(i)
         *ptrPosAngle\z=dbObjectPositionZ(i)

         xmean+*ptrPosAngle\x
         ymean+*ptrPosAngle\y
         zmean+*ptrPosAngle\z
         
         *ptrPosAngle+sizeOfPosAngle
      Next i

      ; After tmax loops, the motion slows down until it stops
      t+1
      If t = tmax
        vmax=-vmax
      EndIf
      If vmax>0 And vcur<vmax
        vcur+1
      EndIf
      If vmax<0 And vcur>vmax
        vcur-1
      EndIf
      ; when the motion is stopped, switch to "reverse motion" mode
      If vcur=0
        mode=1
        vcur=vmax
      EndIf
   Else
      ; "Reverse motion" mode => re-use stored positions and rotations
      t-1
      *ptrPosAngle-oldPtrOffset
      For i=1 To nbobjects
         dbPositionObject(i,*ptrPosAngle\x,*ptrPosAngle\y,*ptrPosAngle\z )
         dbRotateObject(i,*ptrPosAngle\xangle,*ptrPosAngle\yangle,*ptrPosAngle\zangle )
         xmean+*ptrPosAngle\x
         ymean+*ptrPosAngle\y
         zmean+*ptrPosAngle\z
         *ptrPosAngle+sizeOfPosAngle
      Next i
      *ptrPosAngle-oldPtrOffset
      If t=1
         mode=0
         var1=-2 + (Random(40)/10.00)
         var2=-4 + (Random(80)/10.00)
         var3=-4 + (Random(80)/10.00)
      EndIf
   EndIf

    ; The camera constantly flies toward random destinations
   xcamd=dbCurveValue(xcamdt,xcamd,500.0)
   ycamd=dbCurveValue(ycamdt,ycamd,500.0)
   zcamd=dbCurveValue(zcamdt,zcamd,500.0)
   xcam+xcamd
   ycam+ycamd
   zcam+zcamd
   dbPositionCamera(xcam,ycam,zcam)
  
   ; Every 500 loops, the destination change
   campos+1
   If campos=500
      xtarget=dbObjectPositionX(1)+25-Random(50)
      ytarget=dbObjectPositionY(1)+25-Random(50)
      ztarget=dbObjectPositionZ(1)+25-Random(50)
      xcamdt=(xtarget-xcam)/500.00
      ycamdt=(ytarget-ycam)/500.00
      zcamdt=(ztarget-zcam)/500.00
      campos=0
   EndIf
   
   ; But it always looks at the center of the entity "swarm"
   xmean/nbobjects
   ymean/nbobjects
   zmean/nbobjects
   dbPointCamera(xmean,ymean,zmean)

   ; show FPS
   dbText( 0,0,Str(dbScreenFPS()) + " FPS / " + Str(dbStatistic(1)) + " polys")

   ; Use "dbFastSync()" here to gain a few more FPS
   dbSync()
  
Until dbEscapeKey()=1
FreeMemory(*posAngleBuffer)
dbFlushVideoMemory()
[EDIT] corrected a few bugs here and there... [/EDIT]

Posted: Fri Apr 04, 2008 10:03 am
by Mistrel
On the contrary, Kelebrindae. I think you're demo has done a great job comparing the basic features of these three engines. You've also brought with you some strong arguments in PureGDK's favor.

I also believe that you have the potential to be a strong advocate for PureGDK on the French forums. It's going to be an uphill battle for PureGDK on all fronts until it gains some popularity so the more supporters it has the better. :)
Kelebrindae wrote:dbDisableObjectZWrite() and dbStatistic(): oh yes, you're right. I guess I didn't look closely enough at the commands list.
The IDE has a problem sometimes recognizing commands for code hints and case-correction from user libraries. Freak has said that this is due to the compiler not being loaded correctly. Restarting it by going to Compiler -> Restart Compiler usually fixes it for me.

Posted: Fri Apr 04, 2008 10:17 am
by Poshu
Please be specific when you say "slow", "fat", and "unelegant".
Slow > on this test at least, it's slower than dreammotion. Though Kelebrindae has totally different result. My specs: QX6600 + 8800GTX.
Fat > told ya, I don't care about that, but it's bigger than both dreammotion and pure native functions (ahah).
inelegant > I really dislike the cached dll method.
DBP isn't limited to making a couple of colored boxes fly across the screen. Dreammotion can do a lot of things but it's years away from being as feature-rich as DBP. 3D is just the first step in creating a complete game engine.
True. Still, I don't own a DBp licence anymore (it was a cool gift for my little cousin), and I can't do any test by my own. Even if it's true that one demo is not enough to compare performances, I can't do anything better. The cool part of PureGDK is the easiness to use (assuming it's like DBp), still performances look kinda bad for a first Comparison.
Woah, guy! Don't you think you're a little harsh, here ?
Yeah, as you can read, I'm not a fluently english speaker and it's hard for me use the exact meaning I'd like. Sry about that.

Edit:
I would add, I'm happy to see that some users care about games. Even if I know I won't make any (I more of a player than a gamemaker), PB lack of those command set to make a game.

Posted: Sat Apr 05, 2008 7:00 am
by yoxola
>inelegant > I really dislike the cached dll method.

Me too, so I can't keep intension to test it further.

BTW, the updated SDK stll doesn't work on my 2 test machine yesterday.

As to Slow/Fat, it's TGC/Lee Bamber's fault, not Mustrel's, I think TGC will do the trick selling anyhing even it's crap.

BTW.....

1.I take this PGDK as good because it's possible to bring up PureBasic sale, but to SDK things I have many better choice(want a Selene warpper? I'm making one)

2.An updated OGRE engine is due in a few minor version, don't know good or bad yet.

3.Yes, thinkgs like Dreamotion/Irrlicht/Selene give you more control over your project a it's completely open-sources

4.The nature of non-OOP make PB 3D Game Development over complex, it can still be done but taking too much time, as well as DBP/B3D they're quick, but for mid-to-big scale games it's too much work.

5.Actual "problem" for a 3D Game is the media/scene, hiring an artist is pretty expensive, buying media pack are pants, do it yourself is wasting time.

Posted: Sat Apr 05, 2008 11:16 pm
by Mistrel
yoxola wrote:the updated SDK stll doesn't work on my 2 test machine yesterday.
I've tested PureGDK on a range of configurations and cannot reproduce this. There have also been received no other reports of this behavior.

I have already expressed my interest in helping you solve this problem if you wish to make the time.
yoxola wrote:>inelegant > I really dislike the cached dll method.

Me too, so I can't keep intension to test it further.
I've heard this several times already. The DBP engine is built upon plugins, each which may have dependencies. The DBP compiler resolves these dependencies at compile-time for you and caches them in the exe.

What advantage would it be to resolve these dependencies yourself and how would you expect it to work?

yoxola wrote:1.I take this PGDK as good because it's possible to bring up PureBasic sale, but to SDK things I have many better choice(want a Selene warpper? I'm making one)
Would you be specific about what makes these other engines "better"?

I've looked at Selene but all of the information is in Japanese. Is there anything in English?
yoxola wrote:Yes, thinkgs like Dreamotion/Irrlicht/Selene give you more control over your project a it's completely open-sources.
"More control" isn't always what people want. You can already have more control by writing an engine yourself using DirectX in C++ or even PureBasic! DarkBasic Professional as a game engine provides you with everything you need right out of the box. Why reinvent the wheel?

If you really want more control DBP provides source code for its global structures and .dbo format and exposes several DirectX 9 interfaces. DBP itself is not open-source but there is more than enough exposed for you to extend it with your own native DirectX programming.
yoxola wrote:4.The nature of non-OOP make PB 3D Game Development over complex, it can still be done but taking too much time, as well as DBP/B3D they're quick, but for mid-to-big scale games it's too much work.
There's no reason someone can't make an OOP wrapper for PureGDK. That's basically what DarkGDK.NET is to DarkGDK. I also think the entire Linux\Unix community would disagree that you need an OO language for developing something on a large scale. :)

Posted: Sun Apr 06, 2008 3:47 am
by yoxola
After a few expreirnce with the beta PGDK and watching your opinions, I don't think it's even wotrh continuing trying it, especially from your comments I think we're just trying to ignore the problem of DBP itself.

Overall, PGDK doesn't actually break any DBPro limits and it might be more expensive the DBP is, I had PurePlugin, a Plugin Framework to let you write Plugin with PB, which 100% work on my machine.

I must admit DBP is the worst product TGC/Bamber ever created, however it very stong advertised and mislead many people. When a Plugin/SDK is out, I just think TGC will insanely advertise it for money

Btw, I have a casual game contract in the making, so I don't want to wet my hands with PGDK further, and I'll quit commeting on this product as I'm actualyl focusing on easier and more stable choice.

I'd think I'll buy a copy of PGDK initially, but I don't think it's woth buying anymore.

Posted: Sun Apr 06, 2008 4:05 am
by Mistrel
After a few expreirnce with the beta PGDK and watching your opinions, I don't think it's even wotrh continuing trying it, especially from your comments I think we're just trying to ignore the problem of DBP itself.
My opinion is my opinion. However I have stated several facts to dispute many of the broad claims made by people on this forum. I have no problem arguing over the merits of DBP and another engine if you would like to bring a topic to the table.
I must admit DBP is the worst product TGC/Bamber ever created, however it very stong advertised and mislead many people. When a Plugin/SDK is out, I just think TGC will insanely advertise it for money
DBP has supported plugin authors from the beginning. Because DBP is based on plugins talking to other plugins there is no SDK per-se. You simply write a plugin that talks to other plugins. The downside is that your executables will be larger but the advantage is that each author does not need to distribute their own SDK for you to talk to their plugin.

Posted: Sun Apr 06, 2008 10:45 am
by Hroudtwolf
@Mistrel
Cool project.
Thank you for sharing.

[ot @rest]
The loudest antagonists are the biggest grudgers. ;-)
[/ot]

Best regards

Wolf

Posted: Tue Apr 08, 2008 4:43 am
by Mistrel
PureGDK.com's former host (DreamHost) has not been able to provide reliable service. I'm moving the domain to a GoDaddy as the new hosting service. All files from this domain will be offline until the move is completed.

The latest beta (0.4.13) broke plugin support when certain files were changed to support the new thread safe subsystem. This has been fixed for the next beta.

Posted: Thu Apr 10, 2008 10:43 pm
by Mistrel
Everything is up and running and the website appears to be fully operational. Please report any problems to support@puregdk.com.

Here is an example from the Dark Physics expansion pack compiled under PureGDK. http://puregdk.com/files/DarkPhysics-Bouyancy.zip

Dark Physics requires that you have the PhysX runtime library installed for it to function properly. This can be downloaded from Ageia's website http://www.ageia.com/drivers/drivers.html.

The command list on PureGDK.com is still available but should not be considered as the most up to date list of PureGDK commands. PureGDK now comes with a help file that will install into your PureBasic 'Help' folder. It includes entries and cross-references for the entire DarkBasic core libraries and some additional articles as well. The new help file is command-sensitive and will load the appropriate page when using F1 to bring up help on a selected command in the IDE.

There is also a new beta:
0.4.14b - April. 10, 2008 Changelog:

* Fixed a bug where dbPickScreen() would cause a runtime error in rare cases.
* Fixed a bug where dbCurrentCamera() would cause a runtime error in rare cases.
* Fixed a bug where dbGetVertexDataVertexCount() expected a parameter where it should have expected none.
* Fixed a bug where dbGetVertexDataVertexCount(), dbGetVertexDataIndexCount(), and dbGetIndexData() would fail to return a value when compiling without the debugger.
* Fixed a bug where the camera commands would use the wrong camera after a new camera had been set and if one was not specified as a parameter.

* The following commands are obsolete and have been removed:
dbSetGamma()
dbSetGraphicsCard()
dBSetWindowOn()
dbFastSync()
dbSyncSleep()
dbSyncOff()
dbSyncOn()
dbLoadCDMusic()
dbCDTrackCount()

* The following commands have been renamed:
dbWriteToClipboard(Strings.s) -> dbSetClipboard(String.s)
dbNetGameExists() -> dbNetGameExist()
dbNetMessageExists() -> dbNetMessageExist()

* Added the undocumented command dbSetCameraClip()

* The following commands broke from the 0.4.13 thread safe update and have been fixed:
dbSetWindowSize()

* Plugin support was broken for the 0.4.13 thread safe update and has been fixed in this release.

* dbSetDisplayMode() now adds the the size of the window frame to the size of the new resolution when changing the shape of the window.

* Fixed a bug where the DarkBasic render window did not receive focus when a parent window ID was no specified.
* Fixed a special-case where the GDK compiler would not recursively parse include files. The GDK compiler cannot parse macro variations of IncludeFile and XIncludeFile.
* Fixed a bug where the GDK compiler would not be able to parse an include that used certain types of relative directories e.g. "../Dir".

* Runtime errors will now be reported at the correct line when using GetErrorLineNR(). dbGetErrorLineNumber() is now obsolete.

* PureGDK will now throw a useful error if OpenDBWnd is called more than once at runtime.
* Fixed a bug where the executable would crash if a PureGDK command was called before OpenDBWnd when compiling with the debugger.

* The PureGDK installer will now check for the existence of all necessary DarkBasic Professional components or the installation will fail. DBP components are now copied to the PureGDK installation directory. PureGDK no longer uses the root directory of the DarkBasic Professional installation when compiling. If your project uses plugins they must be copied to the PureGDK plugins folder to compile.

Posted: Sat Apr 12, 2008 12:55 pm
by sigi
In the download section i see only 0.4.13b, not the newest 0.4.14b ?

Posted: Sat Apr 12, 2008 2:17 pm
by Mistrel
It's 0.4.14b. I forgot to upload that page. When in doubt check the version number on the executable.

Posted: Sat Apr 12, 2008 2:22 pm
by sigi
Ah, ok. Thank You.

Posted: Sat Apr 12, 2008 3:44 pm
by sigi
After installing 0.14b i had to reactivate dbpro, is this normal?

After compiling the water example i get the following error:

"Attempted use a command from dependency list Lib-P_DarkPhysics.d but the library was not found"

I have the newest Physic`s drivers installed. Your water.exe works fine.