Пример #1
0
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;
}
Пример #2
0
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();
}