Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CU::Vector4<float> temp = aCamera.myOrientation.GetTranslation();
- CU::Vector3<float>toCamera(temp.x, temp.y, temp.z);
- CU::Vector3<float> reverseLightDir = aLightSource.LightDir * -1.f;
- CU::Vector3<float> colors(myPoints[i]->myColor.r, myPoints[i]->myColor.g, myPoints[i]->myColor.b);
- float Diffuse = Dot(myPoints[i]->myNormal, reverseLightDir);
- ColorClamp(Diffuse);
- CU::Vector3<float> DiffuseVector = colors * aLightSource.LightColor * Diffuse;
- CU::Vector3<float> halfvector = (toCamera + reverseLightDir);
- Normalize(halfvector);
- float specular = Dot(halfvector, myPoints[i]->myNormal);
- ColorClamp(specular);
- CU::Vector3<float> specularVector = colors * pow(specular, aLightSource.specularpower);
- colors = DiffuseVector + specularVector;
- ColorClamp(colors.r);
- ColorClamp(colors.g);
- ColorClamp(colors.b);
- hgeColor aColor(myPoints[i]->myColor.r, myPoints[i]->myColor.g, myPoints[i]->myColor.b, 1);
- CU::Vector4<float> normal = (CU::Vector4<float>(myPoints[i]->myNormal.x,
- myPoints[i]->myNormal.y, myPoints[i]->myNormal.z, 0)
- * toWorldMatrix)* aCamera.GetInverse();
- aColor.r = colors.r;
- aColor.g = colors.g;
- aColor.b = colors.b;
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- CU::Vector4<float> cameraPoint(myPoints[i]->GetPosition().x, myPoints[i]->GetPosition().y, myPoints[i]->GetPosition().z, 1.f);
- cameraPoint *= toWorldMatrix;
- cameraPoint *= aCamera.GetInverse();
- cameraPoint *= CreateProjectionMatrixLH(0.001f, 100.f, 800.f / 600.f, 3.1415f / 180.f * 90.f);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement