sprite3d clipping

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
vanleth
User
User
Posts: 79
Joined: Sat Jun 28, 2003 4:39 am
Location: Denmark - Valby

sprite3d clipping

Post by vanleth »

Make it possible to clip 3d sprites, like you can do with the ClipSprite() command on traditional sprites.

best regards
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

It would be quite handy indeed!
DeXtr0
User
User
Posts: 58
Joined: Tue Mar 06, 2007 12:49 pm
Location: Belgium
Contact:

Post by DeXtr0 »

I can use that one too :)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

but it is just impossible by the way sprites are handled in DirectX.

better clip your sprites in advance and cast that into different sprites you could use as textures.

Sprite3D only can use complete sprites, it's the basic Texture-Function of DX.
oh... and have a nice day.
DeXtr0
User
User
Posts: 58
Joined: Tue Mar 06, 2007 12:49 pm
Location: Belgium
Contact:

Post by DeXtr0 »

Hey Kauru,

I understand your answer 100% but for this issue below i could use Sprite 3D clipping.
Maybe you can help me locate the "code-error" I have in this code snippet of me (which is a kinda-workaround to use clipsprite):

Code: Select all

          ClipSprite(BitmapText(id)\id,BitmapText(id)\CharXPos*BitmapText(id)\CharWidth,BitmapText(id)\CharYPos*BitmapText(id)\CharHeight,BitmapText(id)\CharWidth,BitmapText(id)\CharHeight)
          
          UseBuffer(BitmapText(id)\id+99699) 
          
          DisplaySprite(BitmapText(id)\id,BitmapText(id)\XPos+(i-1)*BitmapText(id)\CharWidth,BitmapText(id)\YPos)       
          
          UseBuffer(-1)     
          
          ; THIS CODE SHOULD WORK BUT SHOWS BLACK SCREEN :(
          Start3D()
            DisplaySprite3D(BitmapText(id)\id+99699,BitmapText(id)\XPos+(i-1)*BitmapText(id)\CharWidth,BitmapText(id)\YPos, 128)
          Stop3D()
It looks logic to me but it shows a black screen.
BitmapText(id)\id+99699 refers to a 3D sprite i created before

What i'm trying to do is this:
I'm clipping the 2D sprite to show the correct character of my 2D bitmapfont.
Next I use UseBuffer to draw that on the 3D sprite
I switch back to the normal buffer and try to display the 3D sprite.

I'm definately missing something or doing something that is not "classic" or not even allowed.

Do you have any idea ?

regards,
DeXtr0
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> Do you have any idea ?

first quick idea: is the dimension of your sprite3D a square with a size that's a power of two?

actually, I discovered problems with that quite a while ago..
I was trying to use a Sprite3D as Buffer to display an olkskool gamescreen with double-sized pixels..

I didn't manage to make it work then, but I only spent half an hour and threw it,
because I wanted to get a quick result and the doublesized pixels were only an additional idea...

sorry... I'm short of time at the moment... be back later...
oh... and have a nice day.
DeXtr0
User
User
Posts: 58
Joined: Tue Mar 06, 2007 12:49 pm
Location: Belgium
Contact:

Post by DeXtr0 »

Hey Kaeru,

The Sprite3D is indeed created as a square: Size 32x32:

Code: Select all

  CreateSprite(BitmapText(id)\id+99699,32,32,#PB_Sprite_Texture )
  Result = CreateSprite3D(BitmapText(id)\id+99699,id+99699)
 
I first thought this was the problem too.
I only create the 3D sprite once. I'm not required to create the 3D sprite everytime in the loop am I ?

If you need more information, let me know. I can use some help here since I'm stuck :cry:

Regards,
DeXtr0

P..S I have the same purpose as you: It will be used for some oldskool effects :roll:
Post Reply