Ejemplo n.º 1
0
    // Graphics.Draw() Mode Drawing
    static public void PreRender(LightingMainBuffer2D mainBuffer)
    {
        Camera camera = mainBuffer.cameraSettings.GetCamera();

        if (camera == null)
        {
            return;
        }

        if (mainBuffer.cameraSettings.renderMode == CameraSettings.RenderMode.Disabled)
        {
            return;
        }

        if (Lighting2D.RenderingMode != RenderingMode.OnPreRender)
        {
            return;
        }

        Graphics.DrawMesh(LightingRender2D.GetMesh(), Matrix4x4.TRS(LightingPosition.GetCameraPlanePosition(camera), camera.transform.rotation, GetSize(camera)), mainBuffer.GetMaterial(), 0, camera);
    }
Ejemplo n.º 2
0
    public void Initialize(LightingMainBuffer2D mainBuffer)
    {
        gameObject.transform.parent = Buffers.Get().transform;

        meshRenderer = gameObject.AddComponent <MeshRenderer>();
        meshRenderer.sharedMaterial = mainBuffer.GetMaterial();

        BufferPreset bufferPreset = mainBuffer.GetBufferPreset();

        bufferPreset.sortingLayer.ApplyToMeshRenderer(meshRenderer);

        // Disable Mesh Renderer Settings
        meshRenderer.shadowCastingMode         = UnityEngine.Rendering.ShadowCastingMode.Off;
        meshRenderer.receiveShadows            = false;
        meshRenderer.lightProbeUsage           = UnityEngine.Rendering.LightProbeUsage.Off;
        meshRenderer.reflectionProbeUsage      = UnityEngine.Rendering.ReflectionProbeUsage.Off;
        meshRenderer.allowOcclusionWhenDynamic = false;

        UpdatePosition();

        meshFilter      = gameObject.AddComponent <MeshFilter>();
        meshFilter.mesh = LightingRender2D.GetMesh();
    }