void CMoon::ParseBlock( const CVarBlockParser::_VariableBlock *pBlock_ ) { if( pBlock_==NULL ) { return; } pBlock_->GetBool( "Active", m_bActive ); if( pBlock_->GetString( "MeshFile", m_strMeshName ) ) { HGRPOBJ hMesh = DGraphicAcquireSMD( SFullName( DCtrlGrp()->GroupEnvironment, m_strMeshName ), DGraphicStore::StaticMesh ); if( !hMesh.IsValid() ) { hMesh = DGraphicAcquireSMD( m_strMeshName, DGraphicStore::StaticMesh ); } LoadMesh( hMesh ); } if( pBlock_->GetVector( "Translation", m_vTranslation ) ) { SMatrix mat; mat.SetTranslation( m_vTranslation ); Transform( mat ); } bool bMoonFace; if( pBlock_->GetBool( "MoonFace", bMoonFace ) ) { SetMoonFace( bMoonFace ); } SColor Color; if( pBlock_->GetColor( "Color", Color ) ) { SetColor( Color ); } pBlock_->GetRealNumber( "FillRate", m_fFillRate ); pBlock_->GetRealNumber( "RisingRate", m_fRisingRate ); pBlock_->GetRealNumber( "Pitch", m_fPitch ); }
void CMoon::GetRisingTransformaion( SMatrix& matResult_ ) { // Rising Rate +Y (the zenith) // (0.25) // . | . // . | . // . | . // (0.5) | . // . | . (0) = (1) // ---------------------+----------------------- +X (east) // Transform Moon (Apply Rising Rate to Translated Moon) SMatrix matMoonRot; matMoonRot.SetRotation( SRotator( 0, 0, Rad2Angle(m_fRisingRate*fPi*2.0f - fPi/2.0f )) ); SMatrix matMoonPitch; matMoonPitch.SetRotation( SRotator( Rad2Angle(m_fPitch), 0, 0 ) ); matMoonRot = matMoonRot * matMoonPitch; SVector vMoonPos = matMoonRot.TransformVector( m_vTranslation ); matResult_.SetTranslation( vMoonPos ); Transform( matResult_ ); }