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


C++ SetRotation函数代码示例

本文整理汇总了C++中SetRotation函数的典型用法代码示例。如果您正苦于以下问题:C++ SetRotation函数的具体用法?C++ SetRotation怎么用?C++ SetRotation使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: SetPosition

TransformObject::TransformObject(void)
{
	SetPosition(Vector3f());
	SetRotation(Vector3f());
	SetScale(1.0f);
}
开发者ID:heyx3,项目名称:RayTracer,代码行数:6,代码来源:TransformObject.cpp

示例2: SetRotation

Matrix4x4::Matrix4x4(const Quaternion& q)
{
	SetRotation(q);
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:4,代码来源:matrix.cpp

示例3: SetRotation

void
Entity::ScriptSetRotation( const float rotation )
{
    SetRotation( Ogre::Degree( rotation ) );
}
开发者ID:DeejStar,项目名称:q-gears,代码行数:5,代码来源:Entity.cpp

示例4: CreateHitMarkerMsg


//.........这里部分代码省略.........

		if (tempEnemy && owner && owner->GetOwner() && owner->GetOwner()->GetClass() == ClassType::Gunslinger && owner->GetOwner()->GetLevel() >= 24)
		{
			int theOdds = rand() % 100 + 1;
			// gunslinger passive debug code
			GameplayState::GetInstance()->nRiccochetOdds = theOdds;

			if (theOdds < 45 && tempEnemy->GetIsEnemy() != owner->GetOwner()->GetIsEnemy())
			{
				// adjust angle to aim at another enemy (see chain lightning: cyborg lv 18 - line 120)
				// instead of destroying, redirect to another (and don't destroy)
				// if no other near, destroy this
				Weapon* tempWeapon = newEnemy->GetWeapon();

				// gunslinger debug code
				for (unsigned i = 0; i < GameplayState::GetInstance()->npcs.size(); i++)
				{
					if (GameplayState::GetInstance()->npcs[i]->getCharacter() != tempEnemy)
					{
						SGD::Vector tempDiff = GameplayState::GetInstance()->npcs[i]->getCharacter()->GetPosition() - GetPosition();
						//tempDiff.Normalize();

						float tempDist = tempDiff.ComputeLength();

						if (tempDist < 300)
						{
							// calculate angle to new target
							float toTarget = atan2(tempDiff.y, tempDiff.x);

							SGD::Vector newVelocity = GetVelocity();

							// set the velocity to the newly rotated velocity
							SetVelocity(newVelocity.ComputeRotated(toTarget));
							SetRotation(toTarget);
							SGD::AudioManager::GetInstance()->PlayAudio(GameplayState::GetInstance()->trickShot);
							break;
						}
					}
				}
			}
		}
		if (owner && owner->GetOwner() && owner->GetOwner()->GetClass() == ClassType::Medic && owner->GetOwner()->GetLevel() >= 24 && temp && damage >= temp->GetCurrHealth()*1.2f)
		{
			vector<NPC*> hits = GameplayState::GetInstance()->npcs;
			if ((GameplayState::GetInstance()->player->GetCharacter()->GetPosition() - temp->GetPosition()).ComputeLength() < 300.0f)
			{
				GameplayState::GetInstance()->player->GetCharacter()->ModifyHealth((temp->GetHealth())*0.1f);
				Emitter* heals = GameplayState::GetInstance()->CreateEmitter("heals", (temp != nullptr));
				heals->lifeTime = 0.25f;
			}

			for (unsigned int x = 0; x < hits.size(); x++)
			{
				float length = (hits[x]->getCharacter()->GetPosition() - temp->GetPosition()).ComputeLength();
				if (length < 300.0f && !hits[x]->getCharacter()->GetIsEnemy())
				{
					hits[x]->getCharacter()->ModifyHealth((temp->GetHealth())*0.05f);
					Emitter* heals = GameplayState::GetInstance()->CreateEmitter("heals", (temp != nullptr));
					heals->lifeTime = 0.25f;
					//visual effect
				}
			}
			SGD::AudioManager::GetInstance()->PlayAudio(GameplayState::GetInstance()->tranfusion);
		}
		if (GetOwner()->bulType.size() == 0)
		{
开发者ID:DeVonFire27,项目名称:DTW_Desolate,代码行数:67,代码来源:Bullet.cpp

示例5: SetRotation

	void Transform2D::SetRotationRad(const glm::float32& rad)
	{
		SetRotation(Angle::FromRadians(rad));
	}
开发者ID:kingnobody8,项目名称:astrotether,代码行数:4,代码来源:transform.cpp

示例6: SetRotation

void UKUIMaterialInterfaceComponent::SetRotationStruct( const FRotator& rRotation )
{
	SetRotation( rRotation.Pitch, rRotation.Yaw, rRotation.Yaw );
}
开发者ID:cllpyl,项目名称:KeshUI,代码行数:4,代码来源:KUIMaterialInterfaceComponent.cpp

示例7: PerspectiveCamera

FirstPersonCamera::FirstPersonCamera(float nearClip, float farClip, float fov, float aspect)
    : PerspectiveCamera(nearClip, farClip, fov, aspect)
{
    SetRotation(XMFLOAT2(0.0f, 0.0f), 0.0f);
    UpdateProjection();
}
开发者ID:vonture,项目名称:DeferredRenderer,代码行数:6,代码来源:FirstPersonCamera.cpp

示例8:

_Use_decl_annotations_ HRESULT WINAPI
DXGISwapChainProxy::SetRotation(DXGI_MODE_ROTATION rotation)
{
    auto const swap_chain = static_cast<IDXGISwapChain1*>(swap_chain_);
    return swap_chain->SetRotation(rotation);
}
开发者ID:lvous,项目名称:hadesmem,代码行数:6,代码来源:dxgi_swap_chain.cpp

示例9: SetRotation

void RigidBody::HandleTargetRotation(StringHash eventType, VariantMap& eventData)
{
    // Copy the smoothing target rotation to the rigid body
    if (!physicsWorld_ || !physicsWorld_->IsApplyingTransforms())
        SetRotation(static_cast<SmoothedTransform*>(GetEventSender())->GetTargetWorldRotation());
}
开发者ID:quinsmpang,项目名称:Urho3D,代码行数:6,代码来源:RigidBody.cpp

示例10: SetRotation

void CameraClass::SetRotation(D3DXVECTOR3 dr)
{
	SetRotation(dr.x, dr.y, dr.z);
}
开发者ID:kvlar,项目名称:Haeigan,代码行数:4,代码来源:CameraClass.cpp

示例11: ZeroMemory

/////////////////////////////////////////////////////////////////////////////
// CasteroidIGC
HRESULT     CasteroidIGC::Initialize(ImissionIGC* pMission, Time now, const void* data, int dataSize)
{
	ZeroMemory(&m_builderseensides, sizeof(bool) * c_cSidesMax); //Imago 8/10
    TmodelIGC<IasteroidIGC>::Initialize(pMission, now, data, dataSize);

    ZRetailAssert (data && (dataSize == sizeof(DataAsteroidIGC)));
    {
        DataAsteroidIGC*  dataAsteroid = (DataAsteroidIGC*)data;
        m_asteroidDef = dataAsteroid->asteroidDef;
		
        IclusterIGC*    cluster = pMission->GetCluster(dataAsteroid->clusterID);
        ZRetailAssert (cluster);
        {
            HRESULT rc = Load(0,
                              m_asteroidDef.modelName,
                              m_asteroidDef.textureName,
                              m_asteroidDef.iconName,
                              c_mtStatic | c_mtHitable | c_mtDamagable | c_mtSeenBySide | c_mtPredictable);
            assert (SUCCEEDED(rc));

            SetRadius((float)m_asteroidDef.radius);
            SetPosition(dataAsteroid->position);
            {
                Orientation o(dataAsteroid->forward, dataAsteroid->up);
                SetOrientation(o);
            }
			
			// Turkey 01/2014 AME is bugged, rotation axis should be a normalized vector
			Rotation r = dataAsteroid->rotation;
			Vector axis = r.axis().Normalize();
			r.axis(axis);
            SetRotation(r);

            SetSignature(dataAsteroid->signature);

            m_fraction = dataAsteroid->fraction;
			if (m_fraction > 1.0f) m_fraction = 1.0f; // Turkey 01/2014 AME is bugged, gives rocks 100.4% hitpoints (241/240)

            if (dataAsteroid->name[0] != '\0')
                SetName(dataAsteroid->name);
            else
                SetSecondaryName(dataAsteroid->name + 1);

            SetCluster(cluster);

			//Xynth #100 7/2010 Need to initialize oreseenbyside for all sides
			for (SideLinkIGC* psl = this->GetMission()->GetSides()->first(); psl != NULL; psl = psl->next())
			{
				IsideIGC* pside = psl->data();									
				oreSeenBySide.Set(pside, 0.0);									
			}

			m_lastUpdateOre = 0.0;  //Xynth #132 7/2010 Should update first time this is mined
			m_inhibitUpdate = false; //Xynth #225 9/10 		
		    m_inhibitCounter = -1;
#ifdef DEBUG
            {
                //Verify that there is no pre-existing asteroid with the same ID
                for (AsteroidLinkIGC*   pal = pMission->GetAsteroids()->first(); (pal != NULL); pal = pal->next())
                {
                    assert (pal->data()->GetObjectID() != m_asteroidDef.asteroidID);
                }
            }
#endif
            pMission->AddAsteroid(this);
        }
    }

    return S_OK;
}
开发者ID:ImagoTrigger,项目名称:FreeAllegiance,代码行数:72,代码来源:asteroidigc.cpp

示例12: SetDebugDraw

void World::RunWorld()
{
	std::srand(static_cast<unsigned int>(std::time(NULL)));

	uint32 flags = 0;
	flags += b2Draw::e_shapeBit;
	flags += b2Draw::e_jointBit;
	flags += b2Draw::e_aabbBit;
	flags += b2Draw::e_pairBit;
	flags += b2Draw::e_centerOfMassBit;
	WindowManager::I().GetDebugDraw().SetFlags(flags);
	SetDebugDraw(&WindowManager::I().GetDebugDraw());

	// Since the Box2D world is tuned for meters, and works with averagely sized objects,
	//  we'll zoom in with the view.
	sf::View view;
	view.setSize(sf::Vector2f(80, 60));
	view.setCenter(sf::Vector2f(40, 30));
	WindowManager::I().setView(view);

	auto obj = std::make_shared<ObjectBase>(OSTCircle, 1.0f, true);
	auto obj2 = std::make_shared<ObjectBase>(OSTRectangle, 15.0f, false);
	auto obj3 = std::make_shared<ObjectBase>(OSTRectangle, 15.0f, false);
	auto obj4 = std::make_shared<ObjectBase>(OSTRectangle, 15.0f, false);

	obj->SetPosition(40, 10);
	obj2->SetPosition(40, 51.5);
	obj3->SetPosition(70, 43);
	obj3->SetRotation(b2_pi / 4.0f);
	obj4->SetPosition(10, 45);
	obj4->SetRotation(b2_pi / 8.0f + b2_pi);

	while (WindowManager::I().isOpen())
	{
		// Handle events
		sf::Event event;
		while (WindowManager::I().pollEvent(event))
		{
			// Window closed or escape key pressed: exit
			if ((event.type == sf::Event::Closed) ||
				((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)))
			{
				WindowManager::I().close();
				break;
			}
		}

		float32 timeStep = 1.0f / 60.0f;
		int32 velocityIterations = 6;
		int32 positionIterations = 2;

		Step(timeStep, velocityIterations, positionIterations);

		obj->Move();

		WindowManager::I().clear(sf::Color::Black);

		DrawDebugData();

		WindowManager::I().display();
	}
}
开发者ID:castled,项目名称:b2dsfml,代码行数:62,代码来源:World.cpp

示例13: vgSetPaint

TInt CNVGCSIcon::DoDrawL(const TSize aSize)
    {
    TInt ret = KErrNone;
    
    vgSetPaint(iFillPaint,   VG_FILL_PATH);
    vgSetPaint(iStrokePaint, VG_STROKE_PATH);
    iLastFillPaintColor     = 0;
    iLastStrkePaintColor    = 0;
    iLastFillPaintType      = 0;
    iLastStrokePaintType    = 0;

    VGfloat lCurrentPathMatrix[9];
    vgGetMatrix(lCurrentPathMatrix);
    
    vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);  
    vgLoadMatrix(lCurrentPathMatrix);
    SetRotation();
#ifdef __MIRROR_    
    vgScale(1.0f, -1.0f);
    vgTranslate(0, (VGfloat)(-aSize.iHeight) );
#endif
    
    SetViewBoxToViewTransformationL(aSize);
   
    
    vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
    
    VGfloat currentMatrix[9];
    
    vgGetMatrix(currentMatrix);
    
    iNVGIconData->BeginRead();

    while (!iNVGIconData->EOF())
        {
        switch (iNVGIconData->ReadInt32L())
            {
            case EPath:
                {
                VGPath path = (VGPath)iNVGIconData->ReadInt32L();
                VGPaintMode paintMode = (VGPaintMode)iNVGIconData->ReadInt32L();

                if (path == VG_INVALID_HANDLE)
                    {
                    vgDrawPath(iPath, paintMode);
                    }
                else
                    {
                    vgDrawPath(path, paintMode);
                    }
                
                break;
                }
            case EPathData:
                {                
                if (iPath != VG_INVALID_HANDLE)
                    {
                    VGint numSegments;
                    VGubyte * pathSegments = 0;
                    VGubyte * pathData = 0;
                    
                    numSegments  = iNVGIconData->ReadInt32L();
                    pathSegments = new (ELeave) VGubyte[numSegments];
                    CleanupStack::PushL(TCleanupItem(CleanupArray, pathSegments));
                    if (pathSegments)
                        {
                        iNVGIconData->ReadL(pathSegments, numSegments);
                        VGint coordinateCount = iNVGIconData->ReadInt32L();
                        pathData = new (ELeave) VGubyte[coordinateCount * 4];
                        if (pathData)
                            {
                            CleanupStack::PushL(TCleanupItem(CleanupArray, pathData));
                            iNVGIconData->ReadL(pathData, coordinateCount * 4);
                            vgClearPath(iPath, VG_PATH_CAPABILITY_APPEND_TO);
                            vgAppendPathData(iPath, numSegments, pathSegments, pathData);
                            CleanupStack::PopAndDestroy();
                            }                        
                        }
                    CleanupStack::PopAndDestroy();
                    }
                break;
                }
            case EPaint:
                {
                DrawPaintL(iFillPaint, VG_MATRIX_FILL_PAINT_TO_USER, iLastFillPaintType, iLastFillPaintColor, VG_FILL_PATH);
                break;
                }
            case EColorRamp:
                {
                iNVGIconData->ReadInt32L();
                break;
                }
            case ETransform:
                {
                TInt flag;
                VGfloat transformMatrix[9];
                
                TPtr8 tmPtr((TUint8 *)transformMatrix, 9 * sizeof(VGfloat));
                
                iNVGIconData->ReadL(tmPtr, 9 * sizeof(VGfloat));
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:NVGCSIcon.cpp

示例14: Trigger

void TriggerET::InitializeEntity(
	Entity& entity,
	const EntityModuleParameters* spawnParams) const
{
	auto gameEM = entity.GetModule<GameEM>();
	auto physicsEM = entity.GetModule<PhysicsEM>();
	auto sceneEM = entity.GetModule<SceneEM>();

	const auto params = static_cast<const TriggerEMParams*>(spawnParams);
	auto& timeController = params->m_timeController;
	auto& comboController = params->m_comboController;
	auto& player = params->m_player;
	auto triggerType = params->m_triggerType;

	auto trigger = std::unique_ptr<Trigger>(
		new Trigger(triggerType, player, comboController, timeController));

	auto collisionBox = std::unique_ptr<CollisionBox>(new CollisionBox());
	switch (triggerType)
	{
	case TriggerTypeBoost30:
	case TriggerTypeBoost45:
	case TriggerTypeBoost60:
		collisionBox->SetPosition(Vec3f(0.0f, 100.0f, -1.175f));
		collisionBox->SetDimensions(Vec3f(0.5f, 100.0f, 0.625f));
		break;

	case TriggerTypeSlow:
	case TriggerTypeAngle:
	case TriggerTypeStop:
	case TriggerTypeBlock:
		collisionBox->SetPosition(Vec3f(0.0f, 100.0f, -0.55f));
		collisionBox->SetDimensions(Vec3f(0.5f, 100.0f, 1.25f));
		break;
	}
	physicsEM->AddCollisionShape(std::move(collisionBox));
	physicsEM->SetCollisionListener(trigger.get());
	physicsEM->SetImmovable(true);

	gameEM->SetGameObject(std::move(trigger));

	std::string activeTextureFilePath;
	std::string inactiveTextureFilePath;

	switch(triggerType)
	{
	case TriggerTypeBoost30:
		activeTextureFilePath = "Triggers/Boost30Active.png";
		inactiveTextureFilePath = "Triggers/Boost30Inactive.png";
		break;

	case TriggerTypeBoost45:
		activeTextureFilePath = "Triggers/Boost45Active.png";
		inactiveTextureFilePath = "Triggers/Boost45Inactive.png";
		break;

	case TriggerTypeBoost60:
		activeTextureFilePath = "Triggers/Boost60Active.png";
		inactiveTextureFilePath = "Triggers/Boost60Inactive.png";
		break;

	case TriggerTypeSlow:
		activeTextureFilePath = "Triggers/SlowActive.png";
		inactiveTextureFilePath = "Triggers/SlowInactive.png";
		break;

	case TriggerTypeAngle:
		activeTextureFilePath = "Triggers/Angle.png";
		inactiveTextureFilePath = activeTextureFilePath;
		break;

	case TriggerTypeStop:
		activeTextureFilePath = "Triggers/StopActive.png";
		inactiveTextureFilePath = "Triggers/StopInactive.png";
		break;

	case TriggerTypeBlock:
		activeTextureFilePath = "Triggers/BlockActive.png";
		inactiveTextureFilePath = "Triggers/BlockInactive.png";
		break;
	}

	auto activeModel = Model("nanaka/models/billboard.nmdl");
	Material activeMaterial(activeModel.GetMaterial());
	activeMaterial.SetTexture(Texture(activeTextureFilePath));
	activeModel.SetMaterial(activeMaterial);

	activeModel.SetPosition(Vec3f(0.0f, 0.0f, 0.0f));
	activeModel.SetRotation(Quat::NoRot());
	activeModel.SetScale(Vec3f(2.0f, 1.0f, 4.0f));

	sceneEM->SetAttachment<Model>(s_gfxIdActive, activeModel);

	auto inactiveModel = Model("nanaka/models/billboard.nmdl");
	Material inactiveMaterial(inactiveModel.GetMaterial());
	inactiveMaterial.SetTexture(Texture(inactiveTextureFilePath));
	inactiveModel.SetMaterial(inactiveMaterial);

	inactiveModel.SetPosition(Vec3f(0.0f, 0.0f, 0.0f));
	inactiveModel.SetRotation(Quat::NoRot());
//.........这里部分代码省略.........
开发者ID:mathall,项目名称:hobo,代码行数:101,代码来源:TriggerET.cpp

示例15: Graphics_Mesh

void Graphics_Mesh(bool isOpenGLMode)
{
	StartGraphicsTest();
	SetGLEnable(isOpenGLMode);

	asd::Log* log = asd::Log_Imp::Create(L"graphics.html", L"メッシュ");

	auto window = asd::Window_Imp::Create(640, 480, asd::ToAString(L"メッシュ").c_str());
	ASSERT_TRUE(window != nullptr);

	auto file = asd::File_Imp::Create();
	ASSERT_TRUE(file != nullptr);

	auto graphics = asd::Graphics_Imp::Create(window, isOpenGLMode ? asd::GraphicsDeviceType::OpenGL : asd::GraphicsDeviceType::DirectX11, log, file, false, false);
	ASSERT_TRUE(graphics != nullptr);

	auto renderer3d = new asd::Renderer3D(graphics, asd::RenderSettings());
	ASSERT_TRUE(renderer3d != nullptr);
	renderer3d->SetWindowSize(asd::Vector2DI(640, 480));

	auto mesh1 = CreateMesh(graphics);
	auto mesh2 = CreateMesh(graphics);
	auto deformer = CreateDeformer(graphics);
	auto animation = CreateAnimation();

	SetMeshBone(mesh2);

	mesh1->SendToGPUMemory();
	mesh2->SendToGPUMemory();

	auto cameraObject = new asd::RenderedCameraObject3D(graphics);
	cameraObject->SetPosition(asd::Vector3DF(0, 0, 10));
	cameraObject->SetFocus(asd::Vector3DF(0, 0, 0));
	cameraObject->SetFieldOfView(20.0f);
	cameraObject->SetZNear(1.0f);
	cameraObject->SetZFar(20.0f);
	cameraObject->SetWindowSize(asd::Vector2DI(800, 600));

	auto meshObject1 = new asd::RenderedModelObject3D(graphics);
	meshObject1->AddMesh(mesh1);
	
	meshObject1->SetPosition(asd::Vector3DF(1, 0, 0));
	meshObject1->SetRotation(asd::Vector3DF(20.0f, 20.0f, 0.0f));

	auto meshObject2 = new asd::RenderedModelObject3D(graphics);
	meshObject2->AddMesh(mesh2);
	meshObject2->SetDeformer(deformer.get());
	meshObject2->SetPosition(asd::Vector3DF(-1, 0, 0));
	meshObject2->SetRotation(asd::Vector3DF(20.0f, 20.0f, 0.0f));
	meshObject2->AddAnimationClip(asd::ToAString("anime1").c_str(), animation.get());
	meshObject2->PlayAnimation(0, asd::ToAString("anime1").c_str());

	auto lightObject = new asd::RenderedDirectionalLightObject3D(graphics);
	lightObject->SetRotation(asd::Vector3DF(30, 160, 0));

	renderer3d->AddObject(cameraObject);
	renderer3d->AddObject(meshObject1);
	renderer3d->AddObject(meshObject2);
	renderer3d->AddObject(lightObject);

	int32_t time = 0;
	while (window->DoEvent())
	{
		graphics->Begin();
		graphics->Clear(true, false, asd::Color(0, 0, 0, 255));

		renderer3d->Flip(1);

		renderer3d->BeginRendering(1);
		asd::Sleep(100);
		renderer3d->EndRendering();

		graphics->SetRenderTarget(nullptr, nullptr);
		graphics->Clear(true, false, asd::Color(0, 0, 0, 255));

		renderer3d->RenderResult();

		graphics->Present();

		graphics->End();

		if (time == 10)
		{
			SAVE_SCREEN_SHOT(graphics, 0);
		}

		if (time == 11)
		{
			window->Close();
		}
		time++;
	}

	meshObject1->Release();
	meshObject2->Release();

	cameraObject->Release();
	lightObject->Release();

	delete renderer3d;
//.........这里部分代码省略.........
开发者ID:Pctg-x8,项目名称:Altseed,代码行数:101,代码来源:asd.Mesh_Test.cpp


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