コード例 #1
0
        public void Clear(Color clearColor)
        {
            int num = lightMapTargets.Length;

            for (int i = 0; i < num; i++)
            {
                CreateLightMap createLightMap = lightMapTargets[i];
                createLightMap.Clear(clearColor);
            }
        }
コード例 #2
0
        public void Render(bool destroyOnComplete)
        {
            if (depthCam == null)
            {
                Log.LogError(this, "The Depth Camera has been destroyed. Depth map not created.");
                return;
            }
            createRenderTexture();
            Quaternion localRotation = directionalLight.transform.localRotation;
            float      num           = 0f;

            if (numberPasses > 1)
            {
                num = maxShadowAngle / (float)(numberPasses - 1);
                rotateLight((0f - num) * (float)(numberPasses - 1) / 2f);
            }
            for (int i = 0; i < numberPasses; i++)
            {
                frameWorld();
                depthCam.Render();
                Matrix4x4 matrix4x  = Matrix4x4.TRS(Vector3.one * 0.5f, Quaternion.identity, Vector3.one * 0.5f);
                Matrix4x4 matrix4x2 = depthCam.projectionMatrix * depthCam.worldToCameraMatrix;
                int       num2      = lightMapTargets.Length;
                for (int j = 0; j < num2; j++)
                {
                    CreateLightMap createLightMap = lightMapTargets[j];
                    createLightMap.RenderSinglePass(matrix4x * matrix4x2, renderTex, i, numberPasses);
                }
                rotateLight(num);
            }
            directionalLight.transform.localRotation = localRotation;
            if (destroyOnComplete)
            {
                int num2 = lightMapTargets.Length;
                for (int j = 0; j < num2; j++)
                {
                    CreateLightMap createLightMap = lightMapTargets[j];
                    Object.Destroy(createLightMap);
                }
                Object.Destroy(base.gameObject);
            }
        }