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


C++ Matrix34::OrientFU方法代码示例

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


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

示例1: Render

void LocationEditor::Render()
{
    //
    // Render our buildings
	
	g_app->m_renderer->SetObjectLighting();
    LevelFile *levelFile = g_app->m_location->m_levelFile;
    for( int i = 0; i < levelFile->m_buildings.Size(); ++i )
    {
        if( levelFile->m_buildings.ValidIndex(i) )
        {
            Building *b = levelFile->m_buildings.GetData(i);
            b->Render(0.0);
        }
    } 
    g_app->m_renderer->UnsetObjectLighting();
	if (m_mode == ModeBuilding)
	{
		for( int i = 0; i < levelFile->m_buildings.Size(); ++i )
		{
			if( levelFile->m_buildings.ValidIndex(i) )
			{
				Building *b = levelFile->m_buildings.GetData(i);
				b->RenderAlphas(0.0);
				b->RenderLink();
			}
		}
	}


	// 
	// Render camera mounts

	{
		g_app->m_renderer->SetObjectLighting();
		Shape *camShape = g_app->m_resource->GetShape("camera.shp");
		Matrix34 mat;
		
		for (int i = 0; i < g_app->m_location->m_levelFile->m_cameraMounts.Size(); ++i)
		{
			CameraMount *mount = g_app->m_location->m_levelFile->m_cameraMounts[i];
			Vector3 camToMount = g_app->m_camera->GetPos() - mount->m_pos;
			if (camToMount.Mag() < 20.0) continue;
			mat.OrientFU(mount->m_front, mount->m_up);
			mat.pos = mount->m_pos;
			camShape->Render(0.0, mat);
		}
	    g_app->m_renderer->UnsetObjectLighting();
	}


    g_app->m_renderer->UnsetObjectLighting();


	// 
	// Render our instant units
	
	for (int i = 0; i < levelFile->m_instantUnits.Size(); ++i)
	{
		InstantUnit *iu = levelFile->m_instantUnits.GetData(i);
		RenderUnit(iu);
	}

	switch (m_mode)
	{
		case ModeLandTile:			RenderModeLandTile();				break;
		case ModeLandFlat:			RenderModeLandFlat();				break;
		case ModeBuilding:			RenderModeBuilding();				break;
		case ModeLight:													break;
		case ModeInstantUnit:		RenderModeInstantUnit();			break;
		case ModeCameraMount:		RenderModeCameraMount();			break;
	}

	
	//
	// Render axes

	float sizeX = g_app->m_location->m_landscape.GetWorldSizeX() / 2;
	float sizeZ = g_app->m_location->m_landscape.GetWorldSizeZ() / 2;
	RenderArrow(Vector3(10, 200, 0), Vector3(sizeX, 200, 0), 4.0);
	glBegin(GL_LINES);
		glVertex3f(sizeX,      250, 0);
		glVertex3f(sizeX + 90, 150, 0);
		glVertex3f(sizeX,      150, 0);
		glVertex3f(sizeX + 90, 250, 0);
	glEnd();
	glDisable(GL_BLEND);
	glDisable(GL_LINE_SMOOTH);

	RenderArrow(Vector3(0, 200, 10), Vector3(0, 200, sizeZ), 4.0);
	glBegin(GL_LINES);
		glVertex3f(0, 250, sizeZ);
		glVertex3f(0, 250, sizeZ + 90);
		glVertex3f(0, 250, sizeZ);
		glVertex3f(0, 150, sizeZ + 90);
		glVertex3f(0, 150, sizeZ);
		glVertex3f(0, 150, sizeZ + 90);
	glEnd();
	glDisable(GL_BLEND);
	glDisable(GL_LINE_SMOOTH);
//.........这里部分代码省略.........
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:101,代码来源:location_editor.cpp


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