当前位置: 首页>>代码示例>>C++>>正文


C++ MultiLine::addStatement方法代码示例

本文整理汇总了C++中MultiLine::addStatement方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiLine::addStatement方法的具体用法?C++ MultiLine::addStatement怎么用?C++ MultiLine::addStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MultiLine的用法示例。


在下文中一共展示了MultiLine::addStatement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processPix

void TerrainBaseMapFeatGLSL::processPix(  Vector<ShaderComponent*> &componentList, 
                                          const MaterialFeatureData &fd )
{
   // grab connector texcoord register
   Var *texCoord = getInTexCoord( "texCoord", "vec3", true, componentList );

   // create texture var
   Var *diffuseMap = new Var;
   diffuseMap->setType( "sampler2D" );
   diffuseMap->setName( "baseTexMap" );
   diffuseMap->uniform = true;
   diffuseMap->sampler = true;
   diffuseMap->constNum = Var::getTexUnitNum();     // used as texture unit num here

   MultiLine *meta = new MultiLine;

   Var *baseColor = new Var;
   baseColor->setType( "vec4" );
   baseColor->setName( "baseColor" );
   meta->addStatement( new GenOp( "   @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) );
   meta->addStatement(new GenOp("   @ = toLinear(@);\r\n", baseColor, baseColor));

  ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget;

   if(fd.features.hasFeature(MFT_isDeferred))
   {
      target= ShaderFeature::RenderTarget1;
   }
   meta->addStatement( new GenOp( "   @;\r\n", assignColor( baseColor, Material::Mul,NULL,target ) ) );

   output = meta;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:32,代码来源:terrFeatureGLSL.cpp

示例2: processPix

void TerrainLightMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList, 
                                          const MaterialFeatureData &fd )
{
   // grab connector texcoord register
   Var *inTex = (Var*)LangElement::find( "texCoord" );
   if ( !inTex )
      return;

   // Get the lightmap texture.
   Var *lightMap = new Var;
   lightMap->setType( "sampler2D" );
   lightMap->setName( "lightMapTex" );
   lightMap->uniform = true;
   lightMap->sampler = true;
   lightMap->constNum = Var::getTexUnitNum();

   MultiLine *meta = new MultiLine;

   // Find or create the lightMask value which is read by
   // RTLighting to mask out the lights.
   //
   // The first light is always the sunlight so we apply
   // the shadow mask to only the first channel.
   //
   Var *lightMask = (Var*)LangElement::find( "lightMask" );
   if ( !lightMask )
   {
      lightMask = new Var( "lightMask", "vec4" );
      meta->addStatement( new GenOp( "   @ = vec4(1);\r\n", new DecOp( lightMask ) ) );
   }

   meta->addStatement( new GenOp( "   @[0] = tex2D( @, @.xy ).r;\r\n", lightMask, lightMap, inTex ) );
   output = meta;
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:34,代码来源:terrFeatureGLSL.cpp

示例3: processPix

void TerrainAdditiveFeatHLSL::processPix( Vector<ShaderComponent*> &componentList, 
                                          const MaterialFeatureData &fd )
{
   Var *color = NULL;
   Var *normal = NULL;
   if (fd.features[MFT_DeferredTerrainDetailMap])
   {
       color = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget1) );
       normal = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::DefaultTarget) );
   }
   else
       color = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::DefaultTarget) );

   Var *blendTotal = (Var*)LangElement::find( "blendTotal" );
   if ( !color || !blendTotal )
      return;
   
   MultiLine *meta = new MultiLine;

   meta->addStatement( new GenOp( "   clip( @ - 0.0001 );\r\n", blendTotal ) );
   meta->addStatement( new GenOp( "   @.a = @;\r\n", color, blendTotal ) );

   if (normal)
	   meta->addStatement(new GenOp("   @.a = @;\r\n", normal, blendTotal));

   output = meta;
}
开发者ID:J0linar,项目名称:Torque3D,代码行数:27,代码来源:terrFeatureHLSL.cpp

示例4: processPix

void ParaboloidVertTransformHLSL::processPix(   Vector<ShaderComponent*> &componentList, 
                                                const MaterialFeatureData &fd )
{      
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );

   MultiLine *meta = new MultiLine;

   const bool isSinglePass = fd.features[ MFT_IsSinglePassParaboloid ];
   if ( isSinglePass )
   {
      // Cull things on the back side of the map.
      Var *isBack = connectComp->getElement( RT_TEXCOORD );
      isBack->setName( "isBack" );
      isBack->setStructName( "IN" );
      isBack->setType( "float" );
      meta->addStatement( new GenOp( "   clip( abs( @ ) - 0.999 );\r\n", isBack ) );
   }

   // Cull pixels outside of the valid paraboloid.
   Var *posXY = connectComp->getElement( RT_TEXCOORD );
   posXY->setName( "posXY" );
   posXY->setStructName( "IN" );
   posXY->setType( "float2" );
   meta->addStatement( new GenOp( "   clip( 1.0 - abs(@.x) );\r\n", posXY ) );

   output = meta;
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:27,代码来源:paraboloidHLSL.cpp

示例5: processPix

void ParallaxFeatHLSL::processPix(  Vector<ShaderComponent*> &componentList, 
                                    const MaterialFeatureData &fd )
{
   AssertFatal( GFX->getPixelShaderVersion() >= 2.0, 
      "ParallaxFeatHLSL::processPix - We don't support SM 1.x!" );

   MultiLine *meta = new MultiLine;

   // Order matters... get this first!
   Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );

   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );

   // We need the negative tangent space view vector
   // as in parallax mapping we step towards the camera.
   Var *negViewTS = (Var*)LangElement::find( "negViewTS" );
   if ( !negViewTS )
   {
      Var *inNegViewTS = (Var*)LangElement::find( "outNegViewTS" );
      if ( !inNegViewTS )
      {
         inNegViewTS = connectComp->getElement( RT_TEXCOORD );
         inNegViewTS->setName( "outNegViewTS" );
         inNegViewTS->setStructName( "IN" );
         inNegViewTS->setType( "float3" );
      }

      negViewTS = new Var( "negViewTS", "float3" );
      meta->addStatement( new GenOp( "   @ = normalize( @ );\r\n", new DecOp( negViewTS ), inNegViewTS ) );
   }

   // Get the rest of our inputs.
   Var *parallaxInfo = _getUniformVar( "parallaxInfo", "float", cspPotentialPrimitive );
   Var *normalMap = getNormalMapTex();
   Var *bumpMapTexture = (Var*)LangElement::find("bumpMapTex");

   // Call the library function to do the rest.
   if (fd.features.hasFeature(MFT_IsDXTnm, getProcessIndex()))
   {
      if (mIsDirect3D11)
         meta->addStatement(new GenOp("   @.xy += parallaxOffsetDxtnm( @, @, @.xy, @, @ );\r\n",
         texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
      else
         meta->addStatement(new GenOp("   @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
            texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
   }
   else
   {
      if (mIsDirect3D11)
         meta->addStatement(new GenOp("   @.xy += parallaxOffset( @, @, @.xy, @, @ );\r\n",
         texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
      else
         meta->addStatement(new GenOp("   @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
            texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
   }

   // TODO: Fix second UV maybe?

   output = meta;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:60,代码来源:bumpHLSL.cpp

示例6: processVert

void NormalsOutFeatGLSL::processVert(  Vector<ShaderComponent*> &componentList, 
												 const MaterialFeatureData &fd )
{
   // If we have normal maps then we can count
   // on it to generate the world space normal.
   if ( fd.features[MFT_NormalMap] )
      return;
	
   MultiLine *meta = new MultiLine;
   output = meta;
	
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
	
   Var *outNormal = connectComp->getElement( RT_TEXCOORD );
   outNormal->setName( "wsNormal" );
   outNormal->setStructName( "OUT" );
   outNormal->setType( "vec3" );
   outNormal->mapsToSampler = false;
	
   // Find the incoming vertex normal.
   Var *inNormal = (Var*)LangElement::find( "normal" );   
   if ( inNormal )
   {
      // Transform the normal to world space.
      Var *objTrans = getObjTrans( componentList, fd.features[MFT_UseInstancing], meta );
      meta->addStatement( new GenOp( "   @ = tMul( @, normalize( vec4(@, 0.0) ) ).xyz;\r\n", outNormal, objTrans, inNormal ) );
   }
   else
   {
      // If we don't have a vertex normal... just pass the
      // camera facing normal to the pixel shader.
      meta->addStatement( new GenOp( "   @ = float3( 0.0, 0.0, 1.0 );\r\n", outNormal ) );
   }
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:34,代码来源:bumpGLSL.cpp

示例7: processPix

void TerrainParallaxMapFeatGLSL::processPix(   Vector<ShaderComponent*> &componentList, 
                                            const MaterialFeatureData &fd )
{
   MultiLine *meta = new MultiLine;

   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );

   // We need the negative tangent space view vector
   // as in parallax mapping we step towards the camera.
   Var *negViewTS = (Var*)LangElement::find( "negViewTS" );
   if ( !negViewTS )
   {
      Var *inNegViewTS = (Var*)LangElement::find( "outNegViewTS" );
      if ( !inNegViewTS )
      {
         inNegViewTS = connectComp->getElement( RT_TEXCOORD );
         inNegViewTS->setName( "outNegViewTS" );
         inNegViewTS->setType( "vec3" );
      }

      negViewTS = new Var( "negViewTS", "vec3" );
      meta->addStatement( new GenOp( "   @ = normalize( @ );\r\n", new DecOp( negViewTS ), inNegViewTS ) );
   }

   // Get the rest of our inputs.
   Var *detailInfo = _getDetailIdStrengthParallax();
   Var *normalMap = _getNormalMapTex();
   Var *texCoord = _getInDetailCoord( componentList );

   // Call the library function to do the rest.
   meta->addStatement( new GenOp( "   @.xy += parallaxOffset( @, @.xy, @, @.z );\r\n", 
      texCoord, normalMap, texCoord, negViewTS, detailInfo ) );

   output = meta;
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:35,代码来源:terrFeatureGLSL.cpp

示例8: processVert

void TerrainMacroMapFeatHLSL::processVert(  Vector<ShaderComponent*> &componentList, 
                                             const MaterialFeatureData &fd )
{
   const S32 detailIndex = getProcessIndex();

   // Grab incoming texture coords... the base map feature
   // made sure this was created.
   Var *inTex = (Var*)LangElement::find( "texCoord" );
   AssertFatal( inTex, "The texture coord is missing!" );

   // Grab the input position.
   Var *inPos = (Var*)LangElement::find( "inPosition" );
   if ( !inPos )
      inPos = (Var*)LangElement::find( "position" );

   // Get the object space eye position.
   Var *eyePos = _getUniformVar( "eyePos", "float3", cspPotentialPrimitive );

   MultiLine *meta = new MultiLine;

   // Get the distance from the eye to this vertex.
   Var *dist = (Var*)LangElement::find( "macroDist" );
   if ( !dist )
   {
      dist = new Var;
      dist->setType( "float" );
      dist->setName( "macroDist" );  

      meta->addStatement( new GenOp( "   @ = distance( @.xyz, @ );\r\n", 
                                       new DecOp( dist ), inPos, eyePos ) );
   }

   // grab connector texcoord register
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
   Var *outTex = connectComp->getElement( RT_TEXCOORD );
   outTex->setName( String::ToString( "macroCoord%d", detailIndex ) );
   outTex->setStructName( "OUT" );
   outTex->setType( "float4" );
   outTex->mapsToSampler = true;

   // Get the detail scale and fade info.
   Var *detScaleAndFade = new Var;
   detScaleAndFade->setType( "float4" );
   detScaleAndFade->setName( String::ToString( "macroScaleAndFade%d", detailIndex ) );
   detScaleAndFade->uniform = true;
   detScaleAndFade->constSortPos = cspPotentialPrimitive;

   // Setup the detail coord.
   meta->addStatement( new GenOp( "   @.xyz = @ * @.xyx;\r\n", outTex, inTex, detScaleAndFade ) );

   // And sneak the detail fade thru the w detailCoord.
   meta->addStatement( new GenOp( "   @.w = clamp( ( @.z - @ ) * @.w, 0.0, 1.0 );\r\n", 
                                    outTex, detScaleAndFade, dist, detScaleAndFade ) );   

   output = meta;
}
开发者ID:J0linar,项目名称:Torque3D,代码行数:56,代码来源:terrFeatureHLSL.cpp

示例9: processVert

void EyeSpaceDepthOutHLSL::processVert(   Vector<ShaderComponent*> &componentList, 
                                          const MaterialFeatureData &fd )
{
   MultiLine *meta = new MultiLine;
   output = meta;

   // grab output
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
   Var *outWSEyeVec = connectComp->getElement( RT_TEXCOORD );
   outWSEyeVec->setName( "wsEyeVec" );
   outWSEyeVec->setStructName( "OUT" );

   // grab incoming vert position   
   Var *wsPosition = new Var( "depthPos", "float3" );
   getWsPosition( componentList, fd.features[MFT_UseInstancing], meta, new DecOp( wsPosition ) );

   Var *eyePos = (Var*)LangElement::find( "eyePosWorld" );
   if( !eyePos )
   {
      eyePos = new Var;
      eyePos->setType("float3");
      eyePos->setName("eyePosWorld");
      eyePos->uniform = true;
      eyePos->constSortPos = cspPass;
   }

   meta->addStatement( new GenOp( "   @ = float4( @.xyz - @, 1 );\r\n", outWSEyeVec, wsPosition, eyePos ) );
}
开发者ID:03050903,项目名称:Torque3D,代码行数:28,代码来源:depthHLSL.cpp

示例10: processVert

void TerrainParallaxMapFeatGLSL::processVert(  Vector<ShaderComponent*> &componentList, 
                                             const MaterialFeatureData &fd )
{
   if ( LangElement::find( "outNegViewTS" ) )
      return;

   MultiLine *meta = new MultiLine;

   // Grab the input position.
   Var *inPos = (Var*)LangElement::find( "inPosition" );
   if ( !inPos )
      inPos = (Var*)LangElement::find( "position" );

   // Get the object space eye position and the
   // object to tangent transform.
   Var *eyePos = _getUniformVar( "eyePos", "vec3" , cspPotentialPrimitive );
   Var *objToTangentSpace = getOutObjToTangentSpace( componentList, meta,fd  );

   // Now send the negative view vector in tangent space to the pixel shader.
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
   Var *outNegViewTS = connectComp->getElement( RT_TEXCOORD );
   outNegViewTS->setName( "outNegViewTS" );
   outNegViewTS->setType( "vec3" );
   meta->addStatement( new GenOp( "   @ =  @ * vec3( @ - @.xyz );\r\n", 
      outNegViewTS, objToTangentSpace, eyePos, inPos ) );

   output = meta;
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:28,代码来源:terrFeatureGLSL.cpp

示例11: GenOp

LangElement *ConditionerFeature::assignOutput( Var *unconditionedOutput, ShaderFeature::OutputTarget outputTarget /* = ShaderFeature::DefaultTarget*/ )
{
    LangElement *assign;
    MultiLine *meta = new MultiLine;

    meta->addStatement( new GenOp( avar( "\r\n\r\n   // output buffer format: %s\r\n", GFXStringTextureFormat[getBufferFormat()] ) ) );

    // condition the output
    Var *conditionedOutput = _conditionOutput( unconditionedOutput, meta );

    // search for color var
    Var *color = (Var*) LangElement::find( getOutputTargetVarName(outputTarget) );

    if ( !color )
    {
        // create color var
        color = new Var;

        if(GFX->getAdapterType() == OpenGL)
        {
            color->setName( getOutputTargetVarName(outputTarget) );
            color->setType( "vec4" );
            DecOp* colDecl = new DecOp(color);

            assign = new GenOp( "@ = vec4(@)", colDecl, conditionedOutput );
        }
        else
        {
            color->setType( "fragout" );
            color->setName( getOutputTargetVarName(outputTarget) );
            color->setStructName( "OUT" );

            assign = new GenOp( "@ = @", color, conditionedOutput );
        }
    }
    else
    {
        if (GFX->getAdapterType() == OpenGL)
            assign = new GenOp( "@ = vec4(@)", color, conditionedOutput);
        else
            assign = new GenOp( "@ = @", color, conditionedOutput );
    }

    meta->addStatement( new GenOp( "   @;\r\n", assign ) );

    return meta;
}
开发者ID:mray,项目名称:terminal-overload,代码行数:47,代码来源:conditionerFeature.cpp

示例12: processPix

void BumpFeatHLSL::processPix(   Vector<ShaderComponent*> &componentList, 
                                 const MaterialFeatureData &fd )
{
   MultiLine *meta = new MultiLine;

   // Get the texture coord.
   Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );

   // Sample the bumpmap.
   Var *bumpMap = getNormalMapTex();
   LangElement *texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
   Var *bumpNorm = new Var( "bumpNormal", "float4" );
   meta->addStatement( expandNormalMap( texOp, new DecOp( bumpNorm ), bumpNorm, fd ) );

   // We transform it into world space by reversing the 
   // multiplication by the worldToTanget transform.
   Var *wsNormal = new Var( "wsNormal", "float3" );
   Var *worldToTanget = getInWorldToTangent( componentList );
   meta->addStatement( new GenOp( "   @ = normalize( mul( @.xyz, @ ) );\r\n", new DecOp( wsNormal ), bumpNorm, worldToTanget ) );

   // TODO: Restore this!
   /*
   // Check to see if we're rendering world space normals.
   if ( fd.materialFeatures[MFT_NormalsOut]  )
   {
      Var *inNormal = getInTexCoord( "normal", "float3", false, componentList );

      LangElement *normalOut;
      Var *outColor = (Var*)LangElement::find( "col" );
      if ( outColor )
         normalOut = new GenOp( "float4( ( [email protected] + 1 ) * 0.5, @.a )", inNormal, outColor );
      else
         normalOut = new GenOp( "float4( ( [email protected] + 1 ) * 0.5, 1 )", inNormal );

      meta->addStatement( new GenOp( "   @; // MFT_NormalsOut\r\n", 
         assignColor( normalOut, Material::None ) ) );
         
      output = meta;
      return;
   }
   */

   output = meta;
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:44,代码来源:bumpHLSL.cpp

示例13: processVert

void GBufferConditionerGLSL::processVert( Vector<ShaderComponent*> &componentList, 
                                          const MaterialFeatureData &fd )
{
   // If we have a normal map then that feature will
   // take care of passing gbNormal to the pixel shader.
   if ( fd.features[MFT_NormalMap] )
      return;

   MultiLine *meta = new MultiLine;
   output = meta;

   // grab incoming vert normal
   Var *inNormal = (Var*) LangElement::find( "normal" );
   AssertFatal( inNormal, "Something went bad with ShaderGen. The normal should be already defined." );

   // grab output for gbuffer normal
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
   Var *outNormal = connectComp->getElement( RT_TEXCOORD );
   outNormal->setName( "gbNormal" );
   outNormal->setStructName( "OUT" );
   outNormal->setType( "float3" );

   if( !fd.features[MFT_ParticleNormal] )
   {
      // Kick out the view-space normal

      // TODO: Total hack because Conditioner is directly derived
      // from ShaderFeature and not from ShaderFeatureGLSL.
      NamedFeatureGLSL dummy( String::EmptyString );
      dummy.mInstancingFormat = mInstancingFormat;
      Var *worldViewOnly = dummy.getWorldView( componentList, fd.features[MFT_UseInstancing], meta );

      meta->addStatement(  new GenOp("   @ = tMul(@, float4( normalize(@), 0.0 ) ).xyz;\r\n", 
                              outNormal, worldViewOnly, inNormal ) );
   }
   else
   {
      // Assume the particle normal generator has already put this in view space
      // and normalized it
      meta->addStatement( new GenOp( "   @ = @;\r\n", outNormal, inNormal ) );
   }
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:42,代码来源:gBufferConditionerGLSL.cpp

示例14: processPix

void EyeSpaceDepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList, 
                                       const MaterialFeatureData &fd )
{      
   MultiLine *meta = new MultiLine;

   // grab connector position
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
   Var *wsEyeVec = connectComp->getElement( RT_TEXCOORD );
   wsEyeVec->setName( "wsEyeVec" );
   wsEyeVec->setStructName( "IN" );
   wsEyeVec->setType( "float4" );
   wsEyeVec->mapsToSampler = false;
   wsEyeVec->uniform = false;

   // get shader constants
   Var *vEye = new Var;
   vEye->setType("float3");
   vEye->setName("vEye");
   vEye->uniform = true;
   vEye->constSortPos = cspPass;

   // Expose the depth to the depth format feature
   Var *depthOut = new Var;
   depthOut->setType("float");
   depthOut->setName(getOutputVarName());

   LangElement *depthOutDecl = new DecOp( depthOut );

   meta->addStatement( new GenOp( "#ifndef CUBE_SHADOW_MAP\r\n" ) );

   if (fd.features.hasFeature(MFT_TerrainBaseMap))
      meta->addStatement(new GenOp("   @ =min(0.9999, dot(@, (@.xyz / @.w)));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec));
   else
      meta->addStatement(new GenOp("   @ = dot(@, (@.xyz / @.w));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec));

   meta->addStatement( new GenOp( "#else\r\n" ) );

   Var *farDist = (Var*)Var::find( "oneOverFarplane" );
   if ( !farDist )
   {
      farDist = new Var;
      farDist->setType("float4");
      farDist->setName("oneOverFarplane");
      farDist->uniform = true;
      farDist->constSortPos = cspPass;
   }

   meta->addStatement( new GenOp( "   @ = length( @.xyz / @.w ) * @.x;\r\n", depthOutDecl, wsEyeVec, wsEyeVec, farDist ) );      
   meta->addStatement( new GenOp( "#endif\r\n" ) );

   // If there isn't an output conditioner for the pre-pass, than just write
   // out the depth to rgba and return.
   if( !fd.features[MFT_PrePassConditioner] )
      meta->addStatement( new GenOp( "   @;\r\n", assignColor( new GenOp( "float4(@.rrr,1)", depthOut ), Material::None ) ) );
   
   output = meta;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:57,代码来源:depthHLSL.cpp

示例15: processPix

void GBufferConditionerGLSL::processPix(  Vector<ShaderComponent*> &componentList, 
                                          const MaterialFeatureData &fd )
{     
   // sanity
   AssertFatal( fd.features[MFT_EyeSpaceDepthOut], "No depth-out feature enabled! Bad news!" );

   MultiLine *meta = new MultiLine;

   // grab connector normal
   ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
   Var *gbNormal = (Var*) LangElement::find( "gbNormal" );
   if( !gbNormal )
   {
      gbNormal = connectComp->getElement( RT_TEXCOORD );
      gbNormal->setName( "gbNormal" );
      gbNormal->setType( "vec3" );
      gbNormal->mapsToSampler = false;
      gbNormal->uniform = false;
   }

   // find depth
   ShaderFeature *depthFeat = FEATUREMGR->getByType( MFT_EyeSpaceDepthOut );
   AssertFatal( depthFeat != NULL, "No eye space depth feature found!" );

   Var *depth = (Var*) LangElement::find(depthFeat->getOutputVarName());
   AssertFatal( depth, "Something went bad with ShaderGen. The depth should be already generated by the EyeSpaceDepthOut feature." );


   Var *unconditionedOut = new Var;
   unconditionedOut->setType("vec4");
   unconditionedOut->setName("normal_depth");

   LangElement *outputDecl = new DecOp( unconditionedOut );

   // NOTE: We renormalize the normal here as they
   // will not stay normalized during interpolation.
   meta->addStatement( new GenOp("   @ = @;", outputDecl, new GenOp( "vec4(normalize(@), @)", gbNormal, depth ) ) );
   meta->addStatement( assignOutput( unconditionedOut ) );

   output = meta;
}
开发者ID:fr1tz,项目名称:alux3d,代码行数:41,代码来源:gBufferConditionerGLSL.cpp


注:本文中的MultiLine::addStatement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。