| 103 | |
| 104 | /* called by the C++ code for initialization */ |
| 105 | extern "C" void device_init (char* cfg) |
| 106 | { |
| 107 | TutorialData_Constructor(&data); |
| 108 | |
| 109 | /* create scene */ |
| 110 | data.g_scene = g_scene = rtcNewScene(g_device); |
| 111 | rtcSetSceneBuildQuality(data.g_scene,RTC_BUILD_QUALITY_LOW); |
| 112 | rtcSetSceneFlags(data.g_scene,RTC_SCENE_FLAG_DYNAMIC); |
| 113 | |
| 114 | /* create scene with 4 triangulated spheres */ |
| 115 | data.g_scene1 = rtcNewScene(g_device); |
| 116 | createTriangulatedSphere(data.g_scene1,Vec3fa( 0, 0,+1),0.5f); |
| 117 | createTriangulatedSphere(data.g_scene1,Vec3fa(+1, 0, 0),0.5f); |
| 118 | createTriangulatedSphere(data.g_scene1,Vec3fa( 0, 0,-1),0.5f); |
| 119 | createTriangulatedSphere(data.g_scene1,Vec3fa(-1, 0, 0),0.5f); |
| 120 | rtcCommitScene (data.g_scene1); |
| 121 | |
| 122 | /* instantiate geometry */ |
| 123 | g_instance0 = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_INSTANCE); |
| 124 | rtcSetGeometryMask(g_instance0, 0x80); // test high instance mask bits |
| 125 | rtcSetGeometryInstancedScene(g_instance0,data.g_scene1); |
| 126 | rtcSetGeometryTimeStepCount(g_instance0,1); |
| 127 | g_instance1 = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_INSTANCE); |
| 128 | rtcSetGeometryInstancedScene(g_instance1,data.g_scene1); |
| 129 | rtcSetGeometryTimeStepCount(g_instance1,1); |
| 130 | g_instance2 = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_INSTANCE); |
| 131 | rtcSetGeometryInstancedScene(g_instance2,data.g_scene1); |
| 132 | rtcSetGeometryTimeStepCount(g_instance2,1); |
| 133 | g_instance3 = rtcNewGeometry (g_device, RTC_GEOMETRY_TYPE_INSTANCE); |
| 134 | rtcSetGeometryInstancedScene(g_instance3,data.g_scene1); |
| 135 | rtcSetGeometryTimeStepCount(g_instance3,1); |
| 136 | rtcAttachGeometry(data.g_scene,g_instance0); |
| 137 | rtcAttachGeometry(data.g_scene,g_instance1); |
| 138 | rtcAttachGeometry(data.g_scene,g_instance2); |
| 139 | rtcAttachGeometry(data.g_scene,g_instance3); |
| 140 | rtcReleaseGeometry(g_instance0); |
| 141 | rtcReleaseGeometry(g_instance1); |
| 142 | rtcReleaseGeometry(g_instance2); |
| 143 | rtcReleaseGeometry(g_instance3); |
| 144 | createGroundPlane(data.g_scene); |
| 145 | |
| 146 | /* set all colors */ |
| 147 | data.colors[4*0+0] = Vec3fa(0.25f, 0.f, 0.f); |
| 148 | data.colors[4*0+1] = Vec3fa(0.50f, 0.f, 0.f); |
| 149 | data.colors[4*0+2] = Vec3fa(0.75f, 0.f, 0.f); |
| 150 | data.colors[4*0+3] = Vec3fa(1.00f, 0.f, 0.f); |
| 151 | |
| 152 | data.colors[4*1+0] = Vec3fa(0.f, 0.25f, 0.f); |
| 153 | data.colors[4*1+1] = Vec3fa(0.f, 0.50f, 0.f); |
| 154 | data.colors[4*1+2] = Vec3fa(0.f, 0.75f, 0.f); |
| 155 | data.colors[4*1+3] = Vec3fa(0.f, 1.00f, 0.f); |
| 156 | |
| 157 | data.colors[4*2+0] = Vec3fa(0.f, 0.f, 0.25f); |
| 158 | data.colors[4*2+1] = Vec3fa(0.f, 0.f, 0.50f); |
| 159 | data.colors[4*2+2] = Vec3fa(0.f, 0.f, 0.75f); |
| 160 | data.colors[4*2+3] = Vec3fa(0.f, 0.f, 1.00f); |
| 161 | |
| 162 | data.colors[4*3+0] = Vec3fa(0.25f, 0.25f, 0.f); |
nothing calls this directly
no test coverage detected