void FormMain::on_actionTextureMipmap_toggled(bool b)
{
- SyncTexConfigToData();
+ m_Scene.m_TexConfig.m_SampleMode = gl::TexSampleMode::Mipmap;
updateView_All();
}
dbmap.AddBinder(new MenuBinder( ui.actionCursorToDepth , &cursor.CursorDepth ));
dbmap.AddBinder(new MenuBinder( ui.actionCursorCoord , &cursor.ShowCoord ));
dbmap.AddBinder(new MenuBinder( ui.actionCheckBaryCoord , &cursor.CheckBaryCoord ));
- dbmap.AddBinder(new MenuBinder( ui.actionSelectCloseMat , &cursor.SelCloseVert ));
+ dbmap.AddBinder(new MenuBinder( ui.actionSelectCloseMat , &cursor.SelCloseMat ));
dbmap.AddBinder(new MenuBinder( ui.actionCursorAxis , &cursor.ShowAxis ));
dbmap.AddBinder(new MenuBinder( ui.actionMeasure , &cursor.ShowMeasure ));
dbmap.AddBinder(new MenuBinder( ui.actionMeasureLen , &cursor.ShowMeasureLen ));
if (IsSupportedTextureExt(path))
{
- OpenFixTextureFile(path);
+ DropTextureFile(path, e->pos());
continue;
}
return false;
}
-//! \83I\83u\83W\83F\83N\83g\82Ì\83}\83e\83\8a\83A\83\8b\82É\90Ý\92è\82³\82ê\82½\82à\82Ì\82Æ\82Í\95Ê\82Ì\83e\83N\83X\83`\83\83\82ð\8ew\92è\82·\82é.
-void FormMain::OpenFixTextureFile(const QString& path)
+//! \83I\83u\83W\83F\83N\83g\82É\89æ\91\9c\82ð\83h\83\8d\83b\83v\82³\82ê\82½\8fê\8d\87\82Í\82»\82Ì\83}\83e\83\8a\83A\83\8b\82Ì\83J\83\89\81[\83e\83N\83X\83`\83\83\82ð\83Z\83b\83g
+//! \89½\82à\96³\82¢\8fê\8f\8a\82É\83h\83\8d\83b\83v\82³\82ê\82é\82Æ\83f\83t\83H\83\8b\83g\83e\83N\83X\83`\83\83\82ð\83Z\83b\83g
+void FormMain::DropTextureFile(const QString& path, const QPoint& pos)
{
std::string fname = path.toLocal8Bit().data();
- m_ContextShare.BeginDrawTop();
- m_Scene.LoadDefaultMatTexture(fname);
- m_ContextShare.EndDrawTop();
+ QPoint pl = ui.GLWidgetMain->mapFrom(this, pos);
+
+ PickedMeshSubface picked;
+ m_View3d.BeginRender();
+ bool suc = m_View3d.PickFace2D(picked, pl.x(), pl.y());
+ m_View3d.EndRender();
+
+ if (suc)
+ {
+ m_View3d.BeginRender();
+ MeshBuf* mbuf = picked.mbuf;
+ lib_geo::BaseFace& f = mbuf->m_Mesh.m_Faces[picked.subf.fid];
+ GeomTextureSet* ts = mbuf->GetTexture(f.m_MatIdx);
+ if (ts != NULL)
+ {
+ std::string fp = path.toLocal8Bit().data();
+
+ QString name_qs = QFileInfo(path).fileName();
+ std::string name = name_qs.toLocal8Bit().data();
+
+ mbuf->ReleaseTextureUnit(ts, TextureType::Color);
+ gl::GlTexture* tex = mbuf->GetInitTexture(fp, name, m_Scene.m_TexConfig);
+ ts->SetTextureUnit(TextureType::Color, tex);
+ }
+ m_View3d.EndRender();
+ }
+ else
+ {
+ m_ContextShare.BeginDrawTop();
+ m_Scene.LoadDefaultMatTexture(fname);
+ m_ContextShare.EndDrawTop();
+ }
updateView_All();
}
edit->setText(text);
edit->blockSignals(false);
}
+
+void FormMain::on_sliderMatcapRate_valueChanged(int value)
+{
+ float r = GetSliderNormalizedPos(ui.sliderMatcapRate);
+ m_Scene.m_MatcapImg.m_BlendRate = r;
+
+ ui.labelMatcapRate->setText(QString::number(r, 'f', 2));
+
+ updateView_All();
+}