dxProjectedY#()

Parameters

None.

Description

Returns the viewport y coordinate of the most recently executed dxCameraProject.

Example

; dxProjectedY Example
; ------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()
dxPositionEntity camera,0,2,-10

light=dxCreateLight()
dxRotateEntity light,90,0,0

plane=dxCreatePlane()
ground_tex=dxLoadTexture("media/Chorme-2.bmp")
dxEntityTexture plane,ground_tex

cube=dxCreateCube()
cube_tex=dxLoadTexture("media/b3dlogo.jpg")
dxEntityTexture cube,cube_tex
dxPositionEntity cube,0,1,0

While Not dxKeyDown( 1 )

If dxKeyDown( 205 )=True Then dxTurnEntity camera,0,-1,0
If dxKeyDown( 203 )=True Then dxTurnEntity camera,0,1,0
If dxKeyDown( 208 )=True Then dxMoveEntity camera,0,0,-0.05
If dxKeyDown( 200 )=True Then dxMoveEntity camera,0,0,0.05

; Use camera project to get 2D coordinates from 3D coordinates of cube
dxCameraProject(camera,dxEntityX(cube),dxEntityY(cube),dxEntityZ(cube))

dxRenderWorld

; If cube is in view then draw dxText, if not then draw nothing otherwise dxText will be drawn at 0,0
If dxEntityInView(cube,camera)=True

; Use dxProjectedX() and dxProjectedY() to get 2D coordinates from when dxCameraProject was used.
; Use these coordinates to draw dxText at a 2D position, on top of a 3D scene.
dxText dxProjectedX#(),dxProjectedY#(),"Cube"

EndIf

dxText 0,0,"Use cursor keys to move about"
dxText 0,20,"dxProjectedX: "+dxProjectedX#()
dxText 0,40,"dxProjectedY: "+dxProjectedY#()
dxText 0,60,"dxProjectedZ: "+dxProjectedZ#()
dxText 0,80,"dxEntityInView: "+dxEntityInView(cube,camera)

dxFlip

Wend

End

Index