GetScreenToWorldRay() and GetScreenToWorldRayEx() added
This commit is contained in:
parent
52954882a0
commit
7275646a1d
2 changed files with 43 additions and 1 deletions
|
@ -626,7 +626,9 @@ func UnloadShader(shader Shader) {
|
|||
C.UnloadShader(*cshader)
|
||||
}
|
||||
|
||||
// GetMouseRay - Returns a ray trace from mouse position
|
||||
// GetMouseRay - Get a ray trace from mouse position
|
||||
//
|
||||
// Deprecated: Use [GetScreenToWorldRay] instead.
|
||||
func GetMouseRay(mousePosition Vector2, camera Camera) Ray {
|
||||
cmousePosition := mousePosition.cptr()
|
||||
ccamera := camera.cptr()
|
||||
|
@ -635,6 +637,26 @@ func GetMouseRay(mousePosition Vector2, camera Camera) Ray {
|
|||
return v
|
||||
}
|
||||
|
||||
// GetScreenToWorldRay - Get a ray trace from screen position (i.e mouse)
|
||||
func GetScreenToWorldRay(position Vector2, camera Camera) Ray {
|
||||
cposition := position.cptr()
|
||||
ccamera := camera.cptr()
|
||||
ret := C.GetMouseRay(*cposition, *ccamera)
|
||||
v := newRayFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// GetScreenToWorldRayEx - Get a ray trace from screen position (i.e mouse) in a viewport
|
||||
func GetScreenToWorldRayEx(position Vector2, camera Camera, width, height int32) Ray {
|
||||
cposition := position.cptr()
|
||||
ccamera := camera.cptr()
|
||||
cwidth := (C.int)(width)
|
||||
cheight := (C.int)(height)
|
||||
ret := C.GetMouseRay(*cposition, *ccamera, cwidth, cheight)
|
||||
v := newRayFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// GetCameraMatrix - Returns camera transform matrix (view matrix)
|
||||
func GetCameraMatrix(camera Camera) Matrix {
|
||||
ccamera := camera.cptr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue