From 0eb846360a262e3a13d8f5917df83eb94033538a Mon Sep 17 00:00:00 2001 From: oakes Date: Wed, 29 Jan 2014 22:39:37 -0500 Subject: [PATCH] Allow creating a model from a ModelData --- src/play_clj/g3d.clj | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/play_clj/g3d.clj b/src/play_clj/g3d.clj index 0671a1b..bcc8ae0 100644 --- a/src/play_clj/g3d.clj +++ b/src/play_clj/g3d.clj @@ -5,6 +5,7 @@ [com.badlogic.gdx.graphics.g3d.attributes BlendingAttribute ColorAttribute CubemapAttribute DepthTestAttribute FloatAttribute IntAttribute TextureAttribute] + [com.badlogic.gdx.graphics.g3d.model.data ModelData] [com.badlogic.gdx.graphics.g3d.utils ModelBuilder])) ; environment @@ -54,7 +55,15 @@ (defmacro model "Returns an entity based on [ModelInstance](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/ModelInstance.html)" [& 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! "Calls a single method on a `model`"