Esempio n. 1
0
void Edge::set_style(Edge_Style st)
{
    m_style = st;
    m_style.enabled_style |= Edge_Style::EDGE_TYPE;
    m_style.edge_type = st.edge_type ? st.edge_type :
                                       resource_manager().default_edge_type();
}
Esempio n. 2
0
void Dock_Grid::on_check_enable_toggled(bool arg1)
{
    if ( target )
    {
        resource_manager().settings.set_grid_enabled(arg1);
    }
}
Esempio n. 3
0
void Mesh::enable_debug(bool value) {
    if(value) {
        if(normal_debug_mesh_) return;

        //This maintains a lock on the material
        MaterialID mid = resource_manager().new_material();

        resource_manager().window->loader_for(
            "material_loader",
            Material::BuiltIns::DIFFUSE_ONLY
        )->into(resource_manager().material(mid));

        normal_debug_mesh_ = new_submesh_with_material("__debug__", mid, MESH_ARRANGEMENT_LINES, VERTEX_SHARING_MODE_INDEPENDENT);

        //Go through the submeshes, and for each index draw a normal line
        each([=](const std::string& name, SubMesh* mesh) {
            for(uint16_t idx: mesh->index_data->all()) {
                Vec3 pos1 = mesh->vertex_data->position_at<Vec3>(idx);

                Vec3 n;
                mesh->vertex_data->normal_at(idx, n);
                kmVec3Scale(&n, &n, 10.0);

                kmVec3 pos2;
                kmVec3Add(&pos2, &pos1, &n);

                normal_debug_mesh_->vertex_data->position(pos1);
                normal_debug_mesh_->vertex_data->diffuse(smlt::Colour::RED);
                int16_t next_index = normal_debug_mesh_->vertex_data->move_next();
                normal_debug_mesh_->index_data->index(next_index - 1);

                normal_debug_mesh_->vertex_data->position(pos2);
                normal_debug_mesh_->vertex_data->diffuse(smlt::Colour::RED);
                next_index = normal_debug_mesh_->vertex_data->move_next();
                normal_debug_mesh_->index_data->index(next_index - 1);
            }
        });

        normal_debug_mesh_->vertex_data->done();
        normal_debug_mesh_->index_data->done();
    } else {
        if(normal_debug_mesh_) {
            delete_submesh(normal_debug_mesh_->name());
            normal_debug_mesh_ = nullptr;
        }
    }
}
Esempio n. 4
0
void Dock_Grid::on_combo_shape_currentIndexChanged(int index)
{
    if ( target )
    {
        target->set_shape(Snapping_Grid::Grid_Shape(index));
        resource_manager().settings.set_grid_shape(target->shape());
    }
}
Esempio n. 5
0
void Mesh::prepare_buffers() {
    if(shared_vertex_buffer_dirty_) {
        sync_buffer<VertexData, Renderer>(
            &shared_vertex_buffer_, shared_data_,
            resource_manager().window->renderer.get(),
            HARDWARE_BUFFER_VERTEX_ATTRIBUTES
        );
        shared_vertex_buffer_dirty_ = false;
    }
}
Esempio n. 6
0
void Script_Node_Style::set_cusp_shape(QString name)
{
    Node_Style before = wrapped;
    if ( name.isEmpty() )
        wrapped.enabled_style &= ~Node_Style::CUSP_SHAPE;
    else
    {
        wrapped.enabled_style |= Node_Style::CUSP_SHAPE;
        wrapped.cusp_shape = resource_manager().cusp_shape_from_machine_name(name);
    }
    emit changed(before,wrapped);
}
Esempio n. 7
0
Edge::Edge(Node *v1, Node *v2, Edge_Type *type) :
    v1(v1), v2(v2),
    available_handles(TOP_LEFT|TOP_RIGHT|BOTTOM_LEFT|BOTTOM_RIGHT),
    m_graph(nullptr)
{
    attach();
    setZValue(1);
    setFlag(QGraphicsItem::ItemIsSelectable);

    m_style.enabled_style |= Edge_Style::EDGE_TYPE;
    m_style.edge_type = type ? type : resource_manager().default_edge_type();
}
Esempio n. 8
0
SubMesh* Mesh::new_submesh(
    const std::string& name,
    MeshArrangement arrangement,
    VertexSharingMode vertex_sharing,
    VertexSpecification vertex_specification) {

    return new_submesh_with_material(
        name,
        resource_manager().clone_default_material(),        
        arrangement, vertex_sharing,
        vertex_specification
    );
}