53 std::stringstream result;
54 result << std::hex << FastHash(key, len);
60 std::string str_in(buffer);
66 wchar_t tmp[128] = L
"";
67 const wchar_t* si_prefix[] = {L
"B", L
"KB", L
"MB", L
"GB", L
"TB", L
"EB", L
"ZB", L
"YB"};
69 int c = bytes > 0 ? std::min((
int)(
log(bytes) /
log((
float)base)), (
int)
sizeof(si_prefix) - 1) : 0;
70 swprintf(tmp, 128, L
"%1.2f %ls", bytes / pow((
float)base, c), si_prefix[c]);
71 return UTFString(tmp);
84 sprintf(tmp,
"Rigs of Rods\n"
86 " protocol version: %s\n"
87 " build time: %s, %s\n"
98 Real
RoR::Round(Ogre::Real value,
unsigned short ndigits )
108 value = std::floor(value + 0.5f);
110 value = std::ceil(value - 0.5f);
121 utf8::replace_invalid(str_in.begin(), str_in.end(), std::back_inserter(str_out));
129 end = (start + strlen(start));
134 utf8::replace_invalid(start, end, std::back_inserter(str_out));
141 sha1.
UpdateHash((uint8_t *)input.c_str(), (
int)input.length());
149 for (String& tok : tokens)
160 return a.squaredDistance(b) <= max * max;
165 const VertexElement* ve = vertexDeclaration->getElement(j);
166 text <<
"\n" <<
"\telement #" << (j) <<
"/" << (vertexDeclaration->getElementCount());
167 text <<
" binding:" << (ve->getSource());
168 text <<
", offset:" << (ve->getOffset());
169 text <<
", type:" << (ve->getType());
170 text <<
", semantic:" << (ve->getSemantic());
171 text <<
", size:" << (ve->getSize());
179 if (mesh->sharedVertexData)
181 text <<
"\n" <<(
"Mesh has Shared Vertices:");
182 VertexData* vt=mesh->sharedVertexData;
183 for (
int j=0; j<(int)vt->vertexDeclaration->getElementCount(); j++)
188 text <<
"\n" <<(
"Mesh has "+
TOSTRING(mesh->getNumSubMeshes())+
" submesh(es)");
189 for (
int i=0; i<mesh->getNumSubMeshes(); i++)
191 SubMesh* submesh = mesh->getSubMesh(i);
192 text <<
"\n" <<(
"SubMesh "+
TOSTRING(i)+
": uses shared?:"+
TOSTRING(submesh->useSharedVertices));
193 if (!submesh->useSharedVertices)
195 VertexData* vt=submesh->vertexData;
196 for (
int j=0; j<(int)vt->vertexDeclaration->getElementCount(); j++)
203 return text.ToCStr();
208 StringVector
files = StringUtil::split(cvar->
getStr(),
",");
211 files.push_back(filename);
218 StringVector
files = StringUtil::split(cvar->
getStr(),
",");
219 auto found = (std::find(
files.begin(),
files.end(), filename));
220 if (found !=
files.end())
230 size_t pos = bundleQualifiedFilename.find(
':');
231 if (pos != std::string::npos)
233 out_bundleName = bundleQualifiedFilename.substr(0, pos);
234 out_filename = bundleQualifiedFilename.substr(pos + 1);
239 out_filename = bundleQualifiedFilename;