code format

This commit is contained in:
2022-12-14 14:14:44 +03:00
parent 1dfca0aeab
commit cb944b62e4
85 changed files with 4451 additions and 3744 deletions

View File

@@ -1,23 +1,25 @@
/*
QGL Loader QGL
Ivan Pelipenko peri4ko@yandex.ru
QGL Loader QGL
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "loader_qgl.h"
#include "glscene.h"
#include <chunkstream.h>
@@ -37,7 +39,7 @@ Scene * loadFromQGLFile(const QString & filepath) {
return 0;
}
ushort version = 0x1;
f.peek((char*)&version, 2);
f.peek((char *)&version, 2);
if (version != 1) {
qDebug() << "[Loader QGL] Error: \"" + filepath + "\" unsupported version!";
return 0;
@@ -45,7 +47,7 @@ Scene * loadFromQGLFile(const QString & filepath) {
Scene * ret = 0;
s.skipRawData(2);
s >> ret;
//root->buildTransform();
// root->buildTransform();
qDebug() << "[Loader QGL] Loaded" << ret->objectsCount(true) << "objects from" << filepath;
return ret;
}
@@ -53,15 +55,14 @@ Scene * loadFromQGLFile(const QString & filepath) {
bool saveToQGLFile(const QString & filepath, const Scene * scene) {
QFile f(filepath);
if (!f.open(QIODevice::ReadWrite))
return false;
if (!f.open(QIODevice::ReadWrite)) return false;
f.resize(0);
QDataStream s(&f);
s.setVersion(QDataStream::Qt_5_0);
char sign[4] = {'Q', 'G', 'L', 'E'};
char sign[4] = {'Q', 'G', 'L', 'E'};
ushort version = 0x1;
s.writeRawData(sign, 4);
s.writeRawData((char*)&version, 2);
s.writeRawData((char *)&version, 2);
s << scene;
return true;
}