2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* visual_instance.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* http://www.godotengine.org */
|
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2014-02-10 02:10:30 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
#include "visual_instance.h"
|
|
|
|
|
|
|
|
#include "servers/visual_server.h"
|
|
|
|
#include "room_instance.h"
|
|
|
|
#include "scene/scene_string_names.h"
|
|
|
|
#include "skeleton.h"
|
|
|
|
|
|
|
|
AABB VisualInstance::get_transformed_aabb() const {
|
|
|
|
|
|
|
|
return get_global_transform().xform( get_aabb() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VisualInstance::_notification(int p_what) {
|
|
|
|
|
|
|
|
switch(p_what) {
|
|
|
|
|
|
|
|
case NOTIFICATION_ENTER_WORLD: {
|
|
|
|
|
|
|
|
// CHECK ROOM
|
|
|
|
Spatial * parent = get_parent_spatial();
|
|
|
|
Room *room=NULL;
|
2014-10-28 02:54:32 +01:00
|
|
|
bool is_geom = cast_to<GeometryInstance>();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
/* while(parent) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
room = parent->cast_to<Room>();
|
|
|
|
if (room)
|
|
|
|
break;
|
2014-10-28 02:54:32 +01:00
|
|
|
|
|
|
|
if (is_geom && parent->cast_to<BakedLightSampler>()) {
|
|
|
|
VS::get_singleton()->instance_geometry_set_baked_light_sampler(get_instance(),parent->cast_to<BakedLightSampler>()->get_instance());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
parent=parent->get_parent_spatial();
|
2016-10-03 21:33:42 +02:00
|
|
|
}*/
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
if (room) {
|
|
|
|
|
|
|
|
VisualServer::get_singleton()->instance_set_room(instance,room->get_instance());
|
|
|
|
}
|
2014-05-13 07:24:26 +02:00
|
|
|
// CHECK SKELETON => moving skeleton attaching logic to MeshInstance
|
|
|
|
/*
|
2014-02-10 02:10:30 +01:00
|
|
|
Skeleton *skeleton=get_parent()?get_parent()->cast_to<Skeleton>():NULL;
|
|
|
|
if (skeleton)
|
|
|
|
VisualServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() );
|
2014-05-13 07:24:26 +02:00
|
|
|
*/
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
VisualServer::get_singleton()->instance_set_scenario( instance, get_world()->get_scenario() );
|
|
|
|
|
|
|
|
} break;
|
|
|
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
|
|
|
|
|
|
|
Transform gt = get_global_transform();
|
|
|
|
VisualServer::get_singleton()->instance_set_transform(instance,gt);
|
|
|
|
} break;
|
|
|
|
case NOTIFICATION_EXIT_WORLD: {
|
|
|
|
|
|
|
|
VisualServer::get_singleton()->instance_set_scenario( instance, RID() );
|
|
|
|
VisualServer::get_singleton()->instance_set_room(instance,RID());
|
|
|
|
VisualServer::get_singleton()->instance_attach_skeleton( instance, RID() );
|
2016-10-03 21:33:42 +02:00
|
|
|
// VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() );
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RID VisualInstance::get_instance() const {
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
RID VisualInstance::_get_visual_instance_rid() const {
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VisualInstance::set_layer_mask(uint32_t p_mask) {
|
|
|
|
|
|
|
|
layers=p_mask;
|
|
|
|
VisualServer::get_singleton()->instance_set_layer_mask(instance,p_mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t VisualInstance::get_layer_mask() const {
|
|
|
|
|
|
|
|
return layers;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void VisualInstance::_bind_methods() {
|
|
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("_get_visual_instance_rid"),&VisualInstance::_get_visual_instance_rid);
|
|
|
|
ObjectTypeDB::bind_method(_MD("set_base","base"), &VisualInstance::set_base);
|
|
|
|
ObjectTypeDB::bind_method(_MD("set_layer_mask","mask"), &VisualInstance::set_layer_mask);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_layer_mask"), &VisualInstance::get_layer_mask);
|
|
|
|
|
2016-09-22 23:01:44 +02:00
|
|
|
ObjectTypeDB::bind_method(_MD("get_transformed_aabb"), &VisualInstance::get_transformed_aabb);
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::INT, "layers",PROPERTY_HINT_ALL_FLAGS), _SCS("set_layer_mask"), _SCS("get_layer_mask"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void VisualInstance::set_base(const RID& p_base) {
|
|
|
|
|
|
|
|
VisualServer::get_singleton()->instance_set_base(instance,p_base);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VisualInstance::VisualInstance()
|
|
|
|
{
|
|
|
|
|
|
|
|
instance = VisualServer::get_singleton()->instance_create();
|
|
|
|
VisualServer::get_singleton()->instance_attach_object_instance_ID( instance, get_instance_ID() );
|
|
|
|
layers=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VisualInstance::~VisualInstance() {
|
|
|
|
|
|
|
|
VisualServer::get_singleton()->free(instance);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GeometryInstance::set_material_override(const Ref<Material>& p_material) {
|
|
|
|
|
|
|
|
material_override=p_material;
|
|
|
|
VS::get_singleton()->instance_geometry_set_material_override(get_instance(),p_material.is_valid() ? p_material->get_rid() : RID());
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<Material> GeometryInstance::get_material_override() const{
|
|
|
|
|
|
|
|
return material_override;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
void GeometryInstance::set_lod_min_distance(float p_dist){
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
lod_min_distance=p_dist;
|
|
|
|
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
float GeometryInstance::get_lod_min_distance() const{
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
return lod_min_distance;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
void GeometryInstance::set_lod_max_distance(float p_dist) {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
lod_max_distance=p_dist;
|
|
|
|
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
float GeometryInstance::get_lod_max_distance() const {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
return lod_max_distance;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
void GeometryInstance::set_lod_min_hysteresis(float p_dist){
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
lod_min_hysteresis=p_dist;
|
|
|
|
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis);
|
|
|
|
}
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
float GeometryInstance::get_lod_min_hysteresis() const{
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
return lod_min_hysteresis;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2014-06-11 15:41:03 +02:00
|
|
|
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
void GeometryInstance::set_lod_max_hysteresis(float p_dist) {
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
lod_max_hysteresis=p_dist;
|
|
|
|
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis);
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
float GeometryInstance::get_lod_max_hysteresis() const {
|
2014-08-14 15:31:38 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
return lod_max_hysteresis;
|
|
|
|
}
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2014-08-14 15:31:38 +02:00
|
|
|
|
2014-06-11 15:41:03 +02:00
|
|
|
void GeometryInstance::_notification(int p_what) {
|
|
|
|
|
|
|
|
if (p_what==NOTIFICATION_ENTER_WORLD) {
|
|
|
|
|
|
|
|
if (flags[FLAG_USE_BAKED_LIGHT]) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-08-14 15:31:38 +02:00
|
|
|
_update_visibility();
|
2014-06-11 15:41:03 +02:00
|
|
|
|
|
|
|
} else if (p_what==NOTIFICATION_EXIT_WORLD) {
|
|
|
|
|
|
|
|
if (flags[FLAG_USE_BAKED_LIGHT]) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-08-14 15:31:38 +02:00
|
|
|
} if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
|
|
|
|
|
|
|
|
_update_visibility();
|
2014-06-11 15:41:03 +02:00
|
|
|
}
|
|
|
|
|
2014-08-14 15:31:38 +02:00
|
|
|
|
2014-06-11 15:41:03 +02:00
|
|
|
}
|
|
|
|
|
2014-08-14 15:31:38 +02:00
|
|
|
void GeometryInstance::_update_visibility() {
|
|
|
|
|
2014-11-06 01:20:42 +01:00
|
|
|
if (!is_inside_tree())
|
2014-08-14 15:31:38 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
_change_notify("geometry/visible");
|
|
|
|
VS::get_singleton()->instance_geometry_set_flag(get_instance(),VS::INSTANCE_FLAG_VISIBLE,is_visible() && flags[FLAG_VISIBLE]);
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void GeometryInstance::set_flag(Flags p_flag,bool p_value) {
|
|
|
|
|
|
|
|
ERR_FAIL_INDEX(p_flag,FLAG_MAX);
|
2016-03-08 00:00:55 +01:00
|
|
|
if (p_flag==FLAG_CAST_SHADOW) {
|
|
|
|
if (p_value == true) {
|
|
|
|
set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
if (flags[p_flag]==p_value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
flags[p_flag]=p_value;
|
|
|
|
VS::get_singleton()->instance_geometry_set_flag(get_instance(),(VS::InstanceFlags)p_flag,p_value);
|
|
|
|
if (p_flag==FLAG_VISIBLE) {
|
2014-08-14 15:31:38 +02:00
|
|
|
_update_visibility();
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2014-06-11 15:41:03 +02:00
|
|
|
if (p_flag==FLAG_USE_BAKED_LIGHT) {
|
|
|
|
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool GeometryInstance::get_flag(Flags p_flag) const{
|
|
|
|
|
|
|
|
ERR_FAIL_INDEX_V(p_flag,FLAG_MAX,false);
|
2016-03-08 00:00:55 +01:00
|
|
|
|
|
|
|
if (p_flag == FLAG_CAST_SHADOW) {
|
|
|
|
if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
return flags[p_flag];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-03-08 00:00:55 +01:00
|
|
|
void GeometryInstance::set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting) {
|
|
|
|
|
|
|
|
shadow_casting_setting = p_shadow_casting_setting;
|
|
|
|
|
|
|
|
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(get_instance(), (VS::ShadowCastingSetting)p_shadow_casting_setting);
|
|
|
|
}
|
|
|
|
|
|
|
|
GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_setting() const {
|
|
|
|
|
|
|
|
return shadow_casting_setting;
|
|
|
|
}
|
|
|
|
|
2014-08-02 03:10:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-02 04:54:10 +01:00
|
|
|
void GeometryInstance::set_extra_cull_margin(float p_margin) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(p_margin<0);
|
|
|
|
extra_cull_margin=p_margin;
|
|
|
|
VS::get_singleton()->instance_set_extra_visibility_margin(get_instance(),extra_cull_margin);
|
|
|
|
}
|
|
|
|
|
|
|
|
float GeometryInstance::get_extra_cull_margin() const{
|
|
|
|
|
|
|
|
return extra_cull_margin;
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void GeometryInstance::_bind_methods() {
|
|
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("set_material_override","material"), &GeometryInstance::set_material_override);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_material_override"), &GeometryInstance::get_material_override);
|
|
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("set_flag","flag","value"), &GeometryInstance::set_flag);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_flag","flag"), &GeometryInstance::get_flag);
|
|
|
|
|
2016-03-08 00:00:55 +01:00
|
|
|
ObjectTypeDB::bind_method(_MD("set_cast_shadows_setting", "shadow_casting_setting"), &GeometryInstance::set_cast_shadows_setting);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_cast_shadows_setting"), &GeometryInstance::get_cast_shadows_setting);
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
ObjectTypeDB::bind_method(_MD("set_lod_max_hysteresis","mode"), &GeometryInstance::set_lod_max_hysteresis);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_lod_max_hysteresis"), &GeometryInstance::get_lod_max_hysteresis);
|
|
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("set_lod_max_distance","mode"), &GeometryInstance::set_lod_max_distance);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_lod_max_distance"), &GeometryInstance::get_lod_max_distance);
|
|
|
|
|
|
|
|
ObjectTypeDB::bind_method(_MD("set_lod_min_hysteresis","mode"), &GeometryInstance::set_lod_min_hysteresis);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_lod_min_hysteresis"), &GeometryInstance::get_lod_min_hysteresis);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
ObjectTypeDB::bind_method(_MD("set_lod_min_distance","mode"), &GeometryInstance::set_lod_min_distance);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_lod_min_distance"), &GeometryInstance::get_lod_min_distance);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-08-02 03:10:38 +02:00
|
|
|
|
2015-03-02 04:54:10 +01:00
|
|
|
ObjectTypeDB::bind_method(_MD("set_extra_cull_margin","margin"), &GeometryInstance::set_extra_cull_margin);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin);
|
|
|
|
|
2016-09-22 23:01:44 +02:00
|
|
|
ObjectTypeDB::bind_method(_MD("get_aabb"),&GeometryInstance::get_aabb);
|
|
|
|
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE);
|
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "geometry/material_override",PROPERTY_HINT_RESOURCE_TYPE,"Material"), _SCS("set_material_override"), _SCS("get_material_override"));
|
2016-03-08 00:00:55 +01:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), _SCS("set_cast_shadows_setting"), _SCS("get_cast_shadows_setting"));
|
2015-03-02 04:54:10 +01:00
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::REAL, "geometry/extra_cull_margin",PROPERTY_HINT_RANGE,"0,16384,0"), _SCS("set_extra_cull_margin"), _SCS("get_extra_cull_margin"));
|
2014-02-10 02:10:30 +01:00
|
|
|
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/billboard"), _SCS("set_flag"), _SCS("get_flag"),FLAG_BILLBOARD);
|
|
|
|
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/billboard_y"), _SCS("set_flag"), _SCS("get_flag"),FLAG_BILLBOARD_FIX_Y);
|
|
|
|
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/depth_scale"), _SCS("set_flag"), _SCS("get_flag"),FLAG_DEPH_SCALE);
|
|
|
|
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible_in_all_rooms"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE_IN_ALL_ROOMS);
|
2014-06-11 15:41:03 +02:00
|
|
|
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/use_baked_light"), _SCS("set_flag"), _SCS("get_flag"),FLAG_USE_BAKED_LIGHT);
|
2016-10-03 21:33:42 +02:00
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/min_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_min_distance"), _SCS("get_lod_min_distance"));
|
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/min_hysteresis",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_min_hysteresis"), _SCS("get_lod_min_hysteresis"));
|
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/max_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_distance"), _SCS("get_lod_max_distance"));
|
|
|
|
ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/max_hysteresis",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_hysteresis"), _SCS("get_lod_max_hysteresis"));
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-08-14 15:31:38 +02:00
|
|
|
// ADD_SIGNAL( MethodInfo("visibility_changed"));
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
BIND_CONSTANT(FLAG_VISIBLE );
|
|
|
|
BIND_CONSTANT(FLAG_CAST_SHADOW );
|
|
|
|
BIND_CONSTANT(FLAG_BILLBOARD );
|
|
|
|
BIND_CONSTANT(FLAG_BILLBOARD_FIX_Y );
|
|
|
|
BIND_CONSTANT(FLAG_DEPH_SCALE );
|
|
|
|
BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS );
|
|
|
|
BIND_CONSTANT(FLAG_MAX );
|
|
|
|
|
2016-03-08 00:00:55 +01:00
|
|
|
BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF);
|
|
|
|
BIND_CONSTANT(SHADOW_CASTING_SETTING_ON);
|
|
|
|
BIND_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
|
|
|
|
BIND_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GeometryInstance::GeometryInstance() {
|
2016-10-03 21:33:42 +02:00
|
|
|
lod_min_distance=0;
|
|
|
|
lod_max_distance=0;
|
|
|
|
lod_min_hysteresis=0;
|
|
|
|
lod_max_hysteresis=0;
|
|
|
|
|
2014-12-07 06:04:20 +01:00
|
|
|
for(int i=0;i<FLAG_MAX;i++) {
|
|
|
|
flags[i]=false;
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
flags[FLAG_VISIBLE]=true;
|
|
|
|
flags[FLAG_CAST_SHADOW]=true;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2016-03-08 00:00:55 +01:00
|
|
|
shadow_casting_setting=SHADOW_CASTING_SETTING_ON;
|
2015-05-01 16:26:23 +02:00
|
|
|
extra_cull_margin=0;
|
2016-10-03 21:33:42 +02:00
|
|
|
// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
}
|