aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/io_plugins
diff options
context:
space:
mode:
authorJuan Linietsky2016-10-27 11:50:26 -0300
committerJuan Linietsky2016-10-27 11:50:26 -0300
commit53d8f2b1ec1d86b189800b7fe156c464fdf9e380 (patch)
treea86ac6591239fd58193701419750bdfac3d89417 /tools/editor/io_plugins
parentcb34b70df13ad9f7942b0c363edc71cfd417bb21 (diff)
downloadgodot-53d8f2b1ec1d86b189800b7fe156c464fdf9e380.tar.gz
godot-53d8f2b1ec1d86b189800b7fe156c464fdf9e380.tar.zst
godot-53d8f2b1ec1d86b189800b7fe156c464fdf9e380.zip
PBR more or less working, still working on bringing gizmos back
Diffstat (limited to 'tools/editor/io_plugins')
-rw-r--r--tools/editor/io_plugins/editor_import_collada.cpp26
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp30
-rw-r--r--tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp24
3 files changed, 40 insertions, 40 deletions
diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp
index 6b1873d49..e8207c957 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/io_plugins/editor_import_collada.cpp
@@ -377,7 +377,7 @@ Error ColladaImport::_create_material(const String& p_target) {
ERR_FAIL_COND_V(!collada.state.effect_map.has(src_mat.instance_effect),ERR_INVALID_PARAMETER);
Collada::Effect &effect=collada.state.effect_map[src_mat.instance_effect];
- Ref<FixedMaterial> material= memnew( FixedMaterial );
+ Ref<FixedSpatialMaterial> material= memnew( FixedSpatialMaterial );
if (src_mat.name!="")
material->set_name(src_mat.name);
@@ -394,14 +394,14 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
-// material->set_texture(FixedMaterial::PARAM_DIFFUSE,texture);
-// material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
+// material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,texture);
+// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
-// material->set_parameter(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color);
+// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color);
}
// SPECULAR
@@ -414,15 +414,15 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
-// material->set_texture(FixedMaterial::PARAM_SPECULAR,texture);
-// material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1));
+// material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture);
+// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
-// material->set_parameter(FixedMaterial::PARAM_SPECULAR,effect.specular.color);
+// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color);
}
// EMISSION
@@ -435,15 +435,15 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
-// material->set_texture(FixedMaterial::PARAM_EMISSION,texture);
-// material->set_parameter(FixedMaterial::PARAM_EMISSION,Color(1,1,1,1));
+// material->set_texture(FixedSpatialMaterial::PARAM_EMISSION,texture);
+// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1));
}else {
// missing_textures.push_back(texfile.get_file());
}
}
} else {
-// material->set_parameter(FixedMaterial::PARAM_EMISSION,effect.emission.color);
+// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color);
}
// NORMAL
@@ -456,7 +456,7 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
- // material->set_texture(FixedMaterial::PARAM_NORMAL,texture);
+ // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture);
}else {
// missing_textures.push_back(texfile.get_file());
}
@@ -465,7 +465,7 @@ Error ColladaImport::_create_material(const String& p_target) {
}
-// material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess);
+// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess);
// material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided);
// material->set_flag(Material::FLAG_UNSHADED,effect.unshaded);
@@ -1042,7 +1042,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
{
- Ref<FixedMaterial> material;
+ Ref<FixedSpatialMaterial> material;
//find material
Mesh::PrimitiveType primitive=Mesh::PRIMITIVE_TRIANGLES;
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index 9d68807c4..41b245eb7 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -1392,7 +1392,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
for(List<PropertyInfo>::Element *E=pl.front();E;E=E->next()) {
if (E->get().type==Variant::OBJECT || E->get().type==Variant::ARRAY || E->get().type==Variant::DICTIONARY) {
- if (E->get().type==Variant::OBJECT && res->cast_to<FixedMaterial>() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) {
+ if (E->get().type==Variant::OBJECT && res->cast_to<FixedSpatialMaterial>() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) {
Ref<ImageTexture> tex =res->get(E->get().name);
if (tex.is_valid()) {
@@ -1400,14 +1400,14 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
image_map.insert(tex,TEXTURE_ROLE_DIFFUSE);
}
- } else if (E->get().type==Variant::OBJECT && res->cast_to<FixedMaterial>() && (E->get().name=="textures/normal")) {
+ } else if (E->get().type==Variant::OBJECT && res->cast_to<FixedSpatialMaterial>() && (E->get().name=="textures/normal")) {
Ref<ImageTexture> tex =res->get(E->get().name);
if (tex.is_valid()) {
image_map.insert(tex,TEXTURE_ROLE_NORMALMAP);
//if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY)
- // res->cast_to<FixedMaterial>()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true);
+ // res->cast_to<FixedSpatialMaterial>()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true);
}//
@@ -1514,12 +1514,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
Ref<Mesh> m = mi->get_mesh();
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> fm = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = m->surface_get_material(i);
if (fm.is_valid()) {
// fm->set_flag(Material::FLAG_UNSHADED,true);
// fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
// fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
- // fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}
@@ -1537,18 +1537,18 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> mat = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> mat = m->surface_get_material(i);
if (!mat.is_valid())
continue;
if (p_flags&SCENE_FLAG_DETECT_ALPHA && _teststr(mat->get_name(),"alpha")) {
- // mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ // mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
// mat->set_name(_fixstr(mat->get_name(),"alpha"));
}
if (p_flags&SCENE_FLAG_DETECT_VCOLOR && _teststr(mat->get_name(),"vcol")) {
- //mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
+ //mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
//mat->set_name(_fixstr(mat->get_name(),"vcol"));
}
@@ -1623,12 +1623,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
Ref<Mesh> m = mi->get_mesh();
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> fm = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = m->surface_get_material(i);
if (fm.is_valid()) {
// fm->set_flag(Material::FLAG_UNSHADED,true);
// fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
// fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
- // fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}
@@ -1671,12 +1671,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
Ref<Mesh> m = mi->get_mesh();
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> fm = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = m->surface_get_material(i);
if (fm.is_valid()) {
fm->set_flag(Material::FLAG_UNSHADED,true);
fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
fm->set_hint(Material::HINT_NO_DEPTH_DRAW,true);
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}*/
@@ -2044,16 +2044,16 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
for(int i=0;i<mesh->get_surface_count();i++) {
- Ref<FixedMaterial> fm = mesh->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = mesh->surface_get_material(i);
if (fm.is_valid()) {
String name = fm->get_name();
/* if (_teststr(name,"alpha")) {
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
name=_fixstr(name,"alpha");
}
if (_teststr(name,"vcol")) {
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
name=_fixstr(name,"vcol");
}*/
fm->set_name(name);
diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp
index f11718236..a954db829 100644
--- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp
+++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp
@@ -482,29 +482,29 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) {
ERR_CONTINUE(!material.has("id"));
String id = _id(material["id"]);
- Ref<FixedMaterial> mat = memnew( FixedMaterial );
+ Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial );
if (material.has("diffuse")) {
- mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"]));
+ mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"]));
}
if (material.has("specular")) {
- mat->set_parameter(FixedMaterial::PARAM_SPECULAR,_get_color(material["specular"]));
+ mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,_get_color(material["specular"]));
}
if (material.has("emissive")) {
- mat->set_parameter(FixedMaterial::PARAM_EMISSION,_get_color(material["emissive"]));
+ mat->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,_get_color(material["emissive"]));
}
if (material.has("shininess")) {
float exp = material["shininess"];
- mat->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,exp);
+ mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,exp);
}
if (material.has("opacity")) {
- Color c = mat->get_parameter(FixedMaterial::PARAM_DIFFUSE);
+ Color c = mat->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE);
c.a=material["opacity"];
- mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,c);
+ mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,c);
}
@@ -536,15 +536,15 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) {
String type=texture["type"];
if (type=="DIFFUSE")
- mat->set_texture(FixedMaterial::PARAM_DIFFUSE,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,tex);
else if (type=="SPECULAR")
- mat->set_texture(FixedMaterial::PARAM_SPECULAR,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,tex);
else if (type=="SHININESS")
- mat->set_texture(FixedMaterial::PARAM_SPECULAR_EXP,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR_EXP,tex);
else if (type=="NORMAL")
- mat->set_texture(FixedMaterial::PARAM_NORMAL,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_NORMAL,tex);
else if (type=="EMISSIVE")
- mat->set_texture(FixedMaterial::PARAM_EMISSION,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_EMISSION,tex);
}
}