コード例 #1
0
		public static bool LoadTexture2DLutFromImage( Texture2D texture, ToolSettings settings, out Texture2D lutTexture )
		{
			var width = settings.Resolution.TargetWidth;
			var height = settings.Resolution.TargetHeight;

			var size = settings.LUT.Size;
			var cols = settings.LUT.Columns;
			var rows = settings.LUT.Rows;

			var imageData = texture.GetPixels();

			var lutText = new Texture2D( size * size, size, TextureFormat.ARGB32, false );
			var lutData = new Color[ size * size * size ];


			for ( int h = 0, i = 0; h < size; h++ )
			{
				for ( int r = 0; r < rows; r++ )
				{
					for ( int w = 0; w < size * cols; w++ )
					{
						var x = w;
						var y = h + r * size;
						y = height - 1 - y;
						lutData[ i++ ] = imageData[ x + y * width ];
					}
				}
			}

			lutText.SetPixels( lutData );
			lutText.Apply();
			lutTexture = lutText;

			return true;
		}
コード例 #2
0
ファイル: FileHandler.cs プロジェクト: davidlawson/ggj2016
		public FileHandler( BackBufferHandler backBufferHandler, LUTWriter lutWriter, ToolSettings settings, CameraCollection cameraCollection )
		{
			_backBufferHandler = backBufferHandler;
			_lutWriter = lutWriter;
			_settings = settings;
			_cameraCollection = cameraCollection;
		}
コード例 #3
0
 public PhotoshopHandler(PhotoshopProtocol photoshopProtocol, BackBufferHandler backBufferHandler, LUTWriter lutWriter, ToolSettings settings, CameraCollection cameraCollection)
 {
     _photoshopProtocol = photoshopProtocol;
     _backBufferHandler = backBufferHandler;
     _lutWriter         = lutWriter;
     _settings          = settings;
     _cameraCollection  = cameraCollection;
 }
コード例 #4
0
		public PhotoshopHandler( PhotoshopProtocol photoshopProtocol, BackBufferHandler backBufferHandler, LUTWriter lutWriter, ToolSettings settings, CameraCollection cameraCollection )
		{
			_photoshopProtocol = photoshopProtocol;
			_backBufferHandler = backBufferHandler;
			_lutWriter = lutWriter;
			_settings = settings;
			_cameraCollection = cameraCollection;
		}
コード例 #5
0
        public static bool LoadTexture2DLutFromImage(Texture2D texture, ToolSettings settings, ref Texture2D lutTexture)
        {
            var width  = settings.Resolution.TargetWidth;
            var height = settings.Resolution.TargetHeight;

            var size = settings.LUT.Size;
            var cols = settings.LUT.Columns;
            var rows = settings.LUT.Rows;

            var imageData = texture.GetPixels();

            var lutText = new Texture2D(size * size, size, TextureFormat.ARGB32, false);
            var lutData = new Color[size * size * size];


            for (int h = 0, i = 0; h < size; h++)
            {
                for (int r = 0; r < rows; r++)
                {
                    for (int w = 0; w < size * cols; w++)
                    {
                        var x = w;
                        var y = h + r * size;
                        y            = height - 1 - y;
                        lutData[i++] = imageData[x + y * width];
                    }
                }
            }

            lutText.SetPixels(lutData);
            lutText.Apply();

            if (lutTexture != null)
            {
                Texture2D.DestroyImmediate(lutTexture);
            }

            lutTexture = lutText;

            return(true);
        }