4545 MixinPropertyModel ,
4646 MixinPropertyOpacity ,
4747 MixinPropertySegments ,
48+ MixinPropertySize ,
4849 MixinPropertyThickness ,
4950 MixinPropertyTypeMaterial ,
5051 MixinPropertyWireframe ,
@@ -235,6 +236,7 @@ class VisualRGBColourspace3D(
235236 MixinPropertyTypeMaterial ,
236237 MixinPropertyWireframe ,
237238 MixinPropertySegments ,
239+ MixinPropertySize ,
238240 MixinPropertyKwargs ,
239241 Visual ,
240242):
@@ -263,6 +265,9 @@ class VisualRGBColourspace3D(
263265 Whether to render the visual as a wireframe, i.e., only render edges.
264266 segments
265267 Edge segments count for the *RGB* colourspace cube.
268+ size
269+ Size of the underlying *RGB* colourspace cube; used for plotting HDR
270+ related volumes.
266271
267272 Other Parameters
268273 ----------------
@@ -279,6 +284,7 @@ class VisualRGBColourspace3D(
279284 - :attr:`~colour_visuals.VisualRGBColourspace3D.type_material`
280285 - :attr:`~colour_visuals.VisualRGBColourspace3D.wireframe`
281286 - :attr:`~colour_visuals.VisualRGBColourspace3D.segments`
287+ - :attr:`~colour_visuals.VisualRGBColourspace3D.size`
282288
283289 Methods
284290 -------
@@ -325,6 +331,7 @@ def __init__(
325331 material : Type [gfx .MeshAbstractMaterial ] = gfx .MeshBasicMaterial ,
326332 wireframe : bool = False ,
327333 segments : int = 16 ,
334+ size : float = 1 ,
328335 ** kwargs ,
329336 ):
330337 super ().__init__ ()
@@ -340,6 +347,7 @@ def __init__(
340347 self .type_material = material
341348 self .wireframe = wireframe
342349 self .segments = segments
350+ self .size = size
343351 self .kwargs = kwargs
344352
345353 self .update ()
@@ -360,12 +368,16 @@ def update(self):
360368 )
361369 )
362370
363- positions = vertices ["position" ] + 0.5
371+ positions = ( vertices ["position" ] + 0.5 ) * self . _size
364372
365373 positions [positions == 0 ] = EPSILON
366374
367375 if self ._colour is None :
368- colour = positions
376+ # NOTE: The colours are normalised by the reciprocal of *self._size*
377+ # to avoid unpleasant clipping when displaying HDR volumes, e.g.
378+ # the full ITU-R BT.2020 volume within ICtCp which is using a size
379+ # of 10000.
380+ colour = positions * (1.0 / self ._size )
369381 else :
370382 colour = np .tile (self ._colour , (positions .shape [0 ], 1 ))
371383
0 commit comments