lib/gamnit: extract placeholder model
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 16 Apr 2016 16:06:19 +0000 (12:06 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Fri, 20 May 2016 20:13:42 +0000 (16:13 -0400)
This model can be useful when quickly writing the prototype of a game
to get something visible in the 3D space.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/depth/more_models.nit

index a126223..7ab732d 100644 (file)
@@ -50,7 +50,7 @@ class ModelAsset
 
                if leaves.is_empty then
                        # Nothing was loaded, use a cube with the default material
-                       var leaf = new LeafModel(new Cube, new SmoothMaterial.default)
+                       var leaf = placeholder_model
                        leaves.add leaf
                end
        end
@@ -383,4 +383,9 @@ redef class Sys
 
        # All instantiated asset models
        var models = new Set[ModelAsset]
+
+       # Blue cube of 1 unit on each side, acting as placeholder for models failing to load
+       #
+       # This model can be freely used by any `Actor` as placeholder or for debugging.
+       var placeholder_model = new LeafModel(new Cube, new SmoothMaterial.default) is lazy
 end