Add a new arity to direction! and improve documentation of position!
This commit is contained in:
@@ -162,16 +162,15 @@ of the camera will be set."
|
|||||||
(. camera position)))
|
(. camera position)))
|
||||||
|
|
||||||
(defn position!
|
(defn position!
|
||||||
"Sets the position of `object`. If `object` is a screen, the position of the
|
"Sets the position of the camera in `screen`."
|
||||||
camera will be set."
|
([screen vec-3]
|
||||||
([object vec-3]
|
(position! screen (x vec-3) (y vec-3) (z vec-3)))
|
||||||
(position! object (x vec-3) (y vec-3) (z vec-3)))
|
([screen x-val y-val]
|
||||||
([object x-val y-val]
|
(position! screen x-val y-val nil))
|
||||||
(position! object x-val y-val nil))
|
([screen x-val y-val z-val]
|
||||||
([object x-val y-val z-val]
|
(some->> x-val (x! screen))
|
||||||
(some->> x-val (x! object))
|
(some->> y-val (y! screen))
|
||||||
(some->> y-val (y! object))
|
(some->> z-val (z! screen))))
|
||||||
(some->> z-val (z! object))))
|
|
||||||
|
|
||||||
(defn direction
|
(defn direction
|
||||||
"Returns the direction of the camera in `screen`."
|
"Returns the direction of the camera in `screen`."
|
||||||
@@ -181,10 +180,17 @@ camera will be set."
|
|||||||
|
|
||||||
(defn direction!
|
(defn direction!
|
||||||
"Sets the direction of the camera in `screen`."
|
"Sets the direction of the camera in `screen`."
|
||||||
[screen x-val y-val z-val]
|
([screen x-val y-val z-val]
|
||||||
(let [^Camera camera (u/get-obj screen :camera)]
|
(direction! screen x-val y-val z-val true))
|
||||||
(.lookAt camera x-val y-val z-val)
|
([screen x-val y-val z-val look-at?]
|
||||||
(.update camera)))
|
(let [^Camera camera (u/get-obj screen :camera)]
|
||||||
|
(if look-at?
|
||||||
|
(.lookAt camera x-val y-val z-val)
|
||||||
|
(let [^Vector3 dir-vec (direction screen)]
|
||||||
|
(some->> x-val (x! dir-vec))
|
||||||
|
(some->> y-val (y! dir-vec))
|
||||||
|
(some->> z-val (z! dir-vec))))
|
||||||
|
(.update camera))))
|
||||||
|
|
||||||
(defn up [screen]
|
(defn up [screen]
|
||||||
"Returns the up vector of the camera in `screen`."
|
"Returns the up vector of the camera in `screen`."
|
||||||
|
|||||||
Reference in New Issue
Block a user