| 179 | } |
| 180 | |
| 181 | void buildScene1(OSPCamera *camera, |
| 182 | OSPWorld *world, |
| 183 | OSPRenderer *renderer, |
| 184 | OSPFrameBuffer *framebuffer, |
| 185 | vec2i imgSize) |
| 186 | { |
| 187 | // camera |
| 188 | float cam_pos[] = {0.f, 0.f, 0.f}; |
| 189 | float cam_up[] = {0.f, 1.f, 0.f}; |
| 190 | float cam_view[] = {0.1f, 0.f, 1.f}; |
| 191 | |
| 192 | // triangle mesh data |
| 193 | static float vertex[] = {-1.0f, |
| 194 | -1.0f, |
| 195 | 3.0f, |
| 196 | -1.0f, |
| 197 | 1.0f, |
| 198 | 3.0f, |
| 199 | 1.0f, |
| 200 | -1.0f, |
| 201 | 3.0f, |
| 202 | 0.1f, |
| 203 | 0.1f, |
| 204 | 0.3f}; |
| 205 | static float color[] = {0.9f, |
| 206 | 0.5f, |
| 207 | 0.5f, |
| 208 | 1.0f, |
| 209 | 0.8f, |
| 210 | 0.8f, |
| 211 | 0.8f, |
| 212 | 1.0f, |
| 213 | 0.8f, |
| 214 | 0.8f, |
| 215 | 0.8f, |
| 216 | 1.0f, |
| 217 | 0.5f, |
| 218 | 0.9f, |
| 219 | 0.5f, |
| 220 | 1.0f}; |
| 221 | static int32_t index[] = {0, 1, 2, 1, 2, 3}; |
| 222 | |
| 223 | // create and setup camera |
| 224 | *camera = ospNewCamera("perspective"); |
| 225 | ospSetFloat(*camera, "aspect", imgSize.x / (float)imgSize.y); |
| 226 | ospSetParam(*camera, "pos", OSP_VEC3F, cam_pos); |
| 227 | ospSetParam(*camera, "dir", OSP_VEC3F, cam_view); |
| 228 | ospSetParam(*camera, "up", OSP_VEC3F, cam_up); |
| 229 | ospCommit(*camera); // commit each object to indicate modifications are done |
| 230 | |
| 231 | // create and setup model and mesh |
| 232 | OSPGeometry mesh = ospNewGeometry("mesh"); |
| 233 | OSPData data = ospNewSharedData1D(vertex, OSP_VEC3F, 4); |
| 234 | ospCommit(data); |
| 235 | ospSetObject(mesh, "vertex.position", data); |
| 236 | ospRelease(data); // we are done using this handle |
| 237 | |
| 238 | data = ospNewSharedData1D(color, OSP_VEC4F, 4); |
no test coverage detected