Allow creating a model from a ModelData
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
[com.badlogic.gdx.graphics.g3d.attributes BlendingAttribute
|
[com.badlogic.gdx.graphics.g3d.attributes BlendingAttribute
|
||||||
ColorAttribute CubemapAttribute DepthTestAttribute FloatAttribute
|
ColorAttribute CubemapAttribute DepthTestAttribute FloatAttribute
|
||||||
IntAttribute TextureAttribute]
|
IntAttribute TextureAttribute]
|
||||||
|
[com.badlogic.gdx.graphics.g3d.model.data ModelData]
|
||||||
[com.badlogic.gdx.graphics.g3d.utils ModelBuilder]))
|
[com.badlogic.gdx.graphics.g3d.utils ModelBuilder]))
|
||||||
|
|
||||||
; environment
|
; environment
|
||||||
@@ -54,7 +55,15 @@
|
|||||||
(defmacro model
|
(defmacro model
|
||||||
"Returns an entity based on [ModelInstance](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/ModelInstance.html)"
|
"Returns an entity based on [ModelInstance](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/ModelInstance.html)"
|
||||||
[& args]
|
[& args]
|
||||||
`(u/create-entity (ModelInstance. ~@args)))
|
`(u/create-entity
|
||||||
|
(let [arg1# ~(first args)]
|
||||||
|
(cond
|
||||||
|
(:object arg1#)
|
||||||
|
(ModelInstance. ^ModelInstance (:object arg1#))
|
||||||
|
(isa? arg1# ModelData)
|
||||||
|
(ModelInstance. ^Model (Model. ~@args))
|
||||||
|
:else
|
||||||
|
(ModelInstance. ~@args)))))
|
||||||
|
|
||||||
(defmacro model!
|
(defmacro model!
|
||||||
"Calls a single method on a `model`"
|
"Calls a single method on a `model`"
|
||||||
|
|||||||
Reference in New Issue
Block a user