예제 #1
0
        public static void Blit(ref RenderTexture main, ref RenderTexture swap, P3dBlendMode blendMode, Texture texture, Color color, float opacity, float minimum)
        {
            Instance.SetMaterial(blendMode, texture, color, opacity, minimum);

            Instance.Apply(main);

            P3dHelper.Blit(swap, Instance.Material);

            P3dHelper.Swap(ref main, ref swap);
        }
예제 #2
0
        private void ExecuteCommands(List <P3dCommand> commands, bool sendNotifications, ref RenderTexture main, ref RenderTexture swap, ref Mesh preparedMesh, ref Matrix4x4 preparedMatrix)
        {
            if (swap == null)
            {
                swap = P3dHelper.GetRenderTexture(main);
            }

            if (keepUnpaintable == true)
            {
                P3dCommandReplace.BlitFast(swap, current, Color.white);
            }

            RenderTexture.active = main;

            for (var i = 0; i < commands.Count; i++)
            {
                var command = commands[i];

                if (command.Model != null)
                {
                    RenderTexture.active = swap;

                    command.Apply(main);

                    if (command.RequireMesh == true)
                    {
                        command.Model.GetPrepared(ref preparedMesh, ref preparedMatrix);

                        P3dHelper.Draw(command.Material, preparedMesh, preparedMatrix, command.Submesh, coord);
                    }
                    else
                    {
                        P3dHelper.Draw(command.Material);
                    }

                    P3dHelper.Swap(ref main, ref swap);
                }

                command.Pool();
            }

            commands.Clear();

            if (main.useMipMap == true)
            {
                main.GenerateMips();
            }

            if (sendNotifications == true)
            {
                NotifyOnModified(commands == previewCommands);
            }
        }
예제 #3
0
        private void ExecuteCommands(List <P3dCommand> commands, bool sendNotifications, ref RenderTexture main, ref RenderTexture swap, ref Mesh preparedMesh, ref Matrix4x4 preparedMatrix)
        {
            RenderTexture.active = main;

            for (var i = 0; i < commands.Count; i++)
            {
                var command = commands[i];

                RenderTexture.active = swap;

                command.Apply(main);

                if (command.RequireMesh == true)
                {
                    paintable.GetPrepared(ref preparedMesh, ref preparedMatrix);

                    P3dHelper.Draw(command.Material, preparedMesh, preparedMatrix, slot.Index, coord);
                }
                else
                {
                    P3dHelper.Draw(command.Material);
                }

                P3dHelper.Swap(ref main, ref swap);

                command.Pool();
            }

            commands.Clear();

            if (main.useMipMap == true)
            {
                main.GenerateMips();
            }

            if (sendNotifications == true)
            {
                NotifyOnModified(commands == previewCommands);
            }
        }