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

C++ GP_ASSERT函数代码示例

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

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



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

示例1: GP_ASSERT

void PhysicsRigidBody::applyImpulse(const Vector3& impulse, const Vector3* relativePosition)
{
    // If the impulse is significant enough, activate the rigid body 
    // to make sure that it isn't sleeping and apply the impulse.
    if (impulse.lengthSquared() > MATH_EPSILON)
    {
        GP_ASSERT(_body);
        _body->activate();
        if (relativePosition)
        {
            _body->applyImpulse(BV(impulse), BV(*relativePosition));
        }
        else
            _body->applyCentralImpulse(BV(impulse));
    }
}
开发者ID:BernardsRegards,项目名称:GamePlay,代码行数:16,代码来源:PhysicsRigidBody.cpp


示例2: _vertexSize

VertexFormat::VertexFormat(const Element* elements, unsigned int elementCount)
    : _vertexSize(0)
{
    GP_ASSERT(elements);

    // Copy elements and compute vertex size
    for (unsigned int i = 0; i < elementCount; ++i)
    {
        // Copy element
        Element element;
        memcpy(&element, &elements[i], sizeof(Element));
        _elements.push_back(element);

        _vertexSize += element.size * sizeof(float);
    }
}
开发者ID:ArtProgrammer,项目名称:game-play,代码行数:16,代码来源:VertexFormat.cpp


示例3: GP_ASSERT

void Vec2::clamp(const Vec2& min, const Vec2& max)
{
    GP_ASSERT(!(min.x > max.x || min.y > max.y ));

    // Clamp the x value.
    if (x < min.x)
        x = min.x;
    if (x > max.x)
        x = max.x;

    // Clamp the y value.
    if (y < min.y)
        y = min.y;
    if (y > max.y)
        y = max.y;
}
开发者ID:253056965,项目名称:cocos2d-x-lite,代码行数:16,代码来源:Vec2.cpp


示例4: GP_ASSERT

const ScriptTarget::Event* ScriptTarget::getScriptEvent(const char* eventName) const
{
    GP_ASSERT(eventName);

    // Lookup the event for this name
    const Event* event = NULL;
    RegistryEntry* re = _scriptRegistries;
    while (re)
    {
        if ((event = re->registry->getEvent(eventName)) != NULL)
            break;
        re = re->next;
    }

    return event;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:16,代码来源:ScriptTarget.cpp


示例5: GP_ASSERT

void Transform::removeListener(Transform::Listener* listener)
{
    GP_ASSERT(listener);

    if (_listeners)
    {
        for (std::list<TransformListener>::iterator itr = _listeners->begin(); itr != _listeners->end(); ++itr)
        {
            if ((*itr).listener == listener)
            {
                _listeners->erase(itr);
                break;
            }
        }
    }
}
开发者ID:whztt07,项目名称:GamePlay,代码行数:16,代码来源:Transform.cpp


示例6: SAFE_DELETE

PhysicsCollisionObject::~PhysicsCollisionObject()
{
    SAFE_DELETE(_motionState);

    if (_scriptListeners)
    {
        for (unsigned int i = 0; i < _scriptListeners->size(); i++)
        {
            SAFE_DELETE((*_scriptListeners)[i]);
        }
        SAFE_DELETE(_scriptListeners);
    }

    GP_ASSERT(Game::getInstance()->getPhysicsController());
    Game::getInstance()->getPhysicsController()->destroyShape(_collisionShape);
}
开发者ID:bigianb,项目名称:GamePlay,代码行数:16,代码来源:PhysicsCollisionObject.cpp


示例7: GP_ASSERT

void Plane::intersection(const Plane& p1, const Plane& p2, const Plane& p3, kmVec3* point)
{
    GP_ASSERT(point);

    // The planes' normals must be all normalized (which we guarantee in the Plane class).
    // Calculate the determinant of the kmMat4 (i.e | n1 n2 n3 |).
    float det = p1._normal.x * (p2._normal.y * p3._normal.z -
                p2._normal.z * p3._normal.y) - p2._normal.x *(p1._normal.y * p3._normal.z -
                p1._normal.z * p3._normal.y) + p3._normal.x * (p1._normal.y * p2._normal.z - p1._normal.z * p2._normal.y);

    // If the determinant is zero, then the planes do not all intersect.
    if (fabs(det) <= MATH_EPSILON)
        return;

    // Create 3 points, one on each plane.
    // (We just pick the point on the plane directly along its normal from the origin).
    float p1x = -p1._normal.x * p1._distance;
    float p1y = -p1._normal.y * p1._distance;
    float p1z = -p1._normal.z * p1._distance;
    float p2x = -p2._normal.x * p2._distance;
    float p2y = -p2._normal.y * p2._distance;
    float p2z = -p2._normal.z * p2._distance;
    float p3x = -p3._normal.x * p3._distance;
    float p3y = -p3._normal.y * p3._distance;
    float p3z = -p3._normal.z * p3._distance;

    // Calculate the cross products of the normals.
    float c1x = (p2._normal.y * p3._normal.z) - (p2._normal.z * p3._normal.y);
    float c1y = (p2._normal.z * p3._normal.x) - (p2._normal.x * p3._normal.z);
    float c1z = (p2._normal.x * p3._normal.y) - (p2._normal.y * p3._normal.x);
    float c2x = (p3._normal.y * p1._normal.z) - (p3._normal.z * p1._normal.y);
    float c2y = (p3._normal.z * p1._normal.x) - (p3._normal.x * p1._normal.z);
    float c2z = (p3._normal.x * p1._normal.y) - (p3._normal.y * p1._normal.x);
    float c3x = (p1._normal.y * p2._normal.z) - (p1._normal.z * p2._normal.y);
    float c3y = (p1._normal.z * p2._normal.x) - (p1._normal.x * p2._normal.z);
    float c3z = (p1._normal.x * p2._normal.y) - (p1._normal.y * p2._normal.x);

    // Calculate the point of intersection using the formula:
    // x = (| n1 n2 n3 |)^-1 * [(x1 * n1)(n2 x n3) + (x2 * n2)(n3 x n1) + (x3 * n3)(n1 x n2)]
    float s1 = p1x * p1._normal.x + p1y * p1._normal.y + p1z * p1._normal.z;
    float s2 = p2x * p2._normal.x + p2y * p2._normal.y + p2z * p2._normal.z;
    float s3 = p3x * p3._normal.x + p3y * p3._normal.y + p3z * p3._normal.z;
    float detI = 1.0f / det;
    point->x = (s1 * c1x + s2 * c2x + s3 * c3x) * detI;
    point->y = (s1 * c1y + s2 * c2y + s3 * c3y) * detI;
    point->z = (s1 * c1z + s2 * c2z + s3 * c3z) * detI;
}
开发者ID:dtbinh,项目名称:Game3D,代码行数:47,代码来源:Plane.cpp


示例8: trackRef

void* trackRef(Ref* ref)
{
    GP_ASSERT(ref);

    // Create memory allocation record.
    RefAllocationRecord* rec = (RefAllocationRecord*)malloc(sizeof(RefAllocationRecord));
    rec->ref = ref;
    rec->next = __refAllocations;
    rec->prev = 0;

    if (__refAllocations)
        __refAllocations->prev = rec;
    __refAllocations = rec;
    ++__refAllocationCount;

    return rec;
}
开发者ID:ArtProgrammer,项目名称:game-play,代码行数:17,代码来源:Ref.cpp


示例9: GP_ASSERT

AnimationClip* Animation::findClip(const char* id) const
{
    if (_clips)
    {
        size_t clipCount = _clips->size();
        for (size_t i = 0; i < clipCount; i++)
        {
            AnimationClip* clip = _clips->at(i);
            GP_ASSERT(clip);
            if (clip->_id.compare(id) == 0)
            {
                return clip;
            }
        }
    }
    return NULL;
}
开发者ID:1timmy,项目名称:GamePlay,代码行数:17,代码来源:Animation.cpp


示例10: resetClipStateBit

void AnimationClip::onEnd()
{
    _blendWeight = 1.0f;
    resetClipStateBit(CLIP_ALL_BITS);

    // Notify end listeners if any.
    if (_endListeners)
    {
        std::vector<Listener*>::iterator listener = _endListeners->begin();
        while (listener != _endListeners->end())
        {
            GP_ASSERT(*listener);
            (*listener)->animationEvent(this, Listener::END);
            listener++;
        }
    }
}
开发者ID:Lubee,项目名称:GamePlay,代码行数:17,代码来源:AnimationClip.cpp


示例11: GP_ASSERT

AudioSource* AudioSource::create(Properties* properties)
{
    // Check if the properties is valid and has a valid namespace.
    GP_ASSERT(properties);
    if (!properties || !(strcmp(properties->getNamespace(), "audio") == 0))
    {
        GP_ERROR("Failed to load audio source from properties object: must be non-null object and have namespace equal to 'audio'.");
        return NULL;
    }

    std::string path;
    if (!properties->getPath("path", &path))
    {
        GP_ERROR("Audio file failed to load; the file path was not specified.");
        return NULL;
    }

    // Create the audio source.
    AudioSource* audio = AudioSource::create(path.c_str());
    if (audio == NULL)
    {
        GP_ERROR("Audio file '%s' failed to load properly.", path.c_str());
        return NULL;
    }

    // Set any properties that the user specified in the .audio file.
    if (properties->exists("looped"))
    {
        audio->setLooped(properties->getBool("looped"));
    }
    if (properties->exists("gain"))
    {
        audio->setGain(properties->getFloat("gain"));
    }
    if (properties->exists("pitch"))
    {
        audio->setPitch(properties->getFloat("pitch"));
    }
    Vector3 v;
    if (properties->getVector3("velocity", &v))
    {
        audio->setVelocity(v);
    }

    return audio;
}
开发者ID:sharkpp,项目名称:openhsp,代码行数:46,代码来源:AudioSource.cpp


示例12: GP_ASSERT

void Animation::setTransformRotationOffset(Curve* curve, unsigned int propertyId)
{
    GP_ASSERT(curve);

    switch (propertyId)
    {
    case Transform::ANIMATE_ROTATE:
    case Transform::ANIMATE_ROTATE_TRANSLATE:
        curve->setQuaternionOffset(ANIMATION_ROTATE_OFFSET);
        return;
    case Transform::ANIMATE_SCALE_ROTATE_TRANSLATE:
        curve->setQuaternionOffset(ANIMATION_SRT_OFFSET);
        return;
    }

    return;
}
开发者ID:ArtProgrammer,项目名称:game-play,代码行数:17,代码来源:Animation.cpp


示例13: sqrt

void BoundingSphere::merge(const BoundingSphere& sphere)
{
    if (sphere.isEmpty())
        return;

    // Calculate the distance between the two centers.
    float vx = center.x - sphere.center.x;
    float vy = center.y - sphere.center.y;
    float vz = center.z - sphere.center.z;
    float d = sqrt(vx * vx + vy * vy + vz * vz);

    // If one sphere is contained inside the other, set to the larger sphere.
    if (d <= (sphere.radius - radius))
    {
        center = sphere.center;
        radius = sphere.radius;
        return;
    }
    else if (d <= (radius - sphere.radius))
    {
        return;
    }

    // Calculate the unit vector between the two centers.
    GP_ASSERT(d != 0.0f);
    float dI = 1.0f / d;
    vx *= dI;
    vy *= dI;
    vz *= dI;

    // Calculate the new radius.
    float r = (radius + sphere.radius + d) * 0.5f;

    // Calculate the new center.
    float scaleFactor = (r - sphere.radius);
    vx = vx * scaleFactor + sphere.center.x;
    vy = vy * scaleFactor + sphere.center.y;
    vz = vz * scaleFactor + sphere.center.z;

    // Set the new center and radius.
    center.x = vx;
    center.y = vy;
    center.z = vz;
    radius = r;
}
开发者ID:reven86,项目名称:GamePlay,代码行数:45,代码来源:BoundingSphere.cpp


示例14: GP_ASSERT

void Joystick::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
{
    GP_ASSERT(spriteBatch);

    // If the joystick is not absolute, then only draw if it is active.
    if (!_relative || (_relative && _state == ACTIVE))
    {
        if (!_relative)
        {
            _screenRegion.x = _viewportClipBounds.x + (_viewportClipBounds.width - _screenRegion.width) / 2.0f;
            _screenRegion.y = _viewportClipBounds.y + (_viewportClipBounds.height - _screenRegion.height) / 2.0f;
        }

        // Draw the outer image.
        Theme::ThemeImage* outer = getImage("outer", _state);
        if (outer)
        {
            const Theme::UVs& uvs = outer->getUVs();
            const Vector4& color = outer->getColor();
            if (_relative)
                spriteBatch->draw(_screenRegion.x, _screenRegion.y, _outerSize->x, _outerSize->y, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color);
            else
                spriteBatch->draw(_screenRegion.x, _screenRegion.y, _outerSize->x, _outerSize->y, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
        }

        // Draw the inner image.
        Theme::ThemeImage* inner = getImage("inner", _state);
        if (inner)
        {
            Vector2 position(_screenRegion.x, _screenRegion.y);

            // Adjust position to reflect displacement.
            position.x += _displacement.x;
            position.y += -_displacement.y;

            // Get the uvs and color and draw.
            const Theme::UVs& uvs = inner->getUVs();
            const Vector4& color = inner->getColor();
            if (_relative)
                spriteBatch->draw(position.x, position.y, _innerSize->x, _innerSize->y, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color);
            else
                spriteBatch->draw(position.x, position.y, _innerSize->x, _innerSize->y, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
        }
    }
}
开发者ID:vugluskr86,项目名称:GamePlay,代码行数:45,代码来源:Joystick.cpp


示例15: GP_ASSERT

Vector3 PhysicsConstraint::getWorldCenterOfMass(const Node* node)
{
    GP_ASSERT(node);

    const BoundingSphere& sphere = node->getBoundingSphere();
    if (!(sphere.center.isZero() && sphere.radius == 0))
    {
        // The world-space center of mass is the sphere's center.
        return sphere.center;
    }

    // Warn the user that the node has no bounding volume.
    GP_WARN("Node %s' has no bounding volume - center of mass is defaulting to local coordinate origin.", node->getId());

    Vector3 center;
    node->getWorldMatrix().transformPoint(&center);
    return center;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:18,代码来源:PhysicsConstraint.cpp


示例16: GP_ASSERT

int Text::getPropertyId(TargetType type, const char* propertyIdStr)
{
    GP_ASSERT(propertyIdStr);

    if (type == AnimationTarget::TRANSFORM)
    {
        if (strcmp(propertyIdStr, "ANIMATE_OPACITY") == 0)
        {
            return Text::ANIMATE_OPACITY;
        }
        else if (strcmp(propertyIdStr, "ANIMATE_COLOR") == 0)
        {
            return Text::ANIMATE_COLOR;
        }
    }

    return AnimationTarget::getPropertyId(type, propertyIdStr);
}
开发者ID:dtbinh,项目名称:Game3D,代码行数:18,代码来源:Text.cpp


示例17: GP_ASSERT

void TileSet::cloneInto(TileSet* tileset, NodeCloneContext &context) const
{
    GP_ASSERT(tileset);
    
    // Clone properties
    tileset->_tiles = new Vector2[tileset->_rowCount * tileset->_columnCount];
    memset(tileset->_tiles, -1, sizeof(float) * tileset->_rowCount * tileset->_columnCount * 2);
    memcpy(tileset->_tiles, _tiles, sizeof(Vector2) * tileset->_rowCount * tileset->_columnCount);
    tileset->_tileWidth = _tileWidth;
    tileset->_tileHeight = _tileHeight;
    tileset->_rowCount = _rowCount;
    tileset->_columnCount = _columnCount;
    tileset->_width = _tileWidth * _columnCount;
    tileset->_height = _tileHeight * _rowCount;
    tileset->_opacity = _opacity;
    tileset->_color = _color;
    tileset->_batch = _batch;
}
开发者ID:Joilnen,项目名称:GamePlay,代码行数:18,代码来源:TileSet.cpp


示例18: GP_ASSERT

Material* Material::create(Effect* effect)
{
    GP_ASSERT(effect);

    // Create a new material with a single technique and pass for the given effect.
    Material* material = new Material();

    Technique* technique = new Technique(NULL, material);
    material->_techniques.push_back(technique);

    Pass* pass = new Pass(NULL, technique, effect);
    technique->_passes.push_back(pass);
    effect->addRef();

    material->_currentTechnique = technique;

    return material;
}
开发者ID:AllenPestaluky,项目名称:GamePlay,代码行数:18,代码来源:Material.cpp


示例19: GP_ASSERT

Container* Container::create(Theme::Style* style, Properties* properties, Theme* theme)
{
    GP_ASSERT(properties);

    const char* layoutString = properties->getString("layout");
    Container* container = Container::create(getLayoutType(layoutString));
    container->initialize(style, properties);
    container->_scroll = getScroll(properties->getString("scroll"));
    container->_scrollBarsAutoHide = properties->getBool("scrollBarsAutoHide");
    if (container->_scrollBarsAutoHide)
    {
        container->_scrollBarOpacity = 0.0f;
    }
    container->addControls(theme, properties);
    container->_layout->update(container, container->_scrollPosition);

    return container;
}
开发者ID:BernardsRegards,项目名称:GamePlay,代码行数:18,代码来源:Container.cpp


示例20: GP_ASSERT

void AnimationClip::setRepeatCount(float repeatCount)
{
    GP_ASSERT(repeatCount == REPEAT_INDEFINITE || repeatCount > 0.0f);

    _repeatCount = repeatCount;

    if (repeatCount == REPEAT_INDEFINITE)
    {
        _activeDuration = _duration + _loopBlendTime;
    }
    else
    {
        _activeDuration = _duration * _repeatCount;

        if (repeatCount > 1.0f && _loopBlendTime > 0.0f)
            _activeDuration += std::ceil(repeatCount - 1.0f) * _loopBlendTime;
    }
}
开发者ID:1timmy,项目名称:GamePlay,代码行数:18,代码来源:AnimationClip.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GP_DEBUG函数代码示例发布时间:2022-05-30
下一篇:
C++ GPU_stack_link函数代码示例发布时间: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