• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetScene函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetScene

void World::RenderAllChunks()
{
	viewerPosition = GetScene()->m_camera.m_position;

	// Enable arrays
	glEnable(GL_VERTEX_ARRAY);
	glEnable(GL_TEXTURE_COORD_ARRAY);
	glEnable(GL_NORMAL_ARRAY);

	for(int x = 0; x < m_chunksInX; x++)
		for(int y = 0; y < m_chunksInY; y++)
			for(int z = 0; z < m_chunksInZ; z++)
				if(!m_chunkMatrix[x][y][z].IsEmpty())
					m_chunkMatrix[x][y][z].Draw();

	VBO::Unbind(GL_ARRAY_BUFFER);

	// Disable arrays
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_NORMAL_ARRAY);
}
开发者ID:222464,项目名称:EvolvedVirtualCreaturesRepo,代码行数:22,代码来源:World.cpp


示例2: GetScene

void plSimulationMgr::UpdateAvatarInDetector(plKey world, plPXPhysical* detector)
{
    // search thru the actors in a scene looking for avatars that might be in the newly enabled detector region
    // ... and then send appropiate collision message if needed
    if ( detector->DoDetectorHullWorkaround() )
    {
        NxScene* scene = GetScene(world);
        if (scene)
        {
            uint32_t numActors = scene->getNbActors();
            NxActor** actors = scene->getActors();

            for (int i = 0; i < numActors; i++)
            {
                if ( actors[i]->userData == nil )
                {
                    // we go a controller
                    bool isController;
                    plPXPhysicalControllerCore* controller = plPXPhysicalControllerCore::GetController(*actors[i],&isController);
                    if (controller && controller->IsEnabled())
                    {
                        plKey avatar = controller->GetOwner();
                        plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->ObjectIsLoaded());
                        const plCoordinateInterface* ci;
                        if ( avObj && ( ci = avObj->GetCoordinateInterface() ) )
                        {
                            if ( detector->IsObjectInsideHull(ci->GetWorldPos()) )
                            {
                                detector->SetInsideConvexHull(true);
                                // we are entering this world... say we entered this detector
                                ISendCollisionMsg(detector->GetObjectKey(), avatar, true);
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:39,代码来源:plSimulationMgr.cpp


示例3: GetScene

        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        void State::OnInit()
        {
            GetScene()->SetClearColour(CS::Colour(0.9f, 0.9f, 0.9f, 1.0f));
            
            m_httpRequestSystem = CS::Application::Get()->GetSystem<CS::HttpRequestSystem>();
            CS_ASSERT(m_httpRequestSystem, "Cannot complete HttpRequest smoke test as the system could not be created!");
            
            const u32 k_downloadBufferSize = 100 * 1024;
            m_httpRequestSystem->SetMaxBufferSize(k_downloadBufferSize);
            
            Common::OptionsMenuDesc optionsMenuDesc;

            optionsMenuDesc.AddButton("Test download progress", [=]()
            {
                //TODO: This doesn't work on iOS as HTTP requests aren't allowed. We need to find a file that can be downloaded over HTTPS for testing.
                m_downloadProgressTestSystem->StartDownloadTest("http://download.thinkbroadband.com/5MB.zip", [=](const CS::HttpResponse& in_completeResponse)
                {
                    PresentHttpResponse(in_completeResponse);
                });
            });
            
            m_optionsMenuPresenter->Present(optionsMenuDesc);
        }
开发者ID:ChilliWorks,项目名称:CSTest,代码行数:25,代码来源:State.cpp


示例4: OnNodeSet

void UIComponent::OnNodeSet(Node* node)
{
    rootElement_->SetNode(node);
    if (node)
    {
        auto* renderer = GetSubsystem<Renderer>();
        auto* model = node->GetComponent<StaticModel>();
        rootElement_->SetViewport(renderer->GetViewportForScene(GetScene(), viewportIndex_));
        if (model == nullptr)
            model_ = model = node->CreateComponent<StaticModel>();
        model->SetMaterial(material_);
        rootElement_->SetRenderTexture(texture_);
    }
    else
    {
        rootElement_->SetRenderTexture(nullptr);
        if (model_.NotNull())
        {
            model_->Remove();
            model_ = nullptr;
        }
    }
}
开发者ID:weitjong,项目名称:Urho3D,代码行数:23,代码来源:UIComponent.cpp


示例5: StopFollowing

void CSyncCoreObjectMediator::IntEndTransferObject()
{
	if( !IsActive() )
		StopFollowing();	//这里无需进行StopMoving,让下面的函数通过基类完成这个事情

	if( m_pConn )
		GetScene()->DelFromMulticast( m_pConn );


	CSyncCoreObjectServer::IntEndTransferObject();

	m_bDisbindingConn = false;
	m_fDirKnownMaxSpeed = 0;
	
	if( !m_pConn )
		return;

	AddConnBlockCount();

	SetClientMainScene();

	CSyncCoreObjectServer::SetEyeSight( m_fZeroDimEyeSight, 0 );
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:23,代码来源:CSyncCoreObjectMediator.cpp


示例6: GetScene

void CollisionShape::OnNodeSet(Node* node)
{
    if (node)
    {
        Scene* scene = GetScene();
        if (scene)
        {
            if (scene == node)
                LOGWARNING(GetTypeName() + " should not be created to the root scene node");

            physicsWorld_ = scene->GetOrCreateComponent<PhysicsWorld>();
            physicsWorld_->AddCollisionShape(this);
        }
        else
            LOGERROR("Node is detached from scene, can not create collision shape");

        node->AddListener(this);
        cachedWorldScale_ = node->GetWorldScale();

        // Terrain collision shape depends on the terrain component's geometry updates. Subscribe to them
        SubscribeToEvent(node, E_TERRAINCREATED, HANDLER(CollisionShape, HandleTerrainCreated));
    }
}
开发者ID:AGreatFish,项目名称:Urho3D,代码行数:23,代码来源:CollisionShape.cpp


示例7: GetScene

void StaticModelGroup::ApplyAttributes()
{
    if (!nodeIDsDirty_)
        return;
    
    // Remove all old instance nodes before searching for new. Can not call RemoveAllInstances() as that would modify
    // the ID list on its own
    for (unsigned i = 0; i < instanceNodes_.Size(); ++i)
    {
        Node* node = instanceNodes_[i];
        if (node)
            node->RemoveListener(this);
    }
    
    instanceNodes_.Clear();
    
    Scene* scene = GetScene();
    
    if (scene)
    {
        // The first index stores the number of IDs redundantly. This is for editing
        for (unsigned i = 1; i < nodeIDsAttr_.Size(); ++i)
        {
            Node* node = scene->GetNode(nodeIDsAttr_[i].GetUInt());
            if (node)
            {
                WeakPtr<Node> instanceWeak(node);
                node->AddListener(this);
                instanceNodes_.Push(instanceWeak);
            }
        }
    }
    
    worldTransforms_.Resize(instanceNodes_.Size());
    nodeIDsDirty_ = false;
    OnMarkedDirty(GetNode());
}
开发者ID:LuisAntonRebollo,项目名称:Urho3D,代码行数:37,代码来源:StaticModelGroup.cpp


示例8: GetScene

void StaticModelGroup::ApplyAttributes()
{
    if (!nodesDirty_)
        return;

    // Remove all old instance nodes before searching for new
    for (unsigned i = 0; i < instanceNodes_.Size(); ++i)
    {
        Node* node = instanceNodes_[i];
        if (node)
            node->RemoveListener(this);
    }

    instanceNodes_.Clear();

    Scene* scene = GetScene();
    if (scene)
    {
        // The first index stores the number of IDs redundantly. This is for editing
        for (unsigned i = 1; i < nodeIDsAttr_.Size(); ++i)
        {
            Node* node = scene->GetNode(nodeIDsAttr_[i].GetUInt());
            if (node)
            {
                WeakPtr<Node> instanceWeak(node);
                node->AddListener(this);
                instanceNodes_.Push(instanceWeak);
            }
        }
    }

    worldTransforms_.Resize(instanceNodes_.Size());
    numWorldTransforms_ = 0; // Correct amount will be found during world bounding box update
    nodesDirty_ = false;

    OnMarkedDirty(GetNode());
}
开发者ID:tungsteen,项目名称:Urho3D,代码行数:37,代码来源:StaticModelGroup.cpp


示例9: GetScene

void Vehicle::InitWheel(const String& name, const Vector3& offset, WeakPtr<Node>& wheelNode, unsigned& wheelNodeID)
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();

    // Note: do not parent the wheel to the hull scene node. Instead create it on the root level and let the physics
    // constraint keep it together
    wheelNode = GetScene()->CreateChild(name);
    wheelNode->SetPosition(node_->LocalToWorld(offset));
    wheelNode->SetRotation(node_->GetRotation() * (offset.x_ >= 0.0 ? Quaternion(0.0f, 0.0f, -90.0f) :
        Quaternion(0.0f, 0.0f, 90.0f)));
    wheelNode->SetScale(Vector3(0.8f, 0.5f, 0.8f));
    // Remember the ID for serialization
    wheelNodeID = wheelNode->GetID();

    StaticModel* wheelObject = wheelNode->CreateComponent<StaticModel>();
    RigidBody* wheelBody = wheelNode->CreateComponent<RigidBody>();
    CollisionShape* wheelShape = wheelNode->CreateComponent<CollisionShape>();
    Constraint* wheelConstraint = wheelNode->CreateComponent<Constraint>();

    wheelObject->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
    wheelObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
    wheelObject->SetCastShadows(true);
    wheelShape->SetSphere(1.0f);
    wheelBody->SetFriction(1.0f);
    wheelBody->SetMass(1.0f);
    wheelBody->SetLinearDamping(0.2f); // Some air resistance
    wheelBody->SetAngularDamping(0.75f); // Could also use rolling friction
    wheelBody->SetCollisionLayer(1);
    wheelConstraint->SetConstraintType(CONSTRAINT_HINGE);
    wheelConstraint->SetOtherBody(GetComponent<RigidBody>()); // Connect to the hull body
    wheelConstraint->SetWorldPosition(wheelNode->GetPosition()); // Set constraint's both ends at wheel's location
    wheelConstraint->SetAxis(Vector3::UP); // Wheel rotates around its local Y-axis
    wheelConstraint->SetOtherAxis(offset.x_ >= 0.0 ? Vector3::RIGHT : Vector3::LEFT); // Wheel's hull axis points either left or right
    wheelConstraint->SetLowLimit(Vector2(-180.0f, 0.0f)); // Let the wheel rotate freely around the axis
    wheelConstraint->SetHighLimit(Vector2(180.0f, 0.0f));
    wheelConstraint->SetDisableCollision(true); // Let the wheel intersect the vehicle hull
}
开发者ID:ClockTeam,项目名称:Clockwork,代码行数:37,代码来源:Vehicle.cpp


示例10: GetScene

void Player::Raycast(const GameContext& gameContext)
{
	GameScene* scene = GetScene();

	XMFLOAT3 pos = GetTransform()->GetPosition();
	XMFLOAT3 fw = GetTransform()->GetForward();
	PxVec3 rayOrigin(pos.x,pos.y + 1.f,pos.z), rayDirection(fw.x,fw.y,fw.z);
	rayOrigin.x += fw.x * 2.5f;
	rayOrigin.z += fw.z * 2.5f;

	const PxU32 bufSize = 20;
	PxRaycastHit hit[bufSize];
	PxRaycastBuffer buf(hit, bufSize); // [out] Blocking and touching hits will be stored here

	if(scene->GetPhysxProxy()->Raycast(rayOrigin, rayDirection, 5000, buf))
	{
		for(PxU32 i = 0; i < buf.nbTouches; ++i)
		{
			BaseComponent* component = static_cast<BaseComponent*>(buf.touches[i].actor->userData);
			GameObject* go = component->GetGameObject();
			string name = go->GetName();	
			cout << "RAYCAST OBJECT: " << name << endl;		

			if(name == "Enemy")
			{
				Enemy* enemy = reinterpret_cast<Enemy*>(go);
				int dmg = 12.5f;
				enemy->Damage(dmg);
			}
		}

		PxVec3 vel = rayDirection * 1000;
		auto laser = new Laser(XMFLOAT3(vel.x, vel.y, vel.z));
		AddChild(laser);
	}
}
开发者ID:Kwintenvdb,项目名称:DirectX-Turret-Game,代码行数:36,代码来源:Player.cpp


示例11: GetScene

void RigidBody2D::OnMarkedDirty(Node* node)
{
    if (physicsWorld_ && physicsWorld_->IsApplyingTransforms())
        return;

    // Physics operations are not safe from worker threads
    Scene* scene = GetScene();
    if (scene && scene->IsThreadedUpdate())
    {
        scene->DelayedMarkedDirty(this);
        return;
    }

    // Check if transform has changed from the last one set in ApplyWorldTransform()
    b2Vec2 newPosition = ToB2Vec2(node_->GetWorldPosition());
    float newAngle = node_->GetWorldRotation().RollAngle() * M_DEGTORAD;
    if (newPosition != bodyDef_.position || newAngle != bodyDef_.angle)
    {
        bodyDef_.position = newPosition;
        bodyDef_.angle = newAngle;
        if (body_)
            body_->SetTransform(newPosition, newAngle);
    }
}
开发者ID:3dicc,项目名称:Urho3D,代码行数:24,代码来源:RigidBody2D.cpp


示例12: ViewFamily

void FPhATEdPreviewViewportClient::SimMouseMove(float DeltaX, float DeltaY)
{

	DragX = Viewport->GetMouseX() - SharedData->LastClickPos.X;
	DragY = Viewport->GetMouseY() - SharedData->LastClickPos.Y;

	if (!SharedData->MouseHandle->GrabbedComponent)
	{
		return;
	}

	//We need to convert Pixel Delta into Screen position (deal with different viewport sizes)
	FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues( Viewport, GetScene(), EngineShowFlags ));
	FSceneView* View = CalcSceneView(&ViewFamily);
	FVector4 ScreenOldPos = View->PixelToScreen(SharedData->LastClickPos.X, SharedData->LastClickPos.Y, 1.f);
	FVector4 ScreenNewPos = View->PixelToScreen(DragX + SharedData->LastClickPos.X, DragY + SharedData->LastClickPos.Y, 1.f);
	FVector4 ScreenDelta = ScreenNewPos - ScreenOldPos;
	FVector4 ProjectedDelta = View->ScreenToWorld(ScreenDelta);
	FVector4 WorldDelta;

	//Now we project new ScreenPos to xy-plane of SimGrabLocation
	FVector LocalOffset = View->ViewMatrices.ViewMatrix.TransformPosition(SimGrabLocation + SimGrabZ * SimGrabPush);
	float ZDistance = GetViewportType() == ELevelViewportType::LVT_Perspective ? fabs(LocalOffset.Z) : 1.f;	//in the ortho case we don't need to do any fixup because there is no perspective
	WorldDelta = ProjectedDelta * ZDistance;
	
	//Now we convert back into WorldPos
	FVector WorldPos = SimGrabLocation + WorldDelta + SimGrabZ * SimGrabPush;
	FVector NewLocation = WorldPos;
	float QuickRadius = 5 - SimGrabPush / SimHoldDistanceChangeDelta;
	QuickRadius = QuickRadius < 2 ? 2 : QuickRadius;

	DrawDebugPoint(GetWorld(), NewLocation, QuickRadius, FColorList::Red, false, 0.3);

	SharedData->MouseHandle->SetTargetLocation(NewLocation);
	SharedData->MouseHandle->GrabbedComponent->WakeRigidBody(SharedData->MouseHandle->GrabbedBoneName);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:36,代码来源:PhATPreviewViewportClient.cpp


示例13: GetSceneEditor

bool CubemapGenerator::InitRender()
{

    sceneEditor_ = GetSceneEditor();

    if (sceneEditor_.Null())
    {
        LOGERROR("CubemapGenerator::InitRender - unable to get scene editor");
        return false;
    }

    if (!InitPaths())
        return false;

    cameraNode_ = node_->CreateChild("CubeMapRenderCamera");
    cameraNode_->SetTemporary(true);

    camera_ = cameraNode_->CreateComponent<Camera>();
    camera_->SetTemporary(true);
    camera_->SetFov(90.0f);
    camera_->SetNearClip(0.0001f);
    camera_->SetAspectRatio(1.0f);

    RenderPath* renderPath = sceneEditor_->GetSceneView3D()->GetViewport()->GetRenderPath();
    viewport_ = new Viewport(context_, GetScene(), camera_, renderPath);

    renderImage_ = new Texture2D(context_);
    renderImage_->SetSize(imageSize_, imageSize_, Graphics::GetRGBAFormat(), TEXTURE_RENDERTARGET);

    renderSurface_ = renderImage_->GetRenderSurface();
    renderSurface_->SetViewport(0, viewport_);
    renderSurface_->SetUpdateMode(SURFACE_UPDATEALWAYS);

    return true;

}
开发者ID:GREYFOXRGR,项目名称:AtomicGameEngine,代码行数:36,代码来源:CubemapGenerator.cpp


示例14: GetScene

void RigidBody::OnNodeSet(Node* node)
{
    if (node)
    {
        Scene* scene = GetScene();
        if (scene)
        {
            if (scene == node)
                LOGWARNING(GetTypeName() + " should not be created to the root scene node");

            physicsWorld_ = scene->GetComponent<PhysicsWorld>();
            if (physicsWorld_)
                physicsWorld_->AddRigidBody(this);
            else
                LOGERROR("No physics world component in scene, can not create rigid body");

            AddBodyToWorld();
        }
        else
            LOGERROR("Node is detached from scene, can not create rigid body");
        
        node->AddListener(this);
    }
}
开发者ID:PeteX,项目名称:Urho3D,代码行数:24,代码来源:RigidBody.cpp


示例15: GetScene

void Node::SetNetParentAttr(const PODVector<unsigned char>& value)
{
    Scene* scene = GetScene();
    if (!scene)
        return;
    
    MemoryBuffer buf(value);
    // If nothing in the buffer, parent is the root node
    if (buf.IsEof())
    {
        scene->AddChild(this);
        return;
    }
    
    unsigned baseNodeID = buf.ReadNetID();
    Node* baseNode = scene->GetNode(baseNodeID);
    if (!baseNode)
    {
        LOGWARNING("Failed to find parent node " + String(baseNodeID));
        return;
    }
    
    // If buffer contains just an ID, the parent is replicated and we are done
    if (buf.IsEof())
        baseNode->AddChild(this);
    else
    {
        // Else the parent is local and we must find it recursively by name hash
        StringHash nameHash = buf.ReadStringHash();
        Node* parentNode = baseNode->GetChild(nameHash, true);
        if (!parentNode)
            LOGWARNING("Failed to find parent node with name hash " + nameHash.ToString());
        else
            parentNode->AddChild(this);
    }
}
开发者ID:acremean,项目名称:urho3d,代码行数:36,代码来源:Node.cpp


示例16: CS_ASSERT

        //-------------------------------------------------------------
		//-------------------------------------------------------------
		void Entity::AddComponent(const ComponentSPtr& in_component)
		{
            CS_ASSERT(in_component != nullptr, "Cannot add null component");
            CS_ASSERT(in_component->GetEntity() == nullptr, "Component cannot be attached to more than 1 entity at a time.");
            
            m_components.push_back(in_component);
            
            in_component->SetEntity(this);
            
            in_component->OnAddedToEntity();
            
            if(GetScene() != nullptr)
            {
                in_component->OnAddedToScene();
                if (m_appActive == true)
                {
                    in_component->OnResume();
                    if (m_appForegrounded == true)
                    {
                        in_component->OnForeground();
                    }
                }
            }
		}
开发者ID:mclaughlinhugh4,项目名称:ChilliSource,代码行数:26,代码来源:Entity.cpp


示例17: GetScene

void FPreviewScene::AddComponent(UActorComponent* Component,const FTransform& LocalToWorld)
{
	Components.AddUnique(Component);

	USceneComponent* SceneComp = Cast<USceneComponent>(Component);
	if(SceneComp && SceneComp->GetAttachParent() == NULL)
	{
		SceneComp->SetRelativeTransform(LocalToWorld);
	}

	Component->RegisterComponentWithWorld(GetWorld());

	if (bForceAllUsedMipsResident)
	{
		// Add a mip streaming override to the new mesh
		UMeshComponent* pMesh = Cast<UMeshComponent>(Component);
		if (pMesh != NULL)
		{
			pMesh->SetTextureForceResidentFlag(true);
		}
	}

	GetScene()->UpdateSpeedTreeWind(0.0);
}
开发者ID:stoneStyle,项目名称:Unreal4,代码行数:24,代码来源:PreviewScene.cpp


示例18: GetScene

	void Layer::EndDrawing()
	{
		m_commonObject->EndDrawing();

		if (m_postEffects.size() > 0)
		{
			for (auto& p : m_postEffects)
			{
				GetScene()->m_coreScene->BeginPostEffect(p->GetCoreObject());

				GetScene()->m_coreScene->GetSrcTarget()->AddRef();
				GetScene()->m_coreScene->GetDstTarget()->AddRef();

				auto src = CreateSharedPtrWithReleaseDLL(GetScene()->m_coreScene->GetSrcTarget());
				auto dst = CreateSharedPtrWithReleaseDLL(GetScene()->m_coreScene->GetDstTarget());
				
				p->OnDraw(dst, src);

				GetScene()->m_coreScene->EndPostEffect(p->GetCoreObject());
			}
		}
	}
开发者ID:weiron,项目名称:amusement-creators-engine,代码行数:22,代码来源:ace.Layer.cpp


示例19: getNodeId

BabylonCamera::BabylonCamera(BabylonNode& babnode)
{
	auto node = babnode.fbxNode();
	std::string ansiName = node->GetName();
	name = std::wstring(ansiName.begin(), ansiName.end());
	id = getNodeId(node);
	auto parent = node->GetParent();
	if (parent) {
		parentId = getNodeId(parent);
	}
	auto camera = node->GetCamera();
	if (!camera) {
		return;
	}
	type = L"FreeCamera";
	auto targetNode = node->GetTarget();
	if (targetNode) {
		lockedTargetId = getNodeId(targetNode);
	}
	else {
		target = camera->InterestPosition.Get();
	}
	position = babnode.localTranslate();
	rotationQuaternion = babnode.localRotationQuat();
	
	fov = camera->FieldOfViewY * Euler2Rad;
	minZ = camera->FrontPlaneDistance.Get();
	maxZ = camera->BackPlaneDistance.Get();

	auto hasAnimStack = node->GetScene()->GetSrcObjectCount<FbxAnimStack>() > 0;
	if (!hasAnimStack){
		return;
	}
	auto animStack = node->GetScene()->GetSrcObject<FbxAnimStack>(0);
	FbxString animStackName = animStack->GetName();
	FbxTakeInfo* takeInfo = node->GetScene()->GetTakeInfo(animStackName);
	auto animTimeMode = GlobalSettings::Current().AnimationsTimeMode;
	auto animFrameRate = GlobalSettings::Current().AnimationsFrameRate();
	auto startFrame = takeInfo->mLocalTimeSpan.GetStart().GetFrameCount(animTimeMode);
	auto endFrame = takeInfo->mLocalTimeSpan.GetStop().GetFrameCount(animTimeMode);
	auto animLengthInFrame = endFrame - startFrame + 1;

	auto posAnim = std::make_shared<BabylonAnimation<babylon_vector3>>(BabylonAnimationBase::loopBehavior_Cycle, animFrameRate, L"position", L"position", true, 0, animLengthInFrame, true);
	auto rotAnim = std::make_shared<BabylonAnimation<babylon_vector4>>(BabylonAnimationBase::loopBehavior_Cycle, animFrameRate, L"rotation", L"rotation", true, 0, animLengthInFrame, true);
	auto targetAnim = std::make_shared<BabylonAnimation<babylon_vector3>>(BabylonAnimationBase::loopBehavior_Cycle, animFrameRate, L"target", L"target", true, 0, animLengthInFrame, true);
	
	for (auto ix = 0ll; ix < animLengthInFrame; ix++){
		FbxTime currTime;
		currTime.SetFrame(startFrame + ix, animTimeMode);

		babylon_animation_key<babylon_vector3> poskey;
		babylon_animation_key<babylon_vector4> rotkey;
		poskey.frame = ix;
		rotkey.frame = ix;

		poskey.values = babnode.localTranslate(currTime);
		rotkey.values = babnode.localRotationQuat(currTime);
		posAnim->appendKey(poskey);
		rotAnim->appendKey(rotkey);

		if (lockedTargetId.size() == 0){

			babylon_animation_key<babylon_vector3> targetKey;
			targetKey.frame = ix;
			targetKey.values = camera->InterestPosition.EvaluateValue(currTime);
			targetAnim->appendKey(targetKey);
		}
	}
	if (!posAnim->isConstant()){
		animations.push_back(posAnim);
	}
	if (!rotAnim->isConstant()){
		quatAnimations.push_back(rotAnim);
	}
	if (!targetAnim->isConstant()){
		animations.push_back(targetAnim);
	}
}
开发者ID:Gpinchon,项目名称:Babylon.js,代码行数:78,代码来源:BabylonCamera.cpp


示例20: assert

bool SceneObject_Door::Create(const std::string &doorModelName, const Vec3f &pos, float angle, bool openCW)
{
	assert(!m_created);

	Scene* pScene = GetScene();

	assert(pScene != NULL);

	Asset* pDoorModelAsset;
	
	if(!pScene->GetAssetManager_AutoCreate("modelOBJ", Model_OBJ::Asset_Factory)->GetAsset(doorModelName, pDoorModelAsset))
		return false;

	m_pDoorModel = static_cast<Model_OBJ*>(pDoorModelAsset);
	m_pDoorModel->SetRenderer(GetScene());

	// Default texture setting: nearest filtering
	for(unsigned int i = 0, size = m_pDoorModel->GetNumMaterials(); i < size; i++)
	{
		Model_OBJ::Material* pMat = m_pDoorModel->GetMaterial(i);
		
		pMat->m_pDiffuseMap->Bind();
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

		if(pMat->m_pSpecularMap != NULL)
		{
			pMat->m_pSpecularMap->Bind();
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		}

		if(pMat->m_pNormalMap != NULL)
		{
			pMat->m_pNormalMap->Bind();
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		}
	}

	// Sound effects
	SoundSystem* pSoundSystem = static_cast<SoundSystem*>(pScene->GetNamed_Effect("sndsys"));

	assert(pSoundSystem != NULL);

	Asset* pAsset;

	if(!pSoundSystem->m_sound_effect_manager.GetAsset("data/sounds/doorOpen.wav", pAsset))
		abort();

	m_pOpenSoundEffect = static_cast<Sound_Effect*>(pAsset);

	assert(m_pOpenSoundEffect != NULL);

	if(!pSoundSystem->m_sound_effect_manager.GetAsset("data/sounds/doorClose.wav", pAsset))
		abort();

	m_pCloseSoundEffect = static_cast<Sound_Effect*>(pAsset);

	assert(m_pCloseSoundEffect != NULL);

	m_pos = pos;
	m_angle = angle;

	m_openCW = openCW;

	RegenAABB();

	// Set up sound source
	m_doorSource.SetPosition(m_pos);
	m_doorSource.SetVelocity(Vec3f(0.0f, 0.0f, 0.0f));
	m_doorSource.SetGain(1.0f);
	m_doorSource.SetLooping(false);

	m_created = true;

	return true;
}
开发者ID:222464,项目名称:EvolvedVirtualCreaturesRepo,代码行数:78,代码来源:SceneObject_Door.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetScreen函数代码示例发布时间:2022-05-30
下一篇:
C++ GetScale函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap