本文整理汇总了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);
}
}