DirectX implicit truncation of vector type
-
12 aprilie 2012 20:07
float3 ParallelLight(SurfaceInfo v, Light L, float3 eyePos) { float3 litColor = float3(0.0f, 0.0f, 0.0f); // The light vector aims opposite the direction the light rays travel. float3 lightVec = -L.dir; // Add the ambient term. litColor += v.diffuse * L.ambient; //ERROR HERE!! // Add diffuse and specular term, provided the surface is in // the line of site of the light. float diffuseFactor = dot(lightVec, v.normal); [branch] if( diffuseFactor > 0.0f ) { float specPower = max(v.spec.a, 1.0f); float3 toEye = normalize(eyePos - v.pos); float3 R = reflect(-lightVec, v.normal); float specFactor = pow(max(dot(R, toEye), 0.0f), specPower); // diffuse and specular terms litColor += diffuseFactor * v.diffuse * L.diffuse; //ERROR HERE! litColor += specFactor * v.spec * L.spec; //ERROR HERE!! } return litColor; }You have the name of the error in the title,and I marked where the error appears in the code above.
I just loaded that source code from a book,and I don't even know what that error means.I have a hard time understanding direct x because I haven't started working and making some apps with it.
- Mutat de Helen Zhao 23 aprilie 2012 07:04 DirectX issue (From:Visual C++ General)
Toate mesajele
-
14 aprilie 2012 23:13
what book?
Windows MVP 2010-11, XP, Vista, 7. Expanding into Windows Server 2008 R2, SQL Server, SharePoint, Cloud, Virtualization etc. etc.
Hardcore Games, Legendary is the only Way to Play
Developer | Windows IT | Chess | Economics | Vegan Advocate | PC Reviews
-
16 aprilie 2012 06:52
Hi Turda,
Welcome to the MSDN Forum.
According to your description, I suggest you go to DirectX forum for better support and more efficient responses. And here is that forum's link: http://forums.create.msdn.com/forums/?GroupID=7. And this thread will be moved to Off-Topic Posts.
Thanks for your understanding.
Best regards,Helen Zhao [MSFT]
MSDN Community Support | Feedback to us