rtcSetGeometryDisplacementFunction.3embree3 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .TH "rtcSetGeometryDisplacementFunction" "3" "" "" "Embree Ray Tracing Kernels 3"
  2. .SS NAME
  3. .IP
  4. .nf
  5. \f[C]
  6. rtcSetGeometryDisplacementFunction\ \-\ sets\ the\ displacement\ function
  7. \ \ for\ a\ subdivision\ geometry
  8. \f[]
  9. .fi
  10. .SS SYNOPSIS
  11. .IP
  12. .nf
  13. \f[C]
  14. #include\ <embree3/rtcore.h>
  15. struct\ RTCDisplacementFunctionNArguments
  16. {
  17. \ \ void*\ geometryUserPtr;
  18. \ \ RTCGeometry\ geometry;
  19. \ \ unsigned\ int\ primID;
  20. \ \ unsigned\ int\ timeStep;
  21. \ \ const\ float*\ u;
  22. \ \ const\ float*\ v;
  23. \ \ const\ float*\ Ng_x;
  24. \ \ const\ float*\ Ng_y;
  25. \ \ const\ float*\ Ng_z;
  26. \ \ float*\ P_x;
  27. \ \ float*\ P_y;
  28. \ \ float*\ P_z;
  29. \ \ unsigned\ int\ N;
  30. };
  31. typedef\ void\ (*RTCDisplacementFunctionN)(
  32. \ \ \ const\ struct\ RTCDisplacementFunctionNArguments*\ args
  33. );
  34. void\ rtcSetGeometryDisplacementFunction(
  35. \ \ RTCGeometry\ geometry,
  36. \ \ RTCDisplacementFunctionN\ displacement
  37. );
  38. \f[]
  39. .fi
  40. .SS DESCRIPTION
  41. .PP
  42. The \f[C]rtcSetGeometryDisplacementFunction\f[] function registers a
  43. displacement callback function (\f[C]displacement\f[] argument) for the
  44. specified subdivision geometry (\f[C]geometry\f[] argument).
  45. .PP
  46. Only a single callback function can be registered per geometry, and
  47. further invocations overwrite the previously set callback function.
  48. Passing \f[C]NULL\f[] as function pointer disables the registered
  49. callback function.
  50. .PP
  51. The registered displacement callback function is invoked to displace
  52. points on the subdivision geometry during spatial acceleration structure
  53. construction, during the \f[C]rtcCommitScene\f[] call.
  54. .PP
  55. The callback function of type \f[C]RTCDisplacementFunctionN\f[] is
  56. invoked with a number of arguments stored inside the
  57. \f[C]RTCDisplacementFunctionNArguments\f[] structure.
  58. The provided user data pointer of the geometry (\f[C]geometryUserPtr\f[]
  59. member) can be used to point to the application\[aq]s representation of
  60. the subdivision mesh.
  61. A number \f[C]N\f[] of points to displace are specified in a structure
  62. of array layout.
  63. For each point to displace, the local patch UV coordinates (\f[C]u\f[]
  64. and \f[C]v\f[] arrays), the normalized geometry normal (\f[C]Ng_x\f[],
  65. \f[C]Ng_y\f[], and \f[C]Ng_z\f[] arrays), and the position
  66. (\f[C]P_x\f[], \f[C]P_y\f[], and \f[C]P_z\f[] arrays) are provided.
  67. The task of the displacement function is to use this information and
  68. change the position data.
  69. .PP
  70. The geometry handle (\f[C]geometry\f[] member) and primitive ID
  71. (\f[C]primID\f[] member) of the patch to displace are additionally
  72. provided as well as the time step \f[C]timeStep\f[], which can be
  73. important if the displacement is time\-dependent and motion blur is
  74. used.
  75. .PP
  76. All passed arrays must be aligned to 64 bytes and properly padded to
  77. make wide vector processing inside the displacement function easily
  78. possible.
  79. .PP
  80. Also see tutorial [Displacement Geometry] for an example of how to use
  81. the displacement mapping functions.
  82. .SS EXIT STATUS
  83. .PP
  84. On failure an error code is set that can be queried using
  85. \f[C]rtcGetDeviceError\f[].
  86. .SS SEE ALSO
  87. .PP
  88. [RTC_GEOMETRY_TYPE_SUBDIVISION]