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


C++ KartProperties类代码示例

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


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

示例1: getName

// ----------------------------------------------------------------------------
bool KartProperties::operator<(const KartProperties &other) const
{
    PlayerProfile *p = PlayerManager::getCurrentPlayer();
    bool this_is_locked = p->isLocked(getIdent());
    bool other_is_locked = p->isLocked(other.getIdent());
    if (this_is_locked == other_is_locked)
    {
        return getName() < other.getName();
    }
    else
        return other_is_locked;

    return true;
}  // operator<
开发者ID:supertuxkart,项目名称:stk-code,代码行数:15,代码来源:kart_properties.cpp

示例2: loadModels

/** Loads the 3d model and all wheels.
 */
bool KartModel::loadModels(const KartProperties &kart_properties)
{
    assert(m_is_master);
    std::string  full_path = kart_properties.getKartDir()+m_model_filename;
    m_mesh                 = irr_driver->getAnimatedMesh(full_path);
    if(!m_mesh)
    {
        Log::error("Kart_Model", "Problems loading mesh '%s' - kart '%s' will"
                   "not be available.",
                   full_path.c_str(), kart_properties.getIdent().c_str());
        return false;
    }
    m_mesh->grab();
    irr_driver->grabAllTextures(m_mesh);

    Vec3 kart_min, kart_max;
    MeshTools::minMax3D(m_mesh->getMesh(m_animation_frame[AF_STRAIGHT]),
                        &kart_min, &kart_max);

    // Test if kart model support colorization
    for (u32 i = 0; i < m_mesh->getMeshBufferCount(); i++)
    {
        scene::IMeshBuffer* mb = m_mesh->getMeshBuffer(i);
        Material* material = material_manager->getMaterialFor(mb
            ->getMaterial().getTexture(0), mb);
        m_support_colorization =
            m_support_colorization || material->isColorizable();
    }

#undef MOVE_KART_MESHES
#ifdef MOVE_KART_MESHES
    // Kart models are not exactly centered. The following code would
    // transform the mesh so that they are properly centered, but it
    // would also mean all location relative to the original kart's
    // center (wheel position, emitter, hat) would need to be modified.
    scene::IMeshManipulator *mani =
        irr_driver->getVideoDriver()->getMeshManipulator();
    Vec3 offset_from_center = -0.5f*(kart_max+kart_min);
    offset_from_center.setY(-kart_min.getY());
    offset_from_center.setY(0);

    core::matrix4 translate(core::matrix4::EM4CONST_IDENTITY);
    translate.setTranslation(offset_from_center.toIrrVector());
    mani->transform(m_mesh, translate);
    MeshTools::minMax3D(m_mesh->getMesh(m_animation_frame[AF_STRAIGHT]),
                        &kart_min, &kart_max);
#endif
    m_kart_highest_point = kart_max.getY();
    m_kart_lowest_point  = kart_min.getY();

    // Load the speed weighted object models. We need to do that now because it can affect the dimensions of the kart
    for(size_t i=0 ; i < m_speed_weighted_objects.size() ; i++)
    {
        SpeedWeightedObject&    obj = m_speed_weighted_objects[i];
        std::string full_name =
            kart_properties.getKartDir()+obj.m_name;
        obj.m_model = irr_driver->getAnimatedMesh(full_name);
        // Grab all textures. This is done for the master only, so
        // the destructor will only free the textures if a master
        // copy is freed.
        irr_driver->grabAllTextures(obj.m_model);

        // Update min/max
        Vec3 obj_min, obj_max;
        MeshTools::minMax3D(obj.m_model, &obj_min, &obj_max);
        obj_min += obj.m_position;
        obj_max += obj.m_position;
        kart_min.min(obj_min);
        kart_max.max(obj_max);
    }

    Vec3 size     = kart_max-kart_min;
    m_kart_width  = size.getX();
    m_kart_height = size.getY();
    m_kart_length = size.getZ();

    // Now set default some default parameters (if not defined) that
    // depend on the size of the kart model (wheel position, center
    // of gravity shift)
    for(unsigned int i=0; i<4; i++)
    {
        if(m_wheel_graphics_position[i].getX()==UNDEFINED)
        {
            m_wheel_graphics_position[i].setX( ( i==1||i==3)
                                               ? -0.5f*m_kart_width
                                               :  0.5f*m_kart_width  );
            m_wheel_graphics_position[i].setY(0);
            m_wheel_graphics_position[i].setZ( (i<2) ?  0.5f*m_kart_length
                                                     : -0.5f*m_kart_length);
        }
    }

    // Load the wheel models. This can't be done early, since the default
    // values for the graphical position must be defined, which in turn
    // depend on the size of the model.
    for(unsigned int i=0; i<4; i++)
    {
        // For kart models without wheels.
//.........这里部分代码省略.........
开发者ID:RyanTheNerd,项目名称:stk-code,代码行数:101,代码来源:kart_model.cpp

示例3: getIdent

 /** Returns a unique identifier for this kart (name of the directory the
  *  kart was loaded from). */
 const std::string& getIdent() const {return m_kart_properties->getIdent();}
开发者ID:344717871,项目名称:STK_android,代码行数:3,代码来源:kart.hpp

示例4: getName

 /** Returns a name to be displayed for this kart. */
 virtual const irr::core::stringw& getName() const 
                                    { return m_kart_properties->getName(); }
开发者ID:344717871,项目名称:STK_android,代码行数:3,代码来源:kart.hpp

示例5: getMaxSteerAngle

 /** Returns the maximum steering angle for this kart, which depends on the
  *  speed. */
 float getMaxSteerAngle () const
                 { return m_kart_properties->getMaxSteerAngle(getSpeed()); }
开发者ID:344717871,项目名称:STK_android,代码行数:4,代码来源:kart.hpp

示例6: getTimeFullSteer

 /** Returns the time till full steering is reached for this kart. */
 float getTimeFullSteer() const 
                           { return m_kart_properties->getTimeFullSteer(); }
开发者ID:344717871,项目名称:STK_android,代码行数:3,代码来源:kart.hpp

示例7: getBrakeFactor

 /** Returns the strenght of the brakes for this kart. */
 float getBrakeFactor() const {return m_kart_properties->getBrakeFactor();}
开发者ID:344717871,项目名称:STK_android,代码行数:2,代码来源:kart.hpp

示例8:

 /** Returns the maximum engine power for this kart. */
 float getMaxPower     () const {return m_kart_properties->getMaxPower(); }
开发者ID:344717871,项目名称:STK_android,代码行数:2,代码来源:kart.hpp

示例9: getMass

 /** Returns the current mass of this kart, including any attachment this
  *  kart might have. */
 float getMass() const { return m_kart_properties->getMass()
                              + m_attachment->weightAdjust();}
开发者ID:344717871,项目名称:STK_android,代码行数:4,代码来源:kart.hpp

示例10: blockViewWithPlunger

 /** Sets that the view is blocked by a plunger. The duration depends on
  *  the difficulty, see KartPorperties getPlungerInFaceTime. */
 void           blockViewWithPlunger()   
                          { m_view_blocked_by_plunger = 
                                m_kart_properties->getPlungerInFaceTime();}
开发者ID:344717871,项目名称:STK_android,代码行数:5,代码来源:kart.hpp

示例11: getName

 /** Returns a name to be displayed for this kart. */
 virtual const wchar_t* getName() const 
                                     { return m_kart_properties->getName(); }
开发者ID:xapantu,项目名称:stkolddroid,代码行数:3,代码来源:kart.hpp


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