├── CMakeLists.txt ├── README.txt ├── common ├── CMakeLists.txt ├── cmake │ ├── FindCOI.cmake │ ├── Findembree.cmake │ ├── clang.cmake │ ├── gcc.cmake │ ├── icc.cmake │ ├── icc_mic.cmake │ ├── ispc.cmake │ ├── ispc.props │ ├── ispc.rules │ ├── ispc.targets │ └── ispc.xml ├── freeglut │ ├── LICENSE.txt │ ├── Win32 │ │ ├── GL │ │ │ ├── freeglut.h │ │ │ ├── freeglut_ext.h │ │ │ ├── freeglut_std.h │ │ │ ├── glext.h │ │ │ ├── glut.h │ │ │ ├── glxext.h │ │ │ └── wglext.h │ │ ├── freeglut.dll │ │ └── freeglut.lib │ └── x64 │ │ ├── GL │ │ ├── freeglut.h │ │ ├── freeglut_ext.h │ │ ├── freeglut_std.h │ │ ├── glext.h │ │ ├── glut.h │ │ ├── glxext.h │ │ └── wglext.h │ │ ├── freeglut.dll │ │ └── freeglut.lib ├── image │ ├── CMakeLists.txt │ ├── FindOpenEXR.cmake │ ├── exr.cpp │ ├── image.cpp │ ├── image.h │ ├── image.vcxproj │ ├── jpeg.cpp │ ├── magick.cpp │ ├── pfm.cpp │ ├── ppm.cpp │ └── tga.cpp ├── lexers │ ├── CMakeLists.txt │ ├── lexers.vcxproj │ ├── parsestream.h │ ├── stream.h │ ├── streamfilters.h │ ├── stringstream.cpp │ ├── stringstream.h │ ├── tokenstream.cpp │ └── tokenstream.h ├── math │ ├── affinespace.h │ ├── bbox.h │ ├── col3.h │ ├── col4.h │ ├── color.h │ ├── color_scalar.h │ ├── color_sse.h │ ├── linearspace3.h │ ├── math.h │ ├── permutation.h │ ├── quaternion.h │ ├── random.h │ ├── vec2.h │ ├── vec3.h │ ├── vec4.h │ ├── vector3b_mic.h │ ├── vector3b_sse.h │ ├── vector3f_mic.h │ ├── vector3f_sse.h │ ├── vector3i_mic.h │ └── vector3i_sse.h ├── simd │ ├── CMakeLists.txt │ ├── avx.h │ ├── avxb.h │ ├── avxf.h │ ├── avxi.h │ ├── avxi_emu.h │ ├── immintrin_emu.h │ ├── mic.h │ ├── mic_f.cpp │ ├── mic_f.h │ ├── mic_i.cpp │ ├── mic_i.h │ ├── mic_m.h │ ├── simd.h │ ├── smmintrin_emu.h │ ├── sse.h │ ├── sse_mic.h │ ├── sse_special.h │ ├── sseb.h │ ├── sseb_mic.h │ ├── ssef.h │ ├── ssef_mic.h │ ├── ssei.h │ └── ssei_mic.h └── sys │ ├── CMakeLists.txt │ ├── constants.h │ ├── filename.cpp │ ├── filename.h │ ├── intrinsics.h │ ├── library.cpp │ ├── library.h │ ├── logging.h │ ├── network.cpp │ ├── network.h │ ├── platform.cpp │ ├── platform.h │ ├── ref.h │ ├── stl │ ├── array2d.h │ ├── string.cpp │ ├── string.h │ └── vector.h │ ├── sync │ ├── atomic.h │ ├── barrier.h │ ├── condition.cpp │ ├── condition.h │ ├── event.h │ ├── mutex.cpp │ └── mutex.h │ ├── sys.vcxproj │ ├── sysinfo.cpp │ ├── sysinfo.h │ ├── taskscheduler.cpp │ ├── taskscheduler.h │ ├── taskscheduler_mic.cpp │ ├── taskscheduler_mic.h │ ├── taskscheduler_sys.cpp │ ├── taskscheduler_sys.h │ ├── thread.cpp │ └── thread.h ├── devices ├── CMakeLists.txt ├── device │ ├── CMakeLists.txt │ ├── device.cpp │ ├── device.h │ ├── device.vcxproj │ ├── handle.cpp │ ├── handle.h │ └── loaders │ │ ├── CMakeLists.txt │ │ ├── loaders.cpp │ │ ├── loaders.h │ │ ├── obj_loader.cpp │ │ ├── obj_loader.h │ │ ├── xml_loader.cpp │ │ ├── xml_loader.h │ │ ├── xml_parser.cpp │ │ └── xml_parser.h ├── device_coi │ ├── CMakeLists.txt │ ├── coi_common.h │ ├── coi_device.cpp │ ├── coi_device.h │ ├── coi_server.cpp │ └── coi_server.h ├── device_ispc │ ├── CMakeLists.txt │ ├── api │ │ ├── data.h │ │ ├── datastream.h │ │ ├── framebuffer.h │ │ ├── handle.h │ │ ├── ispc_device.cpp │ │ ├── ispc_device.h │ │ ├── parms.h │ │ ├── ref.h │ │ ├── ref.ispc │ │ ├── ref.isph │ │ ├── swapchain.h │ │ └── variant.h │ ├── brdfs │ │ ├── brdf.isph │ │ ├── compositedbrdf.isph │ │ ├── conductor.isph │ │ ├── dielectric_reflection.isph │ │ ├── dielectric_transmission.isph │ │ ├── dielectriclayer_lambertian.isph │ │ ├── dielectriclayer_microfacet_metal.isph │ │ ├── lambertian.isph │ │ ├── microfacet_metal.isph │ │ ├── microfacet_plastic.isph │ │ ├── minneart.isph │ │ ├── optics.isph │ │ ├── reflection.isph │ │ ├── specular.isph │ │ ├── transmission.isph │ │ └── velvety.isph │ ├── cameras │ │ ├── camera.isph │ │ ├── depthoffieldcamera.h │ │ ├── depthoffieldcamera.ispc │ │ ├── pinholecamera.h │ │ └── pinholecamera.ispc │ ├── default.h │ ├── default.isph │ ├── device_ispc.vcxproj │ ├── framebuffers │ │ ├── accubuffer.ispc │ │ ├── accubuffer.isph │ │ ├── framebuffer.ispc │ │ ├── framebuffer.isph │ │ ├── framebuffer_rgb8.ispc │ │ ├── framebuffer_rgb8.isph │ │ ├── framebuffer_rgb_float32.ispc │ │ ├── framebuffer_rgb_float32.isph │ │ ├── framebuffer_rgba8.ispc │ │ ├── framebuffer_rgba8.isph │ │ ├── swapchain.ispc │ │ └── swapchain.isph │ ├── lights │ │ ├── ambientlight.h │ │ ├── ambientlight.ispc │ │ ├── directionallight.h │ │ ├── directionallight.ispc │ │ ├── distantlight.h │ │ ├── distantlight.ispc │ │ ├── hdrilight.h │ │ ├── hdrilight.ispc │ │ ├── light.ispc │ │ ├── light.isph │ │ ├── pointlight.h │ │ ├── pointlight.ispc │ │ ├── spotlight.h │ │ ├── spotlight.ispc │ │ ├── trianglelight.h │ │ └── trianglelight.ispc │ ├── materials │ │ ├── dielectric.h │ │ ├── dielectric.ispc │ │ ├── material.ispc │ │ ├── material.isph │ │ ├── matte.h │ │ ├── matte.ispc │ │ ├── matte_textured.h │ │ ├── matte_textured.ispc │ │ ├── medium.isph │ │ ├── metal.h │ │ ├── metal.ispc │ │ ├── metallicpaint.h │ │ ├── metallicpaint.ispc │ │ ├── mirror.h │ │ ├── mirror.ispc │ │ ├── obj.h │ │ ├── obj.ispc │ │ ├── plastic.h │ │ ├── plastic.ispc │ │ ├── thindielectric.h │ │ ├── thindielectric.ispc │ │ ├── velvet.h │ │ └── velvet.ispc │ ├── math │ │ ├── affinespace.isph │ │ ├── linearspace.isph │ │ ├── math.isph │ │ ├── ray.isph │ │ ├── vec.isph │ │ ├── vec2f.isph │ │ ├── vec3f.isph │ │ ├── vec3fa.isph │ │ ├── vec4f.isph │ │ └── veci.isph │ ├── renderers │ │ ├── debugrenderer.h │ │ ├── debugrenderer.ispc │ │ ├── pathtracer.h │ │ ├── pathtracer.ispc │ │ ├── renderer.ispc │ │ └── renderer.isph │ ├── samplers │ │ ├── distribution2d.ispc │ │ ├── distribution2d.isph │ │ ├── patterns.isph │ │ ├── permutation.isph │ │ ├── precomputed_sampler.isph │ │ ├── random.isph │ │ ├── sample.isph │ │ └── shapesampler.isph │ ├── scene │ │ ├── instance.ispc │ │ ├── instance.isph │ │ ├── scene.ispc │ │ └── scene.isph │ ├── shapes │ │ ├── differentialgeometry.isph │ │ ├── shape.ispc │ │ ├── shape.isph │ │ ├── sphere.cpp │ │ ├── sphere.h │ │ ├── triangle.h │ │ ├── trianglemesh.cpp │ │ ├── trianglemesh.h │ │ ├── trianglemesh.ispc │ │ └── trianglemesh.isph │ ├── std │ │ └── stdint.h │ ├── textures │ │ ├── image.isph │ │ ├── image3c.ispc │ │ ├── image3ca.ispc │ │ ├── image3f.ispc │ │ ├── image3fa.ispc │ │ ├── nearestneighbor.h │ │ ├── nearestneighbor.ispc │ │ └── texture.isph │ └── tonemappers │ │ ├── defaulttonemapper.h │ │ ├── defaulttonemapper.ispc │ │ └── tonemapper.isph ├── device_network │ ├── CMakeLists.txt │ ├── default.h │ ├── network_common.h │ ├── network_device.cpp │ ├── network_device.h │ ├── network_device.vcxproj │ ├── network_server.cpp │ ├── network_server.h │ ├── network_server.vcxproj │ └── network_server_main.cpp ├── device_singleray │ ├── CMakeLists.txt │ ├── api │ │ ├── data.h │ │ ├── datastream.h │ │ ├── framebuffer.h │ │ ├── handle.h │ │ ├── instance.h │ │ ├── parms.h │ │ ├── scene.h │ │ ├── scene_flat.h │ │ ├── scene_instancing.h │ │ ├── singleray_device.cpp │ │ ├── singleray_device.h │ │ ├── swapchain.h │ │ └── variant.h │ ├── brdfs │ │ ├── brdf.h │ │ ├── compositedbrdf.h │ │ ├── conductor.h │ │ ├── dielectric.h │ │ ├── dielectriclayer.h │ │ ├── lambertian.h │ │ ├── microfacet.h │ │ ├── microfacet │ │ │ ├── anisotropic_beckmann_distribution.h │ │ │ ├── anisotropic_power_cosine_distribution.h │ │ │ ├── beckmann_distribution.h │ │ │ ├── fresnel.h │ │ │ └── power_cosine_distribution.h │ │ ├── minnaert.h │ │ ├── optics.h │ │ ├── reflection.h │ │ ├── specular.h │ │ ├── transmission.h │ │ └── velvety.h │ ├── cameras │ │ ├── camera.h │ │ ├── depthoffieldcamera.h │ │ └── pinholecamera.h │ ├── default.h │ ├── device_singleray.vcxproj │ ├── filters │ │ ├── boxfilter.h │ │ ├── bsplinefilter.h │ │ ├── filter.cpp │ │ └── filter.h │ ├── integrators │ │ ├── integrator.h │ │ ├── pathtraceintegrator.cpp │ │ └── pathtraceintegrator.h │ ├── lights │ │ ├── ambientlight.h │ │ ├── directionallight.h │ │ ├── distantlight.h │ │ ├── hdrilight.cpp │ │ ├── hdrilight.h │ │ ├── light.h │ │ ├── pointlight.h │ │ ├── spotlight.h │ │ └── trianglelight.h │ ├── materials │ │ ├── brushedmetal.h │ │ ├── dielectric.h │ │ ├── material.h │ │ ├── matte.h │ │ ├── matte_textured.h │ │ ├── medium.h │ │ ├── metal.h │ │ ├── metallicpaint.h │ │ ├── mirror.h │ │ ├── obj.h │ │ ├── plastic.h │ │ ├── thindielectric.h │ │ └── velvet.h │ ├── renderers │ │ ├── debugrenderer.cpp │ │ ├── debugrenderer.h │ │ ├── integratorrenderer.cpp │ │ ├── integratorrenderer.h │ │ ├── progress.cpp │ │ ├── progress.h │ │ ├── ray.h │ │ └── renderer.h │ ├── samplers │ │ ├── distribution1d.cpp │ │ ├── distribution1d.h │ │ ├── distribution2d.cpp │ │ ├── distribution2d.h │ │ ├── patterns.h │ │ ├── sample.h │ │ ├── sampler.cpp │ │ ├── sampler.h │ │ └── shapesampler.h │ ├── shapes │ │ ├── differentialgeometry.h │ │ ├── disk.h │ │ ├── shape.h │ │ ├── sphere.h │ │ ├── triangle.h │ │ ├── trianglemesh.h │ │ ├── trianglemesh_full.cpp │ │ ├── trianglemesh_full.h │ │ ├── trianglemesh_normals.cpp │ │ └── trianglemesh_normals.h │ ├── textures │ │ ├── nearestneighbor.h │ │ └── texture.h │ └── tonemappers │ │ ├── defaulttonemapper.h │ │ └── tonemapper.h └── renderer │ ├── CMakeLists.txt │ ├── glutdisplay.cpp │ ├── glutdisplay.h │ ├── regression.cpp │ ├── regression.h │ ├── renderer.cpp │ ├── renderer.ivproj │ └── renderer.vcxproj ├── embree-renderer.sln ├── models ├── cornell_box.ecs ├── cornell_box.mtl ├── cornell_box.obj ├── cornell_box_spheres.ecs ├── cornell_box_spheres.xml ├── lines.ppm ├── sphere_carpaint.ecs ├── sphere_carpaint.xml ├── sphere_glass.ecs ├── sphere_glass.xml ├── sphere_gold.ecs ├── sphere_gold.xml ├── sphere_mirror.ecs ├── sphere_mirror.xml ├── sphere_motion.ecs ├── sphere_motion.xml └── sphere_view.ecs ├── scripts └── benchmark.py └── tools ├── obj2xml ├── CMakeLists.txt ├── obj2xml.cpp ├── objLoader.cpp ├── objLoader.h ├── xmlWriter.cpp └── xmlWriter.h ├── vrml2xml ├── CMakeLists.txt ├── vrml2xml.cpp ├── vrml_loader.cpp └── vrml_loader.h └── xml2obj ├── CMakeLists.txt └── xml2obj.cpp /common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | SET(__XEON__ 1) 18 | ADD_SUBDIRECTORY(sys) 19 | ADD_SUBDIRECTORY(simd) 20 | ADD_SUBDIRECTORY(image) 21 | ADD_SUBDIRECTORY(lexers) 22 | 23 | IF (BUILD_SINGLERAY_DEVICE_XEON_PHI OR BUILD_ISPC_DEVICE_XEON_PHI) 24 | SET(__XEON__ 0) 25 | ADD_SUBDIRECTORY(sys sys_knc) 26 | ADD_SUBDIRECTORY(simd simd_knc) 27 | ADD_SUBDIRECTORY(lexers lexers_knc) 28 | ENDIF () 29 | 30 | -------------------------------------------------------------------------------- /common/cmake/FindCOI.cmake: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | FIND_PATH(COI_INCLUDE_PATH source/COIProcess_source.h /opt/intel/mic/coi/include /usr/include/intel-coi) 18 | FIND_PATH(COI_HOST_LIBRARY_DIR libcoi_host.so /opt/intel/mic/coi/host-linux-release/lib/) 19 | FIND_PATH(COI_DEV_LIBRARY_DIR libcoi_device.so /opt/mpss/*/sysroots/k1om-mpss-linux/usr/lib64/) 20 | 21 | IF (COI_INCLUDE_PATH AND COI_HOST_LIBRARY_DIR AND COI_DEV_LIBRARY_DIR) 22 | SET(COI_FOUND TRUE) 23 | SET(COI_INCLUDE_PATHS ${COI_INCLUDE_PATH}) 24 | SET(COI_HOST_LIBRARIES ${COI_HOST_LIBRARY_DIR}/libcoi_host.so) 25 | SET(COI_DEV_LIBRARIES ${COI_DEV_LIBRARY_DIR}/libcoi_device.so) 26 | ELSE () 27 | MESSAGE(FATAL_ERROR "COI installation not found") 28 | ENDIF () 29 | 30 | MARK_AS_ADVANCED(COI_INCLUDE_PATH) 31 | MARK_AS_ADVANCED(COI_HOST_LIBRARY_DIR) 32 | MARK_AS_ADVANCED(COI_DEV_LIBRARY_DIR) 33 | 34 | MARK_AS_ADVANCED(COI_INCLUDE_PATHS) 35 | MARK_AS_ADVANCED(COI_HOST_LIBRARIES) 36 | MARK_AS_ADVANCED(COI_DEV_LIBRARIES) 37 | -------------------------------------------------------------------------------- /common/cmake/Findembree.cmake: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | FIND_PATH(EMBREE_INCLUDE_PATH embree2/rtcore.h 18 | /usr/include 19 | /usr/local/include 20 | /opt/local/include) 21 | 22 | FIND_LIBRARY(EMBREE_LIBRARY NAMES embree PATHS 23 | /usr/lib 24 | /usr/local/lib 25 | /opt/local/lib) 26 | 27 | FIND_LIBRARY(EMBREE_LIBRARY_MIC NAMES embree_xeonphi PATHS 28 | /usr/lib 29 | /usr/local/lib 30 | /opt/local/lib) 31 | 32 | IF (EMBREE_INCLUDE_PATH AND EMBREE_LIBRARY) 33 | SET(EMBREE_FOUND TRUE) 34 | ENDIF () 35 | -------------------------------------------------------------------------------- /common/cmake/clang.cmake: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | SET(FLAGS_SSSE3 "-mssse3") 18 | SET(FLAGS_SSE41 "-msse4.1") 19 | SET(FLAGS_SSE42 "-msse4.2") 20 | SET(FLAGS_AVX "-mavx -mvzeroupper") 21 | SET(FLAGS_AVX2 "-mavx2 -mvzeroupper") 22 | 23 | SET(CMAKE_CXX_COMPILER "clang++") 24 | SET(CMAKE_C_COMPILER "clang") 25 | SET(CMAKE_CXX_FLAGS "-fPIC -fvisibility-inlines-hidden -fvisibility=hidden") 26 | SET(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O0 -ftree-ter") 27 | SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -g -O3 -Wstrict-aliasing=0 -ffast-math ") 28 | SET(CMAKE_EXE_LINKER_FLAGS "") 29 | 30 | IF (APPLE) 31 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7") 32 | ENDIF (APPLE) 33 | 34 | SET(EXT "") 35 | -------------------------------------------------------------------------------- /common/cmake/gcc.cmake: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | SET(FLAGS_SSE2 "-msse2") 18 | SET(FLAGS_SSSE3 "-mssse3") 19 | SET(FLAGS_SSE41 "-msse4.1") 20 | SET(FLAGS_SSE42 "-msse4.2") 21 | SET(FLAGS_AVX "-mavx -mvzeroupper") 22 | SET(FLAGS_AVX2 "-mavx2 -mvzeroupper") 23 | 24 | SET(CMAKE_CXX_COMPILER "g++") 25 | SET(CMAKE_C_COMPILER "gcc") 26 | SET(CMAKE_CXX_FLAGS "-fPIC -fvisibility-inlines-hidden -fvisibility=hidden") 27 | SET(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O0 -ftree-ter") 28 | SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -g -O3 -Wstrict-aliasing=0 -ffast-math ") 29 | SET(CMAKE_EXE_LINKER_FLAGS "") 30 | 31 | IF (APPLE) 32 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7") 33 | ENDIF (APPLE) 34 | 35 | SET(EXT "") 36 | -------------------------------------------------------------------------------- /common/cmake/icc.cmake: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | SET(FLAGS_SSE2 "-xsse2") 18 | SET(FLAGS_SSSE3 "-xssse3") 19 | SET(FLAGS_SSE41 "-xsse4.1") 20 | SET(FLAGS_SSE42 "-xsse4.2") 21 | SET(FLAGS_AVX "-xAVX") 22 | SET(FLAGS_AVX2 "-xCORE-AVX2") 23 | 24 | SET(CMAKE_CXX_COMPILER "icpc") 25 | SET(CMAKE_C_COMPILER "icc") 26 | SET(CMAKE_CXX_FLAGS "-Wall -fPIC -static-intel -fvisibility-inlines-hidden -fvisibility=hidden") 27 | SET(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O0") 28 | SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -no-ansi-alias -restrict -fp-model fast -fimf-precision=low -no-prec-div -no-prec-sqrt") 29 | SET(CMAKE_EXE_LINKER_FLAGS "") 30 | 31 | IF (APPLE) 32 | SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} -dynamiclib) 33 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7") 34 | ENDIF (APPLE) 35 | 36 | SET(EXT "") 37 | -------------------------------------------------------------------------------- /common/cmake/ispc.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | Midl 6 | CustomBuild 7 | 8 | 9 | _SelectedFiles;$(ISPCDependsOn) 11 | 12 | 13 | 14 | False 15 | true 16 | False 17 | False 18 | False 19 | $(IntDir)%(Filename).ispc.obj 20 | $(IntDir)%(Filename)_ispc.h 21 | 1 22 | 1 23 | 0 24 | 1 25 | 0 26 | 1 27 | ispc.exe [AllOptions] [AdditionalOptions] [Inputs] 28 | $(IntDir)%(Filename).ispc.obj;$(IntDir)%(Filename).ispc_sse2.obj;$(IntDir)%(Filename).ispc_sse4.obj 29 | $(IntDir)%(Filename).ispc.obj;$(IntDir)%(Filename).ispc_sse2.obj;$(IntDir)%(Filename).ispc_sse4.obj 30 | $(IntDir)%(Filename).ispc.obj;$(IntDir)%(Filename).ispc_sse2.obj;$(IntDir)%(Filename).ispc_sse4.obj;$(IntDir)%(Filename).ispc_avx.obj 31 | $(IntDir)%(Filename).ispc.obj;$(IntDir)%(Filename).ispc_sse2.obj;$(IntDir)%(Filename).ispc_sse4.obj;$(IntDir)%(Filename).ispc_avx.obj;$(IntDir)%(Filename).ispc_avx2.obj 32 | Compiling %(Filename)%(Extension) ... 33 | 34 | 35 | -------------------------------------------------------------------------------- /common/freeglut/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Freeglut Copyright 3 | ------------------ 4 | 5 | Freeglut code without an explicit copyright is covered by the following 6 | copyright: 7 | 8 | Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies or substantial portions of the Software. 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | Except as contained in this notice, the name of Pawel W. Olszta shall not be 26 | used in advertising or otherwise to promote the sale, use or other dealings 27 | in this Software without prior written authorization from Pawel W. Olszta. 28 | -------------------------------------------------------------------------------- /common/freeglut/Win32/GL/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /common/freeglut/Win32/GL/glut.h: -------------------------------------------------------------------------------- 1 | #ifndef __GLUT_H__ 2 | #define __GLUT_H__ 3 | 4 | /* 5 | * glut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | 19 | /*** END OF FILE ***/ 20 | 21 | #endif /* __GLUT_H__ */ 22 | -------------------------------------------------------------------------------- /common/freeglut/Win32/freeglut.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embree/embree-renderer/fefc933946894a716c656fdab0c6d62b76c6c1d3/common/freeglut/Win32/freeglut.dll -------------------------------------------------------------------------------- /common/freeglut/Win32/freeglut.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embree/embree-renderer/fefc933946894a716c656fdab0c6d62b76c6c1d3/common/freeglut/Win32/freeglut.lib -------------------------------------------------------------------------------- /common/freeglut/x64/GL/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /common/freeglut/x64/GL/glut.h: -------------------------------------------------------------------------------- 1 | #ifndef __GLUT_H__ 2 | #define __GLUT_H__ 3 | 4 | /* 5 | * glut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | 19 | /*** END OF FILE ***/ 20 | 21 | #endif /* __GLUT_H__ */ 22 | -------------------------------------------------------------------------------- /common/freeglut/x64/freeglut.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embree/embree-renderer/fefc933946894a716c656fdab0c6d62b76c6c1d3/common/freeglut/x64/freeglut.dll -------------------------------------------------------------------------------- /common/freeglut/x64/freeglut.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embree/embree-renderer/fefc933946894a716c656fdab0c6d62b76c6c1d3/common/freeglut/x64/freeglut.lib -------------------------------------------------------------------------------- /common/lexers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | IF (__XEON__) 18 | 19 | ADD_LIBRARY(lexers STATIC 20 | stringstream.cpp 21 | tokenstream.cpp 22 | ) 23 | 24 | TARGET_LINK_LIBRARIES(lexers sys) 25 | 26 | ELSE () 27 | 28 | INCLUDE (icc_mic) 29 | 30 | ADD_LIBRARY(lexers_knc STATIC 31 | stringstream.cpp 32 | tokenstream.cpp 33 | ) 34 | 35 | TARGET_LINK_LIBRARIES(lexers_knc sys_knc) 36 | 37 | ENDIF () 38 | 39 | -------------------------------------------------------------------------------- /common/lexers/stringstream.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_STRING_STREAM_H__ 18 | #define __EMBREE_STRING_STREAM_H__ 19 | 20 | #include "stream.h" 21 | 22 | namespace embree 23 | { 24 | /*! simple tokenizer that produces a string stream */ 25 | class StringStream : public Stream 26 | { 27 | public: 28 | StringStream(const Ref >& cin, const std::string& seps = "\n\t\r ", 29 | const std::string& endl = "", bool multiLine = false); 30 | public: 31 | ParseLocation location() { return cin->loc(); } 32 | std::string next(); 33 | private: 34 | __forceinline bool isSeparator(int c) const { return isSepMap[c]; } 35 | private: 36 | Ref > cin; /*! source character stream */ 37 | bool isSepMap[256]; /*! map for fast classification of separators */ 38 | std::string endl; /*! the token of the end of line */ 39 | bool multiLine; /*! whether to parse lines wrapped with \ */ 40 | }; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /common/math/color.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_COLOR_H__ 18 | #define __EMBREE_COLOR_H__ 19 | 20 | #if defined (__MIC__) 21 | # include "color_scalar.h" 22 | #elif defined (__X86_64__) 23 | # include "color_sse.h" 24 | #else 25 | # include "color_scalar.h" 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /common/simd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | IF (NOT __XEON__) 18 | INCLUDE(icc_mic) 19 | ADD_LIBRARY(simd_knc STATIC mic_i.cpp mic_f.cpp) 20 | ENDIF () 21 | -------------------------------------------------------------------------------- /common/simd/simd.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_SIMD_H__ 18 | #define __EMBREE_SIMD_H__ 19 | 20 | #include "math/math.h" 21 | 22 | /* include SSE wrapper classes */ 23 | #if defined(__SSE__) 24 | #include "simd/sse.h" 25 | #endif 26 | 27 | #if defined (__MIC__) 28 | //#include "simd/sse_mic.h" 29 | #endif 30 | 31 | /* include AVX wrapper classes */ 32 | #if defined(__AVX__) 33 | #include "simd/avx.h" 34 | #endif 35 | 36 | /* include MIC wrapper classes */ 37 | #if defined(__MIC__) 38 | #include "simd/mic.h" 39 | #endif 40 | 41 | #if defined (__AVX__) 42 | #define AVX_ZERO_UPPER() _mm256_zeroupper() 43 | #else 44 | #define AVX_ZERO_UPPER() 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /common/simd/sse_mic.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_SSE_MIC_H__ 18 | #define __EMBREE_SSE_MIC_H__ 19 | 20 | #include "sys/platform.h" 21 | #include "sys/intrinsics.h" 22 | 23 | #include 24 | 25 | namespace embree { 26 | struct sseb_t; 27 | struct ssei_t; 28 | struct ssef_t; 29 | struct sseb_m; 30 | struct ssei_m; 31 | struct ssef_m; 32 | } 33 | 34 | #include "simd/sseb_mic.h" 35 | #include "simd/ssei_mic.h" 36 | #include "simd/ssef_mic.h" 37 | 38 | namespace embree { 39 | typedef sseb_t sseb; 40 | typedef ssei_t ssei; 41 | typedef ssef_t ssef; 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /common/sys/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | IF (__XEON__) 18 | 19 | ADD_LIBRARY(sys STATIC 20 | platform.cpp 21 | sysinfo.cpp 22 | filename.cpp 23 | library.cpp 24 | thread.cpp 25 | network.cpp 26 | taskscheduler.cpp 27 | taskscheduler_sys.cpp 28 | taskscheduler_mic.cpp 29 | sync/mutex.cpp 30 | sync/condition.cpp 31 | stl/string.cpp 32 | ) 33 | 34 | TARGET_LINK_LIBRARIES(sys pthread dl) 35 | 36 | ELSE() 37 | 38 | include (icc_mic) 39 | 40 | ADD_LIBRARY(sys_knc STATIC 41 | platform.cpp 42 | sysinfo.cpp 43 | filename.cpp 44 | library.cpp 45 | thread.cpp 46 | network.cpp 47 | taskscheduler.cpp 48 | taskscheduler_sys.cpp 49 | taskscheduler_mic.cpp 50 | sync/mutex.cpp 51 | sync/condition.cpp 52 | stl/string.cpp 53 | ) 54 | TARGET_LINK_LIBRARIES(sys_knc simd_knc pthread dl) 55 | 56 | ENDIF () 57 | -------------------------------------------------------------------------------- /common/sys/library.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_LIBRARY_H__ 18 | #define __EMBREE_LIBRARY_H__ 19 | 20 | #include "platform.h" 21 | 22 | namespace embree 23 | { 24 | /*! type for shared library */ 25 | typedef struct opaque_lib_t* lib_t; 26 | 27 | /*! loads a shared library */ 28 | lib_t openLibrary(const std::string& file); 29 | 30 | /*! returns address of a symbol from the library */ 31 | void* getSymbol(lib_t lib, const std::string& sym); 32 | 33 | /*! unloads a shared library */ 34 | void closeLibrary(lib_t lib); 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /common/sys/stl/array2d.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ARRAY2D_H__ 18 | #define __EMBREE_ARRAY2D_H__ 19 | 20 | #include "../platform.h" 21 | 22 | namespace embree 23 | { 24 | template 25 | class Array2D 26 | { 27 | public: 28 | Array2D() : sizeX(0), sizeY(0), data(NULL) {} 29 | 30 | Array2D(size_t sizeX, size_t sizeY) : sizeX(sizeX), sizeY(sizeY) { 31 | data = new T*[sizeX]; 32 | for (size_t x = 0; x < sizeX; x++) 33 | data[x] = new T[sizeY]; 34 | } 35 | 36 | ~Array2D() { 37 | for (size_t x = 0; x < sizeX; x++) 38 | delete[] data[x]; 39 | delete[] data; 40 | } 41 | 42 | operator const T**() const { return const_cast(data); } 43 | operator T**() { return data; } 44 | const T& get(const size_t x, const size_t y) const { return data[x][y]; } 45 | T& get(const size_t x, const size_t y) { return data[x][y]; } 46 | void set(const size_t x, const size_t y, const T& value) { data[x][y] = value; } 47 | 48 | private: 49 | size_t sizeX; 50 | size_t sizeY; 51 | T** data; 52 | }; 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /common/sys/stl/string.cpp: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include 18 | #include 19 | #include "string.h" 20 | 21 | namespace std 22 | { 23 | char to_lower(char c) { return char(tolower(int(c))); } 24 | char to_upper(char c) { return char(toupper(int(c))); } 25 | string strlwr(const string& s) { string dst(s); std::transform(dst.begin(), dst.end(), dst.begin(), to_lower); return dst; } 26 | string strupr(const string& s) { string dst(s); std::transform(dst.begin(), dst.end(), dst.begin(), to_upper); return dst; } 27 | } 28 | -------------------------------------------------------------------------------- /common/sys/stl/string.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_STRING_H__ 18 | #define __EMBREE_STRING_H__ 19 | 20 | #include "../platform.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace std 29 | { 30 | string strlwr(const string& s); 31 | string strupr(const string& s); 32 | 33 | template __forceinline string stringOf( T const& v) { 34 | stringstream s; s << v; return s.str(); 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /common/sys/sync/barrier.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_BARRIER_H__ 18 | #define __EMBREE_BARRIER_H__ 19 | 20 | #include "condition.h" 21 | 22 | namespace embree 23 | { 24 | /*! system barrier using operating system */ 25 | class BarrierSys 26 | { 27 | public: 28 | 29 | void init(size_t count) { 30 | this->count = 0; 31 | this->full_size = count; 32 | } 33 | 34 | int wait() 35 | { 36 | count_mutex.lock(); 37 | count++; 38 | 39 | if (count == full_size) { 40 | count = 0; 41 | cond.broadcast(); 42 | count_mutex.unlock(); 43 | return 1; 44 | } 45 | 46 | cond.wait(count_mutex); 47 | count_mutex.unlock(); 48 | return 0; 49 | } 50 | 51 | protected: 52 | size_t count, full_size; 53 | MutexSys count_mutex; 54 | ConditionSys cond; 55 | }; 56 | 57 | /* default barrier type */ 58 | class Barrier : public BarrierSys {}; 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /common/sys/sync/condition.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embree/embree-renderer/fefc933946894a716c656fdab0c6d62b76c6c1d3/common/sys/sync/condition.cpp -------------------------------------------------------------------------------- /common/sys/sync/condition.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_CONDITION_H__ 18 | #define __EMBREE_CONDITION_H__ 19 | 20 | #include "mutex.h" 21 | 22 | namespace embree 23 | { 24 | class ConditionSys 25 | { 26 | public: 27 | ConditionSys( void ); 28 | ~ConditionSys( void ); 29 | void wait( class MutexSys& mutex ); 30 | void broadcast( void ); 31 | 32 | protected: 33 | void* cond; 34 | }; 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /common/sys/sync/event.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_EVENT_H__ 18 | #define __EMBREE_EVENT_H__ 19 | 20 | #include "mutex.h" 21 | #include "condition.h" 22 | 23 | namespace embree 24 | { 25 | 26 | class EventSys 27 | { 28 | public: 29 | EventSys() 30 | : event(false) {} 31 | 32 | void reset() { 33 | event = false; 34 | } 35 | 36 | void signal() { 37 | #if defined(__MIC__) 38 | event = true; 39 | #else 40 | mutex.lock(); 41 | event = true; 42 | condition.broadcast(); // this broadcast has to be protected! 43 | mutex.unlock(); 44 | #endif 45 | } 46 | 47 | void wait() { 48 | #if defined(__MIC__) 49 | while (!event) __pause(1024); 50 | #else 51 | mutex.lock(); 52 | while (!event) condition.wait(mutex); 53 | mutex.unlock(); 54 | #endif 55 | 56 | } 57 | 58 | protected: 59 | __align(64) volatile bool event; 60 | #if !defined(__MIC__) 61 | MutexSys mutex; 62 | ConditionSys condition; 63 | #endif 64 | }; 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /common/sys/sysinfo.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_SYSINFO_H__ 18 | #define __EMBREE_SYSINFO_H__ 19 | 20 | #include "sys/platform.h" 21 | 22 | namespace embree 23 | { 24 | enum CPUModel { 25 | CPU_UNKNOWN, 26 | CPU_CORE1, 27 | CPU_CORE2, 28 | CPU_CORE_NEHALEM, 29 | CPU_CORE_SANDYBRIDGE 30 | }; 31 | 32 | /*! get the full path to the running executable */ 33 | std::string getExecutableFileName(); 34 | 35 | /*! return platform name */ 36 | std::string getPlatformName(); 37 | 38 | /*! return the name of the CPU */ 39 | std::string getCPUVendor(); 40 | 41 | /*! get microprocessor model */ 42 | CPUModel getCPUModel(); 43 | 44 | /*! return the number of logical threads of the system */ 45 | size_t getNumberOfLogicalThreads(); 46 | 47 | /*! returns the size of the terminal window in characters */ 48 | int getTerminalWidth(); 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /common/sys/taskscheduler_mic.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_TASKSCHEDULER_MIC_H__ 18 | #define __EMBREE_TASKSCHEDULER_MIC_H__ 19 | 20 | #include "taskscheduler.h" 21 | #include "sys/sync/mutex.h" 22 | 23 | namespace embree 24 | { 25 | /*! Task scheduler using active synchronization. */ 26 | class TaskSchedulerMIC : public TaskScheduler 27 | { 28 | public: 29 | 30 | enum { NUM_TASKS = 4*1024 }; 31 | 32 | /*! construction */ 33 | TaskSchedulerMIC(); 34 | 35 | private: 36 | 37 | /*! adds a task to the specified task queue */ 38 | void add(ssize_t threadIndex, QUEUE queue, Task* task); 39 | 40 | /*! thread function */ 41 | void run(size_t threadIndex, size_t threadCount); 42 | 43 | /*! sets the terminate thread variable */ 44 | void terminate(); 45 | 46 | private: 47 | Atomic nextScheduleIndex; /*! next index in the task queue where we'll insert a live task */ 48 | Task* volatile tasks[NUM_TASKS]; //!< queue of tasks 49 | volatile atomic_t locks[NUM_TASKS]; 50 | }; 51 | } 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /common/sys/taskscheduler_sys.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_TASKSCHEDULER_SYS_H__ 18 | #define __EMBREE_TASKSCHEDULER_SYS_H__ 19 | 20 | #include "taskscheduler.h" 21 | #include "sys/sync/mutex.h" 22 | #include "sys/sync/condition.h" 23 | 24 | namespace embree 25 | { 26 | /*! Task scheduler implementing a stack of tasks. */ 27 | class TaskSchedulerSys : public TaskScheduler 28 | { 29 | public: 30 | 31 | /*! construction */ 32 | TaskSchedulerSys(); 33 | 34 | private: 35 | 36 | /*! only a single initial task can be added from the main thread */ 37 | void add(ssize_t threadIndex, QUEUE queue, Task* task); 38 | 39 | /*! thread function */ 40 | void run(size_t threadIndex, size_t threadCount); 41 | 42 | /*! sets the terminate thread variable */ 43 | void terminate(); 44 | 45 | private: 46 | MutexSys mutex; //!< mutex to protect access to task list 47 | ConditionSys condition; //!< condition to signal new tasks 48 | size_t begin,end; //!< current range of tasks 49 | std::vector tasks; //!< queue of tasks 50 | }; 51 | } 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /devices/device/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | ADD_SUBDIRECTORY(loaders) 18 | 19 | ADD_LIBRARY(device STATIC handle.cpp device.cpp) 20 | -------------------------------------------------------------------------------- /devices/device/handle.cpp: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "handle.h" 18 | 19 | namespace embree { 20 | Device* g_device = NULL; 21 | } 22 | -------------------------------------------------------------------------------- /devices/device/loaders/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | ADD_LIBRARY(loaders STATIC 18 | loaders.cpp 19 | obj_loader.cpp 20 | xml_loader.cpp 21 | xml_parser.cpp 22 | ) 23 | 24 | TARGET_LINK_LIBRARIES(loaders image sys lexers) 25 | -------------------------------------------------------------------------------- /devices/device/loaders/loaders.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_LOADERS_H__ 18 | #define __EMBREE_LOADERS_H__ 19 | 20 | #include "obj_loader.h" 21 | #include "xml_loader.h" 22 | 23 | namespace embree 24 | { 25 | extern std::string g_mesh_accel; 26 | extern std::string g_mesh_builder; 27 | extern std::string g_mesh_traverser; 28 | 29 | Handle rtLoadImage (const FileName& fileName); 30 | void rtClearImageCache(); 31 | 32 | Handle rtLoadTexture(const FileName& fileName); 33 | void rtClearTextureCache(); 34 | 35 | std::vector > rtLoadScene (const FileName& fileName); 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /devices/device/loaders/obj_loader.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_OBJ_LOADER_H__ 18 | #define __EMBREE_OBJ_LOADER_H__ 19 | 20 | #include 21 | #include "sys/filename.h" 22 | #include "device/device.h" 23 | #include "device/handle.h" 24 | 25 | namespace embree 26 | { 27 | std::vector > loadOBJ(const FileName &fileName); 28 | } 29 | 30 | #endif // __EMBREE_OBJ_LOADER_H__ 31 | 32 | -------------------------------------------------------------------------------- /devices/device/loaders/xml_loader.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_XML_LOADER_H__ 18 | #define __EMBREE_XML_LOADER_H__ 19 | 20 | #include "device/device.h" 21 | #include "device/handle.h" 22 | #include "sys/filename.h" 23 | 24 | namespace embree 25 | { 26 | std::vector > loadXML(const FileName &fileName); 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /devices/device_coi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | FIND_PACKAGE(COI REQUIRED) 18 | INCLUDE_DIRECTORIES(${COI_INCLUDE_PATHS}) 19 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 20 | 21 | IF (__XEON__) 22 | 23 | ADD_DEFINITIONS(-DNETWORK_NO_CREATE) 24 | ADD_LIBRARY(device_coi SHARED coi_device.cpp) 25 | TARGET_LINK_LIBRARIES(device_coi sys image ${COI_HOST_LIBRARIES}) 26 | 27 | ELSE () 28 | 29 | INCLUDE(icc_mic) 30 | ADD_LIBRARY(coi_server_knc STATIC coi_server.cpp) 31 | TARGET_LINK_LIBRARIES(coi_server_knc lexers_knc ${COI_DEV_LIBRARIES}) 32 | 33 | ENDIF () 34 | -------------------------------------------------------------------------------- /devices/device_coi/coi_server.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_COI_SERVER_H__ 18 | #define __EMBREE_COI_SERVER_H__ 19 | 20 | #include "sys/platform.h" 21 | #include "sys/ref.h" 22 | #include "device_singleray/api/swapchain.h" 23 | #include "device/device.h" 24 | #include "coi_common.h" 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /devices/device_ispc/api/data.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_DATA_H__ 18 | #define __EMBREE_ISPC_DATA_H__ 19 | 20 | #include "../default.h" 21 | 22 | namespace embree 23 | { 24 | /*! Data container. */ 25 | class Data : public RefCount 26 | { 27 | public: 28 | 29 | Data (size_t bytes) : bytes(bytes) { 30 | ptr = alignedMalloc(bytes); 31 | } 32 | 33 | Data (size_t bytes, const void* ptr_i, bool copy = true) : bytes(bytes) { 34 | if (copy) { 35 | ptr = alignedMalloc(bytes); 36 | memcpy(ptr,ptr_i,bytes); 37 | } else { 38 | ptr = (void*)ptr_i; 39 | } 40 | } 41 | 42 | virtual ~Data () { 43 | alignedFree(ptr); ptr = NULL; 44 | bytes = 0; 45 | } 46 | 47 | __forceinline const char* map() const { return (const char*)ptr; } 48 | __forceinline char* map() { return ( char*)ptr; } 49 | 50 | size_t size() { return bytes; } 51 | 52 | private: 53 | void* ptr; 54 | size_t bytes; 55 | }; 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /devices/device_ispc/api/ref.ispc: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "ref.isph" 18 | 19 | void RefCount__Destructor(uniform RefCount* uniform this) { 20 | } 21 | 22 | void RefCount__Constructor(uniform RefCount* uniform this, 23 | uniform DestructorFunc destructor) 24 | { 25 | this->counter = 0; 26 | this->destructor = destructor; 27 | } 28 | 29 | void RefCount__IncRef(uniform RefCount* uniform this) { 30 | if (this) this->counter++; 31 | } 32 | 33 | uniform bool RefCount__DecRef(uniform RefCount* uniform this) 34 | { 35 | if (this && --this->counter == 0) { 36 | if (this->destructor) 37 | this->destructor(this); 38 | delete this; 39 | return true; 40 | } 41 | return false; 42 | } 43 | 44 | void RefCount__Destroy(uniform RefCount* uniform this) 45 | { 46 | if (this->counter == 0) { 47 | if (this->destructor) 48 | this->destructor(this); 49 | delete this; 50 | } 51 | } 52 | 53 | export void RefCount__incref(void* uniform _this) { 54 | RefCount__IncRef((uniform RefCount* uniform) _this); 55 | } 56 | 57 | export uniform bool RefCount__decref(void* uniform _this) { 58 | return RefCount__DecRef((uniform RefCount* uniform) _this); 59 | } 60 | -------------------------------------------------------------------------------- /devices/device_ispc/api/ref.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_REF_ISPH__ 18 | #define __EMBREE_ISPC_REF_ISPH__ 19 | 20 | struct RefCount; 21 | 22 | typedef void (*DestructorFunc)(uniform RefCount* uniform this); 23 | 24 | struct RefCount { 25 | DestructorFunc destructor; 26 | int counter; 27 | }; 28 | 29 | void RefCount__Destructor(uniform RefCount* uniform this); 30 | 31 | void RefCount__Constructor(uniform RefCount* uniform this, uniform DestructorFunc destructor); 32 | 33 | void RefCount__IncRef(uniform RefCount* uniform this); 34 | uniform bool RefCount__DecRef(uniform RefCount* uniform this); 35 | void RefCount__Destroy(uniform RefCount* uniform this); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /devices/device_ispc/cameras/camera.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | 21 | struct Camera; 22 | 23 | typedef void (*RayFunc)(const uniform Camera *uniform this, 24 | varying Ray &ray, 25 | const varying vec2f pixel, /*!< The pixel location on the on image plane in the range from 0 to 1. */ 26 | const varying vec2f sample); /*!< The lens sample in [0,1) for depth of field. */ 27 | 28 | struct Camera 29 | { 30 | RefCount base; 31 | 32 | /*! Computes a primary ray for a pixel. */ 33 | RayFunc initRay; 34 | }; 35 | 36 | inline void Camera__Destructor(uniform RefCount* uniform this) { 37 | LOG(print("Camera__Destructor\n")); 38 | RefCount__Destructor(this); 39 | } 40 | 41 | inline void Camera__Constructor(uniform Camera* uniform this, uniform DestructorFunc destructor, uniform RayFunc ray) 42 | { 43 | LOG(print("Camera__Constructor\n")); 44 | RefCount__Constructor(&this->base,destructor); 45 | this->initRay = ray; 46 | } 47 | -------------------------------------------------------------------------------- /devices/device_ispc/cameras/depthoffieldcamera.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "depthoffieldcamera_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct DepthOfFieldCamera 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const AffineSpace3f local2world = parms.getTransform("local2world"); 29 | const float fov = parms.getFloat("angle",64.0f); 30 | const float aspectRatio = parms.getFloat("aspectRatio",1.0f); 31 | const float lensRadius = parms.getFloat("lensRadius",0.0f); 32 | const float focalDistance = parms.getFloat("focalDistance"); 33 | return ispc::DepthOfFieldCamera__new((ispc::vec3f&)local2world.l.vx, 34 | (ispc::vec3f&)local2world.l.vy, 35 | (ispc::vec3f&)local2world.l.vz, 36 | (ispc::vec3f&)local2world.p, 37 | fov,aspectRatio,lensRadius,focalDistance); 38 | } 39 | }; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /devices/device_ispc/cameras/pinholecamera.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "pinholecamera_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct PinHoleCamera 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const AffineSpace3f local2world = parms.getTransform("local2world"); 29 | const float fov = parms.getFloat("angle",64.0f); 30 | const float aspectRatio = parms.getFloat("aspectRatio",1.0f); 31 | return ispc::PinHoleCamera__new((ispc::vec3f&)local2world.l.vx, 32 | (ispc::vec3f&)local2world.l.vy, 33 | (ispc::vec3f&)local2world.l.vz, 34 | (ispc::vec3f&)local2world.p, 35 | fov,aspectRatio); 36 | } 37 | }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /devices/device_ispc/default.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_DEFAULT_H__ 18 | #define __EMBREE_ISPC_DEFAULT_H__ 19 | 20 | #include "sys/platform.h" 21 | #include "sys/ref.h" 22 | #include "sys/intrinsics.h" 23 | #include "sys/stl/vector.h" 24 | #include "sys/stl/string.h" 25 | 26 | #include "math/math.h" 27 | #include "math/vec2.h" 28 | #include "math/vec3.h" 29 | #include "math/vec4.h" 30 | #include "math/color.h" 31 | #include "math/affinespace.h" 32 | 33 | namespace embree 34 | { 35 | /* vertex and triangle layout */ 36 | struct RTCVertex { float x,y,z,a; }; 37 | struct RTCTriangle { int v0, v1, v2; }; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /devices/device_ispc/default.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_DEFAULT_ISPH__ 18 | #define __EMBREE_ISPC_DEFAULT_ISPH__ 19 | 20 | #define LOG(x) 21 | 22 | #ifndef NULL 23 | #define NULL 0 24 | #endif 25 | 26 | typedef unsigned int uint; 27 | typedef unsigned int uint32; 28 | 29 | #include 30 | 31 | #include "api/ref.isph" 32 | #include "math/math.isph" 33 | #include "math/vec.isph" 34 | #include "math/linearspace.isph" 35 | #include "math/affinespace.isph" 36 | #include "math/ray.isph" 37 | 38 | /* vertex and triangle layout */ 39 | struct RTCVertex { uniform float x,y,z,a; }; 40 | struct RTCTriangle { uniform int v0, v1, v2; }; 41 | 42 | #if defined(__MIC__) 43 | inline void* uniform align_ptr(void* uniform ptr) { 44 | return (void* uniform) ((((uniform int64)ptr) + 63) & (-64)); 45 | } 46 | #elif defined(__AVX__) 47 | inline void* uniform align_ptr(void* uniform ptr) { 48 | return (void* uniform) ((((uniform int64)ptr) + 31) & (-32)); 49 | } 50 | #else 51 | inline void* uniform align_ptr(void* uniform ptr) { 52 | return (void* uniform) ((((uniform int64)ptr) + 15) & (-16)); 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/accubuffer.ispc: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "accubuffer.isph" 18 | 19 | void AccuBuffer__Destructor(uniform RefCount* uniform _this) 20 | { 21 | uniform AccuBuffer* uniform this = (uniform AccuBuffer* uniform) _this; 22 | delete[] this->ptr; this->ptr = NULL; 23 | RefCount__Destructor(_this); 24 | } 25 | 26 | void AccuBuffer__Constructor(uniform AccuBuffer* uniform this, const uniform uint width, const uniform uint height) 27 | { 28 | RefCount__Constructor(&this->base,AccuBuffer__Destructor); 29 | this->size.x = width; 30 | this->size.y = height; 31 | this->ptr = uniform new uniform vec4f[width*height]; 32 | for (uniform int i=0; iptr[i] = make_vec4f(0.0f,0.0f,0.0f,0.0f); 34 | } 35 | 36 | uniform AccuBuffer* uniform AccuBuffer__new(const uniform uint width, const uniform uint height) 37 | { 38 | uniform AccuBuffer* uniform this = uniform new uniform AccuBuffer; 39 | AccuBuffer__Constructor(this,width,height); 40 | return this; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/accubuffer.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | #include "api/ref.isph" 21 | 22 | struct AccuBuffer 23 | { 24 | RefCount base; 25 | uniform vec2ui size; /*! size in pixels */ 26 | uniform vec4f* uniform ptr; /*! float4 pixel buffer */ 27 | }; 28 | 29 | uniform AccuBuffer* uniform AccuBuffer__new(const uniform uint width, const uniform uint height); 30 | 31 | inline vec3f AccuBuffer__update(uniform AccuBuffer* uniform this, const int x, const int y, const vec3f c, const int accuMode) 32 | { 33 | const int idx = x+this->size.x*y; 34 | vec4f d = make_vec4f(c.x,c.y,c.z,1.0f); 35 | vec4f old = this->ptr[idx]; 36 | if (accuMode) d = add(d,old); 37 | this->ptr[idx] = d; 38 | return mul(make_vec3f(d.x,d.y,d.z),rcp(d.w)); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/framebuffer.ispc: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "framebuffer.isph" 18 | 19 | void FrameBuffer__Destructor(uniform FrameBuffer* uniform this) { 20 | LOG(print("FrameBuffer__Destructor\n")); 21 | RefCount__Destructor(&this->base); 22 | } 23 | 24 | void FrameBuffer__Constructor(uniform FrameBuffer* uniform this, 25 | const uniform uint width, 26 | const uniform uint height, 27 | const uniform DestructorFunc destructor, 28 | const uniform FrameBuffer__set set, 29 | const uniform FrameBuffer__map map) 30 | { 31 | LOG(print("FrameBuffer__Constructor\n")); 32 | RefCount__Constructor(&this->base,destructor); 33 | this->size.x = width; 34 | this->size.y = height; 35 | this->invSize.x = rcp((uniform float)width); 36 | this->invSize.y = rcp((uniform float)height); 37 | this->set = set; 38 | this->map = map; 39 | } 40 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/framebuffer_rgb8.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "framebuffer.isph" 18 | 19 | struct FrameBufferRGB8 20 | { 21 | FrameBuffer base; 22 | uniform vec3uc* uniform ptr; /*! rgb8 pixel buffer */ 23 | uniform bool allocated; 24 | }; 25 | 26 | uniform FrameBuffer* uniform FrameBufferRGB8__new(const uniform uint width, const uniform uint height, const void* uniform ptr); 27 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/framebuffer_rgb_float32.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "framebuffer.isph" 18 | 19 | struct FrameBufferRGBFloat32 20 | { 21 | FrameBuffer base; 22 | uniform vec3f* uniform ptr; /*! float3 pixel buffer */ 23 | uniform bool allocated; 24 | }; 25 | 26 | uniform FrameBuffer* uniform FrameBufferRGBFloat32__new(const uniform uint width, const uniform uint height, const void* uniform ptr); 27 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/framebuffer_rgba8.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "framebuffer.isph" 18 | 19 | struct FrameBufferRGBA8 20 | { 21 | FrameBuffer base; 22 | uniform int* uniform ptr; /*! rgba8 pixel buffer */ 23 | uniform bool allocated; 24 | }; 25 | 26 | uniform FrameBuffer* uniform FrameBufferRGBA8__new(const uniform uint width, const uniform uint height, const void* uniform ptr); 27 | -------------------------------------------------------------------------------- /devices/device_ispc/framebuffers/swapchain.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | #include "framebuffer.isph" 21 | #include "accubuffer.isph" 22 | 23 | struct SwapChain 24 | { 25 | uniform RefCount base; 26 | 27 | uniform uint width; //!< width of framebuffers 28 | uniform uint height; //!< height of framebuffers 29 | uniform uint depth; //!< number of framebuffers 30 | uniform size_t buf; //!< next buffer 31 | 32 | uniform FrameBuffer* uniform* uniform buffers; //!< chain of framebuffers 33 | uniform AccuBuffer* uniform accu; //!< accumulation buffer 34 | }; 35 | 36 | uniform FrameBuffer* uniform SwapChain__get_buffer(uniform SwapChain* uniform this); 37 | uniform AccuBuffer* uniform SwapChain__get_accu (uniform SwapChain* uniform this); 38 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/ambientlight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "ambientlight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct AmbientLight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color L = parms.getColor("L"); 29 | return ispc::AmbientLight__new((ispc::vec3f&)L); 30 | } 31 | }; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/directionallight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "directionallight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct DirectionalLight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Vector3f D = parms.getVector3f("D"); 29 | const Color E = parms.getColor("E"); 30 | return ispc::DirectionalLight__new((ispc::vec3f&)D,(ispc::vec3f&)E); 31 | } 32 | }; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/distantlight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "distantlight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct DistantLight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Vector3f D = parms.getVector3f("D"); 29 | const Color L = parms.getColor("L"); 30 | const float halfAngle = parms.getFloat("halfAngle"); 31 | return ispc::DistantLight__new((ispc::vec3f&)D,(ispc::vec3f&)L,halfAngle); 32 | } 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/hdrilight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "hdrilight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct HDRILight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const AffineSpace3f local2world = parms.getTransform("local2world",one); 29 | const Color L = parms.getColor("L",one); 30 | ISPCRef pixels = parms.getImage("image"); 31 | return ispc::HDRILight__new((ispc::vec3f&)local2world.l.vx, 32 | (ispc::vec3f&)local2world.l.vy, 33 | (ispc::vec3f&)local2world.l.vz, 34 | (ispc::vec3f&)local2world.p, 35 | (ispc::vec3f&)L, 36 | pixels.ptr); 37 | } 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/pointlight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "pointlight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct PointLight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Vector3f P = parms.getVector3f("P",zero); 29 | const Color I = parms.getColor("I",zero); 30 | return ispc::PointLight__new((ispc::vec3f&)P,(ispc::vec3f&)I); 31 | } 32 | }; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/spotlight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "spotlight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct SpotLight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Vector3f P = parms.getVector3f("P"); 29 | const Vector3f D = parms.getVector3f("D"); 30 | const Color I = parms.getColor("I"); 31 | const float angleMin = parms.getFloat("angleMin"); 32 | const float angleMax = parms.getFloat("angleMax"); 33 | return ispc::SpotLight__new((ispc::vec3f&)P,(ispc::vec3f&)D,(ispc::vec3f&)I,angleMin,angleMax); 34 | } 35 | }; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /devices/device_ispc/lights/trianglelight.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "trianglelight_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct TriangleLight 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Vector3f v0 = parms.getVector3f("v0"); 29 | const Vector3f v1 = parms.getVector3f("v1"); 30 | const Vector3f v2 = parms.getVector3f("v2"); 31 | const Color L = parms.getColor("L"); 32 | return ispc::TriangleLight__new((ispc::vec3f&)v0,(ispc::vec3f&)v1,(ispc::vec3f&)v2,(ispc::vec3f&)L); 33 | } 34 | }; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/dielectric.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "dielectric_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct Dielectric 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const float etaOutside = parms.getFloat("etaOutside",1.0f); 29 | const float etaInside = parms.getFloat("etaInside",1.4f); 30 | const Color transmissionOutside = parms.getColor("transmissionOutside",one); 31 | const Color transmissionInside = parms.getColor("transmission",one); 32 | return ispc::Dielectric__new(etaOutside,(ispc::vec3f&)transmissionOutside, 33 | etaInside ,(ispc::vec3f&)transmissionInside); 34 | } 35 | }; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/material.ispc: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "material.isph" 18 | 19 | void Material__selectNextMedium(uniform const Material *uniform _THIS, 20 | varying Medium& currentMedium) 21 | { 22 | } 23 | 24 | void Material__Destructor(uniform RefCount *uniform this) 25 | { 26 | LOG(print("Material__Destructor\n")); 27 | RefCount__Destructor(this); 28 | } 29 | 30 | void Material__Constructor(uniform Material *uniform this, 31 | uniform DestructorFunc destructor, 32 | uniform Material__shade shade, 33 | uniform Material__selectNextMediumFunc selectNextMedium, 34 | uniform bool isTransparentForShadowRays) 35 | { 36 | LOG(print("Material__Constructor\n")); 37 | RefCount__Constructor(&this->base,destructor); 38 | this->shade = shade; 39 | if (selectNextMedium) this->selectNextMedium = selectNextMedium; 40 | else this->selectNextMedium = Material__selectNextMedium; 41 | this->isTransparentForShadowRays = isTransparentForShadowRays; 42 | } 43 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/matte.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "matte_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct Matte 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color reflectance = parms.getColor("reflectance",one); 29 | return ispc::Matte__new((ispc::vec3f&)reflectance); 30 | } 31 | }; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/matte_textured.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "matte_textured_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct MatteTextured 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | ISPCRef Kd = parms.getTexture("Kd"); 29 | const Vec2f s0 = parms.getVec2f("s0",Vec2f(0.0f,0.0f)); 30 | const Vec2f ds = parms.getVec2f("ds",Vec2f(1.0f,1.0f)); 31 | return ispc::MatteTextured__new(Kd.ptr,(ispc::vec2f&)s0,(ispc::vec2f&)ds); 32 | } 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/medium.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | 21 | struct Medium 22 | { 23 | vec3f transmission; //!< Transmissivity of medium. 24 | float eta; //!< Refraction index of medium. 25 | }; 26 | 27 | inline Medium make_Medium(const vec3f transmission, const float eta) 28 | { 29 | Medium m; 30 | m.transmission = transmission; 31 | m.eta = eta; 32 | return m; 33 | } 34 | 35 | inline Medium make_Medium_Vacuum() { 36 | return make_Medium(make_vec3f(1.0f),1.0f); 37 | } 38 | 39 | inline bool eq(const Medium &a, const Medium &b) { 40 | return a.eta == b.eta & eq(a.transmission, b.transmission); 41 | } 42 | 43 | inline bool eq(const Medium &a, const uniform Medium &b) { 44 | return a.eta == b.eta & eq(a.transmission, b.transmission); 45 | } 46 | 47 | inline uniform bool eq(const uniform Medium &a, const uniform Medium &b) { 48 | return a.eta == b.eta & eq(a.transmission, b.transmission); 49 | } 50 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/metal.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "metal_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct Metal 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color reflectance = parms.getColor("reflectance",one); 29 | const Color eta = parms.getColor("eta",Color(1.4f)); 30 | const Color k = parms.getColor("k",Color(0.0f)); 31 | const float roughness = parms.getFloat("roughness",0.01f); 32 | return ispc::Metal__new((ispc::vec3f&)reflectance, 33 | (ispc::vec3f&)eta, 34 | (ispc::vec3f&)k, 35 | roughness); 36 | } 37 | }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/metallicpaint.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "metallicpaint_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct MetallicPaint 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color shadeColor = parms.getColor("shadeColor",one); 29 | const Color glitterColor = parms.getColor("glitterColor",zero); 30 | const float glitterSpread = parms.getFloat("glitterSpread",1.0f); 31 | const float eta = parms.getFloat("eta",1.4f); 32 | return ispc::MetallicPaint__new((ispc::vec3f&)shadeColor, 33 | (ispc::vec3f&)glitterColor, 34 | glitterSpread, 35 | eta); 36 | } 37 | }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/mirror.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "mirror_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct Mirror 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color reflectance = parms.getColor("reflectance",one); 29 | return ispc::Mirror__new((ispc::vec3f&)reflectance); 30 | } 31 | }; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/plastic.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "plastic_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct Plastic 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color pigmentColor = parms.getColor("pigmentColor",one); 29 | const float eta = parms.getFloat("eta",1.4f); 30 | const float roughness = parms.getFloat("roughness",0.01f); 31 | return ispc::Plastic__new((ispc::vec3f&)pigmentColor,eta,roughness); 32 | } 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/thindielectric.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "thindielectric_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct ThinDielectric 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color transmission = parms.getColor("transmission",one); 29 | const float eta = parms.getFloat("eta",1.4f); 30 | const float thickness = parms.getFloat("thickness",0.1f); 31 | return ispc::ThinDielectric__new((ispc::vec3f&)transmission,eta,thickness); 32 | } 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /devices/device_ispc/materials/velvet.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "velvet_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct Velvet 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const Color reflectance = parms.getColor("reflectance",one); 29 | const Color horizonScatteringColor = parms.getColor("horizonScatteringColor",one); 30 | const float horizonScatteringFallOff = parms.getFloat("horizonScatteringFallOff",zero); 31 | const float backScattering = parms.getFloat("backScattering",zero); 32 | return ispc::Velvet__new((ispc::vec3f&)reflectance, 33 | (ispc::vec3f&)horizonScatteringColor, 34 | horizonScatteringFallOff, 35 | backScattering); 36 | } 37 | }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /devices/device_ispc/math/vec.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "veci.isph" 20 | #include "vec2f.isph" 21 | #include "vec3f.isph" 22 | #include "vec3fa.isph" 23 | #include "vec4f.isph" 24 | -------------------------------------------------------------------------------- /devices/device_ispc/renderers/debugrenderer.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "debugrenderer_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct DebugRenderer 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const int maxDepth = parms.getInt("maxDepth",1); 29 | const int spp = parms.getInt("sampler.spp",1); 30 | return ispc::DebugRenderer__new(maxDepth,spp); 31 | } 32 | }; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /devices/device_ispc/renderers/pathtracer.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "pathtracer_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct PathTracer 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const int maxDepth = parms.getInt("maxDepth",10); 29 | const float minContribution = parms.getFloat("minContribution",0.01f); 30 | const float epsilon = parms.getFloat("epsilon",32.0f)*float(ulp); 31 | const int spp = max(1,parms.getInt("sampler.spp",1)); 32 | const int sampleLightForGlossy = parms.getInt("sampleLightForGlossy",0); 33 | ISPCRef backplate = parms.getImage("backplate"); 34 | return ispc::PathTracer__new(maxDepth,minContribution,epsilon,spp,backplate.ptr,sampleLightForGlossy); 35 | } 36 | }; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /devices/device_ispc/samplers/distribution2d.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "sample.isph" 20 | 21 | struct Distribution2D 22 | { 23 | RefCount base; 24 | 25 | vec2ui size; 26 | uniform float* cdf_x; 27 | uniform float* cdf_y; 28 | uniform float* pdf_x; 29 | uniform float* pdf_y; 30 | }; 31 | 32 | uniform Distribution2D* uniform Distribution2D__new(const uniform float* uniform f, const uniform vec2ui size); 33 | 34 | Sample2f Distribution2D__sample(const uniform Distribution2D* uniform this, const vec2f &u); 35 | -------------------------------------------------------------------------------- /devices/device_ispc/samplers/sample.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | 21 | struct Sample1f { 22 | float v; 23 | float pdf; 24 | }; 25 | 26 | inline Sample1f make_Sample1f(const float v, const float pdf) 27 | { 28 | Sample1f s; 29 | s.v = v; 30 | s.pdf = pdf; 31 | return s; 32 | } 33 | 34 | struct Sample2f { 35 | vec2f v; 36 | float pdf; 37 | }; 38 | 39 | inline Sample2f make_Sample2f(const vec2f v, const float pdf) 40 | { 41 | Sample2f s; 42 | s.v = v; 43 | s.pdf = pdf; 44 | return s; 45 | } 46 | 47 | struct Sample3f { 48 | vec3f v; 49 | float pdf; 50 | }; 51 | 52 | inline Sample3f make_Sample3f(const vec3f v, const float pdf) 53 | { 54 | Sample3f s; 55 | s.v = v; 56 | s.pdf = pdf; 57 | return s; 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /devices/device_ispc/scene/instance.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "shapes/shape.isph" 20 | #include "materials/material.isph" 21 | #include "lights/light.isph" 22 | 23 | struct Instance 24 | { 25 | RefCount base; 26 | uniform Shape* shape; //!< Shape of the instance. 27 | uniform Material* material;//!< Material attached to the shape. 28 | uniform Light* light; //!< Area light attached to the shape. 29 | }; 30 | -------------------------------------------------------------------------------- /devices/device_ispc/shapes/differentialgeometry.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | 21 | struct DifferentialGeometry 22 | { 23 | vec3f P; //!< Hit location in world coordinates. 24 | vec3f Ng; //!< Geometric normal. 25 | vec3f Ns; //!< Shading normal. 26 | vec2f st; //!< Hit location in surface parameter space. 27 | float error; //!< Intersection error factor. 28 | }; 29 | -------------------------------------------------------------------------------- /devices/device_ispc/shapes/shape.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | #include "differentialgeometry.isph" 21 | 22 | struct Shape; 23 | 24 | /*! Performs interpolation of shading vertex parameters. */ 25 | typedef void (*PostIntersectFunc)(uniform const Shape *uniform this, 26 | const varying Ray &ray, 27 | varying DifferentialGeometry &dg); 28 | 29 | typedef void* uniform (*ShapeTransformFunc)(const uniform Shape* uniform this, const uniform AffineSpace3f& xfm); 30 | 31 | typedef uniform int (*AddFunc)(RTCScene scene, const uniform Shape* uniform this); 32 | 33 | struct Shape 34 | { 35 | RefCount base; 36 | PostIntersectFunc postIntersect; 37 | ShapeTransformFunc transform; 38 | AddFunc add; 39 | }; 40 | 41 | void Shape__Destructor(uniform RefCount* uniform this); 42 | 43 | void Shape__Constructor(uniform Shape* uniform this, 44 | uniform DestructorFunc destructor, 45 | uniform PostIntersectFunc postIntersect, 46 | uniform ShapeTransformFunc transform, 47 | uniform AddFunc add_); 48 | 49 | -------------------------------------------------------------------------------- /devices/device_ispc/shapes/sphere.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_SPHERE_H__ 18 | #define __EMBREE_ISPC_SPHERE_H__ 19 | 20 | #include "default.h" 21 | #include "../api/parms.h" 22 | 23 | namespace embree 24 | { 25 | class Sphere 26 | { 27 | public: 28 | 29 | /*! Construction from parameter container. */ 30 | static void* create (const Parms& parms); 31 | }; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /devices/device_ispc/shapes/trianglemesh.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_TRIANGLE_MESH_H__ 18 | #define __EMBREE_ISPC_TRIANGLE_MESH_H__ 19 | 20 | #include "default.h" 21 | #include "../api/parms.h" 22 | 23 | namespace embree 24 | { 25 | class ISPCTriangleMesh 26 | { 27 | public: 28 | 29 | /*! Construction from parameter container. */ 30 | static void* create (const Parms& parms); 31 | }; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /devices/device_ispc/shapes/trianglemesh.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_ISPC_TRIANGLE_MESH_H__ 18 | #define __EMBREE_ISPC_TRIANGLE_MESH_H__ 19 | 20 | #include "shape.isph" 21 | 22 | export void* uniform TriangleMesh__new( uniform vec3fa *uniform position, 23 | uniform vec3fa *uniform motion, 24 | uniform vec3fa *uniform normal, 25 | uniform vec2f *uniform texcoord, 26 | uniform int numPositions, 27 | uniform vec4i *uniform triangle, 28 | uniform int numTriangles); 29 | #endif 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /devices/device_ispc/textures/nearestneighbor.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "nearestneighbor_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct NearestNeighborTexture 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | ISPCRef image = parms.getImage("image"); 29 | return ispc::NearestNeighbor__new(image.ptr); 30 | } 31 | }; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /devices/device_ispc/textures/texture.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | 21 | struct Texture; 22 | 23 | typedef varying vec3f (*Texture__get)(const uniform Texture *uniform this, const varying vec2f& p); 24 | 25 | struct Texture 26 | { 27 | RefCount base; 28 | Texture__get get; 29 | }; 30 | 31 | inline void Texture__Destructor(uniform RefCount* uniform this) { 32 | LOG(print("Texture__Destructor\n")); 33 | RefCount__Destructor(this); 34 | } 35 | 36 | inline void Texture__Constructor(uniform Texture* uniform this, 37 | uniform DestructorFunc destructor, 38 | uniform Texture__get get) 39 | { 40 | LOG(print("Texture__Constructor\n")); 41 | RefCount__Constructor(&this->base,destructor); 42 | this->get = get; 43 | } 44 | -------------------------------------------------------------------------------- /devices/device_ispc/tonemappers/defaulttonemapper.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "api/parms.h" 20 | #include "defaulttonemapper_ispc.h" 21 | 22 | namespace embree 23 | { 24 | struct DefaultToneMapper 25 | { 26 | static void* create(const Parms& parms) 27 | { 28 | const float gamma = parms.getFloat("gamma",1.0f); 29 | const bool vignetting = parms.getBool("vignetting",true); 30 | return ispc::DefaultToneMapper__new(gamma,vignetting); 31 | } 32 | }; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /devices/device_ispc/tonemappers/tonemapper.isph: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #pragma once 18 | 19 | #include "default.isph" 20 | 21 | struct ToneMapper; 22 | 23 | typedef varying vec3f (*FunToneMap)(const uniform ToneMapper *uniform this, 24 | const varying vec3f v, 25 | const varying int x, const varying int y, const uniform vec2ui size); 26 | 27 | struct ToneMapper 28 | { 29 | RefCount base; 30 | FunToneMap toneMap; 31 | }; 32 | 33 | inline void ToneMapper__Destructor(uniform RefCount* uniform this) { 34 | LOG(print("ToneMapper__Destructor\n")); 35 | RefCount__Destructor(this); 36 | } 37 | 38 | inline void ToneMapper__Constructor(uniform ToneMapper* uniform this, 39 | uniform DestructorFunc destructor, 40 | uniform FunToneMap toneMap) 41 | { 42 | LOG(print("ToneMapper__Constructor\n")); 43 | RefCount__Constructor(&this->base,destructor); 44 | this->toneMap = toneMap; 45 | } 46 | -------------------------------------------------------------------------------- /devices/device_network/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 18 | 19 | ADD_LIBRARY(device_network SHARED network_device.cpp) 20 | TARGET_LINK_LIBRARIES(device_network sys image) 21 | 22 | SET(USE_LIBJPEG ON CACHE BOOL "Enable JPEG image codec.") 23 | IF (USE_LIBJPEG) 24 | FIND_PACKAGE(JPEG REQUIRED) 25 | IF (JPEG_FOUND) 26 | ADD_DEFINITIONS(-DUSE_LIBJPEG) 27 | INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) 28 | SET(ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} ${JPEG_LIBRARIES}) 29 | ENDIF (JPEG_FOUND) 30 | ENDIF (USE_LIBJPEG) 31 | 32 | ADD_EXECUTABLE(renderer_server network_server.cpp network_server_main.cpp) 33 | TARGET_LINK_LIBRARIES(renderer_server lexers device loaders ${ADDITIONAL_LIBRARIES}) 34 | 35 | -------------------------------------------------------------------------------- /devices/device_network/default.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_DEFAULT_H__ 18 | #define __EMBREE_DEFAULT_H__ 19 | 20 | #include "sys/platform.h" 21 | #include "sys/ref.h" 22 | #include "sys/intrinsics.h" 23 | #include "sys/stl/vector.h" 24 | #include "sys/stl/string.h" 25 | 26 | #include "math/math.h" 27 | #include "math/vec2.h" 28 | #include "math/vec3.h" 29 | #include "math/vec4.h" 30 | #include "math/col3.h" 31 | #include "math/affinespace.h" 32 | 33 | #include "simd/simd.h" 34 | 35 | #include "sys/thread.h" 36 | #include "sys/sync/atomic.h" 37 | #include "sys/sync/barrier.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /devices/device_singleray/api/data.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_DATA_H__ 18 | #define __EMBREE_DATA_H__ 19 | 20 | #include "../default.h" 21 | 22 | namespace embree 23 | { 24 | /*! Data container. */ 25 | class Data : public RefCount 26 | { 27 | public: 28 | 29 | Data (size_t bytes) : bytes(bytes) { 30 | ptr = alignedMalloc(bytes); 31 | } 32 | 33 | Data (size_t bytes, const void* ptr_i, bool copy = true) : bytes(bytes) { 34 | if (copy) { 35 | ptr = alignedMalloc(bytes); 36 | memcpy(ptr,ptr_i,bytes); 37 | } else { 38 | ptr = (void*)ptr_i; 39 | } 40 | } 41 | 42 | virtual ~Data () { 43 | alignedFree(ptr); ptr = NULL; 44 | bytes = 0; 45 | } 46 | 47 | __forceinline const char* map() const { return (const char*)ptr; } 48 | __forceinline char* map() { return ( char*)ptr; } 49 | 50 | size_t size() { return bytes; } 51 | 52 | private: 53 | void* ptr; 54 | size_t bytes; 55 | }; 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /devices/device_singleray/brdfs/reflection.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_REFLECTION_BRDF_H__ 18 | #define __EMBREE_REFLECTION_BRDF_H__ 19 | 20 | #include "../brdfs/brdf.h" 21 | #include "../brdfs/optics.h" 22 | 23 | namespace embree 24 | { 25 | /*! BRDF of a perfect mirror. */ 26 | class Reflection : public BRDF 27 | { 28 | public: 29 | 30 | /*! Reflection BRDF constructor. This is a specular reflection 31 | * BRDF. \param R is the reflectivity of the mirror. */ 32 | __forceinline Reflection(const Color& R) : BRDF(SPECULAR_REFLECTION), R(R) {} 33 | 34 | __forceinline Color eval(const Vector3f& wo, const DifferentialGeometry& dg, const Vector3f& wi) const { 35 | return zero; 36 | } 37 | 38 | Color sample(const Vector3f& wo, const DifferentialGeometry& dg, Sample3f& wi, const Vec2f& s) const { 39 | wi = reflect(wo,dg.Ns); 40 | return R; 41 | } 42 | 43 | float pdf(const Vector3f& wo, const DifferentialGeometry& dg, const Vector3f& wi) const { 44 | return zero; 45 | } 46 | 47 | private: 48 | 49 | /*! reflectivity of the mirror */ 50 | Color R; 51 | }; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /devices/device_singleray/brdfs/transmission.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_TRANSMISSION_BRDF_H__ 18 | #define __EMBREE_TRANSMISSION_BRDF_H__ 19 | 20 | #include "../brdfs/brdf.h" 21 | #include "../brdfs/optics.h" 22 | 23 | namespace embree 24 | { 25 | /*! BRDF of transmissive material. */ 26 | class Transmission : public BRDF 27 | { 28 | public: 29 | 30 | /*! Transmissive BRDF constructor. \param T is the transmission coefficient */ 31 | __forceinline Transmission(const Color& T) : BRDF(SPECULAR_TRANSMISSION), T(T) {} 32 | 33 | __forceinline Color eval(const Vector3f& wo, const DifferentialGeometry& dg, const Vector3f& wi) const { 34 | return zero; 35 | } 36 | 37 | Color sample(const Vector3f& wo, const DifferentialGeometry& dg, Sample3f& wi, const Vec2f& s) const { 38 | wi = -wo; return T; 39 | } 40 | 41 | float pdf(const Vector3f& wo, const DifferentialGeometry& dg, const Vector3f& wi) const { 42 | return zero; 43 | } 44 | 45 | private: 46 | 47 | /*! Transmission coefficient of the material. The range is [0,1] 48 | * where 0 means total absorption and 1 means total 49 | * transmission. */ 50 | Color T; 51 | }; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /devices/device_singleray/cameras/camera.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_CAMERA_H__ 18 | #define __EMBREE_CAMERA_H__ 19 | 20 | #include "../api/parms.h" 21 | #include "renderers/ray.h" 22 | 23 | namespace embree 24 | { 25 | /*! Interface to different camera models. */ 26 | class Camera : public RefCount { 27 | ALIGNED_CLASS 28 | public: 29 | 30 | /*! Virtual interface destructor. */ 31 | virtual ~Camera() {} 32 | 33 | /*! Computes a primary ray for a pixel. */ 34 | virtual void ray(const Vec2f& pixel, /*!< The pixel location on the on image plane in the range from 0 to 1. */ 35 | const Vec2f& sample, /*!< The lens sample in [0,1) for depth of field. */ 36 | Ray& ray_o) /*!< To return the ray. */ const = 0; 37 | 38 | /*! Field of view. */ 39 | float angle; 40 | }; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /devices/device_singleray/default.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_DEFAULT_H__ 18 | #define __EMBREE_DEFAULT_H__ 19 | 20 | #include "sys/platform.h" 21 | #include "sys/ref.h" 22 | #include "sys/intrinsics.h" 23 | #include "sys/stl/vector.h" 24 | #include "sys/stl/string.h" 25 | 26 | #include "math/math.h" 27 | #include "math/vec2.h" 28 | #include "math/vec3.h" 29 | #include "math/vec4.h" 30 | #include "math/color.h" 31 | #include "math/affinespace.h" 32 | 33 | #include "simd/simd.h" 34 | 35 | #include "sys/thread.h" 36 | #include "sys/sync/atomic.h" 37 | #include "sys/sync/barrier.h" 38 | 39 | #include "samplers/sample.h" 40 | #include "samplers/shapesampler.h" 41 | 42 | namespace embree 43 | { 44 | /* vertex and triangle layout */ 45 | struct RTCVertex { float x,y,z,a; }; 46 | struct RTCTriangle { int v0, v1, v2; }; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /devices/device_singleray/filters/boxfilter.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_BOX_FILTER_H__ 18 | #define __EMBREE_BOX_FILTER_H__ 19 | 20 | #include "filters/filter.h" 21 | 22 | namespace embree 23 | { 24 | /*! Implements a simple box filter. */ 25 | class BoxFilter : public Filter 26 | { 27 | public: 28 | 29 | /*! Constructs a box filter of specified half width. */ 30 | BoxFilter (const float halfWidth = 0.5f) 31 | : Filter(1.414213562f * halfWidth, 2.0f * halfWidth, 2.0f * halfWidth, uint32(ceil(halfWidth - 0.5f))), halfWidth(halfWidth) {} 32 | 33 | float eval(const Vec2f distanceToCenter) const { 34 | if (fabsf(distanceToCenter.x) <= halfWidth && fabsf(distanceToCenter.y) <= halfWidth) return 1.0f; 35 | else return 0.0f; 36 | } 37 | private: 38 | float halfWidth; //!< Half the width of the box filter 39 | }; 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /devices/device_singleray/filters/bsplinefilter.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_BSPLINE_FILTER_H__ 18 | #define __EMBREE_BSPLINE_FILTER_H__ 19 | 20 | #include "filters/filter.h" 21 | 22 | namespace embree 23 | { 24 | /*! Implements a B-Spline filter. */ 25 | class BSplineFilter : public Filter 26 | { 27 | public: 28 | BSplineFilter () : Filter(2.0f,4.0f,4.0f,2) { init(); } 29 | 30 | float eval(const Vec2f distanceToCenter) const 31 | { 32 | float d = length(distanceToCenter); 33 | if (d > 2.0f) return 0.0f; 34 | else if (d < 1.0f) { 35 | float t = 1.0f - d; 36 | return ((((-3.0f*t)+3.0f)*t+3.0f)*t+1.0f)/6.0f; 37 | } 38 | else { 39 | float t = 2.0f - d; 40 | return t*t*t/6.0f; 41 | } 42 | } 43 | }; 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /devices/device_singleray/filters/filter.cpp: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "filters/filter.h" 18 | #include "sys/stl/array2d.h" 19 | 20 | namespace embree 21 | { 22 | void Filter::init() 23 | { 24 | float invTableSize = 1.0f / tableSize; 25 | Array2D absoluteValues(tableSize, tableSize); 26 | 27 | for (uint32 x = 0; x < tableSize; ++x) { 28 | for (uint32 y = 0; y < tableSize; ++y) { 29 | Vec2f pos((x+0.5f)*invTableSize*width - width*0.5f, 30 | (y+0.5f)*invTableSize*height - height*0.5f); 31 | absoluteValues.set(x, y, fabsf(eval(pos))); 32 | } 33 | } 34 | distribution.init(absoluteValues, tableSize, tableSize); 35 | } 36 | 37 | Vec2f Filter::sample(const Vec2f uv) const 38 | { 39 | Sample2f result = distribution.sample(uv); 40 | result.value.x = result.value.x/tableSize*width - width*0.5f; 41 | result.value.y = result.value.y/tableSize*height - height*0.5f; 42 | return result; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /devices/device_singleray/materials/matte.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_MATTE_H__ 18 | #define __EMBREE_MATTE_H__ 19 | 20 | #include "../materials/material.h" 21 | #include "../brdfs/lambertian.h" 22 | 23 | namespace embree 24 | { 25 | /*! Implements a diffuse material. */ 26 | class Matte : public Material 27 | { 28 | public: 29 | 30 | /*! Construction from parameters. */ 31 | Matte (const Parms& parms) { 32 | reflectance = parms.getColor("reflectance",one); 33 | } 34 | 35 | void shade(const Ray& ray, const Medium& currentMedium, const DifferentialGeometry& dg, CompositedBRDF& brdfs) const { 36 | brdfs.add(NEW_BRDF(Lambertian)(reflectance)); 37 | } 38 | 39 | protected: 40 | 41 | /*! Diffuse reflectance of the surface. The range is from 0 42 | * (black) to 1 (white). */ 43 | Color reflectance; 44 | }; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /devices/device_singleray/materials/matte_textured.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_MATTE_TEXTURED_H__ 18 | #define __EMBREE_MATTE_TEXTURED_H__ 19 | 20 | #include "../materials/material.h" 21 | #include "../brdfs/lambertian.h" 22 | #include "../textures/texture.h" 23 | 24 | namespace embree 25 | { 26 | /*! Implements a diffuse and textured material.*/ 27 | class MatteTextured : public Material 28 | { 29 | public: 30 | 31 | /*! Construction from parameters. */ 32 | MatteTextured (const Parms& parms) 33 | { 34 | Kd = parms.getTexture("Kd"); 35 | s0 = parms.getVec2f("s0",Vec2f(0.0f,0.0f)); 36 | ds = parms.getVec2f("ds",Vec2f(1.0f,1.0f)); 37 | } 38 | 39 | void shade(const Ray& ray, const Medium& currentMedium, const DifferentialGeometry& dg, CompositedBRDF& brdfs) const { 40 | if (Kd) brdfs.add(NEW_BRDF(Lambertian)(Kd->get(ds*dg.st+s0))); 41 | } 42 | 43 | protected: 44 | Vec2f s0; //!< Offset for texture coordinates. 45 | Vec2f ds; //!< Scaling for texture coordinates. 46 | Ref Kd; //!< Texture mapped to the surface. 47 | }; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /devices/device_singleray/materials/medium.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_MEDIUM_H__ 18 | #define __EMBREE_MEDIUM_H__ 19 | 20 | #include "../default.h" 21 | 22 | namespace embree 23 | { 24 | /*! Medium description. The integrator tracks the current medium for 25 | * computing volumetric effects. */ 26 | class Medium { 27 | public: 28 | 29 | /*! Medium constructor. */ 30 | __forceinline Medium (const Color& transmission = one, float eta = one) 31 | : transmission(transmission), eta(eta) {} 32 | 33 | /*! Builds a vacuum. */ 34 | static Medium Vacuum() { 35 | return Medium(one, one); 36 | } 37 | 38 | /*! Comparision of two media. */ 39 | __forceinline bool operator==(const Medium& m) const { 40 | return transmission == m.transmission && eta == m.eta; 41 | } 42 | 43 | public: 44 | Color transmission; //!< Transmissivity of medium. 45 | float eta; //!< Refraction index of medium. 46 | }; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /devices/device_singleray/materials/mirror.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_MIRROR_H__ 18 | #define __EMBREE_MIRROR_H__ 19 | 20 | #include "../materials/material.h" 21 | #include "../brdfs/reflection.h" 22 | 23 | namespace embree 24 | { 25 | /*! Implements a mirror material. The reflected light can be 26 | * modulated with a mirror reflectivity. */ 27 | class Mirror : public Material 28 | { 29 | public: 30 | 31 | /*! Construction from parameters. */ 32 | Mirror(const Parms& parms) { 33 | reflectance = parms.getColor("reflectance",one); 34 | } 35 | 36 | void shade(const Ray& ray, const Medium& currentMedium, const DifferentialGeometry& dg, CompositedBRDF& brdfs) const { 37 | brdfs.add(NEW_BRDF(Reflection)(reflectance)); 38 | } 39 | 40 | protected: 41 | Color reflectance; //!< Reflectivity of the mirror 42 | }; 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /devices/device_singleray/renderers/progress.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_PROGRESS_H__ 18 | #define __EMBREE_PROGRESS_H__ 19 | 20 | #include "../default.h" 21 | #include "sys/sync/atomic.h" 22 | #include "sys/sync/mutex.h" 23 | 24 | namespace embree 25 | { 26 | /*! prints progress during rendering */ 27 | class Progress 28 | { 29 | public: 30 | Progress (size_t num = 0); 31 | void start(); 32 | void next(); 33 | void end(); 34 | private: 35 | void drawEmptyBar(); 36 | private: 37 | MutexSys mutex; //!< Mutex to protect progress output 38 | size_t curElement; //!< Number of elements processed 39 | size_t numElements; //!< Total number of elements to process 40 | size_t numDrawn; //!< Number of progress characters drawn 41 | size_t terminalWidth; //!< Width of terminal window in characters 42 | }; 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /devices/device_singleray/shapes/trianglemesh.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_TRIANGLE_MESH_H__ 18 | #define __EMBREE_TRIANGLE_MESH_H__ 19 | 20 | #include "trianglemesh_normals.h" 21 | #include "trianglemesh_full.h" 22 | 23 | namespace embree 24 | { 25 | class TriangleMesh 26 | { 27 | public: 28 | 29 | static Ref create (const Parms& parms) 30 | { 31 | bool hasPositions = parms.getData("positions"); 32 | bool hasMotions = parms.getData("motions"); 33 | bool hasNormals = parms.getData("normals"); 34 | bool hasTangents = parms.getData("tangent_x") | parms.getData("tangent_y"); 35 | bool hasTexCoords = parms.getData("texcoords") | parms.getData("texcoords0"); 36 | 37 | if (hasPositions && !hasMotions && hasNormals && !hasTangents && !hasTexCoords) 38 | return new TriangleMeshWithNormals(parms); 39 | else 40 | return new TriangleMeshFull(parms); 41 | } 42 | }; 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /devices/device_singleray/textures/nearestneighbor.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_NEAREST_NEIGHBOR_H__ 18 | #define __EMBREE_NEAREST_NEIGHBOR_H__ 19 | 20 | #include "image/image.h" 21 | #include "../textures/texture.h" 22 | 23 | namespace embree 24 | { 25 | /*! Implements an image mapped texture with nearest neighbor 26 | * lookup. */ 27 | class NearestNeighbor : public Texture 28 | { 29 | public: 30 | 31 | /*! Construction from image. */ 32 | NearestNeighbor (const Ref& image) 33 | : image(image) { 34 | } 35 | 36 | /*! Construction from parameters. */ 37 | NearestNeighbor (const Parms& parms) { 38 | image = parms.getImage("image"); 39 | } 40 | 41 | Color4 get(const Vec2f& p) const { 42 | float s1 = p.x-floor(p.x), t1 = p.y-floor(p.y); 43 | int si = (int)(s1*float(image->width)), ti = (int)(t1*float(image->height)); 44 | int ix = clamp(si, int(0), int(image->width-1)); 45 | int iy = clamp(ti, int(0), int(image->height-1)); 46 | return image->get(ix,iy); 47 | } 48 | 49 | protected: 50 | Ref image; //!< Image mapped to surface. 51 | }; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /devices/device_singleray/textures/texture.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_TEXTURE_H__ 18 | #define __EMBREE_TEXTURE_H__ 19 | 20 | #include "../default.h" 21 | 22 | namespace embree 23 | { 24 | /*! Interface for different textures. Textures implement a mapping 25 | * from a surface point to a color. */ 26 | class Texture : public RefCount { 27 | ALIGNED_CLASS 28 | public: 29 | 30 | /*! Texture virtual destructor. */ 31 | virtual ~Texture() {}; 32 | 33 | /*! Returns the color for a surface point p. \param p is the 34 | * location to query the color for. The range is 0 to 1. */ 35 | virtual Color4 get(const Vec2f& p) const = 0; 36 | }; 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /devices/device_singleray/tonemappers/tonemapper.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __EMBREE_TONEMAPPER_H__ 18 | #define __EMBREE_TONEMAPPER_H__ 19 | 20 | #include "../api/parms.h" 21 | #include "../api/swapchain.h" 22 | 23 | namespace embree 24 | { 25 | /*! Interface to different tonemappers. */ 26 | class ToneMapper : public RefCount { 27 | ALIGNED_CLASS 28 | public: 29 | 30 | /*! Tonemappers need a virtual destructor. */ 31 | virtual ~ToneMapper() {} 32 | 33 | /*! Evaluates the tonemapper, */ 34 | virtual Color eval (const Color& color, const int x, const int y, const Ref& swapchain) const = 0; 35 | }; 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /devices/renderer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | FIND_PACKAGE(GLUT REQUIRED) 18 | FIND_PACKAGE(OpenGL REQUIRED) 19 | 20 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}) 21 | 22 | ADD_EXECUTABLE(renderer 23 | renderer.cpp 24 | glutdisplay.cpp 25 | regression.cpp 26 | ) 27 | 28 | TARGET_LINK_LIBRARIES(renderer sys lexers loaders image device ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES}) 29 | -------------------------------------------------------------------------------- /devices/renderer/glutdisplay.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "sys/platform.h" 18 | #include "sys/ref.h" 19 | #include "math/math.h" 20 | #include "math/vec2.h" 21 | #include "math/vec3.h" 22 | #include "math/vec4.h" 23 | #include "math/col3.h" 24 | #include "math/affinespace.h" 25 | #include "image/image.h" 26 | #include "lexers/streamfilters.h" 27 | #include "lexers/parsestream.h" 28 | #include "device/loaders/loaders.h" 29 | #include "device/device.h" 30 | #include "device/handle.h" 31 | 32 | namespace embree 33 | { 34 | /* starts display mode */ 35 | void GLUTDisplay(const AffineSpace3f& camSpace, float speed, Handle& scene); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /devices/renderer/regression.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #include "sys/platform.h" 18 | #include "device/device.h" 19 | #include "device/handle.h" 20 | 21 | namespace embree 22 | { 23 | Handle createRandomScene(Device *device, size_t numLights, size_t numObjects, size_t numTriangles); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /devices/renderer/renderer.ivproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 20 | 24 | 25 | 28 | 34 | 38 | 39 | 42 | 48 | 52 | 53 | 56 | 62 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /models/cornell_box.ecs: -------------------------------------------------------------------------------- 1 | -i cornell_box.obj 2 | -quadlight 213 548.77 227 130 0 0 0 0 105 50 50 50 3 | #-pointlight 213 300 227 150000 150000 150000 4 | #-spotlight 213 300 227 -1 -1 1 300000 300000 300000 90 90 5 | #-ambientlight 1 1 1 6 | #-directionallight -0.5 -0.4 1 2 2 2 7 | #-distantlight -0.5 -0.4 1 150 150 150 5 8 | #-hdrilight 1 1 1 lines.ppm 9 | -vp 278 273 -800 -vi 278 273 0 -vu 0 1 0 -fov 37 10 | -renderer pathtracer { depth = 2 } 11 | -------------------------------------------------------------------------------- /models/cornell_box.mtl: -------------------------------------------------------------------------------- 1 | newmtl white 2 | Ka 0 0 0 3 | Kd 1 1 1 4 | Ks 0 0 0 5 | 6 | newmtl red 7 | Ka 0 0 0 8 | Kd 1 0 0 9 | Ks 0 0 0 10 | 11 | newmtl green 12 | Ka 0 0 0 13 | Kd 0 1 0 14 | Ks 0 0 0 15 | 16 | newmtl blue 17 | Ka 0 0 0 18 | Kd 0 0 1 19 | Ks 0 0 0 20 | 21 | newmtl light 22 | Ka 20 20 20 23 | Kd 1 1 1 24 | Ks 0 0 0 25 | -------------------------------------------------------------------------------- /models/cornell_box_spheres.ecs: -------------------------------------------------------------------------------- 1 | -i cornell_box_spheres.xml 2 | -vp 278 273 -800 -vi 278 273 0 -vu 0 1 0 -fov 37 3 | -renderer pathtracer { spp = 1 depth = 2 } 4 | 5 | 6 | -------------------------------------------------------------------------------- /models/lines.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embree/embree-renderer/fefc933946894a716c656fdab0c6d62b76c6c1d3/models/lines.ppm -------------------------------------------------------------------------------- /models/sphere_carpaint.ecs: -------------------------------------------------------------------------------- 1 | -i sphere_carpaint.xml 2 | -c sphere_view.ecs 3 | #-ambientlight 0.5 0.5 0.5 4 | -renderer pathtracer 5 | -------------------------------------------------------------------------------- /models/sphere_carpaint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 100 0 8 | 100 9 | 50 10 | 50 11 | 12 | "MetallicPaint" 13 | 14 | 1.45 15 | 0.5 0.0 0.0 16 | 17 | 18 | 19 | 20 | 21 | -1000 0 -1000 1000 0 -1000 1000 0 1000 -1000 0 1000 22 | 0 1 0 0 1 0 0 1 0 0 1 0 23 | 0 0 1 0 1 1 0 1 24 | 0 1 2 2 3 0 25 | 26 | "MatteTextured" 27 | 28 | "lines.ppm" 29 | 0 0 30 | 1 1 31 | 32 | 33 | 34 | 35 | 36 | 1 0 0 0 0 1 0 0 0 0 1 0 37 | 2.0 1.5 1.2 38 | "lines.ppm" 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /models/sphere_glass.ecs: -------------------------------------------------------------------------------- 1 | -i sphere_glass.xml 2 | -c sphere_view.ecs 3 | #-ambientlight 1 1 1 4 | -renderer pathtracer 5 | -------------------------------------------------------------------------------- /models/sphere_glass.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 100 0 8 | 100 9 | 50 10 | 50 11 | 12 | "glass" 13 | 14 | 1 1 1 15 | 1 16 | 1.45 17 | 18 | 19 | 20 | 21 | 22 | -1000 0 -1000 1000 0 -1000 1000 0 1000 -1000 0 1000 23 | 0 1 0 0 1 0 0 1 0 0 1 0 24 | 0 0 1 0 1 1 0 1 25 | 0 1 2 2 3 0 26 | 27 | "MatteTextured" 28 | 29 | "lines.ppm" 30 | 0 0 31 | 1 1 32 | 33 | 34 | 35 | 36 | 37 | 1 0 0 0 0 1 0 0 0 0 1 0 38 | 2.0 1.5 1.2 39 | "lines.ppm" 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /models/sphere_gold.ecs: -------------------------------------------------------------------------------- 1 | -i sphere_gold.xml 2 | -c sphere_view.ecs 3 | -renderer pathtracer 4 | -------------------------------------------------------------------------------- /models/sphere_gold.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | "Metal" 8 | 9 | 0.19 0.45 1.50 10 | 3.06 2.40 1.88 11 | 0.005 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 0 100 0 20 | 100 21 | 100 22 | 100 23 | 24 | 25 | 26 | 27 | -1000 0 -1000 1000 0 -1000 1000 0 1000 -1000 0 1000 28 | 0 1 0 0 1 0 0 1 0 0 1 0 29 | 0 0 1 0 1 1 0 1 30 | 0 1 2 2 3 0 31 | 32 | "MatteTextured" 33 | 34 | "lines.ppm" 35 | 0 0 36 | 1 1 37 | 38 | 39 | 40 | 41 | 42 | 1 0 0 0 0 1 0 0 0 0 1 0 43 | 2.0 1.5 1.2 44 | "lines.ppm" 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /models/sphere_mirror.ecs: -------------------------------------------------------------------------------- 1 | -i sphere_mirror.xml 2 | -c sphere_view.ecs 3 | -renderer pathtracer 4 | -------------------------------------------------------------------------------- /models/sphere_mirror.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 100 0 8 | 100 9 | 50 10 | 50 11 | 12 | "mirror" 13 | 14 | 1 1 1 15 | 16 | 17 | 18 | 19 | 20 | -1000 0 -1000 1000 0 -1000 1000 0 1000 -1000 0 1000 21 | 0 1 0 0 1 0 0 1 0 0 1 0 22 | 0 0 1 0 1 1 0 1 23 | 0 1 2 2 3 0 24 | 25 | "MatteTextured" 26 | 27 | "lines.ppm" 28 | 0 0 29 | 1 1 30 | 31 | 32 | 33 | 34 | 35 | 1 0 0 0 0 1 0 0 0 0 1 0 36 | 2.0 1.5 1.2 37 | "lines.ppm" 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /models/sphere_motion.ecs: -------------------------------------------------------------------------------- 1 | -i sphere_motion.xml 2 | 3 | -vp -119.999 519.273 292.713 4 | -vi 304.489 40.8668 -159.324 5 | -vu 0 1 0 6 | -fov 60 7 | 8 | -renderer pathtracer 9 | -accel bvh4mb 10 | -------------------------------------------------------------------------------- /models/sphere_view.ecs: -------------------------------------------------------------------------------- 1 | -vp -200 100 200 2 | -vi 0 100 0 3 | -vu 0 1 0 4 | -fov 60 5 | -------------------------------------------------------------------------------- /tools/obj2xml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | ADD_EXECUTABLE(obj2xml 18 | obj2xml.cpp 19 | objLoader.cpp 20 | xmlWriter.cpp 21 | ) 22 | 23 | TARGET_LINK_LIBRARIES(obj2xml sys image) 24 | 25 | -------------------------------------------------------------------------------- /tools/obj2xml/obj2xml.cpp: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // INTEL CORPORATION PROPRIETARY INFORMATION // 3 | // This software is supplied under the terms of a license agreement or // 4 | // nondisclosure agreement with Intel Corporation and may not be copied // 5 | // or disclosed except in accordance with the terms of that agreement. // 6 | // Copyright (C) 2012 Intel Corporation. All Rights Reserved. // 7 | // ======================================================================== // 8 | 9 | #include 10 | #include 11 | #include "objLoader.h" 12 | #include "xmlWriter.h" 13 | 14 | int main(int argc, char **argv) { 15 | 16 | /*! all file names must be specified on the command line */ 17 | if (argc != 4) printf(" USAGE: obj2xml \n"), exit(1); 18 | 19 | /*! load the OBJ file */ 20 | embree::Ref scene = embree::loadOBJ(argv[1]); 21 | 22 | /*! write the Embree XML shell and binary scene data */ 23 | embree::writeXML(argv[2], argv[3], scene); 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /tools/obj2xml/xmlWriter.h: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // Copyright 2009-2013 Intel Corporation // 3 | // // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); // 5 | // you may not use this file except in compliance with the License. // 6 | // You may obtain a copy of the License at // 7 | // // 8 | // http://www.apache.org/licenses/LICENSE-2.0 // 9 | // // 10 | // Unless required by applicable law or agreed to in writing, software // 11 | // distributed under the License is distributed on an "AS IS" BASIS, // 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // 13 | // See the License for the specific language governing permissions and // 14 | // limitations under the License. // 15 | // ======================================================================== // 16 | 17 | #ifndef __XML_WRITER_H__ 18 | #define __XML_WRITER_H__ 19 | 20 | #include "objLoader.h" 21 | 22 | namespace embree 23 | { 24 | 25 | /*! write out scene geometry and materials in Embree XML format */ 26 | void writeXML(const char *xmlFileName, const char *binFileName, const Ref scene); 27 | 28 | } 29 | 30 | #endif // __XML_WRITER_H__ 31 | 32 | -------------------------------------------------------------------------------- /tools/vrml2xml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | ADD_EXECUTABLE(vrml2xml 18 | vrml_loader.cpp 19 | ../obj2xml/xmlWriter.cpp 20 | vrml2xml.cpp 21 | ) 22 | 23 | TARGET_LINK_LIBRARIES(vrml2xml sys lexers image) 24 | 25 | -------------------------------------------------------------------------------- /tools/vrml2xml/vrml2xml.cpp: -------------------------------------------------------------------------------- 1 | // ======================================================================== // 2 | // INTEL CORPORATION PROPRIETARY INFORMATION // 3 | // This software is supplied under the terms of a license agreement or // 4 | // nondisclosure agreement with Intel Corporation and may not be copied // 5 | // or disclosed except in accordance with the terms of that agreement. // 6 | // Copyright (C) 2012 Intel Corporation. All Rights Reserved. // 7 | // ======================================================================== // 8 | 9 | #include 10 | #include 11 | #include "vrml_loader.h" 12 | #include "../obj2xml/xmlWriter.h" 13 | 14 | int main(int argc, char **argv) { 15 | 16 | /*! all file names must be specified on the command line */ 17 | if (argc != 4) printf(" USAGE: obj2xml \n"), exit(1); 18 | 19 | /*! load the VRML file */ 20 | embree::VRMLLoader loader(argv[1]); 21 | 22 | /*! write the Embree XML shell and binary scene data */ 23 | embree::writeXML(argv[2], argv[3], loader.scene); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tools/xml2obj/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## ======================================================================== ## 2 | ## Copyright 2009-2013 Intel Corporation ## 3 | ## ## 4 | ## Licensed under the Apache License, Version 2.0 (the "License"); ## 5 | ## you may not use this file except in compliance with the License. ## 6 | ## You may obtain a copy of the License at ## 7 | ## ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 9 | ## ## 10 | ## Unless required by applicable law or agreed to in writing, software ## 11 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## 13 | ## See the License for the specific language governing permissions and ## 14 | ## limitations under the License. ## 15 | ## ======================================================================== ## 16 | 17 | ADD_EXECUTABLE(xml2obj 18 | xml2obj.cpp 19 | ) 20 | 21 | TARGET_LINK_LIBRARIES(xml2obj sys loaders) 22 | 23 | --------------------------------------------------------------------------------