void CNodeVCompression::UpdateNode()
{
	bool bUseTangent = m_iCompressionMode == COMPRESSION_MODE_NORMAL_TANGENT;

	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	GenerateJacks_Input( bUseTangent ? 2 : 1 );
	LockJackInput_Flags( 0, HLSLVAR_FLOAT4, "Normal" );
	if ( bUseTangent )
		LockJackInput_Flags( 1, HLSLVAR_FLOAT4, "Tangent" );

	RestoreBridgesFromList_In( m_hRestoreBridges );


	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	GenerateJacks_Output( bUseTangent ? 2 : 1 );
	LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "Normal" );
	if ( bUseTangent )
		LockJackOutput_Flags( 1, HLSLVAR_FLOAT4, "Tangent" );

	RestoreBridgesFromList_Out( m_hRestoreBridges );

	OnUpdateHierachy( NULL, NULL );
}
Exemplo n.º 2
0
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 CNodeStdVLight::UpdateNode()
{
    CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
    CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

    GenerateJacks_Input( m_bStaticLighting ? 3 : 1 );
    if ( m_bStaticLighting )
    {
        LockJackInput_Flags( 0, HLSLVAR_FLOAT3, "World pos" );
        LockJackInput_Flags( 1, HLSLVAR_FLOAT3, "World normal" );
        LockJackInput_Flags( 2, HLSLVAR_FLOAT3, "Static light" );
    }
    else
    {
        LockJackInput_Flags( 0, HLSLVAR_FLOAT3, "World pos" );
    }

    RestoreBridgesFromList_In( m_hRestoreBridges );

    CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

    GenerateJacks_Output( 1 );
    if ( m_bStaticLighting )
        LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "Lighting" );
    else
        LockJackOutput_Flags( 0, HLSLVAR_FLOAT4, "VAttn" );

    RestoreBridgesFromList_Out( m_hRestoreBridges );
}
Exemplo n.º 4
0
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 );
}
void CNodeStdSkinning::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numInputs = 3;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numInputs = 4;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numInputs = 5;
	GenerateJacks_Input( numInputs );

	LockJackInput_Flags( 0, HLSLVAR_FLOAT4, "Bone indices" );
	LockJackInput_Flags( 1, HLSLVAR_FLOAT4, "Bone weights" );
	LockJackInput_Flags( 2, HLSLVAR_FLOAT3, "Obj pos" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
		LockJackInput_Flags( 3, HLSLVAR_FLOAT3, "Obj normal" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		LockJackInput_Flags( 4, HLSLVAR_FLOAT4, "Obj tangent s" );

	RestoreBridgesFromList_In( m_hRestoreBridges );




	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numOutputs = 1;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numOutputs = 2;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numOutputs = 4;
	GenerateJacks_Output( numOutputs );

	LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "World pos" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
		LockJackOutput_Flags( 1, HLSLVAR_FLOAT3, "World normal" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
	{
		LockJackOutput_Flags( 2, HLSLVAR_FLOAT3, "World tangent s" );
		LockJackOutput_Flags( 3, HLSLVAR_FLOAT3, "World tangent t" );
	}

	RestoreBridgesFromList_Out( m_hRestoreBridges );
}
void CNodeStdMorph::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numInputs = 2;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numInputs = 4;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numInputs = 5;
	GenerateJacks_Input( numInputs );

	LockJackInput_Flags( 0, HLSLVAR_FLOAT3, "Obj pos" );
	LockJackInput_Flags( 1, HLSLVAR_FLOAT3, "Flex delta" );
	//LockJackInput_Flags( 2, HLSLVAR_FLOAT2, "Morph coords" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
	{
		LockJackInput_Flags( 2, HLSLVAR_FLOAT3, "Obj normal" );
		LockJackInput_Flags( 3, HLSLVAR_FLOAT3, "Flex normal" );
	}
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		LockJackInput_Flags( 4, HLSLVAR_FLOAT3, "Tangent s" );

	RestoreBridgesFromList_In( m_hRestoreBridges );




	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numOutputs = 1;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numOutputs = 2;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numOutputs = 3;
	GenerateJacks_Output( numOutputs );

	LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "Obj pos" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
		LockJackOutput_Flags( 1, HLSLVAR_FLOAT3, "Obj normal" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		LockJackOutput_Flags( 2, HLSLVAR_FLOAT3, "Obj tangent s" );

	RestoreBridgesFromList_Out( m_hRestoreBridges );
}
void CNodeConstant::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_Out( CBaseNode::BY_INDEX, m_hRestoreBridges );

	GenerateJacks_Output( 1 );

	if ( !m_iChannelInfo.IsActive() )
		m_iChannelInfo.Tokenize( "0" );

	Assert(m_iChannelInfo.IsActive());

	SetJackFlags_Output( 0, HLSLJACKFLAGS_F1 );
	LockJackOutput_Flags( 0, GetTypeFlagFromEnum(m_iChannelInfo.iActiveChannels) );

	// HLSLVAR_FLOAT1 - HLSLVAR_FLOAT4
	RestoreBridgesFromList_Out( m_hRestoreBridges );
}
void CNodeCallback::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_Out( CBaseNode::BY_INDEX, m_hRestoreBridges );

	if ( !szCallbackName )
	{
		GenerateJacks_Output( 0 );

		SaveDeleteVector( m_hRestoreBridges );
		return;
	}

	GenerateJacks_Output( 1 );
	int flag = ::GetVarTypeFlag( iNumComponents - 1 );
	LockJackOutput_Flags( 0, flag, szCallbackName );

	RestoreBridgesFromList_Out( m_hRestoreBridges );
}
Exemplo n.º 9
0
void CNodeVSInput::Setup( SETUP_HLSL_VS_Input info )
{
	int numOutputs = 1;
	if ( info.bFlexDelta_enabled )
		numOutputs += 2;
	if ( info.bBlendweights_enabled )
		numOutputs += 2;
	if ( info.bNormal_enabled )
		numOutputs += 1;
	if ( info.bTangentspace_enabled )
		numOutputs += 2;
	numOutputs += info.iTexcoords_num;
	numOutputs += info.iVertexcolor_num;

	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	GenerateJacks_Output( numOutputs );

	int curOutput = 0;

	GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_POS_3 );
	LockJackOutput_Flags( curOutput, HLSLVAR_FLOAT3, "Position" );curOutput++;

	if ( info.bFlexDelta_enabled )
	{
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_FLEXDELTA );
		LockJackOutput_Flags( curOutput, HLSLVAR_FLOAT3, "Flex offset" );curOutput++;
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_FLEXDELTA_NORMAL );
		LockJackOutput_Flags( curOutput, HLSLVAR_FLOAT3, "Flex normal" );curOutput++;
	}
	if ( info.bBlendweights_enabled )
	{
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_BONE_WEIGHTS );
		LockJackOutput_Flags( curOutput, HLSLVAR_FLOAT4, "Bone weights" );curOutput++;
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_BONE_INDICES );
		LockJackOutput_Flags( curOutput, HLSLVAR_FLOAT4, "Bone indices" );curOutput++;
	}
	if ( info.bNormal_enabled )
	{
		int normalFlag = info.bNormal_enabled_compression ? HLSLVAR_FLOAT4 : HLSLVAR_FLOAT3;
		GetJack_Out( curOutput )->SetResourceType( info.bNormal_enabled_compression ? RESOURCETYPE_NORMAL_4 : RESOURCETYPE_NORMAL );
		LockJackOutput_Flags( curOutput, normalFlag, "Normal" );curOutput++;
	}
	if ( info.bTangentspace_enabled )
	{
		int tangentStype = info.bTangentspace_enabled_skinning ? HLSLVAR_FLOAT4 : HLSLVAR_FLOAT3;
		int tangentSRestype = info.bTangentspace_enabled_skinning ? RESOURCETYPE_TANGENTS_4 : RESOURCETYPE_TANGENTS_3;

		GetJack_Out( curOutput )->SetResourceType( tangentSRestype );
		LockJackOutput_Flags( curOutput, tangentStype, "Tangent S" );curOutput++;
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_TANGENTT );
		LockJackOutput_Flags( curOutput, HLSLVAR_FLOAT3, "Tangent T" );curOutput++;
	}

	for ( int i = 0; i < info.iTexcoords_num; i++ )
	{
		Assert( i < 3 );
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_TEXCOORD_0 + i );
		LockJackOutput_Flags( curOutput, info.iDataTypeFlag_TexCoords[i], VarArgs("TexCoords %i",i) );curOutput++;
	}
	for ( int i = 0; i < info.iVertexcolor_num; i++ )
	{
		Assert( i < 2 );
		GetJack_Out( curOutput )->SetResourceType( RESOURCETYPE_COLOR_0 + i );
		LockJackOutput_Flags( curOutput, info.iDataTypeFlag_Color[i], VarArgs("Color %i",i) );curOutput++;
	}
	curSetup = info;

	RestoreBridgesFromList_Out( m_hRestoreBridges );
}