1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Light Baker!

-=-=-=-=-=-=

-Support for lightmap baker, have fun figuring out how it works before tutorial is published.
This commit is contained in:
Juan Linietsky
2014-06-11 10:41:03 -03:00
parent 6f0b4678e2
commit 9b8696d3dd
61 changed files with 4252 additions and 1430 deletions

View File

@@ -31,6 +31,7 @@
#include "global_constants.h"
#include "gd_compiler.h"
#include "os/file_access.h"
#include "io/file_access_encrypted.h"
/* TODO:
@@ -1591,7 +1592,28 @@ void GDScript::_bind_methods() {
Error GDScript::load_byte_code(const String& p_path) {
Vector<uint8_t> bytecode = FileAccess::get_file_as_array(p_path);
Vector<uint8_t> bytecode;
if (p_path.ends_with("gde")) {
FileAccess *fa = FileAccess::open(p_path,FileAccess::READ);
ERR_FAIL_COND_V(!fa,ERR_CANT_OPEN);
FileAccessEncrypted *fae = memnew( FileAccessEncrypted );
ERR_FAIL_COND_V(!fae,ERR_CANT_OPEN);
Vector<uint8_t> key;
key.resize(32);
for(int i=0;i<key.size();i++) {
key[i]=script_encryption_key[i];
}
Error err = fae->open_and_parse(fa,key,FileAccessEncrypted::MODE_READ);
ERR_FAIL_COND_V(err,err);
bytecode.resize(fae->get_len());
fae->get_buffer(bytecode.ptr(),bytecode.size());
memdelete(fae);
} else {
bytecode = FileAccess::get_file_as_array(p_path);
}
ERR_FAIL_COND_V(bytecode.size()==0,ERR_PARSE_ERROR);
path=p_path;
@@ -2225,7 +2247,7 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path,const String& p_orig
Ref<GDScript> scriptres(script);
if (p_path.ends_with(".gdc")) {
if (p_path.ends_with(".gde") || p_path.ends_with(".gdc")) {
script->set_script_path(p_original_path); // script needs this.
script->set_path(p_original_path);
@@ -2258,6 +2280,7 @@ void ResourceFormatLoaderGDScript::get_recognized_extensions(List<String> *p_ext
p_extensions->push_back("gd");
p_extensions->push_back("gdc");
p_extensions->push_back("gde");
}
bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const {
@@ -2268,7 +2291,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String& p_type) const {
String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const {
String el = p_path.extension().to_lower();
if (el=="gd" || el=="gdc")
if (el=="gd" || el=="gdc" || el=="gde")
return "GDScript";
return "";
}