Ejemplo n.º 1
0
void ExtCamControl::showScreenBgFgDetector(void)
{
	int i;
	UMat imMat, imMat2;
	CamFrame* pFrame = m_pCamFront->getFrame();

	if(pFrame->getGMat()->empty())return;
	if(m_pBgFgD->m_Mat.empty())return;
	if(m_pBgFgD->m_gFg.empty())return;

//	m_pBgFgD->m_gFg.download(imMat2);
//	imshow("Bg",imMat);
//	imshow("Fg",imMat2);
//	imshow("BgFgContour",m_pBgFgD->m_Mat);

	imMat = m_pBgFgD->m_Mat;

	putText(imMat, "Camera FPS: "+f2str(m_pCamFront->getFrameRate()), cv::Point(15,15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
	putText(imMat, "BgFg Detector FPS: "+f2str(m_pBgFgD->getFrameRate()), cv::Point(15,35), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);

//	fVector3 markerPos;
//	int lockLevel = m_pMD->getObjLockLevel();
//	if (lockLevel >= LOCK_LEVEL_POS)
//	{
//		putText(imMat, "BgFg", cv::Point(15,55), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
//		//Update current position with trajectory estimation
//		m_pMD->getObjPosition(&markerPos);
//		circle(imMat, Point(markerPos.m_x,markerPos.m_y), markerPos.m_z, Scalar(0, 255, 0), 2);
//	}

	imshow(APP_NAME,imMat);
}
Ejemplo n.º 2
0
	void PropertyFieldQuaternion::OnOK(const MGUI::ClickEvent * e)
	{
		mLayout->SetVisible(false);

		String x_text, y_text, z_text;
		x_text.FromUnicode(mEditBoxX->GetCaption().c_str());
		y_text.FromUnicode(mEditBoxY->GetCaption().c_str());
		z_text.FromUnicode(mEditBoxZ->GetCaption().c_str());

		Float3 val;
		val.x = x_text.ToFloat();
		val.y = y_text.ToFloat();
		val.z = z_text.ToFloat();

		Quat q;
		q.FromEulerAngle(val);
		mObject->SetPropertyData(mProperty, &q);

		String text = 
			f2str(val.x, true) + " " +
			f2str(val.y, true) + " " +
			f2str(val.z, true);

		mButton->SetCaption(text.c_wstr());
	}
Ejemplo n.º 3
0
	PropertyFieldQuaternion::PropertyFieldQuaternion(PropertyGroup * group, IObject * obj, const Property * prop)
		: PropertyFieldButton(group, obj, prop)
	{
		Float4 v = mProperty->AsFloat4(mObject->GetPropertyData(mProperty));
		Quat q(v.x, v.y, v.z, v.w);
		Float3 data = q.ToEulerAngle();
		String text = 
			f2str(data.x, true) + " " +
			f2str(data.y, true) + " " +
			f2str(data.z, true);

		mButton->SetCaption(text.c_wstr());
		mButton->E_Click += new cListener1<PropertyFieldQuaternion, const MGUI::ClickEvent *>(this, &PropertyFieldQuaternion::OnClick);

		mLayout = MGUI::Layout::Load("PropertyFieldEditBox3.layout", NULL);
		mLayout->SetOrder(MGUI::eOrder::TOP - 100);
		mLayout->SetVisible(false);

		mEditBoxX = mLayout->GetChild(0)->GetChildT<MGUI::EditBox>("x");
		mEditBoxY = mLayout->GetChild(0)->GetChildT<MGUI::EditBox>("y");
		mEditBoxZ = mLayout->GetChild(0)->GetChildT<MGUI::EditBox>("z");

		mLayout->GetChild(0)->GetChildT<MGUI::Button>("OK")->E_Click +=
			new cListener1<PropertyFieldQuaternion, const MGUI::ClickEvent *>(this, &PropertyFieldQuaternion::OnOK);
		mLayout->GetChild(0)->GetChildT<MGUI::Button>("Cancel")->E_Click +=
			new cListener1<PropertyFieldQuaternion, const MGUI::ClickEvent *>(this, &PropertyFieldQuaternion::OnCancel);
	}
Ejemplo n.º 4
0
void GizmoBar::OnRotate(const MGUI::MouseEvent * e)
{
	mWidget_Move->SetAlpha(0.5f);
	mWidget_Rotate->SetAlpha(1.0f);
	mWidget_Scale->SetAlpha(0.5f);

	Gizmo::Instance()->SetOperator(Gizmo::OP_ROTATE);

	Node * n = Editor::Instance()->GetSelectNode();
	if (n != NULL)
	{
		Quat q = n->GetRotation();
		Float3 p = q.ToEulerAngle();

		String x_str, y_str, z_str;
		x_str = f2str(p.x, true, "%.2f");
		y_str = f2str(p.y, true, "%.2f");
		z_str = f2str(p.z, true, "%.2f");

		mEditBox_X->SetCaption(x_str.c_wstr());
		mEditBox_Y->SetCaption(y_str.c_wstr());
		mEditBox_Z->SetCaption(z_str.c_wstr());
	}
	else
	{
		String x_str, y_str, z_str;

		mEditBox_X->SetCaption(x_str.c_wstr());
		mEditBox_Y->SetCaption(y_str.c_wstr());
		mEditBox_Z->SetCaption(z_str.c_wstr());
	}
}
Ejemplo n.º 5
0
	void PropertyFieldQuaternion::OnClick(const MGUI::ClickEvent * e)
	{
		mLayout->SetVisible(true);

		Float4 v = mProperty->AsFloat4(mObject->GetPropertyData(mProperty));
		Quat q(v.x, v.y, v.z, v.w);
		Float3 data = q.ToEulerAngle();
		String x_text = f2str(data.x, true);
		String y_text = f2str(data.y, true);
		String z_text = f2str(data.z, true);

		mEditBoxX->SetCaption(x_text.c_wstr());
		mEditBoxY->SetCaption(y_text.c_wstr());
		mEditBoxZ->SetCaption(z_text.c_wstr());
	}
Ejemplo n.º 6
0
GrassModule::GrassModule()
	: EditorModule("Grass")
{
	mBrushSize = 0.5f * METER_LEN;
	mMinSize = 0.5f * METER_LEN;
	mMaxSize = 0.8f * METER_LEN;
	mImageBox_Selected = NULL;

	mLayout = MGUI::Layout::Load("GrassPanel.layout", NULL);
	mLayout->SetVisible(false);

	mEdMinSize = (MGUI::EditBox *)mLayout->GetChild("MinSize");
	mEdMinSize->SetCaption(f2str(mMinSize, true, "%.2f").c_wstr());

	mEdMaxSize = (MGUI::EditBox *)mLayout->GetChild("MaxSize");
	mEdMaxSize->SetCaption(f2str(mMaxSize, true, "%.2f").c_wstr());

	mEdMinSize->E_KeyLostFocus += new cListener1<GrassModule, const MGUI::FocusEvent *>(this, &GrassModule::OnSize);
	mEdMaxSize->E_KeyLostFocus += new cListener1<GrassModule, const MGUI::FocusEvent *>(this, &GrassModule::OnSize);

	mGrid_Grass = new MGUI::GridBox(NULL, mLayout->GetChild("Grass"));
	mGrid_Grass->SetColumn(3);
	mGrid_Grass->SetAutoResizeType(MGUI::GridBox::NONE);
	mGrid_Grass->SetRect(0, 0, 3 * 70, 3 * 70);
	mGrid_Grass->SetGridSize(70, 70);
	mGrid_Grass->SetAlign(MGUI::eAlign::H_CENTER | MGUI::eAlign::V_STRETCH);

	mShaderFX_Brush = ShaderFXManager::Instance()->Load("TerrainBrush", "Shader/TerrainBrush.mfx");
	d_assert (mShaderFX_Brush != NULL && mShaderFX_Brush->GetPassCount());

	Editor::Instance()->E_Update += new cListener0<GrassModule>(this, &GrassModule::OnUpdate);
	Editor::Instance()->E_SceneUnload += new cListener0<GrassModule>(this, &GrassModule::OnSceneUnload);
	Editor::Instance()->E_SceneLoaded += new cListener0<GrassModule>(this, &GrassModule::OnSceenLoaded);
	World::Instance()->E_RenderSolid += new cListener0<GrassModule>(this, &GrassModule::OnRender);

	World::Instance()->E_SectionCurrentChanged += new cListener1<GrassModule, WorldSection *>(this, &GrassModule::OnSectionChanged);
}