Kérdés DirectX implicit truncation of vector type

  • 12 aprilie 2012 20:07
     
      Are cod
    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