gi_probe.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*************************************************************************/
  2. /* gi_probe.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "gi_probe.h"
  31. #include "mesh_instance.h"
  32. #include "voxel_light_baker.h"
  33. void GIProbeData::set_bounds(const AABB &p_bounds) {
  34. VS::get_singleton()->gi_probe_set_bounds(probe, p_bounds);
  35. }
  36. AABB GIProbeData::get_bounds() const {
  37. return VS::get_singleton()->gi_probe_get_bounds(probe);
  38. }
  39. void GIProbeData::set_cell_size(float p_size) {
  40. VS::get_singleton()->gi_probe_set_cell_size(probe, p_size);
  41. }
  42. float GIProbeData::get_cell_size() const {
  43. return VS::get_singleton()->gi_probe_get_cell_size(probe);
  44. }
  45. void GIProbeData::set_to_cell_xform(const Transform &p_xform) {
  46. VS::get_singleton()->gi_probe_set_to_cell_xform(probe, p_xform);
  47. }
  48. Transform GIProbeData::get_to_cell_xform() const {
  49. return VS::get_singleton()->gi_probe_get_to_cell_xform(probe);
  50. }
  51. void GIProbeData::set_dynamic_data(const PoolVector<int> &p_data) {
  52. VS::get_singleton()->gi_probe_set_dynamic_data(probe, p_data);
  53. }
  54. PoolVector<int> GIProbeData::get_dynamic_data() const {
  55. return VS::get_singleton()->gi_probe_get_dynamic_data(probe);
  56. }
  57. void GIProbeData::set_dynamic_range(int p_range) {
  58. VS::get_singleton()->gi_probe_set_dynamic_range(probe, p_range);
  59. }
  60. void GIProbeData::set_energy(float p_range) {
  61. VS::get_singleton()->gi_probe_set_energy(probe, p_range);
  62. }
  63. float GIProbeData::get_energy() const {
  64. return VS::get_singleton()->gi_probe_get_energy(probe);
  65. }
  66. void GIProbeData::set_bias(float p_range) {
  67. VS::get_singleton()->gi_probe_set_bias(probe, p_range);
  68. }
  69. float GIProbeData::get_bias() const {
  70. return VS::get_singleton()->gi_probe_get_bias(probe);
  71. }
  72. void GIProbeData::set_normal_bias(float p_range) {
  73. VS::get_singleton()->gi_probe_set_normal_bias(probe, p_range);
  74. }
  75. float GIProbeData::get_normal_bias() const {
  76. return VS::get_singleton()->gi_probe_get_normal_bias(probe);
  77. }
  78. void GIProbeData::set_propagation(float p_range) {
  79. VS::get_singleton()->gi_probe_set_propagation(probe, p_range);
  80. }
  81. float GIProbeData::get_propagation() const {
  82. return VS::get_singleton()->gi_probe_get_propagation(probe);
  83. }
  84. void GIProbeData::set_interior(bool p_enable) {
  85. VS::get_singleton()->gi_probe_set_interior(probe, p_enable);
  86. }
  87. bool GIProbeData::is_interior() const {
  88. return VS::get_singleton()->gi_probe_is_interior(probe);
  89. }
  90. bool GIProbeData::is_compressed() const {
  91. return VS::get_singleton()->gi_probe_is_compressed(probe);
  92. }
  93. void GIProbeData::set_compress(bool p_enable) {
  94. VS::get_singleton()->gi_probe_set_compress(probe, p_enable);
  95. }
  96. int GIProbeData::get_dynamic_range() const {
  97. return VS::get_singleton()->gi_probe_get_dynamic_range(probe);
  98. }
  99. RID GIProbeData::get_rid() const {
  100. return probe;
  101. }
  102. void GIProbeData::_bind_methods() {
  103. ClassDB::bind_method(D_METHOD("set_bounds", "bounds"), &GIProbeData::set_bounds);
  104. ClassDB::bind_method(D_METHOD("get_bounds"), &GIProbeData::get_bounds);
  105. ClassDB::bind_method(D_METHOD("set_cell_size", "cell_size"), &GIProbeData::set_cell_size);
  106. ClassDB::bind_method(D_METHOD("get_cell_size"), &GIProbeData::get_cell_size);
  107. ClassDB::bind_method(D_METHOD("set_to_cell_xform", "to_cell_xform"), &GIProbeData::set_to_cell_xform);
  108. ClassDB::bind_method(D_METHOD("get_to_cell_xform"), &GIProbeData::get_to_cell_xform);
  109. ClassDB::bind_method(D_METHOD("set_dynamic_data", "dynamic_data"), &GIProbeData::set_dynamic_data);
  110. ClassDB::bind_method(D_METHOD("get_dynamic_data"), &GIProbeData::get_dynamic_data);
  111. ClassDB::bind_method(D_METHOD("set_dynamic_range", "dynamic_range"), &GIProbeData::set_dynamic_range);
  112. ClassDB::bind_method(D_METHOD("get_dynamic_range"), &GIProbeData::get_dynamic_range);
  113. ClassDB::bind_method(D_METHOD("set_energy", "energy"), &GIProbeData::set_energy);
  114. ClassDB::bind_method(D_METHOD("get_energy"), &GIProbeData::get_energy);
  115. ClassDB::bind_method(D_METHOD("set_bias", "bias"), &GIProbeData::set_bias);
  116. ClassDB::bind_method(D_METHOD("get_bias"), &GIProbeData::get_bias);
  117. ClassDB::bind_method(D_METHOD("set_normal_bias", "bias"), &GIProbeData::set_normal_bias);
  118. ClassDB::bind_method(D_METHOD("get_normal_bias"), &GIProbeData::get_normal_bias);
  119. ClassDB::bind_method(D_METHOD("set_propagation", "propagation"), &GIProbeData::set_propagation);
  120. ClassDB::bind_method(D_METHOD("get_propagation"), &GIProbeData::get_propagation);
  121. ClassDB::bind_method(D_METHOD("set_interior", "interior"), &GIProbeData::set_interior);
  122. ClassDB::bind_method(D_METHOD("is_interior"), &GIProbeData::is_interior);
  123. ClassDB::bind_method(D_METHOD("set_compress", "compress"), &GIProbeData::set_compress);
  124. ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbeData::is_compressed);
  125. ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds");
  126. ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_size", "get_cell_size");
  127. ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "to_cell_xform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_to_cell_xform", "get_to_cell_xform");
  128. ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "dynamic_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_dynamic_data", "get_dynamic_data");
  129. ADD_PROPERTY(PropertyInfo(Variant::INT, "dynamic_range", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_dynamic_range", "get_dynamic_range");
  130. ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_energy", "get_energy");
  131. ADD_PROPERTY(PropertyInfo(Variant::REAL, "bias", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bias", "get_bias");
  132. ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_normal_bias", "get_normal_bias");
  133. ADD_PROPERTY(PropertyInfo(Variant::REAL, "propagation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_propagation", "get_propagation");
  134. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_interior", "is_interior");
  135. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_compress", "is_compressed");
  136. }
  137. GIProbeData::GIProbeData() {
  138. probe = VS::get_singleton()->gi_probe_create();
  139. }
  140. GIProbeData::~GIProbeData() {
  141. VS::get_singleton()->free(probe);
  142. }
  143. //////////////////////
  144. //////////////////////
  145. void GIProbe::set_probe_data(const Ref<GIProbeData> &p_data) {
  146. if (p_data.is_valid()) {
  147. VS::get_singleton()->instance_set_base(get_instance(), p_data->get_rid());
  148. } else {
  149. VS::get_singleton()->instance_set_base(get_instance(), RID());
  150. }
  151. probe_data = p_data;
  152. }
  153. Ref<GIProbeData> GIProbe::get_probe_data() const {
  154. return probe_data;
  155. }
  156. void GIProbe::set_subdiv(Subdiv p_subdiv) {
  157. ERR_FAIL_INDEX(p_subdiv, SUBDIV_MAX);
  158. subdiv = p_subdiv;
  159. update_gizmo();
  160. }
  161. GIProbe::Subdiv GIProbe::get_subdiv() const {
  162. return subdiv;
  163. }
  164. void GIProbe::set_extents(const Vector3 &p_extents) {
  165. extents = p_extents;
  166. update_gizmo();
  167. }
  168. Vector3 GIProbe::get_extents() const {
  169. return extents;
  170. }
  171. void GIProbe::set_dynamic_range(int p_dynamic_range) {
  172. dynamic_range = p_dynamic_range;
  173. }
  174. int GIProbe::get_dynamic_range() const {
  175. return dynamic_range;
  176. }
  177. void GIProbe::set_energy(float p_energy) {
  178. energy = p_energy;
  179. if (probe_data.is_valid()) {
  180. probe_data->set_energy(energy);
  181. }
  182. }
  183. float GIProbe::get_energy() const {
  184. return energy;
  185. }
  186. void GIProbe::set_bias(float p_bias) {
  187. bias = p_bias;
  188. if (probe_data.is_valid()) {
  189. probe_data->set_bias(bias);
  190. }
  191. }
  192. float GIProbe::get_bias() const {
  193. return bias;
  194. }
  195. void GIProbe::set_normal_bias(float p_normal_bias) {
  196. normal_bias = p_normal_bias;
  197. if (probe_data.is_valid()) {
  198. probe_data->set_normal_bias(normal_bias);
  199. }
  200. }
  201. float GIProbe::get_normal_bias() const {
  202. return normal_bias;
  203. }
  204. void GIProbe::set_propagation(float p_propagation) {
  205. propagation = p_propagation;
  206. if (probe_data.is_valid()) {
  207. probe_data->set_propagation(propagation);
  208. }
  209. }
  210. float GIProbe::get_propagation() const {
  211. return propagation;
  212. }
  213. void GIProbe::set_interior(bool p_enable) {
  214. interior = p_enable;
  215. if (probe_data.is_valid()) {
  216. probe_data->set_interior(p_enable);
  217. }
  218. }
  219. bool GIProbe::is_interior() const {
  220. return interior;
  221. }
  222. void GIProbe::set_compress(bool p_enable) {
  223. compress = p_enable;
  224. if (probe_data.is_valid()) {
  225. probe_data->set_compress(p_enable);
  226. }
  227. }
  228. bool GIProbe::is_compressed() const {
  229. return compress;
  230. }
  231. void GIProbe::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
  232. MeshInstance *mi = Object::cast_to<MeshInstance>(p_at_node);
  233. if (mi && mi->get_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT) && mi->is_visible_in_tree()) {
  234. Ref<Mesh> mesh = mi->get_mesh();
  235. if (mesh.is_valid()) {
  236. AABB aabb = mesh->get_aabb();
  237. Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform();
  238. if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
  239. PlotMesh pm;
  240. pm.local_xform = xf;
  241. pm.mesh = mesh;
  242. for (int i = 0; i < mesh->get_surface_count(); i++) {
  243. pm.instance_materials.push_back(mi->get_surface_material(i));
  244. }
  245. pm.override_material = mi->get_material_override();
  246. plot_meshes.push_back(pm);
  247. }
  248. }
  249. }
  250. Spatial *s = Object::cast_to<Spatial>(p_at_node);
  251. if (s) {
  252. if (s->is_visible_in_tree()) {
  253. Array meshes = p_at_node->call("get_meshes");
  254. for (int i = 0; i < meshes.size(); i += 2) {
  255. Transform mxf = meshes[i];
  256. Ref<Mesh> mesh = meshes[i + 1];
  257. if (!mesh.is_valid())
  258. continue;
  259. AABB aabb = mesh->get_aabb();
  260. Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
  261. if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
  262. PlotMesh pm;
  263. pm.local_xform = xf;
  264. pm.mesh = mesh;
  265. plot_meshes.push_back(pm);
  266. }
  267. }
  268. }
  269. }
  270. for (int i = 0; i < p_at_node->get_child_count(); i++) {
  271. Node *child = p_at_node->get_child(i);
  272. if (!child->get_owner())
  273. continue; //maybe a helper
  274. _find_meshes(child, plot_meshes);
  275. }
  276. }
  277. GIProbe::BakeBeginFunc GIProbe::bake_begin_function = NULL;
  278. GIProbe::BakeStepFunc GIProbe::bake_step_function = NULL;
  279. GIProbe::BakeEndFunc GIProbe::bake_end_function = NULL;
  280. void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
  281. static const int subdiv_value[SUBDIV_MAX] = { 7, 8, 9, 10 };
  282. VoxelLightBaker baker;
  283. baker.begin_bake(subdiv_value[subdiv], AABB(-extents, extents * 2.0));
  284. List<PlotMesh> mesh_list;
  285. _find_meshes(p_from_node ? p_from_node : get_parent(), mesh_list);
  286. if (bake_begin_function) {
  287. bake_begin_function(mesh_list.size() + 1);
  288. }
  289. int pmc = 0;
  290. for (List<PlotMesh>::Element *E = mesh_list.front(); E; E = E->next()) {
  291. if (bake_step_function) {
  292. bake_step_function(pmc, RTR("Plotting Meshes") + " " + itos(pmc) + "/" + itos(mesh_list.size()));
  293. }
  294. pmc++;
  295. baker.plot_mesh(E->get().local_xform, E->get().mesh, E->get().instance_materials, E->get().override_material);
  296. }
  297. if (bake_step_function) {
  298. bake_step_function(pmc++, RTR("Finishing Plot"));
  299. }
  300. baker.end_bake();
  301. //create the data for visual server
  302. PoolVector<int> data = baker.create_gi_probe_data();
  303. if (p_create_visual_debug) {
  304. MultiMeshInstance *mmi = memnew(MultiMeshInstance);
  305. mmi->set_multimesh(baker.create_debug_multimesh());
  306. add_child(mmi);
  307. #ifdef TOOLS_ENABLED
  308. if (get_tree()->get_edited_scene_root() == this) {
  309. mmi->set_owner(this);
  310. } else {
  311. mmi->set_owner(get_owner());
  312. }
  313. #else
  314. mmi->set_owner(get_owner());
  315. #endif
  316. } else {
  317. Ref<GIProbeData> probe_data = get_probe_data();
  318. if (probe_data.is_null())
  319. probe_data.instance();
  320. probe_data->set_bounds(AABB(-extents, extents * 2.0));
  321. probe_data->set_cell_size(baker.get_cell_size());
  322. probe_data->set_dynamic_data(data);
  323. probe_data->set_dynamic_range(dynamic_range);
  324. probe_data->set_energy(energy);
  325. probe_data->set_bias(bias);
  326. probe_data->set_normal_bias(normal_bias);
  327. probe_data->set_propagation(propagation);
  328. probe_data->set_interior(interior);
  329. probe_data->set_compress(compress);
  330. probe_data->set_to_cell_xform(baker.get_to_cell_space_xform());
  331. set_probe_data(probe_data);
  332. }
  333. if (bake_end_function) {
  334. bake_end_function();
  335. }
  336. }
  337. void GIProbe::_debug_bake() {
  338. bake(NULL, true);
  339. }
  340. AABB GIProbe::get_aabb() const {
  341. return AABB(-extents, extents * 2);
  342. }
  343. PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const {
  344. return PoolVector<Face3>();
  345. }
  346. void GIProbe::_bind_methods() {
  347. ClassDB::bind_method(D_METHOD("set_probe_data", "data"), &GIProbe::set_probe_data);
  348. ClassDB::bind_method(D_METHOD("get_probe_data"), &GIProbe::get_probe_data);
  349. ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &GIProbe::set_subdiv);
  350. ClassDB::bind_method(D_METHOD("get_subdiv"), &GIProbe::get_subdiv);
  351. ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GIProbe::set_extents);
  352. ClassDB::bind_method(D_METHOD("get_extents"), &GIProbe::get_extents);
  353. ClassDB::bind_method(D_METHOD("set_dynamic_range", "max"), &GIProbe::set_dynamic_range);
  354. ClassDB::bind_method(D_METHOD("get_dynamic_range"), &GIProbe::get_dynamic_range);
  355. ClassDB::bind_method(D_METHOD("set_energy", "max"), &GIProbe::set_energy);
  356. ClassDB::bind_method(D_METHOD("get_energy"), &GIProbe::get_energy);
  357. ClassDB::bind_method(D_METHOD("set_bias", "max"), &GIProbe::set_bias);
  358. ClassDB::bind_method(D_METHOD("get_bias"), &GIProbe::get_bias);
  359. ClassDB::bind_method(D_METHOD("set_normal_bias", "max"), &GIProbe::set_normal_bias);
  360. ClassDB::bind_method(D_METHOD("get_normal_bias"), &GIProbe::get_normal_bias);
  361. ClassDB::bind_method(D_METHOD("set_propagation", "max"), &GIProbe::set_propagation);
  362. ClassDB::bind_method(D_METHOD("get_propagation"), &GIProbe::get_propagation);
  363. ClassDB::bind_method(D_METHOD("set_interior", "enable"), &GIProbe::set_interior);
  364. ClassDB::bind_method(D_METHOD("is_interior"), &GIProbe::is_interior);
  365. ClassDB::bind_method(D_METHOD("set_compress", "enable"), &GIProbe::set_compress);
  366. ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbe::is_compressed);
  367. ClassDB::bind_method(D_METHOD("bake", "from_node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false));
  368. ClassDB::bind_method(D_METHOD("debug_bake"), &GIProbe::_debug_bake);
  369. ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
  370. ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv");
  371. ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents"), "set_extents", "get_extents");
  372. ADD_PROPERTY(PropertyInfo(Variant::INT, "dynamic_range", PROPERTY_HINT_RANGE, "1,16,1"), "set_dynamic_range", "get_dynamic_range");
  373. ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_energy", "get_energy");
  374. ADD_PROPERTY(PropertyInfo(Variant::REAL, "propagation", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_propagation", "get_propagation");
  375. ADD_PROPERTY(PropertyInfo(Variant::REAL, "bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_bias", "get_bias");
  376. ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_normal_bias", "get_normal_bias");
  377. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
  378. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed");
  379. ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_probe_data", "get_probe_data");
  380. BIND_ENUM_CONSTANT(SUBDIV_64);
  381. BIND_ENUM_CONSTANT(SUBDIV_128);
  382. BIND_ENUM_CONSTANT(SUBDIV_256);
  383. BIND_ENUM_CONSTANT(SUBDIV_512);
  384. BIND_ENUM_CONSTANT(SUBDIV_MAX);
  385. }
  386. GIProbe::GIProbe() {
  387. subdiv = SUBDIV_128;
  388. dynamic_range = 4;
  389. energy = 1.0;
  390. bias = 1.5;
  391. normal_bias = 0.0;
  392. propagation = 0.7;
  393. extents = Vector3(10, 10, 10);
  394. interior = false;
  395. compress = false;
  396. gi_probe = VS::get_singleton()->gi_probe_create();
  397. set_disable_scale(true);
  398. }
  399. GIProbe::~GIProbe() {
  400. }