--- deliantra/Deliantra-Client/DC/Texture.pm 2007/12/27 20:38:49 1.32 +++ deliantra/Deliantra-Client/DC/Texture.pm 2008/09/08 19:53:23 1.36 @@ -1,6 +1,6 @@ =head1 NAME -DC::Texture - tetxure class for CFPlus +DC::Texture - tetxure class for Deliantra-Client =head1 SYNOPSIS @@ -49,15 +49,10 @@ $class->new (image => $image, internalformat => undef, %arg) } - -sub new_from_file { +sub new_from_resource { my ($class, $path, %arg) = @_; - open my $fh, "<:raw", $path - or die "$path: $!"; - - local $/; - $class->new_from_image (<$fh>, %arg) + $class->new (resource_path => $path, internalformat => undef, %arg) } #sub new_from_surface { @@ -123,6 +118,14 @@ my ($data, $dw, $dh); + if (exists $self->{resource_path}) { + open my $fh, "<:raw", DC::find_rcfile $self->{resource_path}; + local $/; + delete $self->{internalformat}; + $self->{image} = <$fh>; + $self->{delete_image} = 1; + } + if (defined $self->{data}) { $data = $self->{data}; ($dw, $dh) = @$self{qw(w h)}; @@ -133,7 +136,7 @@ } elsif (defined $self->{image}) { ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type}) = DC::load_image_inline $self->{image}; - + $self->{internalformat} ||= $internalformat; ($dw, $dh) = @$self{qw(w h)};