added open file ability from the old project to Qt,
texture seams not to open, texture display does not work
This commit is contained in:
@@ -1,22 +1,6 @@
|
||||
#pragma once
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <QMatrix4x4>
|
||||
#include "FileInterface.h"
|
||||
|
||||
enum ModelTyp {
|
||||
null,
|
||||
dynamicMesh,
|
||||
cloth,
|
||||
bone,
|
||||
staticMesh,
|
||||
shadowMesh = 6
|
||||
};
|
||||
|
||||
struct BoundingBox {
|
||||
float quaternion[4];
|
||||
float center[3];
|
||||
float extents[3];
|
||||
};
|
||||
|
||||
struct ChunkHeader {
|
||||
char name[5];
|
||||
@@ -24,36 +8,16 @@ struct ChunkHeader {
|
||||
std::streampos position;
|
||||
};
|
||||
|
||||
struct Segment {
|
||||
std::uint32_t textureIndex = 0;
|
||||
float* vertex = nullptr;
|
||||
float* uv = nullptr;
|
||||
std::vector<std::vector<std::uint32_t>> polyIndices; // indices into vertex array
|
||||
};
|
||||
|
||||
struct Model {
|
||||
std::string name = "";
|
||||
std::string parent = "";
|
||||
ModelTyp type = null;
|
||||
std::int32_t renderFlags = -1;
|
||||
QMatrix4x4 m4x4Translation;
|
||||
std::vector<Segment*> segmList;
|
||||
};
|
||||
|
||||
|
||||
class MshFile
|
||||
class MshFile : public FileInterface
|
||||
{
|
||||
public:
|
||||
MshFile(const char* path);
|
||||
~MshFile();
|
||||
|
||||
private:
|
||||
std::vector<Model*>* m_vModels;
|
||||
std::fstream m_fsMesh;
|
||||
std::vector<std::string> m_vTextureNames;
|
||||
BoundingBox m_sceneBbox;
|
||||
virtual void import() override final;
|
||||
|
||||
private:
|
||||
void loadChunks(std::list<ChunkHeader*> &destination, std::streampos start, const std::uint32_t length);
|
||||
|
||||
void analyseMsh2Chunks(std::list<ChunkHeader*> &chunkList);
|
||||
@@ -67,9 +31,4 @@ private:
|
||||
|
||||
void readVertex(Segment* dataDestination, std::streampos position);
|
||||
void readUV(Segment* dataDestination, std::streampos position);
|
||||
|
||||
public:
|
||||
std::vector<Model*>* getModels() const;
|
||||
std::vector<std::string> getTextureNames() const;
|
||||
BoundingBox getBoundingBox() const;
|
||||
};
|
||||
Reference in New Issue
Block a user