aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lightmapviewer/lightmapfile.cpp
blob: 4340b769b8c23b07a65c57d5f826adfa0d757610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "lightmapfile.h"

#include <QFile>
#include <QTextStream>
#include <QtQuick3DRuntimeRender/private/qssglightmapio_p.h>

LightmapFile::LightmapFile(QObject *parent) : QObject { parent } { }

QStringList LightmapFile::dataList() const
{
    return m_dataList;
}

void LightmapFile::loadData()
{
    QSharedPointer<QSSGLightmapLoader> loader = QSSGLightmapLoader::open(m_source.toLocalFile());
    m_dataList = loader ? loader->getKeys() : QStringList();
    emit dataListChanged();
}

QUrl LightmapFile::source() const
{
    return m_source;
}

void LightmapFile::setSource(const QUrl &newSource)
{
    if (m_source == newSource)
        return;
    m_source = newSource;
    emit sourceChanged();
}