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


C++ SVector3::set方法代码示例

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


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

示例1: gInitiallyPlaceViewer

static void gInitiallyPlaceViewer()
{
	// TBD
	/*
	const CGameInfo& gi = CGameInfo::getInstance();
	const CGameMap& gmap = gi.getGameMap();
	const CGameReplay& replay = gi.getReplay();
	const CLevelMesh& level = gi.getLevelMesh();

	const CReplayEntity::SState& pl1st = replay.getEntity( replay.getPlayer(0).entityAI ).getTurnState( 0 );
	int posx = pl1st.posx;
	int posy = pl1st.posy;

	const int XOFF[4] = { 2, 2, -2, -2 };
	const int YOFF[4] = { 2, -2, 2, -2 };
	const float ROT[4] = { D3DX_PI/4*7, D3DX_PI/4*5, D3DX_PI/4*1, D3DX_PI/4*3 };
	*/
	gViewer.identify();
	/*
	gViewer.getOrigin().set( posx, VIEWER_Y, -posy );
	for( int i = 0; i < 4; ++i ) {
		int px = posx+XOFF[i];
		int py = posy+YOFF[i];
		//if( gmap.isBlood( gmap.getCell(px,py).type ) ) {
		if( !level.collideSphere( SVector3(px,VIEWER_Y,-py), VIEWER_R ) ) {
			D3DXMatrixRotationY( &gViewer, ROT[i] );
			gViewer.getOrigin().set( px, VIEWER_Y, -py );
			break;
		}
	}
	*/
	gLastViewerValidPos = gViewer.getOrigin();

	gViewerVel.set(0,0,0);
	gViewerZVel.set(0,0,0);
}
开发者ID:BackupTheBerlios,项目名称:dingus-svn,代码行数:36,代码来源:Demo.cpp

示例2: initialize

void CDemo::initialize( IDingusAppContext& appContext )
{
	gAppContext = &appContext;
	CSharedTextureBundle& stb = CSharedTextureBundle::getInstance();
	CSharedSurfaceBundle& ssb = CSharedSurfaceBundle::getInstance();

	CD3DDevice& dx = CD3DDevice::getInstance();

	G_INPUTCTX->addListener( *this );

	// --------------------------------
	// common params
	
	stb.registerTexture( RT_SHADOW, *new CFixedTextureCreator(
			SZ_SHADOW, SZ_SHADOW, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT ) );
	stb.registerTexture( RT_SHADOWBLUR, *new CFixedTextureCreator(
			SZ_SHADOW, SZ_SHADOW, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT ) );

	ssb.registerSurface( RT_SHADOW, *new CTextureLevelSurfaceCreator(*RGET_S_TEX(RT_SHADOW),0) );
	ssb.registerSurface( RT_SHADOWBLUR, *new CTextureLevelSurfaceCreator(*RGET_S_TEX(RT_SHADOWBLUR),0) );
	
	ssb.registerSurface( RT_SHADOWZ, *new CFixedSurfaceCreator(
			SZ_SHADOW, SZ_SHADOW, true, D3DFMT_D16 ) );

	gGlobalCullMode = D3DCULL_CW;
	G_RENDERCTX->getGlobalParams().addIntRef( "iCull", &gGlobalCullMode );
	G_RENDERCTX->getGlobalParams().addFloatRef( "fTime", &gTimeParam );
	G_RENDERCTX->getGlobalParams().addMatrix4x4Ref( "mShadowProj", gShadowProjMat );
	G_RENDERCTX->getGlobalParams().addMatrix4x4Ref( "mViewTexProj", gViewTexProjMat );

	// --------------------------------
	// light
	
	gLightCam.mWorldMat.getAxisX().set( 1, 0, 0 );
	gLightCam.mWorldMat.getAxisY().set( 0, 0, 1 );
	gLightCam.mWorldMat.getAxisZ().set( 0,-1, 0 );
	gLightCam.mWorldMat.getOrigin().set( 0, 9.0f, 0 );
	gLightCam.setProjectionParams( D3DX_PI*0.5f, 1.0f, 0.1f, 20.0f );

	// --------------------------------
	// meshes

	gMeshBox = new CRenderableMesh( *RGET_MESH("Box"), 0 );
	gMeshBox->getParams().setEffect( *RGET_FX("box") );
	gMeshBox->getParams().addTexture( "tBase", *RGET_TEX("HellEdges") );
	gMeshBox->getParams().addTexture( "tShadow", *RGET_S_TEX(RT_SHADOWBLUR) );

	for( int i = 0; i < ENTITY_NAME_COUNT; ++i )
		gAddEntity( i );

	gTargetPos.set( 0, 0, 0 );
	gTargetVel.set(0,0,0);

	// gauss X shadowmap -> shadowblur
	gQuadGaussX = new CRenderableMesh( *RGET_MESH("billboard"), 0, NULL, 0 );
	gQuadGaussX->getParams().setEffect( *RGET_FX("filterGaussX") );
	gQuadGaussX->getParams().addTexture( "tBase", *RGET_S_TEX(RT_SHADOW) );
	// gauss Y shadowblur -> shadowmap
	gQuadGaussY = new CRenderableMesh( *RGET_MESH("billboard"), 0, NULL, 0 );
	gQuadGaussY->getParams().setEffect( *RGET_FX("filterGaussY") );
	gQuadGaussY->getParams().addTexture( "tBase", *RGET_S_TEX(RT_SHADOWBLUR) );
	// blur shadowmap -> shadowblur
	gQuadBlur = new CRenderableMesh( *RGET_MESH("billboard"), 0, NULL, 0 );
	gQuadBlur->getParams().setEffect( *RGET_FX("filterPoisson") );
	gQuadBlur->getParams().addTexture( "tBase", *RGET_S_TEX(RT_SHADOW) );


	// --------------------------------
	// GUI

	gUIDlgHUD = new CUIDialog();
	gUIDlgHUD->setCallback( gUICallback );

	const int hctl = 16;
	const int hrol = 14;

	// fps
	{
		gUIDlgHUD->addStatic( 0, "(wait)", 5,  460, 200, 20, false, &gUIFPS );
	}
	// zoom
	{
		gUIDlgHUD->addStatic( 0, "yaw ", 210,  5, 40, hctl );
		gUIDlgHUD->addSlider( 0, 250,  5, 100, hctl, -180, 180, 10, false, &gUISliderYaw );
		gUIDlgHUD->addStatic( 0, "ptch", 210, 25, 40, hctl );
		gUIDlgHUD->addSlider( 0, 250, 25, 100, hctl, 0, 90, 5, false, &gUISliderPitch );
		gUIDlgHUD->addStatic( 0, "zoom", 210, 45, 40, hctl );
		gUIDlgHUD->addSlider( 0, 250, 45, 100, hctl, 5, 20, 6, false, &gUISliderZoom );
	}
	//
	{
		gUIDlgHUD->addCheckBox( 0, "Preblur shadows", 5, 50, 100, 20, true, 0, false, &gUIChkDilate );
	}
}
开发者ID:BackupTheBerlios,项目名称:dingus-svn,代码行数:94,代码来源:Demo.cpp

示例3: perform

/**
 *  Main loop code.
 */
void CDemo::perform()
{
	char buf[100];

	time_value tmv = CSystemTimer::getInstance().getTime();
	double t = tmv.tosec();
	float dt = CSystemTimer::getInstance().getDeltaTimeS();
	gTimeParam = float(t);

	CDynamicVBManager::getInstance().discard();

	CD3DDevice& dx = CD3DDevice::getInstance();
	gScreenFixUVs.set( 0.5f/dx.getBackBufferWidth(), 0.5f/dx.getBackBufferHeight(), 0.0f, 0.0f );

	CGameInfo& gi = CGameInfo::getInstance();
	const CGameDesc& desc = gi.getGameDesc();
	CGameState& state = gi.getState();
	const CGameMap& gmap = desc.getMap();

	//
	// should we still perform some initialization steps?

	if( !gInitGuiDone ) {
		// perform multi-step initialization...
		const char* initStepName = NULL;
		if( !gInitMainStarted ) {

			BEGIN_T();
			
			initStepName = gi.initBegin();
			gInitMainStarted = true;
		} else if( !gInitMainDone ) {
			initStepName = gi.initStep();
			if( !initStepName ) {
				initStepName = "Initializing GUI...";
				gInitMainDone = true;
			}
		} else {
			gInitiallyPlaceViewer();
			gSetupGUI();
			gInitGuiDone = true;

			END_T( "initialization" );
			
			return;
		}
		// check for init errors...
		if( !gErrorMsg.empty() ) {
			CONS << "Fatal error: " << gErrorMsg << endl;
			gFinished = true;
			return;
		}
		if( initStepName ) {
			CONS << "Init step: " << initStepName << endl;
		}
		// render progress
		assert( initStepName );
		dx.clearTargets( true, true, true, 0xFF000000, 1.0f, 0L );
		dx.sceneBegin();
		G_RENDERCTX->applyGlobalEffect();
		gUIDlg->renderBegin();
		gUIDrawLogo();
		gUIDrawProgress( initStepName );
		gUIDlg->renderEnd();
		dx.sceneEnd();
		return;
	}

	//
	// fatal error

	if( gCheckFatalError() )
		return;

	//
	// check if settings dialog just was closed

	if( gSettingsDlgWasActive && gUISettingsDlg->getState() != CDemoSettingsDialog::STATE_ACTIVE ) {
		gSettingsDlgWasActive = false;
		gUIDlg->getCheckBox( GID_CHK_OPTIONS )->setChecked( false );
		if( gUISettingsDlg->getState() == CDemoSettingsDialog::STATE_OK ) {
			// apply settings, return
			if( gAppSettings.gfxDetail != gUISettingsDlg->getAppSettings().gfxDetail ) {
				gi.getLevelMesh().updateDetailLevel( gUISettingsDlg->getAppSettings().gfxDetail );
			}
			gAppSettings = gUISettingsDlg->getAppSettings();
			CD3DSettings d3dset;
			gUISettingsDlg->getFinalSettings( d3dset );
			// don't apply d3d settings if they didn't change
			if( d3dset != gAppContext->getD3DSettings() )
				gAppContext->applyD3DSettings( d3dset );
			return;
		}
	} else if( gSettingsDlgWasActive ) {
		// if the dialog is active, but the d3d settings just changed (eg. alt-tab),
		// hide it and re-show it
		if( gSettingsAtDlgStart != gAppContext->getD3DSettings() ) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dingus-svn,代码行数:101,代码来源:Demo.cpp


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