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

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.51 by root, Sun May 14 20:51:19 2006 UTC vs.
Revision 1.57 by root, Sun May 21 00:02:00 2006 UTC

20 use XSLoader; 20 use XSLoader;
21 XSLoader::load "CFClient", $VERSION; 21 XSLoader::load "CFClient", $VERSION;
22} 22}
23 23
24use Carp (); 24use Carp ();
25use AnyEvent; 25use AnyEvent ();
26use BerkeleyDB; 26use BerkeleyDB;
27
27use CFClient::OpenGL; 28use CFClient::OpenGL;
28 29
29our %GL_EXT; 30our %GL_EXT;
30our $GL_VERSION; 31our $GL_VERSION;
31 32
40 41
41 glDisable GL_COLOR_MATERIAL; 42 glDisable GL_COLOR_MATERIAL;
42 glShadeModel GL_FLAT; 43 glShadeModel GL_FLAT;
43 glDisable GL_DITHER; 44 glDisable GL_DITHER;
44 glDisable GL_DEPTH_TEST; 45 glDisable GL_DEPTH_TEST;
46 glDepthMask 0;
45 glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST; 47 glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST;
46 48
47 CFClient::Texture::restore_state (); 49 CFClient::Texture::restore_state ();
48} 50}
49 51
50sub gl_check { 52sub gl_check {
51 return unless $GL_DEBUG; 53 return unless $GL_DEBUG;
52 54
53 if (my $error = glGetError) { 55 if (my $error = glGetError) {
54 Carp::cluck sprintf "opengl error %x while %s", $error, sprintf @_; 56 Carp::cluck sprintf "opengl error %x while %s", $error, &sprintf(@_);
55 } 57 }
56} 58}
57 59
58sub find_rcfile($) { 60sub find_rcfile($) {
59 my $path; 61 my $path;
120# -Filename => "database", 122# -Filename => "database",
121# -Subname => $table, 123# -Subname => $table,
122 -Property => DB_CHKSUM, 124 -Property => DB_CHKSUM,
123 -Flags => DB_CREATE | DB_UPGRADE, 125 -Flags => DB_CREATE | DB_UPGRADE,
124 or die "unable to create/open database table $_[0]: $BerkeleyDB::Error"; 126 or die "unable to create/open database table $_[0]: $BerkeleyDB::Error";
127}
128
129sub pod_to_pango($) {
130 my ($pom) = @_;
131
132 $pom->present ("CFClient::PodToPango")
133}
134
135package CFClient::PodToPango;
136
137use base Pod::POM::View::Text;
138
139our $indent = 0;
140
141*view_seq_code =
142*view_seq_bold = sub { "<b>$_[1]</b>" };
143*view_seq_italic = sub { "<i>$_[1]</i>" };
144*view_seq_space =
145*view_seq_link =
146*view_seq_index = sub { CFClient::UI::Label::escape ($_[1]) };
147
148sub view_seq_text {
149 my $text = $_[1];
150 $text =~ s/\s+/ /g;
151 CFClient::UI::Label::escape ($text)
152}
153
154sub view_item {
155 ("\t" x ($indent / 4))
156 . $_[1]->title->present ($_[0])
157 . "\n"
158 . $_[1]->content->present ($_[0])
159}
160
161sub view_verbatim {
162 (join "",
163 map +("\t" x ($indent / 2)) . "$_\n",
164 split /\n/, CFClient::UI::Label::escape ($_[1]))
165 . "\n"
166}
167
168sub view_textblock {
169 ("\t" x ($indent / 2)) . "$_[1]\n\n"
170}
171
172sub view_head2 {
173 "<big>" . $_[1]->title->present ($_[0]) . "</big>\n\n"
174 . $_[1]->content->present ($_[0])
175};
176
177sub view_over {
178 local $indent = $indent + $_[1]->indent;
179 $_[1]->content->present ($_[0])
125} 180}
126 181
127package CFClient::Database; 182package CFClient::Database;
128 183
129our @ISA = BerkeleyDB::Btree::; 184our @ISA = BerkeleyDB::Btree::;
301 glGetError; 356 glGetError;
302 357
303 if (defined $data) { 358 if (defined $data) {
304 glTexImage2D GL_TEXTURE_2D, 0, 359 glTexImage2D GL_TEXTURE_2D, 0,
305 $self->{internalformat}, 360 $self->{internalformat},
306 $tw, $th, # need to pad texture first 361 $tw, $th,
307 0, 362 0,
308 $self->{format}, 363 $self->{format},
309 $self->{type}, 364 $self->{type},
310 $data; 365 $data;
311 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", 366 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x",
317 $tw, $th, 372 $tw, $th,
318 0; 373 0;
319 CFClient::gl_check "copying to texture %dx%d if=%x", 374 CFClient::gl_check "copying to texture %dx%d if=%x",
320 $tw, $th, $self->{internalformat}; 375 $tw, $th, $self->{internalformat};
321 } 376 }
377
378 glBindTexture GL_TEXTURE_2D, 0; # just to be on the safe side
322} 379}
323 380
324sub DESTROY { 381sub DESTROY {
325 my ($self) = @_; 382 my ($self) = @_;
326 383
328 385
329 glDeleteTexture delete $self->{name} 386 glDeleteTexture delete $self->{name}
330 if $self->{name}; 387 if $self->{name};
331} 388}
332 389
333sub restore_state{ 390sub restore_state {
334 $_->upload 391 $_->upload
335 for values %TEXTURES; 392 for values %TEXTURES;
336}; 393}
337 394
3381; 3951;
339 396
340=back 397=back
341 398

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines