primitive.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. // ======================================================================== //
  2. // Copyright 2009-2017 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. #include "primitive.h"
  17. #include "bezier1v.h"
  18. #include "bezier1i.h"
  19. #include "linei.h"
  20. #include "triangle.h"
  21. #include "trianglev.h"
  22. #include "trianglei.h"
  23. #include "trianglev_mb.h"
  24. #include "trianglei_mb.h"
  25. #include "quadv.h"
  26. #include "quadi.h"
  27. #include "quadi_mb.h"
  28. #include "subdivpatch1cached.h"
  29. #include "object.h"
  30. namespace embree
  31. {
  32. /********************** Bezier1v **************************/
  33. Bezier1v::Type::Type ()
  34. : PrimitiveType("bezier1v",sizeof(Bezier1v),1) {}
  35. size_t Bezier1v::Type::size(const char* This) const {
  36. return 1;
  37. }
  38. Bezier1v::Type Bezier1v::type;
  39. /********************** Bezier1i **************************/
  40. Bezier1i::Type::Type ()
  41. : PrimitiveType("bezier1i",sizeof(Bezier1i),1) {}
  42. size_t Bezier1i::Type::size(const char* This) const {
  43. return 1;
  44. }
  45. Bezier1i::Type Bezier1i::type;
  46. /********************** Line4i **************************/
  47. template<>
  48. Line4i::Type::Type ()
  49. : PrimitiveType("line4i",sizeof(Line4i),4) {}
  50. template<>
  51. size_t Line4i::Type::size(const char* This) const {
  52. return ((Line4i*)This)->size();
  53. }
  54. /********************** Triangle4 **************************/
  55. template<>
  56. Triangle4::Type::Type ()
  57. : PrimitiveType("triangle4",sizeof(Triangle4),4) {}
  58. template<>
  59. size_t Triangle4::Type::size(const char* This) const {
  60. return ((Triangle4*)This)->size();
  61. }
  62. /********************** Triangle4v **************************/
  63. template<>
  64. Triangle4v::Type::Type ()
  65. : PrimitiveType("triangle4v",sizeof(Triangle4v),4) {}
  66. template<>
  67. size_t Triangle4v::Type::size(const char* This) const {
  68. return ((Triangle4v*)This)->size();
  69. }
  70. /********************** Triangle4i **************************/
  71. template<>
  72. Triangle4i::Type::Type ()
  73. : PrimitiveType("triangle4i",sizeof(Triangle4i),4) {}
  74. template<>
  75. size_t Triangle4i::Type::size(const char* This) const {
  76. return ((Triangle4i*)This)->size();
  77. }
  78. /********************** Triangle4vMB **************************/
  79. template<>
  80. Triangle4vMB::Type::Type ()
  81. : PrimitiveType("triangle4vmb",sizeof(Triangle4vMB),4) {}
  82. template<>
  83. size_t Triangle4vMB::Type::size(const char* This) const {
  84. return ((Triangle4vMB*)This)->size();
  85. }
  86. /********************** Triangle4iMB **************************/
  87. template<>
  88. Triangle4iMB::Type::Type ()
  89. : PrimitiveType("triangle4imb",sizeof(Triangle4iMB),4) {}
  90. template<>
  91. size_t Triangle4iMB::Type::size(const char* This) const {
  92. return ((Triangle4iMB*)This)->size();
  93. }
  94. /********************** Quad4v **************************/
  95. template<>
  96. Quad4v::Type::Type ()
  97. : PrimitiveType("quad4v",sizeof(Quad4v),4) {}
  98. template<>
  99. size_t Quad4v::Type::size(const char* This) const {
  100. return ((Quad4v*)This)->size();
  101. }
  102. /********************** Quad4i **************************/
  103. template<>
  104. Quad4i::Type::Type ()
  105. : PrimitiveType("quad4i",sizeof(Quad4i),4) {}
  106. template<>
  107. size_t Quad4i::Type::size(const char* This) const {
  108. return ((Quad4i*)This)->size();
  109. }
  110. /********************** Quad4iMB **************************/
  111. template<>
  112. Quad4iMB::Type::Type ()
  113. : PrimitiveType("quad4imb",sizeof(Quad4iMB),4) {}
  114. template<>
  115. size_t Quad4iMB::Type::size(const char* This) const {
  116. return ((Quad4iMB*)This)->size();
  117. }
  118. /********************** SubdivPatch1 **************************/
  119. SubdivPatch1Cached::Type::Type ()
  120. : PrimitiveType("subdivpatch1",sizeof(SubdivPatch1Cached),1) {}
  121. size_t SubdivPatch1Cached::Type::size(const char* This) const {
  122. return 1;
  123. }
  124. SubdivPatch1Cached::Type SubdivPatch1Cached::type;
  125. /********************** SubdivPatch1Cached **************************/
  126. SubdivPatch1Cached::TypeCached::TypeCached ()
  127. : PrimitiveType("subdivpatch1cached",sizeof(SubdivPatch1Cached),1) {}
  128. size_t SubdivPatch1Cached::TypeCached::size(const char* This) const {
  129. return 1;
  130. }
  131. SubdivPatch1Cached::TypeCached SubdivPatch1Cached::type_cached;
  132. /********************** Virtual Object **************************/
  133. Object::Type::Type ()
  134. : PrimitiveType("object",sizeof(Object),1) {}
  135. size_t Object::Type::size(const char* This) const {
  136. return 1;
  137. }
  138. Object::Type Object::type;
  139. }