コード例 #1
0
        private void OnEnable()
        {
            RenderCamera = GetComponent <Camera>();
            if (RenderCamera == Camera.main)
            {
                Current = this;

                CameraNear = RenderCamera.nearClipPlane;
                CameraFar  = RenderCamera.farClipPlane - CameraNear;
            }

            _camTr = RenderCamera.transform;


            _Decals               = new Dictionary <Material, HashSet <OzoneDecal> >();
            _DecalsAlbedo         = new List <OzoneDecal>(64);
            _DecalsTarmacs        = new HashSet <OzoneDecal>();
            _DecalsTarmacsNormals = new HashSet <OzoneDecal>();
            //_decalComponent = new List<OzoneDecal>();
            _DecalsNormal = new List <OzoneDecal>(64);
            //_meshFilterComponent = new List<MeshFilter>();

            _matrices            = new Matrix4x4[1023];
            _CutOffLODValues     = new float[1023];
            _NearCutOffLODValues = new float[1023];

            _instancedBlock = new MaterialPropertyBlock();
            _directBlock    = new MaterialPropertyBlock();


            //_cubeMesh = cubeMesh;
            _cubeMesh           = Resources.Load <Mesh>("DecalCubeProject");
            _normalRenderTarget = new RenderTargetIdentifier[] { BuiltinRenderTextureType.GBuffer1, BuiltinRenderTextureType.GBuffer2 };
            _albedoRenderTarget = new RenderTargetIdentifier[] { BuiltinRenderTextureType.GBuffer0, BuiltinRenderTextureType.GBuffer1 };             // ,
        }
コード例 #2
0
 void Awake()
 {
     if (GetComponent <Camera>() == Camera.main)
     {
         Current = this;
     }
 }
コード例 #3
0
 private void OnBecameInvisible()
 {
     if (_Dec != null && _Dec.Shared != null)
     {
         OzoneDecalRenderer.RemoveDecal(this);                 //, Camera.current
     }
 }
コード例 #4
0
 private void OnBecameInvisible()
 {
     IsVisible = false;
     if (IsRendered && _Dec != null && _Dec.Shared != null)
     {
         OzoneDecalRenderer.RemoveDecal(this);                 //, Camera.current
         IsRendered = false;
     }
 }
コード例 #5
0
        /*public void RefreshSortingArray(int index)
         * {
         *      Index = index;
         *      tr.SetSiblingIndex(index);
         *      OnBecameInvisible();
         *      OnBecameVisible();
         * }*/

        private void OnBecameVisible()
        {
            IsVisible = true;
            if (!IsRendered && _Dec != null && _Dec.Shared != null)
            {
                OzoneDecalRenderer.AddDecal(this);                 //, Camera.current
                IsRendered = true;
            }
        }
コード例 #6
0
 void OnWillRenderObject()
 {
     OzoneDecalRenderer.AddDecal(this, Camera.current);
 }