Files
qad/qglview/loader_3ds.h

78 lines
3.4 KiB
C++

/*
QGLView
Copyright (C) 2020 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOADER_3DS_H
#define LOADER_3DS_H
#include "gltexture_manager.h"
#include "globject.h"
#include <QFileInfo>
#include <QDateTime>
#define LOADER_3DS_CHUNK_MAIN 0x4D4D // [-] сцена
#define LOADER_3DS_CHUNK_COLOR_F 0x0010 // [+] цвет во float
#define LOADER_3DS_CHUNK_COLOR_B 0x0011 // [+] цвет в byte
#define LOADER_3DS_CHUNK_OBJECTS 0x3D3D // [-] всяческие объекты
#define LOADER_3DS_CHUNK_OBJECT 0x4000 // [+] объект
#define LOADER_3DS_CHUNK_MESH 0x4100 // [-] mesh-объект
#define LOADER_3DS_CHUNK_VERTLIST 0x4110 // [+] список вершин
#define LOADER_3DS_CHUNK_FACELIST 0x4120 // [+] список граней
#define LOADER_3DS_CHUNK_FACEMAT 0x4130 // [+] материалы граней
#define LOADER_3DS_CHUNK_MAPLIST 0x4140 // [+] текстурные координаты
#define LOADER_3DS_CHUNK_SMOOTH 0x4150 // [+] группы сглаживания
#define LOADER_3DS_CHUNK_TRMATRIX 0x4160 // [+] матрица перевода
#define LOADER_3DS_CHUNK_LIGHT 0x4600 // [+] источник света
#define LOADER_3DS_CHUNK_SPOTLIGHT 0x4610 // [+]
#define LOADER_3DS_CHUNK_LIGHT_OFF 0x4620 // [+]
#define LOADER_3DS_CHUNK_ATTENUATION_ON 0x4625 // [+]
#define LOADER_3DS_CHUNK_RANGE_START 0x4659 // [+]
#define LOADER_3DS_CHUNK_RANGE_END 0x465A // [+]
#define LOADER_3DS_CHUNK_MULTIPLIER 0x465B // [+]
#define LOADER_3DS_CHUNK_CAMERA 0x4700 // [+] объект-камера
#define LOADER_3DS_CHUNK_MATERIAL 0xAFFF // [-] материал
#define LOADER_3DS_CHUNK_MATERIAL_NAME 0xA000
#define LOADER_3DS_CHUNK_AMBIENT_COLOR 0xA010
#define LOADER_3DS_CHUNK_DIFFUSE_COLOR 0xA020
#define LOADER_3DS_CHUNK_SPECULAR_COLOR 0xA030
#define LOADER_3DS_CHUNK_TEXTURE_MAP 0xA200
#define LOADER_3DS_CHUNK_BUMP_MAP 0xA230
#define LOADER_3DS_CHUNK_REFLECTION_MAP 0xA220
#define LOADER_3DS_CHUNK_MAP_FILENAME 0xA300
#define LOADER_3DS_CHUNK_MAP_PARAMETERS 0xA351
namespace Loader3DS {
#pragma pack(push, 1)
struct Chunk {
ushort id;
uint size;
};
struct Face {
ushort v0;
ushort v1;
ushort v2;
ushort flags;
};
#pragma pack(pop)
void init3DSMesh(GLObjectBase * o, const QVector<uint> & smooth);
Material materialByName(const QVector<Material> & materials, const QString & name);
}
GLObjectBase * loadFrom3DSFile(const QString & filepath, float scale = 1.0);
#endif // LOADER_3DS_H