-vec3 uniforms should now work, fixes #1773

This commit is contained in:
Juan Linietsky 2015-05-04 10:17:24 -03:00
parent 9b01f5954a
commit a76709d240
4 changed files with 49 additions and 20 deletions

View File

@ -117,6 +117,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoader::load_interactive(const Stri
RES ResourceFormatLoader::load(const String &p_path,const String& p_original_path) { RES ResourceFormatLoader::load(const String &p_path,const String& p_original_path) {
String path=p_path;
//or this must be implemented //or this must be implemented
Ref<ResourceInteractiveLoader> ril = load_interactive(p_path); Ref<ResourceInteractiveLoader> ril = load_interactive(p_path);
@ -150,9 +151,13 @@ void ResourceFormatLoader::get_dependencies(const String& p_path,List<String> *p
RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_no_cache) { RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_no_cache) {
String local_path = Globals::get_singleton()->localize_path(p_path); String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = Globals::get_singleton()->localize_path(p_path);
local_path=find_complete_path(p_path,p_type_hint); local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",RES()); ERR_FAIL_COND_V(local_path=="",RES());
if (!p_no_cache && ResourceCache::has(local_path)) { if (!p_no_cache && ResourceCache::has(local_path)) {
@ -209,7 +214,11 @@ RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_n
Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p_path) { Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p_path) {
String local_path = Globals::get_singleton()->localize_path(p_path); String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = Globals::get_singleton()->localize_path(p_path);
String extension=p_path.extension(); String extension=p_path.extension();
bool found=false; bool found=false;
@ -283,9 +292,13 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
String local_path = Globals::get_singleton()->localize_path(p_path); String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = Globals::get_singleton()->localize_path(p_path);
local_path=find_complete_path(p_path,p_type_hint); local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>()); ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>());
@ -340,7 +353,13 @@ void ResourceLoader::add_resource_format_loader(ResourceFormatLoader *p_format_l
void ResourceLoader::get_dependencies(const String& p_path,List<String> *p_dependencies) { void ResourceLoader::get_dependencies(const String& p_path,List<String> *p_dependencies) {
String local_path = Globals::get_singleton()->localize_path(p_path);
String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = Globals::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.extension(); String extension=remapped_path.extension();
@ -359,7 +378,11 @@ void ResourceLoader::get_dependencies(const String& p_path,List<String> *p_depen
String ResourceLoader::guess_full_filename(const String &p_path,const String& p_type) { String ResourceLoader::guess_full_filename(const String &p_path,const String& p_type) {
String local_path = Globals::get_singleton()->localize_path(p_path); String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = Globals::get_singleton()->localize_path(p_path);
return find_complete_path(local_path,p_type); return find_complete_path(local_path,p_type);
@ -367,7 +390,12 @@ String ResourceLoader::guess_full_filename(const String &p_path,const String& p_
String ResourceLoader::get_resource_type(const String &p_path) { String ResourceLoader::get_resource_type(const String &p_path) {
String local_path = Globals::get_singleton()->localize_path(p_path); String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = Globals::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.extension(); String extension=remapped_path.extension();

View File

@ -23,6 +23,7 @@ const JUMP_MAX_AIRBORNE_TIME=0.2
const SLIDE_STOP_VELOCITY=1.0 #one pixel per second const SLIDE_STOP_VELOCITY=1.0 #one pixel per second
const SLIDE_STOP_MIN_TRAVEL=1.0 #one pixel const SLIDE_STOP_MIN_TRAVEL=1.0 #one pixel
var velocity = Vector2() var velocity = Vector2()
var on_air_time=100 var on_air_time=100
var jumping=false var jumping=false
@ -94,7 +95,7 @@ func _fixed_process(delta):
#Since this formula will always slide the character around, #Since this formula will always slide the character around,
#a special case must be considered to to stop it from moving #a special case must be considered to to stop it from moving
#if standing on an inclined floor. Conditions are: #if standing on an inclined floor. Conditions are:
# 1) Standin on floor (on_air_time==0) # 1) Standing on floor (on_air_time==0)
# 2) Did not move more than one pixel (get_travel().length() < SLIDE_STOP_MIN_TRAVEL) # 2) Did not move more than one pixel (get_travel().length() < SLIDE_STOP_MIN_TRAVEL)
# 3) Not moving horizontally (abs(velocity.x) < SLIDE_STOP_VELOCITY) # 3) Not moving horizontally (abs(velocity.x) < SLIDE_STOP_VELOCITY)
# 4) Collider is not moving # 4) Collider is not moving
@ -117,9 +118,13 @@ func _fixed_process(delta):
move(floor_velocity*delta) move(floor_velocity*delta)
if (jumping and velocity.y>0): if (jumping and velocity.y>0):
#if falling, no longer jumping
jumping=false jumping=false
if (on_air_time<JUMP_MAX_AIRBORNE_TIME and jump and not prev_jump_pressed and not jumping): if (on_air_time<JUMP_MAX_AIRBORNE_TIME and jump and not prev_jump_pressed and not jumping):
# Jump must also be allowed to happen if the
# character left the floor a little bit ago.
# Makes controls more snappy.
velocity.y=-JUMP_SPEED velocity.y=-JUMP_SPEED
jumping=true jumping=true

View File

@ -154,9 +154,9 @@
<string> "node_count" </string> <string> "node_count" </string>
<int> 67 </int> <int> 67 </int>
<string> "nodes" </string> <string> "nodes" </string>
<int_array len="975"> -1, -1, 1, 0, -1, 2, 2, 0, 3, 1, 0, 0, 0, 5, 4, -1, 25, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 10, 5, 11, 6, 12, 7, 13, 8, 14, 2, 15, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 8, 22, 14, 23, 14, 24, 3, 25, 6, 26, 4, 27, 4, 28, 15, 3, 16, 0, 0, 0, 1, 29, -1, 2, 2, 0, 3, 17, 0, 2, 0, 31, 30, 18, 3, 2, 0, 10, 19, 3, 20, 0, 2, 0, 31, 32, 18, 3, 2, 0, 10, 21, 3, 20, 0, 2, 0, 31, 33, 18, 3, 2, 0, 10, 22, 3, 20, 0, 2, 0, 31, 34, 18, 3, 2, 0, 10, 23, 3, 20, 0, 2, 0, 31, 35, 18, 3, 2, 0, 10, 24, 3, 20, 0, 2, 0, 31, 36, 18, 3, 2, 0, 10, 25, 3, 20, 0, 2, 0, 31, 37, 18, 3, 2, 0, 10, 26, 3, 20, 0, 2, 0, 31, 38, 18, 3, 2, 0, 10, 27, 3, 20, 0, 2, 0, 31, 39, 18, 3, 2, 0, 10, 28, 3, 20, 0, 2, 0, 31, 40, 18, 3, 2, 0, 10, 29, 3, 20, 0, 2, 0, 31, 41, 18, 3, 2, 0, 10, 30, 3, 20, 0, 2, 0, 31, 42, 18, 3, 2, 0, 10, 31, 3, 20, 0, 2, 0, 31, 43, 18, 3, 2, 0, 10, 32, 3, 20, 0, 2, 0, 31, 44, 18, 3, 2, 0, 10, 33, 3, 20, 0, 2, 0, 31, 45, 18, 3, 2, 0, 10, 34, 3, 20, 0, 2, 0, 31, 46, 18, 3, 2, 0, 10, 35, 3, 20, 0, 2, 0, 31, 47, 18, 3, 2, 0, 10, 36, 3, 20, 0, 2, 0, 31, 48, 18, 3, 2, 0, 10, 37, 3, 20, 0, 2, 0, 31, 49, 18, 3, 2, 0, 10, 38, 3, 20, 0, 2, 0, 31, 50, 18, 3, 2, 0, 10, 39, 3, 20, 0, 2, 0, 31, 51, 18, 3, 2, 0, 10, 40, 3, 20, 0, 2, 0, 31, 52, 18, 3, 2, 0, 10, 41, 3, 20, 0, 2, 0, 31, 53, 18, 3, 2, 0, 10, 42, 3, 20, 0, 2, 0, 31, 54, 18, 3, 2, 0, 10, 43, 3, 20, 0, 2, 0, 31, 55, 18, 3, 2, 0, 10, 44, 3, 20, 0, 2, 0, 31, 56, 18, 3, 2, 0, 10, 45, 3, 20, 0, 2, 0, 31, 57, 18, 3, 2, 0, 10, 46, 3, 20, 0, 2, 0, 31, 58, 18, 3, 2, 0, 10, 47, 3, 20, 0, 2, 0, 31, 59, 18, 3, 2, 0, 10, 48, 3, 20, 0, 2, 0, 31, 60, 18, 3, 2, 0, 10, 49, 3, 20, 0, 2, 0, 31, 61, 18, 3, 2, 0, 10, 50, 3, 20, 0, 2, 0, 31, 62, 18, 3, 2, 0, 10, 51, 3, 20, 0, 2, 0, 31, 63, 18, 3, 2, 0, 10, 52, 3, 20, 0, 2, 0, 31, 64, 18, 3, 2, 0, 10, 53, 3, 20, 0, 2, 0, 31, 65, 18, 3, 2, 0, 10, 54, 3, 20, 0, 2, 0, 31, 66, 18, 3, 2, 0, 10, 55, 3, 20, 0, 2, 0, 31, 67, 18, 3, 2, 0, 10, 56, 3, 20, 0, 2, 0, 31, 68, 18, 3, 2, 0, 10, 57, 3, 20, 0, 2, 0, 31, 69, 18, 3, 2, 0, 10, 58, 3, 20, 0, 2, 0, 31, 70, 18, 3, 2, 0, 10, 59, 3, 20, 0, 2, 0, 31, 71, 18, 3, 2, 0, 10, 60, 3, 20, 0, 2, 0, 31, 72, 18, 3, 2, 0, 10, 61, 3, 20, 0, 0, 0, 1, 73, -1, 1, 2, 0, 0, 45, 0, 75, 74, 62, 5, 2, 0, 10, 63, 3, 64, 76, 65, 77, 66, 0, 45, 0, 75, 78, 62, 5, 2, 0, 10, 67, 3, 64, 76, 68, 77, 69, 0, 45, 0, 75, 79, 62, 5, 2, 0, 10, 70, 3, 64, 76, 71, 77, 69, 0, 45, 0, 75, 80, 72, 3, 2, 0, 10, 73, 3, 74, 0, 45, 0, 82, 81, 75, 3, 2, 0, 10, 76, 3, 77, 0, 0, 0, 84, 83, 78, 3, 2, 0, 10, 79, 3, 80, 0, 0, 0, 86, 85, -1, 7, 2, 0, 87, 81, 88, 14, 89, 2, 90, 82, 91, 2, 92, 14, 0, 0, 0, 1, 93, -1, 1, 2, 0, 0, 53, 0, 84, 94, 83, 3, 2, 0, 10, 84, 3, 85, 0, 53, 0, 84, 95, 83, 3, 2, 0, 10, 86, 3, 85, 0, 53, 0, 84, 96, 83, 3, 2, 0, 10, 87, 3, 85, 0, 53, 0, 84, 97, 83, 3, 2, 0, 10, 88, 3, 85, 0, 53, 0, 84, 98, 83, 3, 2, 0, 10, 89, 3, 85, 0, 53, 0, 84, 99, 83, 3, 2, 0, 10, 90, 3, 85, 0, 53, 0, 84, 100, 83, 3, 2, 0, 10, 91, 3, 85, 0, 53, 0, 84, 101, 83, 3, 2, 0, 10, 92, 3, 85, 0, 53, 0, 84, 102, 83, 3, 2, 0, 10, 93, 3, 85, 0, 53, 0, 84, 103, 83, 3, 2, 0, 10, 94, 3, 85, 0, 53, 0, 84, 104, 83, 3, 2, 0, 10, 95, 3, 85, 0, 0, 0, 106, 105, 96, 2, 2, 0, 3, 97, 0, 0, 0, 107, 107, -1, 30, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 108, 98, 109, 99, 110, 100, 111, 101, 112, 0, 113, 0, 114, 0, 115, 0, 116, 2, 117, 2, 118, 13, 119, 3, 120, 6, 121, 102, 122, 3, 123, 103, 124, 6, 125, 14, 126, 14, 127, 104, 128, 8, 129, 8, 130, 2, 131, 14, 132, 105, 0 </int_array> <int_array len="973"> -1, -1, 1, 0, -1, 2, 2, 0, 3, 1, 0, 0, 0, 5, 4, -1, 25, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 10, 5, 11, 6, 12, 7, 13, 8, 14, 2, 15, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 8, 22, 14, 23, 14, 24, 3, 25, 6, 26, 4, 27, 4, 28, 15, 3, 16, 0, 0, 0, 1, 29, -1, 1, 2, 0, 0, 2, 0, 31, 30, 17, 3, 2, 0, 10, 18, 3, 19, 0, 2, 0, 31, 32, 17, 3, 2, 0, 10, 20, 3, 19, 0, 2, 0, 31, 33, 17, 3, 2, 0, 10, 21, 3, 19, 0, 2, 0, 31, 34, 17, 3, 2, 0, 10, 22, 3, 19, 0, 2, 0, 31, 35, 17, 3, 2, 0, 10, 23, 3, 19, 0, 2, 0, 31, 36, 17, 3, 2, 0, 10, 24, 3, 19, 0, 2, 0, 31, 37, 17, 3, 2, 0, 10, 25, 3, 19, 0, 2, 0, 31, 38, 17, 3, 2, 0, 10, 26, 3, 19, 0, 2, 0, 31, 39, 17, 3, 2, 0, 10, 27, 3, 19, 0, 2, 0, 31, 40, 17, 3, 2, 0, 10, 28, 3, 19, 0, 2, 0, 31, 41, 17, 3, 2, 0, 10, 29, 3, 19, 0, 2, 0, 31, 42, 17, 3, 2, 0, 10, 30, 3, 19, 0, 2, 0, 31, 43, 17, 3, 2, 0, 10, 31, 3, 19, 0, 2, 0, 31, 44, 17, 3, 2, 0, 10, 32, 3, 19, 0, 2, 0, 31, 45, 17, 3, 2, 0, 10, 33, 3, 19, 0, 2, 0, 31, 46, 17, 3, 2, 0, 10, 34, 3, 19, 0, 2, 0, 31, 47, 17, 3, 2, 0, 10, 35, 3, 19, 0, 2, 0, 31, 48, 17, 3, 2, 0, 10, 36, 3, 19, 0, 2, 0, 31, 49, 17, 3, 2, 0, 10, 37, 3, 19, 0, 2, 0, 31, 50, 17, 3, 2, 0, 10, 38, 3, 19, 0, 2, 0, 31, 51, 17, 3, 2, 0, 10, 39, 3, 19, 0, 2, 0, 31, 52, 17, 3, 2, 0, 10, 40, 3, 19, 0, 2, 0, 31, 53, 17, 3, 2, 0, 10, 41, 3, 19, 0, 2, 0, 31, 54, 17, 3, 2, 0, 10, 42, 3, 19, 0, 2, 0, 31, 55, 17, 3, 2, 0, 10, 43, 3, 19, 0, 2, 0, 31, 56, 17, 3, 2, 0, 10, 44, 3, 19, 0, 2, 0, 31, 57, 17, 3, 2, 0, 10, 45, 3, 19, 0, 2, 0, 31, 58, 17, 3, 2, 0, 10, 46, 3, 19, 0, 2, 0, 31, 59, 17, 3, 2, 0, 10, 47, 3, 19, 0, 2, 0, 31, 60, 17, 3, 2, 0, 10, 48, 3, 19, 0, 2, 0, 31, 61, 17, 3, 2, 0, 10, 49, 3, 19, 0, 2, 0, 31, 62, 17, 3, 2, 0, 10, 50, 3, 19, 0, 2, 0, 31, 63, 17, 3, 2, 0, 10, 51, 3, 19, 0, 2, 0, 31, 64, 17, 3, 2, 0, 10, 52, 3, 19, 0, 2, 0, 31, 65, 17, 3, 2, 0, 10, 53, 3, 19, 0, 2, 0, 31, 66, 17, 3, 2, 0, 10, 54, 3, 19, 0, 2, 0, 31, 67, 17, 3, 2, 0, 10, 55, 3, 19, 0, 2, 0, 31, 68, 17, 3, 2, 0, 10, 56, 3, 19, 0, 2, 0, 31, 69, 17, 3, 2, 0, 10, 57, 3, 19, 0, 2, 0, 31, 70, 17, 3, 2, 0, 10, 58, 3, 19, 0, 2, 0, 31, 71, 17, 3, 2, 0, 10, 59, 3, 19, 0, 2, 0, 31, 72, 17, 3, 2, 0, 10, 60, 3, 19, 0, 0, 0, 1, 73, -1, 1, 2, 0, 0, 45, 0, 75, 74, 61, 5, 2, 0, 10, 62, 3, 63, 76, 64, 77, 65, 0, 45, 0, 75, 78, 61, 5, 2, 0, 10, 66, 3, 63, 76, 67, 77, 68, 0, 45, 0, 75, 79, 61, 5, 2, 0, 10, 69, 3, 63, 76, 70, 77, 68, 0, 45, 0, 75, 80, 71, 3, 2, 0, 10, 72, 3, 73, 0, 45, 0, 82, 81, 74, 3, 2, 0, 10, 75, 3, 76, 0, 0, 0, 84, 83, 77, 3, 2, 0, 10, 78, 3, 79, 0, 0, 0, 86, 85, -1, 7, 2, 0, 87, 80, 88, 14, 89, 2, 90, 81, 91, 2, 92, 14, 0, 0, 0, 1, 93, -1, 1, 2, 0, 0, 53, 0, 84, 94, 82, 3, 2, 0, 10, 83, 3, 84, 0, 53, 0, 84, 95, 82, 3, 2, 0, 10, 85, 3, 84, 0, 53, 0, 84, 96, 82, 3, 2, 0, 10, 86, 3, 84, 0, 53, 0, 84, 97, 82, 3, 2, 0, 10, 87, 3, 84, 0, 53, 0, 84, 98, 82, 3, 2, 0, 10, 88, 3, 84, 0, 53, 0, 84, 99, 82, 3, 2, 0, 10, 89, 3, 84, 0, 53, 0, 84, 100, 82, 3, 2, 0, 10, 90, 3, 84, 0, 53, 0, 84, 101, 82, 3, 2, 0, 10, 91, 3, 84, 0, 53, 0, 84, 102, 82, 3, 2, 0, 10, 92, 3, 84, 0, 53, 0, 84, 103, 82, 3, 2, 0, 10, 93, 3, 84, 0, 53, 0, 84, 104, 82, 3, 2, 0, 10, 94, 3, 84, 0, 0, 0, 106, 105, 95, 2, 2, 0, 3, 96, 0, 0, 0, 107, 107, -1, 30, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 108, 97, 109, 98, 110, 99, 111, 100, 112, 0, 113, 0, 114, 0, 115, 0, 116, 2, 117, 2, 118, 13, 119, 3, 120, 6, 121, 101, 122, 3, 123, 102, 124, 6, 125, 14, 126, 14, 127, 103, 128, 8, 129, 8, 130, 2, 131, 14, 132, 104, 0 </int_array>
<string> "variants" </string> <string> "variants" </string>
<array len="106" shared="false"> <array len="105" shared="false">
<node_path> "" </node_path> <node_path> "" </node_path>
<dictionary shared="false"> <dictionary shared="false">
<string> "__editor_plugin_screen__" </string> <string> "__editor_plugin_screen__" </string>
@ -283,7 +283,7 @@
<string> "Script" </string> <string> "Script" </string>
<dictionary shared="false"> <dictionary shared="false">
<string> "current" </string> <string> "current" </string>
<int> 2 </int> <int> 0 </int>
<string> "sources" </string> <string> "sources" </string>
<array len="4" shared="false"> <array len="4" shared="false">
<string> "res://moving_platform.gd" </string> <string> "res://moving_platform.gd" </string>
@ -319,12 +319,8 @@
<string> "_edit_lock_" </string> <string> "_edit_lock_" </string>
<bool> True </bool> <bool> True </bool>
</dictionary> </dictionary>
<dictionary shared="false">
<string> "_editor_collapsed" </string>
<bool> True </bool>
</dictionary>
<resource resource_type="PackedScene" path="res://coin.xml"> </resource> <resource resource_type="PackedScene" path="res://coin.xml"> </resource>
<vector2> 672, 1120 </vector2> <vector2> 672, 1179 </vector2>
<dictionary shared="false"> <dictionary shared="false">
<string> "__editor_plugin_screen__" </string> <string> "__editor_plugin_screen__" </string>
<string> "2D" </string> <string> "2D" </string>
@ -435,8 +431,8 @@
<int> 0 </int> <int> 0 </int>
</dictionary> </dictionary>
</dictionary> </dictionary>
<vector2> 704, 1120 </vector2> <vector2> 704, 1179 </vector2>
<vector2> 736, 1120 </vector2> <vector2> 736, 1179 </vector2>
<vector2> 1120, 992 </vector2> <vector2> 1120, 992 </vector2>
<vector2> 1152, 992 </vector2> <vector2> 1152, 992 </vector2>
<vector2> 1184, 992 </vector2> <vector2> 1184, 992 </vector2>

View File

@ -2378,7 +2378,7 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str
String name = p_node->param1; String name = p_node->param1;
Vector3 dv=p_node->param2; Vector3 dv=p_node->param2;
code +="uniform float "+name+"=vec3("+rtos(dv.x)+","+rtos(dv.y)+","+rtos(dv.z)+");\n"; code +="uniform vec3 "+name+"=vec3("+rtos(dv.x)+","+rtos(dv.y)+","+rtos(dv.z)+");\n";
code += OUTNAME(p_node->id,0)+"="+name+";\n"; code += OUTNAME(p_node->id,0)+"="+name+";\n";
}break; }break;
case NODE_RGB_INPUT: { case NODE_RGB_INPUT: {