Dreamotion3d (and PhysX) continuation...

Advanced game related topics
tmyke
Enthusiast
Enthusiast
Posts: 132
Joined: Fri Sep 29, 2006 1:10 pm
Location: France

Dreamotion3d (and PhysX) continuation...

Post 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
Last edited by tmyke on Fri Feb 02, 2007 3:30 pm, edited 5 times in total.
Strength and wisdom.
Image
tmyke
Enthusiast
Enthusiast
Posts: 132
Joined: Fri Sep 29, 2006 1:10 pm
Location: France

Post 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:
Strength and wisdom.
Image
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

i admit these screenshots look good...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post 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
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post 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
Please correct my english
http://purebasic.developpez.com/
tmyke
Enthusiast
Enthusiast
Posts: 132
Joined: Fri Sep 29, 2006 1:10 pm
Location: France

Post 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:
Strength and wisdom.
Image
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Post by dobro »

@Comtois

" ligne 62 DM_CreateMesh : incorrect number of parameters" :?
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
tmyke
Enthusiast
Enthusiast
Posts: 132
Joined: Fri Sep 29, 2006 1:10 pm
Location: France

Post 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:
Strength and wisdom.
Image
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

:shock:

Awesome
Dare2 cut down to size
DarkDragon
Addict
Addict
Posts: 2218
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Where did you get the PhysX chipset?
bye,
Daniel
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Post by Psychophanta »

These are is a great news!
Thanks you!
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

Great! Now I can begin my work on the MMORPG called "World of PureCraft"... :wink:
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post 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?
User avatar
Maxus
User
User
Posts: 70
Joined: Thu Feb 16, 2006 9:35 am
Location: Russia
Contact:

Post 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)
Sorry my English, I'm Russian
AMT Laboratory
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post 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
Please correct my english
http://purebasic.developpez.com/
Post Reply