Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update :make-pqp-model for directly using glvertices #270

Merged
merged 1 commit into from
Oct 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions irteus/irtgl.l
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,54 @@ if flat option is true, use-flat-shader"
(unless bbox
(send self :calc-bounding-box))
bbox)
(:make-pqpmodel (&key (fat 0))
(let ((m (geo::pqpmakemodel))
v1 v2 v3 (id 0))
(dolist (mesh mesh-list) ;; check triangle model
(let ((tp (cadr (assoc :type mesh))))
(unless (eq tp :triangles)
(warn ";; not supported mesh type -> ~A" tp)
(geo::pqpdeletemodel m)
(return-from :make-pqpmodel nil))))
(setq v1 (float-vector 0 0 0))
(setq v2 (float-vector 0 0 0))
(setq v3 (float-vector 0 0 0))
(geo::pqpbeginmodel m)
(dolist (mesh mesh-list)
(let* ((vlst (cadr (assoc :vertices mesh)))
(idces (cadr (assoc :indices mesh)))
(idlen (* (/ (length idces) 3) 3)))
(cond
(idces
(do ((v 0 (+ v 3)))
((>= v idlen))
(user::c-matrix-row vlst (elt idces v ) v1)
(user::c-matrix-row vlst (elt idces (+ v 1)) v2)
(user::c-matrix-row vlst (elt idces (+ v 2)) v3)
(when (not (= fat 0))
(v+ v1 (scale fat (normalize-vector v1)) v1)
(v+ v2 (scale fat (normalize-vector v2)) v2)
(v+ v3 (scale fat (normalize-vector v3)) v3))
(geo::pqpaddtri m v1 v2 v3 id)
(incf id)
))
(t
(do ((v 0 (+ v 3)))
((>= v (array-dimension vlst 0)))
(user::c-matrix-row vlst v v1)
(user::c-matrix-row vlst (+ v 1) v2)
(user::c-matrix-row vlst (+ v 2) v3)
(when (not (= fat 0))
(v+ v1 (scale fat (normalize-vector v1)) v1)
(v+ v2 (scale fat (normalize-vector v2)) v2)
(v+ v3 (scale fat (normalize-vector v3)) v3))
(geo::pqpaddtri m v1 v2 v3 id)
(incf id)
)))
))
(geo::pqpendmodel m)
m
))
)

;;;
Expand Down