--- deliantra/Deliantra-Client/DC/Texture.pm 2007/08/19 12:56:24 1.26 +++ deliantra/Deliantra-Client/DC/Texture.pm 2007/08/28 01:23:47 1.28 @@ -123,14 +123,14 @@ my ($data, $dw, $dh); - if (exists $self->{data}) { + if (defined $self->{data}) { $data = $self->{data}; ($dw, $dh) = @$self{qw(w h)}; - } elsif (exists $self->{render_cb}) { + } elsif ($self->{render_cb}) { ($dw, $dh) = @$self{qw(w h)}; - } elsif (exists $self->{image}) { + } elsif (defined $self->{image}) { ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type}) = CFPlus::load_image_inline $self->{image}; @@ -139,18 +139,13 @@ delete $self->{image} if delete $self->{delete_image}; - } elsif (exists $self->{tile}) { + } elsif (defined $self->{tile}) { ++$self->{loading}; return CFPlus::DB::get tilecache => $self->{tile}, sub { $self->loading_done ($_[0]); - - $::MAP->set_texture ($self->{tile}, @$self{qw(name w h s t)}, @{$self->{minified}}) - if $::MAP; - $::MAPWIDGET->update - if $::MAPWIDGET; }; - } elsif (exists $self->{path}) { + } elsif (defined $self->{path}) { ++$self->{loading}; return CFPlus::DB::read_file $self->{path}, sub { $self->loading_done ($_[0]); @@ -168,13 +163,13 @@ if $self->{minify}; # against rather broken cards we enforce a maximum texture size - $tw = min $MAX_W, minpot $tw; - $th = min $MAX_H, minpot $th; + $tw = min $MAX_W, $tw; + $th = min $MAX_H, $th; # if only pot-textures are allowed, pot'ify tw/th - unless ($GL_NPOT && 0) {#d# - $tw = minpot $tw; - $th = minpot $th; + unless ($GL_NPOT) { + $tw = CFPlus::minpot $tw; + $th = CFPlus::minpot $th; } # now further decrease texture size until the @@ -298,6 +293,13 @@ $self->{s} = $rw / $tw; $self->{t} = $rh / $th; + + if ($self->{tile}) { + $::MAP->set_texture ($self->{tile}, @$self{qw(name w h s t)}, @{$self->{minified}}) + if $::MAP; + $::MAPWIDGET->update + if $::MAPWIDGET; + } } $_->($self)