Pick a prop. camera has been positioned such that a ray pick at screen-coordinates p hits points with x-y coordinates xy. data contains: expected pick result, block#
(p,xy,data)
| 111 | debug=False |
| 112 | |
| 113 | def propPick(p,xy,data): |
| 114 | """ |
| 115 | Pick a prop. camera has been positioned such that a ray pick at |
| 116 | screen-coordinates p hits points with x-y coordinates xy. |
| 117 | data contains: expected pick result, block# |
| 118 | """ |
| 119 | errors = 0 |
| 120 | result=propPicker.Pick(p[0],p[1],0,r)==1 |
| 121 | if result != data[0]: |
| 122 | print('prop pick at {} result: expected {} actual {}' |
| 123 | .format(xy,data[0],result)) |
| 124 | errors+=1 |
| 125 | if propPicker.GetFlatBlockIndex() != data[1]: |
| 126 | print('prop pick at {} flat block index expected {} actual {}' |
| 127 | .format(xy,data[1],propPicker.GetFlatBlockIndex())) |
| 128 | errors+=1 |
| 129 | |
| 130 | if debug and errors: |
| 131 | if result>0: |
| 132 | if propPicker.GetFlatBlockIndex(): |
| 133 | print('prop pick at {} picked block {}' |
| 134 | .format(xy,propPicker.GetFlatBlockIndex())) |
| 135 | else: |
| 136 | print('prop pick at {} result:{}'.format(xy,result)) |
| 137 | return errors |
| 138 | |
| 139 | def pointPick(p,xy,data): |
| 140 | """ |