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


C++ IsEnabledEffective函数代码示例

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


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

示例1: Update

void SoundSource::Update(float timeStep)
{
    if (!audio_ || !IsEnabledEffective())
        return;

    // If there is no actual audio output, perform fake mixing into a nonexistent buffer to check stopping/looping
    if (!audio_->IsInitialized())
        MixNull(timeStep);

    // Free the stream if playback has stopped
    if (soundStream_ && !position_)
        StopLockless();

    // Check for autoremove
    if (autoRemove_)
    {
        if (!IsPlaying())
        {
            autoRemoveTimer_ += timeStep;
            if (autoRemoveTimer_ > AUTOREMOVE_DELAY)
            {
                Remove();
                // Note: this object is now deleted, so only returning immediately is safe
                return;
            }
        }
        else
            autoRemoveTimer_ = 0.0f;
    }
}
开发者ID:1vanK,项目名称:Urho3DQuake2,代码行数:30,代码来源:SoundSource.cpp

示例2: GetParentCompoundShape

void CollisionShape::NotifyRigidBody(bool updateMass)
{
    btCompoundShape* compound = GetParentCompoundShape();
    if (node_ && shape_ && compound)
    {
        // Remove the shape first to ensure it is not added twice
        compound->removeChildShape(shape_);
        
        if (IsEnabledEffective())
        {
            // Then add with updated offset
            Vector3 position = position_;
            // For terrains, undo the height centering performed automatically by Bullet
            if (shapeType_ == SHAPE_TERRAIN && geometry_)
            {
                HeightfieldData* heightfield = static_cast<HeightfieldData*>(geometry_.Get());
                position.y_ += (heightfield->minHeight_ + heightfield->maxHeight_) * 0.5f;
            }
            
            btTransform offset;
            offset.setOrigin(ToBtVector3(node_->GetWorldScale() * position));
            offset.setRotation(ToBtQuaternion(rotation_));
            compound->addChildShape(offset, shape_);
        }
        
        // Finally tell the rigid body to update its mass
        if (updateMass)
            rigidBody_->UpdateMass();
    }
}
开发者ID:gameogre,项目名称:Urho3D,代码行数:30,代码来源:CollisionShape.cpp

示例3: CreateJoint

void Constraint2D::OnSetEnabled()
{
    if (IsEnabledEffective())
        CreateJoint();
    else
        ReleaseJoint();
}
开发者ID:3dicc,项目名称:Urho3D,代码行数:7,代码来源:Constraint2D.cpp

示例4: GetEffectiveColor

void Light::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
{
    Color color = GetEffectiveColor();

    if (debug && IsEnabledEffective())
    {
        switch (lightType_)
        {
        case LIGHT_DIRECTIONAL:
            {
                Vector3 start = node_->GetWorldPosition();
                Vector3 end = start + node_->GetWorldDirection() * 10.f;
                for (int i = -1; i < 2; ++i)
                {
                    for (int j = -1; j < 2; ++j)
                    {
                        Vector3 offset = Vector3::UP * (5.f * i) + Vector3::RIGHT * (5.f * j);
                        debug->AddSphere(Sphere(start + offset, 0.1f), color, depthTest);
                        debug->AddLine(start + offset, end + offset, color, depthTest);
                    }
                }
            }
            break;

        case LIGHT_SPOT:
            debug->AddFrustum(GetFrustum(), color, depthTest);
            break;

        case LIGHT_POINT:
            debug->AddSphere(Sphere(node_->GetWorldPosition(), range_), color, depthTest);
            break;
        }
    }
}
开发者ID:caivega,项目名称:AtomicGameEngine,代码行数:34,代码来源:Light.cpp

示例5: Update

void SoundSource::Update(float timeStep)
{
    if (!audio_ || !IsEnabledEffective())
        return;

    // If there is no actual audio output, perform fake mixing into a nonexistent buffer to check stopping/looping
    if (!audio_->IsInitialized())
        MixNull(timeStep);

    // Free the stream if playback has stopped
    if (soundStream_ && !position_)
        StopLockless();
    bool playing = IsPlaying();

    if (!playing && sendFinishedEvent_)
    {
        sendFinishedEvent_ = false;

        // Make a weak pointer to self to check for destruction during event handling
        WeakPtr<SoundSource> self(this);

        soundFinished(node_,this,sound_);
        //TODO: verify same semantics as original : node_->SendEvent(E_SOUNDFINISHED, eventData);

        if (self.Expired())
            return;
        DoAutoRemove(autoRemove_);
    }
}
开发者ID:nemerle,项目名称:lutefisk3d,代码行数:29,代码来源:SoundSource.cpp

示例6: OnSetEnabled

void Zone::OnSetEnabled()
{
    // When a Zone is disabled, clear the cached zone from all drawables inside bounding box before removing from octree
    if (!IsEnabledEffective())
        OnMarkedDirty(node_);

    Drawable::OnSetEnabled();
}
开发者ID:gameogre,项目名称:Urho3D,代码行数:8,代码来源:Zone.cpp

示例7: IsEnabledEffective

void RigidBody::OnSetEnabled()
{
    bool enabled = IsEnabledEffective();

    if (enabled && !inWorld_)
        AddBodyToWorld();
    else if (!enabled && inWorld_)
        RemoveBodyFromWorld();
}
开发者ID:quinsmpang,项目名称:Urho3D,代码行数:9,代码来源:RigidBody.cpp

示例8: DrawDebugGeometry

void NavArea::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
{
    if (debug && IsEnabledEffective())
    {
        Matrix3x4 mat;
        mat.SetTranslation(node_->GetWorldPosition());
        debug->AddBoundingBox(boundingBox_, mat, Color::GREEN, depthTest);
    }
}
开发者ID:nonconforme,项目名称:Urho3D,代码行数:9,代码来源:NavArea.cpp

示例9: IsEnabledEffective

void CrowdAgent::OnSetEnabled()
{
    bool enabled = IsEnabledEffective();

    if (enabled && !inCrowd_)
        AddAgentToCrowd();
    else if (!enabled && inCrowd_)
        RemoveAgentFromCrowd();
}
开发者ID:vivienneanthony,项目名称:Urho3D-gameeconomic,代码行数:9,代码来源:CrowdAgent.cpp

示例10: IsEnabledEffective

void Drawable2D::OnSetEnabled()
{
    bool enabled = IsEnabledEffective();

    if (enabled && renderer_)
        renderer_->AddDrawable(this);
    else if (!enabled && renderer_)
        renderer_->RemoveDrawable(this);
}
开发者ID:zhzhxtrrk,项目名称:Urho3D,代码行数:9,代码来源:Drawable2D.cpp

示例11: Mix

void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolation)
{
    if (!position_ || (!sound_ && !soundStream_) || !IsEnabledEffective())
        return;

    int streamFilledSize, outBytes;

    if (soundStream_ && streamBuffer_)
    {
        int streamBufferSize = streamBuffer_->GetDataSize();
        // Calculate how many bytes of stream sound data is needed
        int neededSize = (int)((float)samples * frequency_ / (float)mixRate);
        // Add a little safety buffer. Subtract previous unused data
        neededSize += STREAM_SAFETY_SAMPLES;
        neededSize *= soundStream_->GetSampleSize();
        neededSize -= unusedStreamSize_;
        neededSize = Clamp(neededSize, 0, streamBufferSize - unusedStreamSize_);

        // Always start play position at the beginning of the stream buffer
        position_ = streamBuffer_->GetStart();

        // Request new data from the stream
        signed char* destination = streamBuffer_->GetStart() + unusedStreamSize_;
        outBytes = neededSize ? soundStream_->GetData(destination, (unsigned)neededSize) : 0;
        destination += outBytes;
        // Zero-fill rest if stream did not produce enough data
        if (outBytes < neededSize)
            memset(destination, 0, (size_t)(neededSize - outBytes));

        // Calculate amount of total bytes of data in stream buffer now, to know how much went unused after mixing
        streamFilledSize = neededSize + unusedStreamSize_;
    }

    // If streaming, play the stream buffer. Otherwise play the original sound
    Sound* sound = soundStream_ ? streamBuffer_ : sound_;
    if (!sound)
        return;

    // Update the time position. In stream mode, copy unused data back to the beginning of the stream buffer
    if (soundStream_)
    {
        timePosition_ += ((float)samples / (float)mixRate) * frequency_ / soundStream_->GetFrequency();

        unusedStreamSize_ = std::max(streamFilledSize - (int)(size_t)(position_ - streamBuffer_->GetStart()), 0);
        if (unusedStreamSize_)
            memcpy(streamBuffer_->GetStart(), (const void*)position_, (size_t)unusedStreamSize_);

        // If stream did not produce any data, stop if applicable
        if (!outBytes && soundStream_->GetStopAtEnd())
        {
            position_ = nullptr;
            return;
        }
    }
    else if (sound_)
        timePosition_ = ((float)(int)(size_t)(position_ - sound_->GetStart())) / (sound_->GetSampleSize() * sound_->GetFrequency());
}
开发者ID:nemerle,项目名称:lutefisk3d,代码行数:57,代码来源:SoundSource.cpp

示例12: IsEnabledEffective

void Drawable::OnSetEnabled()
{
    bool enabled = IsEnabledEffective();

    if (enabled && !octant_)
        AddToOctree();
    else if (!enabled && octant_)
        RemoveFromOctree();
}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:9,代码来源:Drawable.cpp

示例13: DrawDebugGeometry

void Constraint::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
{
    if (debug && physicsWorld_ && constraint_ && IsEnabledEffective())
    {
        physicsWorld_->SetDebugRenderer(debug);
        physicsWorld_->SetDebugDepthTest(depthTest);
        physicsWorld_->GetWorld()->debugDrawConstraint(constraint_);
        physicsWorld_->SetDebugRenderer(0);
    }
}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:10,代码来源:Constraint.cpp

示例14:

void Drawable2D::OnSetEnabled()
{
    if (!drawableProxy_)
        return;

    if (IsEnabledEffective())
        drawableProxy_->AddDrawable(this);
    else
        drawableProxy_->RemoveDrawable(this);
}
开发者ID:3dicc,项目名称:Urho3D,代码行数:10,代码来源:Drawable2D.cpp

示例15: IsEnabledEffective

void RigidBody2D::OnSetEnabled()
{
    bool enabled = IsEnabledEffective();

    bodyDef_.active = enabled;

    if (body_)
        body_->SetActive(enabled);
    
    MarkNetworkUpdate();
}
开发者ID:3dicc,项目名称:Urho3D,代码行数:11,代码来源:RigidBody2D.cpp


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