Skip to content

Commit

Permalink
use freshly source built ctlrender
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdcs committed Jul 16, 2023
1 parent ca0bba3 commit 04f06ba
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 115 deletions.
29 changes: 29 additions & 0 deletions CONTRIBUTING_ON_MACOS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Installation
============

Install Homebrew:

```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

Install python versions

```
brew install python@3.9 python@3.10 python@3.11
```

(Re)Install poetry
```
curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | python3 -
```

Working in VSCode / Terminal
============================

Install the poetry environment
```
poetry env use 3.11
poetry install --extras="development meshing optional plotting"
```
48 changes: 24 additions & 24 deletions colour/io/ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ def template_ctl_transform_float(
<BLANKLINE>
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0,
input float exposure = 0.0
)
{
Expand Down Expand Up @@ -380,14 +380,14 @@ def template_ctl_transform_float(
<BLANKLINE>
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut)
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0)
{
rOut = Y_2_linCV(rIn, CINEMA_WHITE, CINEMA_BLACK);
gOut = Y_2_linCV(gIn, CINEMA_WHITE, CINEMA_BLACK);
Expand Down Expand Up @@ -421,14 +421,14 @@ def template_ctl_transform_float(
ctl_file_content += """
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0
""".strip()

if parameters:
Expand Down Expand Up @@ -503,14 +503,14 @@ def template_ctl_transform_float3(
<BLANKLINE>
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut)
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0)
{
float rgbIn[3] = {rIn, gIn, bIn};
<BLANKLINE>
Expand Down Expand Up @@ -546,14 +546,14 @@ def template_ctl_transform_float3(
ctl_file_content += """
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0
""".strip()

if parameters:
Expand Down
8 changes: 4 additions & 4 deletions colour/io/tests/resources/Adjust_Exposure_Float.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0,
input float exposure = 0.0
)
{
Expand Down
8 changes: 4 additions & 4 deletions colour/io/tests/resources/Adjust_Exposure_Float3.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ float[3] adjust_exposure(float rgbIn[3], float exposureIn)

void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0,
input float exposure = 0.0
)
{
Expand Down
162 changes: 79 additions & 83 deletions colour/io/tests/test_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,43 +219,40 @@ def test_template_ctl_transform_float(self):
"input float foo[3] = {1.0, 1.0, 1.0}",
"input float bar = 1.0",
],
header="// Custom Header\n",
header="// Custom Header",
)

self.assertEqual(
ctl_foo_bar_float,
textwrap.dedent(
"""
// Foo & Bar
import "Foo.ctl";
import "Bar.ctl";
// Custom Header
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input float foo[3] = {1.0, 1.0, 1.0},
input float bar = 1.0
)
{
rOut = rIn + foo[0];
gOut = gIn + foo[1];
bOut = bIn + foo[2];
aOut = aIn;
}"""[
1:
]
),
target = textwrap.dedent(
"""
// Foo & Bar
import "Foo.ctl";
import "Bar.ctl";
// Custom Header
void main
(
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0,
input float foo[3] = {1.0, 1.0, 1.0},
input float bar = 1.0
)
{
rOut = rIn + foo[0];
gOut = gIn + foo[1];
bOut = bIn + foo[2];
aOut = aIn;
}"""[
1:
]
)
self.assertEqual(ctl_foo_bar_float, target)


class TestTemplateCtlTransformFloat3(unittest.TestCase):
Expand All @@ -281,31 +278,6 @@ def test_template_ctl_transform_float3(self):
],
header=textwrap.dedent(
"""
float[3] baz(float rgbIn[3], float foo[3], float qux)
{
float rgbOut[3];
rgbOut[0] = rgbIn[0] * foo[0]* qux;
rgbOut[1] = rgbIn[1] * foo[1]* qux;
rgbOut[2] = rgbIn[2] * foo[2]* qux;
return rgbOut;
}\n"""[
1:
]
),
)

self.assertEqual(
ctl_foo_bar_float3,
textwrap.dedent(
"""
// Foo, Bar & Baz
// import "Foo.ctl";
// import "Bar.ctl";
// import "Baz.ctl";
float[3] baz(float rgbIn[3], float foo[3], float qux)
{
float rgbOut[3];
Expand All @@ -316,34 +288,58 @@ def test_template_ctl_transform_float3(self):
return rgbOut;
}
void main
(
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn,
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input float foo[3] = {1.0, 1.0, 1.0},
input float bar = 1.0
)
{
float rgbIn[3] = {rIn, gIn, bIn};
float rgbOut[3] = baz(rgbIn, foo, bar);
rOut = rgbOut[0];
gOut = rgbOut[1];
bOut = rgbOut[2];
aOut = aIn;
}"""[
"""[
1:
]
),
)
# fmt: off
target = textwrap.dedent(
"""
// Foo, Bar & Baz
// import "Foo.ctl";
// import "Bar.ctl";
// import "Baz.ctl";
float[3] baz(float rgbIn[3], float foo[3], float qux)
{
float rgbOut[3];
rgbOut[0] = rgbIn[0] * foo[0]* qux;
rgbOut[1] = rgbIn[1] * foo[1]* qux;
rgbOut[2] = rgbIn[2] * foo[2]* qux;
return rgbOut;
}
void main
(
output varying float rOut,
output varying float gOut,
output varying float bOut,
output varying float aOut,
input varying float rIn,
input varying float gIn,
input varying float bIn,
input varying float aIn = 1.0,
input float foo[3] = {1.0, 1.0, 1.0},
input float bar = 1.0
)
{
float rgbIn[3] = {rIn, gIn, bIn};
float rgbOut[3] = baz(rgbIn, foo, bar);
rOut = rgbOut[0];
gOut = rgbOut[1];
bOut = rgbOut[2];
aOut = aIn;
}"""[
1:
]
)
self.assertEqual(ctl_foo_bar_float3, target)


if __name__ == "__main__":
Expand Down

0 comments on commit 04f06ba

Please sign in to comment.