still trying to fix the problem
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOPenGLVertexArrayObject>
|
||||
#include <QOpenGlShaderProgram>
|
||||
#include <QOpenGlTexture>
|
||||
#include <QImage>
|
||||
#include "..\Header\Texture.h"
|
||||
#include "..\Header\FileInterface.h"
|
||||
|
||||
struct Vertex {
|
||||
@@ -13,6 +12,13 @@ struct Vertex {
|
||||
GLfloat uv[2];
|
||||
};
|
||||
|
||||
struct TextureData {
|
||||
bool alpha;
|
||||
std::uint32_t width;
|
||||
std::uint32_t height;
|
||||
std::vector<std::uint8_t>* data;
|
||||
};
|
||||
|
||||
class OpenGlViewer : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -24,14 +30,14 @@ public:
|
||||
private:
|
||||
// OpenGL ======================================
|
||||
int m_uniformMVP;
|
||||
QOpenGLTexture* m_oglTexture;
|
||||
QOpenGLBuffer m_vertexBuffer;
|
||||
GLuint m_oglTexture;
|
||||
GLuint m_vertexBuffer;
|
||||
QOpenGLVertexArrayObject m_vertexArray;
|
||||
QOpenGLShaderProgram* m_program = nullptr;
|
||||
|
||||
// Data ========================================
|
||||
std::vector<Model*>* m_vModels = nullptr;
|
||||
std::vector<QImage*>* m_vTextures = nullptr;
|
||||
std::vector<TextureData*>* m_vTextures = nullptr;
|
||||
BoundingBox m_sceneBoundings;
|
||||
|
||||
// Transformation ==============================
|
||||
@@ -57,5 +63,5 @@ private:
|
||||
void deleteData();
|
||||
|
||||
public:
|
||||
void setData(std::vector<Model*>* models, std::vector<QImage*>* textures, BoundingBox bbox);
|
||||
void setData(std::vector<Model*>* models, std::vector<TextureData*>* textures, BoundingBox bbox);
|
||||
};
|
||||
|
22
MeshViewerQt/Header/Texture.h
Normal file
22
MeshViewerQt/Header/Texture.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
|
||||
class TextureTGA
|
||||
{
|
||||
public:
|
||||
TextureTGA(const char* filePath);
|
||||
~TextureTGA();
|
||||
|
||||
private:
|
||||
std::vector<std::uint8_t>* vui8Pixels;
|
||||
std::uint32_t ui32BpP;
|
||||
std::uint32_t ui32Width;
|
||||
std::uint32_t ui32Height;
|
||||
|
||||
public:
|
||||
std::vector<std::uint8_t>* getData() const;
|
||||
bool hasAlpha() const;
|
||||
std::uint32_t getWidth() const;
|
||||
std::uint32_t getHeight() const;
|
||||
};
|
Reference in New Issue
Block a user