Commit 9adfb99e authored by Dave Cooper's avatar Dave Cooper
Browse files

billboard support for x3d

parent c5c2357f
...@@ -204,7 +204,8 @@ to the src/ directory distributed with GDL. ...@@ -204,7 +204,8 @@ to the src/ directory distributed with GDL.
:objects :objects
((base :type 'robot-base ((base :type 'robot-base
:display-controls (merge-display-controls (list :color :blue-sky)) :display-controls (append (merge-display-controls (list :color :blue-sky))
(list :billboard t))
:height (* (the height) 0.4) :height (* (the height) 0.4)
:width (* (the :width) 0.2) :width (* (the :width) 0.2)
:length (* (the :length) 0.2) :length (* (the :length) 0.2)
...@@ -223,8 +224,10 @@ to the src/ directory distributed with GDL. ...@@ -223,8 +224,10 @@ to the src/ directory distributed with GDL.
(center-sphere :type 'sphere :radius 0.1) (center-sphere :type 'sphere :radius 0.1)
(rob-text :type 'general-note (rob-text :type 'general-note
:display-controls (list :billboard t)
:orientation (alignment :top (the (face-normal-vector :rear))) :orientation (alignment :top (the (face-normal-vector :rear)))
:strings "Bob" :strings "Bob"
:center (the center)) :center (the center))
......
...@@ -190,10 +190,37 @@ ...@@ -190,10 +190,37 @@
(format nil "~3,7f ~3,7f ~3,7f ~3,7f" (format nil "~3,7f ~3,7f ~3,7f ~3,7f"
(get-x rotation) (get-y rotation) (get-z rotation) (get-w rotation)))) (get-x rotation) (get-y rotation) (get-z rotation) (get-w rotation))))
;;
;; FLAG -- revert to proper conditional (cond ((and *onclick-function* (or (getf (the display-controls) :billboard)
;; (getf (the display-controls) :billboard-vector)))
(write-the shape)) (cl-who:htm
((:|Anchor| :url (format nil "javascript:~a;"
(funcall *onclick-function* self)))
((:|Billboard| :|axisOfRotation| (if (getf (the display-controls) :billboard-vector)
(let ((vector (getf (the display-controls) :billboard-vector)))
(format nil "~a, ~a, ~a" (get-x vector) (get-y vector) (get-z vector)))
(format nil "0, 0, 0")))
(write-the shape)))))
(*onclick-function*
(cl-who:htm
((:|Anchor| :url (format nil "javascript:~a;"
(funcall *onclick-function* self)))
(write-the shape))))
((or (getf (the display-controls) :billboard)
(getf (the display-controls) :billboard-vector))
(cl-who:htm
((:|Billboard| :|axisOfRotation|
(if (getf (the display-controls) :billboard-vector)
(let ((vector (getf (the display-controls) :billboard-vector)))
(format nil "~a, ~a, ~a" (get-x vector) (get-y vector) (get-z vector)))
(format nil "0, 0, 0")))
(write-the shape))))
(t (write-the shape))))
(when (and (typep self 'outline-specialization-mixin) (when (and (typep self 'outline-specialization-mixin)
(not (ignore-errors (typep self (read-from-string "surf:surface")))) (not (ignore-errors (typep self (read-from-string "surf:surface"))))
...@@ -246,13 +273,36 @@ ...@@ -246,13 +273,36 @@
(if (null (the children)) (if (null (the children))
(cond ((and *onclick-function* (or (getf (the display-controls) :billboard)
(getf (the display-controls) :billboard-vector)))
(cl-who:htm
((:|Anchor| :url (format nil "javascript:~a;"
(funcall *onclick-function* self)))
((:|Billboard| :|axisOfRotation| (if (getf (the display-controls) :billboard-vector)
(let ((vector (getf (the display-controls) :billboard-vector)))
(format nil "~a ~a ~a" (get-x vector) (get-y vector) (get-z vector)))
(format nil "0 0 0")))
(if (and (find-package :gwl) *onclick-function*) (write-the shape)))))
(cl-who:htm
((:|Anchor| :url (format nil "javascript:~a;" (*onclick-function*
(funcall *onclick-function* self))) (cl-who:htm
(write-the shape))) ((:|Anchor| :url (format nil "javascript:~a;"
(write-the shape)) (funcall *onclick-function* self)))
(write-the shape))))
((or (getf (the display-controls) :billboard)
(getf (the display-controls) :billboard-vector))
(cl-who:htm
((:|Billboard| :|axisOfRotation|
(if (getf (the display-controls) :billboard-vector)
(let ((vector (getf (the display-controls) :billboard-vector)))
(format nil "~a ~a ~a" (get-x vector) (get-y vector) (get-z vector)))
(format nil "0 0 0")))
(write-the shape))))
(t (write-the shape)))
(mapc #'(lambda(child) (mapc #'(lambda(child)
(write-the-object child (cad-output-tree :header? nil :from-root? nil))) (the children))) (write-the-object child (cad-output-tree :header? nil :from-root? nil))) (the children)))
...@@ -265,8 +315,8 @@ ...@@ -265,8 +315,8 @@
(let* ((center (reverse-vector (the center))) (let* ((center (reverse-vector (the center)))
(x (get-x center)) (y (get-y center)) (z (get-z center)) (x (get-x center)) (y (get-y center)) (z (get-z center))
(inverse (when (the orientation*) (inverse (when (the orientation*)
#+nil
(quaternion-to-rotation (matrix-to-quaternion (matrix:transpose-matrix (the orientation*)))) (quaternion-to-rotation (matrix-to-quaternion (matrix:transpose-matrix (the orientation*))))
#+nil
(matrix-to-rotation (matrix:transpose-matrix (the orientation*)))))) (matrix-to-rotation (matrix:transpose-matrix (the orientation*))))))
(cl-who:htm (cl-who:htm
((:|Transform| :|translation| (when (not (every #'zerop (list x y z))) ((:|Transform| :|translation| (when (not (every #'zerop (list x y z)))
...@@ -492,7 +542,7 @@ ...@@ -492,7 +542,7 @@
(:|Appearance| (write-the material-properties)) (:|Appearance| (write-the material-properties))
(format *stream* "<Text string='\"~a\"' solid='false'> (format *stream* "<Text string='\"~a\"' solid='false'>
<FontStyle size='1' justify='MIDDLE'></FontStyle> <FontStyle size='10' justify='MIDDLE'></FontStyle>
</Text>" (the %text-to-draw%)))) </Text>" (the %text-to-draw%))))
......
("package")
\ No newline at end of file
...@@ -4,83 +4,87 @@ ...@@ -4,83 +4,87 @@
:author :author
"Genworks and Dave Cooper unless otherwise indicated" "Genworks and Dave Cooper unless otherwise indicated"
:license "AGPL unless otherwise indicated" :serial t :license "AGPL unless otherwise indicated" :serial t
:version "2012011800" :depends-on (:lift :gdl-surf :gdl-tasty) :version "2012072600" :depends-on
:components (:lift :gdl-surf :gdl-tasty) :components
((:file "utils/source/package") ((:lisp "utils/source/package")
(:file "utils/source/genworks") (:lisp "utils/source/genworks")
(:file "utils/source/functions") (:lisp "utils/source/functions")
(:file "utils/source/parameters") (:lisp "utils/source/parameters")
(:file "geom-base/source/box-matrix") (:lisp "assembly-output/source/package")
(:file "source/package") (:file "source/parameters") (:lisp "assembly-output/source/bracket")
(:file "source/approximated-curve") (:lisp "geom-base/source/box-matrix")
(:file "source/arc-curve") (:lisp "source/package") (:lisp "source/parameters")
(:file "source/b-spline-curve") (:lisp "source/approximated-curve")
(:file "source/b-spline-surface") (:lisp "source/arc-curve")
(:file "source/blended-solid") (:lisp "source/b-spline-curve")
(:file "source/boolean") (:file "source/box-solid") (:lisp "source/b-spline-surface")
(:file "source/boxed-curve") (:lisp "source/blended-solid")
(:file "source/boxed-surface") (:lisp "source/boolean") (:lisp "source/box-solid")
(:file "source/brep-brep-solve") (:lisp "source/boxed-curve")
(:file "source/brep-intersect") (:lisp "source/boxed-surface")
(:file "source/compatible-curves") (:lisp "source/brep-brep-solve")
(:file "source/compatible-surfaces") (:lisp "source/brep-intersect")
(:file "source/composed-curve") (:lisp "source/compatible-curves")
(:file "source/composed-curves") (:lisp "source/compatible-surfaces")
(:file "source/cone-solid") (:lisp "source/composed-curve")
(:file "source/cylinder-solid") (:lisp "source/composed-curves")
(:file "source/decomposed-curves") (:lisp "source/cone-solid")
(:file "source/dropped-curve") (:lisp "source/cylinder-solid")
(:file "source/dual-blend-surface") (:lisp "source/decomposed-curves")
(:file "source/edge-blend-surface") (:lisp "source/dropped-curve")
(:file "source/elliptical-curve") (:lisp "source/dual-blend-surface")
(:file "source/extended-surface") (:lisp "source/edge-blend-surface")
(:file "source/extruded-solid") (:lisp "source/elliptical-curve")
(:file "source/fitted-conic") (:lisp "source/extended-surface")
(:file "source/fitted-curve") (:lisp "source/extruded-solid")
(:file "source/fitted-surface") (:lisp "source/fitted-conic")
(:file "source/gdlxml") (:lisp "source/fitted-curve")
(:file "source/general-dual-blend-surface") (:lisp "source/fitted-surface")
(:file "source/general-sweep") (:lisp "source/gdlxml")
(:file "source/global-filleted-polyline-curves") (:lisp "source/general-dual-blend-surface")
(:file "source/iges-reader") (:lisp "source/general-note")
(:file "source/iges-writer") (:lisp "source/general-sweep")
(:file "source/intersected-solid") (:lisp "source/global-filleted-polyline-curves")
(:file "source/iso-curve") (:lisp "source/iges-reader")
(:file "source/joined-surfaces") (:lisp "source/iges-writer")
(:file "source/linear-curve") (:lisp "source/intersected-solid")
(:file "source/lofted-surface") (:lisp "source/iso-curve")
(:file "source/merged-solid") (:lisp "source/joined-surfaces")
(:file "source/native-reader") (:lisp "source/linear-curve")
(:file "source/pegasus-regioned-solid") (:lisp "source/lofted-surface")
(:file "source/planar-contour-surface") (:lisp "source/merged-solid")
(:file "source/planar-offset-curve") (:lisp "source/native-reader")
(:file "source/planar-section-curve") (:lisp "source/orientations")
(:file "source/planar-section-curves") (:lisp "source/pegasus-regioned-solid")
(:file "source/planar-surface") (:lisp "source/planar-contour-surface")
(:file "source/poly-brep") (:lisp "source/planar-offset-curve")
(:file "source/projected-curve") (:lisp "source/planar-section-curve")
(:file "source/rectangular-surface") (:lisp "source/planar-section-curves")
(:file "source/regioned-solid") (:lisp "source/planar-surface")
(:file "source/reparameterized-curve") (:lisp "source/poly-brep")
(:file "source/revolved-surface") (:lisp "source/projected-curve")
(:file "source/revolved-surfaces") (:lisp "source/rectangular-surface")
(:file "source/ruled-surface") (:lisp "source/regioned-solid")
(:file "source/separated-solid") (:lisp "source/reparameterized-curve")
(:file "source/sewn-solid") (:lisp "source/revolved-surface")
(:file "source/shelled-solid") (:lisp "source/revolved-surfaces")
(:file "source/silhouette-curves") (:lisp "source/ruled-surface")
(:file "source/spherical-surface") (:lisp "source/separated-solid")
(:file "source/split-surface") (:lisp "source/sewn-solid")
(:file "source/step-reader") (:lisp "source/shelled-solid")
(:file "source/step-writer") (:lisp "source/silhouette-curves")
(:file "source/stitched-solid") (:lisp "source/spherical-surface")
(:file "source/subtracted-solid") (:lisp "source/split-surface")
(:file "source/surface-knot-reduction") (:lisp "source/step-reader")
(:file "source/swept-solid") (:lisp "source/step-writer")
(:file "source/test-harness") (:lisp "source/stitched-solid")
(:file "source/transformed-curve") (:lisp "source/subtracted-solid")
(:file "source/transformed-solid") (:lisp "source/surface-knot-reduction")
(:file "source/transformed-surface") (:lisp "source/swept-solid")
(:file "source/trimmed-curve") (:lisp "source/test-harness")
(:file "source/trimmed-surface") (:lisp "source/transformed-curve")
(:file "source/united-solid"))) (:lisp "source/transformed-solid")
\ No newline at end of file (:lisp "source/transformed-surface")
(:lisp "source/trimmed-curve")
(:lisp "source/trimmed-surface")
(:lisp "source/united-solid")))
\ No newline at end of file
...@@ -6,17 +6,14 @@ ...@@ -6,17 +6,14 @@
( (
(center-sphere :type 'sphere (center-sphere :type 'sphere
:radius .1) :radius .1)
(box :type 'box :length 10 :width 10 :height 10
:display-controls (list :transparency 0.7 :color :orange))
(note :type 'general-note (note :type 'general-note
:display-controls (list :color (list .32 .54 .26) :display-controls (list :color (list .32 .54 .26)
:specular-color (list 0.46 0.46 0.46) :specular-color (list 0.46 0.46 0.46)
:ambient-intensity 0.0933) :ambient-intensity 0.0933
:billboard t)
:strings "Hey Now") :strings "Hey Now")
(kid :type 'general-note-kid (kid :type 'general-note-kid
:center (translate (the center) :rear 10)) :center (translate (the center) :rear 10))
...@@ -30,14 +27,12 @@ ...@@ -30,14 +27,12 @@
((center-sphere :type 'sphere ((center-sphere :type 'sphere
:radius .1) :radius .1)
(box :type 'box :length 10 :width 10 :height 10
:display-controls (list :transparency 0.7 :color :orange))
(note :type 'general-note (note :type 'general-note
:display-controls (list :color (list .32 .54 .26) :display-controls (list :color (list .32 .54 .26)
:billboard t
:specular-color (list 0.46 0.46 0.46) :specular-color (list 0.46 0.46 0.46)
:ambient-intensity 0.0933) :ambient-intensity 0.0933)
:strings "Hey Now") :strings "Hey Now kid")
)) ))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment