Page 1 of 10

Dreamotion3d (and PhysX) continuation...

Posted: Sat Oct 14, 2006 12:44 pm
by tmyke
Dreamotion3D (and the Physic module) is a Blitz3D like 3D engine, in Beta-Test'.
Developed with DIrectX9c, DM3M is designed to allow fast and easy implementation
with a simple set of instructions.
the development continues, and the first release version should arrive at the beginning
of year 2007, with several news (shadows, best terrain engine, new format supported, etc...)

Physic doc is in English, but graphical engine doc is still in French (coming soon in English)
PureBasic 4.00 and Direct9c instelled it's nescessery...

If you want try it, and (why not) become beta-tester ...

link Pure Basic v0.2.04
http://www.dreamotion3d.com section dowload (only for register user)

Image

Posted: Sat Oct 14, 2006 12:47 pm
by tmyke
@Psychophanta:
...
you can also put the DLL in the 'Compiler' folder, I try it, and it's good...
... or in your sample folder, but with an executable .

:wink:

Posted: Sat Oct 14, 2006 3:15 pm
by blueznl
i admit these screenshots look good...

Posted: Sat Oct 14, 2006 4:58 pm
by djes
Please give it a try! It's the best engine available for a while. Samples are : :shock: , and Tmyke is available to help. :D

Posted: Sat Oct 14, 2006 8:42 pm
by Comtois
Yes it's great, i'm playing with it.

Here a small example to create a mesh and texture manual, i needed this example for my own code :)

Code: Select all

;////////////////////////////////////////////////////////////////
;//
;// Project Title: Dreamotion3D pour PureBasic
;// File Title: MESH MANUEL & TEXTURE MANUELLE
;//            
;// Created On: 12-10-2006
;// Conversion Author: Terry Myke
;//
;////////////////////////////////////////////////////////////////

; Fichiers Include
IncludePath "Include\"
IncludeFile "d3dx9.pbi"
IncludeFile "dreamotion3d.pbi"     

Declare CreateCube()

Global  *camera.CEntity
Global  *entity.CEntity
Global  *brush.CBrush
Global  *texture.CTexture
Global  *font.CFont

;Initialisation des différents modules
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  End
EndIf

;ouvre un ecran 3D
DM_Graphics3D(800, 600, 32,  1, 1)
*font = DM_LoadFont( "Arial",16, 2)

;creation du cube
CreateCube()

;--------------------------------------------------------------
; UNE PETITE CAMERA POUR VOIR NOTRE SCENE
;--------------------------------------------------------------
*camera = DM_CreateCamera(#Null)
DM_MoveEntity(*camera, 0, 0, -50)
DM_CameraClsColor(*camera, 25, 25, 25)

Repeat

  ExamineKeyboard()
  DM_TurnEntity(*entity,1,1,1)

  ;debut rendu
  DM_BeginScene()
  ;rendu scene
  DM_Renderworld()
  ;fin rendu
  DM_EndScene()

Until KeyboardPushed(#PB_Key_Escape)
DM_ClearGraphics()
End

Procedure CreateCube()
  ;creation d'un mesh vide, un canal de texutre,
  ;12 faces, 24 vertices, 1 surface, pas de parent
  *entity = DM_CreateMesh(12, 24, 1, #Null)
  ;les vertex
  Restore Vertex
  For i= 0 To 23
    Read x.f
    Read y.f
    Read z.f
    Read u.f
    Read v.f
    ;les coordonnées de vertex
    DM_VertexCoords(*entity, i, x, y, z)
    ;les coordonnées de texture (canal 0)
    DM_VertexTexCoords(*entity, i, 0, u, v)
  Next i
  ;les triangles
  Restore Indice
  For i = 0 To 11
    Read v1.l
    Read v2.l
    Read v3.l
    DM_VertexTriangle(*entity, i, v1,v2,v3, 0)
  Next i
  ;on crée une petite Brush, dont on récupère le pointeur
  *brush = DM_CreateBrush("cube")
  ;modifie certains paramètres de la brush
  DM_BrushAmbient(*brush, 255,128,0,255)
  DM_BrushDiffuse(*brush, 255,128,0,255)
 
  ;--------------------------------------------------------
  ; TEXTURE 
  ;--------------------------------------------------------
  ;creation d'une texture vide de 256x256
  *texture = DM_CreateTexture(256,256)
  ;ré-oriente le buffer de sortie graphique vers notre texture
  DM_SetBuffer(*texture)
  ;debut d'un rendu
  DM_BeginScene()
    DM_ClsScreen (210, 0, 255, 0)         ; efface le buffer avec une couleur
    DM_DrawRect  ( 10, 10, 200, 200)      ; dessin d'un rectangle 2D
    DM_SetColor2D(222, 0, 0, 255)         ; change couleur du trait
    DM_DrawOval  (100, 100, 50, 50)       ; dessin oval 2D
    DM_DrawText(*font, 10, 15, "TEXTURE") ; un petit texte
  ;fin rendu
  DM_EndScene()
  ;de nouveau le buffer vers l'ecran
  DM_SetBuffer(#Null)
 
 
  DM_BrushTexture(*brush, *texture, 0)
  ; modifie l'état de rendu de la Brush pour voir de tous les cotés
  DM_BrushAddRender(*brush, #D3DRS_CULLMODE, #D3DCULL_NONE)
  ; affecte la brush créee a notre entity
  DM_PaintEntity(*entity, *brush, 0)
  ; génératon auto des normales de l'entity créée
  DM_UpdateNormal(*entity)
  ; p'tite rotation
  DM_RotateMesh(*entity, 0, 45, 0)

EndProcedure


DataSection
Vertex:
; liste des 24 vertex avec leurs coordonnées de textures
Data.f -10, 10,-10, 1, 0
Data.f  10, 10,-10, 1, 1
Data.f -10,-10,-10, 0, 0
Data.f  10,-10,-10, 0, 1
Data.f -10, 10, 10, 0, 0
Data.f -10,-10, 10, 0, 1
Data.f  10, 10, 10, 1, 0
Data.f  10,-10, 10, 1, 1
Data.f -10, 10, 10, 0, 0
Data.f  10, 10, 10, 0, 1
Data.f -10, 10,-10, 1, 0
Data.f  10, 10,-10, 1, 1
Data.f -10,-10, 10, 1, 0
Data.f -10,-10,-10, 1, 1
Data.f  10,-10, 10, 0, 0
Data.f  10,-10,-10, 0, 1
Data.f  10, 10,-10, 0, 0
Data.f  10, 10, 10, 0, 1
Data.f  10,-10,-10, 1, 0
Data.f  10,-10, 10, 1, 1
Data.f -10, 10,-10, 1, 0
Data.f -10,-10,-10, 1, 1
Data.f -10, 10, 10, 0, 0
Data.f -10,-10, 10, 0, 1
Indice:
;liste des faces
Data.l  0,  1,  2
Data.l  1,  3,  2
Data.l  4,  5,  6
Data.l  5,  7,  6
Data.l  8,  9, 10
Data.l  9, 11, 10
Data.l 12, 13, 14
Data.l 13, 15, 14
Data.l 16, 17, 18
Data.l 17, 19, 18
Data.l 20, 21, 22
Data.l 21, 23, 22
EndDataSection

Posted: Sun Oct 15, 2006 3:12 pm
by tmyke
... and Just load a B3D entity...

Code: Select all

IncludePath "Include\"
  IncludeFile "d3dx9.pbi"
  IncludeFile "dreamotion3d.pbi"

  Global	*camera.CEntity
  Global	*mesh.CEntity

  ;  first init
  If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0 
    End
  EndIf
  ;-------------------
  ; 3D engine init
  ;-------------------
  DM_Graphics3D(800, 600, 32,  0, 1)
  SetCurrentDirectory("media/")

  ;------------------------
  ; load a B3D file
  *mesh = DM_LoadEntity("harvester.b3d", #Null, #False)
  ; ------- little camera
  *camera = DM_CreateCamera(#Null)
  DM_TranslateEntity(*camera,  0,5,-30)
  DM_CameraClsColor(*camera, 25, 25, 25)
  ;-----------------------------
  ; ------- main loop --------
 ;------------------------------
  Repeat
  	ExamineKeyboard()
  	If KeyboardReleased(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
  	  Quit=1
  	EndIf
  	; ---------------
  	;      Render
  	; ---------------
  	DM_BeginScene()
    	DM_RenderWorld()
  	DM_EndScene()
  	; little rotation entity for demo
  	DM_TurnEntity(*mesh, 0,1,0)
  Until Quit=1
  DM_ClearGraphics()
  End
:wink:

Posted: Sun Oct 15, 2006 4:45 pm
by dobro
@Comtois

" ligne 62 DM_CreateMesh : incorrect number of parameters" :?

Posted: Sun Oct 15, 2006 4:55 pm
by tmyke
dobro wrote:@Comtois

" ligne 62 DM_CreateMesh : incorrect number of parameters" :?
Download the last beta , at home, with it, it's good ... :wink:

Posted: Mon Oct 16, 2006 5:34 am
by Dare
:shock:

Awesome

Posted: Mon Oct 16, 2006 5:36 am
by DarkDragon
Where did you get the PhysX chipset?

Posted: Tue Oct 17, 2006 11:19 am
by Psychophanta
These are is a great news!
Thanks you!

Posted: Tue Oct 17, 2006 11:58 am
by techjunkie
Great! Now I can begin my work on the MMORPG called "World of PureCraft"... :wink:

Posted: Tue Oct 17, 2006 6:07 pm
by Shannara
I noticed the title said PhysX, do we require the PhysX card installed on our computers to run these demos? Or will the demos automatically detect whether that card is installed or not?

Posted: Wed Oct 18, 2006 4:22 pm
by Maxus
tmyke wrote:... and Just load a B3D entity...

Code: Select all

IncludePath "Include"
  IncludeFile "d3dx9.pbi"
  IncludeFile "dreamotion3d.pbi"

  Global	*camera.CEntity
  Global	*mesh.CEntity

  ;  first init
  If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0 
    End
  EndIf
  ;-------------------
  ; 3D engine init
  ;-------------------
  DM_Graphics3D(800, 600, 32,  0, 1)
  SetCurrentDirectory("media/")

  ;------------------------
  ; load a B3D file
  *mesh = DM_LoadEntity("harvester.b3d", #Null, #False)
  ; ------- little camera
  *camera = DM_CreateCamera(#Null)
  DM_TranslateEntity(*camera,  0,5,-30)
  DM_CameraClsColor(*camera, 25, 25, 25)
  ;-----------------------------
  ; ------- main loop --------
 ;------------------------------
  Repeat
  	ExamineKeyboard()
  	If KeyboardReleased(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
  	  Quit=1
  	EndIf
  	; ---------------
  	;      Render
  	; ---------------
  	DM_BeginScene()
    	DM_RenderWorld()
  	DM_EndScene()
  	; little rotation entity for demo
  	DM_TurnEntity(*mesh, 0,1,0)
  Until Quit=1
  DM_ClearGraphics()
  End
:wink:
And how animate B3D Entity???

And well to put parameters by default in import
For example:

Code: Select all

DM_LoadEntity.l (filename.s, *parent. CEntity = #Null, lod.c = #False)

Posted: Wed Oct 18, 2006 8:28 pm
by Comtois
@Psychophanta, do you remember this one ? :)

Code: Select all

; Fichiers Include
IncludePath "Include\"
IncludeFile "d3dx9.pbi"
IncludeFile "dreamotion3d.pbi"     


Global *camera.CEntity
Global *brush.CBrush
Global *texture.CTexture
Global *entity.CEntity
Global *font.CFont
Global *light.CEntity


; Initialisation des différents modules
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  End
EndIf
; ouvre un ecran 3D
DM_Graphics3D(800, 600, 32,  1, 1)

;-camera
*camera = DM_CreateCamera(#Null)
DM_MoveEntity(*camera, 0,0,-50)
DM_CameraClsColor(*camera, 0, 0, 0)

;-Light
DM_AmbiantLight(65,  65,  65)
*light = DM_CreateLight(1, #Null)
DM_TurnEntity(*light, 90,0,0)

;-font
*font = DM_LoadFont( "Arial", 36, 2)

;-Constantes
#NbX=30 ; nombre de facettes
#NbZ=30 ; nombre de facettes
#DegConv=3.14159265/180

;-Variables Globales
Global AngleVague.f,WaveFrequency.f,WavePeriodX.f,WavePeriodZ.f,WaveAmplitude.f
Global xrot.f,yrot.f,zrot.f
Global CamLocateX.l,CamLocateY.l,CamLocateZ.l,CamLookAtX.l,CamLookAtY.l,CamLookAtZ.l
Global Mode.b
circle.l=360
AngleVague=Random(circle)
WaveFrequency=3;=waves/second
WavePeriodX=5;=1/Wave lenght
WavePeriodZ=9;=1/Wave lenght
WaveAmplitude=4
xrot=-0.3:yrot=-0.4:zrot=0.2
CamLocateX.l=0:CamLocateY.l=0:CamLocateZ.l=50
CamLookAtX.l=0:CamLookAtY.l=0:CamLookAtZ.l=0

;-Procédures
Procedure Matrice()
  ;creation d'un mesh vide
  *entity = DM_CreateMesh((#NbX)*(#NbZ)*4, (#NbX+1)*(#NbZ+1), 1, #Null)
  i = 0

  For b=0 To #Nbz
    For a=0 To #NbX
      ;les coordonnées de vertex
      DM_VertexCoords(*entity, i, a - #NbX/2, 0, b - #Nbz/2)
      ;les coordonnées de texture (canal 0)
      DM_VertexTexCoords(*entity, i, 0, a/#NbX, b/#Nbz)
      i + 1
    Next a
  Next b

  i = 0
  Nb=#NbX+1
  For b=0 To #NbZ-1
    For a=0 To #NbX-1
      P1=a+(b*Nb)
      P2=P1+1
      P3=a+(b+1)*Nb
      P4=P3+1
      ;Face 1
      DM_VertexTriangle(*entity, i, P3, P2, P1, 0)
      i + 1
      DM_VertexTriangle(*entity, i, P2, P3, P4, 0)
      i + 1      
    Next
  Next
  
    ;on crée une petite Brush, dont on récupère le pointeur
  *brush = DM_CreateBrush("cylindre")
  ;modifie certains paramètres de la brush
  DM_BrushAmbient(*brush, 255,255,255,255)
  DM_BrushDiffuse(*brush, 255,255,255,255) 
 
  ;--------------------------------------------------------
  ; TEXTURE 
  ;--------------------------------------------------------
  ;creation d'une texture vide de 256x256
  *texture = DM_CreateTexture(256,256)
  ;ré-oriente le buffer de sortie graphique vers notre texture
  DM_SetBuffer(*texture)
  ;debut d'un rendu
  DM_BeginScene()
        DM_ClsScreen (210, 0, 255, 0)         ; efface le buffer avec une couleur
    DM_DrawRect  ( 1, 1, 254, 254)      ; dessin d'un rectangle 2D
    DM_DrawRect  ( 10, 10, 200, 200)      ; dessin d'un rectangle 2D
    DM_SetColor2D(222, 0, 0, 255)         ; change couleur du trait
    DM_DrawOval  (100, 100, 50, 50)       ; dessin oval 2D
    DM_DrawText(*font, 10, 15, "TEXTURE") ; un petit texte
  ;fin rendu
  DM_EndScene()
  ;de nouveau le buffer vers l'ecran
  DM_SetBuffer(#Null)
 
 
  DM_BrushTexture(*brush, *texture, 0)
  ; modifie l'état de rendu de la Brush pour voir de tous les cotés
  DM_BrushAddRender(*brush, #D3DRS_CULLMODE, #D3DCULL_NONE)
  ; affecte la brush créee a notre entity
  DM_PaintEntity(*entity, *brush, 0)
  ;génératon auto des normales de l'entity créée
  DM_UpdateNormal(*entity)
  
EndProcedure

Procedure vagues()
 ; Modification sur l'axe des Y
  i = 0
  For z=0 To #NbZ
    For x=0 To #NbX
       y.f=Sin(#DegConv*(AngleVague+x*WavePeriodX+z*WavePeriodZ))*WaveAmplitude
      DM_VertexCoords(*entity, i, DM_VertexX(*entity, i), y, DM_Vertexz(*entity, i))
      i + 1
    Next
  Next
  ;génératon auto des normales de l'entity créée
  ;DM_UpdateNormal(*entity) ; work very fine but it's slow ? 
EndProcedure


;-Mesh
Matrice()


;-Boucle principale
Repeat
  ExamineKeyboard()
 
  ;Calculate (AngleVague+WaveFrequency)%360: (coz % operand doesn't accept floats)
  !fild dword[v_circle]
  !fld dword[v_AngleVague]
  !fadd dword[v_WaveFrequency]
  !fprem
  !fstp dword[v_AngleVague]
  !fstp st1
 
  vagues()
  DM_TurnEntity(*entity, xrot, yrot, zrot)
  ;debut rendu
  DM_BeginScene()
  ;rendu scene
  DM_Renderworld()
  ;fin rendu
  DM_EndScene()

Until KeyboardPushed(#PB_Key_Escape)
DM_ClearGraphics()
End