Changeset 953 for GTP/trunk/Lib/Illum/GPUObscurancesGT/src
- Timestamp:
- 05/12/06 16:00:21 (19 years ago)
- Location:
- GTP/trunk/Lib/Illum/GPUObscurancesGT/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/GPUObscurancesGT/src/CMesh.cpp
r930 r953 95 95 } 96 96 97 float CMesh::getValue(const char *string, int &i) 98 { 99 int j = 0; 100 float value; 101 char substring[100]; 102 103 while ((string[i] != ' ') && (string[i] != '\0')) 104 { 105 substring[j] = string[i]; 106 i++; 107 j++; 108 } 109 110 substring[j] = '\0'; 111 112 value = atof(substring); 113 114 return (value); 115 116 } 117 97 118 void CMesh::XMLToSNStr(char *name) 98 119 { 99 120 int i = 0, j = 0, k; 100 bool cont = true; 121 const char *string; 122 bool cont = true, color = false; 101 123 102 124 // Read root element and decide from there what type 103 125 String response; 126 String::iterator iter; 127 104 128 TiXmlDocument* doc = new TiXmlDocument(name); 105 129 // Some double-parsing here but never mind … … 194 218 tri = tri->FirstChildElement("vertexbuffer"); 195 219 220 const char *cad = tri->Attribute("colours_diffuse"); 221 222 if (!strcmp(cad, "true")) color = true; 223 224 196 225 m_pObject._geo[0]._triSet[i]._numVer = NVer; 197 226 … … 225 254 m_pObject._geo[0]._triSet[i]._tex[2 * j + 1] = atof(aux1->Attribute("v")); 226 255 227 /*->aux1 = aux->FirstChildElement("colour_diffuse");256 aux1 = aux->FirstChildElement("colour_diffuse"); 228 257 response = aux1->Attribute("value"); 229 /*->m_pObject._geo[0]._triSet[i]._ver[3 * j] = atof(aux1->Attribute("x")); 230 m_pObject._geo[0]._triSet[i]._ver[3 * j + 1] = atof(aux1->Attribute("y")); 231 m_pObject._geo[0]._triSet[i]._ver[3 * j + 2] = atof(aux1->Attribute("z"));*/ 232 233 m_pObject._geo[0]._triSet[i]._refl[3 * j] = 0.5; 234 m_pObject._geo[0]._triSet[i]._refl[3 * j + 1] = 0.5; 235 m_pObject._geo[0]._triSet[i]._refl[3 * j + 2] = 0.5; 258 259 if (color) 260 { 261 string = response.c_str(); 262 k = 0; 263 m_pObject._geo[0]._triSet[i]._refl[3 * j] = getValue(string, k); 264 k++; 265 m_pObject._geo[0]._triSet[i]._refl[3 * j + 1] = getValue(string, k); 266 k++; 267 m_pObject._geo[0]._triSet[i]._refl[3 * j + 2] = getValue(string, k); 268 k++; 269 getValue(string, k); 270 } 271 else 272 { 273 m_pObject._geo[0]._triSet[i]._refl[3 * j] = 0.5; 274 m_pObject._geo[0]._triSet[i]._refl[3 * j + 1] = 0.5; 275 m_pObject._geo[0]._triSet[i]._refl[3 * j + 2] = 0.5; 276 } 236 277 237 278 aux = aux->NextSiblingElement(); -
GTP/trunk/Lib/Illum/GPUObscurancesGT/src/MyFrame.cpp
r930 r953 226 226 float r_float; 227 227 228 i = 0; 229 j = 0; 230 while (i < (res * res * 4)) 228 for (i = 0, j = 0; i < (res * res * 4); i += 4, j += 3) 231 229 { 232 230 r_float = ObscuranceMap[i] * 255; … … 236 234 r_float = ObscuranceMap[i+2] * 255; 237 235 bmp[j + 2] = uchar(r_float); 238 239 j += 3;240 i += 4;241 236 } 242 237
Note: See TracChangeset
for help on using the changeset viewer.