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


C++ CObject3D::GetMat44方法代码示例

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


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

示例1: Init

bool CEmiterInstance::Init(const string& _szCoreName, const CObject3D& _Position, const Vect3f& _vVolume, int _iMaxParticles, bool _bBillboardMode )
{
  assert(!IsOk());
  SetOk(true);
  SetMat44( _Position.GetMat44() );

  m_szCoreName     = _szCoreName;
  m_vVolume        = _vVolume;
  m_vMaxVolume     = m_vVolume * .5f;
  m_vMinVolume     = -m_vMaxVolume;
  m_fVolume        = _vVolume.x * _vVolume.y * _vVolume.z;
  m_pEmiterCore    = CORE->GetEmiterCoreManager()->GetEmiterCore(m_szCoreName);
  m_bBillboardMode = _bBillboardMode;
  m_iMaxParticles  = _iMaxParticles;

  m_RecyclingParticles.Reset(m_iMaxParticles);
  m_iaParticles    = new int[m_iMaxParticles];

  GetBoundingBox()->Init(_vVolume);

  if(m_bBillboardMode)
  {
    if(m_pEmiterCore->IsSimpleEmiter())
    {
      m_Billboard.Init(dynamic_cast<const CSimpleEmiterCore*>(m_pEmiterCore), Vect3f(0,0,0),true);
    }
    else
    {
      LOGGER->AddNewLog(ELL_WARNING, "Trying to initialize billboard with aggregate emiter.");
      m_pEmiterCore = CORE->GetEmiterCoreManager()->GetNullEmiter();
      m_Billboard.Init(CORE->GetEmiterCoreManager()->GetNullEmiter(), Vect3f(0,0,0),true);
    }
  } else if(m_pEmiterCore->IsSimpleEmiter())
  {
    m_bIsSimple = true;
    const CSimpleEmiterCore *l_pEmiterCore = dynamic_cast<const CSimpleEmiterCore*>(m_pEmiterCore);
    
    float l_fMultiplier = l_pEmiterCore->GetEmitAbsolute()? 1 : m_fVolume;
    m_fTimeToNextParticle = 1.f / (l_pEmiterCore->GetEmitRate() * l_fMultiplier);
    m_iActiveParticles = 0;
    memset(m_iaParticles, 0, sizeof(int) * m_iMaxParticles);

    m_bAwake = true;
    m_fTimeToAwakeOrSleep = l_pEmiterCore->GetAwakeTime();

    m_pObjectReference = 0;
    m_bActive = true;
  }
  else
  {
    m_bIsSimple = false;
    const CAggregateEmiterCore *l_pEmiterCore = dynamic_cast<const CAggregateEmiterCore*>(m_pEmiterCore);

    vector<CAggregateEmiterCore::SEmiters>::const_iterator l_it  = l_pEmiterCore->GetChilds().begin();
    vector<CAggregateEmiterCore::SEmiters>::const_iterator l_end = l_pEmiterCore->GetChilds().end();


    for(; l_it != l_end; ++l_it)
    {
      CEmiterInstance *l_pChild = new CEmiterInstance();
      Vect3f l_vChildBox = l_it->volume.GetScaled(_vVolume);
      //Mat44f l_mChildTransform = Mat44f(_vVolume.x, 0, 0, 0,
      //                                  0, _vVolume.y, 0, 0,
      //                                  0, 0, _vVolume.z, 0,
      //                                  0, 0, 0,          1)
      //                           * l_it->movement.GetMat44();
      //CObject3D l_O3D;
      //l_O3D.SetMat44(l_mChildTransform);
      Mat44f l_mChildTransform = l_it->movement.GetMat44();
      Vect3f l_vChildTranslation = l_mChildTransform.GetTranslationVector();
      l_vChildTranslation.Scale(_vVolume);
      l_mChildTransform.Translate(l_vChildTranslation);
      CObject3D l_O3D;
      l_O3D.SetMat44(l_mChildTransform);

      bool l_bIsOk = l_pChild->Init(l_it->emiter, l_O3D, l_vChildBox);
      if(l_bIsOk)
      {
        m_ChildEmiters.push_back(l_pChild);
        GetBoundingBox()->Adjust(*l_pChild->GetBoundingBox());
      }
      else
      {
        delete l_pChild;
        SetOk(false);
        break;
      }
    }
  }

  if(!IsOk())
  {
    Release();
  }
  else if(!m_InstancedData.IsOk())
  {
    bool l_bIsOk = m_InstancedData.Init(CORE->GetRenderManager(), m_iMaxParticles);
    SetOk(l_bIsOk);
  }

//.........这里部分代码省略.........
开发者ID:Atridas,项目名称:biogame,代码行数:101,代码来源:EmiterInstance.cpp


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