当前位置: 首页>>代码示例>>C++>>正文


C++ IObject::GetClass方法代码示例

本文整理汇总了C++中IObject::GetClass方法的典型用法代码示例。如果您正苦于以下问题:C++ IObject::GetClass方法的具体用法?C++ IObject::GetClass怎么用?C++ IObject::GetClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObject的用法示例。


在下文中一共展示了IObject::GetClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Render

void CAppBase::Render()
{
//	SDL_SysWMinfo wmi = { 0 };
//	SDL_GetWMInfo(&wmi);
//	SetWindowPos(wmi.window, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOREPOSITION |SWP_NOSIZE);

	CCamera Camera;
	Camera.SetViewportDims(CVec2i(GetVideo()->GetWidth(), GetVideo()->GetHeight()));
	GetRender()->SetCamera(&Camera);
	
	CVec3f vDirection;
	vDirection.Point(g_fAzimuth, g_fElevation);
	Camera.SetDirection(-vDirection);
	
	CVec3f vPosition(0,0,0);
	vDirection *= g_fZoom;
	Camera.SetPosition(vPosition+vDirection+CVec3f(160,0,160));
//	Camera.SetFOV(60.0f);
//	Camera.SetAspectRatio(4.0f/3.0f);
	static ITube* s_pTube = NULL;
	if ( !s_pTube )
	{
		s_pTube = ITube::Create();
		s_pTube->SetShader("shaders/tube.shader");
		CVec3f vPoint(0,0,0);
		for ( int i = 0 ; i < 100 ; ++i )
		{
			s_pTube->AddControlPoint(CVec3f(160+20.0f*sin(float(i)/10.0f), i, (160+20.0f*cos(float(i)/10.0f))));
		}
	}

	GetRender()->BeginProjection(eProjectionPerspective);
	{
		GetRender()->BeginRenderPass(eRenderPassAccum);
		{
			GetScene()->Render3d();
			GetRender()->RenderTube(s_pTube);
		}
		GetRender()->EndRenderPass(eRenderPassAccum);

		GetRender()->BeginRenderPass(eRenderPassNormal);
		{
			GetScene()->Render3d();
			GetRender()->RenderTube(s_pTube);

			static bool once = true;
			static CVec3f vSrc;
			static CVec3f vDest;
//				if ( once )
			{
				vSrc = GetRender()->Unproject(NULL, g_vMousePos, 10.0f);
				vDest = GetRender()->Unproject(NULL, g_vMousePos, 10000.0f);
				once=false;
			}

			CVec3f vDir = vDest-vSrc; vDir.Normalize();
			IObject* pObject = NULL;
			if ( pObject = GetScene()->PickObject(vSrc, vDir) )
			{
				Debug("Picked %s", pObject->GetClass()->GetClassDef()->GetName().c_str());
			}

			CPlane3f plane(CVec3f(0,1,0), 0.0f);
			if ( plane.IntersectRay(CRay3f(vSrc, vDir), &g_vCursor3d) )
			{
//				Debug("x,y,z = %f,%f,%f", g_vCursor3d.x, g_vCursor3d.y, g_vCursor3d.z);
			}
			else
			{
//				Debug("...");
			}

//				GetRender()->RenderLine(CVec3f(160,0,160), vDest, CRGBA(255,255,0,255));
//				GetRender()->RenderLine(CVec3f(0,0,0), vDest, CRGBA(0,255,0,255));
//				GetRender()->RenderModelSkinned(&s_ModelSkinned);
		}
		GetRender()->EndRenderPass(eRenderPassNormal);
	}
	GetRender()->EndProjection(eProjectionPerspective);
	GetRender()->BeginProjection(eProjectionOrtho);
	{
		GetUi()->Render();
	}
	GetRender()->EndProjection(eProjectionOrtho);

	GetRender()->SetCamera(NULL);

	GetRender()->Swap();
}
开发者ID:newobj,项目名称:taz,代码行数:89,代码来源:appbase.cpp


注:本文中的IObject::GetClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。