| 251 | |
| 252 | |
| 253 | bool |
| 254 | SimpleRenderer::get_userdata (bool derivatives, ustring name, TypeDesc type, |
| 255 | ShaderGlobals *sg, void *val) |
| 256 | { |
| 257 | // Just to illustrate how this works, respect s and t userdata, filled |
| 258 | // in with the uv coordinates. In a real renderer, it would probably |
| 259 | // look up something specific to the primitive, rather than have hard- |
| 260 | // coded names. |
| 261 | |
| 262 | if (name == u_s && type == TypeDesc::TypeFloat) { |
| 263 | ((float *)val)[0] = sg->u; |
| 264 | if (derivatives) { |
| 265 | ((float *)val)[1] = sg->dudx; |
| 266 | ((float *)val)[2] = sg->dudy; |
| 267 | } |
| 268 | return true; |
| 269 | } |
| 270 | if (name == u_t && type == TypeDesc::TypeFloat) { |
| 271 | ((float *)val)[0] = sg->v; |
| 272 | if (derivatives) { |
| 273 | ((float *)val)[1] = sg->dvdx; |
| 274 | ((float *)val)[2] = sg->dvdy; |
| 275 | } |
| 276 | return true; |
| 277 | } |
| 278 | |
| 279 | return false; |
| 280 | } |
| 281 | |
| 282 | |
| 283 | bool |
nothing calls this directly
no outgoing calls
no test coverage detected