diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-10-03 16:33:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-10-03 21:35:16 +0200 |
commit | 22d83bc9f655d5ae7a1b49709c4c1b663725daf5 (patch) | |
tree | a817195c08d4713a70ca014a3f63f5937934fe36 /scene/3d | |
parent | 78d97b060a6873a454e710380cb9ef1bde5e4c65 (diff) |
Begining of GLES3 renderer:
-Most 2D drawing is implemented
-Missing shaders
-Missing all 3D
-Editor needs to be set on update always to be used, otherwise it does not refresh
-Large parts of editor not working
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/baked_light_instance.cpp | 2 | ||||
-rw-r--r-- | scene/3d/baked_light_instance.h | 3 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 107 | ||||
-rw-r--r-- | scene/3d/camera.h | 6 | ||||
-rw-r--r-- | scene/3d/light.cpp | 509 | ||||
-rw-r--r-- | scene/3d/light.h | 104 | ||||
-rw-r--r-- | scene/3d/particles.cpp | 2 | ||||
-rw-r--r-- | scene/3d/particles.h | 3 | ||||
-rw-r--r-- | scene/3d/portal.cpp | 44 | ||||
-rw-r--r-- | scene/3d/portal.h | 2 | ||||
-rw-r--r-- | scene/3d/position_3d.cpp | 31 | ||||
-rw-r--r-- | scene/3d/position_3d.h | 1 | ||||
-rw-r--r-- | scene/3d/quad.cpp | 2 | ||||
-rw-r--r-- | scene/3d/room_instance.cpp | 77 | ||||
-rw-r--r-- | scene/3d/room_instance.h | 5 | ||||
-rw-r--r-- | scene/3d/skeleton.cpp | 47 | ||||
-rw-r--r-- | scene/3d/skeleton.h | 1 | ||||
-rw-r--r-- | scene/3d/spatial_player.cpp | 140 | ||||
-rw-r--r-- | scene/3d/spatial_player.h | 2 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 108 | ||||
-rw-r--r-- | scene/3d/visual_instance.h | 21 |
21 files changed, 131 insertions, 1086 deletions
diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index ca3a309568..07f0e4ee57 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -29,6 +29,7 @@ #include "baked_light_instance.h" #include "scene/scene_string_names.h" +#if 0 RID BakedLightInstance::get_baked_light_instance() const { @@ -179,3 +180,4 @@ BakedLightSampler::~BakedLightSampler(){ VS::get_singleton()->free(base); } +#endif diff --git a/scene/3d/baked_light_instance.h b/scene/3d/baked_light_instance.h index 002e55df1d..15f04fea31 100644 --- a/scene/3d/baked_light_instance.h +++ b/scene/3d/baked_light_instance.h @@ -32,6 +32,7 @@ #include "scene/3d/visual_instance.h" #include "scene/resources/baked_light.h" +#if 0 class BakedLightBaker; @@ -101,5 +102,5 @@ public: VARIANT_ENUM_CAST( BakedLightSampler::Param ); - +#endif #endif // BAKED_LIGHT_H diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index e76c0938fb..1ce07b0264 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -96,8 +96,8 @@ bool Camera::_set(const StringName& p_name, const Variant& p_value) { } else { clear_current(); } - } else if (p_name=="visible_layers") { - set_visible_layers(p_value); + } else if (p_name=="cull_mask") { + set_cull_mask(p_value); } else if (p_name=="environment") { set_environment(p_value); } else @@ -130,8 +130,8 @@ bool Camera::_get(const StringName& p_name,Variant &r_ret) const { } else { r_ret=is_current(); } - } else if (p_name=="visible_layers") { - r_ret=get_visible_layers(); + } else if (p_name=="cull_mask") { + r_ret=get_cull_mask(); } else if (p_name=="h_offset") { r_ret=get_h_offset(); } else if (p_name=="v_offset") { @@ -176,7 +176,7 @@ void Camera::_get_property_list( List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo( Variant::REAL, "far" , PROPERTY_HINT_EXP_RANGE, "0.01,4096.0,0.01") ); p_list->push_back( PropertyInfo( Variant::INT, "keep_aspect",PROPERTY_HINT_ENUM,"Keep Width,Keep Height") ); p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) ); - p_list->push_back( PropertyInfo( Variant::INT, "visible_layers",PROPERTY_HINT_ALL_FLAGS ) ); + p_list->push_back( PropertyInfo( Variant::INT, "cull_mask",PROPERTY_HINT_ALL_FLAGS ) ); p_list->push_back( PropertyInfo( Variant::OBJECT, "environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "h_offset" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "v_offset" ) ); @@ -342,91 +342,6 @@ bool Camera::_can_gizmo_scale() const { } -RES Camera::_get_gizmo_geometry() const { - - - Ref<SurfaceTool> surface_tool( memnew( SurfaceTool )); - - Ref<FixedMaterial> mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(1.0,0.5,1.0,0.5) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); - //mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - switch(mode) { - - case PROJECTION_PERSPECTIVE: { - - - - Vector3 side=Vector3( Math::sin(Math::deg2rad(fov)), 0, -Math::cos(Math::deg2rad(fov)) ); - Vector3 nside=side; - nside.x=-nside.x; - Vector3 up=Vector3(0,side.x,0); - - -#define ADD_TRIANGLE( m_a, m_b, m_c)\ -{\ - surface_tool->add_vertex(m_a);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_a);\ -} - - ADD_TRIANGLE( Vector3(), side+up, side-up ); - ADD_TRIANGLE( Vector3(), nside+up, nside-up ); - ADD_TRIANGLE( Vector3(), side+up, nside+up ); - ADD_TRIANGLE( Vector3(), side-up, nside-up ); - - side.x*=0.25; - nside.x*=0.25; - Vector3 tup( 0, up.y*3/2,side.z); - ADD_TRIANGLE( tup, side+up, nside+up ); - - } break; - case PROJECTION_ORTHOGONAL: { - -#define ADD_QUAD( m_a, m_b, m_c, m_d)\ -{\ - surface_tool->add_vertex(m_a);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_d);\ - surface_tool->add_vertex(m_d);\ - surface_tool->add_vertex(m_a);\ -} - - float hsize=size*0.5; - Vector3 right(hsize,0,0); - Vector3 up(0,hsize,0); - Vector3 back(0,0,-1.0); - Vector3 front(0,0,0); - - ADD_QUAD( -up-right,-up+right,up+right,up-right); - ADD_QUAD( -up-right+back,-up+right+back,up+right+back,up-right+back); - ADD_QUAD( up+right,up+right+back,up-right+back,up-right); - ADD_QUAD( -up+right,-up+right+back,-up-right+back,-up-right); - - right.x*=0.25; - Vector3 tup( 0, up.y*3/2,back.z ); - ADD_TRIANGLE( tup, right+up+back, -right+up+back ); - - } break; - - } - - return surface_tool->commit(); - -} Vector3 Camera::project_ray_normal(const Point2& p_pos) const { @@ -648,8 +563,8 @@ void Camera::_bind_methods() { ObjectTypeDB::bind_method( _MD("get_zfar"),&Camera::get_zfar ); ObjectTypeDB::bind_method( _MD("get_znear"),&Camera::get_znear ); ObjectTypeDB::bind_method( _MD("get_projection"),&Camera::get_projection ); - ObjectTypeDB::bind_method( _MD("set_visible_layers","mask"),&Camera::set_visible_layers ); - ObjectTypeDB::bind_method( _MD("get_visible_layers"),&Camera::get_visible_layers ); + ObjectTypeDB::bind_method( _MD("set_cull_mask","mask"),&Camera::set_cull_mask ); + ObjectTypeDB::bind_method( _MD("get_cull_mask"),&Camera::get_cull_mask ); ObjectTypeDB::bind_method(_MD("set_environment","env:Environment"),&Camera::set_environment); ObjectTypeDB::bind_method(_MD("get_environment:Environment"),&Camera::get_environment); ObjectTypeDB::bind_method(_MD("set_keep_aspect_mode","mode"),&Camera::set_keep_aspect_mode); @@ -690,13 +605,13 @@ Camera::Projection Camera::get_projection() const { return mode; } -void Camera::set_visible_layers(uint32_t p_layers) { +void Camera::set_cull_mask(uint32_t p_layers) { layers=p_layers; - VisualServer::get_singleton()->camera_set_visible_layers(camera,layers); + VisualServer::get_singleton()->camera_set_cull_mask(camera,layers); } -uint32_t Camera::get_visible_layers() const{ +uint32_t Camera::get_cull_mask() const{ return layers; } @@ -757,7 +672,7 @@ Camera::Camera() { layers=0xfffff; v_offset=0; h_offset=0; - VisualServer::get_singleton()->camera_set_visible_layers(camera,layers); + VisualServer::get_singleton()->camera_set_cull_mask(camera,layers); //active=false; } diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 30c6928245..3ea0bd711c 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -75,7 +75,7 @@ private: Ref<Environment> environment; virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; + //void _camera_make_current(Node *p_camera); @@ -126,8 +126,8 @@ public: bool is_position_behind(const Vector3& p_pos) const; Vector3 project_position(const Point2& p_point) const; - void set_visible_layers(uint32_t p_layers); - uint32_t get_visible_layers() const; + void set_cull_mask(uint32_t p_layers); + uint32_t get_cull_mask() const; Vector<Plane> get_frustum() const; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 227bb3a59d..d98f100020 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -32,75 +32,6 @@ #include "scene/resources/surface_tool.h" -static const char* _light_param_names[VS::LIGHT_PARAM_MAX]={ - "params/spot_attenuation", - "params/spot_angle", - "params/radius", - "params/energy", - "params/attenuation", - "shadow/darkening", - "shadow/z_offset", - "shadow/z_slope_scale", - "shadow/esm_multiplier", - "shadow/blur_passes" -}; - -void Light::set_parameter(Parameter p_param, float p_value) { - - ERR_FAIL_INDEX(p_param, PARAM_MAX); - vars[p_param]=p_value; - VisualServer::get_singleton()->light_set_param(light,(VisualServer::LightParam)p_param,p_value); - if (p_param==PARAM_RADIUS || p_param==PARAM_SPOT_ANGLE) - update_gizmo(); - _change_notify(_light_param_names[p_param]); -// _change_notify(_param_names[p_param]); -} - -float Light::get_parameter(Parameter p_param) const { - - ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0); - return vars[p_param]; - -} - -void Light::set_color(LightColor p_color, const Color& p_value) { - - ERR_FAIL_INDEX(p_color, 3); - colors[p_color]=p_value; - VisualServer::get_singleton()->light_set_color(light,(VisualServer::LightColor)p_color,p_value); - //_change_notify(_color_names[p_color]); - -} -Color Light::get_color(LightColor p_color) const { - - ERR_FAIL_INDEX_V(p_color, 3, Color()); - return colors[p_color]; - -} - - -void Light::set_project_shadows(bool p_enabled) { - - shadows=p_enabled; - VisualServer::get_singleton()->light_set_shadow(light, p_enabled); - _change_notify("shadow"); -} -bool Light::has_project_shadows() const { - - return shadows; -} - -void Light::set_projector(const Ref<Texture>& p_projector) { - - projector=p_projector; - VisualServer::get_singleton()->light_set_projector(light, projector.is_null()?RID():projector->get_rid()); -} - -Ref<Texture> Light::get_projector() const { - - return projector; -} - bool Light::_can_gizmo_scale() const { @@ -108,220 +39,9 @@ bool Light::_can_gizmo_scale() const { } -static void _make_sphere(int p_lats, int p_lons, float p_radius, Ref<SurfaceTool> p_tool) { - - - p_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - - for(int i = 1; i <= p_lats; i++) { - double lat0 = Math_PI * (-0.5 + (double) (i - 1) / p_lats); - double z0 = Math::sin(lat0); - double zr0 = Math::cos(lat0); - - double lat1 = Math_PI * (-0.5 + (double) i / p_lats); - double z1 = Math::sin(lat1); - double zr1 = Math::cos(lat1); - - for(int j = p_lons; j >= 1; j--) { - - double lng0 = 2 * Math_PI * (double) (j - 1) / p_lons; - double x0 = Math::cos(lng0); - double y0 = Math::sin(lng0); - - double lng1 = 2 * Math_PI * (double) (j) / p_lons; - double x1 = Math::cos(lng1); - double y1 = Math::sin(lng1); - - - Vector3 v[4]={ - Vector3(x1 * zr0, z0, y1 *zr0), - Vector3(x1 * zr1, z1, y1 *zr1), - Vector3(x0 * zr1, z1, y0 *zr1), - Vector3(x0 * zr0, z0, y0 *zr0) - }; - -#define ADD_POINT(m_idx) \ - p_tool->add_normal(v[m_idx]);\ - p_tool->add_vertex(v[m_idx]*p_radius); - - ADD_POINT(0); - ADD_POINT(1); - ADD_POINT(2); - - ADD_POINT(2); - ADD_POINT(3); - ADD_POINT(0); - } - } - -} - -RES Light::_get_gizmo_geometry() const { - - - Ref<FixedMaterial> mat_area( memnew( FixedMaterial )); - - mat_area->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.7,0.6,0.0,0.05) ); - mat_area->set_parameter( FixedMaterial::PARAM_EMISSION,Color(0.7,0.7,0.7) ); - mat_area->set_blend_mode( Material::BLEND_MODE_ADD ); - mat_area->set_flag(Material::FLAG_DOUBLE_SIDED,true); -// mat_area->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - Ref<FixedMaterial> mat_light( memnew( FixedMaterial )); - - mat_light->set_parameter( FixedMaterial::PARAM_DIFFUSE, Color(1.0,1.0,0.8,0.9) ); - mat_light->set_flag(Material::FLAG_UNSHADED,true); - - Ref< Mesh > mesh; - - Ref<SurfaceTool> surftool( memnew( SurfaceTool )); - - switch(type) { - - case VisualServer::LIGHT_DIRECTIONAL: { - - - mat_area->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.9,0.8,0.1,0.8) ); - mat_area->set_blend_mode( Material::BLEND_MODE_MIX); - mat_area->set_flag(Material::FLAG_DOUBLE_SIDED,false); - mat_area->set_flag(Material::FLAG_UNSHADED,true); - - _make_sphere( 5,5,0.6, surftool ); - surftool->set_material(mat_light); - mesh=surftool->commit(mesh); - - // float radius=1; - - surftool->begin(Mesh::PRIMITIVE_TRIANGLES); - - const int arrow_points=5; - Vector3 arrow[arrow_points]={ - Vector3(0,0,2), - Vector3(1,1,2), - Vector3(1,1,-1), - Vector3(2,2,-1), - Vector3(0,0,-3) - }; - - int arrow_sides=4; - - - for(int i = 0; i < arrow_sides ; i++) { - - - Matrix3 ma(Vector3(0,0,1),Math_PI*2*float(i)/arrow_sides); - Matrix3 mb(Vector3(0,0,1),Math_PI*2*float(i+1)/arrow_sides); - - - for(int j=0;j<arrow_points-1;j++) { - - Vector3 points[4]={ - ma.xform(arrow[j]), - mb.xform(arrow[j]), - mb.xform(arrow[j+1]), - ma.xform(arrow[j+1]), - }; - - Vector3 n = Plane(points[0],points[1],points[2]).normal; - - surftool->add_normal(n); - surftool->add_vertex(points[0]); - surftool->add_normal(n); - surftool->add_vertex(points[1]); - surftool->add_normal(n); - surftool->add_vertex(points[2]); - - surftool->add_normal(n); - surftool->add_vertex(points[0]); - surftool->add_normal(n); - surftool->add_vertex(points[2]); - surftool->add_normal(n); - surftool->add_vertex(points[3]); - - - } - - - } - - surftool->set_material(mat_area); - mesh=surftool->commit(mesh); - - - - } break; - case VisualServer::LIGHT_OMNI: { - - - _make_sphere( 20,20,vars[PARAM_RADIUS], surftool ); - surftool->set_material(mat_area); - mesh=surftool->commit(mesh); - _make_sphere(5,5, 0.1, surftool ); - surftool->set_material(mat_light); - mesh=surftool->commit(mesh); - } break; - - case VisualServer::LIGHT_SPOT: { - - _make_sphere( 5,5,0.1, surftool ); - surftool->set_material(mat_light); - mesh=surftool->commit(mesh); - - // make cone - int points=24; - float len=vars[PARAM_RADIUS]; - float size=Math::tan(Math::deg2rad(vars[PARAM_SPOT_ANGLE]))*len; - - surftool->begin(Mesh::PRIMITIVE_TRIANGLES); - - for(int i = 0; i < points; i++) { - - float x0=Math::sin(i * Math_PI * 2 / points); - float y0=Math::cos(i * Math_PI * 2 / points); - float x1=Math::sin((i+1) * Math_PI * 2 / points); - float y1=Math::cos((i+1) * Math_PI * 2 / points); - - Vector3 v1=Vector3(x0*size,y0*size,-len).normalized()*len; - Vector3 v2=Vector3(x1*size,y1*size,-len).normalized()*len; - - Vector3 v3=Vector3(0,0,0); - Vector3 v4=Vector3(0,0,v1.z); - - Vector3 n = Plane(v1,v2,v3).normal; - - - surftool->add_normal(n); - surftool->add_vertex(v1); - surftool->add_normal(n); - surftool->add_vertex(v2); - surftool->add_normal(n); - surftool->add_vertex(v3); - - n=Vector3(0,0,-1); - - surftool->add_normal(n); - surftool->add_vertex(v1); - surftool->add_normal(n); - surftool->add_vertex(v2); - surftool->add_normal(n); - surftool->add_vertex(v4); - - - } - - surftool->set_material(mat_area); - mesh=surftool->commit(mesh); - - - } break; - } - - return mesh; -} - - AABB Light::get_aabb() const { +#if 0 if (type==VisualServer::LIGHT_DIRECTIONAL) { return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); @@ -336,7 +56,7 @@ AABB Light::get_aabb() const { float size=Math::tan(Math::deg2rad(vars[PARAM_SPOT_ANGLE]))*len; return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); } - +#endif return AABB(); } @@ -346,89 +66,6 @@ DVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { } -void Light::set_operator(Operator p_op) { - ERR_FAIL_INDEX(p_op,2); - op=p_op; - VisualServer::get_singleton()->light_set_operator(light,VS::LightOp(op)); - -} - -void Light::set_bake_mode(BakeMode p_bake_mode) { - - bake_mode=p_bake_mode; -} - -Light::BakeMode Light::get_bake_mode() const { - - return bake_mode; -} - - -Light::Operator Light::get_operator() const { - - return op; -} - -void Light::approximate_opengl_attenuation(float p_constant, float p_linear, float p_quadratic,float p_radius_treshold) { - - //this is horrible and must never be used - - float a = p_quadratic * p_radius_treshold; - float b = p_linear * p_radius_treshold; - float c = p_constant * p_radius_treshold -1; - - float radius=10000; - - if(a == 0) { // solve linear - float d = Math::abs(-c/b); - if(d<radius) - radius=d; - - - } else { // solve quadratic - // now ad^2 + bd + c = 0, solve quadratic equation: - - float denominator = 2*a; - - if(denominator != 0) { - - - float root = b*b - 4*a*c; - - if(root >=0) { - - root = sqrt(root); - - float solution1 = fabs( (-b + root) / denominator); - float solution2 = fabs( (-b - root) / denominator); - - if(solution1 > radius) - solution1 = radius; - - if(solution2 > radius) - solution2 = radius; - - radius = (solution1 > solution2 ? solution1 : solution2); - } - } - } - - float energy=1.0; - - /*if (p_constant>0) - energy=1.0/p_constant; //energy is this - else - energy=8.0; // some high number.. -*/ - - if (radius==10000) - radius=100; //bug? - - set_parameter(PARAM_RADIUS,radius); - set_parameter(PARAM_ENERGY,energy); - -} - void Light::_update_visibility() { @@ -436,7 +73,7 @@ void Light::_update_visibility() { return; -bool editor_ok=true; + bool editor_ok=true; #ifdef TOOLS_ENABLED if (editor_only) { @@ -448,7 +85,7 @@ bool editor_ok=true; } #endif - VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && enabled && editor_ok); + //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && editor_ok); _change_notify("geometry/visible"); } @@ -461,16 +98,6 @@ void Light::_notification(int p_what) { } } -void Light::set_enabled(bool p_enabled) { - - enabled=p_enabled; - _update_visibility(); -} - -bool Light::is_enabled() const{ - - return enabled; -} void Light::set_editor_only(bool p_editor_only) { @@ -486,68 +113,15 @@ bool Light::is_editor_only() const{ void Light::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_parameter","variable","value"), &Light::set_parameter ); - ObjectTypeDB::bind_method(_MD("get_parameter","variable"), &Light::get_parameter ); - ObjectTypeDB::bind_method(_MD("set_color","color","value"), &Light::set_color ); - ObjectTypeDB::bind_method(_MD("get_color","color"), &Light::get_color ); - ObjectTypeDB::bind_method(_MD("set_project_shadows","enable"), &Light::set_project_shadows ); - ObjectTypeDB::bind_method(_MD("has_project_shadows"), &Light::has_project_shadows ); - ObjectTypeDB::bind_method(_MD("set_projector","projector:Texture"), &Light::set_projector ); - ObjectTypeDB::bind_method(_MD("get_projector:Texture"), &Light::get_projector ); - ObjectTypeDB::bind_method(_MD("set_operator","operator"), &Light::set_operator ); - ObjectTypeDB::bind_method(_MD("get_operator"), &Light::get_operator ); - ObjectTypeDB::bind_method(_MD("set_bake_mode","bake_mode"), &Light::set_bake_mode ); - ObjectTypeDB::bind_method(_MD("get_bake_mode"), &Light::get_bake_mode ); - ObjectTypeDB::bind_method(_MD("set_enabled","enabled"), &Light::set_enabled ); - ObjectTypeDB::bind_method(_MD("is_enabled"), &Light::is_enabled ); + ObjectTypeDB::bind_method(_MD("set_editor_only","editor_only"), &Light::set_editor_only ); ObjectTypeDB::bind_method(_MD("is_editor_only"), &Light::is_editor_only ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/enabled"), _SCS("set_enabled"), _SCS("is_enabled")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "params/bake_mode",PROPERTY_HINT_ENUM,"Disabled,Indirect,Indirect+Shadows,Full"), _SCS("set_bake_mode"), _SCS("get_bake_mode")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/energy", PROPERTY_HINT_EXP_RANGE, "0,64,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ENERGY ); - /* - if (type == VisualServer::LIGHT_OMNI || type == VisualServer::LIGHT_SPOT) { - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_RANGE, "0,8,0.01")); - } - if (type == VisualServer::LIGHT_SPOT) { - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/spot_angle", PROPERTY_HINT_RANGE, "0.01,90.0,0.01")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/spot_attenuation", PROPERTY_HINT_RANGE, "0,8,0.01")); - }*/ - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "colors/diffuse"), _SCS("set_color"), _SCS("get_color"),COLOR_DIFFUSE); - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "colors/specular"), _SCS("set_color"), _SCS("get_color"),COLOR_SPECULAR); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow/shadow"), _SCS("set_project_shadows"), _SCS("has_project_shadows")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/darkening", PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_DARKENING ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/z_offset", PROPERTY_HINT_RANGE, "0,128,0.001"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_Z_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/z_slope_scale", PROPERTY_HINT_RANGE, "0,128,0.001"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_Z_SLOPE_SCALE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/esm_multiplier", PROPERTY_HINT_RANGE, "1.0,512.0,0.1"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_ESM_MULTIPLIER); - ADD_PROPERTYI( PropertyInfo( Variant::INT, "shadow/blur_passes", PROPERTY_HINT_RANGE, "0,4,1"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_BLUR_PASSES); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "projector",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_projector"), _SCS("get_projector")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "operator",PROPERTY_HINT_ENUM,"Add,Sub"), _SCS("set_operator"), _SCS("get_operator")); - - - BIND_CONSTANT( PARAM_RADIUS ); - BIND_CONSTANT( PARAM_ENERGY ); - BIND_CONSTANT( PARAM_ATTENUATION ); - BIND_CONSTANT( PARAM_SPOT_ANGLE ); - BIND_CONSTANT( PARAM_SPOT_ATTENUATION ); - BIND_CONSTANT( PARAM_SHADOW_DARKENING ); - BIND_CONSTANT( PARAM_SHADOW_Z_OFFSET ); - - - BIND_CONSTANT( COLOR_DIFFUSE ); - BIND_CONSTANT( COLOR_SPECULAR ); - - BIND_CONSTANT( BAKE_MODE_DISABLED ); - BIND_CONSTANT( BAKE_MODE_INDIRECT ); - BIND_CONSTANT( BAKE_MODE_INDIRECT_AND_SHADOWS ); - BIND_CONSTANT( BAKE_MODE_FULL ); } @@ -558,27 +132,8 @@ Light::Light(VisualServer::LightType p_type) { type=p_type; light=VisualServer::get_singleton()->light_create(p_type); - set_parameter(PARAM_SPOT_ATTENUATION,1.0); - set_parameter(PARAM_SPOT_ANGLE,30.0); - set_parameter(PARAM_RADIUS,2.0); - set_parameter(PARAM_ENERGY,1.0); - set_parameter(PARAM_ATTENUATION,1.0); - set_parameter(PARAM_SHADOW_DARKENING,0.0); - set_parameter(PARAM_SHADOW_Z_OFFSET,0.05); - set_parameter(PARAM_SHADOW_Z_SLOPE_SCALE,0); - set_parameter(PARAM_SHADOW_ESM_MULTIPLIER,60); - set_parameter(PARAM_SHADOW_BLUR_PASSES,1); - - - set_color( COLOR_DIFFUSE, Color(1,1,1)); - set_color( COLOR_SPECULAR, Color(1,1,1)); - - op=OPERATOR_ADD; - set_project_shadows( false ); - set_base(light); - enabled=true; + editor_only=false; - bake_mode=BAKE_MODE_DISABLED; } @@ -598,59 +153,15 @@ Light::~Light() { ///////////////////////////////////////// -void DirectionalLight::set_shadow_mode(ShadowMode p_mode) { - - shadow_mode=p_mode; - VS::get_singleton()->light_directional_set_shadow_mode(light,(VS::LightDirectionalShadowMode)p_mode); - -} - -DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const{ - - return shadow_mode; -} - -void DirectionalLight::set_shadow_param(ShadowParam p_param, float p_value) { - - ERR_FAIL_INDEX(p_param,3); - shadow_param[p_param]=p_value; - VS::get_singleton()->light_directional_set_shadow_param(light,VS::LightDirectionalShadowParam(p_param),p_value); -} - -float DirectionalLight::get_shadow_param(ShadowParam p_param) const { - ERR_FAIL_INDEX_V(p_param,3,0); - return shadow_param[p_param]; -} - void DirectionalLight::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_shadow_mode","mode"),&DirectionalLight::set_shadow_mode); - ObjectTypeDB::bind_method(_MD("get_shadow_mode"),&DirectionalLight::get_shadow_mode); - ObjectTypeDB::bind_method(_MD("set_shadow_param","param","value"),&DirectionalLight::set_shadow_param); - ObjectTypeDB::bind_method(_MD("get_shadow_param","param"),&DirectionalLight::get_shadow_param); - - ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/mode",PROPERTY_HINT_ENUM,"Orthogonal,Perspective,PSSM 2 Splits,PSSM 4 Splits"),_SCS("set_shadow_mode"),_SCS("get_shadow_mode")); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/max_distance",PROPERTY_HINT_EXP_RANGE,"0.00,99999,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_MAX_DISTANCE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/split_weight",PROPERTY_HINT_RANGE,"0.01,1.0,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_PSSM_SPLIT_WEIGHT); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/zoffset_scale",PROPERTY_HINT_RANGE,"0.01,1024.0,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_PSSM_ZOFFSET_SCALE); - BIND_CONSTANT( SHADOW_ORTHOGONAL ); - BIND_CONSTANT( SHADOW_PERSPECTIVE ); - BIND_CONSTANT( SHADOW_PARALLEL_2_SPLITS ); - BIND_CONSTANT( SHADOW_PARALLEL_4_SPLITS ); - BIND_CONSTANT( SHADOW_PARAM_MAX_DISTANCE ); - BIND_CONSTANT( SHADOW_PARAM_PSSM_SPLIT_WEIGHT ); - BIND_CONSTANT( SHADOW_PARAM_PSSM_ZOFFSET_SCALE ); } DirectionalLight::DirectionalLight() : Light( VisualServer::LIGHT_DIRECTIONAL ) { - shadow_mode=SHADOW_ORTHOGONAL; - shadow_param[SHADOW_PARAM_MAX_DISTANCE]=0; - shadow_param[SHADOW_PARAM_PSSM_SPLIT_WEIGHT]=0.5; - shadow_param[SHADOW_PARAM_PSSM_ZOFFSET_SCALE]=2.0; } @@ -658,19 +169,11 @@ DirectionalLight::DirectionalLight() : Light( VisualServer::LIGHT_DIRECTIONAL ) void OmniLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/radius", PROPERTY_HINT_EXP_RANGE, "0.2,4096,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_RADIUS ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ATTENUATION ); } void SpotLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/radius", PROPERTY_HINT_EXP_RANGE, "0.2,4096,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_RADIUS ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ATTENUATION ); - - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_angle", PROPERTY_HINT_RANGE, "0.01,89.9,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ANGLE ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_attenuation", PROPERTY_HINT_EXP_EASING, "spot_attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ATTENUATION ); - } diff --git a/scene/3d/light.h b/scene/3d/light.h index b25c6a44b5..3c31d90d4c 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -44,57 +44,12 @@ class Light : public VisualInstance { public: - enum Parameter { - PARAM_RADIUS=VisualServer::LIGHT_PARAM_RADIUS, - PARAM_ENERGY=VisualServer::LIGHT_PARAM_ENERGY, - PARAM_ATTENUATION=VisualServer::LIGHT_PARAM_ATTENUATION, - PARAM_SPOT_ANGLE=VisualServer::LIGHT_PARAM_SPOT_ANGLE, - PARAM_SPOT_ATTENUATION=VisualServer::LIGHT_PARAM_SPOT_ATTENUATION, - PARAM_SHADOW_DARKENING=VisualServer::LIGHT_PARAM_SHADOW_DARKENING, - PARAM_SHADOW_Z_OFFSET=VisualServer::LIGHT_PARAM_SHADOW_Z_OFFSET, - PARAM_SHADOW_Z_SLOPE_SCALE=VisualServer::LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE, - PARAM_SHADOW_ESM_MULTIPLIER=VisualServer::LIGHT_PARAM_SHADOW_ESM_MULTIPLIER, - PARAM_SHADOW_BLUR_PASSES=VisualServer::LIGHT_PARAM_SHADOW_BLUR_PASSES, - PARAM_MAX=VisualServer::LIGHT_PARAM_MAX - }; - enum LightColor { - - COLOR_DIFFUSE=VisualServer::LIGHT_COLOR_DIFFUSE, - COLOR_SPECULAR=VisualServer::LIGHT_COLOR_SPECULAR - }; - - enum BakeMode { - - BAKE_MODE_DISABLED, - BAKE_MODE_INDIRECT, - BAKE_MODE_INDIRECT_AND_SHADOWS, - BAKE_MODE_FULL - - }; - - - enum Operator { - - OPERATOR_ADD, - OPERATOR_SUB - }; private: - - Ref<Texture> projector; - float vars[PARAM_MAX]; - Color colors[3]; - - - BakeMode bake_mode; - VisualServer::LightType type; - bool shadows; - bool enabled; + VS::LightType type; bool editor_only; - Operator op; - void _update_visibility(); // bind helpers @@ -103,8 +58,7 @@ protected: RID light; virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; - + static void _bind_methods(); void _notification(int p_what); @@ -114,44 +68,17 @@ public: VS::LightType get_light_type() const { return type; } - void set_parameter(Parameter p_var, float p_value); - float get_parameter(Parameter p_var) const; - - void set_color(LightColor p_color,const Color& p_value); - Color get_color(LightColor p_color) const; - - void set_project_shadows(bool p_enabled); - bool has_project_shadows() const; - - void set_projector(const Ref<Texture>& p_projector); - Ref<Texture> get_projector() const; - - void set_operator(Operator p_op); - Operator get_operator() const; - - void set_bake_mode(BakeMode p_bake_mode); - BakeMode get_bake_mode() const; - - void set_enabled(bool p_enabled); - bool is_enabled() const; - void set_editor_only(bool p_editor_only); bool is_editor_only() const; virtual AABB get_aabb() const; virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; - void approximate_opengl_attenuation(float p_constant, float p_linear, float p_quadratic, float p_radius_treshold=0.5); - Light(); ~Light(); }; -VARIANT_ENUM_CAST( Light::Parameter ); -VARIANT_ENUM_CAST( Light::LightColor ); -VARIANT_ENUM_CAST( Light::Operator ); -VARIANT_ENUM_CAST( Light::BakeMode); class DirectionalLight : public Light { @@ -160,39 +87,18 @@ class DirectionalLight : public Light { public: - enum ShadowMode { - SHADOW_ORTHOGONAL, - SHADOW_PERSPECTIVE, - SHADOW_PARALLEL_2_SPLITS, - SHADOW_PARALLEL_4_SPLITS - }; - enum ShadowParam { - SHADOW_PARAM_MAX_DISTANCE, - SHADOW_PARAM_PSSM_SPLIT_WEIGHT, - SHADOW_PARAM_PSSM_ZOFFSET_SCALE - }; private: - ShadowMode shadow_mode; - float shadow_param[3]; + + protected: static void _bind_methods(); public: - void set_shadow_mode(ShadowMode p_mode); - ShadowMode get_shadow_mode() const; - - void set_shadow_max_distance(float p_distance); - float get_shadow_max_distance() const; - void set_shadow_param(ShadowParam p_param, float p_value); - float get_shadow_param(ShadowParam p_param) const; DirectionalLight(); }; -VARIANT_ENUM_CAST( DirectionalLight::ShadowMode ); -VARIANT_ENUM_CAST( DirectionalLight::ShadowParam ); - class OmniLight : public Light { @@ -203,7 +109,7 @@ protected: public: - OmniLight() : Light( VisualServer::LIGHT_OMNI ) { set_parameter(PARAM_SHADOW_Z_OFFSET,0.001);} + OmniLight() : Light( VisualServer::LIGHT_OMNI ) { } }; class SpotLight : public Light { diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 3ac5d8ed7b..994e329853 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -30,6 +30,7 @@ #include "servers/visual_server.h" #include "scene/resources/surface_tool.h" +#if 0 /* static const char* _var_names[Particles::VAR_MAX]={ "vars/lifetime", @@ -557,3 +558,4 @@ Particles::~Particles() { VisualServer::get_singleton()->free(particles); } +#endif diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 42d27c41d7..fb3bb258ef 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -37,7 +37,7 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ - +#if 0 class Particles : public GeometryInstance { public: @@ -163,3 +163,4 @@ public: VARIANT_ENUM_CAST( Particles::Variable ); #endif +#endif diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 23bc64615d..131bbd7000 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -96,45 +96,6 @@ void Portal::_get_property_list( List<PropertyInfo> *p_list) const { } -RES Portal::_get_gizmo_geometry() const { - - Ref<SurfaceTool> surface_tool( memnew( SurfaceTool )); - - Ref<FixedMaterial> mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(1.0,0.8,0.8,0.7) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); -// mat->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - Vector<Point2> shape = get_shape(); - - Vector2 center; - for (int i=0;i<shape.size();i++) { - - int n=(i+1)%shape.size(); - Vector<Vector3> points; - surface_tool->add_vertex( Vector3( shape[i].x, shape[i].y,0 )); - surface_tool->add_vertex( Vector3( shape[n].x, shape[n].y,0 )); - center+=shape[i]; - - } - - if (shape.size()>0) { - - center/=shape.size(); - Vector<Vector3> points; - surface_tool->add_vertex( Vector3( center.x, center.y,0 )); - surface_tool->add_vertex( Vector3( center.x, center.y,1.0 )); - } - - return surface_tool->commit(); -} - AABB Portal::get_aabb() const { @@ -178,18 +139,19 @@ void Portal::set_shape(const Vector<Point2>& p_shape) { VisualServer::get_singleton()->portal_set_shape(portal, p_shape); + shape=p_shape; update_gizmo(); } Vector<Point2> Portal::get_shape() const { - return VisualServer::get_singleton()->portal_get_shape(portal); + return shape; } void Portal::set_connect_range(float p_range) { connect_range=p_range; - VisualServer::get_singleton()->portal_set_connect_range(portal,p_range); + //VisualServer::get_singleton()->portal_set_connect_range(portal,p_range); } float Portal::get_connect_range() const { diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 149a56900f..8bcfa1ea4b 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -47,6 +47,7 @@ class Portal : public VisualInstance { OBJ_TYPE(Portal, VisualInstance); RID portal; + Vector<Point2> shape; bool enabled; float disable_distance; @@ -55,7 +56,6 @@ class Portal : public VisualInstance { AABB aabb; - virtual RES _get_gizmo_geometry() const; protected: diff --git a/scene/3d/position_3d.cpp b/scene/3d/position_3d.cpp index 27130cbe6a..de1a0b73f4 100644 --- a/scene/3d/position_3d.cpp +++ b/scene/3d/position_3d.cpp @@ -29,37 +29,6 @@ #include "position_3d.h" #include "scene/resources/mesh.h" -RES Position3D::_get_gizmo_geometry() const { - - - Ref<Mesh> mesh = memnew( Mesh ); - - DVector<Vector3> cursor_points; - DVector<Color> cursor_colors; - float cs = 0.25; - cursor_points.push_back(Vector3(+cs,0,0)); - cursor_points.push_back(Vector3(-cs,0,0)); - cursor_points.push_back(Vector3(0,+cs,0)); - cursor_points.push_back(Vector3(0,-cs,0)); - cursor_points.push_back(Vector3(0,0,+cs)); - cursor_points.push_back(Vector3(0,0,-cs)); - cursor_colors.push_back(Color(1,0.5,0.5,1)); - cursor_colors.push_back(Color(1,0.5,0.5,1)); - cursor_colors.push_back(Color(0.5,1,0.5,1)); - cursor_colors.push_back(Color(0.5,1,0.5,1)); - cursor_colors.push_back(Color(0.5,0.5,1,1)); - cursor_colors.push_back(Color(0.5,0.5,1,1)); - - Ref<FixedMaterial> mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_line_width(3); - Array d; - d[Mesh::ARRAY_VERTEX]=cursor_points; - d[Mesh::ARRAY_COLOR]=cursor_colors; - mesh->add_surface(Mesh::PRIMITIVE_LINES,d); - mesh->surface_set_material(0,mat); - return mesh; -} Position3D::Position3D() { diff --git a/scene/3d/position_3d.h b/scene/3d/position_3d.h index 6bac540fcb..676f46c2ee 100644 --- a/scene/3d/position_3d.h +++ b/scene/3d/position_3d.h @@ -35,7 +35,6 @@ class Position3D : public Spatial { OBJ_TYPE(Position3D,Spatial); - virtual RES _get_gizmo_geometry() const; public: diff --git a/scene/3d/quad.cpp b/scene/3d/quad.cpp index 1a7eeef180..f31d248ba7 100644 --- a/scene/3d/quad.cpp +++ b/scene/3d/quad.cpp @@ -120,7 +120,7 @@ void Quad::_update() { } else { configured=true; } - VS::get_singleton()->mesh_add_surface(mesh,VS::PRIMITIVE_TRIANGLES,arr); + VS::get_singleton()->mesh_add_surface_from_arrays(mesh,VS::PRIMITIVE_TRIANGLES,arr); pending_update=false; } diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 9e6867d2a2..080fa880ba 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -75,50 +75,6 @@ void Room::_notification(int p_what) { } -RES Room::_get_gizmo_geometry() const { - - DVector<Face3> faces; - if (!room.is_null()) - faces=room->get_geometry_hint(); - - int count=faces.size(); - if (count==0) - return RES(); - - DVector<Face3>::Read facesr=faces.read(); - - const Face3* facesptr=facesr.ptr(); - - DVector<Vector3> points; - - Ref<SurfaceTool> surface_tool( memnew( SurfaceTool )); - - Ref<FixedMaterial> mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.2,0.8,0.9,0.3) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - for (int i=0;i<count;i++) { - - surface_tool->add_vertex(facesptr[i].vertex[0]); - surface_tool->add_vertex(facesptr[i].vertex[1]); - - surface_tool->add_vertex(facesptr[i].vertex[1]); - surface_tool->add_vertex(facesptr[i].vertex[2]); - - surface_tool->add_vertex(facesptr[i].vertex[2]); - surface_tool->add_vertex(facesptr[i].vertex[0]); - - } - - return surface_tool->commit(); -} @@ -127,8 +83,9 @@ AABB Room::get_aabb() const { if (room.is_null()) return AABB(); - return room->get_bounds().get_aabb(); + return AABB(); } + DVector<Face3> Room::get_faces(uint32_t p_usage_flags) const { return DVector<Face3>(); @@ -154,9 +111,6 @@ void Room::set_room( const Ref<RoomBounds>& p_room ) { propagate_notification(NOTIFICATION_AREA_CHANGED); update_gizmo(); - if (room.is_valid()) - SpatialSoundServer::get_singleton()->room_set_bounds(sound_room,room->get_bounds()); - } @@ -202,32 +156,6 @@ void Room::_parse_node_faces(DVector<Face3> &all_faces,const Node *p_node) const } -void Room::compute_room_from_subtree() { - - - DVector<Face3> all_faces; - _parse_node_faces(all_faces,this); - - - if (all_faces.size()==0) - return; - float error; - DVector<Face3> wrapped_faces = Geometry::wrap_geometry(all_faces,&error); - - - if (wrapped_faces.size()==0) - return; - - BSP_Tree tree(wrapped_faces,error); - - Ref<RoomBounds> room( memnew( RoomBounds ) ); - room->set_bounds(tree); - room->set_geometry_hint(wrapped_faces); - - set_room(room); - -} - void Room::set_simulate_acoustics(bool p_enable) { @@ -268,7 +196,6 @@ void Room::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_room","room:Room"),&Room::set_room ); ObjectTypeDB::bind_method(_MD("get_room:Room"),&Room::get_room ); - ObjectTypeDB::bind_method(_MD("compute_room_from_subtree"),&Room::compute_room_from_subtree); diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index c7df4ceadd..346e687d9e 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -45,6 +45,8 @@ */ + + class Room : public VisualInstance { OBJ_TYPE( Room, VisualInstance ); @@ -65,7 +67,7 @@ private: void _bounds_changed(); - virtual RES _get_gizmo_geometry() const; + protected: @@ -89,7 +91,6 @@ public: void set_simulate_acoustics(bool p_enable); bool is_simulating_acoustics() const; - void compute_room_from_subtree(); RID get_sound_room() const; diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index c996a8123c..96233c5ed7 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -163,7 +163,7 @@ void Skeleton::_notification(int p_what) { Bone *bonesptr=&bones[0]; int len=bones.size(); - vs->skeleton_resize( skeleton, len ); // if same size, nothin really happens + vs->skeleton_allocate( skeleton, len ); // if same size, nothin really happens // pose changed, rebuild cache of inverses if (rest_global_inverse_dirty) { @@ -513,51 +513,6 @@ void Skeleton::_make_dirty() { } -RES Skeleton::_get_gizmo_geometry() const { - - if (!GLOBAL_DEF("debug/draw_skeleton", true)) - return RES(); - - if (bones.size()==0) - return RES(); - - Ref<SurfaceTool> surface_tool( memnew( SurfaceTool )); - - Ref<FixedMaterial> mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.6,1.0,0.3,0.1) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_flag(Material::FLAG_ONTOP,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - - const Bone *bonesptr=&bones[0]; - int len=bones.size(); - - for (int i=0;i<len;i++) { - - const Bone &b=bonesptr[i]; - - Transform t; - if (b.parent<0) - continue; - - Vector3 v1=(bonesptr[b.parent].pose_global * bonesptr[b.parent].rest_global_inverse).xform(bonesptr[b.parent].rest_global_inverse.affine_inverse().origin); - Vector3 v2=(b.pose_global * b.rest_global_inverse).xform(b.rest_global_inverse.affine_inverse().origin); - - surface_tool->add_vertex(v1); - surface_tool->add_vertex(v2); - - } - - return surface_tool->commit(); - -} void Skeleton::localize_rests() { diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h index bfdb1d1499..1b8136b06c 100644 --- a/scene/3d/skeleton.h +++ b/scene/3d/skeleton.h @@ -84,7 +84,6 @@ class Skeleton : public Spatial { return bound; } - virtual RES _get_gizmo_geometry() const; protected: diff --git a/scene/3d/spatial_player.cpp b/scene/3d/spatial_player.cpp index c7cf03e284..70370c51e7 100644 --- a/scene/3d/spatial_player.cpp +++ b/scene/3d/spatial_player.cpp @@ -88,146 +88,6 @@ bool SpatialPlayer::_can_gizmo_scale() const { return false; } -RES SpatialPlayer::_get_gizmo_geometry() const { - - Ref<SurfaceTool> surface_tool( memnew( SurfaceTool )); - - Ref<FixedMaterial> mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.0,0.6,0.7,0.05) ); - mat->set_parameter( FixedMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) ); - mat->set_blend_mode( Material::BLEND_MODE_ADD ); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - - surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - surface_tool->set_material(mat); - - int sides=16; - int sections=24; - -// float len=1; - float deg=Math::deg2rad(params[PARAM_EMISSION_CONE_DEGREES]); - if (deg==180) - deg=179.5; - - Vector3 to=Vector3(0,0,-1); - - for(int j=0;j<sections;j++) { - - Vector3 p1=Matrix3(Vector3(1,0,0),deg*j/sections).xform(to); - Vector3 p2=Matrix3(Vector3(1,0,0),deg*(j+1)/sections).xform(to); - - for(int i=0;i<sides;i++) { - - Vector3 p1r = Matrix3(Vector3(0,0,1),Math_PI*2*float(i)/sides).xform(p1); - Vector3 p1s = Matrix3(Vector3(0,0,1),Math_PI*2*float(i+1)/sides).xform(p1); - Vector3 p2s = Matrix3(Vector3(0,0,1),Math_PI*2*float(i+1)/sides).xform(p2); - Vector3 p2r = Matrix3(Vector3(0,0,1),Math_PI*2*float(i)/sides).xform(p2); - - surface_tool->add_normal(p1r.normalized()); - surface_tool->add_vertex(p1r); - surface_tool->add_normal(p1s.normalized()); - surface_tool->add_vertex(p1s); - surface_tool->add_normal(p2s.normalized()); - surface_tool->add_vertex(p2s); - - surface_tool->add_normal(p1r.normalized()); - surface_tool->add_vertex(p1r); - surface_tool->add_normal(p2s.normalized()); - surface_tool->add_vertex(p2s); - surface_tool->add_normal(p2r.normalized()); - surface_tool->add_vertex(p2r); - - if (j==sections-1) { - - surface_tool->add_normal(p2r.normalized()); - surface_tool->add_vertex(p2r); - surface_tool->add_normal(p2s.normalized()); - surface_tool->add_vertex(p2s); - surface_tool->add_normal(Vector3(0,0,1)); - surface_tool->add_vertex(Vector3()); - } - } - } - - - Ref<Mesh> mesh = surface_tool->commit(); - - Ref<FixedMaterial> mat_speaker( memnew( FixedMaterial )); - - mat_speaker->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.3,0.3,0.6) ); - mat_speaker->set_parameter( FixedMaterial::PARAM_SPECULAR,Color(0.5,0.5,0.6) ); - //mat_speaker->set_blend_mode( Material::BLEND_MODE_MIX); - //mat_speaker->set_flag(Material::FLAG_DOUBLE_SIDED,false); - //mat_speaker->set_flag(Material::FLAG_UNSHADED,true); - - surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - surface_tool->set_material(mat_speaker); - -// float radius=1; - - - const int speaker_points=8; - Vector3 speaker[speaker_points]={ - Vector3(0,0,1)*0.15, - Vector3(1,1,1)*0.15, - Vector3(1,1,0)*0.15, - Vector3(2,2,-1)*0.15, - Vector3(1,1,-1)*0.15, - Vector3(0.8,0.8,-1.2)*0.15, - Vector3(0.5,0.5,-1.4)*0.15, - Vector3(0.0,0.0,-1.6)*0.15 - }; - - int speaker_sides=10; - - - for(int i = 0; i < speaker_sides ; i++) { - - - Matrix3 ma(Vector3(0,0,1),Math_PI*2*float(i)/speaker_sides); - Matrix3 mb(Vector3(0,0,1),Math_PI*2*float(i+1)/speaker_sides); - - - for(int j=0;j<speaker_points-1;j++) { - - Vector3 points[4]={ - ma.xform(speaker[j]), - mb.xform(speaker[j]), - mb.xform(speaker[j+1]), - ma.xform(speaker[j+1]), - }; - - Vector3 n = -Plane(points[0],points[1],points[2]).normal; - - surface_tool->add_normal(n); - surface_tool->add_vertex(points[0]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[2]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[1]); - - surface_tool->add_normal(n); - surface_tool->add_vertex(points[0]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[3]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[2]); - - - } - - - } - - - return surface_tool->commit(mesh); - -} - - void SpatialPlayer::_bind_methods() { diff --git a/scene/3d/spatial_player.h b/scene/3d/spatial_player.h index 5a8687b854..594fc8f850 100644 --- a/scene/3d/spatial_player.h +++ b/scene/3d/spatial_player.h @@ -60,7 +60,7 @@ private: RID source_rid; virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; + protected: diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index b4f7a4e5b4..5bc332f8fb 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -52,7 +52,7 @@ void VisualInstance::_notification(int p_what) { Room *room=NULL; bool is_geom = cast_to<GeometryInstance>(); - while(parent) { + /* while(parent) { room = parent->cast_to<Room>(); if (room) @@ -64,7 +64,7 @@ void VisualInstance::_notification(int p_what) { } parent=parent->get_parent_spatial(); - } + }*/ @@ -92,7 +92,7 @@ void VisualInstance::_notification(int p_what) { VisualServer::get_singleton()->instance_set_scenario( instance, RID() ); VisualServer::get_singleton()->instance_set_room(instance,RID()); VisualServer::get_singleton()->instance_attach_skeleton( instance, RID() ); - VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); + // VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); } break; @@ -172,30 +172,55 @@ Ref<Material> GeometryInstance::get_material_override() const{ -void GeometryInstance::set_draw_range_begin(float p_dist){ +void GeometryInstance::set_lod_min_distance(float p_dist){ + + 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); +} + +float GeometryInstance::get_lod_min_distance() const{ + + return lod_min_distance; +} + + +void GeometryInstance::set_lod_max_distance(float p_dist) { + + 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); - draw_begin=p_dist; - VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),draw_begin,draw_end); } -float GeometryInstance::get_draw_range_begin() const{ +float GeometryInstance::get_lod_max_distance() const { - return draw_begin; + return lod_max_distance; } +void GeometryInstance::set_lod_min_hysteresis(float p_dist){ -void GeometryInstance::set_draw_range_end(float p_dist) { + 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); +} - draw_end=p_dist; - VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),draw_begin,draw_end); +float GeometryInstance::get_lod_min_hysteresis() const{ + return lod_min_hysteresis; } -float GeometryInstance::get_draw_range_end() const { - return draw_end; +void GeometryInstance::set_lod_max_hysteresis(float p_dist) { + + 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); + } +float GeometryInstance::get_lod_max_hysteresis() const { + + return lod_max_hysteresis; +} + + void GeometryInstance::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_WORLD) { @@ -212,8 +237,8 @@ void GeometryInstance::_notification(int p_what) { if (flags[FLAG_USE_BAKED_LIGHT]) { if (baked_light_instance) { - baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); - baked_light_instance=NULL; + // baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); + // baked_light_instance=NULL; } _baked_light_changed(); @@ -229,15 +254,15 @@ void GeometryInstance::_notification(int p_what) { void GeometryInstance::_baked_light_changed() { - if (!baked_light_instance) - VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); - else - VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); + //if (!baked_light_instance) + // VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); +// else +// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); } void GeometryInstance::_find_baked_light() { - +/* Node *n=get_parent(); while(n) { @@ -255,6 +280,7 @@ void GeometryInstance::_find_baked_light() { } _baked_light_changed(); + */ } void GeometryInstance::_update_visibility() { @@ -288,7 +314,7 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) { } if (p_flag==FLAG_USE_BAKED_LIGHT) { - if (is_inside_world()) { + /* if (is_inside_world()) { if (!p_value) { if (baked_light_instance) { baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); @@ -298,7 +324,7 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) { } else { _find_baked_light(); } - } + }*/ } } @@ -333,8 +359,8 @@ GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_settin void GeometryInstance::set_baked_light_texture_id(int p_id) { - baked_light_texture_id=p_id; - VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),baked_light_texture_id); +// baked_light_texture_id=p_id; +// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),baked_light_texture_id); } @@ -366,11 +392,18 @@ void GeometryInstance::_bind_methods() { 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); - ObjectTypeDB::bind_method(_MD("set_draw_range_begin","mode"), &GeometryInstance::set_draw_range_begin); - ObjectTypeDB::bind_method(_MD("get_draw_range_begin"), &GeometryInstance::get_draw_range_begin); + 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); + + 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); - ObjectTypeDB::bind_method(_MD("set_draw_range_end","mode"), &GeometryInstance::set_draw_range_end); - ObjectTypeDB::bind_method(_MD("get_draw_range_end"), &GeometryInstance::get_draw_range_end); ObjectTypeDB::bind_method(_MD("set_baked_light_texture_id","id"), &GeometryInstance::set_baked_light_texture_id); ObjectTypeDB::bind_method(_MD("get_baked_light_texture_id"), &GeometryInstance::get_baked_light_texture_id); @@ -385,9 +418,6 @@ void GeometryInstance::_bind_methods() { 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")); 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")); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/receive_shadows"), _SCS("set_flag"), _SCS("get_flag"),FLAG_RECEIVE_SHADOWS); - ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_begin",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_begin"), _SCS("get_draw_range_begin")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_end",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_end"), _SCS("get_draw_range_end")); 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")); 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); @@ -395,12 +425,15 @@ void GeometryInstance::_bind_methods() { ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible_in_all_rooms"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE_IN_ALL_ROOMS); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/use_baked_light"), _SCS("set_flag"), _SCS("get_flag"),FLAG_USE_BAKED_LIGHT); ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/baked_light_tex_id"), _SCS("set_baked_light_texture_id"), _SCS("get_baked_light_texture_id")); + 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")); // ADD_SIGNAL( MethodInfo("visibility_changed")); BIND_CONSTANT(FLAG_VISIBLE ); BIND_CONSTANT(FLAG_CAST_SHADOW ); - BIND_CONSTANT(FLAG_RECEIVE_SHADOWS ); BIND_CONSTANT(FLAG_BILLBOARD ); BIND_CONSTANT(FLAG_BILLBOARD_FIX_Y ); BIND_CONSTANT(FLAG_DEPH_SCALE ); @@ -415,20 +448,23 @@ void GeometryInstance::_bind_methods() { } GeometryInstance::GeometryInstance() { - draw_begin=0; - draw_end=0; + lod_min_distance=0; + lod_max_distance=0; + lod_min_hysteresis=0; + lod_max_hysteresis=0; + for(int i=0;i<FLAG_MAX;i++) { flags[i]=false; } flags[FLAG_VISIBLE]=true; flags[FLAG_CAST_SHADOW]=true; - flags[FLAG_RECEIVE_SHADOWS]=true; + shadow_casting_setting=SHADOW_CASTING_SETTING_ON; baked_light_instance=NULL; baked_light_texture_id=0; extra_cull_margin=0; - VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); +// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); } diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index e286d5fa88..eb0587815f 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -89,7 +89,6 @@ public: enum Flags { FLAG_VISIBLE=VS::INSTANCE_FLAG_VISIBLE, FLAG_CAST_SHADOW=VS::INSTANCE_FLAG_CAST_SHADOW, - FLAG_RECEIVE_SHADOWS=VS::INSTANCE_FLAG_RECEIVE_SHADOWS, FLAG_BILLBOARD=VS::INSTANCE_FLAG_BILLBOARD, FLAG_BILLBOARD_FIX_Y=VS::INSTANCE_FLAG_BILLBOARD_FIX_Y, FLAG_DEPH_SCALE=VS::INSTANCE_FLAG_DEPH_SCALE, @@ -110,8 +109,10 @@ private: bool flags[FLAG_MAX]; ShadowCastingSetting shadow_casting_setting; Ref<Material> material_override; - float draw_begin; - float draw_end; + float lod_min_distance; + float lod_max_distance; + float lod_min_hysteresis; + float lod_max_hysteresis; void _find_baked_light(); BakedLightInstance *baked_light_instance; int baked_light_texture_id; @@ -131,11 +132,17 @@ public: void set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting); ShadowCastingSetting get_cast_shadows_setting() const; - void set_draw_range_begin(float p_dist); - float get_draw_range_begin() const; + void set_lod_min_distance(float p_dist); + float get_lod_min_distance() const; - void set_draw_range_end(float p_dist); - float get_draw_range_end() const; + void set_lod_max_distance(float p_dist); + float get_lod_max_distance() const; + + void set_lod_min_hysteresis(float p_dist); + float get_lod_min_hysteresis() const; + + void set_lod_max_hysteresis(float p_dist); + float get_lod_max_hysteresis() const; void set_material_override(const Ref<Material>& p_material); Ref<Material> get_material_override() const; |