SceneItem::SceneItem( EntityEditorContext& editor_context, Scene& scene) : BaseGroupItem(editor_context, g_class_uid, "Scene", scene) { set_allow_deletion(false); set_allow_edition(false); QFont font; font.setBold(true); setFont(0, font); int child_index = 0; insertChild( child_index++, m_camera_collection_item = new MultiModelCollectionItem<Camera, Scene, SceneItem>( editor_context, new_guid(), EntityTraits<Camera>::get_human_readable_collection_type_name(), scene, this)); m_camera_collection_item->add_items(scene.cameras()); insertChild( child_index++, m_environment_item = new EnvironmentItem( editor_context, scene.get_environment(), scene, this)); m_environment_item->set_allow_deletion(false); m_environment_item->set_fixed_position(true); editor_context.m_item_registry.insert(*scene.get_environment(), m_environment_item); insertChild( child_index++, m_environment_edf_collection_item = new MultiModelCollectionItem<EnvironmentEDF, Scene, SceneItem>( editor_context, new_guid(), EntityTraits<EnvironmentEDF>::get_human_readable_collection_type_name(), scene, this)); m_environment_edf_collection_item->add_items(scene.environment_edfs()); insertChild( child_index++, m_environment_shader_collection_item = new MultiModelCollectionItem<EnvironmentShader, Scene, SceneItem>( editor_context, new_guid(), EntityTraits<EnvironmentShader>::get_human_readable_collection_type_name(), scene, this)); m_environment_shader_collection_item->add_items(scene.environment_shaders()); }
SceneItem::SceneItem( Scene& scene, ProjectBuilder& project_builder, ParamArray& settings) : BaseGroupItem(g_class_uid, "Scene", scene, project_builder, settings) { set_allow_deletion(false); set_allow_edition(false); insertChild( 0, m_camera_item = new CameraItem( scene.get_camera(), scene, project_builder)); m_camera_item->set_allow_deletion(false); m_camera_item->set_fixed_position(true); insertChild( 1, m_environment_item = new EnvironmentItem( scene.get_environment(), scene, project_builder)); m_environment_item->set_allow_deletion(false); m_environment_item->set_fixed_position(true); insertChild( 2, m_environment_edf_collection_item = new MultiModelCollectionItem<EnvironmentEDF, Scene, SceneItem>( new_guid(), EntityTraits<EnvironmentEDF>::get_human_readable_collection_type_name(), scene, this, project_builder)); m_environment_edf_collection_item->add_items(scene.environment_edfs()); insertChild( 3, m_environment_shader_collection_item = new MultiModelCollectionItem<EnvironmentShader, Scene, SceneItem>( new_guid(), EntityTraits<EnvironmentShader>::get_human_readable_collection_type_name(), scene, this, project_builder)); m_environment_shader_collection_item->add_items(scene.environment_shaders()); }
ProjectItem::ProjectItem( ProjectBuilder& project_builder, ParamArray& settings) : ItemBase(g_project_class_uid, "Project") { set_allow_deletion(false); set_allow_edition(false); Project& project = project_builder.get_project(); m_scene_item = new SceneItem(*project.get_scene(), project_builder, settings); addChild(m_scene_item); ItemBase* rules_item = new ItemBase(g_rules_class_uid, "Rules"); rules_item->set_allow_deletion(false); rules_item->set_allow_edition(false); addChild(rules_item); m_render_layer_collection_item = new MultiModelCollectionItem<RenderLayerRule, Project, ProjectItem>( new_guid(), EntityTraits<RenderLayerRule>::get_human_readable_collection_type_name(), project, this, project_builder); m_render_layer_collection_item->add_items(project.render_layer_rules()); rules_item->addChild(m_render_layer_collection_item); m_output_item = new OutputItem(project, project_builder); addChild(m_output_item); }
void BaseGroupItem::add_items(BaseGroup& base_group) { addChild( m_color_collection_item = new ColorCollectionItem( m_editor_context, new_guid(), EntityTraits<ColorEntity>::get_human_readable_collection_type_name(), base_group, this)); m_color_collection_item->add_items(base_group.colors()); addChild( m_texture_collection_item = new TextureCollectionItem( m_editor_context, base_group.textures(), base_group, this)); addChild( m_texture_instance_collection_item = new TextureInstanceCollectionItem( m_editor_context, new_guid(), EntityTraits<TextureInstance>::get_human_readable_collection_type_name(), base_group)); m_texture_instance_collection_item->add_items(base_group.texture_instances()); addChild( m_assembly_collection_item = new AssemblyCollectionItem( m_editor_context, base_group.assemblies(), base_group, this)); addChild( m_assembly_instance_collection_item = new AssemblyInstanceCollectionItem( m_editor_context, new_guid(), EntityTraits<AssemblyInstance>::get_human_readable_collection_type_name(), base_group)); m_assembly_instance_collection_item->add_items(base_group.assembly_instances()); }
AssemblyItem::AssemblyItem( Assembly& assembly, BaseGroup& parent, BaseGroupItem* parent_item, ProjectBuilder& project_builder, ParamArray& settings) : BaseGroupItem(g_class_uid, assembly, project_builder, settings) , m_assembly(assembly) , m_parent(parent) , m_parent_item(parent_item) , m_project_builder(project_builder) { set_title(QString::fromAscii(assembly.get_name())); set_allow_edition(false); insertChild( 3, m_bsdf_collection_item = add_multi_model_collection_item<BSDF>(assembly.bsdfs())); insertChild( 4, m_edf_collection_item = add_multi_model_collection_item<EDF>(assembly.edfs())); insertChild( 5, m_surface_shader_collection_item = add_multi_model_collection_item<SurfaceShader>(assembly.surface_shaders())); insertChild( 6, m_material_collection_item = add_multi_model_collection_item<Material>(assembly.materials())); insertChild( 7, m_light_collection_item = add_multi_model_collection_item<Light>(assembly.lights())); insertChild( 8, m_object_collection_item = new ObjectCollectionItem( assembly.objects(), assembly, this, project_builder, settings)); insertChild( 9, m_object_instance_collection_item = new ObjectInstanceCollectionItem( new_guid(), EntityTraits<ObjectInstance>::get_human_readable_collection_type_name(), assembly, project_builder)); m_object_instance_collection_item->add_items(assembly.object_instances()); }
CollectionItem<Entity, Assembly, AssemblyItem>* AssemblyItem::add_multi_model_collection_item(EntityContainer& entities) { CollectionItem<Entity, Assembly, AssemblyItem>* item = new MultiModelCollectionItem<Entity, Assembly, AssemblyItem>( m_editor_context, new_guid(), EntityTraits<Entity>::get_human_readable_collection_type_name(), m_assembly, this); item->add_items(entities); return item; }
CollectionItem<Entity, Assembly, AssemblyItem>* AssemblyItem::add_single_model_collection_item(EntityContainer& entities) { CollectionItem<Entity, Assembly, AssemblyItem>* item = new SingleModelCollectionItem<Entity, Assembly, AssemblyItem>( new_guid(), EntityTraits<Entity>::get_human_readable_collection_type_name(), m_assembly, this, m_project_builder); item->add_items(entities); return item; }
CollectionItem<Entity, Assembly>* add_multi_model_collection_item(EntityContainer& entities) { CollectionItem<Entity, Assembly>* item = new MultiModelCollectionItem<Entity, Assembly>( new_guid(), EntityTraits<Entity>::get_human_readable_collection_type_name(), *m_assembly, m_project_builder); item->add_items(entities); m_assembly_item->addChild(item); return item; }
CollectionItem<Entity, Scene>* add_multi_model_collection_item( Scene& scene, EntityContainer& entities, ProjectBuilder& project_builder) { CollectionItem<Entity, Scene>* item = new MultiModelCollectionItem<Entity, Scene>( new_guid(), EntityTraits<Entity>::get_human_readable_collection_type_name(), scene, project_builder); item->add_items(entities); m_tree_widget->addTopLevelItem(item); return item; }
RegionTree::RegionTree(const Arguments& arguments) : m_assembly_uid(arguments.m_assembly_uid) { // Build the intermediate representation of the tree. IntermRegionTree interm_tree(arguments); // Copy tree bounding box. m_bbox = interm_tree.m_bbox; // Copy tree nodes. m_nodes = interm_tree.m_nodes; // Create final tree leaves. const size_t leaf_count = interm_tree.m_leaves.size(); for (size_t i = 0; i < leaf_count; ++i) { // Fetch the intermediate representation of this leaf. const IntermRegionLeaf* interm_leaf = interm_tree.m_leaves[i]; // Get a new unique ID for this triangle tree. const UniqueID triangle_tree_uid = new_guid(); // Create the triangle tree factory. auto_ptr<ILazyFactory<TriangleTree> > triangle_tree_factory( new TriangleTreeFactory( TriangleTree::Arguments( arguments.m_scene, triangle_tree_uid, interm_leaf->m_extent, interm_leaf->m_assembly, interm_leaf->m_regions))); // Create and store the triangle tree. m_triangle_trees.insert( make_pair(triangle_tree_uid, new Lazy<TriangleTree>(triangle_tree_factory))); // Create and store the leaf. m_leaves.push_back(new RegionLeaf(*this, triangle_tree_uid)); } }
AssemblyItem::AssemblyItem( EntityEditorContext& editor_context, Assembly& assembly, BaseGroup& parent, BaseGroupItem* parent_item) : BaseGroupItem(editor_context, g_class_uid, assembly) , m_assembly(assembly) , m_assembly_uid(assembly.get_uid()) , m_parent(parent) , m_parent_item(parent_item) { set_title(QString::fromAscii(assembly.get_name())); set_allow_edition(false); insertChild( 3, m_bsdf_collection_item = add_multi_model_collection_item<BSDF>(assembly.bsdfs())); insertChild( 4, m_bssrdf_collection_item = add_multi_model_collection_item<BSSRDF>(assembly.bssrdfs())); insertChild( 5, m_edf_collection_item = add_multi_model_collection_item<EDF>(assembly.edfs())); insertChild( 6, m_surface_shader_collection_item = add_multi_model_collection_item<SurfaceShader>(assembly.surface_shaders())); insertChild( 7, m_material_collection_item = new MaterialCollectionItem( m_editor_context, assembly.materials(), assembly, this)); insertChild( 8, m_light_collection_item = add_multi_model_collection_item<Light>(assembly.lights())); insertChild( 9, m_object_collection_item = new ObjectCollectionItem( m_editor_context, assembly.objects(), assembly, this)); insertChild( 10, m_object_instance_collection_item = new ObjectInstanceCollectionItem( m_editor_context, new_guid(), EntityTraits<ObjectInstance>::get_human_readable_collection_type_name(), assembly)); m_object_instance_collection_item->add_items(assembly.object_instances()); insertChild( 11, m_volume_collection_item = add_multi_model_collection_item<Volume>(assembly.volumes())); m_editor_context.m_item_registry.insert(m_assembly, this); }