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

Method GetValue

trinity/Controllers/Tr2BindingPoint.cpp:362–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362bool Tr2BindingPoint::GetValue( float& value ) const
363{
364 if( !IsValid() )
365 {
366 return false;
367 }
368 switch( m_entry->mType )
369 {
370 case Be::FLOAT:
371 value = *reinterpret_cast<float*>( m_destination );
372 break;
373 case Be::DOUBLE:
374 value = float( *reinterpret_cast<double*>( m_destination ) );
375 break;
376 case Be::BOOL:
377 value = float( *reinterpret_cast<bool*>( m_destination ) ? 1.f : 0.f );
378 break;
379 case Be::FLOATARRAY:
380 value = reinterpret_cast<float*>( m_destination )[std::max( m_entryOffset, 0 )];
381 break;
382 case Be::DOUBLEARRAY:
383 value = float( reinterpret_cast<double*>( m_destination )[std::max( m_entryOffset, 0 )] );
384 break;
385 default:
386 return false;
387 }
388 return true;
389}
390
391bool Tr2BindingPoint::SetDestination( IRoot* object, const std::string& attribute )
392{

Callers 2

Calls 1

IsValidFunction · 0.50

Tested by

no test coverage detected