Random Bits of Open Code

Check-in [f8f135ad78]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support on/off for camera and lights in scad
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f8f135ad7843e3ca16c033424404f115e8b32fbc
User & Date: matt 2019-03-30 23:05:22
Context
2019-03-31
04:13
blah check-in: 8d4ff248c7 user: matt tags: trunk
2019-03-30
23:05
Support on/off for camera and lights in scad check-in: f8f135ad78 user: matt tags: trunk
19:44
Added cubev check-in: a01d61627c user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to a3d/a3d.scm.

365
366
367
368
369
370
371
372

373
374

375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
       (conc *indent* "object { Round_Box( <0,0,0>," (vec->string v) "," r ",0) "
	   (pigment->string pigment texture) ;; (if pigment (conc " texture { pigment { color " (color->string pigment) " } } ") "")
	   " }")))))

;; Round_Box(<0,0,0>,<1,0.5,2>, 0.125, 0)
(define (camera location look-at #!key (show #f)) ;; show in scad
  (case *mode*
    ((openscad) (union

		 (translate location (sphere 5 pigment: 'white))
		 (translate look-at  (sphere 5 pigment: 'blue))

		 ))
    ((povray)
     (conc *indent* "camera{ location " (vec->string (vec->pov location))
	     " look_at " (vec->string (vec->pov look-at)) " }"))))

(define (light location pigment #!key (show #f)) ;; show in scad
  (case *mode*
    ((openscad) #f)
    ((povray)
     (conc *indent* "light_source{\n"
	   (or (inc-indent) "") ;; because it is stuck in this conc
	   *indent* (vec->string (vec->pov location)) "\n"
	   *indent* "color " (color->string pigment) "\n"
	   (or (dec-indent) "")
	   *indent* "}" ))))

)







|
>
|
|
>
|






|









365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
       (conc *indent* "object { Round_Box( <0,0,0>," (vec->string v) "," r ",0) "
	   (pigment->string pigment texture) ;; (if pigment (conc " texture { pigment { color " (color->string pigment) " } } ") "")
	   " }")))))

;; Round_Box(<0,0,0>,<1,0.5,2>, 0.125, 0)
(define (camera location look-at #!key (show #f)) ;; show in scad
  (case *mode*
    ((openscad) (if show
		    (union
		     (translate location (sphere 5 pigment: 'white))
		     (translate look-at  (sphere 5 pigment: 'blue))
		     )
		    '()))
    ((povray)
     (conc *indent* "camera{ location " (vec->string (vec->pov location))
	     " look_at " (vec->string (vec->pov look-at)) " }"))))

(define (light location pigment #!key (show #f)) ;; show in scad
  (case *mode*
    ((openscad) (if show (translate location (sphere 5 pigment: pigment) #f)))
    ((povray)
     (conc *indent* "light_source{\n"
	   (or (inc-indent) "") ;; because it is stuck in this conc
	   *indent* (vec->string (vec->pov location)) "\n"
	   *indent* "color " (color->string pigment) "\n"
	   (or (dec-indent) "")
	   *indent* "}" ))))

)