ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Texture.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Texture.pm (file contents):
Revision 1.16 by root, Thu Jul 19 13:45:18 2007 UTC vs.
Revision 1.18 by root, Thu Jul 19 21:02:02 2007 UTC

114 $self->{internalformat} ||= $internalformat; 114 $self->{internalformat} ||= $internalformat;
115 ($dw, $dh) = @$self{qw(w h)}; 115 ($dw, $dh) = @$self{qw(w h)};
116 } 116 }
117 117
118 my ($tw, $th) = ($dw, $dh); 118 my ($tw, $th) = ($dw, $dh);
119 my ($rw, $rh) = ($dw, $dh);
120 119
121 defined $data or $self->{render_cb} or die; # some sanity check 120 defined $data or $self->{render_cb} or die; # some sanity check
122 121
123 $self->{minified} ||= [CFPlus::average $dw, $dh, $data] 122 $self->{minified} ||= [CFPlus::average $dw, $dh, $data]
124 if $self->{minify}; 123 if $self->{minify};
139 # quarter the texture size 138 # quarter the texture size
140 $tw >>= 1; 139 $tw >>= 1;
141 $th >>= 1; 140 $th >>= 1;
142 } 141 }
143 142
143 # decide the amount of space used in the texture
144 my ($rw, $rh);
145
144 if ($self->{render_cb}) { 146 if ($self->{render_cb}) {
145 # use only part of the texture 147 # use only part of the texture
146 #$rw >>= 1 while $rw > $tw; 148 #$rw >>= 1 while $rw > $tw;
147 #$rh >>= 1 while $rh > $th; 149 #$rh >>= 1 while $rh > $th;
148 $rw = min $rw, $tw; 150 $rw = min $dw, $tw;
149 $rh = min $rh, $th; 151 $rh = min $dh, $th;
150 } else { 152 } else {
151 if ($self->{wrap} || $tw < $dw || $th < $dh) { 153 if ($self->{wrap} || $tw < $dw || $th < $dh) {
152 # scale to the full texture size 154 # scale to the full texture size
153 ($rw, $rh) = ($tw, $th); 155 ($rw, $rh) = ($tw, $th);
154 } else { 156 } else {
161 163
162 # rendering means we need to scale in some way 164 # rendering means we need to scale in some way
163 my $render = $self->{render_cb} || $rw != $dw || $th != $dh; 165 my $render = $self->{render_cb} || $rw != $dw || $th != $dh;
164 166
165 if ($render) { 167 if ($render) {
166 #d#glClear 0,0,0,0;
167 glViewport 0, 0, $tw, $th; 168 glViewport 0, 0, $tw, $th;
169 glClear 0, 0, 0, 0;
168 glMatrixMode GL_PROJECTION; 170 glMatrixMode GL_PROJECTION;
169 glLoadIdentity; 171 glLoadIdentity;
170 glOrtho 0, $tw, 0, $th, -10000, 10000; 172 glOrtho 0, $tw, 0, $th, -10000, 10000;
171 glMatrixMode GL_MODELVIEW; 173 glMatrixMode GL_MODELVIEW;
172 glLoadIdentity; 174 glLoadIdentity;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines