struct DirectionalLights{ float3 revDirection; float4 ambientColor : COLOR; float4 diffuseColor : COLOR; float4 specularColor : COLOR;};int numDirLights = 0;DirectionalLights dirLights[2];
How can i assign values to dirLights ???
I am using DX9 Effects framework.
Here the c++ code am using -
typedef struct chDirectionLight{ D3DXVECTOR3 direction; float pad0; //getting same error even after removing this optional variable D3DXCOLOR ambientColor,diffuseColor,specularColor; chDirectionLight() { pad0=0.0f; direction = D3DXVECTOR3(0.0f,0.0f,0.0f); diffuseColor=ambientColor=specularColor=D3DXCOLOR(0.0f,0.0f,0.0f,0.0f); }}chDirectionLight,*LPChDirectionalLight;/////Later to set value I am using following call effect->SetValue(this->dirLightHandle,(void *)ptrDirLight,sizeof(chDirectionLight));
I am trying to set first member of array in above c++ code but it m getting - DirectX Reported Error: D3DERR_INVALIDCALL - Invalid
Please help me figure out how to do it correctly and also how we will assign values to 2nd member of dirLights array.
EDIT : I know how to set 2 elements togather using 2*sizeof(struct), but i want to know if there is some method to assign value to 2nd elemnt without bothering the first one. There is no option to set offset in ID3DXEFFECT::SetValue() Method.
EDIT 2: I am getting DirectX Reported Error: D3DERR_INVALIDCALL - Invalid call on this line :
effect->SetValue(this->dirLightHandle,(void *)ptrDirLight,sizeof(chDirectionLight));
[Edited by - Chetanhl on October 23, 2010 2:29:37 PM]