| 138 | } |
| 139 | |
| 140 | static void RenderTestScene(const Properties &cfgSetUpProps, const Properties &scnSetUpProps) { |
| 141 | LC_LOG("Creating kernel cache entry with configuration properties:"); |
| 142 | LC_LOG(cfgSetUpProps); |
| 143 | LC_LOG("And scene properties:"); |
| 144 | LC_LOG(scnSetUpProps); |
| 145 | |
| 146 | // Build the scene to render |
| 147 | Scene *scene = Scene::Create(); |
| 148 | |
| 149 | Properties scnProps = scnSetUpProps; |
| 150 | |
| 151 | scnProps << |
| 152 | Property("scene.camera.lookat.orig")(1.f , 6.f , 3.f) << |
| 153 | Property("scene.camera.lookat.target")(0.f , 0.f , .5f) << |
| 154 | Property("scene.camera.fieldofview")(60.f); |
| 155 | |
| 156 | // Define image maps |
| 157 | const u_int size = 256; |
| 158 | vector<u_char> img(size * size * 3); |
| 159 | u_char *ptr = &img[0]; |
| 160 | for (u_int y = 0; y < size; ++y) { |
| 161 | for (u_int x = 0; x < size; ++x) { |
| 162 | if ((x % 64 < 32) ^ (y % 64 < 32)) { |
| 163 | *ptr++ = 255; |
| 164 | *ptr++ = 0; |
| 165 | *ptr++ = 0; |
| 166 | } else { |
| 167 | *ptr++ = 255; |
| 168 | *ptr++ = 255; |
| 169 | *ptr++ = 0; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | scene->DefineImageMap<u_char>("image.png", &img[0], 1.f, 3, size, size, Scene::DEFAULT); |
| 175 | |
| 176 | // Define light sources |
| 177 | const Property lightSetUpProp = scnSetUpProps.Get(Property("kernelcachefill.light.types")("infinite")); |
| 178 | bool hasTriangleLight = false; |
| 179 | for (u_int i = 0; i < lightSetUpProp.GetSize(); ++i) { |
| 180 | const string lightType = lightSetUpProp.Get<string>(i); |
| 181 | if (lightType == "trianglelight") { |
| 182 | hasTriangleLight = true; |
| 183 | continue; |
| 184 | } |
| 185 | |
| 186 | scnProps << Property("scene.lights." + lightType + "_light.type")(lightType); |
| 187 | if (lightType == "mappoint") |
| 188 | scnProps << Property("scene.lights." + lightType + "_light.mapfile")("image.png"); |
| 189 | } |
| 190 | |
| 191 | // Parse the scene definition properties |
| 192 | scene->Parse(scnProps); |
| 193 | |
| 194 | const string geometrySetUp = cfgSetUpProps.Get(Property("kernelcachefill.geometry.type")("test")).Get<string>(); |
| 195 | if (geometrySetUp == "test") { |
| 196 | // Define materials and meshes |
| 197 | if (hasTriangleLight) { |
no test coverage detected