1、Embree 的使 用文 档 光源信 息 /* ambient light source */ r,g,b else if (tag = “-ambientlight“) Handle light = g_device-rtNewLight(“ambientlight“); const Col3f L = cin-getCol3f(); g_device-rtSetFloat3(light, “L“, L.r, L.g, L.b); g_device-rtCommit(light); g_prims.push_back(g_device-rtNewLightPrimitive(light, N
2、ULL); /* point light source */ x,y,z,r,g,b else if (tag = “-pointlight“) Handle light = g_device-rtNewLight(“pointlight“); const Vec3f P = cin-getVec3f(); const Col3f I = cin-getCol3f(); g_device-rtSetFloat3(light, “P“, P.x, P.y, P.z); g_device-rtSetFloat3(light, “I“, I.r, I.g, I.b); g_device-rtComm
3、it(light); g_prims.push_back(g_device-rtNewLightPrimitive(light, NULL); /* directional light source */ vx,vy,vz,r,g,b else if (tag = “-directionallight“ | tag = “-dirlight“) Handle light = g_device-rtNewLight(“directionallight“); const Vec3f D = cin-getVec3f(); const Col3f E = cin-getCol3f(); g_devi
4、ce-rtSetFloat3(light, “D“, D.x, D.y, D.z); g_device-rtSetFloat3(light, “E“, E.r, E.g, E.b); g_device-rtCommit(light); g_prims.push_back(g_device-rtNewLightPrimitive(light, NULL); /* distant light source */ vx,vy,vz,r,g,b,angle else if (tag = “-distantlight“) Handle light = g_device-rtNewLight(“dista
5、ntlight“); const Vec3f D = cin-getVec3f(); const Col3f L = cin-getCol3f(); g_device-rtSetFloat3(light, “D“, D.x, D.y, D.z); g_device-rtSetFloat3(light, “L“, L.r, L.g, L.b); g_device-rtSetFloat1(light, “halfAngle“, cin-getFloat(); g_device-rtCommit(light); g_prims.push_back(g_device-rtNewLightPrimiti
6、ve(light, NULL); /* triangular light source */ else if (tag = “-trianglelight“) Vec3f P = cin-getVec3f(); Vec3f U = cin-getVec3f(); Vec3f V = cin-getVec3f(); Vec3f L = cin-getVec3f(); Handle light = g_device-rtNewLight(“trianglelight“); g_device-rtSetFloat3(light, “v0“, P.x, P.y, P.z); g_device-rtSe
7、tFloat3(light, “v1“, P.x + U.x, P.y + U.y, P.z + U.z); g_device-rtSetFloat3(light, “v2“, P.x + V.x, P.y + V.y, P.z + V.z); g_device-rtSetFloat3(light, “L“, L.x, L.y, L.z); g_device-rtCommit(light); g_prims.push_back(g_device-rtNewLightPrimitive(light, NULL); /* quad light source */ else if (tag = “-
8、quadlight“) Vec3f P = cin-getVec3f(); Vec3f U = cin-getVec3f(); Vec3f V = cin-getVec3f(); Vec3f L = cin-getVec3f(); Handle light0 = g_device-rtNewLight(“trianglelight“); g_device-rtSetFloat3(light0, “v0“, P.x + U.x + V.x, P.y + U.y + V.y, P.z + U.z + V.z); g_device-rtSetFloat3(light0, “v1“, P.x + U.
9、x, P.y + U.y, P.z + U.z); g_device-rtSetFloat3(light0, “v2“, P.x, P.y, P.z); g_device-rtSetFloat3(light0, “L“, L.x, L.y, L.z); g_device-rtCommit(light0); g_prims.push_back(g_device-rtNewLightPrimitive(light0, NULL); Handle light1 = g_device-rtNewLight(“trianglelight“); g_device-rtSetFloat3(light1, “
10、v0“, P.x + U.x + V.x, P.y + U.y + V.y, P.z + U.z + V.z); g_device-rtSetFloat3(light1, “v1“, P.x, P.y, P.z); g_device-rtSetFloat3(light1, “v2“, P.x + V.x, P.y + V.y, P.z + V.z); g_device-rtSetFloat3(light1, “L“, L.x, L.y, L.z); g_device-rtCommit(light1); g_prims.push_back(g_device-rtNewLightPrimitive
11、(light1, NULL); /* HDRI light source */ else if (tag = “-hdrilight“) Handle light = g_device-rtNewLight(“hdrilight“); const Col3f L = cin-getCol3f(); g_device-rtSetFloat3(light, “L“, L.r, L.g, L.b); g_device-rtSetImage(light, “image“, loadImage(path + cin-getFileName(), g_device); g_device-rtCommit(
12、light); g_prims.push_back(g_device-rtNewLightPrimitive(light, NULL); 相机信 息 /* parse camera parameters */Pos,LookAt(P,V), camUp, angle, fov, radius else if (tag = “-vp“) g_camPos = Vec3f(cin-getVec3f(); else if (tag = “-vi“) g_camLookAt = Vec3f(cin-getVec3f(); else if (tag = “-vd“) g_camLookAt = g_camPos + cin-getVec3f(); else if (tag = “-vu“) g_camUp = cin-getVec3f(); else if (tag = “-angle“) g_camFieldOfView = cin-getFloat(); else if (tag = “-fov“) g_camFieldOfView = cin-getFloat(); else if (tag = “-radius“) g_camRadius = cin-getFloat();