//********************************************************************************************************* void CDisplayerVisualActivitySequence::addFootSteps(const NLMISC::CLine &line) { //H_AUTO(R2_CDisplayerVisualActivitySequence_addFootSteps) CDecal *decal = new CDecal; decal->setTexture(CV_FootStepDecalTexture.get(), false, true); CVector2f start2f(line.V0.x, line.V0.y); CVector2f end2f(line.V1.x, line.V1.y); float dist = (end2f - start2f).norm(); if (dist != 0.f) { decal->setWorldMatrixForArrow(start2f, end2f, CV_FootStepDecalWidth.get()); CMatrix uvMatrix; uvMatrix.setScale(CVector(CV_FootStepDecalUScale.get() * dist, 1.f, 1.f)); decal->setTextureMatrix(uvMatrix); } _Decals.push_back(decal); _FootSteps.push_back(line); }
// ********************************************************* void CPrimRender::updateEdgeDecal(CDecal &edgeDecal, const NLMISC::CVector &start, const NLMISC::CVector &end, float distToStartVertex, float distToEndVertex) { //H_AUTO(R2_CPrimRender_updateEdgeDecal) CVector2f start2f(start.x, start.y); CVector2f end2f(end.x, end.y); // compute real start coordinate that is at 'startRadius' dist from the 'start' pos float length = (end2f - start2f).norm(); if ((distToStartVertex + distToEndVertex) >= length) { CMatrix nullMat; nullMat.setScale(0.f); // decal not visible edgeDecal.setWorldMatrix(nullMat); return; } CVector dirNormed = (end2f - start2f) / length; start2f = start2f + distToStartVertex * dirNormed; end2f = end2f - distToEndVertex * dirNormed; edgeDecal.setWorldMatrixForArrow(start2f, end2f, _Look.EdgeLook.DecalWidth); CMatrix uvMatrix; float uScale = _Look.EdgeLook.DecalUScale * (length - (distToStartVertex + distToEndVertex)); uvMatrix.setScale(CVector(uScale, 1.f, 1.f)); switch(_Look.EdgeLook.DecalWrapMode) { case CEdgeLook::Scaled: case CEdgeLook::Repeat: break; case CEdgeLook::Centered: uvMatrix.setPos(CVector(0.5f * (1.f - uScale), 0.f, 0.f)); break; default: nlassert(0); break; } edgeDecal.setTextureMatrix(uvMatrix); }