void CNodeBreak::UpdateNode() { int iJacksRequired = 1; for ( int i = 0; i < max( GetNumJacks_In(), GetNumJacks_Out() ); i++ ) { const bool bJackInValid = i < GetNumJacks_In(); const bool bJackOutValid = i < GetNumJacks_Out(); if ( bJackInValid && GetJack_In( i )->GetNumBridgesConnected() ) iJacksRequired++; else if ( bJackOutValid && GetJack_Out( i )->GetNumBridgesConnected() ) iJacksRequired++; } //CUtlVector< int >hSmartTypes_Out; //for ( int i = 0; i < GetNumJacks_Out(); i++ ) // hSmartTypes_Out.AddToTail( GetJack_Out(i)->GetSmartType() ); CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_In; CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_Out; CreateBridgeRestoreData_In( CBaseNode::BY_COUNT, m_hRestoreBridges_In ); CreateBridgeRestoreData_Out( CBaseNode::BY_COUNT, m_hRestoreBridges_Out ); GenerateJacks_Input( iJacksRequired ); GenerateJacks_Output( iJacksRequired ); RestoreBridgesFromList_In( m_hRestoreBridges_In ); RestoreBridgesFromList_Out( m_hRestoreBridges_Out ); //for ( int i = 0; i < GetNumJacks_Out(); i++ ) // GetJack_Out( i )->SetSmartType( hSmartTypes_Out[i] ); //hSmartTypes_Out.Purge(); OnUpdateHierachy( NULL, NULL ); }
void CNodeSubtract::UpdateOutputs() { if ( !GetNumJacks_Out() || !GetNumJacks_In() ) return; if ( GetErrorLevel() != ERRORLEVEL_NONE ) return SetOutputsUndefined(); GetJack_Out( 0 )->SetSmartType( max( GetJack_In(0)->GetSmartType(), GetJack_In(1)->GetSmartType() ) ); }
void CNodeUtility_Assign::UpdateOutputs() { if ( !GetNumJacks_Out() || !GetNumJacks_In() ) return; if ( GetErrorLevel() != ERRORLEVEL_NONE ) return SetOutputsUndefined(); GetJack_Out( 0 )->SetSmartType( GetJack_In(0)->GetSmartType() ); }
void CNodeBreak::UpdateOutputs() { if ( GetNumJacks_Out() != GetNumJacks_In() ) return SetOutputsUndefined(); for ( int i = 0; i < GetNumJacks_In(); i++ ) { if ( GetJack_In( i )->GetNumBridgesConnected() < 1 ) break; int iSmartTypeIn = GetJack_In( i )->GetSmartType(); if ( iSmartTypeIn < 0 ) return SetOutputsUndefined(); GetJack_Out( i )->SetSmartType( iSmartTypeIn ); } }
bool CNodeCustom::CreateSolvers(GenericShaderData *ShaderData) { if ( GetNumJacks_In_Connected() < GetNumJacks_In() ) return false; Assert( m_pCode_Function && Q_strlen( m_pCode_Function ) ); Assert( m_bInline || Q_strlen(m_szFilePath) ); SetAllocating( true ); char *pszFuncString = CKVPacker::ConvertKVSafeString( m_pCode_Function, false ); char *pszGlobalString = CKVPacker::ConvertKVSafeString( m_pCode_Global, false ); int iHierachyType = GetHierachyTypeIterateFullyRecursive(); int envflags = m_iEnvFlags; if ( iHierachyType & HLSLHIERACHY_PS ) envflags &= ~NODECUSTOM_ADDENV_LIGHTING_VS; if ( iHierachyType & HLSLHIERACHY_VS ) envflags &= ~NODECUSTOM_ADDENV_LIGHTING_PS; CHLSL_Solver_Custom *solver = new CHLSL_Solver_Custom( GetUniqueIndex() ); solver->SetResourceType( RESOURCETYPE_VARIABLE ); solver->Init( pszGlobalString, pszFuncString, envflags, m_szFunctionName, m_szFilePath, m_hszVarNames_In, m_hszVarNames_Out, this ); delete [] pszFuncString; delete [] pszGlobalString; for ( int i = 0; i < GetNumJacks_In(); i++ ) solver->AddSourceVar( GetJack_In( i )->GetTemporaryVarTarget_End() ); for ( int i = 0; i < GetNumJacks_Out(); i++ ) { CJack *pJ = GetJack_Out( i ); CHLSL_Var *pTg = pJ->AllocateVarFromSmartType(); solver->AddTargetVar( pTg ); } AddSolver( solver ); return true; }
void CNodeCustom::UpdateNode() { CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_In; CreateBridgeRestoreData_In( CBaseNode::BY_INDEX, m_hRestoreBridges_In ); GenerateJacks_Input( m_hszVarNames_In.Count() ); //GenerateJacks_Input( numJacksIn ); CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_Out; CreateBridgeRestoreData_Out( CBaseNode::BY_INDEX, m_hRestoreBridges_Out ); GenerateJacks_Output( m_hszVarNames_Out.Count() ); for ( int i = 0; i < GetNumJacks_In(); i++ ) { char *name = NULL; if ( m_hszVarNames_In.Count() > i && m_hszVarNames_In[ i ]->pszName != NULL && Q_strlen( m_hszVarNames_In[ i ]->pszName ) > 0 ) name = m_hszVarNames_In[ i ]->pszName; else name = GenerateDefaultName( i ); LockJackInput_Flags( i, m_hszVarNames_In[ i ]->iFlag, name ); } for ( int i = 0; i < GetNumJacks_Out(); i++ ) { char *name = NULL; if ( m_hszVarNames_Out.Count() > i && m_hszVarNames_Out[ i ]->pszName != NULL && Q_strlen( m_hszVarNames_Out[ i ]->pszName ) > 0 ) name = m_hszVarNames_Out[ i ]->pszName; else name = GenerateDefaultName( i, true ); LockJackOutput_Flags( i, m_hszVarNames_Out[ i ]->iFlag, name ); } RestoreBridgesFromList_In( m_hRestoreBridges_In ); RestoreBridgesFromList_Out( m_hRestoreBridges_Out ); OnUpdateHierachy( NULL, NULL ); }
bool CNodeBreak::CreateSolvers(GenericShaderData *ShaderData) { if ( GetNumJacks_Out() != GetNumJacks_In() ) return false; CHLSL_Solver_Break *solver = new CHLSL_Solver_Break( GetUniqueIndex() ); for ( int i = 0; i < GetNumJacks_In(); i++ ) { CJack *pJ_In = GetJack_In( i ); if ( pJ_In->GetNumBridgesConnected() < 1 ) break; GetJack_Out( i )->SetTemporaryVarTarget( pJ_In->GetTemporaryVarTarget_End() ); } AddSolver( solver ); return true; }
KeyValues *CNodeCustom::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); WriteJackDataFromKV( pKV, m_hszVarNames_In, m_hszVarNames_Out, GetNumJacks_In(), GetNumJacks_Out() ); pKV->SetString( "szFunctionName", m_szFunctionName ); pKV->SetString( "szFilePath", m_szFilePath ); pKV->SetInt( "iInline", m_bInline ? 1 : 0 ); CKVPacker::KVPack( m_pCode_Global, "szcode_global", pKV ); CKVPacker::KVPack( m_pCode_Function, "szcode_body", pKV ); //pKV->SetString( "szcode_global", m_pCode_Global ); //pKV->SetString( "szcode_body", m_pCode_Function ); pKV->SetInt( "iEnvFlags", m_iEnvFlags ); return pKV; }
bool CNodeStdSkinning::CreateSolvers(GenericShaderData *ShaderData) { if ( GetNumJacks_In_Connected() < GetNumJacks_In() ) return false; SetAllocating( true ); CHLSL_Solver_StdSkinning *solver = new CHLSL_Solver_StdSkinning( GetUniqueIndex() ); solver->SetState( m_iSkinMode ); for ( int i = 0; i < GetNumJacks_In(); i++ ) solver->AddSourceVar( GetJack_In(i)->GetTemporaryVarTarget_End() ); for ( int i = 0; i < GetNumJacks_Out(); i++ ) solver->AddTargetVar( GetJack_Out(i)->AllocateVarFromSmartType() ); AddSolver( solver ); return true; }
bool CNodeVSInput::CreateSolvers(GenericShaderData *ShaderData) { for ( int i = 0; i < GetNumJacks_Out(); i++ ) { CJack *pJ = GetJack_Out( i ); if ( !pJ->GetNumBridgesConnected() ) continue; const int res = pJ->GetResourceType(); CHLSL_Var *var = pJ->AllocateVarFromSmartType(); var->MakeConstantOnly(); CHLSL_Solver_ReadSemantics *solver = new CHLSL_Solver_ReadSemantics( GetUniqueIndex() ); solver->SendVSSetup( curSetup ); solver->SetResourceType( res ); solver->AddTargetVar( var ); AddSolver( solver ); } SmartCreateDummySolver(); return true; }
bool CNodeBumpBasis::CreateSolvers(GenericShaderData *ShaderData) { for ( int i = 0; i < GetNumJacks_Out(); i++ ) { CJack *pJCur = GetJack_Out(i); if ( !pJCur->GetNumBridgesConnected() && i != 0 ) continue; const int res = pJCur->GetResourceType(); CHLSL_Var *tg = pJCur->AllocateVarFromSmartType(); tg->MakeConstantOnly(); CHLSL_Solver_BumpBasis *solver = new CHLSL_Solver_BumpBasis( GetUniqueIndex() ); solver->SetResourceType( res ); solver->AddTargetVar( tg ); solver->SetState( i ); AddSolver( solver ); } return !!GetNumSolvers(); }
void CNodeMultiply::UpdateOutputs() { if ( !GetNumJacks_Out() || !GetNumJacks_In() ) return; if ( GetErrorLevel() != ERRORLEVEL_NONE ) return SetOutputsUndefined(); CJack *pJO = GetJack_Out( 0 ); int vartype_jack_0 = GetJack_In( 0 )->GetSmartType(); int vartype_jack_1 = GetJack_In( 1 )->GetSmartType(); int iGoalSmarttype = HLSLVAR_FLOAT4; // matrices out if ( vartype_jack_0 == HLSLVAR_MATRIX3X3 && vartype_jack_1 == HLSLVAR_MATRIX3X3 ) iGoalSmarttype = HLSLVAR_MATRIX3X3; else if ( vartype_jack_0 == HLSLVAR_MATRIX4X4 && vartype_jack_1 == HLSLVAR_MATRIX4X4 ) iGoalSmarttype = HLSLVAR_MATRIX4X4; else if ( vartype_jack_0 == HLSLVAR_MATRIX4X3 && vartype_jack_1 == HLSLVAR_MATRIX4X4 ) iGoalSmarttype = HLSLVAR_MATRIX4X4; // vector out else if ( vartype_jack_0 == HLSLVAR_FLOAT1 || vartype_jack_1 == HLSLVAR_FLOAT1 ) iGoalSmarttype = max( vartype_jack_0, vartype_jack_1 ); else if ( vartype_jack_0 == vartype_jack_1 ) iGoalSmarttype = vartype_jack_0; // vector transform out else if ( vartype_jack_1 == HLSLVAR_MATRIX3X3 || vartype_jack_0 == HLSLVAR_MATRIX3X3 || vartype_jack_1 == HLSLVAR_MATRIX4X3 || ( vartype_jack_1 == HLSLVAR_MATRIX4X4 && m_bMatrixRotation ) ) iGoalSmarttype = HLSLVAR_FLOAT3; return pJO->SetSmartType( iGoalSmarttype ); //GetJack_Out( 0 )->SetSmartType( max( GetJack_In(0)->GetSmartType(), GetJack_In(1)->GetSmartType() ) ); }