public void ObserverPreCull(SgtObserver observer) { if (ObserverOffset != 0.0f) { for (var i = planes.Count - 1; i >= 0; i--) { var plane = planes[i]; if (plane != null) { var planeTransform = plane.transform; var oldPosition = planeTransform.position; var observerDir = (oldPosition - observer.transform.position).normalized; plane.TempPosition = oldPosition; SgtHelper.BeginStealthSet(planeTransform); { planeTransform.position += observerDir * ObserverOffset; } SgtHelper.EndStealthSet(); } } } }
// Shift all bounds on top of the observer, so it never exits the view frustum public override void ObserverPreCull(SgtObserver observer) { base.ObserverPreCull(observer); FollowObservers = false; for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null) { var models = group.Models; for (var j = models.Count - 1; j >= 0; j--) { var model = models[j]; if (model != null) { var modelMesh = model.Mesh; if (modelMesh != null) { var center = model.transform.InverseTransformPoint(observer.transform.position); modelMesh.bounds = new Bounds(center, Size); } } } } } }
public void ObserverPreCull(SgtObserver observer) { if (ObserverOffset != 0.0f) { for (var i = models.Count - 1; i >= 0; i--) { var model = models[i]; if (model != null) { var modelTransform = model.transform; var oldPosition = modelTransform.position; var observerDir = (oldPosition - observer.transform.position).normalized; model.TempPosition = oldPosition; SgtHelper.BeginStealthSet(modelTransform); { modelTransform.position += observerDir * ObserverOffset; } SgtHelper.EndStealthSet(); } } } }
protected void CameraPreRender(Camera camera) { if (Models != null) { for (var i = Models.Count - 1; i >= 0; i--) { var model = Models[i]; if (model != null) { model.Restore(camera); } } } if (Material != null) { var velocity = StretchVector; var observer = SgtObserver.Find(camera); if (observer != null) { Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); velocity += observer.Velocity * StretchScale; } if (Stretch == true) { Material.SetVector("_StretchVector", velocity); Material.SetVector("_StretchDirection", velocity.normalized); Material.SetFloat("_StretchLength", velocity.magnitude); } } }
public virtual void ObserverPreCull(SgtObserver observer) { for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null) { if (group.Material != null) { group.Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); if (StretchToObservers == true) { var velocity = (StretchOverride == true ? StretchVector : observer.Velocity) * StretchScale; group.Material.SetVector("_StretchVector", velocity); group.Material.SetVector("_StretchDirection", velocity.normalized); group.Material.SetFloat("_StretchLength", velocity.magnitude); } } if (FollowObservers == true) { group.TempPosition = group.transform.position; SgtHelper.BeginStealthSet(group.transform); { group.transform.position = observer.transform.position; } SgtHelper.EndStealthSet(); } } } }
private void ObserverPreRender(SgtObserver observer) { if (Material != null) { Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); } }
private void ObserverPreRender(SgtObserver observer) { for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null && group.Material != null) { group.Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); } } }
protected void CameraPreRender(Camera camera) { if (Material != null) { var observer = SgtObserver.Find(camera); if (observer != null) { Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); } } }
public void ObserverPostRender(SgtObserver observer) { if (ObserverOffset != 0.0f) { for (var i = models.Count - 1; i >= 0; i--) { var model = models[i]; if (model != null) { var modelTransform = model.transform; SgtHelper.BeginStealthSet(modelTransform); { modelTransform.position = model.TempPosition; } SgtHelper.EndStealthSet(); } } } }
public void ObserverPostRender(SgtObserver observer) { if (ObserverOffset != 0.0f) { for (var i = planes.Count - 1; i >= 0; i--) { var plane = planes[i]; if (plane != null) { var planeTransform = plane.transform; SgtHelper.BeginStealthSet(planeTransform); { planeTransform.position = plane.TempPosition; } SgtHelper.EndStealthSet(); } } } }
protected virtual void CameraPreCull(Camera camera) { for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null) { if (group.Material != null) { var observer = SgtObserver.Find(camera); if (observer != null) { group.Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); if (StretchToObservers == true) { var velocity = (StretchOverride == true ? StretchVector : observer.Velocity) * StretchScale; group.Material.SetVector("_StretchVector", velocity); group.Material.SetVector("_StretchDirection", velocity.normalized); group.Material.SetFloat("_StretchLength", velocity.magnitude); } } } if (FollowObservers == true) { if (group.TempSet == false) { group.TempSet = true; group.TempPosition = group.transform.position; } group.transform.position = camera.transform.position; } } } }
public override void ObserverPreCull(SgtObserver observer) { base.ObserverPreCull(observer); var dir = (transform.position - observer.transform.position).normalized; var theta = Mathf.Abs(Vector3.Dot(transform.up, dir)); var bright = Mathf.Lerp(HorizontalBrightness, Brightness, Mathf.Pow(theta, HorizontalPower)); var color = SgtHelper.Brighten(Color, bright); for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null) { if (group.Material != null) { group.Material.SetColor("_Color", color); } } } }
public void ObserverPostRender(SgtObserver observer) { for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null) { if (group.Material != null) { group.Material.SetFloat("_CameraRollAngle", 0.0f); } if (FollowObservers == true) { SgtHelper.BeginStealthSet(group.transform); { group.transform.position = group.TempPosition; } SgtHelper.EndStealthSet(); } } } }
public void ObserverPreCull(SgtObserver observer) { for (var i = groups.Count - 1; i >= 0; i--) { var group = groups[i]; if (group != null && group.Material != null) { group.Material.SetFloat("_CameraRollAngle", observer.RollAngle * Mathf.Deg2Rad); } } }