render: scene: Add better printers for primitives, meshes, and scenes.
authorDavid Thompson <dthompson2@worcester.edu>
Thu, 6 Sep 2018 13:24:23 +0000 (09:24 -0400)
committerDavid Thompson <dthompson2@worcester.edu>
Thu, 6 Sep 2018 13:24:23 +0000 (09:24 -0400)
* chickadee/render/scene.scm (display-primitive, display-mesh,
  display-scene-node): New procedures.

chickadee/render/scene.scm

index 279d4e6..8aa6f1f 100644 (file)
   (material primitive-material)
   (targets primitive-targets))
 
+(define (display-primitive primitive port)
+  (format port "#<primitive material: ~s targets: ~s>"
+          (primitive-material primitive)
+          (primitive-targets primitive)))
+
+(set-record-type-printer! <primitive> display-primitive)
+
 (define* (make-primitive #:key
                          vertex-array
                          (material default-material)
   (primitives mesh-primitives)
   (weights mesh-weights))
 
+(define (display-mesh mesh port)
+  (format port "#<mesh name: ~s>" (mesh-name mesh)))
+
+(set-record-type-printer! <mesh> display-mesh)
+
 (define* (make-mesh #:key
                     (name "anonymous")
                     primitives
   (translation scene-node-translation)
   (weights scene-node-weights))
 
+(define (display-scene-node scene port)
+  (format port "#<scene-node name: ~s>" (scene-node-name scene)))
+
+(set-record-type-printer! <scene-node> display-scene-node)
+
 (define* (make-scene-node #:key
                           (name "anonymous")
                           (children #())