summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-10-29 20:48:09 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-10-29 20:48:09 -0300
commitd6567010bf1c65abcbe09b959cde63664778d923 (patch)
tree5a1ec061f317770c41ece7bb378c0ab2dbb2aef4 /servers
parent53d8f2b1ec1d86b189800b7fe156c464fdf9e380 (diff)
-Many many fixes
-Gizmos work again
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer.h9
-rw-r--r--servers/visual/visual_server_raster.h11
-rw-r--r--servers/visual/visual_server_scene.cpp76
-rw-r--r--servers/visual/visual_server_scene.h2
-rw-r--r--servers/visual_server.h13
5 files changed, 86 insertions, 25 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 78757c799f..b61a2d0a46 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -54,11 +54,8 @@ public:
virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0;
virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0;
- virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper)=0;
- virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0;
- virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0;
- virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0;
- virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0;
+ virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper)=0;
+ virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0;
struct InstanceBase : RID_Data {
@@ -176,6 +173,8 @@ public:
virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0;
virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0;
+ virtual void material_set_line_width(RID p_material, float p_width)=0;
+
/* MESH API */
virtual RID mesh_create()=0;
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 655ce410bc..6c7048bd62 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -658,6 +658,10 @@ public:
BIND3(material_set_param,RID, const StringName&, const Variant& )
BIND2RC(Variant,material_get_param,RID, const StringName& )
+ BIND2(material_set_line_width,RID, float )
+
+
+
/* MESH API */
BIND0R(RID,mesh_create)
@@ -864,11 +868,8 @@ public:
BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode )
BIND5(environment_set_fog,RID,bool ,float ,float ,RID )
- BIND8(environment_set_tonemap,RID,bool ,float ,float ,float ,float ,float ,EnvironmentToneMapper )
- BIND3(environment_set_brightness,RID,bool ,float )
- BIND3(environment_set_contrast,RID,bool ,float )
- BIND3(environment_set_saturation,RID,bool ,float )
- BIND3(environment_set_color_correction,RID,bool ,RID )
+ BIND9(environment_set_tonemap,RID,bool ,float ,float ,float ,float ,float,float ,EnvironmentToneMapper )
+ BIND6(environment_set_adjustment,RID,bool ,float ,float ,float ,RID )
/* SCENARIO API */
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 2f0f8f263f..d958ea4bdb 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -692,21 +692,81 @@ void VisualServerScene::instance_set_extra_visibility_margin( RID p_instance, re
}
-// don't use these in a game!
-Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const{
+Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const {
- return Vector<ObjectID>();
-}
-Vector<ObjectID> VisualServerScene::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{
+ Vector<ObjectID> instances;
+ Scenario *scenario=scenario_owner.get(p_scenario);
+ ERR_FAIL_COND_V(!scenario,instances);
+
+ const_cast<VisualServerScene*>(this)->update_dirty_instances(); // check dirty instances before culling
+
+ int culled=0;
+ Instance *cull[1024];
+ culled=scenario->octree.cull_AABB(p_aabb,cull,1024);
- return Vector<ObjectID>();
+ for (int i=0;i<culled;i++) {
+
+ Instance *instance=cull[i];
+ ERR_CONTINUE(!instance);
+ if (instance->object_ID==0)
+ continue;
+
+ instances.push_back(instance->object_ID);
+ }
+
+ return instances;
}
-Vector<ObjectID> VisualServerScene::instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario) const {
+Vector<ObjectID> VisualServerScene::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{
+
+ Vector<ObjectID> instances;
+ Scenario *scenario=scenario_owner.get(p_scenario);
+ ERR_FAIL_COND_V(!scenario,instances);
+ const_cast<VisualServerScene*>(this)->update_dirty_instances(); // check dirty instances before culling
+
+ int culled=0;
+ Instance *cull[1024];
+ culled=scenario->octree.cull_segment(p_from,p_to*10000,cull,1024);
+
+
+ for (int i=0;i<culled;i++) {
+ Instance *instance=cull[i];
+ ERR_CONTINUE(!instance);
+ if (instance->object_ID==0)
+ continue;
+
+ instances.push_back(instance->object_ID);
+ }
+
+ return instances;
- return Vector<ObjectID>();
}
+Vector<ObjectID> VisualServerScene::instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario) const{
+
+ Vector<ObjectID> instances;
+ Scenario *scenario=scenario_owner.get(p_scenario);
+ ERR_FAIL_COND_V(!scenario,instances);
+ const_cast<VisualServerScene*>(this)->update_dirty_instances(); // check dirty instances before culling
+
+ int culled=0;
+ Instance *cull[1024];
+
+
+ culled=scenario->octree.cull_convex(p_convex,cull,1024);
+ for (int i=0;i<culled;i++) {
+
+ Instance *instance=cull[i];
+ ERR_CONTINUE(!instance);
+ if (instance->object_ID==0)
+ continue;
+
+ instances.push_back(instance->object_ID);
+ }
+
+ return instances;
+
+}
void VisualServerScene::instance_geometry_set_flag(RID p_instance,VS::InstanceFlags p_flags,bool p_enabled){
diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h
index 515d52db7b..10a159f27a 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/visual/visual_server_scene.h
@@ -162,7 +162,7 @@ public:
Scenario() { debug=VS::SCENARIO_DEBUG_DISABLED; }
};
- RID_Owner<Scenario> scenario_owner;
+ mutable RID_Owner<Scenario> scenario_owner;
static void* _instance_pair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int);
static void _instance_unpair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int,void*);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index bbe6c2c683..78769c17f7 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -172,6 +172,8 @@ public:
virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0;
virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0;
+ virtual void material_set_line_width(RID p_material, float p_width)=0;
+
/* MESH API */
enum ArrayType {
@@ -512,15 +514,14 @@ public:
enum EnvironmentToneMapper {
ENV_TONE_MAPPER_LINEAR,
+ ENV_TONE_MAPPER_LOG,
ENV_TONE_MAPPER_REINHARDT,
- ENV_TONE_MAPPER_FILMIC
+ ENV_TONE_MAPPER_FILMIC,
+ ENV_TONE_MAPPER_ACES_FILMIC
};
- virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper)=0;
- virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0;
- virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0;
- virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0;
- virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0;
+ virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,EnvironmentToneMapper p_tone_mapper)=0;
+ virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0;
/* SCENARIO API */