MP3D Engine Alpha 33

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MP3D Engine Alpha 32

Post by Psychophanta »

mpz wrote: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
Thanks,
It was my fault coz I did not replaced ''dsound.lib'
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: MP3D Engine Alpha 32

Post by Mythros »

Hi all! :) I'm working on my game using the new MP3D lib (much thanks to mpz & keep up the good work!), and I am simply wanting to know how I can make it so that the camera in this code's X-Rotation value does NOT go past 15 or -15. I want to be able to put a cap on looking up and looking down so I don't have to keep dealing with the camera being allowed to rotate in a full circle when trying to look up or down.

Here's my code:

Code: Select all

MP_Graphics3D(1366, 768, 0, 2)

*camera=MP_CreateCamera()

light = MP_CreateLight(1)

MP_RotateEntity(light, 45, 30, 0)

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

Global quit

Global posx.f
Global posy.f
Global posz.f

Repeat

    SetCursor_(0)
 
    SetCursorPos_(WindowWidth(0)/2, WindowHeight(0)/2)
  
    If MP_KeyDown(#PB_Key_Up )
      
      posz=0.05
      MP_MoveEntity(*camera, 0,0,posz)
      
    EndIf
      
    If MP_KeyDown(#PB_Key_Down )     
      
      posz=-0.05
      MP_MoveEntity(*camera, 0,0,posz)
        
    EndIf
    
    If MP_KeyDown( #PB_Key_Left )
      
      posx = -0.05
      MP_MoveEntity(*camera, posx,0,0)
      
    EndIf
    
    If MP_KeyDown( #PB_Key_Right )   
      
      posx = 0.05
      MP_MoveEntity(*camera, posx,0,0)
      
    EndIf
    
    If MP_MouseButtonDown(0) ;mousebutton ( #pb_mousebutton_left )
       
      quit=1
      
    EndIf
     
    delta_x.f = MP_MouseDeltaX()/8.0
    delta_y.f = MP_MouseDeltaY()/8.0
     
    If delta_x.f > 15: delta_x.f = 15: EndIf
     
    xrot.f = MP_EntityGetPitch(*camera)
    yrot.f = MP_EntityGetYaw(*camera)
    zrot.f = MP_EntityGetRoll(*camera)
     
    If xrot.f > 15: xrot.f = 15: EndIf
    If xrot.f < -15: xrot.f = -15: EndIf
     
    MP_TurnEntity(*camera, delta_y.f, delta_x.f, 0)
     
    MP_RenderWorld()
     
    MP_DrawText(0, 10, "delta_x.f: "+delta_x.f)
    MP_DrawText(0, 30, "delta_y.f: "+delta_y.f)
     
    MP_DrawText(0, 50, "xrot.f: "+xrot.f)
    MP_DrawText(0, 70, "yrot.f: "+yrot.f)
    MP_DrawText(0, 90, "zrot.f: "+zrot.f)
     
    MP_Flip ()
     
  Until MP_KeyHit(1) Or quit
 
End
Thanks for your help all! =)
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 32

Post by mpz »

Hi Mythos,

sorry for the delay, i was working on some new features and had not much times the last days. I have read your code an think i find a solution. The comand MP_TurnEntity rotates an object in relative degree, but you need MP_RotateEntity for abolute degrees. Here the code with the solution:

Greetings Michael

Code: Select all

MP_Graphics3D(1366, 768, 0, 2)

*camera=MP_CreateCamera()

light = MP_CreateLight(1)

MP_RotateEntity(light, 45, 30, 0)

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

Global quit

Global posx.f
Global posy.f
Global posz.f

Repeat

    SetCursor_(0)
 
    SetCursorPos_(WindowWidth(0)/2, WindowHeight(0)/2)
 
    If MP_KeyDown(#PB_Key_Up )
     
      posz=0.05
      MP_MoveEntity(*camera, 0,0,posz)
     
    EndIf
     
    If MP_KeyDown(#PB_Key_Down )     
     
      posz=-0.05
      MP_MoveEntity(*camera, 0,0,posz)
       
    EndIf
   
    If MP_KeyDown( #PB_Key_Left )
     
      posx = -0.05
      MP_MoveEntity(*camera, posx,0,0)
     
    EndIf
   
    If MP_KeyDown( #PB_Key_Right )   
     
      posx = 0.05
      MP_MoveEntity(*camera, posx,0,0)
     
    EndIf
   
    If MP_MouseButtonDown(0) ;mousebutton ( #pb_mousebutton_left )
       
      quit=1
     
    EndIf
     
    delta_x.f = MP_MouseDeltaX()/8.0
    delta_y.f = MP_MouseDeltaY()/8.0
     
    xrot.f + delta_x.f
    yrot.f + delta_y.f
     
    If xrot.f > 15: xrot.f = 15: EndIf
    If xrot.f < -15: xrot.f = -15: EndIf
    
    MP_RotateEntity(*camera,  yrot.f, xrot.f , 0)
    
    MP_RenderWorld()
     
    MP_DrawText(0, 10, "delta_x.f: "+delta_x.f)
    MP_DrawText(0, 30, "delta_y.f: "+delta_y.f)
     
    MP_DrawText(0, 50, "xrot.f: "+MP_EntityGetYaw(*camera))
    MP_DrawText(0, 70, "yrot.f: "+MP_EntityGetPitch(*camera))
    MP_DrawText(0, 90, "zrot.f: "+MP_EntityGetRoll(*camera))
     
    MP_Flip ()
     
  Until MP_KeyHit(1) Or quit
 
End
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: MP3D Engine Alpha 32

Post by Danilo »

@mpz:
Could you please provide a complete up-to-date package for latest PB with all required files (Ascii, Unicode, Threading, Help files, etc.)?
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 32

Post by mpz »

Hi Danilo,

yes i make a new version. I have some problems to create the x64 lib. If i solve the problem i make the new installer...

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
Dirty.cheese
New User
New User
Posts: 2
Joined: Sat Apr 26, 2014 5:23 pm

Re: MP3D Engine Alpha 32

Post by Dirty.cheese »

don't work MP_MeshSetAlpha with 3 or I don't understand?? :?

example:

Code: Select all

InitNetwork()
file$=GetTemporaryDirectory()+"sun"
If FileSize(file$)=-1
  If ReceiveHTTPFile("http://png.findicons.com/files/icons/481/weather/128/sun.png",file$)=0
    MessageRequester("","Need internet")
  EndIf
EndIf

MP_Graphics3D (640,480,0,3)
SetWindowTitle(0, "") 

Camera=MP_CreateCamera()

MP_AmbientSetLight($FFF5E7)

Mesh=MP_CreatePlane(2,2)
MP_PositionEntity(Mesh,0,0,5)
te=MP_LoadTexture(file$)
MP_EntitySetTexture(Mesh,te)


MP_MeshSetAlpha(Mesh,3) ;- It's problem



While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
    MP_RenderWorld()
    MP_Flip ()
Wend
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MP3D Engine Alpha 32

Post by Psychophanta »

Dirty.cheese wrote:don't work MP_MeshSetAlpha with 3 or I don't understand?? :?

example:

Code: Select all

InitNetwork()
file$=GetTemporaryDirectory()+"sun"
If FileSize(file$)=-1
  If ReceiveHTTPFile("http://png.findicons.com/files/icons/481/weather/128/sun.png",file$)=0
    MessageRequester("","Need internet")
  EndIf
EndIf

MP_Graphics3D (640,480,0,3)
SetWindowTitle(0, "") 

Camera=MP_CreateCamera()

MP_AmbientSetLight($FFF5E7)

Mesh=MP_CreatePlane(2,2)
MP_PositionEntity(Mesh,0,0,5)
te=MP_LoadTexture(file$)
MP_EntitySetTexture(Mesh,te)


MP_MeshSetAlpha(Mesh,3) ;- It's problem



While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
    MP_RenderWorld()
    MP_Flip ()
Wend

Code: Select all

    InitNetwork()
    file$=GetTemporaryDirectory()+"sun"
    If FileSize(file$)=-1
      If ReceiveHTTPFile("http://png.findicons.com/files/icons/481/weather/128/sun.png",file$)=0
        MessageRequester("","Need internet")
      EndIf
    EndIf

    MP_Graphics3D (640,480,0,3)
    SetWindowTitle(0, "")

    Camera=MP_CreateCamera()

    MP_AmbientSetLight($FFF5E7)

    Mesh=MP_CreateCube()
    MP_PositionEntity(Mesh,0,0,5)
    te=MP_LoadTexture(file$)
    MP_EntitySetTexture(Mesh,te)

    MP_MeshSetBlendColor(Mesh,MP_ARGB(200,25,205,50))

    MP_MeshSetAlpha(Mesh,3) ;- It's problem



    While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
        MP_RenderWorld()
        MP_Flip ()
    Wend
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Re: MP3D Engine Alpha 32

Post by dobro »

I reinstalled MP3D on Pb-5-22
when I compile an example, I have a missing library error "Misc" :?

on the other hand, I find that there are too many links to download your engine

you have to make an installer 86/64 choice in a check box .. :)
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 32

Post by mpz »

Hi to all,

i have made a mp3d Installer file, ready today. Please test it carefully, bugs message to me. For all who want to use a exe file:

http://www.flasharts.de/mpz/mp33_beta/M ... taller.exe

and for all fearful user the sourcecode, please activate administratormode.

i like to get ideas to improve the code ;)

P.S. With the CheckBoxGadget("MP3D_lib only") it is possible to install the lib only if a make a new beta lib

Greetings Michel

Added Version 0.3

Code: Select all

;////////////////////////////////////////////////////////////////
;//
;// Project Title: MP 3D Engine Demo Programs
;// Dateiname: MP3d_Installer.pb
;// Erstellt am: 3.Mai.2014
;// Update am  :
;// Author: Michael Paulwitz
;//
;// Info:
;// Simple Installer fro Mp3d
;//
;//
;////////////////////////////////////////////////////////////////

; http://www.flasharts.de/mpz/mp33_beta/MP3D_Installer.exe

Global MP_http.s = "http://www.flasharts.de/mpz/",PurebasicHome.s

InitNetwork()
UseZipPacker()

Global mainwindow
Global frm
Global pbcombo
Global pbcombo2
Global progressbar
Global optional_title_gadget
Global threadsave
Global pbdir_title
Global PurebasicHome.s
Global pbhome
Global install
Global exitinstall
Global pbeditor
Global mp3d_libonly

Procedure OpenWindow_0(x = 0, y = 0, width = 450, height = 550)
 
  mainwindow = OpenWindow(#PB_Any, x, y, width, height, "MP3D Installer - V.0.3", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
 
  pbcombo_title = TextGadget(#PB_Any, 60, 80, 100, 20, "Select PB Version: ")
 
  pbcombo = ComboBoxGadget(#PB_Any, 60, 100, 180, 20)
  AddGadgetItem(pbcombo, 0, "Purebasic 4.60 < 5.11")
  AddGadgetItem(pbcombo, 1, "Purebasic 5.24 < 5.31")
 
  pbcombo2_title = TextGadget(#PB_Any, 290, 80, 150, 20, "Select OS Type: ")
 
  pbcombo2 = ComboBoxGadget(#PB_Any, 290, 100, 100, 20)
  AddGadgetItem(pbcombo2, 0, "x86 (32 bit)")
  AddGadgetItem(pbcombo2, 1, "x64 (64 bit)")
 
  SetGadgetState(pbcombo, 1)
  SetGadgetState(pbcombo2, 0)
 
  optional_title_gadget = TextGadget(#PB_Any, 107, 30, 220, 20, "Hello to all, have fun with MP3D!", #PB_Text_Center)
 
  pbdir_title = TextGadget(#PB_Any, 180, 135, 100, 20, "Purebasic directory")
 
  PurebasicHome.s = GetEnvironmentVariable("PUREBASIC_HOME")
 
  If PurebasicHome = ""
    PurebasicHome = GetEnvironmentVariable("ProgramFiles") + "\Purebasic\"
  EndIf
 
  pbhome = StringGadget(#PB_Any, 60, 155, 330, 20, PurebasicHome)
 
  install = ButtonGadget(#PB_Any, 60, 500, 100, 25, "Install")
 
  exitinstall = ButtonGadget(#PB_Any, 290, 500, 100, 25, "Exit Installer")
 
  progressbar = ProgressBarGadget(#PB_Any,  60, 460, 330, 20, 0, 1000, #PB_ProgressBar_Smooth)
 
  pbeditor = EditorGadget(#PB_Any, 60, 280, 330, 160, #PB_Editor_WordWrap)
 
  miscellaneous = TextGadget(#PB_Any, 187, 185, 125, 20, "Miscellaneous")
 
  mp3d_libonly = CheckBoxGadget(#PB_Any, 60, 200, 100, 20, "MP3D_lib only")
 
  threadsafe = CheckBoxGadget(#PB_Any, 60, 220, 150, 20, "Threadsafe (coming soon)")
  DisableGadget(threadsafe, 1)
 
EndProcedure

Procedure Write_help()
 
  file$=GetTemporaryDirectory()+"mp3d"
 
  If ReceiveHTTPFile( MP_http + "mp33_beta/Help/MP3D_Library.chm",file$)=0
       MessageRequester("Error :: 404","Help File not found - Please check your internet connection & try again later...")
       ProcedureReturn
  EndIf
 
  CreateDirectory(PurebasicHome+"Help")
 
  Text$ = PurebasicHome+"Help\MP3D_Library.chm"
 
  If CopyFile(file$, PurebasicHome+"Help\MP3D_Library.chm")
    AddGadgetItem(pbeditor, -1, "Wrote "+Text$+" Successfully!")
  EndIf
 
  SetGadgetState(progressbar, 100)
 
EndProcedure

Procedure Write_lib()
 
  file$=GetTemporaryDirectory()+"mp3d"
 
  If GetGadgetState(pbcombo2)=0
   
    If ReceiveHTTPFile( MP_http + "mp33_beta/lib32/Lib32.zip",file$)=0
       MessageRequester("Error 404 (32-bit)","File(s) not found - Please check your internet connection & try again later...")
       ProcedureReturn
    EndIf
   
  ElseIf GetGadgetState(pbcombo2)=1
   
    If ReceiveHTTPFile( MP_http + "mp33_beta/lib64/Lib64.zip",file$)=0
       MessageRequester("Error 404 (64-bit)","File(s) not found - Please check your internet connection & try again later...")
       ProcedureReturn
    EndIf
   
  EndIf 
 
  If OpenPack(0, file$)
     If ExaminePack(0)
       While NextPackEntry(0)
          Text$ = PurebasicHome+"PureLibraries\Windows\Libraries"+PackEntryName(0)
          If UncompressPackFile(0, Text$)
             AddGadgetItem(pbeditor, -1, "Wrote "+Text$+" Successfully!")
          Else   
             AddGadgetItem(pbeditor, -1, "Can´t write File: "+Text$+" ERROR !")
          EndIf   
          WindowEvent()
        Wend
     EndIf
     ClosePack(0)
  EndIf
 
  SetGadgetState(progressbar, 200)
 
EndProcedure

Procedure Write_Demos()
   
  SetGadgetText(pbeditor, "Decompressing demo files... ")
 
  file$=GetTemporaryDirectory()+"mp3d"
 
  If ReceiveHTTPFile(MP_http + "mp33_beta/Examples/MP3D_Demos.zip",file$)=0
       MessageRequester("Error :: 404","File(s) not found..."+Chr(13)+Chr(10)+Chr(13)+Chr(10)+"Please check your internet connection & try again later...")
       ProcedureReturn
  EndIf
 
  CreateDirectory(PurebasicHome+"Examples\MP3D Demos")
 
  count = 200
 
  If OpenPack(0, file$)
     If ExaminePack(0)
       While NextPackEntry(0)
          Text$ = PurebasicHome+"Examples\"+PackEntryName(0)
          If UncompressPackFile(0, Text$) = -1
              CreateDirectory( GetPathPart(Text$))
              UncompressPackFile(0, Text$)
          EndIf
          txt.s = txt.s + "Wrote "+Text$+" Successfully!"+Chr(13)+Chr(10)
          AddGadgetItem(pbeditor, -1, txt.s)
          SetGadgetState(progressbar, count)
          count + 1
          WindowEvent()

        Wend
     EndIf
     ClosePack(0)
  EndIf
 
  SetGadgetState(progressbar, 800)
 
EndProcedure

Procedure Write_Mp3dlib()
 
  file$=GetTemporaryDirectory()+"mp3d"
 
  If GetGadgetState(pbcombo) = 1
    If GetGadgetState(pbcombo2) = 0
      Text$ = MP_http + "mp33_beta/dx9/pb522_32/MP3D_Library.zip"
    Else
      Text$ = MP_http + "mp33_beta/dx9/pb522_64/MP3D_Library.zip"
    EndIf
  ElseIf GetGadgetState(pbcombo) = 0
    If GetGadgetState(pbcombo2) = 0
      Text$ = MP_http + "mp33_beta/dx9/pb511_32/MP3D_Library.zip"
    Else
      Text$ = MP_http + "mp33_beta/dx9/pb511_64/MP3D_Library.zip"
    EndIf
  EndIf
   
  If ReceiveHTTPFile( Text$,file$)=0
       MessageRequester("Error :: 404","File(s): '"+Text$+"' not found..."+Chr(13)+Chr(10)+Chr(13)+Chr(10)+"Please check your internet connection & try again later...")
       ProcedureReturn
  EndIf
     
  CreateDirectory(PurebasicHome+"SubSystems\dx9")
  Text$ = PurebasicHome+"SubSystems\dx9\purelibraries"
  CreateDirectory(Text$)
 
  If OpenPack(0, file$)
     If ExaminePack(0)
       While NextPackEntry(0)
          Text$+"\MP3D_Library"
          If UncompressPackFile(0, Text$)
             AddGadgetItem(pbeditor, -1, "Wrote File: "+Text$+" Successfully!")
           Else
             AddGadgetItem(pbeditor, -1, "Can´t write File: "+Text$+" ERROR !")
          EndIf   
          WindowEvent()
        Wend
     EndIf
     ClosePack(0)
  EndIf
  
  AddGadgetItem(pbeditor, 0, "* * * * * * * * * * * * * * * * * * * * * * *")
  AddGadgetItem(pbeditor, 0, "*")
  AddGadgetItem(pbeditor, 0, "* Installation of MP3D Successfully!  *")
  AddGadgetItem(pbeditor, 0, "*")
  AddGadgetItem(pbeditor, 0, "* * * * * * * * * * * * * * * * * * * * * * *")
  SetGadgetState(progressbar, 1000)
 
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Gadget
      Select EventGadget()
        Case install
         
          SetGadgetState(install, 0)
                   
          PBdir.s = GetGadgetText(pbhome)
         
          If ExamineDirectory(0, PBdir, "*.*")
            a = 1
            FinishDirectory(0)
          EndIf
         
          If a = 0
             MessageRequester("Error :: 404","File(s) not found in directory '"+PBdir+"'...", #PB_MessageRequester_Ok)
             ProcedureReturn
          EndIf
         
          PurebasicHome = GetGadgetText(pbhome)
         
          If GetGadgetState(mp3d_libonly) ; Install mp3dlib only
            Write_Mp3dlib()
          Else 
            Write_help()
            Write_lib()
            Write_Demos()
            Write_Mp3dlib()
          EndIf
         
        Case exitinstall
          End
         
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

OpenWindow_0()

  Repeat
   
    Event = WindowEvent()
   
    Select EventWindow()
      Case MainWindow
        Window_0_Events(event)
    EndSelect
   
  Until Event = #PB_Event_CloseWindow

; IDE Options = PureBasic 5.22 LTS (Windows - x86)
; CursorPosition = 229
; FirstLine = 177
; Folding = --
; EnableAsm
; EnableXP
; EnableAdmin
; DisableDebugger
* Code actualized on 30.11.2014
Last edited by mpz on Sun Nov 30, 2014 2:17 pm, edited 2 times in total.
Working on - MP3D Library - PB 5.73 version ready for download
Dirty.cheese
New User
New User
Posts: 2
Joined: Sat Apr 26, 2014 5:23 pm

Re: MP3D Engine Alpha 32

Post by Dirty.cheese »

how I can use alpha for back color (for example black), but without alpha color for another colors of texture? For example I see normal on this

Code: Select all

  InitNetwork()
    file$=GetTemporaryDirectory()+"sun"
    If FileSize(file$)=-1
      If ReceiveHTTPFile("http://png.findicons.com/files/icons/481/weather/128/sun.png",file$)=0
        MessageRequester("","Need internet")
      EndIf
    EndIf

    MP_Graphics3D (640,480,0,3)
    SetWindowTitle(0, "")

    Camera=MP_CreateCamera()

    MP_AmbientSetLight(0)

    Mesh=MP_CreateCube()
    MP_PositionEntity(Mesh,0,0,5)
    te=MP_LoadTexture(file$)
    MP_EntitySetTexture(Mesh,te)

    MP_MeshSetBlendColor(Mesh,MP_ARGB(255,255,255,255))

    MP_MeshSetAlpha(Mesh,3) ;- It's problem



    While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
        MP_RenderWorld()
        MP_Flip ()
    Wend
but this don't make normal picture

Code: Select all

  InitNetwork()
    file$=GetTemporaryDirectory()+"sun"
    If FileSize(file$)=-1
      If ReceiveHTTPFile("http://png.findicons.com/files/icons/481/weather/128/sun.png",file$)=0
        MessageRequester("","Need internet")
      EndIf
    EndIf

    MP_Graphics3D (640,480,0,3)
    SetWindowTitle(0, "")

    Camera=MP_CreateCamera()

    MP_AmbientSetLight($FAFAFA)

    Mesh=MP_CreateCube()
    MP_PositionEntity(Mesh,0,0,5)
    te=MP_LoadTexture(file$)
    MP_EntitySetTexture(Mesh,te)

    MP_MeshSetBlendColor(Mesh,MP_ARGB(255,255,255,255))

    MP_MeshSetAlpha(Mesh,3) ;- It's problem



    While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
        MP_RenderWorld()
        MP_Flip ()
    Wend
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: MP3D Engine Alpha 32

Post by Mythros »

Found a glitch in the installer, mpz. :) You forgot to disable the "Install button" after you hit "Install". ;) Also, might it be appropriate to ask for a web streaming server and client demo using your webcam? I've been looking for MONTHS for a way to stream my live video over the internet, but to no avail... :(

Thanks ALOT, @mpz, and keep up the FANTASTIC work! :)

Sincerely,

Mythros
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: MP3D Engine Alpha 32

Post by applePi »

Hi Michel
i have tried your web installer, and i think it is a good idea and solution for the many versions available.
when you announce a new MP3D_Lib (the 980 KB file) then that new beta version should be downloadable from the installer also by checking the 'MP3D_Lib only' check box.
i suggest to add the link to the web installer at the top of page 1 of this forum
regards
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 32

Post by mpz »

Hi to all,

@Mythros, i will make new installer without the "glitch" soon.
web streaming = what exactly is your video source? I use the "AVIFIL32.DLL" in my mp3d engine. If you find a sourceode to open your video stream with these "AVIFIL32.DLL" everything is easy...

@applePi, installer at the top of page 1 = yes, but before i want to test this file some days (i hate bugs)

@Dirty.cheese the Parameter 3 creates a "Blend Color" (SetRenderState(D3DRS_BLENDFACTOR,Factor)). These methode is not very good and if you want to have a better one you need alpha blending and use a picture with alpha canal. Here i have changed your code a little bit as example

Code: Select all

InitNetwork()
    file$=GetTemporaryDirectory()+"sun"
    If FileSize(file$)=-1
      If ReceiveHTTPFile("http://png.findicons.com/files/icons/481/weather/128/sun.png",file$)=0
        MessageRequester("","Need internet")
      EndIf
    EndIf

    MP_Graphics3D (640,480,0,3)
    SetWindowTitle(0, "")

    Camera=MP_CreateCamera()

    MP_AmbientSetLight(0)
    
    Mesh1=MP_CreateCube()
    MP_PositionEntity(Mesh1,0,0.5,7)
    te=MP_LoadTexture(file$)
    MP_EntitySetTexture(Mesh1,te)
    MP_MeshSetBlendColor(Mesh1,MP_ARGB(255,255,255,255))
    
    Mesh=MP_CreateCube()
    MP_PositionEntity(Mesh,0,0,5)
    te=MP_LoadTexture(file$)
    MP_EntitySetTexture(Mesh,te)
    MP_MeshSetBlendColor(Mesh,MP_ARGB(255,255,255,255))


    MP_MeshSetAlpha(Mesh,3) ;- It's problem
    MP_MeshSetAlpha(Mesh1,3) ;- It's problem

    While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
      
        a.f + 1
        MP_AmbientSetLight(RGB(a,a,a))
        If a > 255 : a = 0 : EndIf
        
        mp_turnentity(Mesh,1,0,1)
      
        mp_turnentity(Mesh1,1,2,0)
        
        MP_RenderWorld()
        MP_Flip ()
    Wend
Working on - MP3D Library - PB 5.73 version ready for download
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: MP3D Engine Alpha 32

Post by Mythros »

The source to my webstream would essentially be a server created from MP3D, and would be able to stream both audio AND video, or just audio from a webcam that I plug in. If you need more details, feel free to ask.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: MP3D Engine Alpha 32

Post by applePi »

Hi Michael
if you want CT slices as you have asked here.. from human brain, here is a 20 consecutive pictures from http://www.mathworks.com/matlabcentral/ ... images.zip

Image

they are in DCM format i have converted it to BMP using irfan view Batch conversion and attach it here http://www.2shared.com/file/o-VzH2VN/brain.html
(to download the file from 2shared Don't click on the BIG download button but on the smaller download button below it)
i have found them by searching google images with key words ( CT grayscale segmentation ) that is to convert every picture to a points then arrange them over each other until we get the final 3D brain body. i will try later since i am now learning some OpenGL lessons
i hope to find more interesting CT scans images
Post Reply