Ok here goes.....
These are the function I am using to set the variables. I am not good in Effects framework. Its based on the concept of Frank D Luna. May contain huge mistakes.]
void SetWorldViewProj(CXMMATRIX M) { WorldViewProj->SetMatrix(reinterpret_cast<const float*>(&M)); }
void SetWorld(CXMMATRIX M) { World->SetMatrix(reinterpret_cast<const float*>(&M)); }
void SetWorldInvTranspose(CXMMATRIX M) { WorldInvTranspose->SetMatrix(reinterpret_cast<const float *> (&M)); }
void SetBoneTransforms(const XMFLOAT4X4 *M, int cnt) { BoneTransforms->SetMatrixArray(reinterpret_cast<const float*>(M), 0, sizeof(M)*cnt); }
void SetTexTransform(CXMMATRIX M) { TexTransform->SetMatrix(reinterpret_cast<const float *> (&M)); }
void SetEyePosW(const XMFLOAT3 &v) { EyePosW->SetRawValue(&v,0,sizeof(XMFLOAT3)); }
void SetFogColor(const FXMVECTOR v) { FogColor->SetFloatVector(reinterpret_cast<const float *>(&v)); }
void SetFogStart(float f) { FogStart->SetFloat(f); }
void SetFogRange(float f) { FogRange->SetFloat(f); }
void SetDirLights(const DirectionalLight* lights) { DirLights->SetRawValue(lights, 0, 3 * sizeof(DirectionalLight)); }
void SetMaterial(const Material& mat) { Mat->SetRawValue(&mat, 0, sizeof(Material)); }
void SetDiffuseMap(ID3D11ShaderResourceView *tex) { DiffuseMap->SetResource(tex); }
And this is how I store variables in SkinEffect class.
WorldViewProj = mFX->GetVariableByName("gWorldViewProj")->AsMatrix();
World = mFX->GetVariableByName("gWorld")->AsMatrix();
WorldInvTranspose = mFX->GetVariableByName("gWorldInvTranspose")->AsMatrix();
TexTransform = mFX->GetVariableByName("gTexTransform")->AsMatrix();
EyePosW = mFX->GetVariableByName("gEyePosW")->AsVector();
FogColor = mFX->GetVariableByName("gFogColor")->AsVector();
FogStart = mFX->GetVariableByName("gFogStart")->AsScalar();
FogRange = mFX->GetVariableByName("gFogRange")->AsScalar();
DirLights = mFX->GetVariableByName("gDirLights");
Mat = mFX->GetVariableByName("gMaterial");
DiffuseMap = mFX->GetVariableByName("gDiffuseMap")->AsShaderResource();
BoneTransforms = mFX->GetVariableByName("gBoneTransforms")->AsMatrix();
My main concern would be BoneTransforms. Am I setting it right ? I am setting the variables before rendering in this way :
Effects::SkinFX->SetEyePosW(mCam.GetPosition());
Effects::SkinFX->SetWorld(World);
Effects::SkinFX->SetWorldInvTranspose(worldInvTranspose);
Effects::SkinFX->SetWorldViewProj(worldViewProj);
Effects::SkinFX->SetTexTransform(XMMatrixScaling(1.0f, 1.0f, 1.0f));
Effects::SkinFX->SetDirLights(&dirLight[0]);
Effects::SkinFX->SetBoneTransforms(&mBones.mBoneTransforms[0], mBones.mBoneTransforms.size());
Effects::SkinFX->SetMaterial(Materials[i]);
Effects::SkinFX->SetDiffuseMap(DiffuseMapSRV[i]);
There is huge possiblity that I am setting them in a wrong way. mBoneTransforms is a vector of type XMFLOAT4X4.mCam.GetPosition() returns XMFLOAT3 value.