Page 29 of 71

Re: MP3D Engine Alpha 32

Posted: Sun Jun 30, 2013 2:06 pm
by applePi
Hi AndyLy
i have installed the new mp3d on Purebasic v5.00 (i have many versions on the same C:\) but i run it in winxp not win7 like you, it runs okay from the ide or as a compiled .exe. i have used the following code, have you tried to right click the exe file then choose run as administrator ?

Code: Select all

Global xres=800, yres=600
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "plane")

camera=MP_CreateCamera()

light=MP_CreateLight(2)
MP_InitShadow()
Width=256
Height=256

;to make a background with gradient color
If CreateImage(0, Width, Height)
  MP_CreateImageColored(0, 0, RGB(0,255,255), RGB(0,255,255), RGB(200,0,255), RGB(200,0,255))     
EndIf
Surface = MP_ImageToSurface(0,0)
FreeImage(0)
MP_SurfaceSetPosition(Surface,0,0,1)
MP_SurfaceDestRect(Surface,0, 0, xres, yres)

texture = MP_CreateTextureColor(256, 256, RGBA(0, 0, 255, 255))

plane = MP_CreatePlane(1, 1)
MP_ScaleMesh(plane, 4, 4, 4)

MP_EntitySetTexture(plane, texture)
MP_RotateEntity(plane, 90, 0, 90)
MP_PositionEntity(light, 0, 20, 20)
MP_EntityLookAt(light,0,0,0)

MP_PositionCamera (Camera, 3, 2, 6)
MP_CameraLookAt(Camera,0,0,0)         

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
       
    MP_RenderWorld()
   
    MP_Flip ()

  Wend
  
  

Re: MP3D Engine Alpha 32

Posted: Sun Jun 30, 2013 3:21 pm
by AndyLy
Hi applePi
The same situation with your code- plane does not displayed in exe. Even if run as administrator.
In Ide- work fine.

p.s. Just tried it on Windows XP- is the same. I do not understand what could be the reason.

p.p.s. It was a bug related to the use of D3dx9_43.dll. I removed it and now exe file also works fine.

Re: MP3D Engine Alpha 32

Posted: Sat Jul 06, 2013 3:47 pm
by applePi
Hi Alexi , there are 8 functions to deal with the animated models with bones can be loaded with MP_LoadAnimMesh(Files.s), you can choose the animation index by MP_SetAnimationSet(AnimMesh , index)
look the animation mesh functions in the help
i think it is available only for animated DirectX mesh (*.x files)
look Mesh\MP_3_AnimMesh.pb and Mesh\MP_AnimDemo.pb . i never used bones before so if someone have more info .
if there are some bones related functions needed and it is available in DirectX 9 then i'm sure Michael will implement it.

Re: MP3D Engine Alpha 32

Posted: Wed Jul 10, 2013 3:46 pm
by Sveinung
Some sprite fun withe Aplha32

Image

Code: Select all

MP_Graphics3D(640,480,32,1)

s1=MP_LoadSprite("32.png")

Repeat
  ang.f+0.05
  d.f=0.1
  For x=0 To 640 Step 40
    dy1=Sin(ang+d)*40
    dy2=Sin(ang+d)*80
    dy3=Sin(ang+d)*120
    MP_DrawSprite(s1,0+x,240)
    MP_DrawSprite(s1,0+x,240+dy1)
    MP_DrawSprite(s1,0+x,240-dy1)
    MP_DrawSprite(s1,0+x,240+dy2)
    MP_DrawSprite(s1,0+x,240-dy2)
    MP_DrawSprite(s1,0+x,240+dy3)
    MP_DrawSprite(s1,0+x,240-dy3)
    d+0.1
  Next
  MP_RenderWorld()
  MP_Flip()
Until MP_KeyHit(#PB_Key_Escape)
Regards
Sveinung

Re: MP3D Engine Alpha 32

Posted: Wed Jul 10, 2013 5:30 pm
by applePi
thank you Sveinung, a beautiful demonstration, i have tried it in PB 5.11
since in 5.20 Beta5 it issue a message: PureBasic library missing: Misc(needed by 'MP3D_Library' library)

Re: MP3D Engine Alpha 32

Posted: Wed Jul 10, 2013 10:37 pm
by Andre
applePi wrote:thank you Sveinung, a beautiful demonstration, i have tried it in PB 5.11
since in 5.20 Beta5 it issue a message: PureBasic library missing: Misc(needed by 'MP3D_Library' library)
As the former 'Misc' library was split off and their commands are included in several other libraries (2DDrawing, Math, ...) this UserLib needs to be re-compiled using the actual PB-Compiler for PB5.20 to work again...

Re: MP3D Engine Alpha 32

Posted: Thu Jul 11, 2013 10:08 pm
by Szafir
Would it be possible to the engine as dll?

Sorry for my english.

Re: MP3D Engine Alpha 32

Posted: Fri Jul 12, 2013 5:50 am
by IceSoft
Szafir wrote:Would it be possible to the engine as dll?
I am not sure. The sentence below can be found on the FAQ page of PB:
Is it allowed to use DLLs made with PureBasic in other projects ?
Generally yes. You can make DLLs including PureBasic commands for your own projects without any restrictions. But it's not allowed to release simple "wrapper" Dlls to include PureBasic commands in other programming languages.

Re: MP3D Engine Alpha 32

Posted: Fri Jul 12, 2013 7:29 am
by Szafir
In fact, the engine is tightly integrated with PureBasic.

Re: MP3D Engine Alpha 32

Posted: Fri Jul 12, 2013 9:28 am
by applePi
Hi Michael, when you return home if possible to check the MP_ChangePhysikHull you have added recently since it seems not implemented in the new posted alpha 32, also if possible an example of its usage.
thanks

Re: MP3D Engine Alpha 32

Posted: Fri Jul 12, 2013 11:52 am
by Sveinung
and some more sprite (yes..I'm bored)

Use image from my last post

Code: Select all

MP_Graphics3D(640,480,32,1)

tot_Stars=88

sp1=MP_LoadSprite("64.png")

Structure sdata
  plus.f
  scale.f
  cnt.i
EndStructure

Dim stars.sdata(tot_Stars)

For i=0 To tot_Stars
  stars(i)\plus=1
  stars(i)\scale=10
  stars(i)\cnt=0-(i*10)
Next

Repeat
  ang.f+0.04
  For i=0 To tot_Stars
    MP_SpriteSetZ(sp1,i/100)
    dx.f=Sin(ang-i)*stars(i)\plus
    dy.f=Cos(ang-i)*stars(i)\plus
    dd.f=32*(stars(i)\scale/100)
    MP_ScaleSprite(sp1,stars(i)\scale,stars(i)\scale)
    MP_DrawSprite(sp1,(320-dd)+dx,(240-dd)+dy)
    stars(i)\cnt+1
    If stars(i)\cnt>10
      stars(i)\scale+2
      stars(i)\plus+3
      stars(i)\cnt=0
      If stars(i)\scale>160
        stars(i)\scale=10
        stars(i)\plus=1
      EndIf
    EndIf
  Next
  MP_RenderWorld()
  MP_Flip()
Until MP_KeyHit(#PB_Key_Escape)
Regards
Zzzzzzzzzzzzzzveinung :mrgreen:

Re: MP3D Engine Alpha 32

Posted: Fri Jul 12, 2013 10:42 pm
by mpz
Hi,

to all, i am back. The first bad news, i cant recompile my lib with PB 5.2. There comes an error message "label not found". It could be a pointer problem with 5.2 and tailbite, but i am working on it and with the good help from the tailbite team we find a solution.

@AndyLy, i hope everything works now?!?

@Alexi, Bones, Anim Mesh in MP3d works with DX9 Animmesh X files, a good information side are here
http://www.toymaker.info/Games/html/loa ... chyConcept

@Sveinung, nice Demo thanks

@Andre, Misc lib is missing message appears, yes i must re-compile the lib if i found the problem ;)

@Szafir, yes it is possible, but i need a reason why? I will animate programer to use pb for 3d... and before i must ask Fred, i dont want to make a simple "wrapper" with my engine :) :) :)

@applePi, have you seen the MP_Physic_Primitives.pb example? If you change a MP3d_mesh for example with the MP_VertexSet command you actualize the meshphysic of the mesh with the command MP_ChangePhysicHull(Mesh, Typ)

@Sveinung, nice Demo thanks

@Alexi multiple Screen, not for now. I will check it but it will be a big work to change these function

Greetings Michael

Re: MP3D Engine Alpha 32

Posted: Sat Jul 13, 2013 10:02 am
by AndyLy
Hi Michael, I hope you had a good rest .
to all, i am back. The first bad news, i cant recompile my lib with PB 5.2. There comes an error message "label not found". It could be a pointer problem with 5.2 and tailbite, but i am working on it and with the good help from the tailbite team we find a solution.

@AndyLy, i hope everything works now?!?
I am not planning to move to the PB 5.2 , because with each update changes are more radical.
I don't want every time remake my big codes and have not working additional libraries.
Actually, I think very soon the PB will be completely different, a new language, which will have to study again.

============================
Now that you are back, maybe you want to do what I have long asked: adding additional layers of texture objects . Cite this quote :

Code: Select all

I would like to add layers of texture. Ie there is a basic, large texture and later I add  details texture on arbitrary coordinates .
I added the procedure, as I do now . I hope you understand what I'm doing :
StartDrawing(ImageOutput(LayTex(lrd_tex)\baseimg))
  ForEach LayTex()\layer()
DrawAlphaImage(ImageID(LayTex()\layer()\image),LayTex()\layer()\x,LayTex()\layer()\y)
  Next: StopDrawing()
     texture=MP_ImageToTexture(LayTex()\baseimg,0,0,mip)

Re: MP3D Engine Alpha 32

Posted: Sun Jul 14, 2013 11:02 am
by mpz
Hi Andyly,

i think these function can i implement. What kind of function do you need?

The texture overwrite on this place ?
The texture will be add on this place ?
The texture overwrite with alphafunction on this place ?

Greetings Michael

Re: MP3D Engine Alpha 32

Posted: Sun Jul 14, 2013 12:04 pm
by AndyLy
"The texture overwrite with alphafunction on this place ?"

That there was no misunderstanding, I will explain with pictures.
1 - base texture, 2 - texture with alpha; 3 - result

Image

I think it should be a command like MP_AddTextureLayer(base_tex, add_tex, x, y, trans=255)