MCPcopy Create free account
hub / github.com/carbonengine/trinity / Generate

Method Generate

trinity/Particle/Tr2RandomUniformAttributeGenerator.cpp:38–51  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Implements ITr2AttributeGenerator interface. Generates random values for new particle component (element). Arguments: position - Position of the "parent" particle (unused). velocity - Velocity of the "parent" particle (unused). paticle - (out) New particle data: Tr2ParticleElementData::COUNT of floa

Source from the content-addressed store, hash-verified

36// The generator fills element identified by generator's m_name with random values.
37// --------------------------------------------------------------------------------------
38void Tr2RandomUniformAttributeGenerator::Generate( const Vector3* position,
39 const Vector3* velocity,
40 float** particle )
41{
42 if( !m_valid )
43 {
44 return;
45 }
46 float* data = particle[m_element.m_bufferType] + m_element.m_offset;
47 for( unsigned i = 0; i < m_element.m_dimension; ++i )
48 {
49 data[i] = m_minRange[i] + ( m_maxRange[i] - m_minRange[i] ) * Tr2ParticleSystem::RandFloat();
50 }
51}
52
53// --------------------------------------------------------------------------------------
54// Description:

Callers

nothing calls this directly

Calls 1

RandFloatFunction · 0.85

Tested by

no test coverage detected