Posted: Sat Feb 26, 2005 7:06 pm
@Psychophanta
Is S3DR_TestCollision() not enough ?
regards
Stefan
Is S3DR_TestCollision() not enough ?

regards
Stefan
http://www.purebasic.com
https://www.purebasic.fr/english/
Hi,S.M. wrote:@Psychophanta
Is S3DR_TestCollision() not enough ?![]()
regards
Stefan
Code: Select all
- S3DR_FreeZBuffer() is called automatically
- Converter for x-files added
- support for Meshes
I see.S.M. wrote:@Psychophanta
neither stopped nor aborted. I hadn't much free time.
But here is a new version:![]()
Sprite3DReal v1.2
Code: Select all
Global SprWidth.l
Global SprHeight.l
InitSprite()
InitSprite3D()
InitKeyboard()
OpenWindow(1,0,0,800,600,#PB_Window_ScreenCentered,"Texture Coordinates")
OpenWindowedScreen(WindowID(),0,0,800,600,0,0,0)
S3DR_CreateZBuffer()
;LoadSprite(1, "grass.bmp",#PB_Sprite_Texture)
CreateSprite(1, 32,32,#PB_Sprite_Texture)
StartDrawing(SpriteOutput(1))
Box(0,0,32,32,RGB(255,255,255))
StopDrawing()
SprWidth = SpriteWidth(1)
SprHeight = SpriteHeight(1)
Quit = #False
Repeat
EventID.l = WindowEvent()
If EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
Quit = #True
EndIf
Start3D()
S3DR_BeginReal3D()
S3DR_ClearScreenAndZBuffer(#blue)
S3DR_SelectTexture(1)
S3DR_SetDiffuseColors(RGB(0,255,0),RGB(255,0,0),RGB(0,0,255),RGB(0,0,0))
;S3DR_SetDiffuseColors(RGB(0,0,255),RGB(0,0,255),RGB(0,0,255),RGB(0,0,255))
X1=10
Y1=10
X2=SprWidth-10
Y2=10
X3=10
Y3=SprHeight-10
X4=SprWidth-10
Y4=SprHeight-10
;convert the pixel-coordinates to texture-coordinates.
TU1.f=X1/SprWidth
TV1.f=Y1/SprHeight
TU2.f=X2/SprWidth
TV2.f=Y2/SprHeight
TU3.f=X3/SprWidth
TV3.f=Y3/SprHeight
TU4.f=X4/SprWidth
TV4.f=Y4/SprHeight
; tu1,tv1 tu2,tv2
; +---------+
; | |
; | |
; | |
; | |
; | |
; +---------+
; tu3,tv3 tu4,tv4
S3DR_SetTextureCoordinates(TU1.f,TV1.f,TU2.f,TV2.f,TU3.f,TV3.f,TU4.f,TV4.f)
; X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3 X4 Y4 Z4
S3DR_Draw3D( -1, 1, 5, 1, 1, 5, -1, -1, 5, 1, -1, 5);draws the selected sprite
S3DR_EndReal3D()
Stop3D()
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
Quit = #True
EndIf
Until Quit = #True
S3DR_FreeZBuffer()