Mercurial > cortex
comparison org/skin.org @ 14:3aa1ee6c6308
touch-debug partially works
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 23 Oct 2011 11:30:42 -0700 |
parents | 0eb2eac53361 |
children | c32f3eb9fdeb |
comparison
equal
deleted
inserted
replaced
13:0eb2eac53361 | 14:3aa1ee6c6308 |
---|---|
111 (triangles geom)))) | 111 (triangles geom)))) |
112 | 112 |
113 | 113 |
114 (defn collision-debug [node result] | 114 (defn collision-debug [node result] |
115 (println-repl "contact point: " (.getContactPoint result)) | 115 (println-repl "contact point: " (.getContactPoint result)) |
116 | |
117 | |
116 ) | 118 ) |
117 | 119 |
118 (defn update-ray-debug [node ray] | 120 (defn update-ray-debug [node ray contacts] |
119 (.setLocalTranslation (.getChild node 1) (.getOrigin ray))) | 121 (let [origin (.getChild node 0)] |
122 (.setLocalTranslation origin (.getOrigin ray)) | |
123 (.setColor (.getMaterial origin) "Color" (contact-color contacts)))) | |
124 | |
125 | |
120 | 126 |
121 | 127 |
122 (defn init-node | 128 (defn init-node |
123 [debug-node rays] | 129 [debug-node rays] |
124 (println-repl "Init touch debug node.") | 130 (println-repl "Init touch debug node.") |
127 (for [ray rays] | 133 (for [ray rays] |
128 (do | 134 (do |
129 (.attachChild | 135 (.attachChild |
130 debug-node | 136 debug-node |
131 (doto (Node.) | 137 (doto (Node.) |
132 (.attachChild (ray-debug ray ColorRGBA/Gray)) | 138 (.attachChild (ray-origin-debug ray ColorRGBA/Gray)) |
133 (.attachChild (ray-origin-debug ray ColorRGBA/Gray)))))))) | 139 ;;(.attachChild (ray-debug ray ColorRGBA/Gray)) |
140 )))))) | |
141 | |
134 | 142 |
135 | 143 |
136 (defn manage-ray-debug-node [debug-node geom touch-data limit] | 144 (defn manage-ray-debug-node [debug-node geom touch-data limit] |
137 (let [rays (normal-rays limit geom)] | 145 (let [rays (normal-rays limit geom)] |
138 (if (not= (count (.getChildren debug-node)) (count touch-data)) | 146 (if (not= (count (.getChildren debug-node)) (count touch-data)) |
139 (init-node debug-node rays)) | 147 (init-node debug-node rays)) |
140 (dorun | 148 (dorun |
141 (for [n (range (count touch-data))] | 149 (for [n (range (count touch-data))] |
142 (update-ray-debug (.getChild debug-node n) (nth rays n)))))) | 150 (update-ray-debug |
151 (.getChild debug-node n) (nth rays n) (nth touch-data n)))))) | |
143 | 152 |
144 | 153 |
145 (defn touch-percieve [limit geom node] | 154 (defn touch-percieve [limit geom node] |
146 (let [normals (normal-rays limit geom)] | 155 (let [normals (normal-rays limit geom)] |
147 | 156 |
222 (.setBlendMode RenderState$BlendMode/Alpha)) | 231 (.setBlendMode RenderState$BlendMode/Alpha)) |
223 (.setQueueBucket RenderQueue$Bucket/Transparent))) | 232 (.setQueueBucket RenderQueue$Bucket/Transparent))) |
224 | 233 |
225 (defn test-skin [] | 234 (defn test-skin [] |
226 (let [b | 235 (let [b |
227 (transparent-box) | 236 ;;(transparent-box) |
228 ;;(transparent-sphere) | 237 (transparent-sphere) |
229 ;;(sphere) | 238 ;;(sphere) |
230 f (transparent-floor) | 239 f (transparent-floor) |
231 ;;controls | 240 ;;controls |
232 ;;(make-touch-sphere b) | 241 ;;(make-touch-sphere b) |
233 ;;(make-touch b) | 242 ;;(make-touch b) |