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

Method Generate

trinity/Particle/Tr2RandomIntegerAttributeGenerator.cpp:39–52  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Implements ITr2AttributeGenerator interface. Generates random integer 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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

RandFloatFunction · 0.85

Tested by

no test coverage detected