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


C++ VisBaseEntity_cl::GetBoneCurrentLocalSpaceTransformation方法代码示例

本文整理汇总了C++中VisBaseEntity_cl::GetBoneCurrentLocalSpaceTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ VisBaseEntity_cl::GetBoneCurrentLocalSpaceTransformation方法的具体用法?C++ VisBaseEntity_cl::GetBoneCurrentLocalSpaceTransformation怎么用?C++ VisBaseEntity_cl::GetBoneCurrentLocalSpaceTransformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VisBaseEntity_cl的用法示例。


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

示例1: SetOwner

void RPG_MeshTrailEffectComponent::SetOwner(VisTypedEngineObject_cl *owner)
{
  IVObjectComponent::SetOwner(owner);

  if(owner)
  {
    // Get texture or use plain white
    VTextureObject *trailTexture = Vision::TextureManager.Load2DTexture(m_textureFilename);
    if (trailTexture == NULL)
      trailTexture = Vision::TextureManager.GetPlainWhiteTexture();

    // Get trail bones
    VisBaseEntity_cl *pEntity = (VisBaseEntity_cl *) GetOwner();
    if(pEntity->GetMesh() == NULL)
    {
      return;
    }

    bool useFallback = false;

    if(pEntity->GetMesh()->GetSkeleton())
    {
      int startIndex = pEntity->GetMesh()->GetSkeleton()->GetBoneIndexByName(m_startBoneName);
      int endIndex = pEntity->GetMesh()->GetSkeleton()->GetBoneIndexByName(m_endBoneName);
      if(startIndex > -1 && endIndex > -1)
      {  
        // Use bones to define range
        hkvQuat rotation;
        pEntity->GetBoneCurrentLocalSpaceTransformation(startIndex, m_relStart, rotation);
        pEntity->GetBoneCurrentLocalSpaceTransformation(endIndex, m_relEnd, rotation);
      }
      else
      {
        useFallback = true;
      }
    }
    else
    {
      useFallback = true;
    }

    // use the fallback if there's no skeleton or if we don't have both of the bones that were specified
    if(useFallback)
    {
      // Fallback: Use bounding box along y axis to define range
      hkvAlignedBBox bbox = pEntity->GetMesh()->GetBoundingBox();
      m_relStart = hkvVec3(bbox.getCenter().x, bbox.m_vMin.y, bbox.getCenter().z);
      m_relEnd = hkvVec3(bbox.getCenter().x, bbox.m_vMax.y, bbox.getCenter().z);
    }

    if(m_history)
    {
      // cleanup existing history if we have one
      delete m_history;
      m_history = NULL;
    }

    m_history = new VTrailHistoryEntry[m_numSegments];

    m_mesh = new VisMeshBuffer_cl(VisMBSimpleVertex_t::VertexDescriptor, m_numSegments * 2, VisMeshBuffer_cl::MB_PRIMTYPE_TRISTRIP, 0, 0, VIS_MEMUSAGE_DYNAMIC);
    m_mesh->SetBaseTexture(trailTexture);

    VSimpleRenderState_t iState(VIS_TRANSP_ADDITIVE, RENDERSTATEFLAG_DOUBLESIDED | RENDERSTATEFLAG_FILTERING);
    m_mesh->SetDefaultRenderState(iState);
    m_meshObj = new VisMeshBufferObject_cl(m_mesh);

    m_enabled = true;

    RPG_MeshTrailEffectComponentManager::s_instance.Instances().AddUnique(this);
  }
  else
  {   
    RPG_MeshTrailEffectComponentManager::s_instance.Instances().SafeRemove(this);
  }
}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:75,代码来源:MeshTrailEffectComponent.cpp


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