| 40 | } |
| 41 | |
| 42 | const AffineSpace3fa get(Vec2f p) |
| 43 | { |
| 44 | const size_t width = texture->width; |
| 45 | const size_t height = texture->height; |
| 46 | const size_t x = clamp((size_t)(p.x*(width-1)),(size_t)0,width-1); |
| 47 | const size_t y = clamp((size_t)(p.y*(height-1)),(size_t)0,height-1); |
| 48 | const Color4 c = texture->get(x,y); |
| 49 | const float px = p.x*(bounds.upper.x-bounds.lower.x) + bounds.lower.x; |
| 50 | const float py = c.r*(bounds.upper.y-bounds.lower.y) + bounds.lower.y; |
| 51 | const float pz = p.y*(bounds.upper.z-bounds.lower.z) + bounds.lower.z; |
| 52 | return AffineSpace3fa::translate(Vec3fa(px,py,pz)); |
| 53 | } |
| 54 | |
| 55 | Ref<SceneGraph::Node> geometry() |
| 56 | { |
no test coverage detected