Subversion Repositories gelsvn

Rev

Rev 102 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 102 Rev 136
Line 37... Line 37...
37
 
37
 
38
    void coord_index_to_face_vec(const vector<int>& coord_index, 
38
				void coord_index_to_face_vec(const vector<int>& coord_index, 
39
																 vector<int>& faces,
39
																		 vector<int>& faces,
40
																 vector<int>& indices)
40
																		 vector<int>& indices)
41
    {
41
				{
42
      int tri=0;
-
 
43
      Face face;
42
						Face face;
44
			int k=0;
43
						size_t k=0;
45
      for(int i=0;i<coord_index.size();i++) 
44
						for(size_t i=0;i<coord_index.size();i++) 
46
				{
45
						{
47
					int idx = coord_index[i];
46
								int idx = coord_index[i];
48
					if (idx==-1) 
47
								if (idx==-1) 
49
						{
48
								{
50
							faces.push_back(k);
49
										faces.push_back(k);
Line 98... Line 97...
98
      {
97
				{
99
				cout << "Shape ends" << endl;				
98
						cout << "Shape ends" << endl;				
100
      } 
99
				} 
101
  }
100
		}
102
 
101
 
-
 
102
		int find_last_of(const std::string& F, const std::string& C)
-
 
103
		{
-
 
104
				size_t pos = F.find_last_of(C);
-
 
105
				if (pos == string::npos) 
-
 
106
						return -1;
-
 
107
				return pos;
-
 
108
		}
-
 
109
 
103
  bool x3d_load(const std::string& filename, Manifold& mani) 
110
		bool x3d_load(const std::string& filename, Manifold& mani) 
104
  {
111
		{
105
		faces.clear();
112
				faces.clear();
106
		indices.clear();
113
				indices.clear();
107
		vertices.clear();
114
				vertices.clear();
108
 
115
 
109
    Timer tim;
116
				Timer tim;
110
    tim.start();
117
				tim.start();
111
 
118
 
112
    std::string baseurl;
119
				std::string baseurl;
113
#define FIND_LAST_OF(F,C) (int)(F.find_last_of(C) == string::npos ? -1 : F.find_last_of(C))	
120
				int idx = s_max(find_last_of(filename, "\\"), 
114
    int idx = max(FIND_LAST_OF(filename, "\\"), FIND_LAST_OF(filename, "/"));
121
												find_last_of(filename, "/"));
115
#undef FIND_LAST_OF
-
 
-
 
122
 
116
 
123
 
117
    if(idx != -1)
124
				if(idx != -1)
118
      baseurl = std::string(filename.substr(0, idx+1));
125
						baseurl = std::string(filename.substr(0, idx+1));
119
 
126
 
120
 
127
 
Line 130... Line 137...
130
    }
137
				}
131
 
138
 
132
    struct stat stat_buf;
139
				struct stat stat_buf;
133
    fstat(in, &stat_buf);
140
				fstat(in, &stat_buf);
134
 
141
 
135
    const int BUF_SIZE = s_min(5000000, static_cast<int>(stat_buf.st_size));
142
				const size_t BUF_SIZE = s_min(5000000, static_cast<int>(stat_buf.st_size));
136
    char* buf2 = new char[BUF_SIZE];
143
				char* buf2 = new char[BUF_SIZE];
137
    size_t len;
144
				size_t len;
138
    do {
145
				do {
139
      len = read(in, buf2, BUF_SIZE);
146
						len = read(in, buf2, BUF_SIZE);
140
      if (len!=BUF_SIZE)
147
						if (len!=BUF_SIZE)