MCPcopy Create free account
hub / github.com/RenderKit/embree / device_render

Function device_render

tutorials/pathtracer/pathtracer_device.cpp:1794–1843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1792
1793/* called by the C++ code to render */
1794extern "C" void device_render (int* pixels,
1795 const unsigned int width,
1796 const unsigned int height,
1797 const float time,
1798 const ISPCCamera& camera)
1799{
1800 /* create scene */
1801 if (data.scene == nullptr) {
1802 data.scene = convertScene(data.ispc_scene);
1803 if (g_subdiv_mode) updateEdgeLevels(data.ispc_scene,camera.xfm.p);
1804 rtcCommitScene (data.scene);
1805 data.traversable = rtcGetSceneTraversable(data.scene);
1806 }
1807
1808 /* create accumulator */
1809 if (data.accu_width != width || data.accu_height != height) {
1810 alignedUSMFree(data.accu);
1811 data.accu = (Vec3ff*) alignedUSMMalloc((width*height)*sizeof(Vec3ff),16,EmbreeUSMMode::DEVICE_READ_WRITE);
1812 data.accu_width = width;
1813 data.accu_height = height;
1814 for (unsigned int i=0; i<width*height; i++)
1815 data.accu[i] = Vec3ff(0.0f);
1816 }
1817
1818 /* reset accumulator */
1819 bool camera_changed = g_changed || !g_accumulate || g_animation_mode; g_changed = false;
1820 camera_changed |= ne(g_accu_vx,camera.xfm.l.vx); g_accu_vx = camera.xfm.l.vx;
1821 camera_changed |= ne(g_accu_vy,camera.xfm.l.vy); g_accu_vy = camera.xfm.l.vy;
1822 camera_changed |= ne(g_accu_vz,camera.xfm.l.vz); g_accu_vz = camera.xfm.l.vz;
1823 camera_changed |= ne(g_accu_p, camera.xfm.p); g_accu_p = camera.xfm.p;
1824
1825 if (camera_changed)
1826 {
1827 data.accu_count=0;
1828 for (unsigned int i=0; i<width*height; i++)
1829 data.accu[i] = Vec3ff(0.0f);
1830
1831 if (g_subdiv_mode) {
1832 updateEdgeLevels(data.ispc_scene,camera.xfm.p);
1833 rtcCommitScene (data.scene);
1834 data.traversable = rtcGetSceneTraversable(data.scene);
1835 }
1836 }
1837 else
1838 data.accu_count++;
1839
1840 if (g_animation_mode)
1841 UpdateScene(g_ispc_scene, time);
1842
1843} // device_render
1844
1845/* called by the C++ code for cleanup */
1846extern "C" void device_cleanup ()

Callers

nothing calls this directly

Calls 7

rtcCommitSceneFunction · 0.85
alignedUSMFreeFunction · 0.85
alignedUSMMallocFunction · 0.85
UpdateSceneFunction · 0.85
convertSceneFunction · 0.70
updateEdgeLevelsFunction · 0.70
neFunction · 0.50

Tested by

no test coverage detected