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

Function device_render

tutorials/user_geometry/user_geometry_device.cpp:903–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901
902/* called by the C++ code to render */
903extern "C" void device_render (int* pixels,
904 const unsigned int width,
905 const unsigned int height,
906 const float time,
907 const ISPCCamera& camera)
908{
909 float t0 = 0.7f*time;
910 float t1 = 1.5f*time;
911
912 /* rotate instances around themselves */
913 LinearSpace3fa xfm;
914 xfm.vx = Vec3fa(cos(t1),0,sin(t1));
915 xfm.vy = Vec3fa(0,1,0);
916 xfm.vz = Vec3fa(-sin(t1),0,cos(t1));
917
918 /* calculate transformations to move instances in circles */
919 data.g_instance[0]->local2world = AffineSpace3fa(xfm,2.2f*Vec3fa(+cos(t0),0.0f,+sin(t0)));
920 data.g_instance[1]->local2world = AffineSpace3fa(xfm,2.2f*Vec3fa(-cos(t0),0.0f,-sin(t0)));
921 data.g_instance[2]->local2world = AffineSpace3fa(xfm,2.2f*Vec3fa(-sin(t0),0.0f,+cos(t0)));
922 data.g_instance[3]->local2world = AffineSpace3fa(xfm,2.2f*Vec3fa(+sin(t0),0.0f,-cos(t0)));
923
924 /* update scene */
925 updateInstance(data.g_scene,data.g_instance[0]);
926 updateInstance(data.g_scene,data.g_instance[1]);
927 updateInstance(data.g_scene,data.g_instance[2]);
928 updateInstance(data.g_scene,data.g_instance[3]);
929 rtcCommitScene (data.g_scene);
930 data.g_traversable = rtcGetSceneTraversable(data.g_scene);
931}
932
933/* called by the C++ code for cleanup */
934extern "C" void device_cleanup ()

Callers

nothing calls this directly

Calls 5

rtcCommitSceneFunction · 0.85
updateInstanceFunction · 0.70
Vec3faClass · 0.50
cosFunction · 0.50
sinFunction · 0.50

Tested by

no test coverage detected