Update part preview image to show the metallic and roughness setting

master
huxingyi 2020-10-18 15:22:15 +09:30
parent 51b7d85c3b
commit 8e952c955a
3 changed files with 11 additions and 5 deletions

View File

@ -784,7 +784,9 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
m_partPreviewMeshes[partId] = new Model(partPreviewVertices, m_partPreviewMeshes[partId] = new Model(partPreviewVertices,
partCache.previewTriangles, partCache.previewTriangles,
partPreviewTriangleVertexNormals, partPreviewTriangleVertexNormals,
partPreviewColor); partPreviewColor,
metalness,
roughness);
} }
delete strokeModifier; delete strokeModifier;

View File

@ -89,7 +89,9 @@ Model::Model(ShaderVertex *triangleVertices, int vertexNum, ShaderVertex *edgeVe
Model::Model(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &triangles, Model::Model(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &triangles,
const std::vector<std::vector<QVector3D>> &triangleVertexNormals, const std::vector<std::vector<QVector3D>> &triangleVertexNormals,
const QColor &color) const QColor &color,
float metalness,
float roughness)
{ {
m_triangleVertexCount = triangles.size() * 3; m_triangleVertexCount = triangles.size() * 3;
m_triangleVertices = new ShaderVertex[m_triangleVertexCount]; m_triangleVertices = new ShaderVertex[m_triangleVertexCount];
@ -112,8 +114,8 @@ Model::Model(const std::vector<QVector3D> &vertices, const std::vector<std::vect
dest->normX = srcNormal->x(); dest->normX = srcNormal->x();
dest->normY = srcNormal->y(); dest->normY = srcNormal->y();
dest->normZ = srcNormal->z(); dest->normZ = srcNormal->z();
dest->metalness = m_defaultMetalness; dest->metalness = metalness;
dest->roughness = m_defaultRoughness; dest->roughness = roughness;
dest->tangentX = 0; dest->tangentX = 0;
dest->tangentY = 0; dest->tangentY = 0;
dest->tangentZ = 0; dest->tangentZ = 0;

View File

@ -20,7 +20,9 @@ class Model
public: public:
Model(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &triangles, Model(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &triangles,
const std::vector<std::vector<QVector3D>> &triangleVertexNormals, const std::vector<std::vector<QVector3D>> &triangleVertexNormals,
const QColor &color=Qt::white); const QColor &color=Qt::white,
float metalness=0.0,
float roughness=0.0);
Model(Outcome &outcome); Model(Outcome &outcome);
Model(ShaderVertex *triangleVertices, int vertexNum, ShaderVertex *edgeVertices=nullptr, int edgeVertexCount=0); Model(ShaderVertex *triangleVertices, int vertexNum, ShaderVertex *edgeVertices=nullptr, int edgeVertexCount=0);
Model(const Model &mesh); Model(const Model &mesh);