Fix ShaderGen cubemap feature.

This commit is contained in:
LuisAntonRebollo 2014-12-15 18:28:17 +01:00
parent ef2a843dcd
commit 15c8922028
2 changed files with 9 additions and 24 deletions

View file

@ -1681,7 +1681,7 @@ void ReflectCubeFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
cubeVertPos->setType( "float3" );
LangElement *cubeVertPosDecl = new DecOp( cubeVertPos );
meta->addStatement( new GenOp( " @ = mul((float3x3)@, @).xyz;\r\n",
meta->addStatement( new GenOp( " @ = mul(@, float4(@,1)).xyz;\r\n",
cubeVertPosDecl, cubeTrans, LangElement::find( "position" ) ) );
// cube normal
@ -1702,23 +1702,14 @@ void ReflectCubeFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
eyePos->constSortPos = cspPass;
}
// cube position
Var * cubePos = new Var;
cubePos->setName( "cubePos" );
cubePos->setType( "float3" );
LangElement *cubePosDecl = new DecOp( cubePos );
meta->addStatement( new GenOp( " @ = float3( @[0][3], @[1][3], @[2][3] );\r\n",
cubePosDecl, cubeTrans, cubeTrans, cubeTrans ) );
// eye to vert
Var * eyeToVert = new Var;
eyeToVert->setName( "eyeToVert" );
eyeToVert->setType( "float3" );
LangElement *e2vDecl = new DecOp( eyeToVert );
meta->addStatement( new GenOp( " @ = @ - ( @ - @ );\r\n",
e2vDecl, cubeVertPos, eyePos, cubePos ) );
meta->addStatement( new GenOp( " @ = @ - @;\r\n",
e2vDecl, cubeVertPos, eyePos ) );
// grab connector texcoord register
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );