Hi, i try to write a shader with a gradient input. Here is a part from the code which i have made and which is working:
Context ctxt( in_ctxt ); Application app; ShaderDef sdef( ctxt.GetAttribute( L"Definition" ) ); sdef.AddShaderFamily( siShaderFamilyTexture, true ); // PARAMETERS Factory fact = app.GetFactory(); ShaderParamDefContainer inpdefs = sdef.GetInputParamDefs(); ShaderParamDefContainer outpdefs = sdef.GetOutputParamDefs(); // Input ULONG cnt = 12; CRefArray popts; ShaderParamDefOptions *opts = new ShaderParamDefOptions[cnt]; for( ULONG i=0; i < cnt; i++ ) { popts.Add( fact.CreateShaderParamDefOptions() ); opts[i] = ShaderParamDefOptions( popts[i] ); } opts[0].SetInspectable( true ); opts[0].SetTexturable( false ); opts[0].SetLongName( L"Gradient" ); inpdefs.AddParamDef( L"valueGradient", siShaderDataTypeGradient, popts[0] ); opts[1].SetInspectable( true ); opts[1].SetTexturable( true ); opts[1].SetAnimatable( true ); opts[1].SetLongName( L"Color1" ); inpdefs.AddParamDef( L"inColor1", siShaderDataTypeColor3, popts[1] ); ... Now i want to define the inColor1 for the marker1 color. In the spdl file of the gradient shader, i see there is a connection like this: Connection "gradient::color1" = interface "color1"; How can i make this in c++? I have tried some things, but nothing works: inpdefs.GetParamDefByName(L"valueGradient").GetAttributes().Set( L"{210EA5F3-1742-4204-999F-E0750F2289E4}", L"inColor1" ); inpdefs.GetParamDefByName(L"valueGradient").GetAttributes().Set( L"gradient::color1", L"inColor1" ); inpdefs.GetParamDefByName(L"valueGradient").GetAttributes().Set( L"color1", L"inColor1" ); opts[0].SetAttribute( L"{210EA5F3-1742-4204-999F-E0750F2289E4}", L"inColor1" ); opts[0].SetAttribute( L"color1", L"inColor1" ); opts[0].SetAttribute( L"gradient::color1", L"inColor1" ); Sorry for the bad layout, but gmail works only with the simple html. It would be nice to get help from someone. Best, Stephan