1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | //////////////////////////// var powerOf2:int=1; var val:int=456; while ( powerOf2 <val ) { trace(powerOf2 <<= 1); } //////////////////////////// function nextPowerOfTwo( value_ : int ):int { value_--; value_ = (value_>> 1) | value_; value_ = (value_>> 2) | value_; value_ = (value_>> 4) | value_; value_ = (value_>> 8) | value_; value_ = (value_>> 16) | value_; value_++; return value_; } //////////////////////////// function nextPowerOfTwo( value_ : int ):int { return int(Math.pow(2,Math.ceil(Math.log(value_) / Math.log(2)))); } |
From: http://www.blog.lessrain.com/flash-more-efficient-blur-filter-values/
Surfing the web I found an interesting post in Everyday Flash , it explains how to get Pixel Precision in PV3D ( Getting a textured object show his texture with a 1:1 aspect relation )
To position the object we use this formula:
1 |
And to get x,y 2D coordinates of the 3D object this one:
1 2 | screenPosX = 3dobj.screen.x + viewport.viewportWidth / 2; screenPosY = 3dobj.screen.y + viewport.viewportHeight / 2; |
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | ||||