| 304 | } |
| 305 | |
| 306 | void buildScene2(OSPCamera *camera, |
| 307 | OSPWorld *world, |
| 308 | OSPRenderer *renderer, |
| 309 | OSPFrameBuffer *framebuffer, |
| 310 | vec2i imgSize) |
| 311 | { |
| 312 | // camera |
| 313 | float cam_pos[] = {2.0f, -1.f, -4.f}; |
| 314 | float cam_up[] = {0.f, 1.f, 0.f}; |
| 315 | float cam_view[] = {-0.2f, 0.25f, 1.f}; |
| 316 | |
| 317 | // triangle mesh data |
| 318 | static float vertex[] = {-2.0f, |
| 319 | -2.0f, |
| 320 | 2.0f, |
| 321 | -2.0f, |
| 322 | 3.0f, |
| 323 | 2.0f, |
| 324 | 2.0f, |
| 325 | -2.0f, |
| 326 | 2.0f, |
| 327 | 0.1f, |
| 328 | -0.1f, |
| 329 | 1.f}; |
| 330 | static float color[] = {0.0f, |
| 331 | 0.1f, |
| 332 | 0.8f, |
| 333 | 1.0f, |
| 334 | 0.8f, |
| 335 | 0.8f, |
| 336 | 0.0f, |
| 337 | 1.0f, |
| 338 | 0.8f, |
| 339 | 0.8f, |
| 340 | 0.0f, |
| 341 | 1.0f, |
| 342 | 0.9f, |
| 343 | 0.1f, |
| 344 | 0.0f, |
| 345 | 1.0f}; |
| 346 | static int32_t index[] = {0, 1, 2, 1, 2, 3}; |
| 347 | |
| 348 | // create and setup camera |
| 349 | *camera = ospNewCamera("perspective"); |
| 350 | ospSetFloat(*camera, "aspect", imgSize.x / (float)imgSize.y); |
| 351 | ospSetParam(*camera, "pos", OSP_VEC3F, cam_pos); |
| 352 | ospSetParam(*camera, "dir", OSP_VEC3F, cam_view); |
| 353 | ospSetParam(*camera, "up", OSP_VEC3F, cam_up); |
| 354 | ospCommit(*camera); // commit each object to indicate modifications are done |
| 355 | |
| 356 | // create and setup model and mesh |
| 357 | OSPGeometry mesh = ospNewGeometry("mesh"); |
| 358 | OSPData data = ospNewSharedData1D(vertex, OSP_VEC3F, 4); |
| 359 | ospCommit(data); |
| 360 | ospSetObject(mesh, "vertex.position", data); |
| 361 | ospRelease(data); |
| 362 | |
| 363 | data = ospNewSharedData1D(color, OSP_VEC4F, 4); |
no test coverage detected