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


C++ GetScene函数代码示例

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


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


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