Skip to content
Snippets Groups Projects
Select Git revision
  • 744269395b0f781832bcd495f5b0405fe21ab1b4
  • master default protected
  • dev_2022
  • patch-1
  • develop
  • 50-use-ubuntus-libhidapi
  • issue-highLevelDispatch
  • issue-highLevelDesign
  • issue-motorStartBug
  • issue-commandLayerDesign
  • v1.0
  • v0.4-rc.13
  • v0.4-rc.12
  • v0.4-rc.11
  • v0.4-rc.10
  • v0.4-rc.9
  • v0.3-rc.8
  • v0.3-rc.7
  • v0.3-rc.6
  • v0.3-rc.5
  • v0.3-rc.4
  • v0.3-rc.3
  • v0.3-rc.2
  • v0.3-rc.1
  • v0.3-rc
  • v0.2
  • v0.1.1
  • v0.1
28 results

UIWriteSubCodes.m

Blame
    • Tim Stadtmann's avatar
      912bb027
      Merge branch 'feature-display' · 912bb027
      Tim Stadtmann authored
      Implements overriden display-function and adapts comments to MATLAB's
      doc and help function in order to deliver a cleaner interface.
      Also, for some reason, all file-access modes in /source are marked as
      changed.
      912bb027
      History
      Merge branch 'feature-display'
      Tim Stadtmann authored
      Implements overriden display-function and adapts comments to MATLAB's
      doc and help function in order to deliver a cleaner interface.
      Also, for some reason, all file-access modes in /source are marked as
      changed.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    MshFile.h 1.73 KiB
    #pragma once
    #include <fstream>
    #include <vector>
    #include <QMatrix4x4>
    
    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];
    	std::uint32_t size;
    	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
    {
    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;
    
    private:
    	void loadChunks(std::list<ChunkHeader*> &destination, std::streampos start, const std::uint32_t length);
    
    	void analyseMsh2Chunks(std::list<ChunkHeader*> &chunkList);
    
    	void analyseMatdChunks(std::list<ChunkHeader*> &chunkList);
    
    	void analyseModlChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
    	void analyseGeomChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
    	void analyseSegmChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
    	void analyseClthChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
    
    	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;
    };