Add setTexelSize api for simpleuv

master
Jeremy Hu 2019-08-10 23:33:49 +09:30
parent dacff70eaa
commit dc33e2f11c
3 changed files with 9 additions and 3 deletions

View File

@ -57,7 +57,7 @@ void uvUnwrap(const Outcome &outcome,
simpleuv::UvUnwrapper uvUnwrapper;
uvUnwrapper.setMesh(inputMesh);
uvUnwrapper.unwrap();
qDebug() << "Texture size:" << uvUnwrapper.textureSize();
qDebug() << "Texture size:" << uvUnwrapper.getTextureSize();
const std::vector<simpleuv::FaceTextureCoords> &resultFaceUvs = uvUnwrapper.getFaceUvs();
const std::vector<simpleuv::Rect> &resultChartRects = uvUnwrapper.getChartRects();
const std::vector<int> &resultChartSourcePartitions = uvUnwrapper.getChartSourcePartitions();

View File

@ -20,6 +20,11 @@ void UvUnwrapper::setMesh(const Mesh &mesh)
m_mesh = mesh;
}
void UvUnwrapper::setTexelSize(float texelSize)
{
m_texelSizePerUnit = texelSize;
}
const std::vector<FaceTextureCoords> &UvUnwrapper::getFaceUvs() const
{
return m_faceUvs;
@ -577,7 +582,7 @@ void UvUnwrapper::parametrizeSingleGroup(const std::vector<Vertex> &verticies,
m_chartSourcePartitions.push_back(sourcePartition);
}
float UvUnwrapper::textureSize() const
float UvUnwrapper::getTextureSize() const
{
return m_resultTextureSize;
}

View File

@ -12,11 +12,12 @@ class UvUnwrapper
{
public:
void setMesh(const Mesh &mesh);
void setTexelSize(float texelSize);
void unwrap();
const std::vector<FaceTextureCoords> &getFaceUvs() const;
const std::vector<Rect> &getChartRects() const;
const std::vector<int> &getChartSourcePartitions() const;
float textureSize() const;
float getTextureSize() const;
private:
void partition();