|
|
|
@ -334,10 +334,10 @@ public: |
|
|
|
|
vCamera=Vector_Sub(vCamera,vForward); |
|
|
|
|
} |
|
|
|
|
if (GetKey(olc::A).bHeld) { |
|
|
|
|
fYaw+=2*fElapsedTime; |
|
|
|
|
fYaw-=2*fElapsedTime; |
|
|
|
|
} |
|
|
|
|
if (GetKey(olc::D).bHeld) { |
|
|
|
|
fYaw-=2*fElapsedTime; |
|
|
|
|
fYaw+=2*fElapsedTime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set up rotation matrices
|
|
|
|
@ -380,7 +380,7 @@ public: |
|
|
|
|
vec3d vCameraRay=Vector_Sub(triTransformed.p[0],vCamera); |
|
|
|
|
|
|
|
|
|
if (Vector_DotProduct(normal,vCameraRay)<0) { |
|
|
|
|
vec3d light_dir=Vector_Mul(vLookDir, -1); |
|
|
|
|
vec3d light_dir=Vector_Mul(vCameraRay,-1); |
|
|
|
|
light_dir=Vector_Normalise(light_dir); |
|
|
|
|
|
|
|
|
|
float dp = std::max(0.1f,Vector_DotProduct(light_dir,normal)); |
|
|
|
@ -401,6 +401,13 @@ public: |
|
|
|
|
triProjected.p[2]=Vector_Div(triProjected.p[2],triProjected.p[2].w); |
|
|
|
|
triProjected.col=triTransformed.col; |
|
|
|
|
|
|
|
|
|
triProjected.p[0].x*=-1.0f; |
|
|
|
|
triProjected.p[1].x*=-1.0f; |
|
|
|
|
triProjected.p[2].x*=-1.0f; |
|
|
|
|
triProjected.p[0].y*=-1.0f; |
|
|
|
|
triProjected.p[1].y*=-1.0f; |
|
|
|
|
triProjected.p[2].y*=-1.0f; |
|
|
|
|
|
|
|
|
|
// Scale into view
|
|
|
|
|
vec3d vOffsetView={1,1,0}; |
|
|
|
|
triProjected.p[0] = Vector_Add(triProjected.p[0],vOffsetView); |
|
|
|
|