summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-04-06 23:36:37 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-04-06 23:49:27 -0300
commit74808ac4d9176180dc7ecace99723edab8a73e0e (patch)
tree065e903073bbdebe864bb6322ca0abc2fca108bb /editor/import
parent25d09b92be0f5d86cdee6eada80823cdcc2d42bc (diff)
New particle system, mostly working, some small features missing.
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/editor_import_collada.cpp34
-rw-r--r--editor/import/resource_importer_scene.cpp34
2 files changed, 35 insertions, 33 deletions
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 93614fb511..95baacb9e7 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -364,7 +364,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<FixedSpatialMaterial> material = memnew(FixedSpatialMaterial);
+ Ref<SpatialMaterial> material = memnew(SpatialMaterial);
if (src_mat.name != "")
material->set_name(src_mat.name);
@@ -381,15 +381,15 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO, texture);
+ material->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
material->set_albedo(Color(1, 1, 1, 1));
- //material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
+ //material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
- //material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color);
+ //material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color);
}
// SPECULAR
@@ -401,11 +401,11 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_texture(FixedSpatialMaterial::TEXTURE_SPECULAR, texture);
+ material->set_texture(SpatialMaterial::TEXTURE_SPECULAR, texture);
material->set_specular(Color(1, 1, 1, 1));
- //material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture);
- //material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1));
+ //material->set_texture(SpatialMaterial::PARAM_SPECULAR,texture);
+ //material->set_parameter(SpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
@@ -424,18 +424,18 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_feature(FixedSpatialMaterial::FEATURE_EMISSION, true);
- material->set_texture(FixedSpatialMaterial::TEXTURE_EMISSION, texture);
+ material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
+ material->set_texture(SpatialMaterial::TEXTURE_EMISSION, texture);
material->set_emission(Color(1, 1, 1, 1));
- //material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1));
+ //material->set_parameter(SpatialMaterial::PARAM_EMISSION,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
if (effect.emission.color != Color()) {
- material->set_feature(FixedSpatialMaterial::FEATURE_EMISSION, true);
+ material->set_feature(SpatialMaterial::FEATURE_EMISSION, true);
material->set_emission(effect.emission.color);
}
}
@@ -449,11 +449,11 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
- material->set_feature(FixedSpatialMaterial::FEATURE_NORMAL_MAPPING, true);
- material->set_texture(FixedSpatialMaterial::TEXTURE_NORMAL, texture);
+ material->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
+ material->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
//material->set_emission(Color(1,1,1,1));
- //material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture);
+ //material->set_texture(SpatialMaterial::PARAM_NORMAL,texture);
} else {
//missing_textures.push_back(texfile.get_file());
}
@@ -464,9 +464,9 @@ Error ColladaImport::_create_material(const String &p_target) {
material->set_roughness(roughness);
if (effect.double_sided) {
- material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED);
+ material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
}
- material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, effect.unshaded);
+ material->set_flag(SpatialMaterial::FLAG_UNSHADED, effect.unshaded);
material_cache[p_target] = material;
return OK;
@@ -1000,7 +1000,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<Mesh> &p_mesh, c
{
- Ref<FixedSpatialMaterial> material;
+ Ref<SpatialMaterial> material;
//find material
Mesh::PrimitiveType primitive = Mesh::PRIMITIVE_TRIANGLES;
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 8a78376f13..3aa412bd5c 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -157,7 +157,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
memdelete(p_node);
return NULL;
}
-
+#if 0
if (p_node->cast_to<MeshInstance>()) {
MeshInstance *mi = p_node->cast_to<MeshInstance>();
@@ -177,18 +177,18 @@ Node *ResourceImporterScene::_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<FixedSpatialMaterial> fm = m->surface_get_material(i);
+ Ref<SpatialMaterial> 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(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
+ //fm->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}
}
}
-
+#endif
if (p_node->cast_to<MeshInstance>()) {
MeshInstance *mi = p_node->cast_to<MeshInstance>();
@@ -199,19 +199,19 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
for (int i = 0; i < m->get_surface_count(); i++) {
- Ref<FixedSpatialMaterial> mat = m->surface_get_material(i);
+ Ref<SpatialMaterial> mat = m->surface_get_material(i);
if (!mat.is_valid())
continue;
if (_teststr(mat->get_name(), "alpha")) {
- mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true);
+ mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
mat->set_name(_fixstr(mat->get_name(), "alpha"));
}
if (_teststr(mat->get_name(), "vcol")) {
- mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
mat->set_name(_fixstr(mat->get_name(), "vcol"));
}
}
@@ -242,7 +242,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
}
}
}
-
+#if 0
if (p_node->cast_to<MeshInstance>()) {
MeshInstance *mi = p_node->cast_to<MeshInstance>();
@@ -277,12 +277,12 @@ Node *ResourceImporterScene::_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<FixedSpatialMaterial> fm = m->surface_get_material(i);
+ Ref<SpatialMaterial> 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(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
+ //fm->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}
@@ -290,6 +290,8 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
}
}
}
+
+#endif
#if 0
if (p_flags&SCENE_FLAG_CREATE_LODS && p_node->cast_to<MeshInstance>()) {
@@ -325,12 +327,12 @@ Node *ResourceImporterScene::_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<FixedSpatialMaterial> fm = m->surface_get_material(i);
+ Ref<SpatialMaterial> 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(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
+ fm->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}*/
@@ -687,16 +689,16 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
for (int i = 0; i < mesh->get_surface_count(); i++) {
- Ref<FixedSpatialMaterial> fm = mesh->surface_get_material(i);
+ Ref<SpatialMaterial> fm = mesh->surface_get_material(i);
if (fm.is_valid()) {
String name = fm->get_name();
/* if (_teststr(name,"alpha")) {
- fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
+ fm->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true);
name=_fixstr(name,"alpha");
}
if (_teststr(name,"vcol")) {
- fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
+ fm->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
name=_fixstr(name,"vcol");
}*/
fm->set_name(name);