void CShapeModule::InitParticleForCone(CVec3& localPos, CVec3& direction, float fParticleScale) const { CVec3 finalPos, finalDirection; float fClipAngle = m_fAngle; BEATS_CLIP_VALUE(fClipAngle, 0, 89.99f); float fRadius = m_fRadius * fParticleScale; float fConeLength = m_fConeLength * fParticleScale; float fTopRadius = fRadius + fConeLength * tanf(DegreesToRadians(fClipAngle)); CVec3 randomDirection(PARTICLE_RAND_RANGE(-1, 1), PARTICLE_RAND_RANGE(-1, 1), 0); randomDirection.Normalize(); float fRadiusOnBase = m_bEmitFromShell ? fRadius : PARTICLE_RAND_RANGE(0, fRadius); finalPos = randomDirection * fRadiusOnBase; BEATS_ASSERT(!BEATS_FLOAT_EQUAL(fRadius, 0)); fTopRadius *= (fRadiusOnBase / fRadius); CVec3 topPos = (m_bRandomDirection ? GetRandomDirection() : randomDirection) * fTopRadius; topPos.Z() = fConeLength; finalDirection = topPos - finalPos; if (!m_bEmitFromBaseOrVolume) { finalPos += (finalDirection * PARTICLE_RAND_RANGE(0, 1)); if (m_bRandomDirection) { finalDirection = GetRandomDirection(); } } finalDirection.Normalize(); localPos = finalPos; direction = finalDirection; }
void CRenderer::DepthRange(float fNear, float fFar) { bool bChanged = false; if (!BEATS_FLOAT_EQUAL(m_pCurrState->GetDepthFar(), fFar)) { m_pCurrState->SetDepthFar(fFar); bChanged = true; } if (!BEATS_FLOAT_EQUAL(m_pCurrState->GetDepthNear(), fNear)) { m_pCurrState->SetDepthNear(fNear); bChanged = true; } if (bChanged) { glDepthRange(fNear, fFar); FC_CHECK_GL_ERROR_DEBUG(); } }