// Token: 0x06000968 RID: 2408 RVA: 0x00049E69 File Offset: 0x00048069 public static void RegisterS(GameObject gameObj) { if (!AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryRegister(gameObj, false); } }
// Token: 0x0600096C RID: 2412 RVA: 0x00049F79 File Offset: 0x00048179 public static void UnregisterS(GameObject gameObj) { if (AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryUnregister(gameObj); } }
private void CheckTeleportReset(AmplifyMotionEffectBase inst) { if (Vector3.SqrMagnitude(base.transform.position - this.m_lastPosition) > inst.MinResetDeltaDistSqr) { AmplifyMotionObjectBase.RecursiveResetMotionAtFrame(base.transform, this, Time.frameCount + inst.ResetFrameDelay); } }
private void OnEnable() { bool flag = this.InitializeType(); if (flag) { if (this.m_type == ObjectType.Cloth) { this.m_fixedStep = false; } else if (this.m_type == ObjectType.Solid) { Rigidbody component = base.GetComponent <Rigidbody>(); if (component != null && component.interpolation == RigidbodyInterpolation.None && !component.isKinematic) { this.m_fixedStep = true; } } } if (this.m_applyToChildren) { foreach (object obj in base.gameObject.transform) { Transform transform = (Transform)obj; AmplifyMotionEffectBase.RegisterRecursivelyS(transform.gameObject); } } if (!flag) { base.enabled = false; } }
internal static bool CanRegister(GameObject gameObj, bool autoReg) { if (gameObj.isStatic) { return(false); } Renderer component = gameObj.GetComponent <Renderer>(); if (component == null || component.sharedMaterials == null || component.isPartOfStaticBatch) { return(false); } if (!component.enabled) { return(false); } if (component.shadowCastingMode == ShadowCastingMode.ShadowsOnly) { return(false); } if (component.GetType() == typeof(SpriteRenderer)) { return(false); } if (!AmplifyMotionEffectBase.FindValidTag(component.sharedMaterials)) { return(false); } Type type = component.GetType(); return(type == typeof(MeshRenderer) || type == typeof(SkinnedMeshRenderer)); }
public static void UnregisterRecursivelyS(GameObject gameObj) { if (AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryUnregister(gameObj); } IEnumerator enumerator = gameObj.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AmplifyMotionEffectBase.UnregisterRecursivelyS(transform.gameObject); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }
void OnEnable() { bool valid = InitializeType(); if (valid) { if (m_type == AmplifyMotion.ObjectType.Cloth) { m_fixedStep = false; } else if (m_type == AmplifyMotion.ObjectType.Solid) { Rigidbody rigidbody = GetComponent <Rigidbody>(); if (rigidbody != null && rigidbody.interpolation == RigidbodyInterpolation.None && !rigidbody.isKinematic) { m_fixedStep = true; } } } if (m_applyToChildren) { foreach (Transform child in gameObject.transform) { AmplifyMotionEffectBase.RegisterRecursivelyS(child.gameObject); } } if (!valid) { enabled = false; } }
public void UpdateTransform(AmplifyMotionEffectBase inst, CommandBuffer updateCB) { if (!this.m_initialized) { this.Initialize(); } if (Time.frameCount > this.m_prevFrameCount && (this.m_autoStep || this.m_step)) { this.UpdateMatrices(); if (this.m_affectedObjectsChanged) { this.UpdateAffectedObjects(); } for (int i = 0; i < this.m_affectedObjects.Length; i++) { if (!this.m_affectedObjects[i].FixedStep) { this.m_affectedObjects[i].OnUpdateTransform(inst, this.m_camera, updateCB, this.m_starting); } } this.m_starting = false; this.m_step = false; this.m_prevFrameCount = Time.frameCount; } }
public void FixedUpdateTransform(AmplifyMotionEffectBase inst, CommandBuffer updateCB) #endif { if (!m_initialized) { Initialize(); } if (m_affectedObjectsChanged) { UpdateAffectedObjects(); } for (int i = 0; i < m_affectedObjects.Length; i++) { if (m_affectedObjects[i].FixedStep) { #if UNITY_4 m_affectedObjects[i].OnUpdateTransform(inst, m_camera, m_starting); #else m_affectedObjects[i].OnUpdateTransform(inst, m_camera, updateCB, m_starting); #endif } } }
void Awake() { if (m_firstInstance == null) { m_firstInstance = this; } m_isD3D = SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D"); m_globalObjectId = 1; m_width = m_height = 0; if (ForceCPUOnly) { m_canUseGPU = false; } else { #if !UNITY_4 bool hasRTs = SystemInfo.supportsRenderTextures; bool hasSM3 = (SystemInfo.graphicsShaderLevel >= 30); bool hasRHalfTex = SystemInfo.SupportsTextureFormat(TextureFormat.RHalf); bool hasRGHalfTex = SystemInfo.SupportsTextureFormat(TextureFormat.RGHalf); bool hasARGBHalfTex = SystemInfo.SupportsTextureFormat(TextureFormat.RGBAHalf); bool hasARGBFloatRT = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBFloat); m_canUseGPU = hasRTs && hasSM3 && hasRHalfTex && hasRGHalfTex && hasARGBHalfTex && hasARGBFloatRT; #endif } }
void OnEnable() { if (Instance == null) { Instance = AmplifyMotionEffectBase.CurrentInstance; } }
public void UpdateTransform(AmplifyMotionEffectBase inst, CommandBuffer updateCB) #endif { if (!m_initialized) { Initialize(); } if (Time.frameCount > m_prevFrameCount && (m_autoStep || m_step)) { UpdateMatrices(); if (m_affectedObjectsChanged) { UpdateAffectedObjects(); } for (int i = 0; i < m_affectedObjects.Length; i++) { if (!m_affectedObjects[i].FixedStep) { #if UNITY_4 m_affectedObjects[i].OnUpdateTransform(inst, m_camera, m_starting); #else m_affectedObjects[i].OnUpdateTransform(inst, m_camera, updateCB, m_starting); #endif } } m_starting = false; m_step = false; m_prevFrameCount = Time.frameCount; } }
private bool InitializeType() { Renderer component = base.GetComponent <Renderer>(); if (AmplifyMotionEffectBase.CanRegister(base.gameObject, false) && component != null) { if (component.GetType() == typeof(MeshRenderer)) { this.m_type = ObjectType.Solid; } else if (component.GetType() == typeof(SkinnedMeshRenderer)) { if (base.GetComponent <Cloth>() != null) { this.m_type = ObjectType.Cloth; } else { this.m_type = ObjectType.Skinned; } } AmplifyMotionEffectBase.RegisterObject(this); } return(component != null); }
void OnDisable() { m_initialized = false; #if !UNITY_4 ShutdownCommandBuffers(); #endif AmplifyMotionEffectBase.UnregisterCamera(this); }
public void LinkTo(AmplifyMotionEffectBase instance, bool overlay) { this.Instance = instance; this.m_camera = base.GetComponent <Camera>(); this.m_camera.depthTextureMode |= DepthTextureMode.Depth; this.m_overlay = overlay; this.m_linked = true; }
// Token: 0x06000964 RID: 2404 RVA: 0x00049DDC File Offset: 0x00047FDC internal static void TryRegister(GameObject gameObj, bool autoReg) { if (AmplifyMotionEffectBase.CanRegister(gameObj, autoReg) && gameObj.GetComponent <AmplifyMotionObjectBase>() == null) { AmplifyMotionObjectBase.ApplyToChildren = false; gameObj.AddComponent <AmplifyMotionObjectBase>(); AmplifyMotionObjectBase.ApplyToChildren = true; } }
public void LinkTo( AmplifyMotionEffectBase instance, bool overlay ) { Instance = instance; m_camera = GetComponent<Camera>(); m_camera.depthTextureMode |= DepthTextureMode.Depth; m_overlay = overlay; m_linked = true; }
public static void RegisterRecursivelyS(GameObject gameObj) { if (!AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryRegister(gameObj, false); } foreach (Transform transform in gameObj.transform) { AmplifyMotionEffectBase.RegisterRecursivelyS(transform.gameObject); } }
public void UnregisterRecursively(GameObject gameObj) { if (AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryUnregister(gameObj); } foreach (Transform transform in gameObj.transform) { this.UnregisterRecursively(transform.gameObject); } }
// Token: 0x0600096D RID: 2413 RVA: 0x00049FDC File Offset: 0x000481DC public static void UnregisterRecursivelyS(GameObject gameObj) { if (AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryUnregister(gameObj); } foreach (object obj in gameObj.transform) { AmplifyMotionEffectBase.UnregisterRecursivelyS(((Transform)obj).gameObject); } }
// Token: 0x0600095F RID: 2399 RVA: 0x00049B84 File Offset: 0x00047D84 public void UpdateActiveObjects() { GameObject[] array = UnityEngine.Object.FindObjectsOfType(typeof(GameObject)) as GameObject[]; for (int i = 0; i < array.Length; i++) { if (!AmplifyMotionEffectBase.m_activeObjects.ContainsKey(array[i])) { AmplifyMotionEffectBase.TryRegister(array[i], true); } } }
//public string DebugString = ""; void Awake() { if (m_firstInstance == null) { m_firstInstance = this; } m_globalObjectId = 1; m_width = m_height = 0; }
internal void OnUpdateTransform(AmplifyMotionEffectBase inst, Camera camera, CommandBuffer updateCB, bool starting) { MotionState motionState; if (this.m_states.TryGetValue(camera, out motionState) && !motionState.Error) { this.CheckTeleportReset(inst); bool flag = this.m_resetAtFrame > 0 && Time.frameCount >= this.m_resetAtFrame; motionState.UpdateTransform(updateCB, starting || flag); } this.m_lastPosition = base.transform.position; }
public void LinkTo(AmplifyMotionEffectBase instance, bool overlay) { Instance = instance; m_camera = GetComponent <Camera>(); m_camera.depthTextureMode |= DepthTextureMode.Depth; InitializeCommandBuffers(); m_overlay = overlay; m_linked = true; }
// Token: 0x06000968 RID: 2408 RVA: 0x00049E58 File Offset: 0x00048058 public void RegisterRecursively(GameObject gameObj) { if (!AmplifyMotionEffectBase.m_activeObjects.ContainsKey(gameObj)) { AmplifyMotionEffectBase.TryRegister(gameObj, false); } foreach (object obj in gameObj.transform) { Transform transform = (Transform)obj; this.RegisterRecursively(transform.gameObject); } }
void Awake() { if (m_firstInstance == null) { m_firstInstance = this; } m_isD3D = SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D"); m_globalObjectId = 1; m_width = m_height = 0; }
internal void OnUpdateTransform(AmplifyMotionEffectBase inst, Camera camera, CommandBuffer updateCB, bool starting) { AmplifyMotion.MotionState state; if (m_states.TryGetValue(camera, out state)) { if (!state.Error) { CheckTeleportReset(inst); bool reset = (m_resetAtFrame > 0 && Time.frameCount >= m_resetAtFrame); state.UpdateTransform(updateCB, starting || reset); } } m_lastPosition = transform.position; }
void OnEnable() { m_camera = GetComponent<Camera>(); AmplifyMotionEffectBase.RegisterCamera( this ); // Assign reference only on first initialization, which is always made by Motion if ( Instance == null ) Instance = AmplifyMotionEffectBase.CurrentInstance; m_camera.depthTextureMode |= DepthTextureMode.Depth; m_step = false; UpdateMatrices(); }
bool InitializeType() { Renderer renderer = GetComponent <Renderer>(); if (AmplifyMotionEffectBase.CanRegister(gameObject, false)) { #if !UNITY_PRE_5_3 ParticleSystem particleRenderer = GetComponent <ParticleSystem>(); if (particleRenderer != null) { m_type = AmplifyMotion.ObjectType.Particle; AmplifyMotionEffectBase.RegisterObject(this); } else #endif if (renderer != null) { // At this point, Renderer is guaranteed to be one of the following if (renderer.GetType() == typeof(MeshRenderer)) { m_type = AmplifyMotion.ObjectType.Solid; } #if UNITY_4 else if (renderer.GetType() == typeof(ClothRenderer)) { m_type = AmplifyMotion.ObjectType.Cloth; } #endif else if (renderer.GetType() == typeof(SkinnedMeshRenderer)) { #if !UNITY_4 if (GetComponent <Cloth>() != null) { m_type = AmplifyMotion.ObjectType.Cloth; } else #endif m_type = AmplifyMotion.ObjectType.Skinned; } AmplifyMotionEffectBase.RegisterObject(this); } } // No renderer? disable it, it is here just for adding children return(renderer != null); }
void InitializeCameras() { List <Camera> cleanOverlayCameras = new List <Camera>(OverlayCameras.Length); for (int i = 0; i < OverlayCameras.Length; i++) { if (OverlayCameras[i] != null) { cleanOverlayCameras.Add(OverlayCameras[i]); } } Camera[] referenceCameras = new Camera[cleanOverlayCameras.Count + 1]; referenceCameras[0] = this.GetComponent <Camera>(); for (int i = 0; i < cleanOverlayCameras.Count; i++) { referenceCameras[i + 1] = cleanOverlayCameras[i]; } m_linkedCameras.Clear(); for (int i = 0; i < referenceCameras.Length; i++) { Camera reference = referenceCameras[i]; if (!m_linkedCameras.ContainsKey(reference)) { AmplifyMotionCamera cam = reference.gameObject.GetComponent <AmplifyMotionCamera>(); if (cam != null && cam.Instance != this) { DestroyImmediate(cam); cam = null; } if (cam == null) { CurrentInstance = this; cam = reference.gameObject.AddComponent <AmplifyMotionCamera>(); cam.SetOverlay(i > 0); CurrentInstance = null; } m_linkedCameras.Add(reference, cam); m_linkedCamerasChanged = true; } } }
void OnEnable() { AmplifyMotionEffectBase.RegisterCamera(this); // Assign reference only on first initialization, which is always made by Motion if (Instance == null) { Instance = AmplifyMotionEffectBase.CurrentInstance; } GetComponent <Camera>().depthTextureMode |= DepthTextureMode.Depth; m_d3d = SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D"); m_step = false; UpdateMatrices(); }
private void OnPostRender() { bool flag = this.QualityLevel != this.m_qualityLevel; if (flag) { this.CreateMaterials(); this.m_qualityLevel = this.QualityLevel; } this.UpdateRenderTextures(flag); this.ResetObjectId(); bool flag2 = this.CameraMotionMult > 1.401298E-45f; bool clearColor = !flag2 || this.m_starting; float y = (this.DepthThreshold <= 1.401298E-45f) ? 3.40282347E+38f : (1f / this.DepthThreshold); this.m_motionScaleNorm = ((this.m_deltaTime < 1.401298E-45f) ? 0f : (this.MotionScale * (1f / this.m_deltaTime))); this.m_fixedMotionScaleNorm = ((this.m_fixedDeltaTime < 1.401298E-45f) ? 0f : (this.MotionScale * (1f / this.m_fixedDeltaTime))); float scale = this.m_starting ? 0f : this.m_motionScaleNorm; float fixedScale = this.m_starting ? 0f : this.m_fixedMotionScaleNorm; AmplifyMotionEffectBase.DiscardContents(this.m_motionRT); this.m_updateCB.Clear(); this.m_renderCB.Clear(); this.m_renderCB.SetGlobalFloat("_AM_MIN_VELOCITY", this.MinVelocity); this.m_renderCB.SetGlobalFloat("_AM_MAX_VELOCITY", this.MaxVelocity); this.m_renderCB.SetGlobalFloat("_AM_RCP_TOTAL_VELOCITY", 1f / (this.MaxVelocity - this.MinVelocity)); this.m_renderCB.SetGlobalVector("_AM_DEPTH_THRESHOLD", new Vector2(this.DepthThreshold, y)); this.m_renderCB.SetRenderTarget(this.m_motionRT); this.m_renderCB.ClearRenderTarget(true, clearColor, Color.black); if (flag2) { float num = (this.m_deltaTime < 1.401298E-45f) ? 0f : (this.MotionScale * this.CameraMotionMult * (1f / this.m_deltaTime)); float scale2 = this.m_starting ? 0f : num; this.RenderReprojectionVectors(this.m_renderCB, this.m_motionRT, scale2); } this.m_baseCamera.RenderVectors(this.m_renderCB, scale, fixedScale, this.QualityLevel); for (int i = 0; i < this.m_linkedCameraValues.Length; i++) { AmplifyMotionCamera amplifyMotionCamera = this.m_linkedCameraValues[i]; if (amplifyMotionCamera != null && amplifyMotionCamera.Overlay && amplifyMotionCamera.isActiveAndEnabled) { this.m_linkedCameraValues[i].RenderVectors(this.m_renderCB, scale, fixedScale, this.QualityLevel); } } this.m_starting = false; }
void InitializeCameras() { List<Camera> cleanOverlayCameras = new List<Camera>( OverlayCameras.Length ); for ( int i = 0; i < OverlayCameras.Length; i++ ) { if ( OverlayCameras[ i ] != null ) cleanOverlayCameras.Add( OverlayCameras[ i ] ); } Camera[] referenceCameras = new Camera[ cleanOverlayCameras.Count + 1 ]; referenceCameras[ 0 ] = m_camera; for ( int i = 0; i < cleanOverlayCameras.Count; i++ ) referenceCameras[ i + 1 ] = cleanOverlayCameras[ i ]; m_linkedCameras.Clear(); for ( int i = 0; i < referenceCameras.Length; i++ ) { Camera reference = referenceCameras[ i ]; if ( !m_linkedCameras.ContainsKey( reference ) ) { AmplifyMotionCamera cam = reference.gameObject.GetComponent<AmplifyMotionCamera>(); if ( cam != null && cam.Instance != this ) { DestroyImmediate( cam ); cam = null; } if ( cam == null ) { CurrentInstance = this; cam = reference.gameObject.AddComponent<AmplifyMotionCamera>(); cam.SetOverlay( i > 0 ); CurrentInstance = null; } m_linkedCameras.Add( reference, cam ); m_linkedCamerasChanged = true; } } }
void Awake() { if ( m_firstInstance == null ) m_firstInstance = this; m_isD3D = SystemInfo.graphicsDeviceVersion.StartsWith( "Direct3D" ); m_globalObjectId = 1; m_width = m_height = 0; if ( ForceCPUOnly ) m_canUseGPU = false; else { #if !UNITY_4 bool hasRTs = SystemInfo.supportsRenderTextures; bool hasSM3 = ( SystemInfo.graphicsShaderLevel >= 30 ); bool hasRHalfTex = SystemInfo.SupportsTextureFormat( TextureFormat.RHalf ); bool hasRGHalfTex = SystemInfo.SupportsTextureFormat( TextureFormat.RGHalf ); bool hasARGBHalfTex = SystemInfo.SupportsTextureFormat( TextureFormat.RGBAHalf ); bool hasARGBFloatRT = SystemInfo.SupportsRenderTextureFormat( RenderTextureFormat.ARGBFloat ); m_canUseGPU = hasRTs && hasSM3 && hasRHalfTex && hasRGHalfTex && hasARGBHalfTex && hasARGBFloatRT; #endif } }
void OnEnable() { AmplifyMotionEffectBase.RegisterCamera( this ); // Assign reference only on first initialization, which is always made by Motion if ( Instance == null ) Instance = AmplifyMotionEffectBase.CurrentInstance; GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth; m_d3d = SystemInfo.graphicsDeviceVersion.StartsWith( "Direct3D" ); m_step = false; UpdateMatrices(); }
void Awake() { if ( m_firstInstance == null ) m_firstInstance = this; m_isD3D = SystemInfo.graphicsDeviceVersion.StartsWith( "Direct3D" ); m_globalObjectId = 1; m_width = m_height = 0; }
void UpdatePostProcess() { Camera highestReference = null; float highestDepth = -float.MaxValue; if ( m_linkedCamerasChanged ) UpdateLinkedCameras(); for ( int i = 0; i < m_linkedCameraKeys.Length; i++ ) { if ( m_linkedCameraKeys[ i ].depth > highestDepth ) { highestReference = m_linkedCameraKeys[ i ]; highestDepth = m_linkedCameraKeys[ i ].depth; } } if ( m_currentPostProcess != null && m_currentPostProcess.gameObject != highestReference.gameObject ) { DestroyImmediate( m_currentPostProcess ); m_currentPostProcess = null; } if ( m_currentPostProcess == null && highestReference != null && highestReference != m_camera ) { CurrentInstance = this; AmplifyMotionPostProcess[] runtimes = gameObject.GetComponents<AmplifyMotionPostProcess>(); if ( runtimes != null && runtimes.Length > 0 ) { for ( int i = 0; i < runtimes.Length; i++ ) DestroyImmediate( runtimes[ i ] ); } m_currentPostProcess = highestReference.gameObject.AddComponent<AmplifyMotionPostProcess>(); CurrentInstance = null; } }
void OnEnable() { if ( Instance == null ) Instance = AmplifyMotionEffectBase.CurrentInstance; }
private void Awake() { if (AmplifyMotionEffectBase.m_firstInstance == null) { AmplifyMotionEffectBase.m_firstInstance = this; } AmplifyMotionEffectBase.m_isD3D = SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D"); this.m_globalObjectId = 1; this.m_width = (this.m_height = 0); if (this.ForceCPUOnly) { this.m_canUseGPU = false; } else { bool supportsRenderTextures = SystemInfo.supportsRenderTextures; bool flag = SystemInfo.graphicsShaderLevel >= 30; bool flag2 = SystemInfo.SupportsTextureFormat(TextureFormat.RHalf); bool flag3 = SystemInfo.SupportsTextureFormat(TextureFormat.RGHalf); bool flag4 = SystemInfo.SupportsTextureFormat(TextureFormat.RGBAHalf); bool flag5 = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBFloat); this.m_canUseGPU = (supportsRenderTextures && flag && flag2 && flag3 && flag4 && flag5); } }