« Chart/Plotly/Trace/Isosurface/Legendgrouptitle/Font.pm
↑ Summary
Chart/Plotly/Trace/Isosurface/Lightposition.pm »
| 1 | package Chart::Plotly::Trace::Isosurface::Lighting; | ||
| 2 | use Moose; | ||
| 3 | use MooseX::ExtraArgs; | ||
| 4 | use Moose::Util::TypeConstraints qw(enum union); | ||
| 5 | if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) { | ||
| 6 | Moose::Util::TypeConstraints::type('PDL'); | ||
| 7 | } | ||
| 8 | |||
| 9 | our $VERSION = '0.042'; # VERSION | ||
| 10 | |||
| 11 | # ABSTRACT: This attribute is one of the possible options for the trace isosurface. | ||
| 12 | |||
| 13 | sub TO_JSON { | ||
| 14 | my $self = shift; | ||
| 15 | my $extra_args = $self->extra_args // {}; | ||
| 16 | my $meta = $self->meta; | ||
| 17 | my %hash = %$self; | ||
| 18 | for my $name ( sort keys %hash ) { | ||
| 19 | my $attr = $meta->get_attribute($name); | ||
| 20 | if ( defined $attr ) { | ||
| 21 | my $value = $hash{$name}; | ||
| 22 | my $type = $attr->type_constraint; | ||
| 23 | if ( $type && $type->equals('Bool') ) { | ||
| 24 | $hash{$name} = $value ? \1 : \0; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
| 28 | %hash = ( %hash, %$extra_args ); | ||
| 29 | delete $hash{'extra_args'}; | ||
| 30 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 31 | $hash{type} = $self->type(); | ||
| 32 | } | ||
| 33 | return \%hash; | ||
| 34 | } | ||
| 35 | |||
| 36 | has ambient => ( is => "rw", | ||
| 37 | isa => "Num", | ||
| 38 | documentation => "Ambient light increases overall color visibility but can wash out the image.", | ||
| 39 | ); | ||
| 40 | |||
| 41 | has diffuse => ( is => "rw", | ||
| 42 | isa => "Num", | ||
| 43 | documentation => "Represents the extent that incident rays are reflected in a range of angles.", | ||
| 44 | ); | ||
| 45 | |||
| 46 | has facenormalsepsilon => ( | ||
| 47 | is => "rw", | ||
| 48 | isa => "Num", | ||
| 49 | documentation => "Epsilon for face normals calculation avoids math issues arising from degenerate geometry.", | ||
| 50 | ); | ||
| 51 | |||
| 52 | has fresnel => ( | ||
| 53 | is => "rw", | ||
| 54 | isa => "Num", | ||
| 55 | documentation => | ||
| 56 | "Represents the reflectance as a dependency of the viewing angle; e.g. paper is reflective when viewing it from the edge of the paper (almost 90 degrees), causing shine.", | ||
| 57 | ); | ||
| 58 | |||
| 59 | has roughness => ( | ||
| 60 | is => "rw", | ||
| 61 | isa => "Num", | ||
| 62 | documentation => "Alters specular reflection; the rougher the surface, the wider and less contrasty the shine.", | ||
| 63 | ); | ||
| 64 | |||
| 65 | has specular => ( | ||
| 66 | is => "rw", | ||
| 67 | isa => "Num", | ||
| 68 | documentation => "Represents the level that incident rays are reflected in a single direction, causing shine.", | ||
| 69 | ); | ||
| 70 | |||
| 71 | has vertexnormalsepsilon => ( | ||
| 72 | is => "rw", | ||
| 73 | isa => "Num", | ||
| 74 | documentation => "Epsilon for vertex normals calculation avoids math issues arising from degenerate geometry.", | ||
| 75 | ); | ||
| 76 | |||
| 77 | __PACKAGE__->meta->make_immutable(); | ||
| 78 | 1; | ||
| 79 | |||
| 80 | __END__ |