コード例 #1
0
ファイル: wbpediv.cpp プロジェクト: Johnicholas/EldritchCopy
void WBPEDiv::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const
{
	WBParamEvaluator::SEvaluatedParam ValueA;
	m_InputA->Evaluate( Context, ValueA );

	WBParamEvaluator::SEvaluatedParam ValueB;
	m_InputB->Evaluate( Context, ValueB );

	if( ValueA.m_Type == WBParamEvaluator::EPT_Vector )
	{
		EvaluatedParam.m_Type = WBParamEvaluator::EPT_Vector;
		EvaluatedParam.m_Vector = ValueA.m_Vector / ValueB.GetFloat();
	}
	else if( ValueB.m_Type == WBParamEvaluator::EPT_Vector )
	{
		EvaluatedParam.m_Type = WBParamEvaluator::EPT_Vector;
		EvaluatedParam.m_Vector = ValueB.m_Vector / ValueA.GetFloat();
	}
	else if( ValueA.m_Type == WBParamEvaluator::EPT_Int && ValueB.m_Type == WBParamEvaluator::EPT_Int )
	{
		EvaluatedParam.m_Type = WBParamEvaluator::EPT_Int;
		EvaluatedParam.m_Int = ValueA.m_Int / ValueB.m_Int;
	}
	else
	{
		EvaluatedParam.m_Type = WBParamEvaluator::EPT_Float;
		EvaluatedParam.m_Float = ValueA.GetFloat() / ValueB.GetFloat();
	}
}
コード例 #2
0
ファイル: wbpemin.cpp プロジェクト: MinorKeyGames/Eldritch
void WBPEMin::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const
{
	WBParamEvaluator::SEvaluatedParam ValueA;
	m_InputA->Evaluate( Context, ValueA );

	WBParamEvaluator::SEvaluatedParam ValueB;
	m_InputB->Evaluate( Context, ValueB );

	ASSERT( ValueA.m_Type == WBParamEvaluator::EPT_Int || ValueA.m_Type == WBParamEvaluator::EPT_Float );
	ASSERT( ValueB.m_Type == WBParamEvaluator::EPT_Int || ValueB.m_Type == WBParamEvaluator::EPT_Float );

	if( ValueA.m_Type == WBParamEvaluator::EPT_Int && ValueB.m_Type == WBParamEvaluator::EPT_Int )
	{
		EvaluatedParam.m_Type = WBParamEvaluator::EPT_Int;
		EvaluatedParam.m_Int = Min( ValueA.m_Int, ValueB.m_Int );
	}
	else
	{
		EvaluatedParam.m_Type = WBParamEvaluator::EPT_Float;
		EvaluatedParam.m_Float = Min( ValueA.GetFloat(), ValueB.GetFloat() );
	}
}
コード例 #3
0
ファイル: wbpesquare.cpp プロジェクト: ptitSeb/Eldritch
void WBPESquare::Evaluate(
    const WBParamEvaluator::SPEContext& Context,
    WBParamEvaluator::SEvaluatedParam& EvaluatedParam) const {
  WBParamEvaluator::SEvaluatedParam Value;
  m_Input->Evaluate(Context, Value);

  ASSERT(Value.m_Type == WBParamEvaluator::EPT_Int ||
         Value.m_Type == WBParamEvaluator::EPT_Float);

  if (Value.m_Type == WBParamEvaluator::EPT_Int) {
    EvaluatedParam.m_Type = WBParamEvaluator::EPT_Int;
    EvaluatedParam.m_Int = Square(Value.m_Int);
  } else {
    EvaluatedParam.m_Type = WBParamEvaluator::EPT_Float;
    EvaluatedParam.m_Float = Square(Value.GetFloat());
  }
}