MP3D Engine Alpha 33
Re: MP3D Engine Alpha 30
Menu: compiler -> compiler options. You will find a textfield called "Library Subsystem" here. Just type in "dx9" (there should be the same, if you open a demo file)
pb 5.11
Re: MP3D Engine Alpha 30
thanks man and it work 
I got a questions...
You know Alien Breed Intro Demo where show all the 2D stars doing different directions and how I would do it knowing when the stars come toward me then change different directions like 3D World using Z Values and so on

I got a questions...
You know Alien Breed Intro Demo where show all the 2D stars doing different directions and how I would do it knowing when the stars come toward me then change different directions like 3D World using Z Values and so on
Last edited by Swos2009 on Mon Jul 02, 2012 12:37 am, edited 1 time in total.
Re: MP3D Engine Alpha 30
Hi firstly wonderful little addition to PureBasic, just a quick question.
Does the TileEngine support layers?
Example: you can create a map in 'Tiled' with many layers, however how do you code the TileEngine and insert this new layer.
Does the TileEngine support layers?
Example: you can create a map in 'Tiled' with many layers, however how do you code the TileEngine and insert this new layer.
-
- Addict
- Posts: 1675
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: MP3D Engine Alpha 30
I don't know how MP3D handles Tiles and if it does layers like that, but I would hazzard a guess that even if it didn't, you could still do it if you:
Built a parser to read the file format into data you can feed to the tile engine.. Then draw the tiles in proper Z-order (bottom-most layer gets drawn first, next highest on top of that, next highest on top of that, etc)
Built a parser to read the file format into data you can feed to the tile engine.. Then draw the tiles in proper Z-order (bottom-most layer gets drawn first, next highest on top of that, next highest on top of that, etc)
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 30
Hi applepi,
you have made nice demos and functions with the vertex / triangle functions. I hope you understand now the vertex and / triangle function ?!?
littel example:
A mesh has vertex points. The Vertex point has a xyz point in space and can have a color function and for textures a uv coordinate. You can have some of these vertexe in a mesh, but the only thing you see are the triangles of a mesh. A triangle is made from the position of 3 vertex points. Your mesh can have 1000 vertex, but you only see the created triangles:
for example a little demo of a 2d mesh with triangle creation
you have made nice demos and functions with the vertex / triangle functions. I hope you understand now the vertex and / triangle function ?!?
littel example:
A mesh has vertex points. The Vertex point has a xyz point in space and can have a color function and for textures a uv coordinate. You can have some of these vertexe in a mesh, but the only thing you see are the triangles of a mesh. A triangle is made from the position of 3 vertex points. Your mesh can have 1000 vertex, but you only see the created triangles:
for example a little demo of a 2d mesh with triangle creation
Code: Select all
MP_Graphics3D (640,480,0,1) ; Erstelle ein WindowsFenster #Window = 0
SetWindowTitle(0, "Vertex und Triangle Demo 2")
camera=MP_CreateCamera() ; Kamera erstellen
light=MP_CreateLight(2) ; Es werde Licht
Mesh = MP_CreateMesh() ; Erzeuge leeres Mesh
If CreateImage(0,128, 128) ; Erzeuge 6 unterschiedliche Texturseiten
Font = LoadFont(#PB_Any, "Arial" , 24)
StartDrawing(ImageOutput(0))
Box(0, 0, 64, 64,RGB(255,0,0))
Box(0, 64, 64, 64,RGB(255,255,0))
Box(64, 0, 64, 64,RGB(0,255,0))
Box(64, 64, 64, 64,RGB(0,0,255))
DrawingFont(FontID(Font))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(20,45,"MP3D",RGB(0,0,0))
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 )
; Create 0 Vertex for middle
MP_AddVertex (Mesh, 0, 0,0,0,0.5,0.5)
For n = 0 To 360 Step 20
; Create 18 Vertexe
MP_AddVertex (Mesh, Sin (Radian(n)), Cos(Radian(n)),0,0,Sin (Radian(n))/2+0.5,-Cos(Radian(n))/2+0.5)
Next n
MP_AddTriangle (Mesh, 0,1,18)
MP_PositionEntity (Mesh,0,0,3)
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
count + 1
If count > 60 ; easy counter
count = 0
count2 + 1
If count2 < 18 ; add max 18 triangles
MP_AddTriangle (Mesh, 0,count2,count2+1)
EndIf
EndIf
; If count2 > 18 ; change x,y position of vertex
; For n = 0 To 20
; MP_VertexSetX (Mesh,n,MP_VertexGetX (Mesh,n)+Sin(count2+n)/100)
; MP_VertexSetY (Mesh,n,MP_VertexGetY (Mesh,n)+Cos(count2+n)/100)
; Next
; EndIf
MP_TurnEntity (Mesh,0,0,0.2)
MP_RenderWorld() ; Erstelle die Welt
MP_Flip () ; Stelle Sie dar
Wend
Last edited by mpz on Wed Jul 11, 2012 2:28 pm, edited 1 time in total.
Working on - MP3D Library - PB 5.73 version ready for download
Re: MP3D Engine Alpha 30
that is a beautiful and demonstrative example Michael
thank you very much
thank you very much
Re: MP3D Engine Alpha 30
Hi
while looking at the Michael example above i get an idea to make holes and tearing and destroying a mesh. since the mesh composed from triangles, what if we pick some triangle and then assign the coordinates of the second vertex the same as the third vertex, then we will have a very thin triangle ie a line and the what was before a triangle area now a void we can see through it.
here is an example to demonstrate that. just click on the green board to tear it and to see how light go through its holes.
the program depends on the MP3D example "MP_PickingTriangle.pb" inside picking folder, if you give the green board a real texture such as bricks or a tiger skin then we will have more amusing show.
the idea are not complete since it does not destroy triangles inside the mesh correctly, it is more correct at the corners of the board. but i present the example until i improve it more. also i want to put a moving sun to make it more enjoyable.
i hope the next version of MP3D to support shadow on resolution 640x480.

while looking at the Michael example above i get an idea to make holes and tearing and destroying a mesh. since the mesh composed from triangles, what if we pick some triangle and then assign the coordinates of the second vertex the same as the third vertex, then we will have a very thin triangle ie a line and the what was before a triangle area now a void we can see through it.
here is an example to demonstrate that. just click on the green board to tear it and to see how light go through its holes.
the program depends on the MP3D example "MP_PickingTriangle.pb" inside picking folder, if you give the green board a real texture such as bricks or a tiger skin then we will have more amusing show.
the idea are not complete since it does not destroy triangles inside the mesh correctly, it is more correct at the corners of the board. but i present the example until i improve it more. also i want to put a moving sun to make it more enjoyable.
i hope the next version of MP3D to support shadow on resolution 640x480.

Code: Select all
;depends on MP_PickingTriangle.pb and MP_ChessShadow MP3D examples
Global xres=800, yres=600
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "mesh eating, tearing and shadow, click on the green board to tear it")
camera=MP_CreateCamera()
light=MP_CreateLight(0)
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, 255, 0, 0))
texture2 = MP_CreateTextureColor(256, 256, RGBA(0, 255, 255, 0))
texture3 = MP_CreateTextureColor(256, 256, RGBA(0, 0, 255, 255))
cone = MP_CreateCone(64, 10)
MP_EntitySetTexture(cone, texture2)
MP_PositionEntity(cone, 0, 2, 0)
MP_ScaleMesh(cone, 0.5, 0.5, 0.5)
MP_RotateEntity(cone, 0, 90, 0)
plane = MP_CreatePlane(10, 10)
MP_EntitySetTexture(plane, texture)
MP_RotateEntity(plane, 0, 0, 90)
plane2 = MP_CreatePlane(10, 10)
MP_EntitySetTexture(plane2, texture3)
MP_RotateEntity(plane2, 0, 90, 90)
cam0 = MP_CreateCamera()
MP_PositionCamera(cam0, -150, 90, -140)
MP_RotateCamera(cam0, 47, 0, -30)
MP_PositionEntity(light, 0, 20, 20)
MP_EntityLookAt(light,0,0,0)
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
count.f + 0.01
MP_PositionEntity(light, Sin(count+#PI/2) * 10 , 20, Cos(count+#PI/2) * 10)
MP_EntityLookAt(light,MP_EntityGetX(plane),MP_EntityGetY(plane),MP_EntityGetZ(plane))
MP_PositionCamera (Camera, 10, 5, 6)
MP_CameraLookAt(Camera,MP_EntityGetX(plane),MP_EntityGetY(plane),MP_EntityGetZ(plane))
;;0000000000000000000000000000000000000000000000000000
If MP_MouseButtonDown(0)
pickedmesh = MP_PickCamera(cam0, WindowMouseX(0),WindowMouseY(0))
triangleindex = MP_PickedGetTriangle();
If triangleindex And pickedmesh = plane
index0 = MP_EntityGetTriangle(pickedmesh, triangleindex, 0)
index1 = MP_EntityGetTriangle(pickedmesh, triangleindex, 1)
index2 = MP_EntityGetTriangle(pickedmesh, triangleindex, 2)
x1.f=MP_VertexGetX(pickedmesh, index1)
y1.f=MP_VertexGetY(pickedmesh, index1)
z1.f=MP_VertexGetZ(pickedmesh, index1)
x2.f=MP_VertexGetX(pickedmesh, index2)
y2.f=MP_VertexGetY(pickedmesh, index2)
z2.f=MP_VertexGetZ(pickedmesh, index2)
; reset the vertex1 coordinates the same as vertex2
MP_VertexSetX(plane,index1,x2)
MP_VertexSetY(plane,index1,y2)
MP_VertexSetZ(plane,index1,z2)
EndIf
EndIf
;;;00000000000000000000000000000000000000000000000000000
MP_RenderWorld()
MP_Flip ()
Wend
Re: MP3D Engine Alpha 30
in the previous example i was not able to make a hole in the middle of the green board correctly
here is a way to make a hole inside a mesh correctly
we use custom mesh made from adjacent independent triangles, so we can erase any triangle without affecting the others.
it is made from 18 triangles and the numbering of indexes for triangle 1 is
index 0 have coordinates 0,3,0
index 1 have coordinates 1,2,0
index 2 have coordinates 1,3,0
index 3 is for triangle 2 and begins with 0,3,0
look the figure below (not showing z coordinate because it is all 0)
(remember the triangle corners are corner 0, corner 1, corner 2)
when we want to delete triangle 9 we change the coordinates of corner 1 of the triangle 9 which have index 25 like this:
MP_VertexSetX(Mesh,25,2)
MP_VertexSetY(Mesh,25,2)
MP_VertexSetZ(Mesh,25,0)
ie we give it the coordinates of the triangle 9 corner 2 (index 26)
you can add more to MP_AddVertex such as MP_AddVertex(Entity, x.f, y.f, z.f [, Color [, u.f, v.f [, nx.f, ny.f, nz.f]]]) look docs
look example MP_UseVertex.pb in Mesh folder to see how to texture a mesh made using MP_AddVertex + MP_AddTriangle

click the mouse in the middle of the green board and you can erase triangles in the middle and the light will pass through it.

here is a way to make a hole inside a mesh correctly
we use custom mesh made from adjacent independent triangles, so we can erase any triangle without affecting the others.
it is made from 18 triangles and the numbering of indexes for triangle 1 is
index 0 have coordinates 0,3,0
index 1 have coordinates 1,2,0
index 2 have coordinates 1,3,0
index 3 is for triangle 2 and begins with 0,3,0
look the figure below (not showing z coordinate because it is all 0)
(remember the triangle corners are corner 0, corner 1, corner 2)
when we want to delete triangle 9 we change the coordinates of corner 1 of the triangle 9 which have index 25 like this:
MP_VertexSetX(Mesh,25,2)
MP_VertexSetY(Mesh,25,2)
MP_VertexSetZ(Mesh,25,0)
ie we give it the coordinates of the triangle 9 corner 2 (index 26)
you can add more to MP_AddVertex such as MP_AddVertex(Entity, x.f, y.f, z.f [, Color [, u.f, v.f [, nx.f, ny.f, nz.f]]]) look docs
look example MP_UseVertex.pb in Mesh folder to see how to texture a mesh made using MP_AddVertex + MP_AddTriangle

click the mouse in the middle of the green board and you can erase triangles in the middle and the light will pass through it.

Code: Select all
;depends on MP_PickingTriangle.pb and MP_ChessShadow MP3D examples
Global xres=800, yres=600
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "mesh eating, tearing and shadow, click on the green board to tear it")
camera=MP_CreateCamera()
light=MP_CreateLight(0)
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, 255, 0, 0))
texture2 = MP_CreateTextureColor(256, 256, RGBA(0, 255, 255, 0))
texture3 = MP_CreateTextureColor(256, 256, RGBA(0, 0, 255, 255))
cone = MP_CreateCone(64, 10)
MP_EntitySetTexture(cone, texture2)
MP_PositionEntity(cone, 0, 2, 0)
MP_ScaleMesh(cone, 0.5, 0.5, 0.5)
MP_RotateEntity(cone, 0, 90, 0)
plane = MP_CreateMesh() ;the plane we want to make holes
plane2 = MP_CreatePlane(10, 10)
MP_EntitySetTexture(plane2, texture3)
MP_RotateEntity(plane2, 0, 90, 90)
cam0 = MP_CreateCamera()
MP_PositionCamera(cam0, -150, 90, -140)
MP_RotateCamera(cam0, 47, 0, -30)
MP_PositionEntity(light, 0, 20, 20)
MP_EntityLookAt(light,0,0,0)
;;00000000000000000000000000000000000000000000000000000
; constructing the green board
i.l:j.l:vtx.l=-1:t1.f=0:t2.f=0:t3.f=0
Restore Vertices
For i=0 To 17
vtx + 1 ; corner 0 of every triangle
For j=0 To 2
Read.f t1 : Read.f t2 : Read.f t3
MP_AddVertex(plane,t1, t2, t3)
Next j
MP_AddTriangle (plane, vtx,vtx+1,vtx+2)
vtx+2
Next i
MP_ScaleMesh(plane, 2.5, 2.5, 2.5)
MP_EntitySetTexture(plane, texture)
MP_PositionEntity (plane,-3,0,0)
;-00000000000000000000000000000000000000000000000000000
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
count.f + 0.01
MP_PositionEntity(light, Sin(count+#PI/2) * 10 , 20, Cos(count+#PI/2) * 10)
MP_EntityLookAt(light,MP_EntityGetX(plane),MP_EntityGetY(plane),MP_EntityGetZ(plane))
MP_PositionCamera (Camera, 10, 5, 6)
MP_CameraLookAt(Camera,MP_EntityGetX(plane),MP_EntityGetY(plane),MP_EntityGetZ(plane))
;;0000000000000000000000000000000000000000000000000000
If MP_MouseButtonDown(0)
pickedmesh = MP_PickCamera(cam0, WindowMouseX(0),WindowMouseY(0))
triangleindex = MP_PickedGetTriangle();
If triangleindex And pickedmesh = plane
index0 = MP_EntityGetTriangle(pickedmesh, triangleindex, 0)
index1 = MP_EntityGetTriangle(pickedmesh, triangleindex, 1)
index2 = MP_EntityGetTriangle(pickedmesh, triangleindex, 2)
x1.f=MP_VertexGetX(pickedmesh, index1)
y1.f=MP_VertexGetY(pickedmesh, index1)
z1.f=MP_VertexGetZ(pickedmesh, index1)
x2.f=MP_VertexGetX(pickedmesh, index2)
y2.f=MP_VertexGetY(pickedmesh, index2)
z2.f=MP_VertexGetZ(pickedmesh, index2)
; reset the vertex1 coordinates the same as vertex2
MP_VertexSetX(plane,index1,x2)
MP_VertexSetY(plane,index1,y2)
MP_VertexSetZ(plane,index1,z2)
EndIf
EndIf
;;;00000000000000000000000000000000000000000000000000000
MP_RenderWorld()
MP_Flip ()
Wend
DataSection
Vertices:
Data.f 0,3,0
Data.f 1,2,0
Data.f 1,3,0
Data.f 0,3,0
Data.f 0,2,0
Data.f 1,2,0
Data.f 1,3,0
Data.f 2,2,0
Data.f 2,3,0
Data.f 1,3,0
Data.f 1,2,0
Data.f 2,2,0
Data.f 2,3,0
Data.f 3,2,0
Data.f 3,3,0
Data.f 2,3,0
Data.f 2,2,0
Data.f 3,2,0
Data.f 0,2,0
Data.f 1,1,0
Data.f 1,2,0
Data.f 0,2,0
Data.f 0,1,0
Data.f 1,1,0
Data.f 1,2,0
Data.f 2,1,0
Data.f 2,2,0
Data.f 1,2,0
Data.f 1,1,0
Data.f 2,1,0
Data.f 2,2,0
Data.f 3,1,0
Data.f 3,2,0
Data.f 2,2,0
Data.f 2,1,0
Data.f 3,1,0
Data.f 0,1,0
Data.f 1,0,0
Data.f 1,1,0
Data.f 0,1,0
Data.f 0,0,0
Data.f 1,0,0
Data.f 1,1,0
Data.f 2,0,0
Data.f 2,1,0
Data.f 1,1,0
Data.f 1,0,0
Data.f 2,0,0
Data.f 2,1,0
Data.f 3,0,0
Data.f 3,1,0
Data.f 2,1,0
Data.f 2,0,0
Data.f 3,0,0
EndDataSection
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 30
hello applePi,
thanks for your great Demo. This bring me an Idea of two new commands. One Command to delete vertexe and one Command to delete Triangles. I will test id but i think In the next version i will make this new command.
For exampel
MP_FreeTriangle (mesh, triangleindex)
MP_FreeVertex (mesh, vertexindex)
If the command are ready i can give you a beta version for testing if you want...
Greetings Michael
thanks for your great Demo. This bring me an Idea of two new commands. One Command to delete vertexe and one Command to delete Triangles. I will test id but i think In the next version i will make this new command.
For exampel
MP_FreeTriangle (mesh, triangleindex)
MP_FreeVertex (mesh, vertexindex)
If the command are ready i can give you a beta version for testing if you want...
Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
Re: MP3D Engine Alpha 30
Hi Michael
MP_FreeTriangle and MP_FreeVertex will be a great idea. i wish if it can be used also with the mesh created with MP_CreatePlane function
of course i will test the beta version when it is ready
thanks
MP_FreeTriangle and MP_FreeVertex will be a great idea. i wish if it can be used also with the mesh created with MP_CreatePlane function
of course i will test the beta version when it is ready
thanks
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 30
Hi applePi,
both functions are working now and can used for all meshs including the MP_CreatePlane mesh. I send you an pm with a testcode and the lib in the next hours...
Greeting Michael
both functions are working now and can used for all meshs including the MP_CreatePlane mesh. I send you an pm with a testcode and the lib in the next hours...
Greeting Michael
Working on - MP3D Library - PB 5.73 version ready for download
some beautiful models
some math programs can export its 3D Graphics to 3D files formats such as 3ds format and can Import it again, such as mathematica v8 or above (http://www.wolfram.com/mathematica)
read this mht file which show how to do that in a one page tutorial :
https://sites.google.com/site/zak31415/ ... ormats.mht
also look here: http://reference.wolfram.com/mathematic ... phics.html for some examples
if you clicked at the codes lines a javascript will show a copyable text.
i have Exported some Graphics using mathematica and attached some small size models including a colorful helicopter and a pb example you can download it from here
http://www.mediafire.com/?19wok6r34g5p9oo

some notes:
1-the helicopter model are colored, i don't know how it is colored, but it is not a texture. when i have used MP_LoadMesh to load a "helicopter.3DS" it is not colored but shaded black and white. and when i have exported that 3DS file to directX x file using milkshape and using the MP_LoadMesh to load the "helicopter.x" now it show the color, i deduce that MP3D are more comfortable with x files than 3DS files.
2- the mathematica Export the models without textures and some times the models have a color, so we have to texture the models using other programs.
read this mht file which show how to do that in a one page tutorial :
https://sites.google.com/site/zak31415/ ... ormats.mht
also look here: http://reference.wolfram.com/mathematic ... phics.html for some examples
if you clicked at the codes lines a javascript will show a copyable text.
i have Exported some Graphics using mathematica and attached some small size models including a colorful helicopter and a pb example you can download it from here
http://www.mediafire.com/?19wok6r34g5p9oo

some notes:
1-the helicopter model are colored, i don't know how it is colored, but it is not a texture. when i have used MP_LoadMesh to load a "helicopter.3DS" it is not colored but shaded black and white. and when i have exported that 3DS file to directX x file using milkshape and using the MP_LoadMesh to load the "helicopter.x" now it show the color, i deduce that MP3D are more comfortable with x files than 3DS files.
2- the mathematica Export the models without textures and some times the models have a color, so we have to texture the models using other programs.
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 30
Hi applePi ,
nice idea to use mathematica for a model...
The 3ds and b3d import modul is written myself. I will have a look on it an perhaps i find a solution. You can color a mesh with textures and you can give every vertex point a different color and the vertex color colored the triangle. I thing in this case the 3ds model ist colored with a vertex color and the import could not read this.
Greetings Michael
nice idea to use mathematica for a model...
The 3ds and b3d import modul is written myself. I will have a look on it an perhaps i find a solution. You can color a mesh with textures and you can give every vertex point a different color and the vertex color colored the triangle. I thing in this case the 3ds model ist colored with a vertex color and the import could not read this.
Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 31
Update auf Alpha 31
Works only with PB 4.61 (x86 and x64) or higher
* Some Updates and new demos
* New command expansions
* you can change Pixel of textures
* Anti Alaising function
* Particlefunktion has big expansions
* More and usefull Triangel and Vertex functions
* You can use Sprites in the 3d Space like Billboards
Currently the following functions are not working with x64: the V2Lib (binärcode in 32 bit only)
1) Befehl erweitert: MP_FeaturesOf (Var) ; Var = 5, checked Anti Alaising function
2) Neuer Befehl: MP_SetAntiAlaising( State ); State activiert Antialaising
3) Befehl erweitert: MP_CatchMeshX wurde durch MP_CatchMesh (Memory , SizeOfMemory ) ersetzt. MP_CatchMesh can load *.x, 3ds and b3d files
4) Befehl erweitert: MP_CatchSprite(Adresse, Laenge) ; then comand load alpha textures for sprites now
5) Neuer Befehl: MP_SetRenderWorldCallback(*proc.i) ; Callback for render routine to use own functions
6) Befehl erweitert: MP_InitShadow([Var]); With Var = 0 you could deactivate the Shadow function
7) Neuer Befehl: MP_TextureSetPixel(Texture,x,y,Color,[Level]) ; Set a Pixel of a Texture. Level = Mipmap level
Neuer Befehl: MP_TextureGetPixel(Texture,x,y,[Level]) ; Get a Pixel of a Texture. Level = Mipmap level
9) Befehl erweitert: MP_TextureGetWidth (Texture[,level]) ; width of Level = Mipmap level
10) Befehl erweitert: MP_TextureGetHeight (Texture[, level]); height of Level = Mipmap level
11) Neuer Befehl: MP_CatchSkyBox (Adress0, Adress1, Adress2, Adress3, Adress4, Adress5, Adress6 ,factor) ; Catched a Skybox with 6 grafic files
12) Befehl erweitert: MP_ScrollSurface(Surface, X.f, Y.f ) ; x and y was reversed, x and y could be float for now
13) Neuer Befehl: MP_GetRenderedParticles(Entity); count of active particle of a Particleemitter
14) Neuer Befehl: MP_SetSamplerState( Type, Value ) ; Sets the sampler state value, Setzt eine TexturFiltertechnik
15) Neuer Befehl: MP_GetSamplerState( Type ) ; Gets the sampler state value, ließt eine TexturFiltertechnik aus
16) Neuer Befehl: MP_FreeTriangle ( Entity, Index) ; delete triangle of mesh, Triangel eines mesh wird gelöscht
17) Neuer Befehl: MP_FreeVertex ( Entity ,Index) ; delete a vertex from a mesh, Subtrahiert eine Vertex von einem Mesh
18) Neuer Befehl: MP_CopySprite(Sprite) ; Create a new Sprite from a Sprite; Erzeugt eine neuen Sprite aus einem Sprite
19) Neuer Befehl: MP_ParticleFadeOut(Entity, kind) ; fade out, over livetime or at 80%/50%/39% or 10% livetime, Blendet die Partikel über die gesammte Lebenzeit , oder erst bei 80%/50%/30% oder 10% der Lebenszeit sanft aus.
20) Neuer Befehl: MP_ParticleChangeColor(Entity, RGB, kind); change color over livetime with fadeout function. Partikelfarbe wird gewechselt mit Ausblendeeffekt
21) Neuer Befehl: MP_CreateOneShotEmitter (Part, x.f, y.f, z.f, MaxParticle, ReleaseParticle,Interval.f, MinTime.f, MaxTime.f); Creat a oneshot partticle emmiter: Erzeugt eine oneshot particleemmiter
22) Neuer Befehl: MP_3DZto2D (z.f) ; get the 2d z position from a 3d position. Bestimmt die 2D Entfernung z im 3D Raum
23) Befehl erweitert: MP_TextSetZ(z.f) ; See-deep of text, now with 3d z float, text could use in 3d space. Sichttiefe des Textes als 3D Wert, 0 = Front, z.f = weiter im Hintergrund
24) Befehl erweitert: MP_SpriteSetZ(z.f) ; See-deep of Sprite, now with 3d z float, sprite could use as billboard. Sichttiefe des Sprite als 3D Wert, 0 = Front, z.f = weiter im Hintergrund
25) Neuer Befehl: MP_ChangeMeshcoord(Entity) ; change the vertex coords with the position and turning of the meshmatrix; Ändert die Coordinaten der Vertexe in Richtung die das Mesh gedreht oder positioniert wurde
Works only with PB 4.61 (x86 and x64) or higher
* Some Updates and new demos
* New command expansions
* you can change Pixel of textures
* Anti Alaising function
* Particlefunktion has big expansions
* More and usefull Triangel and Vertex functions
* You can use Sprites in the 3d Space like Billboards
Currently the following functions are not working with x64: the V2Lib (binärcode in 32 bit only)
1) Befehl erweitert: MP_FeaturesOf (Var) ; Var = 5, checked Anti Alaising function
2) Neuer Befehl: MP_SetAntiAlaising( State ); State activiert Antialaising
3) Befehl erweitert: MP_CatchMeshX wurde durch MP_CatchMesh (Memory , SizeOfMemory ) ersetzt. MP_CatchMesh can load *.x, 3ds and b3d files
4) Befehl erweitert: MP_CatchSprite(Adresse, Laenge) ; then comand load alpha textures for sprites now
5) Neuer Befehl: MP_SetRenderWorldCallback(*proc.i) ; Callback for render routine to use own functions
6) Befehl erweitert: MP_InitShadow([Var]); With Var = 0 you could deactivate the Shadow function
7) Neuer Befehl: MP_TextureSetPixel(Texture,x,y,Color,[Level]) ; Set a Pixel of a Texture. Level = Mipmap level

9) Befehl erweitert: MP_TextureGetWidth (Texture[,level]) ; width of Level = Mipmap level
10) Befehl erweitert: MP_TextureGetHeight (Texture[, level]); height of Level = Mipmap level
11) Neuer Befehl: MP_CatchSkyBox (Adress0, Adress1, Adress2, Adress3, Adress4, Adress5, Adress6 ,factor) ; Catched a Skybox with 6 grafic files
12) Befehl erweitert: MP_ScrollSurface(Surface, X.f, Y.f ) ; x and y was reversed, x and y could be float for now
13) Neuer Befehl: MP_GetRenderedParticles(Entity); count of active particle of a Particleemitter
14) Neuer Befehl: MP_SetSamplerState( Type, Value ) ; Sets the sampler state value, Setzt eine TexturFiltertechnik
15) Neuer Befehl: MP_GetSamplerState( Type ) ; Gets the sampler state value, ließt eine TexturFiltertechnik aus
16) Neuer Befehl: MP_FreeTriangle ( Entity, Index) ; delete triangle of mesh, Triangel eines mesh wird gelöscht
17) Neuer Befehl: MP_FreeVertex ( Entity ,Index) ; delete a vertex from a mesh, Subtrahiert eine Vertex von einem Mesh
18) Neuer Befehl: MP_CopySprite(Sprite) ; Create a new Sprite from a Sprite; Erzeugt eine neuen Sprite aus einem Sprite
19) Neuer Befehl: MP_ParticleFadeOut(Entity, kind) ; fade out, over livetime or at 80%/50%/39% or 10% livetime, Blendet die Partikel über die gesammte Lebenzeit , oder erst bei 80%/50%/30% oder 10% der Lebenszeit sanft aus.
20) Neuer Befehl: MP_ParticleChangeColor(Entity, RGB, kind); change color over livetime with fadeout function. Partikelfarbe wird gewechselt mit Ausblendeeffekt
21) Neuer Befehl: MP_CreateOneShotEmitter (Part, x.f, y.f, z.f, MaxParticle, ReleaseParticle,Interval.f, MinTime.f, MaxTime.f); Creat a oneshot partticle emmiter: Erzeugt eine oneshot particleemmiter
22) Neuer Befehl: MP_3DZto2D (z.f) ; get the 2d z position from a 3d position. Bestimmt die 2D Entfernung z im 3D Raum
23) Befehl erweitert: MP_TextSetZ(z.f) ; See-deep of text, now with 3d z float, text could use in 3d space. Sichttiefe des Textes als 3D Wert, 0 = Front, z.f = weiter im Hintergrund
24) Befehl erweitert: MP_SpriteSetZ(z.f) ; See-deep of Sprite, now with 3d z float, sprite could use as billboard. Sichttiefe des Sprite als 3D Wert, 0 = Front, z.f = weiter im Hintergrund
25) Neuer Befehl: MP_ChangeMeshcoord(Entity) ; change the vertex coords with the position and turning of the meshmatrix; Ändert die Coordinaten der Vertexe in Richtung die das Mesh gedreht oder positioniert wurde
Working on - MP3D Library - PB 5.73 version ready for download
Re: MP3D Engine Alpha 31
thank you Michael for the new version.
the new funtion "MP_SaveMesh" which save the model to x format makes MP3D a kind of a modelling program .
as a proof for the new users here is a program to create a sphere click on it to make holes in it then when we exit the program will save the mesh as a model.x . just save first the texture http://s15.postimage.org/c6q54l4tn/texture.png to the same folder.
now run the second program to load the model.x file and you will see the model with the holes you have made. open the model.x file with any modelling software to view it textured
PS:
i have found also that we can save the models transformed mathematically into model.x , this is great and resembles what an expensive wolfram mathematica program do, we design klein bottle or mobius strip mathematicaly and save it to model. as an example the deformation example in :MP3D Demos\Mesh>MP_Bewegende Objekte.pb we wait 10 seconds after enough deformation and save the model, we open it in milkshape and waw it is a real model deformed.
try the example modified to save the model after 10 seconds and exit. if i don't want to use MP3D then this feature alone will force me to use it for making mathematical models.
look the mathematically constructed "A model" here: http://www.purebasic.fr/english/viewtop ... 20#p383932
just insert MP_SaveMesh("A_model.x",plane) after the latest "wend" and when you exit it will save a splended textured 3D A letter, i have opened it in milkshape and saved it as 3ds file. here is the result of the A_model converted by milkshape to textured 3ds file

thank you Michael for this great feature.
PS-2: if i install v 31 on a fresh purebasic then when we run mp3d program an error message file not found d3d9.lib ,Dinput8.lib and so on. but if we install v 30 before then v 31 it will work
i think this is the paths:
C:\PureBasic\Windows\Libraries
C:\PureBasic\PureLibraries\Windows\Libraries
the new funtion "MP_SaveMesh" which save the model to x format makes MP3D a kind of a modelling program .
as a proof for the new users here is a program to create a sphere click on it to make holes in it then when we exit the program will save the mesh as a model.x . just save first the texture http://s15.postimage.org/c6q54l4tn/texture.png to the same folder.
Code: Select all
;depends on MP_PickingTriangle.pb and MP_ChessShadow MP3D examples
Global xres=800, yres=600
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "press R to rotate")
;MP_Wireframe(1)
camera=MP_CreateCamera()
light=MP_CreateLight(2)
MP_PositionEntity(light, 10 , 20, -1)
;MP_InitShadow(1)
Width=256
Height=256
texture = MP_LoadTexture("texture.png")
sphere = MP_CreateSphere(30)
;sphere = MP_LoadMesh("model.x")
MP_EntitySetTexture(sphere, texture)
MP_ScaleMesh(sphere, 4, 4,4)
MP_RotateEntity(sphere, 180, 0, 0)
cam0 = MP_CreateCamera()
MP_PositionCamera(cam0, -150, 90, -140)
MP_RotateCamera(cam0, 47, 0, -30)
rot.l=0
MP_RotateEntity(sphere, rot, 0, 0)
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
MP_PositionCamera (Camera, 10, 5, 6)
MP_CameraLookAt(Camera,MP_EntityGetX(plane),MP_EntityGetY(plane),MP_EntityGetZ(plane))
If MP_KeyDown(#PB_Key_R)
rot + 1
MP_RotateEntity(sphere, rot, 0, 0)
EndIf
If MP_MouseButtonDown(0)
If key = 0
pickedmesh = MP_PickCamera(cam0, WindowMouseX(0),WindowMouseY(0))
triangleindex = MP_PickedGetTriangle();
If triangleindex; And pickedmesh = plane
MP_FreeTriangle(pickedmesh, triangleindex)
key = 1
EndIf
EndIf
EndIf
If MP_MouseButtonUp(0)
key = 0
EndIf
MP_RenderWorld()
MP_Flip ()
Wend
MP_SaveMesh("model.x",sphere)
Code: Select all
Global xres=800, yres=600
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "")
;MP_Wireframe(1)
camera=MP_CreateCamera()
light=MP_CreateLight(2)
MP_PositionEntity(light, 10 , 20, -1)
;MP_InitShadow(1)
texture = MP_LoadTexture("texture.png")
sphere = MP_LoadMesh("model.x")
MP_EntitySetTexture(sphere, texture)
MP_ScaleMesh(sphere, 1, 1,1)
MP_RotateEntity(sphere, 180, 0, 0)
cam0 = MP_CreateCamera()
MP_PositionCamera(cam0, -150, 90, -140)
MP_RotateCamera(cam0, 47, 0, -30)
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
MP_PositionCamera (Camera, 10, 5, 6)
MP_CameraLookAt(Camera,MP_EntityGetX(plane),MP_EntityGetY(plane),MP_EntityGetZ(plane))
If MP_KeyDown(#PB_Key_R)
rot + 1
MP_RotateEntity(sphere, rot, 0, 0)
EndIf
MP_TurnEntity(sphere, 0.5, 0, 0)
MP_RenderWorld()
MP_Flip ()
Wend
i have found also that we can save the models transformed mathematically into model.x , this is great and resembles what an expensive wolfram mathematica program do, we design klein bottle or mobius strip mathematicaly and save it to model. as an example the deformation example in :MP3D Demos\Mesh>MP_Bewegende Objekte.pb we wait 10 seconds after enough deformation and save the model, we open it in milkshape and waw it is a real model deformed.
try the example modified to save the model after 10 seconds and exit. if i don't want to use MP3D then this feature alone will force me to use it for making mathematical models.
Code: Select all
;////////////////////////////////////////////////////////////////
;//
;// Project Title: MP 3D Engine
;// File Title: Bewegende Objekte2.pb
;// Created On: 26.11.2008
;// Updated On:
;// Author: Michael Paulwitz
;// OS:Windows
;//
;// Teapot is changed
;// Teekanne wird verنndert
;//
;////////////////////////////////////////////////////////////////
;-
;- ProgrammStart
MP_Graphics3D (640,480,0,3) ; Erstelle ein WindowsFenster #Window = 0
SetWindowTitle(0, "Teapot is changed") ; So soll es heissen
camera=MP_CreateCamera() ; Kamera erstellen
x.f=0 : y.f=0 : z.f = -4
MP_PositionCamera(camera,x.f,y.f,z.f) ; Kameraposition
light=MP_CreateLight(1) ; Es werde Licht
cube=MP_CreateTeapot() ; Nen Würfel
;cube=MP_Create3DText ("Times", "MP 3D Engine", 30) ; Oder 3D schrift
For n = 0 To MP_CountVertices(cube)-1
farbea.l = Random(255)
farbeb.l = Random(255)
farbec.l = Random(255)
MP_VertexSetColor (cube,n,RGB(farbea,farbeb,farbec))
Next
StartTime = ElapsedMilliseconds()
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder schliessen
For n = 0 To MP_CountVertices(cube)-1
x.f = MP_VertexGetX (cube,n)
y.f = MP_VertexGetY (cube,n)
z.f = MP_VertexGetZ (cube,n)
zufall.f = (Random (1000)-500)/100000
MP_VertexSetX (cube,n, x + zufall)
MP_VertexSetY (cube,n, y + zufall)
MP_VertexSetZ (cube,n, z + zufall)
Next
ElapsedTime = ElapsedMilliseconds()-StartTime
If ElapsedTime >= 10000
MP_SaveMesh("teapot.x",cube)
break
EndIf
MP_DrawText (10,10,"Lنuft mit "+Str(MP_FPS ())+" FPS") ; Textanzeige an Position x,y, Farbe RGB und Text$
MP_TurnEntity (cube,0.05,0.5,1) ; Würfel Drehen
MP_RenderWorld () ; Hier gehts los
MP_Flip () ;
Wend
End
just insert MP_SaveMesh("A_model.x",plane) after the latest "wend" and when you exit it will save a splended textured 3D A letter, i have opened it in milkshape and saved it as 3ds file. here is the result of the A_model converted by milkshape to textured 3ds file

thank you Michael for this great feature.
PS-2: if i install v 31 on a fresh purebasic then when we run mp3d program an error message file not found d3d9.lib ,Dinput8.lib and so on. but if we install v 30 before then v 31 it will work
i think this is the paths:
C:\PureBasic\Windows\Libraries
C:\PureBasic\PureLibraries\Windows\Libraries