scriptup 2026.0.1 → 2026.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -24
  3. data/ext/arc_curve.c +50 -0
  4. data/ext/attribute_dictionaries.c +49 -32
  5. data/ext/attribute_dictionary.c +54 -127
  6. data/ext/axes.c +79 -0
  7. data/ext/behavior.c +100 -9
  8. data/ext/bounding_box.c +195 -0
  9. data/ext/camera.c +178 -0
  10. data/ext/classifications.c +85 -0
  11. data/ext/color.c +91 -163
  12. data/ext/component_definition.c +78 -162
  13. data/ext/component_instance.c +88 -9
  14. data/ext/construction.c +59 -0
  15. data/ext/curve.c +87 -0
  16. data/ext/definition_list.c +89 -109
  17. data/ext/depend +1 -0
  18. data/ext/drawing_element.c +96 -117
  19. data/ext/edge.c +147 -0
  20. data/ext/edge_use.c +37 -0
  21. data/ext/entities.c +573 -16
  22. data/ext/entities_builder.c +145 -0
  23. data/ext/entity.c +175 -215
  24. data/ext/environments.c +149 -0
  25. data/ext/extconf.rb +54 -10
  26. data/ext/face.c +331 -0
  27. data/ext/geom.c +172 -0
  28. data/ext/group.c +86 -0
  29. data/ext/helpers.c +244 -0
  30. data/ext/image.c +182 -0
  31. data/ext/image_rep.c +158 -0
  32. data/ext/instance_path.c +185 -0
  33. data/ext/lat_long.c +88 -0
  34. data/ext/layer.c +98 -0
  35. data/ext/layer_folder.c +99 -0
  36. data/ext/layers.c +122 -0
  37. data/ext/length.c +253 -0
  38. data/ext/line_styles.c +60 -0
  39. data/ext/loop.c +24 -0
  40. data/ext/material.c +144 -197
  41. data/ext/materials.c +49 -60
  42. data/ext/model.c +232 -26
  43. data/ext/options_store.c +188 -0
  44. data/ext/page.c +168 -0
  45. data/ext/pages.c +135 -0
  46. data/ext/point2d.c +195 -0
  47. data/ext/point3d.c +340 -0
  48. data/ext/polygon_mesh.c +253 -0
  49. data/ext/scriptup.h +279 -0
  50. data/ext/section_plane.c +44 -0
  51. data/ext/sketchup.c +102 -76
  52. data/ext/styles.c +91 -0
  53. data/ext/text.c +135 -0
  54. data/ext/texture.c +74 -83
  55. data/ext/texture_writer.c +104 -0
  56. data/ext/transformation.c +309 -0
  57. data/ext/transformation2d.c +190 -0
  58. data/ext/uv_helper.c +41 -0
  59. data/ext/vector2d.c +238 -0
  60. data/ext/vector3d.c +294 -0
  61. data/ext/vertex.c +67 -0
  62. data/lib/sketchup.rb +2 -2
  63. data/sig/_top_level.rbs +188 -0
  64. data/sig/array.rbs +52 -0
  65. data/sig/geom/bounding_box.rbs +28 -0
  66. data/sig/geom/bounds2d.rbs +20 -0
  67. data/sig/geom/lat_long.rbs +13 -0
  68. data/sig/geom/oriented_bounds2d.rbs +10 -0
  69. data/sig/geom/point2d.rbs +32 -0
  70. data/sig/geom/point3d.rbs +46 -0
  71. data/sig/geom/polygon_mesh.rbs +35 -0
  72. data/sig/geom/transformation.rbs +44 -0
  73. data/sig/geom/transformation2d.rbs +26 -0
  74. data/sig/geom/utm.rbs +14 -0
  75. data/sig/geom/vector2d.rbs +40 -0
  76. data/sig/geom/vector3d.rbs +49 -0
  77. data/sig/geom.rbs +25 -0
  78. data/sig/language_handler.rbs +8 -0
  79. data/sig/layout/angular_dimension.rbs +32 -0
  80. data/sig/layout/auto_text_definition.rbs +73 -0
  81. data/sig/layout/auto_text_definitions.rbs +15 -0
  82. data/sig/layout/connection_point.rbs +6 -0
  83. data/sig/layout/dictionary.rbs +18 -0
  84. data/sig/layout/document.rbs +61 -0
  85. data/sig/layout/ellipse.rbs +5 -0
  86. data/sig/layout/entities.rbs +10 -0
  87. data/sig/layout/entity.rbs +28 -0
  88. data/sig/layout/formatted_text.rbs +30 -0
  89. data/sig/layout/grid.rbs +24 -0
  90. data/sig/layout/group.rbs +17 -0
  91. data/sig/layout/image.rbs +7 -0
  92. data/sig/layout/label.rbs +31 -0
  93. data/sig/layout/layer.rbs +21 -0
  94. data/sig/layout/layer_instance.rbs +9 -0
  95. data/sig/layout/layers.rbs +18 -0
  96. data/sig/layout/linear_dimension.rbs +39 -0
  97. data/sig/layout/locked_entity_error.rbs +4 -0
  98. data/sig/layout/locked_layer_error.rbs +4 -0
  99. data/sig/layout/page.rbs +20 -0
  100. data/sig/layout/page_info.rbs +37 -0
  101. data/sig/layout/pages.rbs +17 -0
  102. data/sig/layout/path.rbs +34 -0
  103. data/sig/layout/rectangle.rbs +15 -0
  104. data/sig/layout/reference_entity.rbs +7 -0
  105. data/sig/layout/sketch_up_model.rbs +54 -0
  106. data/sig/layout/style.rbs +150 -0
  107. data/sig/layout/table.rbs +17 -0
  108. data/sig/layout/table_cell.rbs +13 -0
  109. data/sig/layout/table_column.rbs +10 -0
  110. data/sig/layout/table_row.rbs +10 -0
  111. data/sig/layout.rbs +4 -0
  112. data/sig/length.rbs +37 -0
  113. data/sig/numeric.rbs +23 -0
  114. data/sig/sketchup/animation.rbs +8 -0
  115. data/sig/sketchup/app_observer.rbs +11 -0
  116. data/sig/sketchup/arc_curve.rbs +14 -0
  117. data/sig/sketchup/attribute_dictionaries.rbs +11 -0
  118. data/sig/sketchup/attribute_dictionary.rbs +18 -0
  119. data/sig/sketchup/axes.rbs +13 -0
  120. data/sig/sketchup/behavior.rbs +19 -0
  121. data/sig/sketchup/camera.rbs +33 -0
  122. data/sig/sketchup/classification_schema.rbs +8 -0
  123. data/sig/sketchup/classifications.rbs +12 -0
  124. data/sig/sketchup/color.rbs +22 -0
  125. data/sig/sketchup/component_definition.rbs +43 -0
  126. data/sig/sketchup/component_instance.rbs +32 -0
  127. data/sig/sketchup/console.rbs +8 -0
  128. data/sig/sketchup/construction_line.rbs +17 -0
  129. data/sig/sketchup/construction_point.rbs +5 -0
  130. data/sig/sketchup/curve.rbs +13 -0
  131. data/sig/sketchup/definition_list.rbs +26 -0
  132. data/sig/sketchup/definition_observer.rbs +6 -0
  133. data/sig/sketchup/definitions_observer.rbs +8 -0
  134. data/sig/sketchup/dimension.rbs +18 -0
  135. data/sig/sketchup/dimension_linear.rbs +24 -0
  136. data/sig/sketchup/dimension_observer.rbs +5 -0
  137. data/sig/sketchup/dimension_radial.rbs +9 -0
  138. data/sig/sketchup/drawingelement.rbs +18 -0
  139. data/sig/sketchup/edge.rbs +24 -0
  140. data/sig/sketchup/edge_use.rbs +13 -0
  141. data/sig/sketchup/entities.rbs +61 -0
  142. data/sig/sketchup/entities_builder.rbs +15 -0
  143. data/sig/sketchup/entities_observer.rbs +9 -0
  144. data/sig/sketchup/entity.rbs +21 -0
  145. data/sig/sketchup/entity_observer.rbs +6 -0
  146. data/sig/sketchup/environment.rbs +25 -0
  147. data/sig/sketchup/environments.rbs +18 -0
  148. data/sig/sketchup/environments_observer.rbs +8 -0
  149. data/sig/sketchup/extensions_manager.rbs +11 -0
  150. data/sig/sketchup/face.rbs +44 -0
  151. data/sig/sketchup/frame_change_observer.rbs +5 -0
  152. data/sig/sketchup/group.rbs +38 -0
  153. data/sig/sketchup/http/request.rbs +17 -0
  154. data/sig/sketchup/http/response.rbs +7 -0
  155. data/sig/sketchup/http.rbs +27 -0
  156. data/sig/sketchup/image.rbs +23 -0
  157. data/sig/sketchup/image_rep.rbs +17 -0
  158. data/sig/sketchup/importer.rbs +14 -0
  159. data/sig/sketchup/input_point.rbs +25 -0
  160. data/sig/sketchup/instance_observer.rbs +6 -0
  161. data/sig/sketchup/instance_path.rbs +20 -0
  162. data/sig/sketchup/layer.rbs +20 -0
  163. data/sig/sketchup/layer_folder.rbs +26 -0
  164. data/sig/sketchup/layers.rbs +30 -0
  165. data/sig/sketchup/layers_observer.rbs +13 -0
  166. data/sig/sketchup/licensing/extension_license.rbs +8 -0
  167. data/sig/sketchup/licensing.rbs +15 -0
  168. data/sig/sketchup/line_style.rbs +5 -0
  169. data/sig/sketchup/line_styles.rbs +13 -0
  170. data/sig/sketchup/load_handler.rbs +8 -0
  171. data/sig/sketchup/loop.rbs +10 -0
  172. data/sig/sketchup/material.rbs +74 -0
  173. data/sig/sketchup/materials.rbs +22 -0
  174. data/sig/sketchup/materials_observer.rbs +10 -0
  175. data/sig/sketchup/menu.rbs +9 -0
  176. data/sig/sketchup/model.rbs +105 -0
  177. data/sig/sketchup/model_observer.rbs +23 -0
  178. data/sig/sketchup/options_manager.rbs +12 -0
  179. data/sig/sketchup/options_provider.rbs +23 -0
  180. data/sig/sketchup/options_provider_observer.rbs +5 -0
  181. data/sig/sketchup/overlay.rbs +21 -0
  182. data/sig/sketchup/overlays_manager.rbs +10 -0
  183. data/sig/sketchup/page.rbs +55 -0
  184. data/sig/sketchup/pages.rbs +25 -0
  185. data/sig/sketchup/pages_observer.rbs +7 -0
  186. data/sig/sketchup/pick_helper.rbs +28 -0
  187. data/sig/sketchup/regional_settings.rbs +7 -0
  188. data/sig/sketchup/rendering_options.rbs +89 -0
  189. data/sig/sketchup/rendering_options_observer.rbs +5 -0
  190. data/sig/sketchup/section_plane.rbs +12 -0
  191. data/sig/sketchup/selection.rbs +31 -0
  192. data/sig/sketchup/selection_observer.rbs +8 -0
  193. data/sig/sketchup/set.rbs +15 -0
  194. data/sig/sketchup/shadow_info.rbs +18 -0
  195. data/sig/sketchup/shadow_info_observer.rbs +5 -0
  196. data/sig/sketchup/skp.rbs +5 -0
  197. data/sig/sketchup/snap.rbs +10 -0
  198. data/sig/sketchup/style.rbs +9 -0
  199. data/sig/sketchup/styles.rbs +21 -0
  200. data/sig/sketchup/text.rbs +22 -0
  201. data/sig/sketchup/texture.rbs +14 -0
  202. data/sig/sketchup/texture_writer.rbs +14 -0
  203. data/sig/sketchup/tool.rbs +45 -0
  204. data/sig/sketchup/tools.rbs +14 -0
  205. data/sig/sketchup/tools_observer.rbs +6 -0
  206. data/sig/sketchup/uv_helper.rbs +6 -0
  207. data/sig/sketchup/vertex.rbs +11 -0
  208. data/sig/sketchup/view.rbs +87 -0
  209. data/sig/sketchup/view_observer.rbs +6 -0
  210. data/sig/sketchup.rbs +137 -0
  211. data/sig/sketchup_extension.rbs +23 -0
  212. data/sig/string.rbs +5 -0
  213. data/sig/ui/command.rbs +20 -0
  214. data/sig/ui/html_dialog.rbs +29 -0
  215. data/sig/ui/notification.rbs +16 -0
  216. data/sig/ui/toolbar.rbs +18 -0
  217. data/sig/ui/web_dialog.rbs +38 -0
  218. data/sig/ui.rbs +66 -0
  219. metadata +204 -287
  220. data/ext/attribute_dictionaries.h +0 -8
  221. data/ext/attribute_dictionary.h +0 -8
  222. data/ext/behavior.h +0 -8
  223. data/ext/color.h +0 -8
  224. data/ext/component_definition.h +0 -8
  225. data/ext/component_instance.h +0 -8
  226. data/ext/definition_list.h +0 -8
  227. data/ext/drawing_element.h +0 -8
  228. data/ext/entities.h +0 -8
  229. data/ext/entity.h +0 -8
  230. data/ext/material.h +0 -8
  231. data/ext/materials.h +0 -8
  232. data/ext/model.h +0 -8
  233. data/ext/not_implemented.c +0 -88
  234. data/ext/not_implemented.h +0 -20
  235. data/ext/sketchup.h +0 -9
  236. data/ext/texture.h +0 -8
  237. data/ext/typed_value.c +0 -84
  238. data/ext/typed_value.h +0 -11
  239. data/ext/utils.h +0 -111
  240. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeometry.dylib +0 -0
  241. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeoutils.dylib +0 -0
  242. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonImage.dylib +0 -4
  243. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonPreferences.dylib +0 -0
  244. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUnits.dylib +0 -0
  245. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUtils.dylib +0 -0
  246. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonZip.dylib +0 -0
  247. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +0 -36
  248. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
  249. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -262
  250. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
  251. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
  252. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
  253. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
  254. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -70
  255. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
  256. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
  257. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
  258. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
  259. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
  260. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
  261. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
  262. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
  263. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
  264. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -154
  265. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
  266. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -187
  267. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
  268. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
  269. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
  270. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
  271. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
  272. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
  273. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
  274. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
  275. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
  276. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
  277. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
  278. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -629
  279. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition_snap_to_behavior_private.h +0 -46
  280. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
  281. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
  282. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -147
  283. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -224
  284. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
  285. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
  286. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
  287. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
  288. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
  289. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
  290. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
  291. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
  292. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -879
  293. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -189
  294. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
  295. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
  296. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environment.h +0 -382
  297. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environments.h +0 -133
  298. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -702
  299. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
  300. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
  301. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -695
  302. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -245
  303. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
  304. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
  305. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -289
  306. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
  307. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
  308. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
  309. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
  310. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
  311. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
  312. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
  313. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
  314. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -797
  315. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
  316. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1826
  317. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_entity_type_private.h +0 -44
  318. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
  319. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
  320. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
  321. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
  322. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
  323. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -180
  324. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -1016
  325. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
  326. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
  327. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
  328. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
  329. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
  330. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
  331. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/snap.h +0 -183
  332. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/space.h +0 -26
  333. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
  334. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -192
  335. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -392
  336. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -380
  337. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
  338. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
  339. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
  340. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
  341. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -125
  342. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
  343. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
  344. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
  345. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
  346. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
  347. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
  348. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
  349. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -891
  350. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
  351. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
  352. data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
  353. data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
  354. data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
  355. data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
  356. data/sketchup-sdk-win/binaries/layout/x64/LayOutView.dll +0 -4
  357. data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
  358. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
  359. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
  360. data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
  361. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
  362. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
  363. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
  364. data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
  365. data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
  366. data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
  367. data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
  368. data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
  369. data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
  370. data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
  371. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
  372. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
  373. data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
  374. data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
  375. data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
  376. data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -937
  377. data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -78
  378. data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
  379. data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -402
  380. data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
  381. data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
  382. data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
  383. data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
  384. data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -244
  385. data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
  386. data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
  387. data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
  388. data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
  389. data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
  390. data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
  391. data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -508
  392. data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -331
  393. data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
  394. data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
  395. data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
  396. data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
  397. data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
  398. data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -681
  399. data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1116
  400. data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -472
  401. data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -180
  402. data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
  403. data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
  404. data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -262
  405. data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
  406. data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
  407. data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
  408. data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
  409. data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -70
  410. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
  411. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
  412. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
  413. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
  414. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
  415. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
  416. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
  417. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
  418. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
  419. data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -154
  420. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
  421. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -187
  422. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
  423. data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
  424. data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
  425. data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
  426. data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
  427. data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
  428. data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
  429. data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
  430. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
  431. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
  432. data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
  433. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -629
  434. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition_snap_to_behavior_private.h +0 -46
  435. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
  436. data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
  437. data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -147
  438. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -224
  439. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
  440. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
  441. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
  442. data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
  443. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
  444. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
  445. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
  446. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
  447. data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -879
  448. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -189
  449. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
  450. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
  451. data/sketchup-sdk-win/headers/SketchUpAPI/model/environment.h +0 -382
  452. data/sketchup-sdk-win/headers/SketchUpAPI/model/environments.h +0 -133
  453. data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -702
  454. data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
  455. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
  456. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -695
  457. data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -245
  458. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
  459. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
  460. data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -289
  461. data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
  462. data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
  463. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
  464. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
  465. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
  466. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
  467. data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
  468. data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
  469. data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -797
  470. data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
  471. data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1826
  472. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_entity_type_private.h +0 -44
  473. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
  474. data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
  475. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
  476. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
  477. data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
  478. data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -180
  479. data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -1016
  480. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
  481. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
  482. data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
  483. data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
  484. data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
  485. data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
  486. data/sketchup-sdk-win/headers/SketchUpAPI/model/snap.h +0 -183
  487. data/sketchup-sdk-win/headers/SketchUpAPI/model/space.h +0 -26
  488. data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
  489. data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -192
  490. data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -392
  491. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -380
  492. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
  493. data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
  494. data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
  495. data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
  496. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -125
  497. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
  498. data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
  499. data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
  500. data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
  501. data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
@@ -0,0 +1,149 @@
1
+ #include <scriptup.h>
2
+
3
+ #define ENVIRONMENT(self) SU_REF(SUEnvironmentRef, self)
4
+ #define ENVIRONMENTS(self) SU_REF(SUEnvironmentsRef, self)
5
+
6
+ DEFINE_STRING_GETTER(environment_name, SUEnvironmentRef, SUEnvironmentGetName)
7
+ DEFINE_STRING_SETTER(environment_set_name, SUEnvironmentRef, SUEnvironmentSetName)
8
+ DEFINE_STRING_GETTER(environment_description, SUEnvironmentRef, SUEnvironmentGetDescription)
9
+ DEFINE_STRING_SETTER(environment_set_description, SUEnvironmentRef, SUEnvironmentSetDescription)
10
+ DEFINE_BOOL_GETTER(environment_use_as_skydome_p, SUEnvironmentRef, SUEnvironmentGetUseAsSkydome)
11
+ DEFINE_BOOL_SETTER(environment_set_use_as_skydome, SUEnvironmentRef, SUEnvironmentSetUseAsSkydome)
12
+ DEFINE_BOOL_GETTER(environment_use_for_reflections_p, SUEnvironmentRef, SUEnvironmentGetUseForReflections)
13
+ DEFINE_BOOL_SETTER(environment_set_use_for_reflections, SUEnvironmentRef, SUEnvironmentSetUseForReflections)
14
+ DEFINE_BOOL_GETTER(environment_linked_sun_p, SUEnvironmentRef, SUEnvironmentGetLinkedSun)
15
+ DEFINE_BOOL_SETTER(environment_set_linked_sun, SUEnvironmentRef, SUEnvironmentSetLinkedSun)
16
+ DEFINE_DOUBLE_GETTER(environment_rotation, SUEnvironmentRef, SUEnvironmentGetRotation)
17
+ DEFINE_SETTER(environment_set_rotation, SUEnvironmentRef, SUEnvironmentSetRotation, NUM2DBL)
18
+ DEFINE_DOUBLE_GETTER(environment_skydome_exposure, SUEnvironmentRef, SUEnvironmentGetSkydomeExposure)
19
+ DEFINE_SETTER(environment_set_skydome_exposure, SUEnvironmentRef, SUEnvironmentSetSkydomeExposure, NUM2DBL)
20
+ DEFINE_DOUBLE_GETTER(environment_reflection_exposure, SUEnvironmentRef, SUEnvironmentGetReflectionExposure)
21
+ DEFINE_SETTER(environment_set_reflection_exposure, SUEnvironmentRef, SUEnvironmentSetReflectionExposure, NUM2DBL)
22
+
23
+ static VALUE environment_linked_sun_position(VALUE self)
24
+ {
25
+ struct SUPoint2D p = {0, 0};
26
+ SUEnvironmentGetLinkedSunPosition(ENVIRONMENT(self), &p);
27
+ return su_point3d_new((struct SUPoint3D){p.x, p.y, 0});
28
+ }
29
+
30
+ static VALUE environment_set_linked_sun_position(VALUE self, VALUE position)
31
+ {
32
+ struct SUPoint3D p = su_to_point3d(position);
33
+ struct SUPoint2D xy = {p.x, p.y};
34
+ if (SUEnvironmentSetLinkedSunPosition(ENVIRONMENT(self), &xy) != SU_ERROR_NONE)
35
+ rb_raise(rb_eArgError, "invalid sun position");
36
+ return position;
37
+ }
38
+
39
+ static VALUE environment_thumbnail(VALUE self)
40
+ {
41
+ SUImageRepRef image = SU_INVALID;
42
+ SUImageRepCreate(&image);
43
+ if (SUEnvironmentGetThumbnail(ENVIRONMENT(self), &image) != SU_ERROR_NONE)
44
+ {
45
+ SUImageRepRelease(&image);
46
+ return Qnil;
47
+ }
48
+ return su_image_rep_new(image);
49
+ }
50
+
51
+ // Writes the HDR image into the given directory and returns the written path.
52
+ static VALUE environment_write_hdr(VALUE self, VALUE directory)
53
+ {
54
+ SUStringRef path = SU_INVALID;
55
+ SUStringCreate(&path);
56
+ enum SUResult result = SUEnvironmentWriteHDRImageToFile(ENVIRONMENT(self), StringValueCStr(directory), &path);
57
+ VALUE output = su_string_to_rb(path);
58
+ SUStringRelease(&path);
59
+ if (result != SU_ERROR_NONE)
60
+ rb_raise(rb_eArgError, "cannot write the HDR image to %"PRIsVALUE, directory);
61
+ return output;
62
+ }
63
+
64
+ DEFINE_REF_LIST(environments_list, SUEnvironmentsRef, SUEnvironmentsGetCount, SUEnvironmentsGetAll, SUEnvironmentRef, cEnvironment)
65
+ DEFINE_SIZE_GETTER(environments_size, SUEnvironmentsRef, SUEnvironmentsGetCount)
66
+
67
+ static VALUE environments_each(VALUE self)
68
+ {
69
+ return su_yield_each(self, environments_list(ENVIRONMENTS(self)));
70
+ }
71
+
72
+ static VALUE environments_aref(VALUE self, VALUE name)
73
+ {
74
+ SUEnvironmentRef environment = SU_INVALID;
75
+ SUEnvironmentsGetEnvironmentByName(ENVIRONMENTS(self), StringValueCStr(name), &environment);
76
+ return su_wrap_or_nil(cEnvironment, environment.ptr);
77
+ }
78
+
79
+ static VALUE environments_add(int argc, VALUE* argv, VALUE self)
80
+ {
81
+ rb_check_arity(argc, 1, 2);
82
+ VALUE path = argv[argc - 1];
83
+ const char* name = argc == 2 ? StringValueCStr(argv[0]) : "";
84
+ SUEnvironmentRef environment = SU_INVALID;
85
+ if (SUEnvironmentCreateFromFile(&environment, StringValueCStr(path), name) != SU_ERROR_NONE)
86
+ rb_raise(rb_eArgError, "cannot load an environment from %"PRIsVALUE, path);
87
+ if (SUEnvironmentsAdd(ENVIRONMENTS(self), environment) != SU_ERROR_NONE)
88
+ {
89
+ SUEnvironmentRelease(&environment);
90
+ rb_raise(rb_eArgError, "cannot add the environment");
91
+ }
92
+ return su_wrap(cEnvironment, environment.ptr);
93
+ }
94
+
95
+ static VALUE environments_remove(VALUE self, VALUE environment)
96
+ {
97
+ return BOOL2RB(SUEnvironmentsRemove(ENVIRONMENTS(self), (SUEnvironmentRef){su_unwrap(environment, cEnvironment)}) == SU_ERROR_NONE);
98
+ }
99
+
100
+ static VALUE environments_current(VALUE self)
101
+ {
102
+ SUEnvironmentRef environment = SU_INVALID;
103
+ SUEnvironmentsGetSelectedEnvironment(ENVIRONMENTS(self), &environment);
104
+ return su_wrap_or_nil(cEnvironment, environment.ptr);
105
+ }
106
+
107
+ // Model#environments
108
+ static VALUE model_environments(VALUE model)
109
+ {
110
+ SUEnvironmentsRef environments = SU_INVALID;
111
+ SUModelGetEnvironments(SU_REF(SUModelRef, model), &environments);
112
+ return su_wrap_or_nil(cEnvironments, environments.ptr);
113
+ }
114
+
115
+ void Init_environments(void)
116
+ {
117
+ static const struct { const char* name; VALUE (*fn)(ANYARGS); int argc; } methods[] = {
118
+ {"name", RUBY_METHOD_FUNC(environment_name), 0},
119
+ {"name=", RUBY_METHOD_FUNC(environment_set_name), 1},
120
+ {"description", RUBY_METHOD_FUNC(environment_description), 0},
121
+ {"description=", RUBY_METHOD_FUNC(environment_set_description), 1},
122
+ {"use_as_skydome?", RUBY_METHOD_FUNC(environment_use_as_skydome_p), 0},
123
+ {"use_as_skydome=", RUBY_METHOD_FUNC(environment_set_use_as_skydome), 1},
124
+ {"use_for_reflections?", RUBY_METHOD_FUNC(environment_use_for_reflections_p), 0},
125
+ {"use_for_reflections=", RUBY_METHOD_FUNC(environment_set_use_for_reflections), 1},
126
+ {"linked_sun?", RUBY_METHOD_FUNC(environment_linked_sun_p), 0},
127
+ {"linked_sun=", RUBY_METHOD_FUNC(environment_set_linked_sun), 1},
128
+ {"linked_sun_position", RUBY_METHOD_FUNC(environment_linked_sun_position), 0},
129
+ {"linked_sun_position=", RUBY_METHOD_FUNC(environment_set_linked_sun_position), 1},
130
+ {"rotation", RUBY_METHOD_FUNC(environment_rotation), 0},
131
+ {"rotation=", RUBY_METHOD_FUNC(environment_set_rotation), 1},
132
+ {"skydome_exposure", RUBY_METHOD_FUNC(environment_skydome_exposure), 0},
133
+ {"skydome_exposure=", RUBY_METHOD_FUNC(environment_set_skydome_exposure), 1},
134
+ {"reflection_exposure", RUBY_METHOD_FUNC(environment_reflection_exposure), 0},
135
+ {"reflection_exposure=", RUBY_METHOD_FUNC(environment_set_reflection_exposure), 1},
136
+ {"thumbnail", RUBY_METHOD_FUNC(environment_thumbnail), 0},
137
+ {"write_hdr", RUBY_METHOD_FUNC(environment_write_hdr), 1},
138
+ };
139
+ for (size_t i = 0; i < sizeof(methods) / sizeof(methods[0]); i++)
140
+ rb_define_method(cEnvironment, methods[i].name, methods[i].fn, methods[i].argc);
141
+ rb_include_module(cEnvironments, rb_mEnumerable);
142
+ rb_define_method(cEnvironments, "each", environments_each, 0);
143
+ rb_define_method(cEnvironments, "[]", environments_aref, 1);
144
+ rb_define_method(cEnvironments, "size", environments_size, 0);
145
+ rb_define_method(cEnvironments, "add", environments_add, -1);
146
+ rb_define_method(cEnvironments, "remove", environments_remove, 1);
147
+ rb_define_method(cEnvironments, "current", environments_current, 0);
148
+ rb_define_method(cModel, "environments", model_environments, 0);
149
+ }
data/ext/extconf.rb CHANGED
@@ -1,10 +1,63 @@
1
1
  require 'mkmf'
2
+ require 'fileutils'
3
+ require 'net/http'
4
+ require 'tmpdir'
5
+ require 'uri'
2
6
 
3
7
  MAC = RUBY_PLATFORM =~ /darwin/
4
8
  WIN = !MAC
5
9
 
6
10
  extension_name = 'sketchup'
7
- sdk_path = "#{__dir__}/../sketchup-sdk-#{MAC ? 'mac' : 'win'}"
11
+ sdk_path = File.expand_path('../sketchup-sdk', __dir__)
12
+
13
+ # The SketchUp SDK isn't redistributable: the user supplies the zip from extensions.sketchup.com.
14
+ # SKETCHUP_SDK_PATH path to the SDK zip
15
+ # SKETCHUP_SDK_URL URL to download the zip from (SKETCHUP_SDK_TOKEN is sent as a bearer token)
16
+ def download(url, destination, token, limit = 10)
17
+ abort 'Too many redirects while downloading the SketchUp SDK' if limit.zero?
18
+ uri = URI(url)
19
+ request = Net::HTTP::Get.new(uri)
20
+ request['Authorization'] = "Bearer #{token}" if token && !token.empty?
21
+ Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
22
+ http.request(request) do |response|
23
+ case response
24
+ when Net::HTTPSuccess then File.open(destination, 'wb') { |f| response.read_body { |chunk| f.write(chunk) } }
25
+ when Net::HTTPRedirection then return download(response['location'], destination, nil, limit - 1)
26
+ else abort "Failed to download the SketchUp SDK from #{url}: #{response.code} #{response.message}"
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ def extract(zip, destination)
33
+ FileUtils.mkdir_p(destination)
34
+ # ditto keeps the framework's symlinks on macOS; Windows' bsdtar reads zips (MSYS's GNU tar doesn't).
35
+ tar = File.join(ENV.fetch('SystemRoot', 'C:/Windows'), 'System32', 'tar.exe')
36
+ ok = MAC ? system('ditto', '-x', '-k', zip, destination) : system(tar, '-xf', zip, '-C', destination)
37
+ abort "Failed to extract the SketchUp SDK from #{zip}" unless ok
38
+ end
39
+
40
+ unless File.directory?(sdk_path)
41
+ zip = ENV['SKETCHUP_SDK_PATH']
42
+ url = ENV['SKETCHUP_SDK_URL']
43
+ if zip && !zip.empty?
44
+ abort "SKETCHUP_SDK_PATH does not exist: #{zip}" unless File.file?(zip)
45
+ extract(zip, sdk_path)
46
+ elsif url && !url.empty?
47
+ Dir.mktmpdir do |dir|
48
+ download(url, File.join(dir, 'sdk.zip'), ENV['SKETCHUP_SDK_TOKEN'])
49
+ extract(File.join(dir, 'sdk.zip'), sdk_path)
50
+ end
51
+ else
52
+ abort <<~MESSAGE
53
+ scriptup builds against the SketchUp C API SDK, which you have to provide.
54
+ Download the #{MAC ? 'macOS' : 'Windows'} SDK from https://extensions.sketchup.com/sketchup-sdk and set
55
+ SKETCHUP_SDK_PATH=/path/to/sdk.zip
56
+ or
57
+ SKETCHUP_SDK_URL=https://host/sdk.zip (optionally with SKETCHUP_SDK_TOKEN)
58
+ MESSAGE
59
+ end
60
+ end
8
61
 
9
62
  # Work around for how framework headers are structured
10
63
  if MAC && !File.exist?("#{sdk_path}/headers/SketchUpAPI")
@@ -12,15 +65,6 @@ if MAC && !File.exist?("#{sdk_path}/headers/SketchUpAPI")
12
65
  FileUtils.symlink('../SketchUpAPI.framework/Headers', "#{sdk_path}/headers/SketchUpAPI")
13
66
  end
14
67
 
15
- # Work around for fact gems can't handle symlinks
16
- if MAC
17
- framework = "#{sdk_path}/SketchUpAPI.framework"
18
- FileUtils.symlink('Versions/A/SketchUpAPI', "#{framework}/SketchUpAPI") unless File.exist?("#{framework}/SketchUpAPI")
19
- FileUtils.symlink('Versions/A/Resources', "#{framework}/Resources") unless File.exist?("#{framework}/Resources")
20
- FileUtils.symlink('Versions/A/Headers', "#{framework}/Headers") unless File.exist?("#{framework}/Headers")
21
- FileUtils.symlink('A', "#{framework}/Versions/Current") unless File.exist?("#{framework}/Versions/Current")
22
- end
23
-
24
68
  # rubocop:disable Style/GlobalVars
25
69
  $INCFLAGS << " -I#{sdk_path}/headers"
26
70
  $CFLAGS << " #{'-Werror' if MAC } -O0 " if ENV['SCRIPTUP_DEVELOPMENT']
data/ext/face.c ADDED
@@ -0,0 +1,331 @@
1
+ #include <scriptup.h>
2
+
3
+ #define FACE(self) SU_REF(SUFaceRef, self)
4
+ #define FACE_TOLERANCE 1.0e-3
5
+
6
+ enum
7
+ {
8
+ POINT_UNKNOWN = 0,
9
+ POINT_INSIDE = 1,
10
+ POINT_ON_VERTEX = 2,
11
+ POINT_ON_EDGE = 4,
12
+ POINT_ON_FACE = 8,
13
+ POINT_OUTSIDE = 16,
14
+ POINT_NOT_ON_PLANE = 32
15
+ };
16
+
17
+ DEFINE_REF_LIST(face_edge_list, SUFaceRef, SUFaceGetNumEdges, SUFaceGetEdges, SUEdgeRef, cEdge)
18
+ DEFINE_REF_LIST(face_vertex_list, SUFaceRef, SUFaceGetNumVertices, SUFaceGetVertices, SUVertexRef, cVertex)
19
+ DEFINE_REF_LIST(face_inner_loop_list, SUFaceRef, SUFaceGetNumInnerLoops, SUFaceGetInnerLoops, SULoopRef, cLoop)
20
+ DEFINE_REF_LIST(loop_vertex_list, SULoopRef, SULoopGetNumVertices, SULoopGetVertices, SUVertexRef, cVertex)
21
+ DEFINE_REF_GETTER(face_outer_loop, SUFaceRef, SUFaceGetOuterLoop, SULoopRef, cLoop)
22
+ DEFINE_REF_GETTER(face_material, SUFaceRef, SUFaceGetFrontMaterial, SUMaterialRef, cMaterial)
23
+ DEFINE_REF_GETTER(face_back_material, SUFaceRef, SUFaceGetBackMaterial, SUMaterialRef, cMaterial)
24
+
25
+ static VALUE face_edges(VALUE self) { return face_edge_list(FACE(self)); }
26
+ static VALUE face_vertices(VALUE self) { return face_vertex_list(FACE(self)); }
27
+
28
+ static VALUE face_loops(VALUE self)
29
+ {
30
+ VALUE loops = rb_ary_new_from_args(1, face_outer_loop(self));
31
+ return rb_ary_concat(loops, face_inner_loop_list(FACE(self)));
32
+ }
33
+
34
+ static VALUE face_normal(VALUE self)
35
+ {
36
+ struct SUVector3D normal = {0, 0, 0};
37
+ SUFaceGetNormal(FACE(self), &normal);
38
+ return su_vector3d_new(normal);
39
+ }
40
+
41
+ static VALUE face_plane(VALUE self)
42
+ {
43
+ struct SUPlane3D plane = {0, 0, 0, 0};
44
+ SUFaceGetPlane(FACE(self), &plane);
45
+ return rb_ary_new_from_args(4, DBL2NUM(plane.a), DBL2NUM(plane.b), DBL2NUM(plane.c), DBL2NUM(plane.d));
46
+ }
47
+
48
+ static VALUE face_area(int argc, VALUE* argv, VALUE self)
49
+ {
50
+ VALUE transformation;
51
+ rb_scan_args(argc, argv, "01", &transformation);
52
+ double area = 0.0;
53
+ if (NIL_P(transformation))
54
+ SUFaceGetArea(FACE(self), &area);
55
+ else
56
+ {
57
+ struct SUTransformation t = su_to_transformation(transformation);
58
+ SUFaceGetAreaWithTransform(FACE(self), &t, &area);
59
+ }
60
+ return DBL2NUM(area);
61
+ }
62
+
63
+ static VALUE face_set_material(VALUE self, VALUE material)
64
+ {
65
+ SUFaceSetFrontMaterial(FACE(self), su_material_from_arg(self, material));
66
+ return material;
67
+ }
68
+
69
+ static VALUE face_set_back_material(VALUE self, VALUE material)
70
+ {
71
+ SUFaceSetBackMaterial(FACE(self), su_material_from_arg(self, material));
72
+ return material;
73
+ }
74
+
75
+ static VALUE face_reverse_bang(VALUE self)
76
+ {
77
+ return SUFaceReverse(FACE(self)) == SU_ERROR_NONE ? self : Qfalse;
78
+ }
79
+
80
+ static VALUE face_coplanar_with_p(VALUE self, VALUE other)
81
+ {
82
+ bool coplanar = false;
83
+ SUFaceCoplanarWith(FACE(self), (SUFaceRef){su_unwrap(other, cFace)}, &coplanar);
84
+ return BOOL2RB(coplanar);
85
+ }
86
+
87
+ static VALUE face_all_connected(VALUE self)
88
+ {
89
+ VALUE edges = face_edges(self);
90
+ if (RARRAY_LEN(edges) == 0)
91
+ return rb_ary_new_from_args(1, self);
92
+ return rb_funcall(RARRAY_AREF(edges, 0), (rb_intern)("all_connected"), 0);
93
+ }
94
+
95
+ static VALUE face_get_glued_instances(VALUE self)
96
+ {
97
+ size_t count = 0;
98
+ SUFaceGetNumAttachedDrawingElements(FACE(self), &count);
99
+ VALUE ary = rb_ary_new_capa((long)count);
100
+ if (count == 0)
101
+ return ary;
102
+ SUDrawingElementRef* elements = ZALLOC_N(SUDrawingElementRef, count);
103
+ SUFaceGetAttachedDrawingElements(FACE(self), count, elements, &count);
104
+ for (size_t i = 0; i < count; i++)
105
+ rb_ary_push(ary, su_wrap_entity((SUEntityRef){elements[i].ptr}));
106
+ xfree(elements);
107
+ return ary;
108
+ }
109
+
110
+ #define DEFINE_SIDE_PREDICATE(fn, SUFn) \
111
+ static VALUE fn(VALUE self, VALUE front) \
112
+ { \
113
+ bool result = false; \
114
+ SUFn(FACE(self), RTEST(front), &result); \
115
+ return BOOL2RB(result); \
116
+ }
117
+ DEFINE_SIDE_PREDICATE(face_texture_positioned_p, SUFaceIsTexturePositioned)
118
+ DEFINE_SIDE_PREDICATE(face_texture_projected_p, SUFaceIsTextureProjected)
119
+
120
+ static VALUE face_clear_texture_position(VALUE self, VALUE front)
121
+ {
122
+ return BOOL2RB(SUFaceClearTexturePosition(FACE(self), RTEST(front)) == SU_ERROR_NONE);
123
+ }
124
+
125
+ static VALUE face_clear_texture_projection(VALUE self, VALUE front)
126
+ {
127
+ return BOOL2RB(SUFaceClearTextureProjection(FACE(self), RTEST(front)) == SU_ERROR_NONE);
128
+ }
129
+
130
+ static VALUE face_get_texture_projection(VALUE self, VALUE front)
131
+ {
132
+ struct SUVector3D vector = {0, 0, 0};
133
+ if (SUFaceGetTextureProjection(FACE(self), RTEST(front), &vector) != SU_ERROR_NONE)
134
+ return Qnil;
135
+ return su_vector3d_new(vector);
136
+ }
137
+
138
+ static VALUE face_uv_tile_at(VALUE self, VALUE position, VALUE front)
139
+ {
140
+ struct SUPoint3D reference = su_to_point3d(position);
141
+ struct SUPoint3D points[4];
142
+ struct SUPoint2D uvs[4];
143
+ if (SUFaceGetUVTileAt(FACE(self), &reference, RTEST(front), points, uvs) != SU_ERROR_NONE)
144
+ return Qnil;
145
+ VALUE result = rb_ary_new_capa(8);
146
+ for (int i = 0; i < 4; i++)
147
+ {
148
+ rb_ary_push(result, su_point3d_new(points[i]));
149
+ rb_ary_push(result, su_point3d_new((struct SUPoint3D){uvs[i].x, uvs[i].y, 1.0}));
150
+ }
151
+ return result;
152
+ }
153
+
154
+ // mapping: [model point, uv point, ...] with 1 to 4 pairs.
155
+ static VALUE face_position_material(int argc, VALUE* argv, VALUE self)
156
+ {
157
+ rb_check_arity(argc, 3, 4);
158
+ Check_Type(argv[1], T_ARRAY);
159
+ long length = RARRAY_LEN(argv[1]);
160
+ if (length < 2 || length > 8 || length % 2 != 0)
161
+ rb_raise(rb_eArgError, "expected 1 to 4 pairs of model and UV points");
162
+ struct SUMaterialPositionInput mapping;
163
+ memset(&mapping, 0, sizeof(mapping));
164
+ mapping.material.ptr = su_unwrap(argv[0], cMaterial);
165
+ mapping.num_uv_coords = (size_t)length / 2;
166
+ for (long i = 0; i < length / 2; i++)
167
+ {
168
+ mapping.points[i] = su_to_point3d(RARRAY_AREF(argv[1], i * 2));
169
+ struct SUPoint3D uv = su_to_point3d(RARRAY_AREF(argv[1], i * 2 + 1));
170
+ mapping.uv_coords[i] = (struct SUPoint2D){uv.x, uv.y};
171
+ }
172
+ if (argc == 4 && !NIL_P(argv[3]))
173
+ mapping.projection = su_to_vector3d(argv[3]);
174
+ if (SUFacePositionMaterial(FACE(self), RTEST(argv[2]), &mapping) != SU_ERROR_NONE)
175
+ rb_raise(rb_eArgError, "cannot position material");
176
+ return self;
177
+ }
178
+
179
+ static VALUE face_mesh(int argc, VALUE* argv, VALUE self)
180
+ {
181
+ VALUE flags;
182
+ rb_scan_args(argc, argv, "01", &flags);
183
+ SUMeshHelperRef helper = SU_INVALID;
184
+ if (SUMeshHelperCreate(&helper, FACE(self)) != SU_ERROR_NONE)
185
+ rb_raise(rb_eRuntimeError, "cannot triangulate face");
186
+ size_t vertex_count = 0;
187
+ size_t triangle_count = 0;
188
+ SUMeshHelperGetNumVertices(helper, &vertex_count);
189
+ SUMeshHelperGetNumTriangles(helper, &triangle_count);
190
+ struct SUPoint3D* vertices = ZALLOC_N(struct SUPoint3D, vertex_count + 1);
191
+ struct SUPoint3D* front = ZALLOC_N(struct SUPoint3D, vertex_count + 1);
192
+ struct SUPoint3D* back = ZALLOC_N(struct SUPoint3D, vertex_count + 1);
193
+ struct SUVector3D* normals = ZALLOC_N(struct SUVector3D, vertex_count + 1);
194
+ size_t* indices = ZALLOC_N(size_t, triangle_count * 3 + 1);
195
+ size_t n = 0;
196
+ SUMeshHelperGetVertices(helper, vertex_count, vertices, &n);
197
+ SUMeshHelperGetFrontSTQCoords(helper, vertex_count, front, &n);
198
+ SUMeshHelperGetBackSTQCoords(helper, vertex_count, back, &n);
199
+ SUMeshHelperGetNormals(helper, vertex_count, normals, &n);
200
+ SUMeshHelperGetVertexIndices(helper, triangle_count * 3, indices, &n);
201
+ SUMeshHelperRelease(&helper);
202
+
203
+ VALUE points = rb_ary_new_capa((long)vertex_count);
204
+ VALUE uvs_front = rb_ary_new_capa((long)vertex_count);
205
+ VALUE uvs_back = rb_ary_new_capa((long)vertex_count);
206
+ VALUE normal_list = rb_ary_new_capa((long)vertex_count);
207
+ for (size_t i = 0; i < vertex_count; i++)
208
+ {
209
+ rb_ary_push(points, su_point3d_new(vertices[i]));
210
+ rb_ary_push(uvs_front, su_point3d_new(front[i]));
211
+ rb_ary_push(uvs_back, su_point3d_new(back[i]));
212
+ rb_ary_push(normal_list, su_vector3d_new(normals[i]));
213
+ }
214
+ VALUE polygons = rb_ary_new_capa((long)triangle_count);
215
+ for (size_t i = 0; i < triangle_count; i++)
216
+ rb_ary_push(polygons, rb_ary_new_from_args(3, SIZET2NUM(indices[i * 3] + 1), SIZET2NUM(indices[i * 3 + 1] + 1),
217
+ SIZET2NUM(indices[i * 3 + 2] + 1)));
218
+ xfree(vertices);
219
+ xfree(front);
220
+ xfree(back);
221
+ xfree(normals);
222
+ xfree(indices);
223
+ return su_polygon_mesh_new(points, polygons, uvs_front, uvs_back, normal_list);
224
+ }
225
+
226
+ // Projects onto the plane's dominant axes for 2D tests.
227
+ static void project(struct SUPoint3D p, int axis, double* u, double* v)
228
+ {
229
+ double c[3] = {p.x, p.y, p.z};
230
+ *u = c[(axis + 1) % 3];
231
+ *v = c[(axis + 2) % 3];
232
+ }
233
+
234
+ static bool in_loop(VALUE vertices, struct SUPoint3D p, int axis)
235
+ {
236
+ double pu;
237
+ double pv;
238
+ project(p, axis, &pu, &pv);
239
+ bool inside = false;
240
+ long count = RARRAY_LEN(vertices);
241
+ for (long i = 0, j = count - 1; i < count; j = i++)
242
+ {
243
+ double au, av, bu, bv;
244
+ project(su_to_point3d_like(RARRAY_AREF(vertices, i)), axis, &au, &av);
245
+ project(su_to_point3d_like(RARRAY_AREF(vertices, j)), axis, &bu, &bv);
246
+ if ((av > pv) != (bv > pv) && pu < (bu - au) * (pv - av) / (bv - av) + au)
247
+ inside = !inside;
248
+ }
249
+ return inside;
250
+ }
251
+
252
+ static VALUE face_classify_point(VALUE self, VALUE point)
253
+ {
254
+ struct SUPoint3D p = su_to_point3d(point);
255
+ struct SUPlane3D plane;
256
+ SUFaceGetPlane(FACE(self), &plane);
257
+ double distance = 0.0;
258
+ SUPlane3DDistanceTo(&plane, &p, &distance);
259
+ if (fabs(distance) > FACE_TOLERANCE)
260
+ return INT2FIX(POINT_NOT_ON_PLANE);
261
+ VALUE vertices = face_vertices(self);
262
+ for (long i = 0; i < RARRAY_LEN(vertices); i++)
263
+ {
264
+ struct SUPoint3D v = su_to_point3d_like(RARRAY_AREF(vertices, i));
265
+ double d = 0.0;
266
+ SUPoint3DDistanceToSUPoint3D(&v, &p, &d);
267
+ if (d < FACE_TOLERANCE)
268
+ return INT2FIX(POINT_ON_VERTEX);
269
+ }
270
+ VALUE edges = face_edges(self);
271
+ for (long i = 0; i < RARRAY_LEN(edges); i++)
272
+ {
273
+ VALUE edge = RARRAY_AREF(edges, i);
274
+ struct SUPoint3D a = su_to_point3d_like(rb_funcall(edge, (rb_intern)("start"), 0));
275
+ struct SUPoint3D b = su_to_point3d_like(rb_funcall(edge, (rb_intern)("end"), 0));
276
+ struct SURay3D ray = {a, {b.x - a.x, b.y - a.y, b.z - a.z}};
277
+ double length = sqrt(ray.normal.x * ray.normal.x + ray.normal.y * ray.normal.y + ray.normal.z * ray.normal.z);
278
+ SUVector3DNormalize(&ray.normal);
279
+ struct SUPoint3D projected;
280
+ SURay3DProjectTo(&ray, &p, &projected);
281
+ double d = 0.0;
282
+ SUPoint3DDistanceToSUPoint3D(&projected, &p, &d);
283
+ double t = (projected.x - a.x) * ray.normal.x + (projected.y - a.y) * ray.normal.y + (projected.z - a.z) * ray.normal.z;
284
+ if (d < FACE_TOLERANCE && t >= -FACE_TOLERANCE && t <= length + FACE_TOLERANCE)
285
+ return INT2FIX(POINT_ON_EDGE);
286
+ }
287
+ double normal[3] = {fabs(plane.a), fabs(plane.b), fabs(plane.c)};
288
+ int axis = normal[0] >= normal[1] && normal[0] >= normal[2] ? 0 : normal[1] >= normal[2] ? 1 : 2;
289
+ VALUE loops = face_loops(self);
290
+ if (!in_loop(loop_vertex_list(SU_REF(SULoopRef, RARRAY_AREF(loops, 0))), p, axis))
291
+ return INT2FIX(POINT_OUTSIDE);
292
+ for (long i = 1; i < RARRAY_LEN(loops); i++)
293
+ if (in_loop(loop_vertex_list(SU_REF(SULoopRef, RARRAY_AREF(loops, i))), p, axis))
294
+ return INT2FIX(POINT_OUTSIDE);
295
+ return INT2FIX(POINT_INSIDE);
296
+ }
297
+
298
+ void Init_face(void)
299
+ {
300
+ rb_define_const(cFace, "PointUnknown", INT2FIX(POINT_UNKNOWN));
301
+ rb_define_const(cFace, "PointInside", INT2FIX(POINT_INSIDE));
302
+ rb_define_const(cFace, "PointOnVertex", INT2FIX(POINT_ON_VERTEX));
303
+ rb_define_const(cFace, "PointOnEdge", INT2FIX(POINT_ON_EDGE));
304
+ rb_define_const(cFace, "PointOnFace", INT2FIX(POINT_ON_FACE));
305
+ rb_define_const(cFace, "PointOutside", INT2FIX(POINT_OUTSIDE));
306
+ rb_define_const(cFace, "PointNotOnPlane", INT2FIX(POINT_NOT_ON_PLANE));
307
+ rb_define_method(cFace, "edges", face_edges, 0);
308
+ rb_define_method(cFace, "vertices", face_vertices, 0);
309
+ rb_define_method(cFace, "loops", face_loops, 0);
310
+ rb_define_method(cFace, "outer_loop", face_outer_loop, 0);
311
+ rb_define_method(cFace, "normal", face_normal, 0);
312
+ rb_define_method(cFace, "plane", face_plane, 0);
313
+ rb_define_method(cFace, "area", face_area, -1);
314
+ rb_define_method(cFace, "material", face_material, 0);
315
+ rb_define_method(cFace, "material=", face_set_material, 1);
316
+ rb_define_method(cFace, "back_material", face_back_material, 0);
317
+ rb_define_method(cFace, "back_material=", face_set_back_material, 1);
318
+ rb_define_method(cFace, "reverse!", face_reverse_bang, 0);
319
+ rb_define_method(cFace, "coplanar_with?", face_coplanar_with_p, 1);
320
+ rb_define_method(cFace, "all_connected", face_all_connected, 0);
321
+ rb_define_method(cFace, "get_glued_instances", face_get_glued_instances, 0);
322
+ rb_define_method(cFace, "texture_positioned?", face_texture_positioned_p, 1);
323
+ rb_define_method(cFace, "texture_projected?", face_texture_projected_p, 1);
324
+ rb_define_method(cFace, "clear_texture_position", face_clear_texture_position, 1);
325
+ rb_define_method(cFace, "clear_texture_projection", face_clear_texture_projection, 1);
326
+ rb_define_method(cFace, "get_texture_projection", face_get_texture_projection, 1);
327
+ rb_define_method(cFace, "uv_tile_at", face_uv_tile_at, 2);
328
+ rb_define_method(cFace, "position_material", face_position_material, -1);
329
+ rb_define_method(cFace, "mesh", face_mesh, -1);
330
+ rb_define_method(cFace, "classify_point", face_classify_point, 1);
331
+ }