3 #include "ABFPannelNew.h"
4 #include "../UIs/ui_cabfpannelnew.h"
6 using namespace LODGenerator
;
8 cABFPannelNew::cABFPannelNew(QWidget
*parent
) :
10 ui(new Ui::cABFPannelNew
)
14 connect(ui
->TestABFButton
, SIGNAL(clicked()), this, SLOT(TestABF_Slot()));
15 connect(ui
->TestDecimator
, SIGNAL(clicked()), this, SLOT(TestDecimator_Slot()));
17 m_pUVPreview
= new CMeshBakerUVPreview(ui
->UVViwer
);
18 m_pUVPreview
->SetRenderMesh(false);
20 connect(ui
->UVViwer
, SIGNAL(SignalRender(const SRenderContext
&)), this, SLOT(OnRenderUV(const SRenderContext
&)));
21 connect(ui
->UVViwer
, SIGNAL(SignalMouse(const SMouseEvent
&)), this, SLOT(OnMouseEventUV(const SMouseEvent
&)));
22 connect(ui
->UVViwer
, SIGNAL(SignalKey(const SKeyEvent
&)), this, SLOT(OnKeyEventUV(const SKeyEvent
&)));
25 m_pMeshPreview
= new CMeshBakerUVPreview(ui
->MeshViwer
);
27 connect(ui
->MeshViwer
, SIGNAL(SignalRender(const SRenderContext
&)), this, SLOT(OnRender(const SRenderContext
&)));
28 connect(ui
->MeshViwer
, SIGNAL(SignalMouse(const SMouseEvent
&)), this, SLOT(OnMouseEvent(const SMouseEvent
&)));
29 connect(ui
->MeshViwer
, SIGNAL(SignalKey(const SKeyEvent
&)), this, SLOT(OnKeyEvent(const SKeyEvent
&)));
32 atlasgenerator_
= new LODGenerator::CAtlasGenerator();
36 void cABFPannelNew::OnIdle()
38 ui
->UVViwer
->Update();
39 ui
->MeshViwer
->Update();
42 cABFPannelNew::~cABFPannelNew()
46 delete atlasgenerator_
;
49 void cABFPannelNew::OnRenderUV(const SRenderContext
& rc
)
51 m_pUVPreview
->OnRender(rc
);
54 void cABFPannelNew::OnKeyEventUV(const SKeyEvent
& sKeyEvent
)
59 void cABFPannelNew::OnMouseEventUV(const SMouseEvent
& sMouseEvent
)
61 m_pUVPreview
->OnMouseEvent(sMouseEvent
);
64 void cABFPannelNew::OnRender(const SRenderContext
& rc
)
66 m_pMeshPreview
->OnRender(rc
);
69 void cABFPannelNew::OnKeyEvent(const SKeyEvent
& sKeyEvent
)
74 void cABFPannelNew::OnMouseEvent(const SMouseEvent
& sMouseEvent
)
76 m_pMeshPreview
->OnMouseEvent(sMouseEvent
);
79 void cABFPannelNew::TestABF_Slot()
81 atlasgenerator_
->testGenerate_texture_atlas();
82 //OGF::AutoSeam::prepare(textureAtlasGenerator->surface());
83 m_pMeshPreview
->UpdateMeshMap();
86 void cABFPannelNew::TestDecimator_Slot()
88 if (decimator
== NULL
)
91 decimator
->set_proportion_to_remove(0.125);
93 m_pMeshPreview
->UpdateMeshMap();
96 void cABFPannelNew::UpdateObj(IStatObj
* pObj
)
98 atlasgenerator_
->setSurface(pObj
);
99 decimator
= new LODGenerator::CDecimator(atlasgenerator_
->surface());
100 m_pUVPreview
->SetMeshMap(atlasgenerator_
->surface());
101 m_pMeshPreview
->SetMeshMap(atlasgenerator_
->surface());