Sprite3DReal Userlibrary

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Stefan, this example is another way to see what's happening with current S3DR lib.
At the left side there is a normal cube mesh rotated 45 degrees over X axis.
At right side there is a cube mesh design with a 45 degrees over X axis.
Then, when both figures are displayed you can rotate it over Y axis (with cursor keys left and right) and then you can see that something is wrong:

Code: Select all

#PI=3.14159265
InitSprite():InitSprite3D():InitKeyboard()
OpenScreen(1024,768,32,"")

UsePNGImageDecoder()
LoadSprite(1,"yourspritehere",#PB_Sprite_Texture); <- a 256x256x8 graph image should be good
S3DR_CreateZBuffer()

;Create the cube
Start3D():S3DR_BeginReal3D()
S3DR_StartCreateMesh()
S3DR_CreateMesh_AddQuad(-1, 1, 1,-1, 1,-1,-1,-1, 1,-1,-1,-1);<-cara izquierda
S3DR_CreateMesh_AddQuad( 1,-1, 1,-1,-1, 1, 1,-1,-1,-1,-1,-1);<-cara de abajo
S3DR_CreateMesh_AddQuad(-1, 1, 1, 1, 1, 1,-1, 1,-1, 1, 1,-1);<-cara de arriba
S3DR_CreateMesh_AddQuad(1,1,1,-1,1,1,1,-1,1,-1,-1,1);<-cara de atras
S3DR_CreateMesh_AddQuad(-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1);<-cara de enfrente
S3DR_CreateMesh_AddQuad( 1, 1,-1, 1, 1, 1, 1,-1,-1, 1,-1, 1);<-cara derecha
Cube=S3DR_StopCreateMesh()
S3DR_EndReal3D():Stop3D()

;Create a cube rotated 45 degrees over X axis
Start3D():S3DR_BeginReal3D()
S3DR_StartCreateMesh()
 S3DR_CreateMesh_AddQuad(-1,Sqr(2),0,-1,0,-Sqr(2),-1,0,Sqr(2),-1,-Sqr(2),0);<-cara izquierda
 S3DR_CreateMesh_AddQuad(1,0,Sqr(2),-1,0,Sqr(2),1,-Sqr(2),0,-1,-Sqr(2),0);<-cara de abajo
 S3DR_CreateMesh_AddQuad(-1,Sqr(2),0,1,Sqr(2),0,-1,0,-Sqr(2),1,0,-Sqr(2));<-cara de arriba
 S3DR_CreateMesh_AddQuad(1,Sqr(2),0,-1,Sqr(2),0,1,0,Sqr(2),-1,0,Sqr(2));<-cara de atras
 S3DR_CreateMesh_AddQuad(-1,0,-Sqr(2),1,0,-Sqr(2),-1,-Sqr(2),0,1,-Sqr(2),0);<-cara de enfrente
 S3DR_CreateMesh_AddQuad(1,0,-Sqr(2),1,Sqr(2),0,1,-Sqr(2),0,1,0,Sqr(2));<-cara derecha
Cube2=S3DR_StopCreateMesh()
S3DR_EndReal3D():Stop3D()

Sprite3DQuality(1)

Repeat
  ExamineKeyboard()
  Start3D():S3DR_BeginReal3D()
  S3DR_ClearScreenAndZBuffer(0);<- clear screen in black color
  StartDrawing(ScreenOutput()):Locate(400,200):DrawText("Rotating over world Y axis:")
  Locate(320,240):DrawText("bad done:")
  Locate(640,240):DrawText("well done:"):StopDrawing()
  
  If KeyboardPushed(#PB_Key_Right):angleY.f-0.02:EndIf; <- rotate over Y axis of the world ?
  If KeyboardPushed(#PB_Key_Left):angleY.f+0.02:EndIf; <- rotate over Y axis of the world ?
  S3DR_SelectTexture(1)
  
;********************** DRAWING ****************************
; The cube at the left side, a normal cube mesh rotated 45 degrees over X axis:
  S3DR_DrawMesh(Cube,-2,0,16,-#PI/4,angleY.f,0)
; The cube at the right side, a cube mesh designed rotating 45 degrees over X axis:
  S3DR_DrawMesh(Cube2,2,0,16,0,angleY.f,0)
;********************************************************

  S3DR_EndReal3D():Stop3D()
  FlipBuffers():Delay(16)
Until KeyboardPushed(#PB_Key_Escape)
S3DR_FreeMesh(Cube2); Don't forget to free the Mesh.
S3DR_FreeMesh(Cube); Don't forget to free the Mesh.
Hope you see it.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
S.M.
Enthusiast
Enthusiast
Posts: 118
Joined: Sat Apr 24, 2004 1:11 pm
Contact:

Post by S.M. »

@Psychophanta
Yes, I see...
The problem is, that I don't know how to correct this using Direct3D7.
The only thing I could do at the moment is transforming the vertices
on my own...
Thanks for the example.
Psychophanta wrote:Is it a Direct3D problem????
No, I think it's no issue of Direct3D.
- added ability to use software-rendering
Can someone provide with some example of this?
Just use

Code: Select all

S3DR_CreateZBuffer(#S3DR_SoftwareDevice)
Instead of

Code: Select all

S3DR_CreateZBuffer()
@Shannara
Shannara wrote:I can provide ftp account and download space (no file size limitations) @
http://www.officialmirrors.com
The domain doesn't exist. :? :?:
@djes
djes wrote:Could you add a png loader with alpha layer?
Sorry,but this feature isn't available in Direct3D 7, which is used by my Library.
If I'd write a Library with Direct3D 8,it would be one of the first things on my list.
regards
Stefan
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Why don't use last version of direct 3D ? It should implicate to rewrite all your lib again ? :?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
S.M.
Enthusiast
Enthusiast
Posts: 118
Joined: Sat Apr 24, 2004 1:11 pm
Contact:

Post by S.M. »

Yes, there are many differences between Direct3D7 and Direct3D8/Direct3D9, so I
would need to rewrite nearly all the code.
Another point is,that the 3D-Engine wouldn't be compatible with the other
Libraries of Purebasic (Sprite,Keyboard,Joystick,Sound).
Therefore I would need to write a complete collection of 2D/3D/Sound/Input functions.

On the other hand using Direct3D8/Direct3D9 would have many advantages... :roll:
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

S.M. wrote:Yes, there are many differences between Direct3D7 and Direct3D8/Direct3D9, so I
would need to rewrite nearly all the code.
Another point is,that the 3D-Engine wouldn't be compatible with the other
Libraries of Purebasic (Sprite,Keyboard,Joystick,Sound).
Therefore I would need to write a complete collection of 2D/3D/Sound/Input functions.

On the other hand using Direct3D8/Direct3D9 would have many advantages... :roll:
I wouldn't doubt :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

www.officialmirror.com , i accidently added an "s". :)

Front page won't show anything, but a current list of mirriors are found @ http://www.officialmirror.com/mirrors
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Ok, thanks! I'll be patient ;)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

As a request, you could make a DX9 version for the newest VGAs and keep the DX7 version. :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
S.M.
Enthusiast
Enthusiast
Posts: 118
Joined: Sat Apr 24, 2004 1:11 pm
Contact:

Post by S.M. »

@Shannara
Ok, but what do you want for exchange?
where is the hook ? :wink:

@Psychophanta
Psychophanta wrote: As a request, you could make a DX9 version for the newest VGAs and keep the DX7 version. :)
If I do it, I will use DirectX8, because it works better with older Cards and
I could use the "DirectX8 type library for VB" for loading meshes and textures.
The problem is that it's really much work and I also have many things on my
To-Do-List for the Sprite3DReal-Library.
But, my holidays start in 4 weeks, so maybe I have time for doing it... 8)

Somebody here who wants to help me ? :wink:
regards
Stefan
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

The the best choice now should be to finish the current lib :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

No hook, as I stated to GPI when I hosted a mirror for JaPBe, there are no hooks, I have the spare bandwidth, why not put it to good use? Actually, in all honesty, there are no hooks :) If you can trust me as a download mirror, I can provide you with a ftp account for uploading to the site.
chris_b
Enthusiast
Enthusiast
Posts: 103
Joined: Sun Apr 27, 2003 1:54 am

Post by chris_b »

S.M. wrote:
djes wrote:Could you add a png loader with alpha layer?
Sorry,but this feature isn't available in Direct3D 7, which is used by my Library.
:?: This feature is available in Blitz3D which uses Direct3D 7
Brice Manuel

Post by Brice Manuel »

This feature is available in Blitz3D which uses Direct3D 7
D3D 7 can't load PNGs. Blitz 3D uses a third-party lib for loading images.
xperience2003
Enthusiast
Enthusiast
Posts: 113
Joined: Tue Oct 05, 2004 9:05 pm
Location: germany
Contact:

Post by xperience2003 »

any news , stefan???
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Spritedx9 do the job.
Post Reply