protected void UpdateWorldTranslation(Vector3f outw) { outw.AddStore(localTranslation); if (parent != null) { Node p = parent; p.UpdateWorldTranslation(outw); } }
private void CalculateBindingTranslation(Vector3f outv) { if (parentBone != null) { outv.Set(parentBone.GetModelRotation().Multiply(GetBindTranslation())); outv.AddStore(parentBone.GetModelTranslation()); } else { outv.Set(GetBindTranslation()); } }
public void Update() { UpdateFrustumPoints(fPoints); centerPos.Set(0, 0, 0); frustumCornersWS = fPoints; for (int i = 0; i < 8; i++) { centerPos.AddStore(frustumCornersWS[i]); } centerPos.DivideStore(8f); newView.SetToLookAt(tmpVec.Set(centerPos).SubtractStore(lightDirection), centerPos, Vector3f.UnitY); Transform(ref frustumCornersWS, ref frustumCornersLS, ref newView); maxes.Set(float.MinValue, float.MinValue, float.MinValue); mins.Set(float.MaxValue, float.MaxValue, float.MaxValue); for (int i = 0; i < frustumCornersLS.Length; i++) { if (frustumCornersLS[i].x > maxes.x) { maxes.x = frustumCornersLS[i].x; } else if (frustumCornersLS[i].x < mins.x) { mins.x = frustumCornersLS[i].x; } if (frustumCornersLS[i].y > maxes.y) { maxes.y = frustumCornersLS[i].y; } else if (frustumCornersLS[i].y < mins.y) { mins.y = frustumCornersLS[i].y; } if (frustumCornersLS[i].z > maxes.z) { maxes.z = frustumCornersLS[i].z; } else if (frustumCornersLS[i].z < mins.z) { mins.z = frustumCornersLS[i].z; } } s_cam.ViewMatrix = newView; s_cam.ProjectionMatrix.SetToOrtho(mins.x, maxes.x, mins.y, maxes.y, -splits[3], splits[3]); viewProjectionMatrix.Set(s_cam.ViewMatrix); viewProjectionMatrix.MultiplyStore(s_cam.ProjectionMatrix); s_cam.ViewProjectionMatrix.Set(s_cam.ViewMatrix); s_cam.ViewProjectionMatrix.MultiplyStore(s_cam.ProjectionMatrix); s_cam.InverseViewProjectionMatrix.Set(s_cam.ViewProjectionMatrix); s_cam.InverseViewProjectionMatrix.InvertStore(); }
public override void UpdateMatrix() { tmp.Set(translation); tmp.AddStore(direction); rotation.SetToLookAt(direction, up); viewMatrix.SetToLookAt(translation, tmp, up); projMatrix.SetToProjection(fov, width, height, 0.05f, far); viewProjMatrix.Set(projMatrix); viewProjMatrix.MultiplyStore(viewMatrix); invViewProjMatrix.Set(viewProjMatrix); invViewProjMatrix.InvertStore(); yaw = rotation.GetYaw(); roll = rotation.GetRoll(); pitch = rotation.GetPitch(); }