Page 47 of 71

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 1:39 pm
by mpz
Hi Dobro,

if you use PB5.20 or PB5.21 use these lib please:

x86 for pb 520 and newer
http://www.flasharts.de/mpz/mp33/pb520/MP3D_Library.zip

on my pc works these codes fine:

Code: Select all

MP_Graphics3D (800,600,32,0)

camera=MP_CreateCamera() ; Kamera erstellen
light=MP_CreateLight(1) ; Es werde Licht
Mesh=MP_CreateCube() ; Und jetzt eine Würfel
MP_PositionEntity (Mesh,0,0,3) ; Position des Würfels

While Zaehler < 320 ; ==> Need more time, 60 is too low
  Zaehler + 1
   MP_TurnEntity (Mesh,0.3,0.2,0.1) 
   MP_RenderWorld () ; Hier gehts los
   MP_Flip () ;
Wend
MP_Close()
CloseWindow(0) ; dont forget these

;beep(440,1000) ; let a little Square  ??
;********************************************************************************************
Delay( 4000) ; wait 2 secondes == need more time 2s too low

MP_Graphics3D (800,600,32,0) ; no Screen Appear !! ???? ==> screen is here
MP_RenderWorld ()  ;  <<<<<<<<<<<<< Bug here ==> no crash, works
MP_Flip () ;

camera=MP_CreateCamera() ; Kamera erstellen
light=MP_CreateLight(1) ; Es werde Licht
Mesh=MP_CreateCube() ; Und jetzt eine Würfel
MP_PositionEntity (Mesh,0,0,3) ; Position des Würfels

While Zaehler < 600 ; ==> Need more time, 60 is too low
   Zaehler + 1
   MP_TurnEntity (Mesh,0.3,0.2,0.1) 
   MP_RenderWorld () ; Hier gehts los
   MP_Flip () ;
Wend
MP_Close()
CloseWindow(0)
;beep(440,1000)

Code: Select all

MP_Graphics3D (800,600,32,1)
While Zaehler < 230
   Zaehler + 1
   MP_RenderWorld () ; Hier gehts los
   MP_Flip () ;
Wend
MP_Close()
CloseWindow(0)
;beep(440,1000) ; let a little Square  ??
;********************************************************************************************
Delay( 2000) ; wait 2 secondes
MP_Graphics3D (800,600,32,1) ; no Screen Appear !! ???? ==> screen is here
MP_RenderWorld ()  ;  <<<<<<<<<<<<< Bug here ==> no bug here
MP_Flip () ;


While Zaehler < 400
   Zaehler + 1
   MP_RenderWorld () ; Hier gehts los
   MP_Flip () ;
Wend
MP_Close()
CloseWindow(0)
;beep(440,1000)
;

; EPB

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 2:20 pm
by dobro
yes! now it works! :D

[Mode KCC on ]
Image
[Mode KCC off ]

you do not you'll be misled archive yesterday? :mrgreen:

good, the main thing is that now it works ...
Congratulations and thank you to you :)

count on me to find you other problems :mrgreen:

friendly Michel :)

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 3:33 pm
by dobro
in the Help
the sample of "MP_TurnEntity" bug ...
"MP_WindowEvent() " not recognized

and "MP_DrawText (1,1,$FFFF0000,"Köper dreht mit folgenden Werten x = "+StrF(x)+" / y = "+StrF(y)+" / z = "+StrF(z),0)"
do not have good arguments

Example corrected : :)

Code: Select all

MP_Graphics3D (640,480,0,2) ; Erstelle ein WindowsFenster #Window = 0

MP_CreateCamera() ; Kamera erstellen
MP_CreateLight(1) ; Es werde Licht

Mesh=MP_CreateCube() ; Und jetzt eine Würfel
MP_PositionEntity (Mesh,0,0,3) ; Position des Würfels

If CreateImage(0, 255, 255) ; Male schöne Textur
	
	Font = LoadFont(#PB_Any, "Arial"   , 138) 
	StartDrawing(ImageOutput(0))
		
		Box(0, 0, 128, 128,RGB(255,0,0))
		Box(128, 0, 128, 128,RGB(0,255,0))
		Box(0, 128, 128, 128,RGB(0,0,255))
		Box(128, 128, 128, 128,RGB(255,255,0))
		
		DrawingFont(FontID(Font))
		DrawingMode(#PB_2DDrawing_Transparent)
		DrawText(73,35,"5")
		
	StopDrawing() ; This is absolutely needed when the drawing operations are finished !!! Never forget it !
	
EndIf

Texture = MP_ImageToTexture(0) ; Create Texture from image 
MP_EntitySetTexture (Mesh, Texture ) ; textur to mesh

x.f = 0.1
y.f = 0.2
z.f = 0.3

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow  ; Esc abfrage oder Windows Schliessen
	
	If MP_KeyDown(#PB_Key_1) : x -0.01 : EndIf
	If MP_KeyDown(#PB_Key_2) : x +0.01 : EndIf
	If MP_KeyDown(#PB_Key_3) : y -0.01 : EndIf
	If MP_KeyDown(#PB_Key_4) : y +0.01 : EndIf
	If MP_KeyDown(#PB_Key_5) : z -0.01 : EndIf
	If MP_KeyDown(#PB_Key_6) : z +0.01 : EndIf
	
	MP_DrawText (1,1,"Köper dreht mit folgenden Werten x = "+StrF(x)+" / y = "+StrF(y)+" / z = "+StrF(z),0,$FFFF0000)
	
	MP_TurnEntity (Mesh,x,y,z) 
	MP_RenderWorld() ; Erstelle die Welt
	MP_Flip () ; Stelle Sie dar
	
Wend 
; EPB

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 4:13 pm
by mpz
Hi dobro,

i am working on a new help file and check the help file demo, thanks.

P.S: The command "MP_WindowEvent() " was deleted, because you can use the normal "WindowEvent()" better


Greetings Michael

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 6:35 pm
by dobro
tell me
Image


the Function "MP_TurnCamera(*camera, -15, 0, 0,)"
is supposed run to : MP_TurnCamera(*camera, Pitch, Yaw, Roll)

it seems, rather function as :

MP_TurnCamera(*camera, Yaw, Roll, Pitch)

this is normal?

Code: Select all

MP_Graphics3D (640,480,0,2)
*camera=MP_CreateCamera()
MP_TurnCamera(  *camera, 0, 30, 0) ; This is a Roll no Yaw !!!!! 
MP_CreateLight(1) 
Mesh=MP_CreateCube() 
MP_PositionEntity (Mesh,0,0,3) 
If CreateImage(0, 255, 255) 
	Font = LoadFont(#PB_Any, "Arial"   , 138) 
	StartDrawing(ImageOutput(0))
		Box(0, 0, 128, 128,RGB(255,0,0))
		Box(128, 0, 128, 128,RGB(0,255,0))
		Box(0, 128, 128, 128,RGB(0,0,255))
		Box(128, 128, 128, 128,RGB(255,255,0))
		DrawingFont(FontID(Font))
		DrawingMode(#PB_2DDrawing_Transparent)
		DrawText(73,35,"5")
	StopDrawing() 
EndIf
Texture = MP_ImageToTexture(0) 
MP_EntitySetTexture (Mesh, Texture ) 
x.f = 0
y.f = 0.0
z.f = 0.0
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow  ; Esc abfrage oder Windows Schliessen
	MP_RenderWorld() 
	MP_Flip () 
Wend 

; EPB


Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 7:01 pm
by N_Gnom
In a version of mp3d mpz have fixed that problem....
it should be pitch , yaw, roll....

x = rotate on x axis
y = rotate on y axis
z = rotate(roll) on z axis

i say sometimes that i think camera and entity commands should be the same...moveentity(camera, x, y, z) is better than an seperate camera command....my two cents


this image looks better...smile Image

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 8:32 pm
by dobro
I have the Latest Version!

I read the documentation ... :

MP_TurnCamera (*camera, Pitch, Yaw, Roll)

but in reality it is:

MP_TurnCamera (*camera, Yaw, Roll, Pitch)

test my Sample ;)

ps: your aircraft is exactly the same image as mine! ....

there is no question here of the sense of rotation
but the order of the parameters of this fonction !

sorry my english is zero
I am French, and I do not speak English ..

Re: MP3D Engine Alpha 32

Posted: Mon Feb 24, 2014 10:01 pm
by mpz
Hi dobro,

i know i must rewrite the camera function and so it was a good idea to check them...

I have written in Blitzbasic3d a program to rotate a entity and a camera and i have written the same program in mp3d and what can i say, you find a bug. So i have made a new lib and i think the funktion
MP_RotateCamera (camera, pitch,yaw,roll)
MP_TurnCamera (camera, pitch,yaw,roll)
works now correct.

x86 for PB 511 and older
http://www.flasharts.de/mpz/mp33/pb511/MP3D_Library.zip

x86 for pb 520 and newer
http://www.flasharts.de/mpz/mp33/pb520/MP3D_Library.zip

I think about a next step to kill the commands and use only the entity commands like

MP_MoveCamera(Cam, x.f, y.f, z.f) -> MP_MoveEntity (Entity, x.f, y.f, z.f )
MP_PositionCamera (Cam, x.f, y.f, z.f) ->MP_PositionEntity (Entity, x.f, y.f, z.f )
MP_CameraGetX (Cam) ->MP_EntityGetX (Entity)
MP_CameraGetY (Cam) ->MP_EntityGetY (Entity)
MP_CameraGetZ (Cam) -> MP_EntitySetZ (Entity)
MP_RotateCamera (Cam, pitch.f, yaw.f, roll.f) ->MP_RotateEntity (Entity, pitch.f, yaw.f, roll.f)
MP_TurnCamera (Cam, pitch.f, yaw.f, roll.f) ->MP_TurnEntity (Entity, pitch.f, yaw.f, roll.f)
MP_CameraLookAt(Cam,x.f,y.f,z.f) -> MP_EntityLookAt (Entity,x.f,y.f,z.f)

Is these better and usefull?

Greetings Michael

Blitzbasic testcode

Code: Select all

Graphics3D 640,480 
SetBuffer BackBuffer() 

camera=CreateCamera() 
light=CreateLight() 

cone=CreateCube( ) 
PositionEntity cone,0,0,5 

While Not KeyDown( 1 ) 

; Change rotation values depending on the key pressed 
If KeyDown( 208 )=True Then pitch#=pitch#-1 
If KeyDown( 200 )=True Then pitch#=pitch#+1 
If KeyDown( 203 )=True Then yaw#=yaw#-1 
If KeyDown( 205 )=True Then yaw#=yaw#+1 
If KeyDown( 45 )=True Then roll#=roll#-1 
If KeyDown( 44 )=True Then roll#=roll#+1 

; Rotate cone using rotation values 
RotateEntity camera,pitch#,yaw#,roll# 
;RotateEntity cone,pitch#,yaw#,roll# 

RenderWorld 

Text 0,0,"Use cursor/Z/X keys to change cone rotation" 
Text 0,20,"Pitch: "+pitch# 
Text 0,40,"Yaw : "+yaw# 
Text 0,60,"Roll : "+roll# 

Flip 

Wend 
MP3D Testcode

Code: Select all

MP_Graphics3D (640,480,0,2)

camera=MP_CreateCamera()
Mesh=MP_CreateCube()
light=MP_CreateLight(1)

MP_PositionEntity (Mesh,0,0,3)

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow  ; Esc abfrage oder Windows Schliessen
  
  If MP_KeyDown(#PB_Key_Down) : pitch.f-1 : EndIf
  If MP_KeyDown(#PB_Key_Up) : pitch.f+1 : EndIf
  If MP_KeyDown(#PB_Key_Right) : yaw.f-1 : EndIf
  If MP_KeyDown(#PB_Key_Left) : yaw.f+1 : EndIf
  If MP_KeyDown(#PB_Key_X) : roll.f-1 : EndIf
  If MP_KeyDown(#PB_Key_Z) : roll.f+1 : EndIf
  
  MP_RotateCamera (camera, pitch,yaw,roll) 
  
;  MP_RotateEntity (Mesh, pitch,yaw,roll) 
  
  MP_DrawText(0,0,"Use cursor/Z/X keys to change cone rotation")
  MP_DrawText(0,20,"Pitch: "+StrF(pitch,3))
  MP_DrawText(0,40,"Yaw  : "+StrF(Yaw,3))
  MP_DrawText(0,60,"Roll : "+StrF(Roll,3))
  
  MP_RenderWorld()
  MP_Flip ()
Wend

; EPB

Re: MP3D Engine Alpha 32

Posted: Tue Feb 25, 2014 12:15 am
by dobro
mpz wrote:
I think about a next step to kill the commands and use only the entity commands like

MP_MoveCamera(Cam, x.f, y.f, z.f) -> MP_MoveEntity (Entity, x.f, y.f, z.f )
MP_PositionCamera (Cam, x.f, y.f, z.f) ->MP_PositionEntity (Entity, x.f, y.f, z.f )
MP_CameraGetX (Cam) ->MP_EntityGetX (Entity)
MP_CameraGetY (Cam) ->MP_EntityGetY (Entity)
MP_CameraGetZ (Cam) -> MP_EntitySetZ (Entity)
MP_RotateCamera (Cam, pitch.f, yaw.f, roll.f) ->MP_RotateEntity (Entity, pitch.f, yaw.f, roll.f)
MP_TurnCamera (Cam, pitch.f, yaw.f, roll.f) ->MP_TurnEntity (Entity, pitch.f, yaw.f, roll.f)
MP_CameraLookAt(Cam,x.f,y.f,z.f) -> MP_EntityLookAt (Entity,x.f,y.f,z.f)

Is these better and usefull?

Greetings Michael

yes I like the idea
the camera is an Entity :)

it brings together the functions in the same folder (for the 'Help')

Thank you for your updates, manner Flash Gordon :)


I used your 3d engine for modification of my interpreter pseudo-logo (the language) in 3D mode, it works already very well in 2D mode :)

Re: MP3D Engine Alpha 32

Posted: Tue Feb 25, 2014 1:06 am
by dobro
Request ! :)

I think it lacks a mode of Rotation! :)

one that will an object or the camera behaves like a plane! :lol:

that is to say that if given an upward inclination
then advances ... it continue the climb in altitude ....
(it's hard to explain in a language other than my own)

something like this picture:
Image

currently, the camera (or entity) can change Orientation , but if moves .. it does not follow the inclination
it moves horizontally, vertically, etc ...

that we permetre able to simulate the behavior of an aircraft, or a roller coaster ... ect .. therefore an object tilt follows a trajectory
or rather a path created by a oriantation ...

hoping that you understand my Chinese: lol:


in this code .....
we can not direct the camera in the direction of orientation .... :)
(and this is true for all entity)

Code: Select all

MP_Graphics3D (640,480,0,2)
*camera=MP_CreateCamera()

MP_CreateLight(1) 
Mesh=MP_CreateCube() 
MP_PositionEntity (Mesh,0,0,3) 
If CreateImage(0, 255, 255) 
	Font = LoadFont(#PB_Any, "Arial"   , 138) 
	StartDrawing(ImageOutput(0))
		Box(0, 0, 128, 128,RGB(255,0,0))
		Box(128, 0, 128, 128,RGB(0,255,0))
		Box(0, 128, 128, 128,RGB(0,0,255))
		Box(128, 128, 128, 128,RGB(255,255,0))
		DrawingFont(FontID(Font))
		DrawingMode(#PB_2DDrawing_Transparent)
		DrawText(73,35,"5")
	StopDrawing() 
EndIf
Texture = MP_ImageToTexture(0) 
MP_EntitySetTexture (Mesh, Texture ) 
x.f = 0
y.f = 0.0
z.f = 0.0
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow  ; Esc abfrage oder Windows Schliessen
	if MP_KeyDown(#pb_key_up ) 
		poz=-0.05
		MP_MoveCamera(*camera, 0,0,0.5)   
		elseif MP_KeyDown(#pb_key_down )     
		poz=0.05
		MP_MoveCamera(*camera, 0,0,-0.5)  
		elseif MP_KeyDown( #pb_key_left ) 
		MP_MoveCamera(*camera,-0.5,0,0) 		
		elseif MP_KeyDown( #pb_key_right )   
		MP_MoveCamera(*camera,  0.5,0,0) 
		elseif  MP_KeyDown(#pb_key_pad0)
		MP_MoveCamera(*camera,  0,0.5,0 )  
		elseif MP_KeyDown(#pb_key_rightcontrol )  
		MP_MoveCamera(*camera,0,0.-0.5,0 ) 
		elseif MP_KeyDown( #pb_key_pageup) 
		MP_MoveCamera(*camera, 0,0.5,0)  
		elseif MP_KeyDown( #pb_key_pagedown )  
		MP_MoveCamera(*camera,0,-0.5,0) 
		
	endif
	
	
	if MP_MouseButtonDown(0) ;mousebutton ( #pb_mousebutton_left )
		quit=1
		MP_UseCursor(1) ; showcursor_(1) ; montre le curseur
	endif
	
	MP_TurnCamera(*camera, -MP_MouseDeltaY()/8, MP_MouseDeltaX()/8,0 )          ;dm_turnentity(*camera, mousedeltay ()/8, mousedeltax ()/8,0)
	
	
	MP_RenderWorld() 
	MP_Flip () 
Wend 



; 

; EPB

I had asked this, the creator of Dreamotion3D did it .. :)

if you can do it, it'll be great :D
it is indispensable to me for my 3D Logo :mrgreen:

with the aid of this kind of rotation, I could do this :
Image

in PureGolo3D , the code for this , is :

Code: Select all



  pinceau ligne
  couleur 255,100,50

   repete 36              ; repeat 36 
      repete 36           ; repeat 36 
        AV 5                ; Forward 5
        EL 10               ; Elevation 10 degres
      fin_repete           ; End_repeat
     RD 10                  ; Roll Right
   fin_repete             ; end Repeat 

;)

this make a Tore-Donuts :)

The PureGolo 3d that time was not yet recursive

now my Puregolo 2D is recursive :)
So I can not wait, put in your 3D engine :)

Puregolo3D in Action here:
http://www.youtube.com/watch?v=7Rz6Wtpg ... e=youtu.be


Another Request :)
it lacks a function : MP_entityvisible(*tortue3d, flag.c=0)

to Make entity, visible or invisible :)

Re: MP3D Engine Alpha 32

Posted: Fri Feb 28, 2014 6:12 pm
by Num3
Small bug, i downloaded the 32 bit version of the lastest release (32) but i cannot install it, because the installer says "Your operating system is not supported" eheh :lol:

I'm on Windows 8.1 x64, but I work only on x86 purebasic!

Also tried http://www.flasharts.de/mpz/Install_MP3D_32_x86.zip, but no cigar :P

Thanks in advance and keep up the good work!


-- EDIT --
Just unziped the installer a copied the files manually, all works now ;)

Re: MP3D Engine Alpha 32

Posted: Fri Mar 14, 2014 8:11 am
by N_Gnom
@mpz: any news about it?

Re: MP3D Engine Alpha 32

Posted: Mon Mar 17, 2014 1:42 pm
by mpz
Hi to all,

yes it was a little bit quiet around mp3D. I work on some new features and work on old not yet ready thinks like:

@dobro I have made a new lib and have rewritten the camera function.
Please check this. The MP_EntityTurn(Camera...) works fine in my demos now. Hope i find the solution for it...

@N_Gnom
oh what have i done:
* rewritten the camera function
* have included the new function in all mp3d demos and test them
* have actulized the help files (but i am not ready with this, it is a *'**uc** job for me ;)

next steps:
* working on a dungeon with light map. You can open a b3d dungeon with light map and walk in the dungeon
* You car Demo you ask for. I think i have all newton physic for these now :)
* Ending the *"!*"* Help file

x86 for PB 511 and older
http://www.flasharts.de/mpz/mp33/pb511/MP3D_Library.zip

x86 for pb 522 and newer
http://www.flasharts.de/mpz/mp33/pb522/MP3D_Library.zip

Greetings Michael

Dobows file for testing:

Code: Select all

MP_Graphics3D (640,480,0,2)
*camera=MP_CreateCamera()

MP_CreateLight(1)
Mesh=MP_CreateCube()
MP_PositionEntity (Mesh,0,0,3)
If CreateImage(0, 255, 255)
   Font = LoadFont(#PB_Any, "Arial"   , 138)
   StartDrawing(ImageOutput(0))
      Box(0, 0, 128, 128,RGB(255,0,0))
      Box(128, 0, 128, 128,RGB(0,255,0))
      Box(0, 128, 128, 128,RGB(0,0,255))
      Box(128, 128, 128, 128,RGB(255,255,0))
      DrawingFont(FontID(Font))
      DrawingMode(#PB_2DDrawing_Transparent)
      DrawText(73,35,"5")
   StopDrawing()
EndIf
Texture = MP_ImageToTexture(0)
MP_EntitySetTexture (Mesh, Texture )
x.f = 0
y.f = 0.0
z.f = 0.0
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow  ; Esc abfrage oder Windows Schliessen
   If MP_KeyDown(#PB_Key_Up )
      poz=-0.05
      MP_MoveEntity(*camera, 0,0,0.5)   
      ElseIf MP_KeyDown(#PB_Key_Down )     
      poz=0.05
      MP_MoveEntity(*camera, 0,0,-0.5) 
      ElseIf MP_KeyDown( #PB_Key_Left )
      MP_MoveEntity(*camera,-0.5,0,0)       
      ElseIf MP_KeyDown( #PB_Key_Right )   
      MP_MoveEntity(*camera,  0.5,0,0)
      ElseIf  MP_KeyDown(#PB_Key_Pad0)
      MP_MoveEntity(*camera,  0,0.5,0 ) 
      ElseIf MP_KeyDown(#PB_Key_RightControl ) 
      MP_MoveEntity(*camera,0,0.-0.5,0 )
      ElseIf MP_KeyDown( #PB_Key_PageUp)
      MP_MoveEntity(*camera, 0,0.5,0) 
      ElseIf MP_KeyDown( #PB_Key_PageDown ) 
      MP_MoveEntity(*camera,0,-0.5,0)
      
   EndIf
   
   If MP_MouseButtonDown(0) ;mousebutton ( #pb_mousebutton_left )
      quit=1
      MP_UseCursor(1) ; showcursor_(1) ; montre le curseur
   EndIf
   
   MP_TurnEntity(*camera, MP_MouseDeltaY()/8, MP_MouseDeltaX()/8,0 )          ;dm_turnentity(*camera, mousedeltay ()/8, mousedeltax ()/8,0)   
   
   MP_RenderWorld()
   MP_Flip ()
Wend



;

; EPB

Re: MP3D Engine Alpha 32

Posted: Tue Mar 18, 2014 9:10 pm
by Psychophanta
Thanks MPZ, keep going!

By the way, it does not work in PB5.22 as i can see here.

Re: MP3D Engine Alpha 32

Posted: Tue Mar 18, 2014 11:32 pm
by mpz
Hi Psychophanta,

i have recomplied it with 5.22 but have not full tested it (but all tested demos works fine for now).

x86 for pb 522 and newer
http://www.flasharts.de/mpz/mp33/pb522/MP3D_Library.zip

Greetings Michael