/[cvs]/api/Classes/Engine3d/Texture.cpp
ViewVC logotype

Contents of /api/Classes/Engine3d/Texture.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sun Jul 1 20:47:58 2001 UTC (23 years, 4 months ago) by bearsoft
Branch: lazy, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
First import

1 #include "Texture.h"
2
3 Texture::Texture()
4 {
5 howfair=0;
6 }
7
8 Texture::~Texture(){}
9
10 int Texture::sizeof_text(char *source)
11 {
12 int r=0;
13
14 while( source[r++] != 0 )
15 {
16 }
17
18 return r;
19 }
20
21 void Texture::copy_text(char *source, char *dest)
22 {
23 for ( int r=0; r<(sizeof_text(source)) ; r++ )
24 {
25 dest[r]=source[r];
26 }
27 }
28
29 int Texture::compare_text(char *source, char *dest)
30 {
31 int sant=1;
32
33 int size=sizeof_text(source);
34 int size2=sizeof_text(dest);
35
36 if ( size == size2 )
37 {
38 for ( int r=0; r<size ; r++ )
39 {
40 if ( dest[r] != source[r] )
41 {
42 sant=0;
43 }
44 }
45 }
46 else
47 {
48 sant=0;
49 }
50
51 return sant;
52 }
53
54
55 int *Texture::add_texture( char *texturedataname )
56 {
57 TextureData **ftexturedata=vtexturedata;
58
59 int *texturepointer;
60
61 int r=0;
62 int sant=0;
63
64 while ( r<howfair && sant == 0 )
65 {
66 sant=compare_text(texturedataname,ftexturedata[0]->name);
67
68 if ( sant == 0 )
69 {
70 ftexturedata=ftexturedata[0]->texturedata_next;
71 }
72
73 r++;
74 }
75
76 if ( sant == 1 )
77 {
78 texturepointer=ftexturedata[0]->getpointertexture();
79 }
80 else
81 {
82 ftexturedata=vtexturedata;
83
84 if (howfair == 0)
85 {
86 ftexturedata[0] = new TextureData(texturedataname);
87 ftexturedata[0]->name= new char[sizeof_text(texturedataname)];
88 copy_text(texturedataname,ftexturedata[0]->name);
89 texturepointer=ftexturedata[0]->getpointertexture();
90 lasttexturedata[0]=ftexturedata[0];
91 howfair++;
92 }
93 else
94 {
95 ftexturedata=lasttexturedata[0]->texturedata_next;
96 ftexturedata[0] = new TextureData(texturedataname);
97 ftexturedata[0]->name= new char[sizeof_text(texturedataname)];
98 copy_text(texturedataname,ftexturedata[0]->name);
99 texturepointer=ftexturedata[0]->getpointertexture();
100 lasttexturedata[0]=ftexturedata[0];
101 howfair++;
102 }
103 }
104
105 return texturepointer;
106 }

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26