diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-08-14 10:31:38 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-08-14 10:31:38 -0300 |
commit | 2ee4ac183babedd679e901b0158f5268556deceb (patch) | |
tree | c0b5215b7ab17186835e1919912fa09de7301bfb /servers/visual | |
parent | c3e1d7b7c788530dc69e973352763a90da05d4e1 (diff) |
Little Bits
-=-=-=-=-=-
-Fixed small bugs all around
-Added ability to show/hide entire sections of the spatial (3D) tree
-WIP new vehicle (not ready yet) based on Bullet
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/rasterizer.h | 2 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 6 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 27 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 8 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 2 |
5 files changed, 40 insertions, 5 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 2b02a81a44..77d4da81d9 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -507,6 +507,7 @@ public: float octree_lattice_size; float octree_lattice_divide; float texture_multiplier; + float lightmap_multiplier; int octree_steps; Vector2 octree_tex_pixel_size; }; @@ -520,6 +521,7 @@ public: Vector<float> morph_values; BakedLightData *baked_light; Transform *baked_light_octree_xform; + int baked_lightmap_id; bool mirror :8; bool depth_scale :8; bool billboard :8; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 16a725010d..489b5c3771 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1005,6 +1005,11 @@ const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={ const ShaderLanguage::BuiltinsDef ShaderLanguage::vertex_builtins_defs[]={ + { "SRC_VERTEX", TYPE_VEC3}, + { "SRC_NORMAL", TYPE_VEC3}, + { "SRC_TANGENT", TYPE_VEC3}, + { "SRC_BINORMALF", TYPE_FLOAT}, + { "VERTEX", TYPE_VEC3}, { "NORMAL", TYPE_VEC3}, { "TANGENT", TYPE_VEC3}, @@ -1023,6 +1028,7 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::vertex_builtins_defs[]={ { "WORLD_MATRIX", TYPE_MAT4}, { "INV_CAMERA_MATRIX", TYPE_MAT4}, { "PROJECTION_MATRIX", TYPE_MAT4}, + { "MODELVIEW_MATRIX", TYPE_MAT4}, { "INSTANCE_ID", TYPE_FLOAT}, { "TIME", TYPE_FLOAT}, { NULL, TYPE_VOID}, diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 7c1f03b71b..66862ece65 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -148,7 +148,7 @@ String VisualServerRaster::shader_get_fragment_code(RID p_shader) const{ String VisualServerRaster::shader_get_light_code(RID p_shader) const{ - return rasterizer->shader_get_fragment_code(p_shader); + return rasterizer->shader_get_light_code(p_shader); } void VisualServerRaster::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const { @@ -1038,6 +1038,7 @@ RID VisualServerRaster::baked_light_create() { baked_light->data.octree_lattice_size=0; baked_light->data.octree_lattice_divide=0; baked_light->data.octree_steps=1; + baked_light->data.lightmap_multiplier=1.0; return baked_light_owner.make_rid( baked_light ); @@ -1063,6 +1064,26 @@ VisualServer::BakedLightMode VisualServerRaster::baked_light_get_mode(RID p_bake } +void VisualServerRaster::baked_light_set_lightmap_multiplier(RID p_baked_light,float p_multiplier) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.lightmap_multiplier=p_multiplier; + +} + +float VisualServerRaster::baked_light_get_lightmap_multiplier(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light,0); + + return baked_light->data.lightmap_multiplier; + +} + + void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector<uint8_t> p_octree){ VS_CHANGED; @@ -2568,7 +2589,7 @@ void VisualServerRaster::instance_geometry_set_baked_light_texture_index(RID p_i Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); - instance->lightmap_texture_index=p_tex_id; + instance->data.baked_lightmap_id=p_tex_id; } @@ -2577,7 +2598,7 @@ int VisualServerRaster::instance_geometry_get_baked_light_texture_index(RID p_in const Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND_V( !instance,0 ); - return instance->lightmap_texture_index; + return instance->data.baked_lightmap_id; } diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 0368780bfb..2620225cc2 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -157,7 +157,7 @@ class VisualServerRaster : public VisualServer { float draw_range_begin; float draw_range_end; float extra_margin; - int lightmap_texture_index; + Rasterizer::InstanceData data; @@ -267,6 +267,7 @@ class VisualServerRaster : public VisualServer { data.billboard_y=false; data.baked_light=NULL; data.baked_light_octree_xform=NULL; + data.baked_lightmap_id=-1; version=1; room_info=NULL; room=NULL; @@ -278,7 +279,7 @@ class VisualServerRaster : public VisualServer { draw_range_end=0; extra_margin=0; visible_in_all_rooms=false; - lightmap_texture_index=-1; + baked_light=NULL; baked_light_info=NULL; BLE=NULL; @@ -942,6 +943,9 @@ public: virtual void baked_light_set_octree(RID p_baked_light,const DVector<uint8_t> p_octree); virtual DVector<uint8_t> baked_light_get_octree(RID p_baked_light) const; + virtual void baked_light_set_lightmap_multiplier(RID p_baked_light,float p_multiplier); + virtual float baked_light_get_lightmap_multiplier(RID p_baked_light) const; + virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id); virtual void baked_light_clear_lightmaps(RID p_baked_light); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index d577ca0c59..f1ba4c453b 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -909,6 +909,8 @@ public: FUNC2(baked_light_set_octree,RID,DVector<uint8_t>); FUNC1RC(DVector<uint8_t>,baked_light_get_octree,RID); + FUNC2(baked_light_set_lightmap_multiplier,RID,float); + FUNC1RC(float,baked_light_get_lightmap_multiplier,RID); FUNC3(baked_light_add_lightmap,RID,RID,int); FUNC1(baked_light_clear_lightmaps,RID); |